:root {
  color-scheme: light;
  --ink: #172321;
  --muted: #5f6e69;
  --paper: #f6f7f2;
  --panel: #ffffff;
  --line: #d9e0db;
  --teal: #086c67;
  --teal-dark: #064f4b;
  --mint: #d7efe8;
  --coral: #d94f3d;
  --gold: #e2b045;
  --leaf: #6e9f50;
  --shadow: 0 14px 34px rgba(19, 36, 34, 0.13);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  height: 100%;
  min-width: 0;
  background: var(--paper);
  overflow: hidden;
}

body {
  height: 100%;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(8, 108, 103, 0.12), transparent 34%),
    radial-gradient(circle at 86% 14%, rgba(226, 176, 69, 0.20), transparent 26%),
    var(--paper);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
}

.app {
  width: min(1120px, 100%);
  height: 100vh;
  min-height: 0;
  margin: 0 auto;
  padding: 18px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.topbar,
.panel-heading,
.score-strip,
.open-row,
.ending-actions,
.report-stats {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.75rem, 3vw, 2.65rem);
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 1.1rem;
  line-height: 1.15;
}

h3 {
  margin-bottom: 7px;
  font-size: 1.1rem;
  line-height: 1.2;
}

.game-shell {
  display: grid;
  gap: 14px;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding-bottom: 18px;
  scrollbar-gutter: stable;
}

.score-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.metric {
  min-width: 0;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 7px 20px rgba(19, 36, 34, 0.07);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.metric strong {
  display: block;
  margin-top: 2px;
  font-size: clamp(1rem, 2vw, 1.35rem);
  line-height: 1.05;
}

.play-area {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(310px, 0.82fr);
  gap: 14px;
  align-items: start;
}

.plan-panel,
.cafe-panel,
.ending-panel,
.forecast-card,
.report-panel,
.log-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.plan-panel {
  min-width: 0;
  padding: 16px;
}

.panel-heading {
  justify-content: space-between;
  gap: 14px;
}

.panel-heading.small {
  align-items: flex-start;
}

.run-id,
.tag {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 9px;
  color: var(--teal-dark);
  background: var(--mint);
  font-size: 0.73rem;
  font-weight: 850;
}

.forecast-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  margin-top: 14px;
  padding: 14px;
  background:
    linear-gradient(135deg, rgba(215, 239, 232, 0.75), rgba(255, 255, 255, 0.86)),
    #ffffff;
}

.forecast-copy p,
.report-panel p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.forecast-numbers {
  display: grid;
  grid-template-columns: repeat(2, minmax(74px, 1fr));
  gap: 8px;
  margin: 0;
}

.forecast-numbers div {
  padding: 10px;
  border: 1px solid rgba(8, 108, 103, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.forecast-numbers dt {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
}

.forecast-numbers dd {
  margin: 2px 0 0;
  font-size: 1.12rem;
  font-weight: 900;
}

.choices {
  display: grid;
  gap: 13px;
  margin-top: 15px;
}

.choice-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.choice-field legend {
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 850;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.choice-button {
  min-width: 0;
  min-height: 78px;
  padding: 10px;
  color: var(--ink);
  background: #f8faf6;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.choice-button:hover,
.choice-button:focus-visible {
  border-color: var(--teal);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(8, 108, 103, 0.16);
  transform: translateY(-1px);
}

.choice-button[aria-pressed="true"] {
  color: #ffffff;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  border-color: var(--teal-dark);
}

.choice-button strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 0.92rem;
  line-height: 1.12;
}

.choice-button span {
  display: block;
  margin-top: 5px;
  color: inherit;
  font-size: 0.76rem;
  line-height: 1.24;
  opacity: 0.83;
}

.open-row {
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.open-row p {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 800;
}

.primary-button,
.ghost-button {
  min-height: 42px;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 900;
  cursor: pointer;
}

.primary-button {
  color: #ffffff;
  background: var(--coral);
  box-shadow: 0 10px 22px rgba(217, 79, 61, 0.24);
}

.primary-button:hover,
.primary-button:focus-visible {
  outline: 0;
  background: #c94031;
}

.ghost-button {
  color: var(--teal-dark);
  background: #ffffff;
  border: 1px solid var(--line);
}

.ghost-button:hover,
.ghost-button:focus-visible {
  outline: 0;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 108, 103, 0.14);
}

.cafe-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.82);
}

.cafe-art {
  position: relative;
  min-height: 192px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #d7efe8 0 48%, #ffffff 48% 100%);
}

.awning {
  position: absolute;
  inset: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: 46px;
}

.awning span:nth-child(odd) {
  background: var(--coral);
}

.awning span:nth-child(even) {
  background: #ffffff;
}

.window-scene {
  position: absolute;
  inset: 50px 18px 16px;
  overflow: hidden;
  border: 5px solid var(--ink);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.48) 0 1px, transparent 1px 50%),
    linear-gradient(180deg, #f7fbff 0 42%, #d7efe8 42% 100%);
  background-size: 50% 100%, auto;
}

.counter {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 38px;
  background: var(--gold);
  border-top: 5px solid var(--ink);
}

.cup {
  position: absolute;
  left: 42%;
  bottom: 35px;
  width: 54px;
  height: 42px;
  border-radius: 0 0 15px 15px;
  background: #ffffff;
  border: 5px solid var(--ink);
}

.cup::after {
  content: "";
  position: absolute;
  right: -20px;
  top: 10px;
  width: 19px;
  height: 18px;
  border: 5px solid var(--ink);
  border-left: 0;
  border-radius: 0 18px 18px 0;
}

.steam {
  position: absolute;
  bottom: 86px;
  width: 16px;
  height: 44px;
  border-left: 4px solid rgba(8, 108, 103, 0.42);
  border-radius: 50%;
}

.steam-one {
  left: 45%;
  transform: rotate(12deg);
}

.steam-two {
  left: 53%;
  transform: rotate(-12deg);
}

.shelf {
  position: absolute;
  height: 9px;
  width: 68px;
  background: var(--ink);
}

.shelf-one {
  left: 20px;
  top: 38px;
}

.shelf-two {
  right: 22px;
  top: 66px;
}

.plant {
  position: absolute;
  right: 36px;
  bottom: 35px;
  width: 22px;
  height: 32px;
  background: var(--leaf);
  border-radius: 22px 22px 4px 4px;
  box-shadow: -12px 9px 0 #89b66d, 13px 7px 0 #5f9147;
}

.report-panel,
.log-panel {
  padding: 13px;
  box-shadow: none;
}

.report-stats {
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.report-stats span {
  border-radius: 999px;
  padding: 6px 9px;
  background: #f1f5f0;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
}

.day-log {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--muted);
}

.day-log li {
  padding-left: 3px;
  line-height: 1.35;
}

.ending-panel {
  padding: 18px;
}

.ending-panel[hidden] {
  display: none;
}

.ending-copy p {
  color: var(--muted);
}

.share-card {
  overflow-x: auto;
  margin: 14px 0;
  padding: 14px;
  border-radius: 8px;
  background: #172321;
  color: #f6f7f2;
  white-space: pre-wrap;
  line-height: 1.45;
}

.copy-status {
  min-height: 1.4em;
  margin: 8px 0 0;
  color: var(--teal-dark);
  font-weight: 800;
}

@media (max-width: 760px) {
  .app {
    padding: 10px;
  }

  .topbar {
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
  }

  h1 {
    font-size: 1.5rem;
  }

  h2,
  h3 {
    font-size: 0.98rem;
  }

  .eyebrow {
    font-size: 0.66rem;
  }

  .score-strip {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
  }

  .metric:first-child {
    grid-column: auto;
  }

  .metric {
    padding: 7px 6px;
  }

  .metric span {
    font-size: 0.62rem;
  }

  .metric strong {
    font-size: 0.92rem;
  }

  .play-area,
  .forecast-card {
    grid-template-columns: 1fr;
  }

  .play-area,
  .game-shell {
    gap: 10px;
  }

  .plan-panel {
    padding: 10px;
  }

  .forecast-card {
    margin-top: 9px;
    padding: 10px;
    gap: 9px;
  }

  .forecast-copy p,
  .report-panel p {
    font-size: 0.84rem;
    line-height: 1.34;
  }

  .forecast-numbers div {
    padding: 7px;
  }

  .choices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 10px;
  }

  .choice-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .choice-button {
    min-height: 56px;
    padding: 7px;
  }

  .choice-button strong {
    font-size: 0.78rem;
  }

  .choice-button span {
    margin-top: 4px;
    font-size: 0.66rem;
  }

  .open-row {
    margin-top: 10px;
  }

  .primary-button,
  .ghost-button {
    min-height: 38px;
    padding: 8px 10px;
  }

  .ending-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .ending-actions .primary-button,
  .ending-actions .ghost-button {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .topbar,
  .open-row {
    align-items: stretch;
    flex-direction: column;
  }

  .score-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric:first-child {
    grid-column: span 2;
  }

  .choices,
  .choice-grid {
    grid-template-columns: 1fr;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
  }
}

@media (min-width: 761px) and (max-width: 900px) {
  .play-area {
    grid-template-columns: 1fr;
  }
}
