:root {
  color-scheme: light;
  --ink: #1d2422;
  --muted: #62706c;
  --paper: #f6f4ed;
  --surface: #ffffff;
  --line: #d9ddd3;
  --green: #2f7d63;
  --teal: #2f6f7d;
  --gold: #b86f12;
  --red: #b84b3d;
  --violet: #69539f;
  --shadow: 0 16px 38px rgba(34, 40, 36, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(47, 125, 99, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(47, 111, 125, 0.08) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
.rules-link {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

button:hover:not(:disabled),
.rules-link:hover {
  transform: translateY(-1px);
  border-color: #9fb0a9;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

button.needs-sales:disabled {
  opacity: 0.86;
  border-color: rgba(184, 111, 18, 0.72);
  background: #fff4d6;
  color: #7a4a10;
  box-shadow: inset 0 0 0 1px rgba(184, 111, 18, 0.24);
}

button.ready-to-end:not(:disabled) {
  border-color: #b86f12;
  background: #b86f12;
  color: white;
  box-shadow: 0 0 0 3px rgba(184, 111, 18, 0.2), 0 10px 22px rgba(184, 111, 18, 0.24);
}

.primary-button {
  border-color: #1f5e4a;
  background: #1f5e4a;
  color: white;
}

.ghost-button {
  background: transparent;
}

.rules-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.primary-link {
  border-color: #1f5e4a;
  background: #1f5e4a;
  color: white;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(320px, auto) minmax(250px, auto);
  gap: 24px;
  align-items: center;
  padding: 18px clamp(16px, 3vw, 34px);
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand-lockup {
  display: flex;
  gap: 14px;
  align-items: center;
  min-width: 0;
}

.brand-mark {
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
}

.brand-mark rect {
  fill: #1f5e4a;
}

.brand-mark path,
.brand-mark circle {
  fill: none;
  stroke: #f7d38a;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

h1 {
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0;
}

.brand-lockup p,
.zone-header p,
.active-founder-block p,
.log-entry time {
  color: var(--muted);
}

.setup-panel {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.online-panel {
  display: grid;
  gap: 8px;
  justify-items: stretch;
}

.online-copy {
  display: grid;
  gap: 5px;
}

.online-copy span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.online-copy input {
  width: min(360px, 28vw);
  font-size: 12px;
}

.online-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

input,
select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 10px;
}

#player-names {
  width: min(320px, 48vw);
}

main {
  padding: 18px clamp(16px, 3vw, 34px) 34px;
}

.status-band {
  display: grid;
  grid-template-columns: 130px 150px minmax(240px, 1fr) minmax(260px, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.status-tile,
.ceo-draft,
.active-founder-block,
.turn-panel,
.adjust-panel,
.clients-panel,
.tracker-panel,
.hand-panel,
.market-panel,
.log-panel {
  background: rgba(255, 255, 255, 0.93);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.status-tile {
  min-height: 76px;
  padding: 13px 14px;
  display: grid;
  align-content: center;
  gap: 4px;
}

.status-tile span,
.active-founder-block > span,
.zone-header span,
.deck-count span,
.turn-counters span,
.tracker-meta,
.draft-kicker,
.log-entry time {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.status-tile strong {
  font-size: 23px;
  line-height: 1.1;
}

.trend-tile strong {
  font-size: 15px;
}

.score-readout {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.score-readout span {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfcf9;
  padding: 0 8px;
  color: #26322f;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.score-readout span.active {
  border-color: rgba(31, 94, 74, 0.38);
  background: #edf4f1;
  color: #1f5e4a;
}

.ceo-draft {
  padding: 16px;
  margin-bottom: 14px;
}

.draft-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 12px;
}

.draft-header h2 {
  font-size: 24px;
}

.draft-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
}

.ceo-option {
  min-height: 170px;
  display: grid;
  align-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf9;
}

.ceo-option h3 {
  font-size: 18px;
}

.ceo-option p {
  color: #4c5955;
  line-height: 1.35;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
  grid-template-areas: "active board";
  gap: 16px;
  align-items: start;
}

.active-rail {
  grid-area: active;
  position: sticky;
  top: 104px;
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 126px);
  overflow: auto;
}

.active-founder-block,
.turn-panel,
.adjust-panel,
.clients-panel,
.tracker-panel,
.hand-panel,
.market-panel,
.log-panel {
  padding: 13px;
}

.active-founder-block {
  display: grid;
  gap: 12px;
}

.active-founder-block strong {
  display: block;
  font-size: 26px;
  line-height: 1;
}

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

.resource-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #fbfcf9;
  border-radius: 999px;
  min-height: 28px;
  padding: 0 8px;
  font-size: 13px;
  white-space: nowrap;
}

.resource-card {
  min-height: 54px;
  display: grid;
  align-content: center;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf9;
  padding: 9px;
}

.resource-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

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

.money {
  color: #1f5e4a;
}

.widgets {
  color: #235d69;
}

.interest {
  color: #86510f;
}

.sales {
  color: #7a3327;
}

.hype {
  color: #594789;
}

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

.deck-count {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf9;
  padding: 9px;
}

.deck-count strong {
  display: block;
  font-size: 22px;
}

.turn-panel h2,
.adjust-panel h2,
.log-panel h2 {
  font-size: 16px;
  margin-bottom: 10px;
}

.turn-counters {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.turn-counters div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf9;
  padding: 10px;
}

.turn-counters strong {
  font-size: 27px;
}

.command-group {
  display: grid;
  gap: 8px;
}

.manual-action-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.adjust-grid {
  display: grid;
  gap: 8px;
}

.adjust-row {
  display: grid;
  grid-template-columns: 1fr 36px 36px;
  gap: 6px;
  align-items: center;
}

.adjust-row span {
  font-size: 13px;
  font-weight: 700;
}

.adjust-row button {
  min-height: 34px;
  padding: 0;
}

.board-zone {
  grid-area: board;
  min-width: 0;
  display: grid;
  gap: 14px;
}

.table-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 310px);
  gap: 14px;
  align-items: stretch;
}

.zone-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 10px;
}

.zone-header h2 {
  font-size: 24px;
}

.zone-header p {
  max-width: 560px;
  font-size: 13px;
  text-align: right;
}

.tracker-header {
  align-items: start;
}

.client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.client-card {
  min-height: 126px;
  border: 1px solid rgba(184, 111, 18, 0.35);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(184, 111, 18, 0.12), transparent 55%),
    var(--surface);
  padding: 12px;
  display: grid;
  gap: 9px;
}

.client-card h3 {
  font-size: 16px;
}

.client-requirements {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.client-special {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.client-interest-list {
  display: grid;
  gap: 5px;
}

.client-interest-list span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf9;
  padding: 5px 7px;
  color: #4c5955;
  font-size: 12px;
}

.client-interest-list span.active {
  border-color: rgba(184, 111, 18, 0.4);
  background: #fff8e7;
}

.client-card button {
  align-self: end;
}

.client-actions {
  display: grid;
  gap: 6px;
}

#hype-tracker {
  display: grid;
  gap: 10px;
}

.tracker-row {
  display: grid;
  gap: 6px;
}

.tracker-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.tracker-title strong {
  font-size: 15px;
}

.tracker-payout {
  color: #1f5e4a;
  font-size: 12px;
  font-weight: 800;
}

.tracker-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #ecefe8;
}

.tracker-fill {
  height: 100%;
  min-width: 4px;
  border-radius: inherit;
  background: linear-gradient(90deg, #69539f, #2f6f7d);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(172px, 1fr));
  gap: 10px;
}

.hand-grid {
  grid-template-columns: repeat(auto-fit, minmax(162px, 1fr));
}

.employee-card {
  display: grid;
  grid-template-rows: auto auto minmax(42px, 1fr) auto auto auto;
  min-height: 206px;
  border: 1px solid #cbd4cc;
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(circle at 16px 18px, rgba(247, 211, 138, 0.32), transparent 38px),
    var(--surface);
  box-shadow: 0 9px 24px rgba(34, 40, 36, 0.1);
}

.employee-card.played {
  border-color: rgba(47, 111, 125, 0.5);
  background:
    linear-gradient(135deg, rgba(47, 111, 125, 0.16), rgba(47, 125, 99, 0.08)),
    var(--surface);
}

.employee-card.attack {
  border-color: rgba(184, 75, 61, 0.52);
}

.employee-card.free {
  border-color: rgba(47, 111, 125, 0.42);
}

.employee-card.c-suite-card {
  border-color: rgba(105, 83, 159, 0.44);
  background:
    linear-gradient(135deg, rgba(105, 83, 159, 0.12), rgba(47, 125, 99, 0.05)),
    var(--surface);
}

.market-subheader {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin: 16px 0 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.market-subheader span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.market-subheader h2 {
  font-size: 21px;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: start;
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--line);
}

.card-top h3 {
  font-size: 15px;
  line-height: 1.15;
}

.cost-pill {
  flex: 0 0 auto;
  min-width: 58px;
  border-radius: 999px;
  padding: 4px 7px;
  background: var(--ink);
  color: #fff;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 9px 10px 0;
  min-height: 38px;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 7px;
  background: #f0f4ef;
  color: #26322f;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.stock-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 7px;
  background: #eee9f7;
  color: #594789;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.stat-chip.negative {
  background: #f7e3dd;
  color: #8d3529;
}

.card-fill {
  min-height: 42px;
  padding: 0 10px;
}

.special-text {
  margin: 8px 0;
  color: #4c5955;
  font-size: 12.5px;
  line-height: 1.3;
}

.department-line,
.trait-line {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  gap: 5px;
  min-height: 21px;
  padding: 0 10px 5px;
}

.trait,
.department {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 7px;
  background: #eee9f7;
  color: #594789;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.department {
  background: #edf4f1;
  color: #2f6f7d;
}

.card-actions {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
}

.card-actions button {
  min-height: 34px;
}

#game-log {
  max-height: 260px;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding-right: 3px;
}

.log-entry {
  border-left: 3px solid var(--green);
  background: #fbfcf9;
  padding: 8px 9px;
  font-size: 12.5px;
  line-height: 1.35;
}

.rules-shell {
  min-height: 100vh;
}

.rules-main {
  max-width: 1080px;
  margin: 0 auto;
}

.rules-card {
  display: grid;
  gap: 14px;
}

.rules-hero,
.rules-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.93);
  box-shadow: var(--shadow);
  padding: 18px;
}

.rules-hero {
  min-height: 190px;
  display: grid;
  align-content: end;
  gap: 8px;
  background:
    linear-gradient(135deg, rgba(47, 125, 99, 0.18), rgba(184, 111, 18, 0.12)),
    var(--surface);
}

.rules-hero span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.rules-hero h2 {
  max-width: 760px;
  font-size: 34px;
  line-height: 1.08;
}

.rules-hero p,
.rules-section p,
.rules-section li,
.rules-terms dd,
.rules-grid span {
  color: #4c5955;
  line-height: 1.48;
}

.rules-section {
  display: grid;
  gap: 12px;
}

.rules-section h2 {
  font-size: 22px;
}

.rules-section ul,
.rules-section ol {
  margin: 0;
  padding-left: 22px;
}

.rules-section li + li {
  margin-top: 7px;
}

.rules-terms {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.rules-terms div,
.rules-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf9;
  padding: 10px;
}

.rules-terms dt,
.rules-grid b {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.rules-terms dd {
  margin: 0;
  font-size: 13px;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.rules-grid span {
  display: block;
  font-size: 13px;
}

.empty-state {
  min-height: 92px;
  display: grid;
  place-items: center;
  border: 1px dashed #bcc9c2;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
  padding: 14px;
}

.choice-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(29, 36, 34, 0.46);
  padding: 18px;
}

.choice-modal[hidden] {
  display: none;
}

.choice-dialog {
  width: min(560px, 100%);
  max-height: min(680px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 26px 70px rgba(18, 24, 22, 0.28);
  padding: 16px;
}

.choice-dialog h2 {
  font-size: 23px;
  margin-bottom: 6px;
}

.choice-dialog p {
  color: var(--muted);
  line-height: 1.35;
  margin-bottom: 14px;
}

.choice-options {
  display: grid;
  gap: 8px;
}

.choice-options button {
  min-height: 46px;
  text-align: left;
}

.choice-options button:disabled {
  opacity: 1;
  cursor: default;
  color: var(--ink);
  background: #fbfcf9;
}

.game-over-banner {
  border-color: rgba(184, 111, 18, 0.55);
  background: #fff8e7;
}

@media (max-width: 1120px) {
  .game-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "board"
      "active";
  }

  .table-row {
    grid-template-columns: 1fr;
  }

  .active-rail {
    position: static;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: 1fr;
    position: static;
  }

  .setup-panel {
    justify-content: start;
  }

  .online-panel {
    justify-items: start;
  }

  .online-copy input {
    width: 100%;
  }

  #player-names {
    width: 100%;
  }

  .status-band,
  .draft-grid {
    grid-template-columns: 1fr;
  }

  .zone-header,
  .draft-header {
    display: grid;
  }

  .zone-header p {
    text-align: left;
  }
}
