:root {
  color-scheme: light;
  --ink: #203333;
  --muted: #61706d;
  --paper: #f5eddb;
  --cream: #fff9ea;
  --line: #dcccae;
  --green: #527c59;
  --deep-green: #284f4b;
  --gold: #d4953c;
  --rust: #a04f38;
  --blue: #43809a;
  font-family: "Nunito", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: #d7e2d7;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.5), transparent 24rem),
    linear-gradient(135deg, #c8d7c8, #e8e0c8);
}

button {
  font: inherit;
  cursor: pointer;
}

.game-shell {
  width: min(1500px, calc(100% - 32px));
  margin: 16px auto;
}

.topbar,
.resource-strip,
.play-layout {
  display: flex;
  gap: 12px;
}

.topbar {
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 10px;
}

.eyebrow,
.panel-kicker {
  margin: 0;
  color: var(--rust);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-family: "IM Fell English", Georgia, serif;
  font-size: 35px;
  font-weight: 400;
}

h2 {
  margin: 4px 0 8px;
  font-size: 20px;
}

.date-card {
  display: flex;
  gap: 9px;
  align-items: baseline;
  padding: 8px 16px;
  color: var(--cream);
  border-radius: 18px;
  background: var(--deep-green);
  box-shadow: 0 4px 0 rgba(32, 51, 51, 0.14);
}

.date-card span {
  font-size: 14px;
  font-weight: 800;
}

.date-card strong {
  font-family: "IM Fell English", Georgia, serif;
  font-size: 25px;
  font-weight: 400;
}

.resource-strip {
  margin-bottom: 12px;
}

.resource {
  display: flex;
  min-width: 96px;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid rgba(108, 92, 60, 0.18);
  border-radius: 14px;
  background: rgba(255, 249, 234, 0.92);
}

.resource-dot {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(32, 51, 51, 0.25);
  border-radius: 50%;
}

.resource-label {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.resource strong {
  font-size: 17px;
}

.canvas-wrap {
  position: relative;
  overflow: hidden;
  flex: 1;
  min-width: 0;
  border: 7px solid rgba(255, 249, 234, 0.9);
  border-radius: 23px;
  background: #b9d7cb;
  box-shadow: 0 12px 24px rgba(44, 77, 71, 0.17);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1040 / 700;
}

.map-tip {
  position: absolute;
  bottom: 14px;
  left: 14px;
  max-width: 520px;
  padding: 8px 12px;
  color: #fff9ea;
  border-radius: 10px;
  background: rgba(32, 51, 51, 0.88);
  font-size: 13px;
  font-weight: 800;
}

.sidebar {
  width: 315px;
  flex: 0 0 315px;
}

.panel {
  margin-bottom: 11px;
  padding: 14px;
  border: 1px solid rgba(108, 92, 60, 0.18);
  border-radius: 17px;
  background: rgba(255, 249, 234, 0.94);
  box-shadow: 0 5px 12px rgba(53, 70, 59, 0.08);
}

.goal-panel p {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.goal-meter {
  overflow: hidden;
  height: 9px;
  margin-top: 10px;
  border-radius: 99px;
  background: #e4dcc9;
}

.goal-meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #598861, #d4953c);
  transition: width 250ms ease;
}

.goal-progress {
  margin-top: 7px;
  font-size: 11px !important;
  font-weight: 900;
  text-transform: uppercase;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quiet-button {
  color: var(--rust);
  border: 0;
  background: transparent;
  font-size: 12px;
  font-weight: 900;
}

.build-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.build-card {
  min-height: 78px;
  padding: 8px;
  text-align: left;
  border: 2px solid transparent;
  border-radius: 11px;
  background: #f0e7d4;
}

.build-card:hover:not(:disabled),
.build-card.selected {
  border-color: var(--gold);
  background: #fff4d7;
}

.build-card:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.build-card strong,
.build-card small {
  display: block;
}

.build-card strong {
  color: var(--ink);
  font-size: 13px;
}

.build-card small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}

.turn-button,
.expansion-button,
.improvement-button,
.journal-button,
.report-button,
.guide-button,
.primary-button {
  width: 100%;
  color: white;
  border: 0;
  border-radius: 14px;
  background: var(--rust);
  box-shadow: 0 5px 0 #713728;
  font-weight: 900;
}

.turn-button {
  padding: 13px;
}

.expansion-button {
  margin-bottom: 13px;
  padding: 12px;
  color: #fff9ea;
  background: var(--deep-green);
  box-shadow: 0 5px 0 #1d3937;
}

.expansion-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.expansion-button.ready {
  color: #fff9ea;
  background: #b47735;
  box-shadow: 0 5px 0 #805021;
}

.expansion-button.claimed {
  color: var(--deep-green);
  background: #dfe8cf;
  box-shadow: 0 4px 0 #bdc9ac;
  opacity: 1;
}

.expansion-button span,
.expansion-button small {
  display: block;
}

.improvement-button {
  margin-bottom: 13px;
  padding: 12px;
  color: var(--deep-green);
  border: 2px solid rgba(40, 79, 75, 0.22);
  background: #e7eddd;
  box-shadow: 0 4px 0 #bcc8ae;
}

.improvement-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.improvement-button span,
.improvement-button small {
  display: block;
}

.improvement-button small {
  margin-top: 4px;
  font-size: 10px;
  opacity: 0.85;
}

.expansion-button small {
  margin-top: 4px;
  font-size: 10px;
  opacity: 0.85;
}

.turn-button small,
.turn-button span {
  display: block;
}

.turn-button small {
  margin-top: 4px;
  font-size: 10px;
  opacity: 0.8;
}

.journal-button {
  margin-top: 13px;
  padding: 11px;
  color: var(--deep-green);
  background: #e9d8af;
  box-shadow: 0 4px 0 #c1ae84;
}

.report-button {
  margin-top: 11px;
  padding: 10px;
  color: var(--deep-green);
  background: #dfe8cf;
  box-shadow: 0 4px 0 #bdc9ac;
}

.guide-button,
.start-guide-button {
  width: 100%;
  margin-top: 11px;
  padding: 10px;
  color: var(--deep-green);
  border: 2px solid rgba(40, 79, 75, 0.28);
  border-radius: 12px;
  background: rgba(255, 249, 234, 0.82);
  font-weight: 900;
}

.start-guide-button {
  color: var(--rust);
  border-color: rgba(160, 79, 56, 0.28);
  background: transparent;
}

.start-screen,
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: rgba(21, 40, 40, 0.7);
}

.start-screen {
  background:
    linear-gradient(90deg, rgba(19, 44, 45, 0.88), rgba(25, 48, 44, 0.3)),
    url("assets/title-farmstead.png") center / cover;
}

.start-card {
  width: 520px;
  margin-right: min(43vw, 650px);
  padding: 28px;
  color: var(--ink);
  border: 1px solid rgba(255, 249, 234, 0.65);
  border-radius: 22px;
  background: rgba(255, 249, 234, 0.94);
  box-shadow: 0 18px 50px rgba(12, 29, 30, 0.28);
}

.start-card h2 {
  margin: 3px 0 -8px;
  color: var(--deep-green);
  font-family: "IM Fell English", Georgia, serif;
  font-size: 76px;
  font-weight: 400;
  line-height: 0.95;
}

.start-card h3 {
  margin-bottom: 15px;
  color: var(--rust);
  font-family: "IM Fell English", Georgia, serif;
  font-size: 30px;
  font-weight: 400;
}

.start-card p {
  color: #4b5a57;
  line-height: 1.55;
}

.start-grid {
  display: flex;
  gap: 8px;
  margin: 18px 0;
}

.start-grid span {
  padding: 6px 8px;
  color: var(--deep-green);
  border-radius: 99px;
  background: #e7eddd;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.primary-button {
  padding: 13px 17px;
}

.hidden {
  display: none !important;
}

.modal {
  width: min(580px, calc(100vw - 32px));
  padding: 23px;
  border: 5px solid #f5eddb;
  border-radius: 20px;
  background: #fff9ea;
  box-shadow: 0 16px 45px rgba(12, 29, 30, 0.32);
}

.modal h2 {
  color: var(--deep-green);
  font-family: "IM Fell English", Georgia, serif;
  font-size: 35px;
  font-weight: 400;
}

.modal p,
.modal li {
  color: #51635f;
  font-size: 14px;
  line-height: 1.48;
}

.modal-actions {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.choice-button {
  padding: 11px 12px;
  text-align: left;
  color: var(--ink);
  border: 2px solid #e3d6bb;
  border-radius: 11px;
  background: #f7efd9;
  font-weight: 800;
}

.choice-button:hover:not(:disabled) {
  border-color: var(--gold);
}

.choice-button:disabled {
  opacity: 0.5;
}

.modal-close {
  margin-top: 15px;
  padding: 10px 14px;
  color: white;
  border: 0;
  border-radius: 10px;
  background: var(--deep-green);
  font-weight: 900;
}

.history-list {
  padding-left: 20px;
}

.guide-list {
  padding-left: 21px;
}

.guide-list li {
  margin-bottom: 7px;
}

@media (min-width: 1181px) and (max-height: 950px) {
  .game-shell {
    width: min(1540px, calc(100% - 20px));
    margin: 0 auto;
  }

  .topbar,
  .resource-strip,
  .play-layout {
    gap: 8px;
  }

  .topbar {
    padding: 0 7px 4px;
  }

  h1 {
    font-size: 29px;
  }

  .eyebrow,
  .panel-kicker {
    font-size: 9px;
  }

  .date-card {
    padding: 5px 13px;
  }

  .date-card strong {
    font-size: 21px;
  }

  .resource-strip {
    margin-bottom: 7px;
  }

  .resource {
    min-width: 83px;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 11px;
  }

  .resource-dot {
    width: 10px;
    height: 10px;
  }

  .resource-label {
    font-size: 8px;
  }

  .resource strong {
    font-size: 15px;
  }

  .canvas-wrap {
    border-width: 5px;
    border-radius: 18px;
  }

  .play-layout {
    align-items: flex-start;
  }

  .map-tip {
    bottom: 10px;
    left: 10px;
    padding: 6px 9px;
    font-size: 11px;
  }

  .sidebar {
    width: 350px;
    flex-basis: 350px;
  }

  .panel {
    margin-bottom: 6px;
    padding: 9px;
    border-radius: 13px;
  }

  .goal-panel h2,
  .build-panel h2 {
    margin: 2px 0 4px;
    font-size: 17px;
  }

  .goal-panel p {
    margin-bottom: 4px;
    font-size: 11px;
    line-height: 1.24;
  }

  .goal-meter {
    height: 7px;
    margin-top: 6px;
  }

  .goal-progress {
    margin-top: 5px !important;
    font-size: 9px !important;
  }

  .quiet-button {
    font-size: 10px;
  }

  .build-list {
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
  }

  .build-card {
    min-height: 53px;
    padding: 6px;
    border-radius: 9px;
  }

  .build-card strong {
    font-size: 11px;
  }

  .build-card small {
    margin-top: 2px;
    font-size: 8px;
    line-height: 1.16;
  }

  .expansion-button,
  .improvement-button {
    margin-bottom: 6px;
    padding: 7px;
    border-radius: 11px;
  }

  .turn-button {
    padding: 8px;
    border-radius: 11px;
  }

  .expansion-button small,
  .improvement-button small,
  .turn-button small {
    margin-top: 2px;
    font-size: 8px;
  }

  .journal-button {
    margin-top: 7px;
    padding: 7px;
    border-radius: 11px;
  }

  .report-button {
    margin-top: 7px;
    padding: 7px;
    border-radius: 11px;
    font-size: 10px;
  }

  .guide-button {
    margin-top: 7px;
    padding: 6px;
    border-radius: 11px;
  }
}

@media (max-width: 1180px) {
  .resource-strip {
    flex-wrap: wrap;
  }

  .play-layout {
    flex-direction: column;
  }

  .sidebar {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(220px, 0.9fr) minmax(410px, 1.5fr);
    gap: 11px;
  }

  .sidebar .panel {
    margin-bottom: 0;
  }

  .build-panel {
    grid-row: span 3;
  }

  .journal-button,
  .report-button,
  .guide-button,
  .expansion-button,
  .improvement-button,
  .turn-button {
    margin-top: 0;
  }
}

@media (max-width: 720px) {
  .game-shell {
    width: min(100% - 16px, 700px);
    margin: 8px auto;
  }

  .topbar {
    align-items: flex-start;
  }

  h1 {
    font-size: 27px;
  }

  .resource {
    min-width: 82px;
    padding: 7px 9px;
  }

  .sidebar {
    display: block;
  }

  .sidebar .panel {
    margin-bottom: 11px;
  }

  .start-card {
    width: min(94vw, 520px);
    margin-right: 0;
    padding: 22px;
  }

  .start-card h2 {
    font-size: 61px;
  }
}
