:root {
  color-scheme: dark;
  --ink: #e9e3cf;
  --muted: #a9b6a4;
  --bg: #101b19;
  --panel: #182824;
  --panel-2: #20342e;
  --line: #3d5b4d;
  --gold: #e2b95f;
  --gold-2: #f4d98c;
  --rust: #bd684e;
  --green: #75b68b;
  --danger: #e17b65;
  --shadow: 0 12px 32px rgba(0,0,0,.28);
  font-family: Georgia, "Times New Roman", serif;
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --ink: #25352f; --muted: #5d6e65; --bg: #e8e0ca;
    --panel: #f7f1df; --panel-2: #e9e1ca; --line: #b9aa86;
    --gold: #996e20; --gold-2: #d5a94b; --rust: #9d4939;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; min-width: 320px; background:
  radial-gradient(circle at 80% 0%, rgba(91,139,111,.18), transparent 32rem),
  var(--bg); color: var(--ink); line-height: 1.45;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
#app { width: min(1440px, 100%); margin: auto; padding: 18px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.8rem, 5vw, 3.2rem); line-height: 1; margin-bottom: 0; letter-spacing: -.04em; }
h2 { font-size: clamp(1.45rem, 3vw, 2.3rem); margin-bottom: 8px; }
h3 { margin-bottom: 8px; font-size: 1.1rem; }
.eyebrow, .chapter { text-transform: uppercase; letter-spacing: .16em; font-size: .72rem; color: var(--gold-2); font-weight: bold; }
.muted, .small-note { color: var(--muted); }
.small-note { font-size: .9rem; }
.top-actions { display: flex; gap: 8px; }
.screen { display: none; }
.screen.active { display: block; }
.panel, .hero-card, .end-card {
  background: linear-gradient(145deg, rgba(35,57,48,.96), rgba(19,32,29,.98));
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
.panel { padding: 18px; }
.hero-card { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; margin-bottom: 18px; }
.hero-copy { padding: clamp(22px, 5vw, 52px); align-self: center; }
.camp-art { min-height: 270px; position: relative; overflow: hidden; background: linear-gradient(#1e3940, #274b45 60%, #162b26 60%); }
.moon { position: absolute; right: 18%; top: 12%; width: 64px; height: 64px; border-radius: 50%; background: #f0d994; box-shadow: 0 0 40px #eecf7a; }
.hill { position: absolute; bottom: 28%; width: 130%; height: 45%; border-radius: 50% 50% 0 0; background: #23433a; }
.hill-a { left: -60%; transform: rotate(-8deg); }.hill-b { right: -65%; bottom: 19%; transform: rotate(9deg); background: #1b3630; }
.tree { position: absolute; bottom: 28%; width: 11px; height: 95px; background: #382d25; }
.tree:before, .tree:after { content: ""; position: absolute; left: -25px; width: 62px; height: 62px; background: #17352d; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.tree:before { top: -36px; }.tree:after { top: -5px; }
.tree-a { left: 15%; }.tree-b { right: 15%; transform: scale(.7); }
.wagon-art { position: absolute; bottom: 22%; left: 42%; width: 105px; height: 48px; background: #ba8b4b; border: 5px solid #5e412b; border-radius: 8px; }
.wagon-art:before, .wagon-art:after { content: ""; position: absolute; bottom: -20px; width: 25px; height: 25px; border: 5px solid #5e412b; border-radius: 50%; background: #c69a5c; }
.wagon-art:before { left: 8px; }.wagon-art:after { right: 8px; }
.fire { position: absolute; left: 33%; bottom: 12%; width: 25px; height: 25px; background: #ee9d42; border-radius: 60% 40% 50% 50%; box-shadow: 0 0 24px #e76c37; }
.setup-grid, .game-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.party-panel { margin-top: 18px; }
.section-heading, .map-title, .meter-label { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.choice-stack { display: grid; gap: 9px; }
.choice-card, .load-slot {
  text-align: left; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 9px; padding: 12px; min-height: 52px; transition: .15s ease;
}
.choice-card:hover, .choice-card.selected, .load-slot:hover { border-color: var(--gold); transform: translateY(-1px); background: #29453a; }
.choice-card strong, .choice-card span, .choice-card small, .load-slot strong, .load-slot span { display: block; }
.choice-card span, .choice-card small, .load-slot span { color: var(--muted); margin-top: 3px; font-size: .86rem; }
.party-builder { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.person-editor { border: 1px solid var(--line); padding: 10px; border-radius: 9px; background: rgba(0,0,0,.12); }
.person-number { color: var(--gold-2); font-weight: bold; margin-bottom: 5px; }
label { display: block; font-size: .8rem; color: var(--muted); margin-bottom: 8px; }
input, select {
  display: block; width: 100%; margin-top: 4px; min-height: 44px; border-radius: 7px;
  border: 1px solid var(--line); background: #10201c; color: var(--ink); padding: 8px;
}
.start-actions, .action-row, .end-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.primary-btn, .secondary-btn, .icon-btn, .text-btn {
  min-height: 44px; border-radius: 8px; padding: 9px 15px; border: 1px solid var(--gold);
}
.primary-btn {
  color: #211d12; background: var(--gold); font-weight: bold;
  background-image: url("https://assets.popchat.com/assets/kenney/ui-pack/PNG/Blue/Default/button_rectangle_depth_border.png");
  background-size: 100% 100%; background-blend-mode: soft-light;
}
.primary-btn:hover { background-color: var(--gold-2); }
.primary-btn:disabled { opacity: .45; cursor: not-allowed; }
.secondary-btn, .icon-btn { background: var(--panel-2); color: var(--ink); border-color: var(--line); }
.text-btn { background: none; border: 0; color: var(--gold-2); padding: 5px; min-height: 32px; }
.full-btn { width: 100%; margin-top: 12px; }
.load-panel { margin-top: 12px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hidden { display: none !important; }
.game-header { margin-bottom: 18px; display: flex; justify-content: space-between; align-items: center; }
.day-box { text-align: center; border-left: 1px solid var(--line); padding-left: 24px; }
.day-box span { display: block; color: var(--muted); font-size: .8rem; text-transform: uppercase; }
.day-box strong { font-size: 2.3rem; color: var(--gold-2); }
.main-column, .side-column { display: grid; align-content: start; gap: 18px; }
.map-panel { padding-bottom: 12px; }
#mapCanvas { width: 100%; height: auto; min-height: 230px; display: block; border-radius: 8px; margin-top: 8px; image-rendering: pixelated; }
.weather-label { color: var(--gold-2); font-size: .85rem; }
.map-legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: .78rem; margin-top: 9px; }
.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; background: #314c4c; }.legend-dot.current { background: #f8e5a4; }.legend-dot.visited { background: #d8a44b; }
.decision-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 15px; }
.badge { display: inline-block; border: 1px solid var(--line); border-radius: 30px; padding: 4px 9px; color: var(--gold-2); font-size: .76rem; white-space: nowrap; }
.supply-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 15px 0; }
.supply { background: var(--panel-2); padding: 9px; border-radius: 7px; display: flex; justify-content: space-between; color: var(--muted); }
.supply strong { color: var(--gold-2); }.supply strong.money { color: #9bd5a4; }
.meter-block { margin-top: 12px; }.meter-label { font-size: .82rem; color: var(--muted); }.meter-label strong { color: var(--ink); }
.meter { height: 8px; background: #0d1715; border-radius: 8px; overflow: hidden; margin-top: 4px; }.meter i { display: block; height: 100%; background: var(--gold); border-radius: inherit; transition: width .3s; }
.party-row { display: grid; grid-template-columns: 38px 1fr 38px; gap: 8px; align-items: center; padding: 9px 0; border-bottom: 1px solid rgba(120,150,130,.18); }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; background: #9c6748; color: #fff0c0; border-radius: 50%; font-weight: bold; }
.party-row small { display: block; color: var(--muted); font-size: .73rem; }.mini-stat { font-size: .72rem; text-align: right; color: var(--muted); }.mini-stat b { display: block; color: var(--green); }.party-row.dead { opacity: .45; }
.log { max-height: 280px; overflow: auto; display: grid; gap: 6px; }.log-entry { padding: 9px 10px; border-left: 3px solid var(--line); background: rgba(0,0,0,.12); font-size: .9rem; }.log-entry.warning { border-color: var(--gold); }.log-entry.danger { border-color: var(--danger); }
.modal { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 18px; background: rgba(4,10,9,.78); }
.modal-card { position: relative; width: min(580px, 100%); background: var(--panel); border: 1px solid var(--gold); border-radius: 14px; padding: 25px; box-shadow: var(--shadow); }
.modal-close { position: absolute; right: 14px; top: 14px; background: none; color: var(--muted); border: 0; }
.modal-choices { display: grid; gap: 8px; margin-top: 20px; }
.end-card { max-width: 800px; margin: 8vh auto; padding: clamp(22px, 6vw, 58px); text-align: center; }
.score-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: 24px 0; }
.score-grid div { background: var(--panel-2); border-radius: 8px; padding: 12px; }.score-grid span { display: block; color: var(--muted); font-size: .8rem; }.score-grid strong { color: var(--gold-2); font-size: 1.35rem; }
@media (max-width: 850px) {
  #app { padding: 12px; }.hero-card, .setup-grid, .game-layout { grid-template-columns: 1fr; }.camp-art { min-height: 190px; }
  .party-builder { grid-template-columns: repeat(2, 1fr); }.side-column { grid-row: 1; }.main-column { grid-row: 2; }
}
@media (max-width: 520px) {
  .topbar, .game-header { align-items: flex-start; }.top-actions { flex-direction: column; }
  .panel { padding: 14px; }.party-builder, .decision-grid, .score-grid, .load-panel { grid-template-columns: 1fr; }
  .start-actions .primary-btn, .start-actions .secondary-btn, .action-row button { width: 100%; }
  h1 { font-size: 2rem; }.hero-copy { padding: 24px 18px; }
}
