* { box-sizing: border-box; }
:root { color-scheme: dark; --paper: #f5e9cb; --muted: #b0c0b1; --gold: #edce91; --line: #b9c89e26; }
[hidden] { display: none !important; }
body { margin: 0; background: radial-gradient(ellipse at 50% 20%, #2b4a3f, #102628 70%); color: var(--paper); font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; color: inherit; }
button:disabled { opacity: .4; cursor: default; }
button:focus-visible, a:focus-visible, #forest:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.survival-shell { max-width: 450px; margin: auto; padding: 10px 12px max(16px, env(safe-area-inset-bottom)); user-select: none; -webkit-user-select: none; }
.game-heading { display: flex; align-items: center; justify-content: space-between; padding: 4px 2px 12px; gap: 8px; }
.game-heading h1 { font-size: 18px; letter-spacing: 1px; margin: 0; }
.game-heading span { font-size: 11px; color: var(--muted); }
.expedition { position: relative; padding: 4px 10px 5px; border: 1px solid var(--line); border-radius: 12px 12px 0 0; background: linear-gradient(110deg, #29483e, #1b3633); box-shadow: inset 0 1px #ffffff08; }
.hud { display: flex; align-items: center; gap: 10px; font-size: 11px; }
.day-label { display: flex; flex-direction: column; gap: 3px; }
.hud strong { color: #f8dfac; font-size: 18px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.phase-group { margin-left: auto; min-width: 92px; text-align: right; }
#phase { font-size: 11px; color: #e0d9b9; font-variant-numeric: tabular-nums; }
.phase-track { display: block; height: 3px; margin-top: 4px; background: #0e2727; border-radius: 3px; overflow: hidden; }
.phase-track i { display: block; height: 100%; background: #d4bd7f; border-radius: inherit; }
.hud button, .status button, .field-top button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; border: 1px solid #a7bb923d; border-radius: 8px; background: #16312dcc; min-height: 44px; padding: 6px 9px; font-size: 10px; }
.hud button { width: 44px; font-size: 16px; }
.day-track { height: 3px; margin-top: 4px; background: #102d2b; -webkit-mask-image: repeating-linear-gradient(90deg, #000 0, #000 calc(100% / 7 - 3px), transparent calc(100% / 7 - 3px), transparent calc(100% / 7)); mask-image: repeating-linear-gradient(90deg, #000 0, #000 calc(100% / 7 - 3px), transparent calc(100% / 7 - 3px), transparent calc(100% / 7)); }
.day-track i { display: block; height: 100%; background: #c9b57c; }
.status { display: flex; align-items: center; gap: 8px; padding: 3px 10px; border: 1px solid var(--line); border-top: 0; background: #132e2b; font-size: 11px; }
.health-group { display: flex; flex-direction: column; gap: 5px; min-width: 68px; }
#health { color: #f0b1a1; white-space: nowrap; font-size: 10px; }
.health-track { height: 3px; background: #472f2e; border-radius: 2px; overflow: hidden; }
.health-track i { display: block; height: 100%; background: #e8a28e; border-radius: inherit; }
#resources { margin-left: auto; color: #ddd5b4; word-spacing: 4px; font-size: 11px; font-variant-numeric: tabular-nums; }
.icon { width: 15px; height: 15px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.field { position: relative; border: 1px solid #a7bb7655; border-top: 0; border-radius: 0 0 12px 12px; overflow: hidden; box-shadow: 0 14px 30px #05171966; background: #213d32; }
#forest { display: block; width: 100%; aspect-ratio: 320/360; image-rendering: pixelated; }
.field-top { position: absolute; inset: 9px 9px auto; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; font-size: 10px; pointer-events: none; }
.fuel-badge { display: flex; align-items: center; gap: 7px; padding: 7px 9px; background: #112c2ce8; border: 1px solid #c9b77a44; border-radius: 8px; color: #e7c58b; box-shadow: 0 3px 8px #071a2244; }
.fuel-badge > div { display: flex; flex-direction: column; gap: 5px; }
.fuel-track { height: 2px; background: #51472e; border-radius: 2px; overflow: hidden; }
.fuel-track i { display: block; height: 100%; background: #f1c17b; }
.field-top button { pointer-events: auto; background: #112c2ce8; color: #dedcc2; }
.overlay { position: absolute; inset: 0; z-index: 3; display: grid; place-items: start center; overflow-y: auto; background: radial-gradient(ellipse at 50% 20%, #314e3dce, #0d272af7 85%); padding: 16px; scrollbar-width: thin; scrollbar-color: #7d8d69 #142e2b; }
.panel { position: relative; margin-block: auto; width: 100%; max-width: 330px; text-align: center; padding: 12px 12px; }
.eyebrow { display: block; color: #b9c09c; font-size: 8px; font-weight: 600; letter-spacing: 3px; }
.eyebrow::before { content: ''; display: block; width: 27px; height: 1px; background: #d9c18a88; margin: 0 auto 15px; }
.panel h2 { font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; font-size: 29px; font-weight: 600; letter-spacing: 3px; margin: 13px 0; color: #ffebbd; text-shadow: 0 2px 14px #0004; }
.panel p { font-size: 12px; line-height: 1.9; color: #d1d8c3; margin: 10px 0; }
.panel .small { font-size: 10px; line-height: 1.85; color: #afc0ac; }
.partner-intro { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 14px auto; width: fit-content; padding: 7px 18px 7px 8px; border: 1px solid var(--line); border-radius: 40px; background: #112f2b66; text-align: left; }
.partner-intro small { display: block; font-size: 8px; letter-spacing: 2px; color: #b4c29e; margin-bottom: 4px; }
.partner-intro strong { font-size: 12px; font-weight: 600; color: #f2dfb8; }
.portrait { display: block; border-radius: 50%; border: 1px solid #d7bf82; object-fit: cover; width: 46px; height: 46px; box-shadow: 0 0 0 3px #dec38913; }
.primary { display: block; width: 100%; min-height: 46px; margin: 12px auto 0; border: 1px solid #f4dca3; border-radius: 8px; background: linear-gradient(115deg, #f0dab0, #d6b779); color: #263a30; font-weight: 750; font-size: 13px; letter-spacing: 1px; box-shadow: inset 0 1px #fff3d4, inset 0 -3px #9c7d4333, 0 5px 12px #001c2555; }
.primary:active { transform: translateY(1px); }
#continue:not([hidden]) ~ #start { background: transparent; color: #d6d7b7; border-color: #adc08f44; box-shadow: none; min-height: 38px; font-size: 11px; }
.text-link { display: block; margin-top: 18px; color: #cad2b6; font-size: 11px; text-underline-offset: 5px; }
.camp-panel { padding: 6px 0; }
.camp-panel h2 { font-size: 23px; letter-spacing: 1px; margin: 10px 0; }
.camp-panel .eyebrow::before { margin-bottom: 10px; }
.camp-panel p { margin: 6px 0; font-size: 11px; }
#campStock { color: #e7d09f; padding: 8px 0; border-block: 1px solid var(--line); }
.building-list { display: grid; gap: 6px; margin-top: 11px; }
.build-row { position: relative; text-align: left; background: linear-gradient(110deg, #36523d55, #1d393155); border: 1px solid #beca9b26; border-radius: 8px; padding: 9px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.build-row > span { font-size: 11px; color: #efdcaf; font-weight: 600; }
.build-row small { display: block; font-weight: 400; font-size: 9px; line-height: 1.7; color: #afc3ac; margin-top: 4px; }
.build-row button { border: 1px solid #b7be8e55; border-radius: 6px; background: #38533f; padding: 7px; font-size: 10px; color: #f2deb5; min-height: 44px; min-width: 76px; font-variant-numeric: tabular-nums; }
.build-row button:disabled { opacity: .38; }
.companion { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; }
.companion > img { width: 28px; height: 28px; object-fit: cover; border-radius: 50%; border: 1px solid #c4b58388; }
.companion > div { min-width: 0; width: 100%; }
.companion strong { display: block; font-size: 10px; font-weight: 600; color: #e6c99b; }
.companion p { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: 10px; color: #d5ddc7; line-height: 1.5; margin: 3px 0 0; }
.controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 3px 0; }
.pad { position: relative; width: 92px; height: 92px; flex-shrink: 0; border: 1px solid #9db58b55; border-radius: 50%; background: radial-gradient(circle, #2b4b3a 0 45%, #112c2c 47% 61%, #355341 63% 64%, #18332e 66%); box-shadow: inset 0 2px 5px #071e2a55, 0 3px #091f25, 0 6px 12px #061c2344; touch-action: none; }
.pad i { position: absolute; inset: 0; display: grid; place-items: center; font-style: normal; color: #b9cda33d; font-size: 39px; pointer-events: none; }
#stick { position: absolute; left: 29px; top: 29px; width: 32px; height: 32px; border: 1px solid #adc39888; background: radial-gradient(circle at 40% 25%, #92a984, #5f7b5c); border-radius: 50%; box-shadow: 0 2px 5px #061e24aa, inset 0 1px #d8e3bc44; z-index: 1; pointer-events: none; }
#action { position: relative; width: 90px; height: 78px; flex-shrink: 0; border: 1px solid #edce91; border-radius: 50%; background: radial-gradient(ellipse at 40% 20%, #f1dcad, #be9c61); color: #2c402f; font-size: 12px; font-weight: 800; letter-spacing: 1px; touch-action: none; box-shadow: inset 0 0 0 4px #cab078, inset 0 0 0 5px #fff0bb66, 0 4px #79643c, 0 7px 15px #041d2488; }
#action:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 0 0 4px #cab078, 0 2px #79643c; }
.storage-note { min-height: 14px; font-size: 9px; text-align: center; color: #a0b09a; margin: 13px 0 0; }
.survival-shell[data-phase="night"] .expedition { background: linear-gradient(110deg, #273746, #182b34); }
.survival-shell[data-phase="night"] .phase-track i { background: #a4bfd1; }
.survival-shell[data-phase="dusk"] #phase { color: #f3bd89; }
@media (max-width: 360px) { .survival-shell { padding-inline: 8px; } .status { gap: 6px; padding-inline: 8px; } #resources { word-spacing: 0; font-size: 10px; } .panel { padding-inline: 2px; } .panel h2 { font-size: 25px; } .camp-panel h2 { font-size: 20px; } .build-row { padding: 7px; } .overlay { padding: 12px; } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto; } .primary:active, #action:active:not(:disabled) { transform: none; } }
/* Reserve room for status and thumb controls; shrink only the field on short screens. */
@media (max-height: 850px) {
    body { display: flex; flex-direction: column; height: 100svh; min-height: 600px; }
    .game-nav-header { flex: 0 0 auto; }
    .survival-shell { display: grid; grid-template-rows: auto auto minmax(150px, 1fr) auto auto; flex: 1; min-height: 0; width: 100%; padding-top: 6px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
    .field { min-height: 0; }
    #forest { width: 100%; height: 100%; min-height: 0; object-fit: contain; aspect-ratio: auto; }
    .controls { padding-top: 8px; }
    .storage-note { margin: 7px 0 0; min-height: 12px; font-size: 9px; }
}

/* Keep direction and equipment in one slot, outside the canvas drawing coordinates. */
.camp-navigation { display: flex; align-items: center; min-height: 44px; }
#campGuide { display: inline-flex; align-items: center; gap: 6px; padding: 7px; border: 1px solid #c9b77a44; border-radius: 8px; background: #112c2ce8; color: var(--gold); }
#campArrow { display: inline-block; font-style: normal; font-size: 18px; line-height: 1; }
.survival-shell[data-phase="night"] #campGuide { border-color: var(--gold); }
#action { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
#actionIcon { font-size: 21px; line-height: 1; }
#action[data-target="false"] { filter: saturate(.55); }
.build-row .build-reason { color: #edbe95; font-size: 10px; margin-top: 2px; }
#closeCamp { position: sticky; bottom: 0; z-index: 1; }
.companion .needs-rescue { color: #f5b2a2; text-decoration: underline; text-underline-offset: 3px; }
