/* Main game screen (src/ui/shell.js): the planner screen + map + section buttons + panels.
   Loaded after the old screen's CSS and planner.css. */
.pv-app.main{--scene:#ddb29a}
.pv-app.main .pv-scene{background:var(--scene);overflow:hidden}
.ms-map{position:absolute;inset:44px 0 0;background:url(../assets/body-map.webp) center/contain no-repeat}
.ms-map.live{inset:0;background:none}.ms-canvas{position:absolute;inset:0;display:block}
.ms-discovery{position:absolute;inset:0;z-index:3;overflow:auto;background:#0b1930ee;color:#eef4f3}

/* Section buttons: one tap opens Research, Activities, Jobs, the full Routine, Clues. */
.ms-tabs{position:absolute;left:8px;right:8px;top:calc(var(--top,90px) + 4px);z-index:8;display:flex;gap:6px;justify-content:space-between}
.ms-tab{position:relative;flex:1;min-width:0;height:40px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;border-radius:12px;background:#fffc;color:var(--ink);box-shadow:0 1px 3px #0002;font:600 10px/1 system-ui,-apple-system,sans-serif}
.ms-tab svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.ms-tab span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
.ms-tab.on{background:var(--ink);color:#fff}
.ms-tab.has-news::after{content:'';position:absolute;top:5px;right:9px;width:7px;height:7px;border-radius:50%;background:var(--stress);box-shadow:0 0 0 2px #fff}

/* A section opened full screen. Its content is the old (dark) section view. */
.ms-panel{position:fixed;inset:0;z-index:40;display:flex;flex-direction:column;background:#f6efe9;color:#3b2f2a;font:14px 'DM Sans',system-ui,sans-serif}
.ms-panel-head{display:flex;align-items:center;justify-content:space-between;padding:max(10px,env(safe-area-inset-top)) 14px 8px;border-bottom:1px solid #e5d8cd;background:#fffaf6}
.ms-panel-head h2{margin:0;font-size:18px}
.ms-close{width:40px;height:40px;border-radius:50%;background:#3b2f2a10;color:#3b2f2a;font-size:24px;line-height:1}
.ms-panel-body{flex:1;overflow:auto;padding:12px 14px max(24px,env(safe-area-inset-bottom));-webkit-overflow-scrolling:touch;overscroll-behavior:contain}
.ms-routine{display:flex;flex-direction:column;gap:12px}
.ms-note{color:#9fb3c8;font-size:12px;margin:4px 0}

.ms-ended{position:absolute;left:16px;right:16px;top:40%;z-index:20;padding:16px;border-radius:16px;background:var(--card);box-shadow:0 8px 24px #0003;display:flex;flex-wrap:wrap;gap:8px;align-items:center;justify-content:center;color:var(--ink)}
.ms-ended p{width:100%;margin:0 0 4px;text-align:center;font-weight:700}
.ms-ended button{padding:10px 14px;border-radius:12px;background:var(--ink);color:#fff}

/* The old toast, placed above the deck. */
.pv-app.main #toast{bottom:calc(var(--deck) + 56px)}
html,body{background:var(--bg)}
.pv-app.main{background:var(--bg);color:var(--ink);font:14px/1.3 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif}
.ms-tabs{left:92px}
/* Slim deck (Oct 20): the curves panel is also the slide/open pad; Run day, speed and +
   float over the map just above the bars; the playback strip is a thin track with the
   hours under the curves. Frees ~70px for the map. */
.pv-app.main.side-bottom{--deck:calc(54px + 22px + max(6px,env(safe-area-inset-bottom)))}
.pv-app.main .pv-curvepad{touch-action:none;cursor:ew-resize}
.pv-app.main .pv-deck.slim .pv-deck-ctrl{display:block;height:22px;position:static}
.pv-app.main .pv-deck.slim .pv-strip{height:18px;margin-top:2px;border-radius:6px}
.pv-app.main .pv-deck.slim .pv-strip span{font-size:9px}
.pv-app.main .pv-deck.slim .pv-play,.pv-app.main .pv-deck.slim .pv-speed,.pv-app.main .pv-deck.slim .pv-add{position:absolute;bottom:calc(100% + 46px + 10px);box-shadow:0 2px 8px #0003}
.pv-app.main .pv-deck.slim .pv-play{left:12px}
.pv-app.main .pv-deck.slim .pv-speed{left:calc(12px + var(--playw,100px) + 8px);background:#fffe;height:36px;border-radius:18px}
.pv-app.main .pv-deck.slim .pv-add{left:calc(12px + var(--playw,100px) + 56px);background:#fffe;height:36px;width:40px;border-radius:18px}
.pv-app.main .pv-deck.slim .pv-play.on{min-width:44px}
.pv-app.main .pv-deck.slim:has(.pv-play.on){--playw:44px}
/* Pressures: smaller and lower, so it covers less of the map. */
.pv-app.main .pv-press{bottom:calc(var(--deck) + 46px + 10px);right:10px}
.pv-app.main .pv-pbars{gap:3px;padding:4px 5px;background:#ffffff30}
.pv-app.main .pv-pbar{width:8px;border-radius:4px;max-height:34px;min-height:10px}
.pv-app.main .pv-ptally small{font-size:8px}.pv-app.main .pv-ptally b{font-size:13px}
/* The map's peach ground runs under the header and the bars too (no cut-off band);
   the map is framed to the part between the tabs and the bars. */
.pv-app.main{background:var(--scene)}
.pv-app.main.s.side-bottom .pv-scene{top:0;bottom:var(--deck)}
html:has(.pv-app.main),body:has(.pv-app.main){background:#ddb29a}
/* Top (Oct 20): menu button sits in the metrics row; the day clock moved down next to
   Run day (it is the playback clock). Saves one header row for the map. */
.pv-app.main .pv-mhead{flex-direction:row;align-items:center;gap:8px}
.pv-app.main .pv-topline{flex:none;height:auto}
.pv-app.main .pv-topline .pv-topspacer{display:none}
.pv-app.main .pv-burger{height:40px;width:40px;border-radius:12px;background:var(--card);box-shadow:0 2px 8px #0002}
.pv-app.main .pv-mhead .pv-portrait.big{top:calc(100% + 8px)}
.pv-app.main .ms-clock{position:absolute;left:14px;bottom:calc(100% + 46px + 10px + 36px + 8px);font-size:12px;font-weight:700;color:#5a3f33;background:#fff9;padding:3px 8px;border-radius:8px;pointer-events:none}
.ms-tab{height:38px}
.pv-app.main .pv-metrics{min-width:0;padding:7px 8px 5px}
.pv-app.main .pv-mrow{gap:5px}
.pv-app.main .pv-cm{gap:2px}
.pv-app.main .pv-cm small{font-size:9px}
.pv-app.main .pv-cm b{font-size:14px}
.pv-app.main .pv-cbar{width:12px;height:3px}
/* Top (Oct 20): menu button sits in the metrics row; the day clock moved down next to
   Run day (it is the playback clock). Saves one header row for the map. */
.pv-app.main .pv-mhead{flex-direction:row;align-items:center;gap:8px}
.pv-app.main .pv-topline{flex:none;height:auto}
.pv-app.main .pv-topline .pv-topspacer{display:none}
.pv-app.main .pv-burger{height:40px;width:40px;border-radius:12px;background:var(--card);box-shadow:0 2px 8px #0002}
.pv-app.main .pv-mhead .pv-portrait.big{top:calc(100% + 8px)}
.pv-app.main .ms-clock{position:absolute;left:14px;bottom:calc(100% + 46px + 10px + 36px + 8px);font-size:12px;font-weight:700;color:#5a3f33;background:#fff9;padding:3px 8px;border-radius:8px;pointer-events:none}
.ms-tab{height:38px}
.pv-app.main .pv-metrics{min-width:0;padding:7px 8px 5px}
.pv-app.main .pv-mrow{gap:5px}
.pv-app.main .pv-cm{gap:2px}
.pv-app.main .pv-cm small{font-size:9px}
.pv-app.main .pv-cm b{font-size:14px}
.pv-app.main .pv-cbar{width:12px;height:3px}
/* Upgrades card on organ pages */
.organ-upgrades{margin:0 0 14px;padding:12px 14px;border-radius:14px;background:#ffffff12;border:1px solid #ffffff1f}
.organ-upgrades header{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px}
.up-title{font-weight:700}.up-title em{font-style:normal;opacity:.6;font-weight:500}
.up-dots{display:flex;gap:5px}.up-dots i{width:9px;height:9px;border-radius:50%;background:#ffffff26}
.up-dots i.on{background:#7ff3ea;box-shadow:0 0 6px #7ff3ea99}.up-dots i.asleep{background:#7ff3ea55}
.organ-upgrades p{margin:4px 0}.organ-upgrades small{display:block;opacity:.7;font-size:12px;margin-top:3px}
.up-bar{height:8px;border-radius:4px;background:#ffffff1f;overflow:hidden;margin-top:6px}
.up-bar i{display:block;height:100%;background:#7ff3ea;border-radius:4px}
.up-bar.life i{background:#92e9c8}.up-bar.asleep i{background:#e8a35a}
.up-install{margin-top:10px;width:100%}
.up-life{margin-top:10px}.up-life span{font-size:12px;opacity:.75}
.up-cap{font-size:12px;opacity:.75;margin-top:8px!important}
/* Light theme fixes the generator can't guess (Oct 21) */
.pv-app.main{--soft:#8a7465;--line:#e5d8cd;--green:#2bb3a5}
.pv-app.main .player-dialog{background:#f6efe9;color:#3b2f2a;border-color:#e5d8cd}
.pv-app.main .player-dialog::backdrop{background:#5a3d2e55}
/* A game screen, not a page: no double-tap zoom, no page pinch (iPhone Safari). */
html:has(.pv-app.main),body:has(.pv-app.main){touch-action:manipulation;overscroll-behavior:none;-webkit-text-size-adjust:100%}
/* New blocks glow for ~4 s wherever they were added from */
.pv-app.main .pv-row.fresh{animation:pv-fresh 4s ease-out var(--fresh-delay,0s) both;z-index:3}
@keyframes pv-fresh{0%,55%{filter:drop-shadow(0 0 5px #fff) drop-shadow(0 0 12px #ffcf6b) brightness(1.15)}100%{filter:none}}
/* Organ recipe blocks: a glowing strip in the organ's colour on top of the bar */
.pv-app.main .pv-row.recipe::before{content:'';position:absolute;left:4px;right:4px;top:3px;height:5px;border-radius:3px;background:var(--rc);box-shadow:0 0 6px var(--rc),0 0 0 1.5px #fff;z-index:3;pointer-events:none}
/* Original progress chips with same-height installed-level circles. */
.ms-prog-layer{position:absolute;inset:0;pointer-events:none;overflow:hidden}
.ms-organ-status{position:absolute;left:0;top:0;display:flex;align-items:center;gap:4px;padding:0;border:0;background:none;box-shadow:none;pointer-events:auto;cursor:pointer;transform-origin:50% 100%;touch-action:manipulation;color:#3b2f2a;font:700 11px system-ui,sans-serif;white-space:nowrap}
.ms-organ-status[hidden]{display:none}
.ms-prog{display:flex;align-items:center;gap:5px;box-sizing:border-box;height:22px;padding:4px 7px;border-radius:999px;background:#fffaf6ee;box-shadow:0 2px 8px #5a3d2e33}
.ms-prog i{display:block;width:44px;height:6px;border-radius:3px;background:#ece2d8;overflow:hidden}
.ms-prog i b{display:block;height:100%;border-radius:3px;background:var(--c)}
.ms-level{display:flex;flex:none;flex-direction:column;align-items:center;justify-content:center;gap:0;width:22px;height:22px;border-radius:50%;background:#fffaf6ee;box-shadow:0 2px 8px #5a3d2e33;line-height:1}
.ms-level small{font-size:6px;font-weight:500}.ms-level b{font-size:10px;font-weight:700}
.ms-organ-status.ready .ms-prog{background:#fff1d6;box-shadow:0 0 0 2px #f0a531,0 2px 10px #f0a53166}
.ms-organ-status.noticed .ms-prog i b{opacity:.45}
.ms-organ-status:focus-visible{outline:2px solid #237e85;outline-offset:3px;border-radius:999px}
.pv-vmission{display:inline-block;margin:4px 0 2px;padding:2px 8px;border-radius:999px;background:color-mix(in srgb,var(--rc) 18%,#fff);color:color-mix(in srgb,var(--rc) 80%,#000);font:700 11px system-ui,sans-serif;box-shadow:inset 0 0 0 1.5px var(--rc)}


/* Body reveal (Oct 25): the "?" that asks for attention, and the card when it is noticed. */
.ms-cue{position:absolute;left:0;top:0;display:flex;flex-direction:column;align-items:center;gap:6px;padding:0;border:0;background:none;pointer-events:auto;cursor:pointer;touch-action:manipulation;font:600 12px system-ui,sans-serif;color:#4a3a33}
.ms-cue[hidden]{display:none}
.ms-cue b{display:grid;place-items:center;width:44px;height:44px;border-radius:50%;background:#fffaf6;color:#b0573f;font-size:24px;box-shadow:0 0 0 0 #fffaf6aa,0 4px 14px #5a3d2e40;animation:ms-cue-breathe 2.6s ease-in-out infinite}
.ms-cue span{max-width:190px;padding:5px 10px;border-radius:12px;background:#fffaf6e8;box-shadow:0 2px 8px #5a3d2e26;text-align:center;line-height:1.3;white-space:normal}
@keyframes ms-cue-breathe{0%,100%{box-shadow:0 0 0 0 #fffaf6aa,0 4px 14px #5a3d2e40}50%{box-shadow:0 0 0 12px #fffaf600,0 4px 14px #5a3d2e40}}
@media (prefers-reduced-motion:reduce){.ms-cue b{animation:none}}
.reveal-card{position:fixed;left:50%;top:calc(env(safe-area-inset-top) + 132px);z-index:40;width:min(340px,calc(100vw - 32px));box-sizing:border-box;transform:translateX(-50%);padding:16px 18px 14px;border-radius:18px;background:#fffaf6f2;box-shadow:0 10px 30px #5a3d2e33;color:#3b2f2a;font:14px/1.45 system-ui,sans-serif;animation:reveal-in .5s ease-out both}
.reveal-card.leaving{animation:reveal-out .6s ease-in both}
.reveal-card h3{margin:0 0 6px;font-size:18px}
.reveal-card p{margin:0 0 6px}
.reveal-card .reveal-first{font-style:italic;color:#8a5a47;margin-bottom:10px}
.reveal-card .reveal-since{color:#7a6a62;font-size:13px}
.reveal-card .reveal-new{font-size:13px}
.reveal-close{position:absolute;right:8px;top:6px;width:32px;height:32px;border:0;background:none;font-size:20px;color:#7a6a62;cursor:pointer}
@keyframes reveal-in{from{opacity:0;transform:translate(-50%,-8px)}to{opacity:1;transform:translate(-50%,0)}}
@keyframes reveal-out{to{opacity:0;transform:translate(-50%,-8px)}}
.research-fog{color:#8a5a47;font-style:italic}
/* Observation pins (✦) follow their building on the 3D map; below the tabs and the Clues board. */
.pv-app.main .body-notice-pins{z-index:2}.pv-app.main .body-notice-pin[hidden]{display:none}
/* Clues board: clear of the metrics bar + section tabs above and the routine dock below. */
.pv-app.main .ms-discovery{top:calc(var(--top,59px) + 60px);bottom:110px;border-radius:18px 18px 0 0;overflow:hidden}
.pv-app.main .ms-discovery .body-discovery{bottom:0}
