:root {
  --bg: #15110e;
  --panel: rgba(22, 18, 15, 0.82);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f4ede4;
  --muted: #b5a99b;
  --fire: #ff7a2e;
  --gold: #ffd65a;
  --bad: #ff5a4a;
  --water: #7cc4ff;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
body { font: 14px/1.35 system-ui, -apple-system, "Segoe UI", sans-serif; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#ov { z-index: 1; }
#loading { position: fixed; inset: 0; display: grid; place-items: center; color: var(--muted); z-index: 5; }

#hud {
  position: fixed; z-index: 2; top: calc(var(--safe-t) + 8px); left: calc(var(--safe-l) + 8px); right: calc(var(--safe-r) + 8px);
  display: flex; align-items: center; gap: 14px; padding: 8px 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
#hud .wind { display: flex; align-items: center; gap: 6px; font-weight: 700; white-space: nowrap; }
#windArrow { width: 26px; height: 26px; fill: var(--gold); transition: transform 0.4s; filter: drop-shadow(0 0 4px rgba(255, 214, 90, 0.5)); }
#hud .stat { display: flex; flex-direction: column; align-items: center; min-width: 40px; }
#hud .stat b { font-size: 16px; font-variant-numeric: tabular-nums; }
#hud .stat.bad b { color: var(--bad); }
#hud small { color: var(--muted); font-size: 11px; white-space: nowrap; }
#hud .contain { flex: 1; min-width: 70px; }
#hud .bar { height: 7px; border-radius: 4px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
#hud .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--fire), var(--gold)); transition: width 0.4s; }
#hud .ctrls { display: flex; gap: 6px; }
#hud .ctrls button { width: 38px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.07); font-weight: 700; }

#banner {
  position: fixed; z-index: 3; top: calc(var(--safe-t) + 70px); left: 50%; transform: translateX(-50%);
  padding: 9px 16px; border-radius: 999px; background: rgba(120, 30, 10, 0.92); border: 1px solid #ff8a4a; font-weight: 700;
  animation: pulse 1s ease-in-out infinite alternate; white-space: nowrap; max-width: calc(100vw - 24px); overflow: hidden; text-overflow: ellipsis;
}
@keyframes pulse { to { box-shadow: 0 0 22px rgba(255, 110, 40, 0.65); } }
#toasts { position: fixed; z-index: 3; top: calc(var(--safe-t) + 116px); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { padding: 7px 14px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-weight: 600; transition: opacity 0.5s, transform 0.5s; white-space: nowrap; }
.toast.warn { border-color: var(--gold); color: var(--gold); }
.toast.bad { border-color: var(--bad); color: #ffd0c8; background: rgba(90, 16, 10, 0.9); }
.toast.out { opacity: 0; transform: translateY(-6px); }

#dock { position: fixed; z-index: 2; left: calc(var(--safe-l) + 8px); right: calc(var(--safe-r) + 8px); bottom: calc(var(--safe-b) + 8px); display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
#hint { align-self: center; padding: 4px 12px; border-radius: 999px; background: rgba(0, 0, 0, 0.55); color: var(--muted); font-size: 12px; }
#units { display: flex; gap: 6px; pointer-events: auto; }
.unit {
  flex: 1; min-width: 0; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 8px; position: relative;
  padding: 8px 10px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); text-align: left; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.unit .ic { font-size: 22px; }
.unit .tx { display: flex; flex-direction: column; min-width: 0; }
.unit b { font-size: 13px; white-space: nowrap; }
.unit small { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unit .meter { position: absolute; left: 10px; right: 10px; bottom: 5px; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.unit .meter i { display: block; height: 100%; background: var(--gold); }
.unit.engine .meter i, .unit.heli .meter i { background: var(--water); }
.unit.sel { border-color: #fff; box-shadow: 0 0 0 1px #fff, 0 0 18px rgba(255, 255, 255, 0.2); }
.unit.alert { border-color: var(--bad); animation: pulse 0.5s ease-in-out infinite alternate; }
.unit.lost { opacity: 0.45; }

#modal { position: fixed; inset: 0; z-index: 4; display: grid; place-items: center; padding: 16px; background: rgba(8, 6, 5, 0.6); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
#modal[hidden] { display: none; }
.card { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 22px; border-radius: 18px; background: rgba(26, 21, 17, 0.96); border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.card h1 { margin: 6px 0 8px; font-size: 24px; }
.card p { margin: 0 0 10px; }
.kicker { color: var(--fire); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; font-size: 12px; }
.lvls { display: flex; gap: 6px; margin: 10px 0 4px; }
.lvl { width: 52px; padding: 6px 0; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); font-weight: 800; font-size: 16px; display: flex; flex-direction: column; align-items: center; }
.lvl small { color: var(--gold); font-size: 11px; }
.lvl.on { border-color: var(--fire); background: rgba(255, 122, 46, 0.15); }
.facts { margin: 0 0 10px; padding-left: 18px; color: var(--muted); }
.tip { color: var(--gold); }
.how { display: grid; gap: 6px; margin: 12px 0 16px; font-size: 13px; color: var(--muted); }
.how b { color: var(--text); margin-right: 4px; }
.card button { padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.07); font-weight: 700; }
.card button.go { width: 100%; border: 0; background: linear-gradient(180deg, #ff8a3a, #e5541c); color: #fff; font-size: 16px; }
.card .row { display: flex; gap: 8px; }
.card .row button { flex: 1; }
.stars { font-size: 44px; letter-spacing: 6px; color: rgba(255, 255, 255, 0.15); }
.stars .on { color: var(--gold); text-shadow: 0 0 18px rgba(255, 214, 90, 0.6); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.grid div { padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); display: flex; flex-direction: column; }
.grid b { font-size: 20px; }
.grid small, .sub { color: var(--muted); font-size: 12px; }
.xp { color: var(--gold); font-weight: 800; font-size: 18px; }

/* Phones: compact HUD, unit cards show icon + status. */
@media (max-width: 560px) {
  #hud { gap: 8px; padding: 6px 8px; }
  #hud .stat { min-width: 32px; }
  #hud .stat b { font-size: 14px; }
  #hud .wind { font-size: 13px; gap: 3px; }
  #windArrow { width: 20px; height: 20px; }
  #hud .ctrls button { width: 34px; }
  #toasts { top: calc(var(--safe-t) + 104px); }
  .toast { font-size: 12px; padding: 5px 11px; }
  #hud .contain small { display: none; }
  #hud .contain { min-width: 20px; }
  .unit { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 6px 4px 9px; }
  .unit .ic { font-size: 20px; }
  .unit b { font-size: 11px; }
  .unit small { font-size: 10px; max-width: 100%; }
}
/* Sideways phones: the dock becomes a column on the left. */
@media (orientation: landscape) and (max-height: 500px) {
  #hud { left: calc(var(--safe-l) + 150px); }
  #dock { top: calc(var(--safe-t) + 8px); right: auto; width: 134px; justify-content: flex-end; }
  #hint { display: none; }
  #units { flex-direction: column; }
  .unit { flex: 0 0 auto; }
  #banner { top: calc(var(--safe-t) + 60px); }
  #toasts { top: calc(var(--safe-t) + 100px); }
}

/* ---- Story: radio chatter, scenes, story cards ---- */
#radio { position: fixed; z-index: 3; left: calc(var(--safe-l) + 8px); top: calc(var(--safe-t) + 70px); width: min(340px, calc(100vw - 16px)); display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.say { display: flex; gap: 9px; align-items: flex-start; }
.say .av { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; background: color-mix(in srgb, var(--c) 22%, #15110e); border: 2px solid var(--c); }
.say b { display: block; color: var(--c); font-size: 13px; }
.say b small { color: var(--muted); font-weight: 500; }
.say p { margin: 1px 0 0; }
.say.radio { padding: 8px 10px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--c); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: radioIn 0.3s ease-out; transition: opacity 0.6s, transform 0.6s; }
.say.radio p { font-size: 13px; }
.say.radio.out { opacity: 0; transform: translateX(-10px); }
@keyframes radioIn { from { opacity: 0; transform: translateX(-14px); } }
.scene { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 14px; padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); }
.scene .say p { font-size: 14px; }
.story { text-align: center; padding: 8px 4px; }
.story .big { font-size: 20px; line-height: 1.45; margin: 18px 0 22px; }
.story .scene { text-align: left; }
.note { position: relative; margin: 18px auto; padding: 18px 22px; max-width: 320px; transform: rotate(-1.5deg); background: #efe6d2; color: #2a2118; border-radius: 3px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); font: 22px/1.4 "Bradley Hand", "Segoe Print", "Comic Sans MS", cursive; text-align: left; }
.note .match { position: absolute; right: 12px; bottom: 6px; font-size: 18px; filter: grayscale(1) contrast(1.4); }
.dots { display: flex; justify-content: center; gap: 6px; margin-top: 14px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, 0.2); }
.dots i.on { background: var(--fire); }
details.how summary { cursor: pointer; color: var(--text); font-weight: 600; margin-bottom: 4px; }
.bonus { margin: 0 0 6px; color: var(--muted); }
.bonus.ok { color: var(--gold); }
@media (max-width: 560px) {
  #radio { top: auto; bottom: calc(var(--safe-b) + 112px); }
  .say.radio { padding: 6px 8px; }
  .say.radio p { font-size: 12px; }
  .say .av { width: 26px; height: 26px; font-size: 13px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  #radio { left: calc(var(--safe-l) + 150px); top: calc(var(--safe-t) + 60px); width: 300px; }
}

/* ---- Portraits ---- */
.say .av, .av { overflow: hidden; }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.unit .ic.face { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; border: 2px solid var(--c); display: block; }
.unit .ic.face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.unit.lost .ic.face img { filter: grayscale(1); }
.roster { display: flex; flex-direction: column; gap: 8px; margin: 0 0 12px; }
.unitrow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.unitrow .what { min-width: 86px; color: var(--muted); font-size: 12px; font-weight: 600; }
.mem { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 44px; }
.mem small { font-size: 10px; color: var(--muted); }
.av.sm { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--c); background: #15110e; }
@media (max-width: 560px) { .unit .ic.face { width: 28px; height: 28px; } .mem { width: 38px; } .av.sm { width: 30px; height: 30px; } }

/* ---- Fun pass: score, callouts, danger, decisions, medals, station, tutorial, forecast ---- */
#danger { position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0; transition: opacity 0.4s;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(220, 40, 10, 0.55) 100%); }
#danger.pulse { animation: dangerPulse 1.1s ease-in-out infinite alternate; }
@keyframes dangerPulse { from { filter: brightness(0.8); } to { filter: brightness(1.3); } }
#callout { position: fixed; z-index: 3; left: 50%; top: 34%; transform: translate(-50%, -50%) scale(0.6); opacity: 0; pointer-events: none;
  text-align: center; transition: transform 0.25s cubic-bezier(.2, 1.6, .4, 1), opacity 0.25s; }
#callout.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#callout b { display: block; font-size: clamp(30px, 8vw, 56px); font-weight: 900; letter-spacing: 0.04em; color: #ffd65a;
  text-shadow: 0 0 24px rgba(255, 150, 40, 0.8), 0 3px 0 #6a2a08; -webkit-text-stroke: 1px #6a2a08; }
#callout.warn b { color: #ff7a4a; }
#callout small { display: inline-block; margin-top: 4px; padding: 3px 12px; border-radius: 999px; background: rgba(0, 0, 0, 0.6); font-weight: 700; font-size: 15px; }
.dockrow { display: flex; align-items: center; justify-content: center; gap: 8px; }
#btnForecast { pointer-events: auto; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-weight: 700; font-size: 12px; }
#btnForecast:disabled { opacity: 0.5; }
#modal.urgent { background: rgba(60, 12, 4, 0.55); }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choices button { padding: 14px; font-size: 16px; }
.total { text-align: center; margin: 4px 0 10px; }
.total b { font-size: 40px; font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.total small { display: block; color: var(--muted); }
.total em { color: #7dff9a; font-style: normal; font-weight: 800; animation: pulse 0.6s ease-in-out infinite alternate; }
.medals { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0 0 12px; }
.medal { width: 92px; padding: 8px 4px; border-radius: 12px; background: rgba(255, 214, 90, 0.08); border: 1px solid rgba(255, 214, 90, 0.35);
  display: flex; flex-direction: column; align-items: center; text-align: center; opacity: 0; transform: scale(0.4); animation: medalIn 0.45s cubic-bezier(.2, 1.6, .4, 1) forwards; }
.medal span { font-size: 26px; }
.medal b { font-size: 12px; color: var(--gold); }
.medal small { font-size: 10px; color: var(--muted); }
@keyframes medalIn { to { opacity: 1; transform: scale(1); } }
.tally { display: grid; gap: 3px; margin: 0 0 10px; font-size: 13px; }
.tally div { display: flex; justify-content: space-between; color: var(--muted); }
.tally b { color: var(--text); font-variant-numeric: tabular-nums; }
.bonus em { color: #7dff9a; font-style: normal; }
.card .row { flex-wrap: wrap; }
.upgs { display: flex; flex-direction: column; gap: 8px; margin: 0 0 14px; }
.upg { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); }
.upg .ic { font-size: 24px; }
.upg small { display: block; color: var(--muted); font-size: 12px; }
.upg .tiers { display: flex; gap: 4px; margin-top: 4px; }
.upg .tiers em { width: 18px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.15); }
.upg .tiers em.on { background: var(--gold); }
.upg button { min-width: 64px; }
.upg button:disabled { opacity: 0.4; }
.lvl.daily { width: 64px; }
.lvl:disabled { opacity: 0.45; }
#coach { position: fixed; z-index: 4; left: 50%; top: calc(var(--safe-t) + 72px); transform: translateX(-50%); width: min(420px, calc(100vw - 16px));
  padding: 12px; border-radius: 14px; background: rgba(26, 21, 17, 0.97); border: 2px solid var(--gold); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
#coach .coach-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
#coach button { padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.07); font-weight: 700; }
#coach button.go { border: 0; background: linear-gradient(180deg, #ff8a3a, #e5541c); color: #fff; }
#coach button.link { background: none; border: 0; color: var(--muted); text-decoration: underline; }
.coach-target { position: relative; z-index: 5; box-shadow: 0 0 0 3px var(--gold), 0 0 24px rgba(255, 214, 90, 0.8) !important; animation: pulse 0.7s ease-in-out infinite alternate; }
@media (max-width: 400px) { #hud .stat.acres { display: none; } }
@media (max-width: 560px) { #radio .say:nth-last-child(n+3) { display: none; } }
@media (max-width: 560px) { #coach { top: calc(var(--safe-t) + 60px); } }

/* ---- Free Play and ranks ---- */
h3.mini { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 6px; }
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.slot { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); font-size: 20px; }
.slot small { font-size: 10px; color: var(--muted); text-align: center; }
.slot i { position: absolute; top: 2px; right: 6px; font-size: 10px; font-style: normal; color: var(--muted); }
.slot.empty { color: rgba(255, 255, 255, 0.25); justify-content: center; border-style: dashed; min-height: 56px; }
.upg.locked { opacity: 0.75; }
.upg.locked .ic { filter: grayscale(0.6); }
em.rank { font-style: normal; font-size: 11px; color: var(--gold); margin-left: 4px; }
button.link { background: none; border: 0; padding: 0; color: var(--gold); text-decoration: underline; font-weight: 700; }
.lvl.cond { width: auto; padding: 8px 14px; font-size: 14px; }
.ranks { display: grid; gap: 6px; margin: 0 0 10px; }
.rk { display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: center; font-size: 12px; }
.rk span { font-size: 20px; }
.rk b { font-size: 13px; }
.rk.up b { color: #7dff9a; }
.rk .bar { display: block; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); overflow: hidden; margin: 3px 0; }
.rk .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--fire), var(--gold)); }
.rk small { color: var(--muted); }
#btnRefill { pointer-events: auto; padding: 5px 12px; border-radius: 999px; border: 1px solid #5aaee8; background: rgba(10, 40, 70, 0.85); color: #d8efff; font-weight: 700; font-size: 12px; }
#btnRefill[hidden] { display: none; }
#btnRefill.low { border-color: #ffd65a; animation: pulse 0.6s ease-in-out infinite alternate; }
#btnRefill:disabled { opacity: 0.5; animation: none; }
.diff { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 12px; }
.diff small { width: 100%; color: var(--muted); font-size: 12px; }

/* ---- Radio calls: a card over the map while the fire runs at quarter speed ---- */
#decision { position: fixed; z-index: 4; left: 50%; top: calc(var(--safe-t) + 70px); transform: translateX(-50%); width: min(460px, calc(100vw - 16px));
  padding: 10px 12px 12px; border-radius: 14px; background: rgba(34, 14, 8, 0.92); border: 1px solid rgba(255, 122, 46, 0.6);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 26px rgba(255, 90, 30, 0.25); animation: decIn 0.25s ease-out; }
@keyframes decIn { from { opacity: 0; transform: translate(-50%, -10px); } }
#decision[hidden] { display: none; }
body.deciding #radio, body.deciding #coach { display: none; }
.dec-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.dec-head b { color: var(--fire); font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }
.dec-time { flex: 1; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.dec-time i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff4a2a, #ffb547); }
#decision .say p { font-size: 14px; }
.dec-look { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.dec-look.bad { color: #ff9a7a; font-weight: 700; }
.dec-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.dec-opts .opt { text-align: left; padding: 8px 9px; border-radius: 11px; background: rgba(255, 255, 255, 0.06); border: 2px solid var(--oc); color: var(--text); font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.dec-opts .opt.a { --oc: rgba(255, 214, 90, 0.85); }
.dec-opts .opt.b { --oc: rgba(124, 196, 255, 0.85); }
.dec-opts .opt:active { transform: scale(0.98); }
.dec-opts .opt b { font-size: 14px; display: flex; align-items: center; gap: 6px; }
.dec-opts .opt em { font-style: normal; width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--oc); color: #1a1410; font-size: 11px; font-weight: 900; flex: 0 0 auto; }
.dec-opts .opt small { font-size: 11.5px; line-height: 1.3; color: #e2d6c8; }
.dec-opts .opt small span { display: inline-block; margin-right: 5px; padding: 0 5px; border-radius: 4px; background: rgba(255, 255, 255, 0.12); color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.dec-note { margin: 8px 0 0; font-size: 11px; color: var(--muted); text-align: center; }
@media (max-width: 560px) {
  /* Phones: over the unit bar, so the map under the HUD stays visible for the A/B markers. */
  #decision { top: auto; bottom: calc(var(--safe-b) + 8px); padding: 8px 9px 10px; }
  @keyframes decIn { from { opacity: 0; transform: translate(-50%, 10px); } }
  #decision .say p { font-size: 13px; }
  .dec-opts { gap: 6px; }
  .dec-opts .opt { padding: 7px; }
  .dec-opts .opt b { font-size: 13px; }
  .dec-opts .opt small { font-size: 11px; }
}

/* Carried over from the last chapter's call (briefing), and the calls you made (results). */
.perks { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.perk { display: flex; gap: 8px; align-items: center; padding: 7px 9px; border-radius: 10px; background: rgba(120, 220, 140, 0.1); border: 1px solid rgba(120, 220, 140, 0.35); }
.perk.bad { background: rgba(255, 90, 74, 0.1); border-color: rgba(255, 90, 74, 0.4); }
.perk p { margin: 0; font-size: 13px; }
.perk b { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.calls { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 12px; text-align: left; }
.call { display: flex; gap: 9px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); }
.call b { display: block; font-size: 14px; }
.call small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.call small.ok { color: #9fe3a8; }
.call small.bad, .call small.miss { color: #ff9a8a; }
.call small.alt { font-style: italic; opacity: 0.85; }

/* ---- Tactical unit bar (5+ units): group buttons, then compact chips ---- */
#units.big { flex-direction: column; gap: 5px; }
#units .cards { display: flex; gap: 6px; }
#units .groups { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; }
#units .grp { flex: 0 0 auto; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: 600 12px system-ui, sans-serif; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
#units .grp small { color: var(--muted); margin-left: 2px; }
#units .grp.sel { border-color: #fff; box-shadow: 0 0 0 1px #fff; }
#units .grp:disabled { opacity: 0.4; }
#units .chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 5px; }
#units.compact .unit { grid-template-columns: 1fr; justify-items: center; padding: 5px 2px 8px; border-radius: 10px; }
#units.compact .unit .tx small { display: none; }
#units.compact .unit b { font-size: 11px; }
#units.compact .unit .ic { font-size: 18px; }
#units.compact .unit .ic.face { width: min(28px, 100%); height: auto; aspect-ratio: 1; }
#units.compact .unit .meter { left: 6px; right: 6px; bottom: 4px; }
#units .unit.member { border-color: rgba(255, 255, 255, 0.75); }
@media (orientation: landscape) and (max-height: 500px) {
  #units.compact .chips { grid-template-columns: repeat(3, 1fr) !important; }
  #units .groups { flex-wrap: wrap; }
}
/* Phones: one radio line at a time, just above the unit bar, two lines at most. */
@media (max-width: 560px) {
  #radio { bottom: calc(var(--safe-b) + var(--dock-h, 104px) + 14px); }
  #radio .say:not(:last-child) { display: none; }
  .say.radio p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}
#btnBurn { pointer-events: auto; white-space: nowrap; flex: 0 0 auto; padding: 5px 12px; border-radius: 999px; border: 1px solid #ff8a3a; background: rgba(70, 22, 6, 0.88); color: #ffe2cc; font-weight: 700; font-size: 12px; animation: pulse 0.9s ease-in-out infinite alternate; }
#btnBurn[hidden] { display: none; }

/* Loading a chapter or a Free Play valley. */
.loading-card { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 26px 10px; }
.loading-card p { margin: 0; color: var(--muted); font-weight: 600; }
.spin { width: 38px; height: 38px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, 0.12); border-top-color: var(--fire); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* A vehicle's own sprite as its icon (unit cards, Free Play). */
.vic { width: 30px; height: auto; display: block; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.5)); }
.slot .vic { width: 26px; margin: 0 auto 2px; }
#units.compact .unit .vic { width: 24px; }
