/* Survival Trainer's own look: "Sunset 3D" in the woods (Doug's style library, 3 Oct). Golden-hour forest painted
   on the canvas behind everything (art.js); chunky toy-like buttons with a thick bottom edge in campfire orange and
   pine green; warm parchment cards with wood-brown ink. Titan One (fat rounded capitals, SIL OFL, self-hosted) for
   titles and buttons, Inter for reading. Loaded after games.css, which keeps the shared rules (no selecting text). */
@font-face { font-family: 'Titan One'; src: url(/fonts/titan-one.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Inter; src: url(/fonts/Inter.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Inter; src: url(/fonts/Inter-700.woff2) format('woff2'); font-weight: 700; font-display: swap; }
:root {
  --bg: #2a1a12; --panel: #fff4dc; --paper: #fff4dc; --paper2: #f6e2b8; --ink: #3a2214; --line: #c9a572;
  --text: #3a2214; --soft: #7a5a3a; --accent: #ff7a20; --fire: #ff7a20; --fire-dk: #b8461a; --pine: #2f6b3a; --pine-dk: #1b4424;
  --gold: #ffd23f; --good: #2f8a3e; --bad: #c4362b; --sky: #3f6fb4;
}
body.st { font: 400 16px/1.42 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); min-height: 100dvh; overflow-x: hidden; }
.st h1, .st h2, .st h3, .st button, .st .big-num b, .st dd, .top-title { font-family: 'Titan One', system-ui, sans-serif; font-weight: 400; letter-spacing: .01em; }
.st a { color: var(--fire-dk); }

#scene { position: fixed; inset: 0; width: 100vw; height: 100dvh; display: block; z-index: 0; touch-action: none; }
main { position: relative; z-index: 2; }

/* the top bar floats over the sky */
.st-top { position: relative; z-index: 5; display: flex; align-items: center; gap: 8px; padding: 10px 16px; min-height: 60px; }
.st-top .grow { flex: 1; min-width: 0; }
#back-slot { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }
body.no-scroll { overflow: hidden; height: 100dvh; }
.top-title { color: #fff8ec; font-size: 18px; text-shadow: 0 2px 0 #3a2214, 0 0 12px #0008; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st .st-top .back, .st .lock-btn { background: var(--paper); color: var(--ink); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink); }
.st .icon { min-width: 44px; min-height: 44px; padding: 0; background: var(--paper); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink); color: var(--ink); font-size: 18px; border-radius: 14px; }

/* chunky toy buttons */
.st button { border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 5px 0 var(--ink); background: var(--paper2); color: var(--ink); min-height: 48px; padding: 8px 16px; font-size: 17px; cursor: pointer; }
.st button:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.st button.go { background: linear-gradient(180deg, #ffb35a, var(--fire) 55%, #e8601a); color: #fff8ec; text-shadow: 0 2px 0 var(--fire-dk); font-size: 22px; min-height: 58px; }
.st button.go.drop, .st button.green { background: linear-gradient(180deg, #6fae52, var(--pine) 60%, var(--pine-dk)); color: #fff8ec; text-shadow: 0 2px 0 var(--pine-dk); }
.st button.quiet { background: #fff4dccc; border: 3px solid var(--ink); box-shadow: 0 3px 0 var(--ink); font-family: Inter, sans-serif; font-weight: 700; }
.st button.link { background: none; border: 0; box-shadow: none; font: 700 15px Inter, sans-serif; color: #fff8ec; text-decoration: underline; min-height: 44px; padding: 4px 6px; text-shadow: 0 1px 2px #000a; }
.st button.big { width: 100%; display: grid; gap: 2px; place-items: center; }
.st button.big small { font: 700 13px Inter, sans-serif; opacity: .95; text-shadow: none; }
.st .muted { color: var(--soft); }
.st .small { font-size: 14px; }

/* home: a parchment sign hanging over the woods */
.home { max-width: 520px; width: calc(100% - 32px); margin: 2vh auto 0; padding: 18px 16px 16px; display: grid; gap: 12px; text-align: center; background: linear-gradient(180deg, #fff4dcf2, #f6e2b8ee); border: 4px solid var(--ink); border-radius: 26px; box-shadow: 0 8px 0 var(--ink), 0 20px 50px #0007; }
.logo { margin: 0; line-height: .95; display: grid; }
.logo small { font: 700 15px Inter, sans-serif; color: var(--soft); letter-spacing: .08em; text-transform: uppercase; }
.logo span { font-size: clamp(42px, 12vw, 70px); color: var(--fire); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 0 5px 0 var(--ink); }
.logo em { font-style: normal; font-size: clamp(36px, 10vw, 58px); color: var(--pine); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 0 5px 0 var(--ink); }
.home .tag { margin: 0; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.st .chip { min-height: 44px; padding: 6px 18px; font-size: 17px; background: #fff8ec; box-shadow: 0 3px 0 var(--ink); }
.st .chip[aria-pressed="true"] { background: var(--gold); }
.lv-blurb { margin: -4px 0 0; font-size: 14px; color: var(--soft); min-height: 1.4em; }
.modes { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.links { display: flex; gap: 6px 14px; justify-content: center; align-items: center; flex-wrap: wrap; }
.home .links button.link, .home .links a { color: var(--fire-dk); text-shadow: none; font: 700 15px Inter, sans-serif; }
.home .links a { min-height: 44px; display: inline-flex; align-items: center; }

/* cards and pages */
.page { position: relative; }
.panel { background: linear-gradient(180deg, #fff4dcf5, #f6e2b8f2); border: 4px solid var(--ink); border-radius: 24px; box-shadow: 0 8px 0 var(--ink), 0 20px 50px #0007; padding: 16px; width: calc(100% - 32px); max-width: 560px; margin: 2vh auto 24px; }
.panel h2 { font-size: 26px; margin: 0 0 6px; color: var(--ink); }
.panel h3 { font-size: 19px; margin: 14px 0 4px; color: var(--pine-dk); }
.panel ul { padding-left: 20px; }
.panel li + li { margin-top: 8px; }
.read-panel p { margin: 4px 0 8px; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }

.lesson-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 10px; }
.lesson-list button { width: 100%; display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 10px; align-items: center; text-align: left; padding: 10px 12px; }
.lesson-list .ico { width: 52px; height: 52px; border-radius: 14px; border: 3px solid var(--ink); display: grid; place-items: center; font-size: 28px; background: #fff8ec; }
.lesson-list b { display: block; font-size: 20px; }
.lesson-list small { display: block; font: 600 13px/1.3 Inter, sans-serif; color: var(--soft); }
.stars { color: var(--fire); font-size: 20px; letter-spacing: 1px; white-space: nowrap; -webkit-text-stroke: 1px var(--ink); }
.stars i { color: #e8d6b0; font-style: normal; }
.gear-badge { display: inline-block; margin-top: 2px; font: 700 12px Inter, sans-serif; color: var(--pine-dk); }

/* stage screens: the scene fills the top, the work panel sits at the bottom */
.stage { min-height: calc(100dvh - 60px); display: flex; flex-direction: column; justify-content: flex-end; }
.stage { height: calc(100dvh - 60px); min-height: 0; }
.stage .panel { margin: 0 auto 12px; max-height: 58dvh; overflow-y: auto; overscroll-behavior: contain; }
.stage .bubble { font-size: 16px; }
.work > * + * { margin-top: 10px; }
.bubble { position: relative; background: #fff; border: 3px solid var(--ink); border-radius: 18px; padding: 10px 14px; font-weight: 700; font-size: 17px; line-height: 1.35; }
.bubble::before { content: ''; position: absolute; left: 34px; top: -14px; border: 12px solid transparent; border-bottom-color: var(--ink); border-top: 0; }
.bubble::after { content: ''; position: absolute; left: 37px; top: -9px; border: 9px solid transparent; border-bottom-color: #fff; border-top: 0; }
.bubble.good { background: #e8f8e0; }
.bubble.good::after { border-bottom-color: #e8f8e0; }
.bubble.bad { background: #ffe6de; }
.bubble.bad::after { border-bottom-color: #ffe6de; }
.who { font: 700 12px Inter, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--fire-dk); display: block; margin-bottom: 2px; }
.src { display: block; margin-top: 6px; font: 600 12.5px/1.3 Inter, sans-serif; color: var(--soft); }
.src a { color: var(--soft); }
.step-title { margin: 0; font-family: "Titan One", system-ui, sans-serif; font-size: 20px; color: var(--pine-dk); display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.step-title small { font: 700 13px Inter, sans-serif; color: var(--soft); white-space: nowrap; }
.choices { display: grid; gap: 8px; }
.choices button { text-align: left; font: 700 16px/1.25 Inter, sans-serif; padding: 10px 14px; min-height: 52px; }
.choices button.right { background: #c8f0b8; }
.choices button.wrong { background: #ffc9bc; text-decoration: line-through; }
.choices.two { grid-template-columns: 1fr 1fr; }
.slots { display: flex; gap: 6px; flex-wrap: wrap; }
.slots span { flex: 1 1 0; min-width: 80px; min-height: 40px; border: 3px dashed var(--line); border-radius: 12px; display: grid; place-items: center; text-align: center; font: 700 13px/1.2 Inter, sans-serif; color: var(--soft); padding: 4px; }
.slots span.done { border-style: solid; border-color: var(--pine); background: #d8f0c8; color: var(--pine-dk); }
.meter { position: relative; height: 22px; border: 3px solid var(--ink); border-radius: 12px; background: #fff8ec; overflow: hidden; }
.meter i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #ffb35a, var(--fire)); }
.meter .band { position: absolute; top: 0; bottom: 0; z-index: 1; background: #2f8a3e55; border-left: 3px solid var(--good); border-right: 3px solid var(--good); pointer-events: none; }
.meter .goal { position: absolute; z-index: 1; top: 0; bottom: 0; width: 3px; background: var(--good); }
.meter.water i { background: linear-gradient(90deg, #8ac8f0, #3f8ad8); }
.meter.sun i { background: linear-gradient(90deg, #ffd23f, #ff8a2a 70%, #6a3a8a); }
.mlabel { display: flex; justify-content: space-between; font: 700 13px Inter, sans-serif; color: var(--soft); margin-bottom: 3px; }
.hold { touch-action: none; }
.hold.on { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); filter: brightness(1.1); }
.stepper { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.stepper button { min-width: 52px; font-size: 24px; padding: 0; }
.stepper b { text-align: center; font: 700 15px Inter, sans-serif; }
.result-stars { font-size: 46px; text-align: center; line-height: 1; }
.tip { font: 600 14px/1.35 Inter, sans-serif; color: var(--pine-dk); background: #e8f8e0; border: 2px solid var(--pine); border-radius: 12px; padding: 6px 10px; }

/* The Drop */
.hud { position: relative; z-index: 3; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; width: calc(100% - 32px); max-width: 560px; margin: 0 auto 8px; background: #fff4dcee; border: 3px solid var(--ink); border-radius: 16px; padding: 8px; box-shadow: 0 5px 0 var(--ink); }
.hud .line { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 8px; font: 700 14px Inter, sans-serif; flex-wrap: wrap; }
.hud .line b { font-family: 'Titan One', sans-serif; font-weight: 400; font-size: 16px; }
.stat { font: 700 11px Inter, sans-serif; color: var(--soft); text-transform: uppercase; letter-spacing: .04em; }
.stat .meter { height: 12px; border-width: 2px; margin-top: 2px; }
.stat .meter.low i { background: var(--bad); }
.acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.acts button { font: 700 15px/1.2 Inter, sans-serif; text-align: left; min-height: 54px; padding: 6px 10px; display: grid; }
.acts button small { font-weight: 600; font-size: 12px; color: var(--soft); }
.acts button:disabled small { color: var(--bad); }
.gear { display: grid; gap: 8px; margin: 10px 0; }
.gear button { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; text-align: left; font: 700 15px Inter, sans-serif; padding: 8px 12px; }
.gear button small { grid-column: 1; font-weight: 600; font-size: 12.5px; color: var(--soft); }
.gear button .cost { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-family: 'Titan One', sans-serif; font-weight: 400; }
.gear button[aria-pressed="true"] { background: #c8f0b8; }
.gear button.free { background: #d8f0c8; }
.budget { margin: 4px 0; font-weight: 700; }
.budget b { font-family: 'Titan One', sans-serif; font-weight: 400; font-size: 22px; color: var(--fire-dk); }
.big-num { text-align: center; margin: 4px 0; }
.big-num b { font-size: 56px; color: var(--fire); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; }
.new { text-align: center; font-weight: 700; color: var(--good); margin: 0; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.stats div { background: #fff8ec; border: 2px solid var(--line); border-radius: 12px; padding: 6px 10px; }
.stats dt { font: 700 12px Inter, sans-serif; color: var(--soft); }
.stats dd { margin: 0; font-size: 20px; }
.log p { margin: 0; }
.log p + p { margin-top: 6px; }

/* short sideways screens: the panel moves to the right half so Gus has the left */
/* real photos: lesson cards, picture choices, credits */
.photo { margin: 0 0 8px; }
.photo img { display: block; width: 100%; height: clamp(100px, 18dvh, 240px); object-fit: cover; border: 3px solid var(--ink); border-radius: 14px; background: #3a2a1c; }
.photo figcaption, .credits { font: 500 11px/1.3 Inter, sans-serif; color: var(--soft); margin-top: 3px; }
.photo figcaption a { color: inherit; text-decoration: none; }
.choices .thumb { display: block; object-fit: cover; border: 2px solid var(--ink); border-radius: 10px; background: #3a2a1c; pointer-events: none; }
.choices.pics { grid-template-columns: 1fr 1fr; }
.choices.pics button { display: flex; flex-direction: column; gap: 6px; padding: 6px 6px 10px; font-size: 14px; }
.choices.pics .thumb { width: 100%; aspect-ratio: 16 / 10; height: auto; }
.choices.rows button { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; }
.choices.rows .thumb { width: 64px; height: 52px; flex-shrink: 0; }
.choices button.wrong .thumb { filter: grayscale(1) brightness(.8); }
.choices button.right .thumb { border-color: var(--good); }

@media (orientation: landscape) and (max-height: 560px) {
  .st-top { min-height: 52px; padding: 6px 12px; }
  .stage { min-height: calc(100dvh - 52px); justify-content: flex-start; align-items: flex-end; }
  .stage .panel { width: min(52vw, 520px); margin: 0 12px 10px auto; max-height: calc(100dvh - 70px); }
  .hud { width: min(52vw, 520px); margin: 0 12px 6px auto; }
  #drop .panel { max-height: calc(100dvh - 150px); }
  .home { margin-top: 0; padding: 10px 14px; gap: 8px; max-width: 640px; }
  .logo { grid-template-columns: auto auto; justify-content: center; column-gap: 12px; align-items: end; }
  .logo small { grid-column: 1 / -1; }
  .logo span { font-size: 40px; }
  .logo em { font-size: 40px; }
  .home .tag { display: none; }
  .home .big { padding-block: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .st button:active:not(:disabled) { transform: none; }
}
.credit-list { font-size: 13px; padding-left: 18px; } .credit-list a { color: var(--fire-dk); }
@media (min-width: 900px) and (min-height: 600px) { .choices.pics { grid-template-columns: repeat(4, 1fr); } .choices.pics button { font-size: 13px; } }
