:root {
  color-scheme: light;
  --ink: #18201f;
  --muted: #5f6964;
  --paper: #f7f1e6;
  --surface: #fffaf0;
  --line: #d8cdbb;
  --forest: #18312d;
  --green: #3d7c55;
  --blue: #326a8f;
  --amber: #b77828;
  --red: #a2443e;
  --shadow: 0 18px 60px rgba(24, 32, 31, 0.16);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(24, 49, 45, 0.08), rgba(247, 241, 230, 0) 280px),
    var(--paper);
}

button {
  font: inherit;
}

.app-shell {
  width: min(1480px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto;
  gap: 18px;
  align-items: end;
  justify-content: space-between;
  padding: 10px 0 20px;
}

.screen-nav {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(84px, 1fr));
  gap: 6px;
  padding: 5px;
  border: 1px solid rgba(24, 49, 45, 0.14);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.72);
}

.screen-button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  color: var(--forest);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 850;
  background: transparent;
}

.screen-button.is-active {
  color: var(--surface);
  background: var(--forest);
}

.eyebrow,
.scene-kicker {
  margin: 0 0 6px;
  color: var(--amber);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  gap: 20px;
  align-items: start;
}

.scene-stage {
  display: grid;
  grid-template-rows: minmax(300px, 42vh) auto auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.scene-art {
  min-height: 300px;
  background-color: #d7ded4;
  background-position: center;
  background-size: cover;
}

.scene-copy {
  padding: 24px 28px 12px;
}

.scene-copy h2 {
  margin-bottom: 10px;
  font-size: clamp(1.7rem, 3vw, 3rem);
  line-height: 1;
}

.scene-body {
  max-width: 74ch;
  margin-bottom: 0;
  color: #31403b;
  font-size: 1.05rem;
  line-height: 1.65;
}

.choice-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  padding: 18px 20px 22px;
}

.choice-button,
.secondary-button,
.tab-button {
  cursor: pointer;
}

.choice-button {
  display: grid;
  min-height: 158px;
  padding: 16px;
  border: 1px solid rgba(24, 49, 45, 0.18);
  border-radius: 8px;
  color: var(--ink);
  text-align: left;
  background: #fffdf7;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.choice-button:hover,
.choice-button:focus-visible {
  border-color: var(--green);
  box-shadow: 0 10px 24px rgba(24, 32, 31, 0.12);
  transform: translateY(-2px);
}

.choice-title {
  display: block;
  align-self: start;
  font-weight: 850;
  line-height: 1.2;
}

.choice-summary {
  display: block;
  align-self: center;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.38;
}

.choice-preview {
  display: block;
  align-self: end;
  color: var(--blue);
  font-size: 0.82rem;
  font-weight: 800;
}

.ledger {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 14px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.92);
  box-shadow: 0 14px 40px rgba(24, 32, 31, 0.1);
}

.ledger-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.tab-button {
  min-height: 38px;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  background: transparent;
}

.tab-button.is-active {
  border-color: rgba(24, 49, 45, 0.14);
  color: var(--surface);
  background: var(--forest);
}

.tab-panel {
  display: grid;
  gap: 10px;
}

.meter-row {
  display: grid;
  gap: 7px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(216, 205, 187, 0.72);
}

.meter-label {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: #33423e;
  font-size: 0.92rem;
  font-weight: 800;
}

.meter-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4dacb;
}

.meter-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.tone-green {
  background: var(--green);
}

.tone-blue {
  background: var(--blue);
}

.tone-amber {
  background: var(--amber);
}

.compact-record {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid rgba(24, 49, 45, 0.12);
  border-radius: 8px;
  background: #fffdf7;
}

.compact-record h3 {
  margin-bottom: 3px;
  font-size: 1rem;
}

.compact-record p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.compact-record dl {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 0;
}

.compact-record dl div {
  min-width: 0;
  padding: 8px;
  border-radius: 7px;
  background: #f2eadc;
}

.compact-record dt {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.compact-record dd {
  margin: 1px 0 0;
  font-weight: 850;
}

.record-note {
  color: #40504b;
}

.auction-screen {
  display: grid;
  gap: 16px;
}

.auction-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  padding: 18px 0 4px;
}

.auction-toolbar h2 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 3.2vw, 3.4rem);
  line-height: 1;
}

.auction-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(112px, 1fr));
  gap: 8px;
  align-items: center;
}

.primary-action {
  color: var(--surface);
  background: var(--forest);
}

.primary-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.auction-board {
  display: grid;
  gap: 14px;
}

.auction-status {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(24, 49, 45, 0.14);
  border-radius: 8px;
  color: #354541;
  font-weight: 750;
  background: #fffdf7;
}

.auction-status.is-settled {
  border-color: rgba(61, 124, 85, 0.42);
  color: #1f5136;
  background: #eef6ed;
}

.auction-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(250px, 1fr));
  gap: 12px;
  align-items: start;
}

.auction-property {
  display: grid;
  gap: 9px;
  padding: 13px;
  border: 1px solid rgba(24, 49, 45, 0.12);
  border-radius: 8px;
  background: #fffdf7;
}

.auction-property.is-overdemanded {
  border-color: rgba(162, 68, 62, 0.42);
  box-shadow: inset 0 0 0 1px rgba(162, 68, 62, 0.08);
}

.auction-property.is-partially-overdemanded {
  border-color: rgba(183, 120, 40, 0.46);
  box-shadow: inset 0 0 0 1px rgba(183, 120, 40, 0.09);
}

.auction-property-header {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.auction-property-header img {
  width: 82px;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid rgba(24, 49, 45, 0.12);
  border-radius: 8px;
  background: #d7ded4;
}

.auction-property-header h3 {
  margin-bottom: 3px;
  font-size: 1rem;
}

.auction-property-header p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.demand-badge {
  align-self: start;
  min-width: 92px;
  padding: 7px 8px;
  border-radius: 999px;
  color: var(--surface);
  font-size: 0.7rem;
  font-weight: 850;
  line-height: 1.05;
  text-align: center;
  background: var(--green);
}

.auction-property.is-overdemanded .demand-badge {
  background: var(--red);
}

.auction-property.is-partially-overdemanded .demand-badge {
  background: var(--amber);
}

.rent-control {
  display: grid;
  grid-template-columns: 42px minmax(84px, 1fr) 42px;
  gap: 6px;
  align-items: stretch;
}

.rent-control button {
  min-height: 42px;
  border: 1px solid rgba(24, 49, 45, 0.18);
  border-radius: 7px;
  color: var(--forest);
  cursor: pointer;
  font-weight: 850;
  background: #fffdf7;
}

.rent-control div {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 5px 8px;
  border-radius: 7px;
  color: var(--surface);
  background: var(--forest);
}

.rent-control span {
  font-size: 0.62rem;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
}

.rent-control strong {
  font-size: 1.3rem;
}

.bid-list {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bid-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 7px;
  color: #3b4b46;
  font-size: 0.86rem;
  background: #f2eadc;
  will-change: transform;
}

.bidder-avatar {
  width: 30px;
  aspect-ratio: 1;
  border: 1px solid rgba(24, 49, 45, 0.14);
  border-radius: 50%;
  background: #e7dccb;
  object-fit: cover;
}

.bid-row.is-column-leader {
  outline: 2px solid rgba(183, 120, 40, 0.42);
  background: #f7eddc;
}

.bid-row div {
  display: grid;
  gap: 2px;
}

.bid-row div:last-child {
  text-align: right;
}

.bid-row small {
  color: inherit;
  font-size: 0.68rem;
  font-weight: 800;
  opacity: 0.78;
  text-transform: uppercase;
}

.bid-row.is-winner {
  color: var(--surface);
  background: var(--green);
}

.bid-row.is-winner.is-column-leader {
  outline-color: rgba(24, 49, 45, 0.34);
}

.bid-row.is-empty,
.bidder-preference-card li.is-empty {
  justify-content: center;
  color: var(--muted);
  font-style: italic;
  text-align: center;
  background: #f5efe5;
}

.bidder-preference-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 10px;
}

.bidder-preference-card {
  padding: 12px;
  border: 1px solid rgba(24, 49, 45, 0.12);
  border-radius: 8px;
  background: #fffdf7;
}

.bidder-preference-card h3 {
  margin-bottom: 2px;
  font-size: 1rem;
}

.bidder-preference-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.bidder-card-header {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  margin-bottom: 10px;
}

.bidder-card-header .bidder-avatar {
  width: 34px;
}

.bidder-preference-card ol {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bidder-preference-card li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 7px;
  background: #f2eadc;
}

.journal-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 22px;
}

.journal-list li {
  color: #354541;
  line-height: 1.45;
}

.ledger-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.secondary-button {
  min-height: 42px;
  border: 1px solid rgba(24, 49, 45, 0.18);
  border-radius: 8px;
  color: var(--forest);
  font-weight: 850;
  background: #fffdf7;
}

.secondary-button:hover,
.secondary-button:focus-visible {
  border-color: var(--forest);
}

@media (max-width: 1120px) {
  .topbar,
  .game-layout {
    grid-template-columns: 1fr;
  }

  .ledger {
    position: static;
    max-height: none;
  }

  .auction-columns,
  .bidder-preference-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 12px;
  }

  h1 {
    font-size: 2.4rem;
  }

  .scene-stage {
    grid-template-rows: minmax(220px, 32vh) auto auto;
  }

  .scene-art {
    min-height: 220px;
  }

  .scene-copy {
    padding: 20px 18px 6px;
  }

  .choice-list {
    grid-template-columns: 1fr;
    padding: 12px 12px 16px;
  }

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

  .auction-toolbar {
    display: grid;
  }

  .auction-actions {
    grid-template-columns: 1fr;
  }
}
