/* SUMMIT FEVER — retro Everest ascent */
* { margin:0; padding:0; box-sizing:border-box; }
html, body { height:100%; }
body {
  background:#05070c;
  overflow:hidden; overscroll-behavior:none; height:100dvh;
  font-family:'VT323', monospace; color:#cfd8e3;
  -webkit-tap-highlight-color:transparent;
}
#app { position:fixed; inset:0; display:flex; align-items:center; justify-content:center; }
.phone {
  position:relative; width:min(100vw, 560px); height:min(100dvh, 900px);
  background:#0a1018; border-left:1px solid #1b2740; border-right:1px solid #1b2740;
  box-shadow:0 0 120px rgba(120,170,255,.06);
}
.screen { position:absolute; inset:0; display:none; flex-direction:column; }
.screen.active { display:flex; }
button { font-family:'VT323', monospace; }

/* CRT overlay on everything */
.phone::after {
  content:""; position:absolute; inset:0; pointer-events:none; z-index:60;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.028) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 55%, rgba(0,0,10,.5) 100%);
}
h1 {
  font-family:'Press Start 2P', monospace; line-height:1.35; letter-spacing:2px;
  color:#ffd66e; text-shadow:0 0 18px rgba(255,180,60,.45), 3px 3px 0 #7a2e12;
}

/* ---------- TITLE / END screens ---------- */
#title-canvas, #end-canvas { position:absolute; inset:0; width:100%; height:100%; }
.title-inner {
  position:relative; z-index:5; height:100%;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:14px; padding:24px; text-align:center;
}
.t-kicker { font-size:18px; letter-spacing:3px; color:#8fb4d9; }
.title-inner h1 { font-size:clamp(26px, 9vw, 46px); }
.t-sub { font-size:20px; color:#9fb2c8; max-width:40ch; }
.t-facts { font-size:17px; color:#6f86a3; letter-spacing:2px; }
.t-foot { position:absolute; bottom:max(12px, env(safe-area-inset-bottom)); font-size:15px; color:#3f5470; width:100%; }

/* ---------- PANELS (lore/setup) ---------- */
.panel { height:100%; padding:22px 18px calc(26px + env(safe-area-inset-bottom)); }
.scrollable { overflow-y:auto; scrollbar-width:thin; }
.p-h { font-family:'Press Start 2P', monospace; font-size:15px; color:#ffd66e; margin-bottom:16px; line-height:1.5; }
.lore-p { font-size:19px; line-height:1.42; color:#b9c8da; margin-bottom:13px; }
.budget-row {
  display:flex; justify-content:space-between; font-size:19px; color:#8fb4d9;
  border:1px solid #22304b; background:#0e1624; padding:7px 12px; margin-bottom:8px;
}
.budget-row b { color:#ffd66e; }
.setup-note { font-size:16px; color:#6f86a3; margin-bottom:12px; line-height:1.3; }
.shop-grid { display:flex; flex-direction:column; gap:8px; margin-bottom:16px; }
.shop-item {
  display:flex; justify-content:space-between; align-items:center; gap:10px;
  border:1px solid #22304b; background:#0e1624; padding:9px 12px;
}
.shop-info { flex:1; min-width:0; text-align:left; }
.shop-name { font-size:19px; color:#dbe6f2; }
.shop-desc { font-size:15px; color:#6f86a3; line-height:1.25; }
.stepper { display:flex; align-items:center; gap:8px; flex-shrink:0; }
.step-btn {
  width:34px; height:34px; font-size:20px; background:#16233a; color:#ffd66e;
  border:1px solid #33456a; cursor:pointer;
}
.step-btn:active { background:#22355a; }
.shop-qty { min-width:26px; text-align:center; font-size:20px; color:#fff; }
.team-h { font-size:18px; letter-spacing:2px; color:#8fb4d9; margin:6px 0 8px; }
.setup-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(150px, 1fr)); gap:8px; margin-bottom:16px; }
.role-card { border:1px solid #22304b; background:#0e1624; padding:8px 10px; }
.role-card label { display:block; font-size:14px; color:#6f86a3; letter-spacing:1px; margin-bottom:4px; }
.role-card input {
  width:100%; background:#16233a; border:1px solid #33456a; color:#fff;
  font-family:'VT323', monospace; font-size:18px; padding:4px 7px;
}
.btn-block { width:100%; }
.btn {
  font-family:'Press Start 2P', monospace; font-size:12px; letter-spacing:1px;
  padding:15px 20px; cursor:pointer; border:1px solid #33456a; color:#e8eef7;
  background:#16233a; transition:transform .05s, background .12s;
}
.btn:active { transform:translateY(2px); }
.btn-primary { background:#b3400f; border-color:#e06a1e; color:#ffe9c9; box-shadow:0 4px 0 #571f05; }
.btn-primary:active { box-shadow:0 1px 0 #571f05; transform:translateY(3px); }
.btn-ghost { background:transparent; color:#8fb4d9; }
.ext-link { text-decoration:none; display:inline-block; }

/* ---------- GAME screen ---------- */
.hdr {
  display:flex; justify-content:space-between; align-items:center; gap:8px;
  padding:calc(8px + env(safe-area-inset-top)) 12px 6px;
  background:#0c1320; border-bottom:1px solid #1b2740; flex:0 0 auto;
}
.hdr .left { flex:0 0 auto; max-width:32%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:17px; color:#8fb4d9; }
.hdr .mid { flex:1; text-align:center; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-family:'Press Start 2P', monospace; font-size:10px; color:#ffd66e; }
.hdr .right { flex:0 0 auto; max-width:36%; text-align:right; font-size:17px; color:#8fb4d9; white-space:nowrap; }
.wx { display:inline-block; margin-right:8px; padding:1px 6px; border:1px solid #33456a; font-size:13px; letter-spacing:1px; }
.wx-clear { color:#9fe08c; } .wx-wind { color:#ffd66e; } .wx-storm { color:#ff7b6e; border-color:#7a3a30; }
.mon { color:#c9a0ff; font-size:14px; margin-left:6px; }
/* end card rows */
.end-card {
  width:min(100%, 340px); background:#0e1624cc; border:1px solid #22304b;
  padding:12px 16px; text-align:left;
}
.end-row {
  display:flex; justify-content:space-between; gap:12px; font-size:18px;
  padding:4px 0; border-bottom:1px dashed #1b2740;
}
.end-row:last-child { border-bottom:none; }
.end-row span { color:#6f86a3; } .end-row b { color:#ffd66e; font-weight:normal; }

#scene-wrap { position:relative; flex:1 1 auto; min-height:110px; background:#05070c; }
.vitals { display:grid; grid-template-columns:repeat(5, minmax(0,1fr)); gap:5px; padding:6px 10px; background:#0a1018; border-bottom:1px solid #14203600; flex:0 0 auto; }
.vital { min-width:0; }
.vital .v-label { font-size:12px; letter-spacing:1px; color:#6f86a3; white-space:nowrap; }
.v-bar { height:9px; background:#131d30; border:1px solid #22304b; margin-top:2px; }
.v-fill { height:100%; transition:width .35s; }
.v-val { font-size:13px; color:#93a9c4; }
.flow-cold { color:#7ec8ff !important; } .flow-hot { color:#ff9060 !important; }

#scene { position:absolute; inset:0; width:100%; height:100%; display:block; }
.log {
  flex:0 0 auto; height:118px; overflow-y:auto; padding:7px 12px;
  border-top:1px solid #1b2740; background:#080d16; scrollbar-width:thin;
}
.log p { font-size:18px; line-height:1.28; color:#a9bcd3; }
.log p b { color:#ffd66e; font-weight:normal; }
.log p.warn { color:#ffb46e; }
.log p.bad { color:#ff7b6e; }
.log p.good { color:#9fe08c; }
.actions {
  flex:0 0 auto; display:flex; gap:7px; padding:9px 10px calc(9px + env(safe-area-inset-bottom));
  border-top:1px solid #1b2740; background:#0c1320;
}
.actions .btn { flex:1; padding:13px 4px; font-size:10px; }
.actions .btn.tiny { font-size:9px; padding:12px 2px; }

/* modal event card over scene */
.event-card {
  position:absolute; inset:auto 10px 12px 10px; z-index:20;
  background:#0e1728; border:1px solid #3a4f78; box-shadow:0 10px 34px rgba(0,0,0,.65);
  padding:13px 14px;
}
.ec-title { font-family:'Press Start 2P', monospace; font-size:11px; color:#ffd66e; margin-bottom:7px; }
.ec-text { font-size:18px; line-height:1.32; color:#b9c8da; margin-bottom:11px; }
.ec-choices { display:flex; flex-direction:column; gap:6px; }
.ec-choices .btn { text-align:left; font-family:'VT323', monospace; font-size:18px; letter-spacing:0; padding:9px 11px; }

/* toast */
#toast {
  position:fixed; left:50%; bottom:84px; transform:translateX(-50%) translateY(20px);
  background:#132038; color:#ffe9c9; border:1px solid #3a4f78; padding:8px 16px;
  font-size:18px; opacity:0; transition:all .25s; z-index:99; pointer-events:none;
}
#toast.show { opacity:1; transform:translateX(-50%) translateY(0); }

/* minigame picks rendered inside event card as a grid of canvas tiles */
.mg-grid { display:grid; grid-template-columns:repeat(3, 1fr); gap:6px; margin-bottom:10px; }
.mg-tile {
  position:relative; aspect-ratio:1/1; background:#131d30; border:1px solid #33456a;
  cursor:pointer; overflow:hidden;
}
.mg-tile canvas { position:absolute; inset:0; width:100%; height:100%; }
.mg-tile.done-good { border-color:#79c96b; }
.mg-tile.done-bad { border-color:#d95747; }
.mg-status { font-size:17px; color:#8fb4d9; margin-bottom:9px; }
.mg-status b { color:#ffd66e; font-weight:normal; }

/* ---------- MOBILE / SHORT SCREENS ---------- */
@media (max-width:640px) {
  .setup-grid { grid-template-columns:1fr 1fr; }
}
@media (max-height:600px), (orientation:landscape) and (max-height:500px) {
  .hdr { padding-top:4px; }
  .log { height:86px; }
  .vitals { gap:4px; padding:4px 8px; }
  .title-inner { gap:8px; }
  .t-sub { font-size:17px; }
  .actions { padding-top:6px; padding-bottom:calc(6px + env(safe-area-inset-bottom)); }
  .actions .btn { padding:10px 4px; }
}
@media (pointer:coarse) {
  .btn, .step-btn { min-height:44px; }
}
