:root {
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --bg: #070a16; --bg-deep: #04050c; --surface: rgba(10, 14, 32, 0.88); --surface-2: rgba(18, 24, 48, 0.92);
  --border: rgba(34, 228, 255, 0.22); --border-soft: rgba(148, 163, 204, 0.16);
  --text: #eef1fb; --dim: #9aa4c2; --faint: #6f7a99;
  --lime: #3cf5a7; --magenta: #ff2dbf; --cyan: #22e4ff; --amber: #ffbd2e; --violet: #8b5cf6; --red: #ff4d6d;
  --grad: linear-gradient(90deg, #22e4ff 0%, #8b5cf6 55%, #ff2dbf 100%);
  --radius: 12px; --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);   /* a phone held sideways: its camera cutout */
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg-deep); color: var(--text); font-family: var(--font-body); -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
canvas#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }
canvas#overlay { position: fixed; inset: 0; pointer-events: none; }
[hidden] { display: none !important; }
button { font-family: var(--font-display); font-weight: 700; letter-spacing: 0.04em; color: var(--text); background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 10px; padding: 10px 16px; cursor: pointer; transition: transform 120ms var(--ease), border-color 120ms, background 120ms; font-size: 14px; }
button:hover { border-color: var(--cyan); transform: translateY(-1px); }
button:active { transform: translateY(1px) scale(0.98); }
button:disabled { opacity: 0.4; cursor: default; transform: none; }
button.primary { background: linear-gradient(180deg, #2af0b4, #13b988); color: #03140e; border-color: transparent; box-shadow: 0 6px 24px rgba(60, 245, 167, 0.35); }
button.big { font-size: 18px; padding: 14px 22px; }
button small { display: block; font-weight: 500; font-size: 11px; opacity: 0.75; letter-spacing: 0.02em; margin-top: 2px; }
kbd { font-family: var(--font-mono); font-size: 11px; padding: 1px 6px; border-radius: 5px; background: rgba(0, 0, 0, 0.28); border: 1px solid rgba(255, 255, 255, 0.2); margin-left: 6px; }
h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: 0.03em; }
h3 { font-size: 13px; color: var(--dim); letter-spacing: 0.14em; margin-bottom: 10px; }
h3.mt { margin-top: 18px; }

#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, rgba(0,0,0,0) 55%, rgba(0,0,0,0.42) 100%); }
#hurtflash { position: fixed; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at center, rgba(255,0,40,0) 40%, rgba(255,0,40,0.55) 100%); transition: opacity 300ms; }
#hurtflash.on { opacity: 1; transition: none; }
#flashwhite { position: fixed; inset: 0; pointer-events: none; background: #fff; opacity: 0; transition: opacity 600ms; }
#flashwhite.on { opacity: 0.85; transition: none; }

/* ---------------- HUD ---------------- */
#hud { position: fixed; inset: 0 var(--safe-r) 0 var(--safe-l); pointer-events: none; font-family: var(--font-display); }
.hud-tl { position: absolute; left: 16px; top: calc(14px + var(--safe-t)); width: min(340px, 46vw); }
.hpbar { position: relative; height: 22px; background: rgba(6, 8, 18, 0.8); border: 1px solid rgba(255,255,255,0.18); border-radius: 8px; overflow: hidden; }
.hpbar i { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; }
#hp-lag { background: rgba(255, 255, 255, 0.45); transition: width 600ms 200ms; z-index: 0; }
#hp-fill { background: linear-gradient(90deg, #ff3b5c, #ff6a3d); z-index: 1; transition: width 80ms; }
#hp-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; z-index: 2; text-shadow: 0 1px 2px #000; }
.lvwrap { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
#lvl { font-weight: 700; font-size: 14px; min-width: 44px; text-shadow: 0 1px 3px #000; }
.xpbar { flex: 1; height: 9px; background: rgba(6, 8, 18, 0.8); border-radius: 6px; overflow: hidden; border: 1px solid rgba(255,255,255,0.12); }
#xp-fill { display: block; height: 100%; width: 0; background: var(--grad); transition: width 120ms; }
#loadout { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.slot { width: 36px; height: 36px; border-radius: 8px; background: rgba(6, 8, 18, 0.78); border: 1px solid rgba(255,255,255,0.14); position: relative; display: grid; place-items: center; }
.slot svg { width: 24px; height: 24px; }
.slot.evo { border-color: var(--amber); box-shadow: 0 0 12px rgba(255, 189, 46, 0.6); }
.slot b { position: absolute; right: 2px; bottom: 0; font-size: 10px; text-shadow: 0 1px 2px #000; }
.slot.passive { width: 28px; height: 28px; }
.slot.passive svg { width: 18px; height: 18px; }
.slot.syn { width: 26px; height: 26px; border-color: rgba(255, 224, 102, 0.7); box-shadow: 0 0 10px rgba(255, 224, 102, 0.45); }
.slot.syn svg { width: 16px; height: 16px; }
.card .syn { margin-top: 8px; font-size: 11px; font-weight: 800; letter-spacing: 0.06em; color: #ffe066; text-shadow: 0 0 8px rgba(255, 224, 102, 0.6); }
#buffs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.buff { font-size: 11px; font-weight: 700; padding: 3px 8px 4px; border-radius: 6px; background: rgba(6,8,18,0.8); border: 1px solid; position: relative; overflow: hidden; }
.buff i { position: absolute; left: 0; bottom: 0; height: 2px; background: currentColor; }
.hud-top { position: absolute; left: 50%; top: calc(10px + var(--safe-t)); transform: translateX(-50%); text-align: center; width: min(560px, 60vw); }
#timer { font-size: 30px; font-weight: 700; letter-spacing: 0.06em; text-shadow: 0 2px 8px rgba(0,0,0,0.7); font-variant-numeric: tabular-nums; }
#timer.late { color: var(--red); }
#epoch { font-size: 11px; letter-spacing: 0.2em; color: var(--dim); text-shadow: 0 1px 3px #000; }
#bossbar { margin-top: 8px; }
.bb-name { font-size: 13px; letter-spacing: 0.18em; font-weight: 700; text-shadow: 0 1px 4px #000; }
.bb-bar { height: 12px; background: rgba(6,8,18,0.85); border: 1px solid rgba(255,255,255,0.25); border-radius: 7px; overflow: hidden; margin-top: 4px; }
.bb-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff2e63, #ff8a2b); transition: width 150ms; }
/* phase two (js/bosses.js): the bar burns: hotter colours and a slow glow (no flashing) */
#bossbar.p2 .bb-bar { border-color: #ff7a1a; box-shadow: 0 0 10px rgba(255, 90, 20, 0.55); }
#bossbar.p2 .bb-bar i { background: linear-gradient(90deg, #ff3b1a, #ffd84a); animation: bbBurn 1.2s ease-in-out infinite alternate; }
@keyframes bbBurn { from { filter: brightness(1); } to { filter: brightness(1.25); } }
.hud-tr { position: absolute; right: 16px; top: calc(14px + var(--safe-t)); text-align: right; }
#credits { font-size: 22px; font-weight: 700; color: var(--amber); text-shadow: 0 2px 6px rgba(0,0,0,0.7); display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
#credits.pulse b { animation: pulse 260ms var(--ease); display: inline-block; }
@keyframes pulse { 0% { transform: scale(1.35); } 100% { transform: scale(1); } }
.coin { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3c4, #ffbd2e 45%, #b8780d); box-shadow: 0 0 10px rgba(255,189,46,0.7); display: inline-block; }
#kills { font-size: 15px; color: var(--text); text-shadow: 0 1px 4px #000; margin-top: 2px; }
#credits small, #kills small { font-size: 10px; color: var(--dim); letter-spacing: 0.12em; }
#fps { font-family: var(--font-mono); font-size: 10px; color: var(--faint); margin-top: 4px; }
#combo { position: absolute; right: 18px; top: 38%; text-align: right; font-family: var(--font-display); }
#combo b { display: block; font-size: 52px; line-height: 1; font-weight: 700; background: linear-gradient(180deg, #fff, #ffbd2e); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.6)); }
#combo span { font-size: 12px; letter-spacing: 0.3em; color: var(--dim); }
#combo em { display: block; font-style: normal; font-size: 13px; color: var(--amber); font-weight: 700; }
#combo i { display: block; height: 3px; background: var(--amber); margin-top: 4px; margin-left: auto; border-radius: 2px; }
#combo.fire b { background: linear-gradient(180deg, #fff6a0, #ff5d2e); -webkit-background-clip: text; background-clip: text; animation: flick 120ms infinite alternate; }
@keyframes flick { from { transform: translateY(0) scale(1); } to { transform: translateY(-1px) scale(1.03); } }
#combo.bump b { animation: pulse 200ms var(--ease); }
#minimap { position: absolute; right: 14px; bottom: calc(14px + var(--safe-b)); width: 180px; height: 180px; border-radius: 50%; border: 2px solid rgba(34, 228, 255, 0.35); box-shadow: 0 6px 20px rgba(0,0,0,0.5); background: rgba(4,6,14,0.6); }
#prompt { position: absolute; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); padding: 10px 18px; border-radius: 10px; background: var(--surface); border: 1px solid var(--amber); font-weight: 700; font-size: 15px; letter-spacing: 0.04em; white-space: nowrap; }
#prompt.poor { border-color: var(--red); color: #ffb3c0; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: rgba(255,255,255,0.7); box-shadow: 0 0 0 2px rgba(0,0,0,0.35); opacity: 0.6; }

#toasts { position: fixed; left: 50%; top: calc(104px + var(--safe-t)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; z-index: 5; width: min(92vw, 640px); }
.toast { font-family: var(--font-display); font-weight: 700; font-size: 13px; letter-spacing: 0.06em; padding: 8px 14px; border-radius: 9px; background: var(--surface); border-left: 3px solid; box-shadow: 0 6px 18px rgba(0,0,0,0.4); animation: toastIn 300ms var(--ease); text-align: center; }
.toast.out { opacity: 0; transform: translateY(-8px); transition: all 400ms; }
.toast.ach { border: 1px solid var(--amber); background: linear-gradient(90deg, rgba(60,40,0,0.92), rgba(20,14,0,0.92)); }
.toast.ach small { display: block; color: var(--amber); font-size: 11px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px) scale(0.96); } to { opacity: 1; transform: none; } }
#banner { position: fixed; left: 0; right: 0; top: 30%; text-align: center; pointer-events: none; z-index: 6; animation: bannerIn 700ms var(--ease); }
#banner h2 { max-width: 94vw; margin: 0 auto; line-height: 1.02; font-size: clamp(26px, 5.4vw, 64px); font-weight: 700; letter-spacing: 0.04em; text-shadow: 0 4px 30px rgba(0,0,0,0.8), 0 0 40px currentColor; }
#banner p { font-family: var(--font-display); font-size: clamp(13px, 2vw, 18px); color: var(--text); letter-spacing: 0.14em; text-shadow: 0 2px 8px #000; margin: 6px 0 0; }
#banner.ufo h2 { font-size: clamp(38px, 6.4vw, 72px); }   /* the UFO's ALIEN AUDIT (js/ufo.js): big and bold enough for a phone */
#banner.ufo p { font-size: clamp(16px, 2.3vw, 20px); font-weight: 700; letter-spacing: 0.08em; text-shadow: 0 2px 6px #000, 0 0 2px #000; }
/* a plate behind the title and a large subtitle, for a banner over a busy sky (FLASH CRASH's INCOMING) */
#banner.plate h2 { display: inline-block; max-width: 92vw; padding: 4px 26px 8px; border-radius: 14px; background: #0a0608; border: 3px solid var(--bc, #fff); box-shadow: 0 8px 30px rgba(0,0,0,0.55); text-shadow: 0 0 26px currentColor; }
#banner.plate p { width: fit-content; max-width: 92vw; margin: 10px auto 0; padding: 6px 16px; border-radius: 10px; background: #0a0608; color: #fff; font-weight: 700; font-size: clamp(15px, 2.6vw, 24px); letter-spacing: 0.08em; }
#toasts.held { opacity: 0; transition: opacity 150ms; }
@keyframes bannerIn { from { opacity: 0; transform: scale(1.35); letter-spacing: 0.3em; } to { opacity: 1; transform: none; } }
/* the partners' hero card (js/ui.js crewBanner): a face badge ringed in their colour, a slanted plate with their name */
#crew-banner { --hc: #3cf5a7; position: fixed; left: calc(16px + var(--safe-l)); bottom: calc(110px + var(--safe-b)); display: flex; align-items: center; z-index: 6; max-width: 92vw; pointer-events: none; animation: heroIn 650ms var(--ease); filter: drop-shadow(0 10px 28px rgba(0,0,0,0.55)); }
#crew-banner .hc-face { position: relative; z-index: 1; flex: none; width: 96px; height: 96px; border-radius: 50%; overflow: hidden; border: 3px solid var(--hc); background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--hc) 60%, #0b0f16), #0b0f16 72%); box-shadow: 0 0 0 3px rgba(8,10,16,0.85), 0 0 26px var(--hc); animation: heroFace 700ms var(--ease); }
#crew-banner img { width: 100%; height: 100%; object-fit: contain; object-position: 50% 30%; transform: scale(1.18) translateY(8%); }
#crew-banner .hc-text { margin-left: -22px; padding: 10px 22px 11px 36px; transform: skewX(-10deg); background: linear-gradient(100deg, rgba(10,13,20,0.96) 70%, color-mix(in srgb, var(--hc) 30%, rgba(10,13,20,0.9))); border-left: 6px solid var(--hc); border-bottom: 2px solid color-mix(in srgb, var(--hc) 60%, transparent); }
#crew-banner .hc-text > * { transform: skewX(10deg); }
#crew-banner i { display: inline-block; font-style: normal; font-family: var(--font-display); font-weight: 700; font-size: 11px; letter-spacing: 0.28em; color: #0b0f16; background: var(--hc); padding: 1px 8px; border-radius: 3px; }
#crew-banner b { display: block; font-family: var(--font-display); font-size: 26px; line-height: 1.05; color: var(--hc); text-shadow: 0 0 18px color-mix(in srgb, var(--hc) 70%, transparent); letter-spacing: 0.03em; margin-top: 3px; }
#crew-banner span { font-size: 11px; letter-spacing: 0.2em; color: var(--dim); }
#crew-banner em { display: block; font-style: normal; font-family: var(--font-display); font-weight: 700; font-size: 14px; margin-top: 3px; color: var(--text); }
#crew-banner q { display: block; font-size: 13px; color: var(--dim); margin-top: 2px; }
#crew-banner.calm, #crew-banner.calm .hc-face { animation: heroFade 300ms ease-out; }
#crew-banner.exit b { font-size: 34px; letter-spacing: 0.05em; }
#crew-banner.exit em, #crew-banner.exit q { display: none; }
@keyframes heroIn { 0% { transform: translateX(-115%) skewX(14deg); } 70% { transform: translateX(3%) skewX(-3deg); } 100% { transform: none; } }
@keyframes heroFace { 0%, 35% { transform: scale(0.4); } 75% { transform: scale(1.12); } 100% { transform: none; } }
@keyframes heroFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes crewIn { from { transform: translateX(-120%); } to { transform: none; } }

/* ---------------- screens ---------------- */
.screen { position: fixed; inset: 0; display: flex; overflow-y: auto; z-index: 10; padding: calc(16px + var(--safe-t)) calc(16px + var(--safe-r)) calc(16px + var(--safe-b)) calc(16px + var(--safe-l)); }
.screen > * { margin: auto; }
.modal { background: rgba(3, 5, 12, 0.62); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal-box { width: min(560px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 22px; box-shadow: 0 24px 80px rgba(0,0,0,0.6); animation: pop 360ms var(--ease); }
.modal-box.wide { width: min(900px, 100%); }
@keyframes pop { from { opacity: 0; transform: scale(0.94) translateY(10px); } to { opacity: 1; transform: none; } }
.kicker { font-family: var(--font-display); font-size: 12px; letter-spacing: 0.3em; color: var(--lime); font-weight: 700; }
.modal-box h2 { font-size: clamp(26px, 5vw, 38px); margin: 4px 0 16px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 16px; }
.row.col { flex-direction: column; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.card { text-align: left; padding: 16px; border-radius: 14px; background: linear-gradient(180deg, rgba(30,38,70,0.95), rgba(12,16,34,0.95)); border: 2px solid var(--border-soft); position: relative; min-height: 180px; display: flex; flex-direction: column; gap: 6px; }
.card:hover { border-color: var(--c, var(--cyan)); box-shadow: 0 0 0 1px var(--c, var(--cyan)), 0 12px 40px rgba(0,0,0,0.4); }
.card .ic { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; background: rgba(0,0,0,0.35); border: 1px solid var(--c); }
.card .ic svg { width: 34px; height: 34px; }
.card .t { font-size: 19px; }
.card .s { font-size: 11px; letter-spacing: 0.16em; color: var(--c); }
.card .d { font-family: var(--font-body); font-weight: 400; font-size: 13px; color: var(--dim); letter-spacing: 0; line-height: 1.4; }
.card kbd { position: absolute; right: 12px; top: 12px; }
.card.evo { border-color: var(--amber); box-shadow: 0 0 30px rgba(255,189,46,0.35); }
.card.evo::after { content: 'EVOLUTION'; position: absolute; right: 12px; bottom: 12px; font-size: 10px; letter-spacing: 0.2em; color: var(--amber); }

/* the everything-maxed level-up (ui.patchPrompt): two choices for the rest of the run, each in its own colour */
#levelup.patch .modal-box.wide { width: min(720px, 100%); border-color: rgba(60,245,167,0.4); box-shadow: 0 0 0 1px rgba(60,245,167,0.12), 0 0 70px rgba(60,245,167,0.14), 0 24px 80px rgba(0,0,0,0.6); }
#levelup.patch .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
#levelup.patch .card { min-height: 0; align-items: center; text-align: center; gap: 8px; padding: 20px 18px 16px; border-color: color-mix(in srgb, var(--c) 60%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 12%, rgba(26,34,66,0.96)), rgba(12,16,34,0.96) 75%); box-shadow: inset 0 1px 0 color-mix(in srgb, var(--c) 30%, transparent); }
#levelup.patch .card:hover, #levelup.patch .card:focus-visible, #levelup.patch .card.pad-focus { border-color: var(--c); box-shadow: 0 0 0 1px var(--c), 0 0 28px color-mix(in srgb, var(--c) 35%, transparent); }
#levelup.patch .card .ic { width: 64px; height: 64px; border-radius: 16px; background: color-mix(in srgb, var(--c) 14%, rgba(0,0,0,0.35)); }
#levelup.patch .card .ic svg { width: 42px; height: 42px; }
#levelup.patch .card .t { font-size: 21px; }
#levelup.patch .card .s { font-size: 13px; letter-spacing: 0.1em; filter: brightness(1.12); }
#levelup.patch .card .d { font-size: 15px; color: #e1e7f6; }
#levelup.patch .card kbd { right: 10px; top: 10px; font-size: 18px; font-weight: 800; line-height: 1; min-width: 34px; padding: 7px 10px; text-align: center; color: #071018; background: var(--c); border: 0; border-radius: 9px; box-shadow: 0 2px 10px rgba(0,0,0,0.45); }
#levelup.patch .card .cta { margin-top: 8px; padding: 11px 22px; min-height: 40px; box-sizing: border-box; border-radius: 999px; font-family: var(--font-display); font-size: 12px; letter-spacing: 0.16em; color: #071018; background: var(--c); }
body.touch #levelup.patch .card kbd { display: none; }
.lv-note { margin: -4px 0 16px; padding: 10px 14px; border-radius: 10px; font-family: var(--font-body); font-size: 17px; font-weight: 600; line-height: 1.4; color: #f2f6ff; background: rgba(60,245,167,0.1); border: 1px solid rgba(60,245,167,0.45); }
.lv-note b { color: #3cf5a7; }
@media (max-width: 820px) {
  #levelup.patch .cards { grid-template-columns: 1fr; gap: 12px; }
  #levelup.patch .card { flex-direction: column; flex-wrap: nowrap; padding: 16px 14px 14px; gap: 6px; }
  #levelup.patch .card .ic { width: 52px; height: 52px; }
  #levelup.patch .card .ic svg { width: 34px; height: 34px; }
  #levelup.patch .card .t { font-size: 19px; }
  #levelup.patch .card .d { font-size: 14.5px; flex-basis: auto; }
  #levelup.patch .card .cta { align-self: stretch; min-height: 44px; }
  #levelup.patch .lv-note { font-size: 15.5px; margin: -6px 0 12px; }
  #levelup.patch .card .ic { flex-shrink: 0; }
}

/* chest reels */
#reels { display: flex; gap: 12px; justify-content: center; margin: 10px 0; }
.reel { width: min(150px, 27vw); height: 170px; border-radius: 14px; background: #060914; border: 2px solid var(--border-soft); overflow: hidden; position: relative; }
.reel .strip { position: absolute; left: 0; right: 0; top: 0; }
.reel .cell { height: 170px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 8px; text-align: center; }
.reel .cell svg { width: 56px; height: 56px; }
.reel .cell b { font-family: var(--font-display); font-size: 13px; }
.reel .cell small { font-size: 10px; color: var(--dim); letter-spacing: 0.1em; }
.reel.stopped { border-color: var(--rc, var(--cyan)); box-shadow: 0 0 24px var(--rc, var(--cyan)); }
.reel.dead { opacity: 0.28; filter: grayscale(1); }
#chest-rarity { transition: color 200ms; }
#chest-result { text-align: center; color: var(--dim); font-size: 14px; min-height: 20px; }
.jackpot #chest-rarity { animation: flick 90ms infinite alternate; }

/* results */
.results h3 { margin-top: 18px; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.stat { background: rgba(0,0,0,0.25); border: 1px solid var(--border-soft); border-radius: 10px; padding: 10px 12px; }
.stat b { display: block; font-family: var(--font-display); font-size: 22px; }
.stat span { font-size: 10px; letter-spacing: 0.16em; color: var(--dim); }
.stat.hl b { color: var(--amber); }
#rs-best { font-family: var(--font-display); color: var(--amber); letter-spacing: 0.2em; font-size: 13px; margin-bottom: 10px; }
.qrow { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 10px 12px; border-radius: 10px; background: rgba(0,0,0,0.22); border: 1px solid var(--border-soft); margin-bottom: 6px; }
.qrow b { font-family: var(--font-display); font-size: 14px; }
.qrow small { color: var(--dim); font-size: 12px; }
.qrow .rw { font-family: var(--font-display); color: var(--amber); font-size: 13px; text-align: right; }
.qrow .qb { grid-column: 1 / -1; height: 6px; border-radius: 4px; background: rgba(255,255,255,0.08); overflow: hidden; }
.qrow .qb i { display: block; height: 100%; background: var(--grad); transition: width 1200ms var(--ease); }
.qrow.done { border-color: var(--amber); background: rgba(80, 60, 0, 0.3); }
.qrow .unlock { color: var(--lime); font-size: 11px; letter-spacing: 0.1em; }
.pbar { margin-top: 14px; }
.pbar .lv { font-family: var(--font-display); font-size: 14px; display: flex; justify-content: space-between; }
.pbar .bar { height: 10px; border-radius: 6px; background: rgba(255,255,255,0.08); overflow: hidden; margin-top: 4px; }
.pbar .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--lime), var(--cyan)); transition: width 1400ms var(--ease); }

/* title */
#title { background: linear-gradient(180deg, rgba(4,5,12,0.35), rgba(4,5,12,0.75)); }
.title-wrap { width: min(1100px, 100%); }
.brand { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.logo { font-family: var(--font-display); font-weight: 700; font-size: clamp(40px, 8vw, 84px); line-height: 0.9; letter-spacing: 0.01em; background: linear-gradient(180deg, #fff 30%, #ffbd2e); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 6px 24px rgba(0,0,0,0.65)); }
.logo span { font-size: 0.5em; vertical-align: middle; -webkit-text-fill-color: var(--lime); }
.badge { font-family: var(--font-display); font-weight: 700; font-size: 13px; letter-spacing: 0.24em; padding: 6px 12px; border-radius: 999px; background: var(--grad); color: #04050c; margin-bottom: 8px; }
#profile-chip { margin-left: auto; font-family: var(--font-display); font-size: 13px; padding: 8px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border-soft); margin-bottom: 6px; }
#profile-chip b { color: var(--amber); }
.title-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; }
.panel { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 18px; padding: 16px; }
#char-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.char { padding: 10px 8px; border-radius: 12px; text-align: center; background: rgba(0,0,0,0.25); border: 2px solid var(--border-soft); position: relative; min-height: 118px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; }
.char.on { border-color: var(--lime); box-shadow: 0 0 20px rgba(60,245,167,0.35); background: rgba(20, 60, 40, 0.35); }
.char .av { width: 54px; height: 64px; display: grid; place-items: center; }
.char .av img { max-width: 100%; max-height: 100%; }
.char .av .dot { width: 40px; height: 56px; border-radius: 10px; }
.char b { font-size: 12px; font-family: var(--font-display); line-height: 1.1; }
.char.locked { opacity: 0.55; }
.char.locked::after { content: '🔒'; position: absolute; top: 6px; right: 8px; font-size: 13px; }
.char .crewtag { position: absolute; top: 6px; left: 8px; font-size: 9px; letter-spacing: 0.14em; color: var(--amber); }
#char-detail { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: rgba(0,0,0,0.25); min-height: 96px; }
#char-detail b { font-family: var(--font-display); font-size: 20px; }
#char-detail p { margin: 4px 0; color: var(--dim); font-size: 13px; }
#char-detail .kv { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; font-family: var(--font-mono); color: var(--text); margin-top: 6px; }
#char-detail .lockmsg { color: var(--amber); font-weight: 600; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.seg button.on { border-color: var(--lime); background: rgba(20, 60, 40, 0.5); }
.toggle { display: flex; align-items: center; gap: 8px; margin: 12px 0; font-family: var(--font-display); font-weight: 700; font-size: 14px; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--lime); }
.toggle small { margin-left: auto; color: var(--dim); font-weight: 500; font-size: 11px; }
details { margin-bottom: 12px; }
summary { font-family: var(--font-display); font-weight: 700; font-size: 13px; letter-spacing: 0.1em; cursor: pointer; color: var(--dim); }
#curse-list { display: grid; gap: 4px; margin-top: 8px; }
#curse-list label { font-size: 12px; display: flex; gap: 8px; align-items: center; }
#curse-list label small { color: var(--faint); }
#play { width: 100%; margin-top: 4px; font-size: 22px; padding: 16px; }
.nav { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.controls { margin-top: 12px; text-align: center; font-size: 12px; color: var(--dim); text-shadow: 0 1px 3px #000; }
.shop { display: grid; gap: 8px; }
.shop .item { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; padding: 12px; border-radius: 12px; background: rgba(0,0,0,0.25); border: 1px solid var(--border-soft); }
.shop .item b { font-family: var(--font-display); }
.shop .item small { color: var(--dim); display: block; }
.pips { display: flex; gap: 3px; margin-top: 4px; }
.pips i { width: 16px; height: 5px; border-radius: 3px; background: rgba(255,255,255,0.12); }
.pips i.on { background: var(--lime); }
/* settings in tabs (js/ui.js settingsHTML): one short panel at a time */
.set-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border-soft); }
.set-tab { font: 700 12px var(--font-display); letter-spacing: 0.12em; padding: 8px 12px; border-radius: 9px; border: 1px solid var(--border-soft); background: var(--surface-2); color: var(--dim); cursor: pointer; }
#pause .set-tabs { gap: 4px; } #pause .set-tab { padding: 7px 8px; font-size: 11px; letter-spacing: 0.08em; }   /* the narrower pause card: one row */
.set-tab.on { color: #06110c; background: var(--lime); border-color: var(--lime); }
.set-tab:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.set-panel h3:first-child { margin-top: 0; }
.settings { display: grid; gap: 10px; }
.settings label { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; font-size: 13px; }
.settings select, .settings input[type=range], .settings input[type=text] { font-family: var(--font-body); background: var(--surface-2); color: var(--text); border: 1px solid var(--border-soft); border-radius: 8px; padding: 6px; }
.settings input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--lime); }
.help { color: var(--dim); font-size: 12px; line-height: 1.5; }
/* Settings > DATA > USAGE STATS (js/telemetry.js): the heading with its NEW ANONYMOUS ID button, the switch with its note */
.tm-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0 6px; }
.tm-head h3 { margin: 0; }
.tm-new { padding: 5px 12px; font-size: 11px; min-height: 0; flex: none; }
.tm-flag { flex: 1; text-align: right; font-size: 11px; line-height: 1.3; }
.tm-note { display: block; margin-top: 2px; font-size: 11px; line-height: 1.4; }
.tm-note b { color: var(--text); font-weight: 600; }

#bigmap { position: fixed; inset: 0; background: rgba(3,5,12,0.8); z-index: 9; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#bigmap canvas { width: min(92vw, 80vh); height: min(92vw, 80vh); border-radius: 16px; border: 2px solid var(--border); }
#bigmap p { color: var(--dim); font-size: 12px; }
#loading { position: fixed; inset: 0; display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; background: rgba(4,5,12,0.85); z-index: 30; font-family: var(--font-display); letter-spacing: 0.2em; }
.spinner { width: 42px; height: 42px; border: 4px solid rgba(255,255,255,0.15); border-top-color: var(--amber); border-radius: 50%; animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#error { position: fixed; left: 12px; right: 12px; bottom: 12px; padding: 12px; border-radius: 10px; background: #3a0b14; border: 1px solid var(--red); color: #ffd0d8; font-family: var(--font-mono); font-size: 12px; z-index: 40; white-space: pre-wrap; }

/* ---------------- touch ---------------- */
#touch { position: fixed; inset: 0; pointer-events: none; z-index: 4; display: none; }
body.touch #touch:not([hidden]) { display: block; }
#stick { position: fixed; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.25); background: rgba(0,0,0,0.18); opacity: 0; left: calc(90px + var(--safe-l)); top: 70%; }
#stick.on { opacity: 1; }
#stick-knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(255,255,255,0.4); }
.touch-btn { position: fixed; pointer-events: auto; border-radius: 50%; width: 84px; height: 84px; font-size: 14px; background: rgba(10,14,32,0.55); border: 2px solid rgba(255,255,255,0.3); touch-action: none; padding: 0; }
#btn-jump { right: calc(24px + var(--safe-r)); bottom: calc(40px + var(--safe-b)); width: 96px; height: 96px; border-color: var(--lime); }
#btn-slide { right: calc(132px + var(--safe-r)); bottom: calc(26px + var(--safe-b)); }
#btn-use { right: calc(44px + var(--safe-r)); bottom: calc(150px + var(--safe-b)); border-color: var(--amber); }
.touch-btn.small { width: 48px; height: 48px; font-size: 12px; border-radius: 12px; }
#btn-pause { right: calc(12px + var(--safe-r)); top: calc(204px + var(--safe-t)); }
#btn-map { right: calc(68px + var(--safe-r)); top: calc(204px + var(--safe-t)); }
body.touch #minimap { width: 104px; height: 104px; right: 12px; left: auto; top: calc(92px + var(--safe-t)); bottom: auto; }
body.touch #crosshair { display: none; }
body.touch #prompt { bottom: calc(160px + var(--safe-b)); }

@media (max-width: 820px) {
  /* phone portrait HUD: two columns, nothing in the middle of the view */
  .hud-tl { width: 56vw; left: 10px; top: calc(8px + var(--safe-t)); }
  .hpbar { height: 18px; }
  #hp-text { font-size: 11px; }
  .hud-tr { right: 10px; top: calc(8px + var(--safe-t)); }
  .hud-top { left: auto; right: 10px; transform: none; width: auto; text-align: right; top: calc(58px + var(--safe-t)); }
  #timer { font-size: 18px; }
  #epoch { display: none; }
  #bossbar { position: fixed; left: 10vw; right: 10vw; top: 24%; margin: 0; text-align: center; }
  .bb-name { font-size: 11px; }
  #combo { right: auto; left: 10px; top: 46%; text-align: left; }
  #combo i { margin-left: 0; }
  #toasts { top: 32%; width: 84vw; gap: 4px; }
  .toast { font-size: 11px; padding: 6px 10px; }
  #toasts .toast:nth-last-child(n+3) { display: none; }
  .title-grid { grid-template-columns: 1fr; }
  #char-list { grid-template-columns: repeat(4, 1fr); }
  .char { min-height: 96px; }
  .char .av { width: 40px; height: 48px; }
  .hud-tl { width: 52vw; }
  #timer { font-size: 22px; }
  .hud-top { width: 40vw; }
  #epoch { font-size: 9px; letter-spacing: 0.1em; }
  #credits { font-size: 17px; }
  #combo b { font-size: 36px; }
  #combo { top: 30%; }
  .cards { grid-template-columns: 1fr; }
  .card { min-height: 0; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .card .d { flex-basis: 100%; }
  #crew-banner { bottom: auto; top: 14%; left: 8px; right: 8px; }
  #crew-banner .hc-face { width: 60px; height: 60px; }
  #crew-banner .hc-text { padding: 6px 12px 7px 28px; }
  #crew-banner b { font-size: 17px; }
  #crew-banner em { font-size: 12px; }
  #crew-banner q { display: none; }
  .reel { height: 130px; }
  .reel .cell { height: 130px; }
  .reel .cell svg { width: 40px; height: 40px; }
  .slot { width: 30px; height: 30px; }
  .slot svg { width: 20px; height: 20px; }
}
@media (max-width: 400px) {
  #char-list { grid-template-columns: repeat(4, 1fr); gap: 5px; }
  .char b { font-size: 10px; }
  .modal-box { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

/* ---- meta layer: seed selector, tiers, streak, locker, history, share card ---- */
.seg.seg3 { grid-template-columns: repeat(3, 1fr); margin-top: 6px; }
.seg.seg3 button { font-size: 12px; padding: 8px 4px; }
.seg.seg3 small { display: block; font-size: 10px; opacity: 0.75; font-weight: 600; }
#seed-info { font-size: 11px; color: #b07bff; min-height: 14px; margin: 4px 0 6px; letter-spacing: 0.04em; }
.tier-row { display: grid; grid-template-columns: 34px 1fr 34px; gap: 6px; align-items: center; margin: 6px 0; }
.tier-row button { height: 44px; border-radius: 10px; font-weight: 900; }
.tier-row button:disabled { opacity: 0.3; }
#tier-box { text-align: center; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,189,46,0.35); border-radius: 10px; padding: 6px 8px; }
#tier-box b { display: block; color: #ffbd2e; letter-spacing: 0.1em; }
#tier-box small { display: block; font-size: 10px; color: #b8c4d8; line-height: 1.3; }
#streak-chip { font-size: 12px; font-weight: 800; color: #ff8a2b; margin: 2px 0 8px; min-height: 16px; letter-spacing: 0.05em; }
.locker { display: grid; gap: 14px; }
.locker .slotrow { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.locker .cos { text-align: left; padding: 10px; border-radius: 10px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12); color: #e8ecf6; }
.locker .cos b { display: block; font-size: 13px; }
.locker .cos small { display: block; font-size: 10px; opacity: 0.7; margin-top: 3px; }
.locker .cos.on { border-color: #3cf5a7; box-shadow: 0 0 12px rgba(60,245,167,0.35); }
.locker .cos.locked { opacity: 0.6; }
/* worn: a filled card with a tick; NONE: a red cross (owner 2026-10-15: take things off) */
.locker .cos.on { background: rgba(60,245,167,0.13); }
.locker .cos.on small { opacity: 1; color: #9dffd6; font-weight: 700; }
.locker .cos.on b::after { content: ' ✓'; color: #3cf5a7; }
.locker .cos .off { display: inline-block; margin-top: 7px; padding: 4px 10px; border-radius: 999px; background: #ff5c72; color: #1a0b10; font-size: 12px; font-weight: 900; letter-spacing: 0.05em; box-shadow: 0 0 10px rgba(255,92,114,0.45); }
.locker .cos.none .x { display: inline-block; margin-right: 6px; color: #ff6b7d; font-weight: 900; }
.locker .sw { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 6px; border: 1px solid rgba(255,255,255,0.3); }
.hist .qrow small { line-height: 1.5; }
.hist .cause { color: #ff8a8a; }
#rs-cause { text-align: center; color: #ff8a8a; font-weight: 700; margin: -4px 0 8px; min-height: 16px; font-size: 13px; }
#share-wrap { margin-top: 12px; }
#share-wrap canvas { width: 100%; height: auto; border-radius: 10px; border: 1px solid rgba(255,255,255,0.15); }
.hist .hw svg { width: 16px; height: 16px; margin-right: 2px; }
/* ---- the collection book (js/collection.js) ---- */
.cbook { display: grid; gap: 14px; min-width: 0; }
.cb-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: center; padding: 14px; border-radius: 14px; border: 1px solid var(--border); background: linear-gradient(120deg, rgba(34,228,255,0.10), rgba(139,92,246,0.10) 55%, rgba(255,45,191,0.08)); }
.cb-ring { --p: 0; position: relative; width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--lime) calc(var(--p) * 1%), rgba(255,255,255,0.09) 0); box-shadow: 0 0 24px rgba(60,245,167,0.25); }
.cb-ring::before { content: ''; position: absolute; inset: 8px; border-radius: 50%; background: radial-gradient(circle at 50% 35%, #182040, #0a0e20); }
.cb-ring b { position: relative; font-family: var(--font-display); font-size: 28px; line-height: 1; }
.cb-ring b small { font-size: 13px; color: var(--dim); margin-left: 1px; }
.cb-sum { display: grid; gap: 6px; min-width: 0; }
.cb-sum > b { font-family: var(--font-display); font-size: 15px; letter-spacing: 0.12em; }
.cb-sum > small { color: var(--dim); font-size: 12px; line-height: 1.45; }
.cb-miles { display: flex; flex-wrap: wrap; gap: 6px; }
.cb-mile { position: relative; display: grid; gap: 1px; padding: 5px 10px 5px 9px; border-radius: 9px; border: 1px solid var(--border-soft); background: rgba(0,0,0,0.25); font-family: var(--font-display); }
.cb-mile b { font-size: 13px; color: var(--dim); }
.cb-mile small { font-size: 10px; color: var(--faint); letter-spacing: 0.03em; }
.cb-mile.next { border-color: var(--amber); }
.cb-mile.next b { color: var(--amber); }
.cb-mile.got { border-color: rgba(60,245,167,0.45); background: rgba(60,245,167,0.14); padding-right: 22px; }
.cb-mile.got b { color: var(--lime); }
.cb-mile.got small { color: rgba(60,245,167,0.65); text-decoration: line-through; text-decoration-color: rgba(60,245,167,0.35); }
.cb-done { color: var(--lime); font-weight: 700; letter-spacing: 0.04em; }
.cb-mile i { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 13px; font-weight: 800; color: var(--lime); }
.cb-tabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; padding-bottom: 12px; border-bottom: 1px solid var(--border-soft); }
.cb-tab { position: relative; font: 700 12px var(--font-display); letter-spacing: 0.1em; padding: 8px 4px 7px; border-radius: 9px; border: 1px solid var(--border-soft); background: var(--surface-2); color: var(--dim); min-width: 0; overflow-wrap: anywhere; }
.cb-tab small { font-size: 10px; letter-spacing: 0.04em; opacity: 0.8; }
.cb-tab.on { color: #06110c; background: var(--lime); border-color: var(--lime); }
.cb-tab:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.cb-dot { position: absolute; top: 5px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--magenta); box-shadow: 0 0 8px var(--magenta); }
.cb-panel h3 small { letter-spacing: 0.04em; color: var(--faint); font-weight: 500; }
.cb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.cb-grid.foes { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.cb-card { --c: var(--cyan); position: relative; display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 4px 12px; align-items: start; align-content: start; min-width: 0; padding: 12px; text-align: left; border-radius: 14px; font-family: var(--font-body); font-weight: 400; letter-spacing: 0; color: var(--text);
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 9%, rgba(24,30,58,0.96)), rgba(10,14,30,0.96)); border: 1px solid color-mix(in srgb, var(--c) 42%, transparent); }
.cb-card:hover, .cb-card:focus-visible { border-color: var(--c); box-shadow: 0 0 0 1px var(--c), 0 10px 30px rgba(0,0,0,0.35); outline: none; }
.cb-card.locked { background: repeating-linear-gradient(135deg, rgba(255,255,255,0.022) 0 6px, transparent 6px 12px), rgba(9,12,26,0.94); border-style: dashed; }
.cb-card.locked .cb-t { color: var(--dim); }
.cb-ic { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; background: rgba(0,0,0,0.35); border: 1px solid color-mix(in srgb, var(--c) 60%, transparent); box-shadow: inset 0 0 16px color-mix(in srgb, var(--c) 18%, transparent); }
.cb-ic svg { width: 34px; height: 34px; }
.cb-ic.sm { width: 36px; height: 36px; border-radius: 9px; } .cb-ic.sm svg { width: 24px; height: 24px; }
.cb-ic.xs { width: 24px; height: 24px; border-radius: 6px; flex: none; } .cb-ic.xs svg { width: 16px; height: 16px; }
.cb-ic.q { --c: #3a4266; color: var(--faint); font: 800 13px var(--font-display); background: rgba(0,0,0,0.5); box-shadow: none; }
.cb-main { display: grid; gap: 3px; min-width: 0; }
.cb-k { font: 700 10px var(--font-display); letter-spacing: 0.16em; color: var(--c); }
.cb-card.locked .cb-k { color: var(--faint); }
.cb-t { font-family: var(--font-display); font-size: 17px; line-height: 1.15; overflow-wrap: anywhere; }
.cb-t.sm { font-size: 14px; }
.cb-d { font-size: 12.5px; color: var(--dim); line-height: 1.4; }
.cb-x { font: 700 10.5px var(--font-display); letter-spacing: 0.07em; color: color-mix(in srgb, var(--c) 55%, #fff); margin-top: 3px; overflow-wrap: anywhere; }
.cb-evo { grid-column: 1 / -1; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; align-items: start; margin-top: 8px; padding-top: 10px; border-top: 1px dashed rgba(255,189,46,0.4); --c: #ffbd2e; }
.cb-evo > span:last-child { display: grid; gap: 2px; min-width: 0; }
.cb-evo.locked { border-top-color: rgba(255,255,255,0.1); --c: #4a5272; }
.cb-evo.locked .cb-t { color: var(--faint); }
.cb-recipe { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font: 700 11px var(--font-display); letter-spacing: 0.04em; }
.cb-recipe em { font-style: normal; color: var(--amber); }
.cb-new { position: absolute; top: 8px; right: 8px; font: 800 9px var(--font-display); letter-spacing: 0.16em; padding: 2px 6px; border-radius: 5px; background: var(--lime); color: #04140d; box-shadow: 0 0 12px rgba(60,245,167,0.6); }
.cb-card.foe { grid-template-columns: 92px minmax(0, 1fr); align-items: center; }
.cb-pic { position: relative; width: 92px; height: 92px; border-radius: 12px; overflow: hidden; display: grid; place-items: center; border: 1px solid color-mix(in srgb, var(--c) 50%, transparent);
  background: radial-gradient(circle at 50% 62%, color-mix(in srgb, var(--c) 46%, transparent), rgba(0,0,0,0.45) 72%); }
.cb-pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity 260ms; }
.cb-pic img.ready { opacity: 1; }
.cb-pic-fb { display: grid; place-items: center; font-style: normal; }
.cb-pic-fb svg { width: 40px; height: 40px; opacity: 0.6; }
.cb-pic img.ready + .cb-pic-fb { display: none; }
.cb-pic.nopic img { display: none; }
.cb-pic.art svg { width: 76%; height: 76%; }
.cb-pic.sil { background: radial-gradient(circle at 50% 62%, rgba(70,82,140,0.38), rgba(0,0,0,0.55) 72%); border-color: rgba(120,135,200,0.25); }
.cb-pic.sil img, .cb-pic.art.sil svg { filter: brightness(0) drop-shadow(0 0 1px rgba(160,180,255,0.75)) drop-shadow(0 0 6px rgba(90,110,220,0.45)); }
.cb-pic.sil img.ready { opacity: 0.9; }
.cb-pic.sil::after { content: '?'; position: absolute; right: 7px; bottom: 1px; font: 900 22px var(--font-display); color: rgba(170,185,240,0.55); }
.cb-grid.maps { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.cb-card.map { grid-template-columns: minmax(0, 1fr); }
.cb-scene { position: relative; display: block; height: 84px; border-radius: 10px; overflow: hidden; border: 1px solid rgba(255,255,255,0.14); background: repeating-linear-gradient(135deg, rgba(255,255,255,0.03) 0 6px, transparent 6px 12px), #0b0f22; }
.cb-ridge { position: absolute; left: 0; right: 0; bottom: 0; height: 64%; background: rgba(0,0,0,0.22); clip-path: polygon(0 62%, 12% 40%, 22% 52%, 36% 18%, 48% 46%, 60% 30%, 74% 56%, 86% 34%, 100% 50%, 100% 100%, 0 100%); }
.cb-card.map.locked .cb-scene::after { content: '?'; position: absolute; inset: 0; display: grid; place-items: center; font: 900 30px var(--font-display); color: rgba(170,185,240,0.4); }
.nav button { position: relative; }
.cb-badge { position: absolute; top: 6px; right: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: grid; place-items: center; font: 800 10px/1 var(--font-display); font-style: normal; letter-spacing: 0; color: #fff; background: var(--magenta); box-shadow: 0 0 10px rgba(255,45,191,0.6); }
@media (max-width: 600px) {
  .cb-head { padding: 12px; gap: 6px 12px; }
  .cb-ring { width: 64px; height: 64px; }
  .cb-ring::before { inset: 6px; }
  .cb-ring b { font-size: 20px; }
  .cb-sum { display: contents; }
  .cb-ring { grid-row: 1 / span 2; }
  .cb-sum > b { grid-column: 2; grid-row: 1; font-size: 13px; letter-spacing: 0.08em; align-self: end; }
  .cb-sum > small { grid-column: 2; grid-row: 2; align-self: start; font-size: 11.5px; }
  .cb-sum .cb-how { display: none; }
  .cb-miles { grid-column: 1 / -1; grid-row: 3; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .cb-mile, .cb-mile.got { padding: 5px 6px; text-align: center; }
  .cb-mile i { top: 3px; right: 4px; transform: none; font-size: 10px; }
  .cb-mile small { font-size: 10px; }
  .cb-mile .u { display: none; }
  .cb-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cb-grid, .cb-grid.foes, .cb-grid.maps { grid-template-columns: minmax(0, 1fr); }
  .cb-card.foe { grid-template-columns: 78px minmax(0, 1fr); }
  .cb-pic { width: 78px; height: 78px; }
}

.cards.vend { grid-template-columns: repeat(5, 1fr); }
.card .price { margin-top: 10px; font-weight: 900; color: #ffbd2e; letter-spacing: 0.05em; }
.card .price.poor { color: #ff8a8a; }
.card .price.sold { color: #6a7a8a; }
@media (max-width: 900px) { .cards.vend { grid-template-columns: repeat(2, 1fr); } }

.binds { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; }
.binds label { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.binds .bind { min-width: 92px; padding: 6px 10px; font-weight: 800; letter-spacing: 0.05em; }
.binds .bind.wait { border-color: #ffbd2e; color: #ffbd2e; }
.pad-focus { outline: 3px solid #22e4ff !important; outline-offset: 2px; box-shadow: 0 0 16px rgba(34, 228, 255, 0.55) !important; }

#download-game { display: block; box-sizing: border-box; width: 100%; margin-top: 8px; padding: 10px; text-align: center; text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 12px; letter-spacing: 0.08em; border: 1px solid rgba(34,228,255,0.5); border-radius: 10px; color: #22e4ff; background: rgba(20,40,60,0.35); }
#download-game[hidden] { display: none; }
#download-zip { display: block; margin-top: 6px; text-align: center; font-family: var(--font-display); font-weight: 700; font-size: 11px; letter-spacing: 0.06em; color: var(--dim); text-decoration: underline; text-underline-offset: 3px; }
#download-zip[hidden] { display: none; }
#install-app { width: 100%; margin-top: 8px; font-size: 12px; letter-spacing: 0.08em; border-color: rgba(60,245,167,0.5); color: #3cf5a7; background: rgba(20,60,40,0.35); }
#update-note { margin: 0 0 10px; padding: 10px 12px; border: 1px solid rgba(255,189,46,0.6); border-radius: 10px; background: rgba(60,44,10,0.55); color: #ffe7a8; font-size: 13px; line-height: 1.35; }
#update-note[hidden] { display: none; }
#update-note .update-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
#update-note a, #update-note button { padding: 7px 10px; font-family: var(--font-display); font-weight: 700; font-size: 11px; letter-spacing: 0.08em; text-decoration: none; text-align: center; border: 1px solid rgba(255,189,46,0.6); border-radius: 8px; color: #ffbd2e; background: rgba(20,14,4,0.5); }
#update-note #update-go { flex: 1; }
#update-note a[hidden] { display: none; }

/* results: daily / weekly board */
.settings input[type=text] { width: min(12em, 46vw); -webkit-user-select: text; user-select: text; font-size: 15px; }
#rs-board { margin-top: 10px; }
table.lb { width: 100%; border-collapse: collapse; font-size: 13px; }
table.lb td { padding: 4px 6px; border-bottom: 1px solid rgba(255,255,255,0.07); white-space: nowrap; }
table.lb td:nth-child(2) { overflow: hidden; text-overflow: ellipsis; max-width: 9em; }
table.lb td:last-child { text-align: right; }
table.lb tr.me td { color: #3cf5a7; }
@media (max-width: 520px) { table.lb td:nth-child(3), table.lb td:nth-child(4) { display: none; } }
/* benchmark report */
#bench-panel { position: fixed; right: 12px; top: 12px; z-index: 60; width: min(420px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; background: rgba(6,10,20,0.94); border: 1px solid #22e4ff55; border-radius: 10px; padding: 12px; font-size: 12px; color: #cfe; }
#bench-panel pre { white-space: pre-wrap; word-break: break-word; max-height: 40vh; overflow: auto; margin: 8px 0; font-size: 11px; }
#bench-panel table { width: 100%; border-collapse: collapse; }
#bench-panel td { padding: 2px 4px; }

/* ---------------- co-op: the lobby and teammates on the HUD ---------------- */
#coop-btn { width: 100%; margin-top: 8px; }
/* the title's two ways online: QUICK PLAY (a public room, matched) and PLAY ONLINE · CO-OP (friends) */
.online-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.online-row > button, .online-row > #coop-btn { margin: 0; width: 100%; min-height: 48px; padding: 8px 10px; font-size: 13px; line-height: 1.2; }
.online-row button small { display: block; margin-top: 2px; font-size: 10px; font-weight: 600; letter-spacing: 0.04em; opacity: 0.75; }
.online-row button[hidden] { display: none; }
.online-row:has(> button[hidden]) { grid-template-columns: 1fr; }
#quick-btn { border-color: rgba(60, 245, 167, 0.6); color: var(--lime); background: linear-gradient(135deg, rgba(60, 245, 167, 0.16), rgba(34, 228, 255, 0.08)); }
#quick-btn small { color: var(--text); }
.online-row .nw { white-space: nowrap; }
.coop-quick.searching { border-color: var(--lime); }
.coop-quick .spin { display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
.coop-wait { display: flex; align-items: center; gap: 12px; background: rgba(60, 245, 167, 0.1); border: 1px solid rgba(60, 245, 167, 0.5); border-radius: 12px; padding: 10px 14px; }
.coop-wait i { width: 12px; height: 12px; border-radius: 50%; background: var(--lime); flex: none; animation: coopWait 1.2s ease-in-out infinite alternate; }
.coop-wait b { display: block; font-family: var(--font-display); color: var(--lime); font-size: 15px; letter-spacing: 0.04em; }
.coop-wait small { display: block; color: var(--dim); font-size: 11px; letter-spacing: 0.06em; margin-top: 2px; }
@keyframes coopWait { from { box-shadow: 0 0 0 0 rgba(60, 245, 167, 0.6); opacity: 0.6; } to { box-shadow: 0 0 0 7px rgba(60, 245, 167, 0); opacity: 1; } }
.coop-code .coop-count { color: var(--text); }
.coop-rooms { display: grid; gap: 6px; }
.coop-rooms > b { font-family: var(--font-display); font-size: 12px; color: var(--dim); letter-spacing: 0.08em; }
.coop-room { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr) auto auto auto; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 10px; padding: 6px 6px 6px 12px; font-size: 12px; }
.coop-room span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coop-room .cr-host { font-family: var(--font-display); font-weight: 700; }
.coop-room .cr-what { color: var(--dim); }
.coop-room .cr-n { font-family: var(--font-display); font-weight: 700; color: var(--lime); }
.coop-room .cr-state { color: var(--dim); font-size: 10px; letter-spacing: 0.06em; }
.coop-room .cr-state.boss { color: var(--amber); }
.coop-room button { padding: 6px 12px; font-size: 12px; min-height: 0; }
.coop-cfg { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 12px; letter-spacing: 0.06em; color: var(--cyan); }
.coop-vis button small { display: block; font-size: 10px; opacity: 0.75; font-weight: 600; }
.coop-mode, .coop-map { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; gap: 8px; }
.coop-mode > b, .coop-map > b { font-family: var(--font-display); font-size: 12px; color: var(--dim); }
.seg.coop-modes { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.seg.coop-modes button { font-size: 11px; padding: 8px 4px; }
.coop-map select { font-family: var(--font-display); font-weight: 700; background: var(--surface-2); color: var(--text); border: 1px solid var(--border-soft); border-radius: 8px; padding: 8px; font-size: 13px; min-width: 0; }
.coop { display: grid; gap: 14px; }
.coop input[type=text] { font-family: var(--font-display); background: var(--surface-2); color: var(--text); border: 1px solid var(--border-soft); border-radius: 8px; padding: 8px 10px; font-size: 16px; -webkit-user-select: text; user-select: text; }
.coop-name { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 13px; color: var(--dim); }
.coop-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.coop-card { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 14px; padding: 14px; display: grid; gap: 10px; align-content: start; }
.coop-card h3 { margin: 0; font-family: var(--font-display); }
.coop-card p { margin: 0; color: var(--dim); font-size: 13px; line-height: 1.45; }
#coop-code { text-transform: uppercase; letter-spacing: 0.4em; font-size: 22px; text-align: center; width: 100%; }
.coop-status { margin: 0; color: var(--amber); font-family: var(--font-display); font-weight: 700; font-size: 13px; }
.coop-quick { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; background: linear-gradient(135deg, rgba(60, 245, 167, 0.14), rgba(34, 228, 255, 0.08)); border: 1px solid rgba(60, 245, 167, 0.45); border-radius: 14px; padding: 14px 16px; }
.coop-quick > div { flex: 1 1 240px; display: grid; gap: 6px; }
.coop-quick h3 { margin: 0; font-family: var(--font-display); color: var(--lime); }
.coop-quick p { margin: 0; color: var(--dim); font-size: 13px; line-height: 1.45; }
.coop-quick button { flex: 0 0 auto; }
.coop .coop-online { display: flex; align-items: center; gap: 8px; color: var(--text); font-family: var(--font-display); font-weight: 700; font-size: 12px; letter-spacing: 0.04em; }
.coop-online i { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 8px var(--lime); flex: none; }
.coop-invite { display: flex; gap: 8px; flex-wrap: wrap; }
.coop-invite .coop-link { flex: 1 1 220px; min-width: 0; font-size: 13px !important; color: var(--cyan) !important; }
.coop-flags { display: grid; gap: 6px; }
.coop-flags label { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 10px; padding: 8px 12px; cursor: pointer; }
.coop-flags b { font-family: var(--font-display); font-size: 13px; }
.coop-flags span { color: var(--dim); font-size: 12px; }
.coop-flags input { accent-color: var(--lime); width: 16px; height: 16px; }
#pause-coop { margin-bottom: 12px; }
.pause-coop { gap: 10px; }
.coop-code.small { font-size: 26px; letter-spacing: 0.2em; }
.coop-code { font-family: var(--font-display); font-weight: 700; font-size: clamp(40px, 9vw, 64px); letter-spacing: 0.3em; text-align: center; color: var(--lime); -webkit-user-select: text; user-select: text; }
.coop-code small { display: block; font-size: 12px; letter-spacing: 0.12em; color: var(--dim); }
.coop-list { display: grid; gap: 6px; }
.coop-row { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 10px; padding: 8px 12px; }
.coop-row i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.coop-row b { flex: 1; font-family: var(--font-display); }
.coop-row b small { color: var(--dim); font-size: 11px; margin-left: 4px; }
.coop-row span { color: var(--dim); font-size: 13px; }
/* voice chat (js/chat.js): who is talking, mute buttons, your own mic */
.coop-row.talk { border-color: var(--lime); box-shadow: 0 0 0 1px var(--lime) inset; }
.coop-row.talk i { box-shadow: 0 0 0 3px rgba(60, 245, 167, 0.35); }
.coop-row .vme { font-style: normal; font-family: var(--font-display); font-size: 11px; color: var(--dim); }
.coop-row .vmute { font-size: 11px; padding: 4px 8px; min-height: 0; }
.coop-row .vmute.on { color: var(--red); border-color: var(--red); }
.coop-row { flex-wrap: wrap; }
.coop-row .coop-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; margin-left: auto; }
.coop-row .vrep, .coop-row .vkick, .coop-row .von { font-size: 11px; padding: 4px 8px; min-height: 0; }
.coop-row em.vrep { font-style: normal; font-family: var(--font-display); color: var(--dim); }
.coop-row .vkick.on { color: var(--red); border-color: var(--red); background: rgba(255, 77, 109, 0.12); }
.coop-row .von { color: var(--cyan); border-color: rgba(34, 228, 255, 0.5); }
.coop-row .von.on { color: var(--dim); border-color: var(--border-soft); }
.coop-row .vc-off { color: var(--faint, var(--dim)); font-size: 10px; letter-spacing: 0.06em; }
.coop-rep { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding-top: 6px; border-top: 1px dashed var(--border-soft); }
.coop-rep span { font-family: var(--font-display); font-size: 11px; color: var(--amber); margin-right: 4px; }
.coop-rep button { font-size: 11px; padding: 5px 9px; min-height: 0; }
@media (pointer: coarse) { .coop-row .vmute, .coop-row .vrep, .coop-row .vkick, .coop-row .von, .coop-rep button, .coop-room button { min-height: 34px; padding-left: 10px; padding-right: 10px; } }
@media (max-width: 520px) {
  .coop-room { grid-template-columns: minmax(0, 1fr) auto auto; }
  .coop-room .cr-what { grid-column: 1 / 2; grid-row: 2; }
  .coop-room .cr-state { grid-column: 2 / 4; grid-row: 2; text-align: right; }
  .seg.coop-modes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .coop-row .coop-acts { flex-basis: 100%; justify-content: flex-start; margin-left: 20px; }
}
#team .mate.talk { box-shadow: 0 0 0 2px var(--lime) inset; }
#team .vchip { pointer-events: auto; justify-self: start; font-family: var(--font-display); font-size: 11px; padding: 4px 8px; min-height: 0; border-radius: 8px; background: rgba(4, 6, 14, 0.55); border: 1px solid rgba(255, 255, 255, 0.18); color: var(--dim); }
#team .vchip.talk { color: #06110c; background: var(--lime); border-color: var(--lime); }
#team .vchip.open { color: var(--lime); }
#team .vchip.bad { color: var(--red); }
#btn-talk { right: 124px; top: calc(204px + var(--safe-t)); }
#btn-talk.on { background: var(--lime); color: #06110c; border-color: var(--lime); }
#team { display: grid; gap: 4px; margin-top: 8px; width: 180px; }
#team .mate { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; background: rgba(4, 6, 14, 0.55); border-radius: 8px; padding: 4px 8px; font-family: var(--font-display); font-size: 12px; }
#team .mate small { color: var(--dim); }
#team .mhp { grid-column: 1 / -1; height: 4px; background: rgba(255, 255, 255, 0.12); border-radius: 2px; overflow: hidden; }
#team .mhp i { display: block; height: 100%; background: var(--lime); }
#team .mate.down { opacity: 0.6; }
#team .mate.down .mhp i { background: var(--red); }
/* co-op team synergies (js/team.js): a strip of small chips under the team list, never in the middle of the view */
#teamsyn { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; max-width: 260px; pointer-events: none; }
#teamsyn .ts { font-family: var(--font-display); font-size: 11px; letter-spacing: 0.06em; line-height: 1.2; padding: 3px 8px; border-radius: 7px; background: rgba(4, 6, 14, 0.62); border: 1px solid color-mix(in srgb, var(--c) 60%, transparent); color: var(--c); white-space: nowrap; }
#teamsyn .ts.on { background: color-mix(in srgb, var(--c) 22%, rgba(4, 6, 14, 0.7)); box-shadow: 0 0 10px color-mix(in srgb, var(--c) 35%, transparent); }
#teamsyn .ts.off { opacity: 0.55; border-style: dashed; }
#teamsyn .ts.call { flex-basis: 100%; white-space: normal; font-size: 12px; color: #fff; border-color: var(--c); background: color-mix(in srgb, var(--c) 30%, rgba(4, 6, 14, 0.75)); animation: tsCall 360ms var(--ease); }
@keyframes tsCall { from { transform: translateX(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast.syn small { display: block; color: var(--dim); font-size: 10px; margin-top: 2px; }
@media (max-width: 820px) { #teamsyn { max-width: 100%; } #teamsyn .ts { font-size: 9px; padding: 2px 6px; } #teamsyn .ts.call { font-size: 10px; } }
@media (orientation: landscape) and (max-height: 500px) { #teamsyn .ts { font-size: 9px; padding: 2px 6px; } }
/* a phone held sideways: toasts (the synergy explainers above all) stay a narrow strip under the timer, at most two at once, instead of
   desktop-size cards across the middle of the play area */
@media (orientation: landscape) and (max-height: 500px) {
  #toasts { max-width: 52vw; gap: 3px; }
  .toast { font-size: 10.5px; padding: 5px 10px; line-height: 1.25; }
  .toast.syn small { font-size: 8.5px; margin-top: 1px; }
  #toasts .toast:nth-last-child(n+3) { display: none; }
}
/* the lobby's list of them */
.coop-syn { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 12px; padding: 10px 14px; }
.coop-syn summary { cursor: pointer; font-family: var(--font-display); letter-spacing: 0.08em; }
.coop-syn summary small { color: var(--dim); font-size: 11px; margin-left: 6px; letter-spacing: 0.04em; }
.coop-syn ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.coop-syn li { display: grid; grid-template-columns: 130px 1fr; gap: 10px; font-size: 13px; line-height: 1.4; }
.coop-syn li b { font-family: var(--font-display); font-size: 12px; letter-spacing: 0.06em; }
.coop-syn li span { color: var(--dim); }
.coop-syn .coop-combos { border-top: 1px solid var(--border-soft); padding-top: 8px; }
.coop-syn .help { margin: 8px 0 0; }
@media (max-width: 520px) { .coop-syn li { grid-template-columns: 1fr; gap: 0; } }
/* PROFILE (js/account.js): the claimed name, the recovery code, notifications, friends; invites in the game */
.acct .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.acct input[type=text] { flex: 1; min-width: 140px; font-family: var(--font-display); background: var(--surface-2); color: var(--text); border: 1px solid var(--border-soft); border-radius: 8px; padding: 8px 10px; font-size: 16px; -webkit-user-select: text; user-select: text; }
.acct input[type=text]:focus, .acct input[type=email]:focus { outline: 2px solid var(--lime); outline-offset: 1px; }
.acct input[type=email] { flex: 1; min-width: 180px; font-family: var(--font-display); background: var(--surface-2); color: var(--text); border: 1px solid var(--border-soft); border-radius: 8px; padding: 8px 10px; font-size: 16px; -webkit-user-select: text; user-select: text; }
#em-code { letter-spacing: 0.3em; max-width: 9em; }
#rec-code { text-transform: uppercase; letter-spacing: 0.12em; }
.acct select { font-family: var(--font-body); background: var(--surface-2); color: var(--text); border: 1px solid var(--border-soft); border-radius: 8px; padding: 6px; }
.acct-prefs input[type=checkbox] { accent-color: var(--lime); width: 16px; height: 16px; }
.acct-name { display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border-soft); }
.acct-name b { font-family: var(--font-display); font-size: 22px; color: var(--lime); }
.acct-name span { color: var(--dim); font-size: 13px; }
.acct-code { display: grid; gap: 6px; margin-top: 10px; padding: 12px 14px; border-radius: 12px; border: 2px dashed var(--amber); background: rgba(255, 189, 46, 0.08); }
.acct-code code { font-family: var(--font-mono, monospace); font-size: 22px; letter-spacing: 0.08em; color: #fff; user-select: all; }
.acct-code span { color: var(--dim); font-size: 13px; }
.acct-code button { justify-self: start; }
.acct-prefs { display: grid; gap: 6px; margin-top: 8px; }
.acct-prefs label { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.lb .ok { color: var(--lime); font-weight: 700; }
.invite-card { position: fixed; right: calc(16px + var(--safe-r)); bottom: calc(120px + var(--safe-b)); z-index: 30; display: grid; gap: 6px; width: min(340px, calc(100vw - 32px)); padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 2px solid var(--lime); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); font-family: var(--font-display); animation: crewIn 400ms var(--ease); }
.invite-card b { font-size: 16px; color: var(--lime); }
.invite-card span { color: var(--dim); font-size: 13px; }
.invite-card div { display: flex; gap: 8px; }
.coop-friends { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0; }
.coop-friends b { font-family: var(--font-display); font-size: 12px; color: var(--dim); margin-right: 4px; }
.coop-friends button { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; padding: 6px 10px; min-height: 0; }
.coop-friends i { width: 8px; height: 8px; border-radius: 50%; }

/* NO HIDING (js/nohiding.js): the rocket countdown */
#nohide { position: fixed; left: 50%; top: calc(120px + var(--safe-t)); transform: translateX(-50%); display: grid; justify-items: center; gap: 2px; padding: 10px 22px; border-radius: 14px; background: rgba(40, 4, 10, 0.72); border: 2px solid #ff4d6d; font-family: var(--font-display); color: #ffd6dc; text-align: center; animation: nohidePulse 0.5s ease-in-out infinite alternate; z-index: 6; pointer-events: none; }
#nohide b { font-size: 26px; letter-spacing: 0.12em; color: #ff4d6d; }
#nohide span { font-size: 14px; letter-spacing: 0.08em; }
#nohide i { font-style: normal; font-size: 22px; color: #fff; margin-left: 4px; }
#nohide small { font-size: 11px; color: #ffb3bf; letter-spacing: 0.1em; }
@keyframes nohidePulse { from { box-shadow: 0 0 0 0 rgba(255, 77, 109, 0.0); } to { box-shadow: 0 0 28px 4px rgba(255, 77, 109, 0.55); } }
/* One-time tips for new players (js/onboarding.js): left of centre, above a level-up card, gone after a few seconds */
#tip { position: fixed; left: calc(16px + var(--safe-l)); top: 36%; z-index: 12; width: min(300px, calc(100vw - 32px)); padding: 12px 14px 12px; border-radius: 12px; background: var(--surface); border: 1px solid rgba(60, 245, 167, 0.5); border-left: 4px solid var(--lime); box-shadow: 0 10px 34px rgba(0, 0, 0, 0.5); font-family: var(--font-display); color: var(--text); animation: tipIn 320ms var(--ease); pointer-events: none; }
#tip .tip-k { font-size: 10px; letter-spacing: 0.2em; color: var(--lime); opacity: 0.85; }
#tip b { display: block; font-size: 16px; letter-spacing: 0.08em; margin: 2px 0 4px; }
#tip p { margin: 0 0 8px; font-size: 13px; line-height: 1.4; font-weight: 500; }
#tip .tip-x { pointer-events: auto; font: 700 11px var(--font-display); letter-spacing: 0.12em; padding: 5px 10px; border-radius: 7px; border: 1px solid rgba(60, 245, 167, 0.6); background: rgba(60, 245, 167, 0.12); color: var(--lime); cursor: pointer; }
#tip.out { opacity: 0; transform: translateX(-12px); transition: all 300ms; }
@keyframes tipIn { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
#tip.over { left: 50%; top: calc(12px + var(--safe-t)); bottom: auto; transform: translateX(-50%); width: min(460px, calc(100vw - 32px)); animation: none; }
#tip.over.out { transform: translateX(-50%); }
@media (max-width: 820px) {
  #tip { left: 50%; top: auto; bottom: calc(210px + var(--safe-b)); transform: translateX(-50%); width: min(320px, calc(100vw - 32px)); padding: 10px 12px; animation: none; }
  #tip.out { transform: translateX(-50%); }
  #tip b { font-size: 14px; }
  #tip p { font-size: 12px; margin-bottom: 6px; }
}
/* BONKBOT's intro on a new player's first run: letterbox bars, a caption and SKIP */
#intro { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
#intro .intro-bar { position: absolute; left: 0; right: 0; height: 12vh; background: #000; animation: introBar 600ms var(--ease); }
#intro .intro-bar.top { top: 0; }
#intro .intro-bar.bot { bottom: 0; display: flex; align-items: center; justify-content: center; padding: 0 calc(var(--skip-w, 128px) + var(--safe-r)) calc(var(--safe-b)) calc(var(--skip-w, 128px) + var(--safe-l)); gap: 16px; min-height: 76px; }
#intro .intro-cap { flex: 1; max-width: 760px; font-family: var(--font-display); text-align: center; }
#intro .intro-who { display: block; font-size: 11px; letter-spacing: 0.3em; color: var(--cyan); }
#intro .intro-line { display: block; font-size: clamp(15px, 2.4vw, 22px); font-weight: 700; color: #fff; min-height: 1.3em; }
#intro .intro-skip { pointer-events: auto; position: absolute; z-index: 1; right: calc(16px + var(--safe-r)); bottom: calc(12px + var(--safe-b)); font: 700 13px var(--font-display); letter-spacing: 0.12em; padding: 8px 14px; border-radius: 9px; border: 1px solid rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.08); color: #fff; cursor: pointer; display: grid; justify-items: center; }
#intro .intro-skip small { font-size: 9px; opacity: 0.6; letter-spacing: 0.1em; }
@keyframes introBar { from { transform: scaleY(0); } to { transform: none; } }
@media (max-width: 600px) { #intro .intro-bar.bot { padding-left: calc(16px + var(--safe-l)); } #intro .intro-cap { text-align: left; } #intro .intro-skip small { display: none; } }
body.touch #intro { --skip-w: 96px; }
body.touch #intro .intro-skip small { display: none; }   /* ESC · SPACE means nothing to a thumb */
/* The Cold Wallet Vault's room panel (js/vault.js), under the timer */
#vault-hud { position: fixed; right: calc(14px + var(--safe-r)); top: calc(92px + var(--safe-t)); z-index: 5; display: grid; justify-items: end; gap: 1px; padding: 6px 16px; border-radius: 12px; background: rgba(6, 12, 22, 0.72); border: 1px solid rgba(127, 227, 255, 0.45); font-family: var(--font-display); pointer-events: none; text-align: right; }
#vault-hud small { font-size: 10px; letter-spacing: 0.24em; color: #7fe3ff; }
#vault-hud b { font-size: 15px; letter-spacing: 0.1em; color: #fff; }
#vault-hud em { font-style: normal; font-size: 11px; letter-spacing: 0.12em; color: #ffbd2e; }
@media (max-width: 820px) { #vault-hud { top: calc(96px + var(--safe-t)); right: calc(8px + var(--safe-r)); padding: 4px 10px; } #vault-hud b { font-size: 12px; } #vault-hud small, #vault-hud em { font-size: 9px; } }
/* The season track (js/season.js) and the boards (tabs, parties, dares) */
.pbar.season .bar i { background: linear-gradient(90deg, #22e4ff, #b07bff); }
#rs-season { margin-top: 8px; }
.season-track { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 12px 0; }
.season-track .tier { position: relative; display: grid; gap: 2px; padding: 8px 8px 7px; border-radius: 9px; background: rgba(18, 24, 48, 0.8); border: 1px solid rgba(255, 255, 255, 0.08); font-family: var(--font-display); min-height: 62px; }
.season-track .tier b { font-size: 16px; color: var(--dim); }
.season-track .tier span { font-size: 10px; letter-spacing: 0.06em; color: var(--text); line-height: 1.25; }
.season-track .tier.cos { border-color: color-mix(in srgb, var(--c) 55%, transparent); }
.season-track .tier.got { background: color-mix(in srgb, var(--c) 18%, rgba(18, 24, 48, 0.9)); }
.season-track .tier.got b { color: var(--c); }
.season-track .tier.next { outline: 2px solid var(--c); }
.season-track .tier i { position: absolute; right: 8px; top: 6px; font-style: normal; color: var(--c); font-weight: 700; }
.seg.small { grid-template-columns: repeat(3, 1fr); margin: 8px 0; }
.seg.small button { font-size: 11px; padding: 6px 4px; }
#bk-seg { grid-template-columns: repeat(4, 1fr); }
.dare { margin-top: 10px; display: grid; gap: 6px; }
.dare b { font-family: var(--font-display); font-size: 12px; letter-spacing: 0.14em; color: #ffbd2e; }
.row.wrap { flex-wrap: wrap; }
.dare-card { border-color: #ffbd2e; }
@media (max-width: 520px) { .season-track { grid-template-columns: repeat(4, 1fr); } .season-track .tier span { font-size: 9px; } }
/* board moderation: the report flag on each row */
table.lb td.rep-cell { width: 26px; text-align: right; }
table.lb .rep { padding: 0 6px; min-width: 0; font-size: 12px; line-height: 20px; background: transparent; border: 1px solid transparent; color: var(--faint); opacity: 0.6; }
table.lb tr:hover .rep, table.lb .rep:focus-visible { opacity: 1; border-color: rgba(255, 255, 255, 0.2); color: #ff8a8a; }
/* The phone pass: nothing on the title (or in the menus) is wider than the screen; long names wrap, columns shrink */
.title-grid > *, .panel { min-width: 0; }
#char-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.seg { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.seg.seg3, .seg.small { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#bk-seg { grid-template-columns: repeat(5, minmax(0, 1fr)); }
#mode-seg { grid-template-columns: repeat(2, minmax(0, 1fr)); }   /* four modes: two rows of two */
.nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.char b { overflow-wrap: anywhere; }
@media (max-width: 420px) {
  .char { padding: 8px 3px; }
  .char b { font-size: min(10px, 2.35vw); letter-spacing: -0.01em; }
  .seg button { font-size: 12px; padding: 8px 4px; }
  .seg button small { font-size: 9px; }
  #bk-seg button { font-size: 10px; }
}
@media (pointer: coarse) { table.lb .rep { min-width: 34px; min-height: 30px; opacity: 0.85; } table.lb td.rep-cell { width: 38px; } }

/* Halloween (js/halloween.js): the title's event button, the HUD's candy, the Locker's Spooky Shop */
#event-pill { display: inline-flex; gap: 6px; align-items: baseline; margin-top: 8px; padding: 7px 14px; border-radius: 999px; border: 1px solid #ff9a2e; background: linear-gradient(90deg, rgba(255, 122, 20, 0.22), rgba(138, 63, 252, 0.22)); color: #ffe3c2; font: 600 12px var(--font-display); letter-spacing: 0.06em; cursor: pointer; }
#event-pill b { color: #ff9a2e; letter-spacing: 0.12em; }
#event-pill u { text-decoration: none; color: #fff; }
#event-pill small { opacity: 0.7; font-size: 10px; }
#candy { color: #ffb36b; }
#candy b { color: #ff9a2e; }
/* on touch screens the candy count shares the kills row, so the score block keeps its height and stays clear of the minimap below it */
body.touch #kills, body.touch #candy:not([hidden]) { display: inline-block; }
body.touch #candy:not([hidden]) { margin-left: 8px; }
.spooky { margin-bottom: 18px; padding: 12px 14px; border-radius: 14px; border: 1px solid rgba(255, 154, 46, 0.5); background: linear-gradient(135deg, rgba(255, 122, 20, 0.12), rgba(138, 63, 252, 0.14)); }
.spooky h3 { margin-top: 0; color: #ff9a2e; }
.spooky h3 small { color: var(--dim); font-weight: 600; letter-spacing: 0.06em; }
.spooky-item:not(:disabled):not([aria-disabled="true"]) { border-color: #ff9a2e; }

/* ---------------- a phone held sideways (short landscape: the iPhone app) ---------------- */
@media (orientation: landscape) and (max-height: 500px) {
  .hud-tl { width: min(300px, 36vw); left: 12px; top: calc(8px + var(--safe-t)); }
  .hpbar { height: 18px; }
  #hp-text { font-size: 11px; }
  .hud-top { left: 50%; right: auto; transform: translateX(-50%); width: auto; text-align: center; top: calc(6px + var(--safe-t)); }
  #timer { font-size: 26px; }
  #epoch { display: none; }
  .hud-tr { right: 12px; top: calc(8px + var(--safe-t)); }
  #minimap { width: 120px; height: 120px; }
  body.touch #minimap { width: 96px; height: 96px; top: calc(80px + var(--safe-t)); }
  body.touch #btn-use { right: calc(140px + var(--safe-r)); bottom: calc(118px + var(--safe-b)); }
  body.touch #btn-pause { top: calc(8px + var(--safe-t)); right: calc(172px + var(--safe-r)); }
  body.touch #btn-map { top: calc(8px + var(--safe-t)); right: calc(228px + var(--safe-r)); }
  /* the combo beside the minimap, not over it, and clear of SLIDE/JUMP below */
  body.touch #combo { left: auto; right: 120px; top: calc(84px + var(--safe-t)); text-align: right; }   /* #hud is already inset by the cutout */
  body.touch #combo b { font-size: 34px; }
  body.touch #combo i { margin-left: auto; }
  /* the operator cards narrow by the cutout padding: names fit whole (THE ACCOUNTANT, V4P0RW4VE) instead of breaking */
  .char { padding: 8px 3px; }
  .char b { font-size: 10px; letter-spacing: -0.01em; }
}

/* a tip on a phone holds the world (js/onboarding.js): mid-screen, clear of both thumbs; a tap anywhere carries on */
#tip.hold, #tip.hold.out { left: 50%; top: 50%; bottom: auto; transform: translate(-50%, -50%); width: min(340px, calc(100vw - 32px)); pointer-events: auto; animation: none; box-shadow: 0 0 0 100vmax rgba(4, 5, 12, 0.35), 0 10px 34px rgba(0, 0, 0, 0.5); }
#tip.hold .tip-x { padding: 8px 14px; font-size: 12px; }
@media (orientation: landscape) and (max-height: 500px) {
  body.touch #btn-talk { right: calc(236px + var(--safe-r)); top: auto; bottom: calc(150px + var(--safe-b)); }   /* clear of USE */
}

/* co-op: the team waits while someone picks a power-up (js/ui.js teamPause) */
#teampause { position: fixed; left: 50%; top: max(28%, calc(226px + var(--safe-t)));   /* under a full stack of toasts */ transform: translateX(-50%); z-index: 40; pointer-events: none; display: grid; justify-items: center; gap: 2px; padding: 8px 18px; border-radius: 12px; background: rgba(4, 5, 12, 0.82); border: 1px solid var(--c); box-shadow: 0 0 24px color-mix(in srgb, var(--c) 35%, transparent); font-family: var(--font-display); text-align: center; max-width: calc(100vw - 32px); }
@media (max-width: 820px) { #teampause { top: calc(32% + 80px); } }   /* the phone's toasts start at 32% (two at most) */
#teampause.me { top: auto; bottom: calc(18px + var(--safe-b)); }
#teampause b { font-size: 15px; letter-spacing: 0.1em; color: var(--c); }
#teampause small { font-size: 11px; letter-spacing: 0.08em; color: var(--dim); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }   /* read aloud, not shown */

/* ---------------- the 3D showroom (js/showroom.js): operator select over the fans, and the locker beside its operator ---------------- */
#showroom { position: fixed; inset: 0; z-index: 10; touch-action: none; font-family: var(--font-display);
  background: linear-gradient(90deg, rgba(3, 5, 12, 0) 52%, rgba(3, 5, 12, 0.5) 78%, rgba(3, 5, 12, 0.72) 100%), linear-gradient(180deg, rgba(3, 5, 12, 0.55) 0, rgba(3, 5, 12, 0) 16%, rgba(3, 5, 12, 0) 82%, rgba(3, 5, 12, 0.6) 100%); }
#showroom .sr-top { position: absolute; left: calc(18px + var(--safe-l)); top: calc(16px + var(--safe-t)); display: flex; align-items: center; gap: 16px; }
#showroom .sr-head { display: grid; gap: 2px; }
/* launched from PLAY (the operator already picked on the title): nothing to browse, so no arrows, tabs, hint or BACK */
#showroom.launch .sr-arrow, #showroom.launch .sr-dots, #showroom.launch .sr-hint, #showroom.launch #sr-back, #showroom.launch #sr-count { display: none; }
#showroom .sr-head b { font-size: 13px; letter-spacing: 0.22em; color: var(--dim); }
.sr-btn { background: rgba(6, 9, 20, 0.7); border-color: rgba(148, 163, 204, 0.28); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.sr-arrow { position: absolute; top: 53%; width: 58px; height: 58px; margin-top: -29px; padding: 0; border-radius: 50%; font-size: 34px; line-height: 1; display: grid; place-items: center;
  background: rgba(6, 9, 20, 0.62); border: 1px solid rgba(34, 228, 255, 0.4); color: #dff8ff; box-shadow: 0 0 22px rgba(34, 228, 255, 0.18); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.sr-arrow:hover { border-color: var(--cyan); box-shadow: 0 0 30px rgba(34, 228, 255, 0.45); }
.sr-arrow.left { left: calc(3vw + var(--safe-l)); }
.sr-arrow.right { right: calc(4vw + min(410px, 34vw) + 22px + var(--safe-r)); }
.sr-arrow:disabled { opacity: 0.18; }
.sr-card { position: absolute; right: calc(4vw + var(--safe-r)); top: 50%; transform: translateY(-50%); width: min(410px, 34vw); max-height: calc(100% - 140px); overflow-y: auto;
  padding: 22px 22px 20px; border-radius: 20px; background: linear-gradient(180deg, rgba(14, 19, 40, 0.86), rgba(6, 9, 20, 0.9)); border: 1px solid rgba(34, 228, 255, 0.26);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.sr-card::before { content: ''; position: absolute; left: 22px; right: 22px; top: 0; height: 2px; border-radius: 2px; background: var(--grad); opacity: 0.9; }
.sr-card.locked { border-color: rgba(148, 163, 204, 0.22); }
.sr-card.locked::before { background: linear-gradient(90deg, #5b6680, #2b3246); }
.sr-card.swap > * { animation: srSwap 300ms var(--ease) both; }
.sr-card.swap > *:nth-child(2) { animation-delay: 30ms; } .sr-card.swap > *:nth-child(3) { animation-delay: 60ms; } .sr-card.swap > *:nth-child(4) { animation-delay: 90ms; }
@keyframes srSwap { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.sr-card.nope { animation: srNope 420ms ease; }
@keyframes srNope { 0%, 100% { margin-left: 0; } 20% { margin-left: -10px; } 40% { margin-left: 9px; } 60% { margin-left: -6px; } 80% { margin-left: 3px; } }
.sr-card.go { border-color: var(--lime); box-shadow: 0 0 0 1px rgba(60, 245, 167, 0.5), 0 0 60px rgba(60, 245, 167, 0.3), 0 30px 90px rgba(0, 0, 0, 0.55); }
.sr-role { font-size: 11px; letter-spacing: 0.26em; color: var(--lime); font-weight: 700; }
.sr-card.locked .sr-role { color: var(--faint); }
.sr-card h2 { font-size: clamp(28px, 3.4vw, 44px); line-height: 1; margin: 8px 0 6px; letter-spacing: 0.02em; text-shadow: 0 0 24px rgba(34, 228, 255, 0.25); overflow-wrap: anywhere; }
.sr-tag { margin: 0 0 14px; color: var(--dim); font-family: var(--font-body); font-size: 14px; }
.sr-stats { display: grid; gap: 7px; }
.sr-stat { display: grid; grid-template-columns: 74px 1fr 40px; align-items: center; gap: 10px; font-size: 11px; letter-spacing: 0.16em; color: var(--dim); }
.sr-stat i { height: 7px; border-radius: 6px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.sr-stat i b { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #13b988, #22e4ff); box-shadow: 0 0 10px rgba(34, 228, 255, 0.5); transition: width 420ms var(--ease); }
.sr-card.locked .sr-stat i b { background: linear-gradient(90deg, #3a4358, #59647e); box-shadow: none; }
.sr-stat em { font-style: normal; font-family: var(--font-mono); font-size: 13px; color: var(--text); letter-spacing: 0; text-align: right; }
.sr-weapon { display: flex; align-items: center; gap: 12px; margin-top: 6px; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.07); font-size: 15px; }
.sr-weapon svg { width: 32px; height: 32px; flex: none; }
.sr-weapon small { display: block; font-size: 9px; letter-spacing: 0.24em; color: var(--faint); }
.sr-perk { margin: 12px 0 0; font-family: var(--font-body); font-size: 13px; line-height: 1.45; color: #c9d0e6; }
.sr-lock { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: rgba(255, 189, 46, 0.08); border: 1px solid rgba(255, 189, 46, 0.35); color: var(--amber); font-family: var(--font-body); font-weight: 600; font-size: 13px; }
.sr-lock small { display: block; margin-top: 3px; font-family: var(--font-mono); color: #ffd98a; opacity: 0.8; }
#sr-go { width: 100%; margin-top: 16px; }
#sr-go kbd { color: #03140e; border-color: rgba(3, 20, 14, 0.35); background: rgba(255, 255, 255, 0.25); }
.sr-card.go #sr-go { animation: srPulse 600ms ease infinite alternate; }
@keyframes srPulse { from { box-shadow: 0 6px 24px rgba(60, 245, 167, 0.35); } to { box-shadow: 0 6px 44px rgba(60, 245, 167, 0.85); } }
.sr-dots { position: absolute; left: var(--safe-l); right: calc(4vw + min(410px, 34vw) + var(--safe-r)); bottom: calc(18px + var(--safe-b)); display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; padding: 0 12px; }
.sr-dots button { padding: 6px 10px; font-size: 10px; letter-spacing: 0.12em; border-radius: 999px; background: rgba(6, 9, 20, 0.6); border-color: rgba(148, 163, 204, 0.22); color: var(--dim); }
.sr-dots button.on { color: #03140e; background: linear-gradient(180deg, #2af0b4, #13b988); border-color: transparent; box-shadow: 0 0 16px rgba(60, 245, 167, 0.45); }
.sr-dots button.locked span::before { content: '🔒 '; font-size: 9px; }
.sr-dots button.locked.on { background: linear-gradient(180deg, #59647e, #3a4358); color: #eef1fb; box-shadow: none; }
/* touch screens of any size (a tablet held sideways too): the operator tabs are 44 px targets, the dot drawn inside */
@media (pointer: coarse) {
  .sr-dots { gap: 0; padding: 0; flex-wrap: nowrap; }
  .sr-dots button, .sr-dots button.on, .sr-dots button.locked.on { position: relative; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 12px; background: none; box-shadow: none; flex: none; }
  .sr-dots button span { display: none; }
  .sr-dots button::before { content: ''; position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: rgba(6, 9, 20, 0.75); border: 1px solid rgba(148, 163, 204, 0.4); box-sizing: border-box; }
  .sr-dots button.on::before { width: 26px; margin-left: -13px; border-radius: 8px; background: linear-gradient(180deg, #2af0b4, #13b988); border-color: transparent; box-shadow: 0 0 12px rgba(60, 245, 167, 0.5); }
  .sr-dots button.locked::before { opacity: 0.6; }
  .sr-dots button.locked.on::before { background: linear-gradient(180deg, #59647e, #3a4358); box-shadow: none; opacity: 1; }
}
.sr-hint { position: absolute; left: 0; right: calc(4vw + min(410px, 34vw)); bottom: calc(56px + var(--safe-b)); text-align: center; font-size: 10px; letter-spacing: 0.24em; color: var(--faint); }
body.touch .sr-hint, body.touch #sr-back kbd { display: none; }
.sr-open { display: block; width: 100%; margin-top: 10px; padding: 9px 12px; font-size: 12px; letter-spacing: 0.14em; background: linear-gradient(90deg, rgba(34, 228, 255, 0.1), rgba(255, 45, 191, 0.1)); border-color: rgba(34, 228, 255, 0.4); color: #dff8ff; }
.sr-open:hover { box-shadow: 0 0 18px rgba(34, 228, 255, 0.3); }
@media (max-width: 520px) { .sr-open .long { display: none; } }
#sr-tryon { position: fixed; z-index: 11; transform: translateX(-50%); pointer-events: none; text-align: center; padding: 8px 16px; border-radius: 12px; font-family: var(--font-display);
  background: rgba(4, 6, 14, 0.74); border: 1px solid rgba(60, 245, 167, 0.4); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); max-width: 80vw; }
#sr-tryon b { display: block; font-size: 13px; letter-spacing: 0.14em; }
#sr-tryon small { display: block; font-size: 10px; letter-spacing: 0.18em; color: var(--dim); margin-top: 2px; }
#sr-tryon.locked { border-color: rgba(255, 189, 46, 0.55); }
#sr-tryon.locked small { color: var(--amber); }
/* the locker beside its operator: the list on the right, the 3D room on the left (or above, on a phone) */
#menu.sr-locker { background: linear-gradient(90deg, rgba(3, 5, 12, 0) 40%, rgba(3, 5, 12, 0.55) 100%); pointer-events: none; overflow: hidden; }
#menu.sr-locker > .modal-box { pointer-events: auto; margin: 0 0 0 auto; width: min(560px, 46vw); max-height: 100%; overflow-y: auto; background: rgba(8, 11, 26, 0.86); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
#menu.sr-locker .locker .slotrow { grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); }
#menu.sr-locker .cos { transition: border-color 120ms, background 120ms, transform 120ms var(--ease); }
#menu.sr-locker .cos:hover, #menu.sr-locker .cos:focus-visible { background: rgba(34, 228, 255, 0.08); border-color: rgba(34, 228, 255, 0.55); }
.locker .cos.locked[aria-disabled="true"] { cursor: help; }
/* the moment between PLAY and the room: a dark backdrop and a spinner over the old frame, under the screen's own UI */
#sr-load { position: fixed; inset: 0; z-index: 9; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding-right: min(40vw, 460px); background: radial-gradient(ellipse at 36% 50%, rgba(10, 16, 34, 0.9), rgba(3, 5, 12, 0.97)); font-family: var(--font-display); letter-spacing: 0.24em; font-size: 12px; color: var(--dim); pointer-events: none; }
#sr-load .spinner { border-top-color: var(--cyan); }
#showroom.launch .sr-card, #showroom.launch .sr-top { visibility: hidden; }   /* PLAY's send-off: nothing to choose, the operator has the stage */
#title.sr-sending { position: fixed; z-index: 11; pointer-events: none; }   /* the title over the send-off's room until it crossfades away */
#sr-vig { position: fixed; inset: 0; z-index: 28; pointer-events: none; background: radial-gradient(ellipse 62% 70% at 50% 46%, rgba(4, 5, 12, 0) 52%, rgba(4, 5, 12, 0.82) 100%); }
@media (max-aspect-ratio: 85/100) { #sr-vig { background: radial-gradient(ellipse 80% 52% at 50% 40%, rgba(4, 5, 12, 0) 50%, rgba(4, 5, 12, 0.82) 100%); } }
#sr-fade { position: fixed; inset: 0; z-index: 29; background: #04050c; pointer-events: none; }   /* PLAY's send-off fades to the loading cover's colour (#loading is z 30) */
@media (max-aspect-ratio: 85/100) { #sr-load { padding: 0 0 46vh; } }
@media (max-aspect-ratio: 85/100) {
  #showroom { background: linear-gradient(180deg, rgba(3, 5, 12, 0.5) 0, rgba(3, 5, 12, 0) 14%, rgba(3, 5, 12, 0) 48%, rgba(3, 5, 12, 0.6) 62%); }
  .sr-arrow { top: 29%; width: 46px; height: 46px; margin-top: -23px; font-size: 28px; }
  .sr-arrow.left { left: calc(10px + var(--safe-l)); }
  .sr-arrow.right { right: calc(10px + var(--safe-r)); }
  .sr-card { left: calc(12px + var(--safe-l)); right: calc(12px + var(--safe-r)); top: auto; bottom: calc(12px + var(--safe-b)); transform: none; width: auto; max-height: 44%; padding: 16px 16px 14px; border-radius: 18px; }
  .sr-card h2 { font-size: 28px; margin: 4px 0 2px; }
  .sr-tag { font-size: 12px; margin-bottom: 10px; }
  .sr-stats { gap: 5px; }
  .sr-stat { grid-template-columns: 64px 1fr 34px; font-size: 10px; }
  .sr-weapon { font-size: 13px; padding: 6px 8px; }
  .sr-weapon svg { width: 26px; height: 26px; }
  .sr-perk { font-size: 12px; margin-top: 8px; }
  #sr-go { margin-top: 10px; padding: 12px 16px; font-size: 16px; }
  /* the dots are 44 px touch targets (eight fit a 360 px phone), each drawing its small dot inside */
  .sr-dots { left: 0; right: 0; bottom: auto; top: calc(57% - 22px); gap: 0; padding: 0; flex-wrap: nowrap; }   /* under the fan's plate, above the card */
  .sr-dots button, .sr-dots button.on, .sr-dots button.locked.on { position: relative; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 12px; background: none; box-shadow: none; flex: none; }
  .sr-dots button span { display: none; }
  .sr-dots button::before { content: ''; position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: rgba(6, 9, 20, 0.75); border: 1px solid rgba(148, 163, 204, 0.4); box-sizing: border-box; }
  .sr-dots button.on::before { width: 26px; margin-left: -13px; border-radius: 8px; background: linear-gradient(180deg, #2af0b4, #13b988); border-color: transparent; box-shadow: 0 0 12px rgba(60, 245, 167, 0.5); }
  .sr-dots button.locked::before { opacity: 0.6; }
  .sr-dots button.locked.on::before { background: linear-gradient(180deg, #59647e, #3a4358); box-shadow: none; opacity: 1; }
  .sr-hint { display: none; }
  #menu.sr-locker { background: none; padding: calc(40vh + 4px) 0 0; }
  #menu.sr-locker > .modal-box { width: 100%; height: 100%; margin: 0; border-radius: 18px 18px 0 0; padding: 14px 14px calc(14px + var(--safe-b)); }
  #menu.sr-locker .modal-box h2 { font-size: 24px; margin-bottom: 10px; }
  #menu.sr-locker .locker .slotrow { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}
@media (orientation: landscape) and (max-height: 520px) {
  #showroom .sr-top { top: calc(8px + var(--safe-t)); }
  .sr-arrow { width: 44px; height: 44px; margin-top: -22px; font-size: 26px; }
  .sr-arrow.right { right: calc(2vw + min(380px, 42vw) + 14px + var(--safe-r)); }
  .sr-card { right: calc(2vw + var(--safe-r)); width: min(380px, 42vw); max-height: calc(100% - 20px); padding: 12px 14px; }
  .sr-card h2 { font-size: 24px; margin: 2px 0; }
  .sr-tag { font-size: 11px; margin-bottom: 6px; }
  .sr-stats { gap: 3px; }
  .sr-weapon { padding: 4px 8px; margin-top: 3px; }
  .sr-perk { display: none; }
  .sr-lock { margin-top: 6px; padding: 6px 10px; font-size: 11px; }
  #sr-go { margin-top: 8px; padding: 10px 14px; font-size: 15px; }
  /* the tabs stay 44 px touch targets here too (dots drawn inside, no labels), in one row left of the card */
  .sr-dots { right: calc(2vw + min(380px, 42vw) + var(--safe-r)); bottom: calc(2px + var(--safe-b)); gap: 0; padding: 0; flex-wrap: nowrap; }
  .sr-dots button, .sr-dots button.on, .sr-dots button.locked.on { position: relative; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 12px; background: none; box-shadow: none; flex: none; }
  .sr-dots button span { display: none; }
  .sr-dots button::before { content: ''; position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: rgba(6, 9, 20, 0.75); border: 1px solid rgba(148, 163, 204, 0.4); box-sizing: border-box; }
  .sr-dots button.on::before { width: 26px; margin-left: -13px; border-radius: 8px; background: linear-gradient(180deg, #2af0b4, #13b988); border-color: transparent; box-shadow: 0 0 12px rgba(60, 245, 167, 0.5); }
  .sr-dots button.locked::before { opacity: 0.6; }
  .sr-dots button.locked.on::before { background: linear-gradient(180deg, #59647e, #3a4358); box-shadow: none; opacity: 1; }
  .sr-hint { display: none; }
  #menu.sr-locker > .modal-box { width: min(460px, 50vw); padding: 12px 14px; }
}
@media (prefers-reduced-motion: reduce) { .sr-card.swap > *, .sr-card.nope, .sr-card.go #sr-go { animation: none; } }
/* ---------------- reward moments (js/rewards.js) ---------------- */
canvas#reward-fx { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 35; }
#rw-edge { position: fixed; inset: 0; pointer-events: none; z-index: 4; opacity: 0; background: radial-gradient(ellipse at center, transparent 48%, var(--ec, #ff8a2b) 135%); }
#rw-edge.on { animation: rwEdge 750ms ease-out; }
@keyframes rwEdge { 0% { opacity: 0; } 15% { opacity: var(--ek, 0.7); } 100% { opacity: 0; } }
/* a chest: a shaft of its rarity's colour behind the box, rays for a LEGENDARY, the reels landing */
#chest .modal-box { position: relative; z-index: 1; }
#chest .rw-shaft, #chest .rw-rays { position: absolute; pointer-events: none; opacity: 0; }
#chest .rw-shaft { left: 50%; top: 0; bottom: 0; width: min(560px, 76vw); transform: translateX(-50%) scaleX(0.2);
  background: radial-gradient(ellipse 50% 46% at 50% 50%, color-mix(in srgb, var(--rc, #fff) 55%, transparent) 0%, transparent 100%),
    linear-gradient(90deg, transparent 0%, color-mix(in srgb, var(--rc, #fff) 22%, transparent) 28%, color-mix(in srgb, var(--rc, #fff) 46%, transparent) 50%, color-mix(in srgb, var(--rc, #fff) 22%, transparent) 72%, transparent 100%); }
#chest.rw-on .rw-shaft { animation: rwShaft 650ms var(--ease) forwards; }
#chest.rw-landed .rw-shaft { animation: rwShaft 650ms var(--ease) forwards, rwShaftHit 700ms ease-out; }
@keyframes rwShaft { to { opacity: 0.85; transform: translateX(-50%) scaleX(1); } }
@keyframes rwShaftHit { 0% { opacity: 1; transform: translateX(-50%) scaleX(1.35); } 100% { opacity: 0.85; transform: translateX(-50%) scaleX(1); } }
#chest .rw-rays { left: 50%; top: 50%; width: min(1000px, 130vmax); height: min(1000px, 130vmax); transform: translate(-50%, -50%);
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--rc, #ffbd2e) 32%, transparent) 0deg 7deg, transparent 7deg 22.5deg);
  -webkit-mask: radial-gradient(circle, #000 0 12%, transparent 62%); mask: radial-gradient(circle, #000 0 12%, transparent 62%); }
#chest.rw-legend .rw-rays { animation: rwRaysIn 700ms ease-out forwards, rwSpin 16s linear infinite; }
@keyframes rwRaysIn { to { opacity: 1; } }
@keyframes rwSpin { from { transform: translate(-50%, -50%) rotate(0deg); } to { transform: translate(-50%, -50%) rotate(360deg); } }
@media (pointer: coarse) { #chest.rw-legend .rw-rays { animation: rwRaysIn 700ms ease-out forwards; } }   /* a phone: still rays, no big spinning layer */
@media (prefers-reduced-motion: reduce) {   /* the global rule shortens animations but keeps infinite ones looping: stop those outright */
  #chest.rw-legend .rw-rays { animation: rwRaysIn 1ms forwards !important; }
  #chest-rarity.rw-stamp, .jackpot #chest-rarity.rw-stamp { animation: rwStampIn 1ms both !important; }
}
.reel.rw-land { animation: rwReel 380ms cubic-bezier(0.2, 1.3, 0.4, 1); box-shadow: 0 0 34px var(--rc, var(--cyan)), inset 0 0 18px color-mix(in srgb, var(--rc, #22e4ff) 40%, transparent); }
@keyframes rwReel { 0% { transform: scale(1.16) translateY(-8px); } 55% { transform: scale(0.96) translateY(3px); } 100% { transform: none; } }
.modal-box.rw-thud { animation: rwThud 300ms ease-out; }
@keyframes rwThud { 0% { transform: none; } 25% { transform: translateY(7px) scale(1.01); } 60% { transform: translateY(-2px); } 100% { transform: none; } }
#chest-rarity.rw-stamp, .jackpot #chest-rarity.rw-stamp { transform-origin: 0 50%; text-shadow: 0 0 24px currentColor; animation: rwStampIn 520ms cubic-bezier(0.2, 1.4, 0.4, 1) both, flick 90ms 520ms infinite alternate; }
@keyframes rwStampIn { 0% { opacity: 0; transform: scale(2.4) rotate(-6deg); } 60% { opacity: 1; transform: scale(0.94) rotate(1deg); } 100% { transform: none; } }
/* a level-up: the XP bar flashes, the level number pops */
.lvwrap.rw-flash .xpbar { animation: rwXp 650ms ease-out; }
.lvwrap.rw-flash #xp-fill { animation: rwXpFill 650ms ease-out; }
.lvwrap.rw-flash #lvl { color: var(--lime); animation: rwLvl 650ms cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes rwXp { 0% { box-shadow: 0 0 0 0 rgba(60, 245, 167, 0); } 18% { box-shadow: 0 0 16px 3px rgba(60, 245, 167, 0.95); border-color: #b8ffe4; transform: scaleY(1.7); } 100% { box-shadow: 0 0 0 0 rgba(60, 245, 167, 0); transform: none; } }
@keyframes rwXpFill { 0%, 30% { filter: brightness(2.4); } 100% { filter: none; } }
@keyframes rwLvl { 0% { transform: scale(1.7); } 100% { transform: none; } }
/* combo tiers: a flare at 25 and 50, the peak (a ring off the counter) at 100+ */
#combo.rw-flare b { animation: rwFlare 420ms cubic-bezier(0.2, 1.4, 0.4, 1); }
#combo.rw-flare b, #combo.rw-peak b { transform-origin: 100% 60%; }   /* it grows away from the screen's edge */
#combo.rw-peak b { animation: rwPeakB 900ms cubic-bezier(0.2, 1.4, 0.4, 1); }
#combo.rw-peak::after { content: ''; position: absolute; right: 0; top: -6px; width: 64px; height: 64px; border-radius: 50%; border: 3px solid #ffbd2e; opacity: 0; animation: rwRing 700ms ease-out; pointer-events: none; }
@keyframes rwFlare { 0% { transform: scale(1.5); filter: drop-shadow(0 0 14px #ffbd2e); } 100% { transform: none; } }
@keyframes rwPeakB { 0% { transform: scale(2.3); filter: drop-shadow(0 0 22px #ff8a2b) brightness(1.6); } 100% { transform: none; } }
@keyframes rwRing { 0% { opacity: 1; transform: scale(0.4); } 100% { opacity: 0; transform: scale(2.6); } }
/* milestone banners: tier 2 draws a rule under the title, tier 3 also slams it in on a glow */
#banner::before { content: ''; position: absolute; left: 50%; top: 50%; width: min(900px, 96vw); height: 240px; transform: translate(-50%, -50%); background: radial-gradient(ellipse at center, color-mix(in srgb, var(--bc, #fff) 30%, transparent), transparent 70%); opacity: 0; pointer-events: none; z-index: -1; }
#banner.rw-t3::before { animation: rwGlow 1500ms ease-out; }
#banner.rw-t2::after, #banner.rw-t3::after { content: ''; display: block; height: 3px; width: 0; margin: 10px auto 0; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--bc, #fff), transparent); animation: rwRule 700ms 120ms var(--ease) forwards; }
#banner.rw-t3 h2 { animation: rwBig 800ms cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes rwGlow { 0% { opacity: 0; } 20% { opacity: 1; } 100% { opacity: 0; } }
@keyframes rwRule { to { width: min(520px, 70vw); } }
@keyframes rwBig { 0% { transform: scale(1.8); filter: brightness(2); } 100% { transform: none; filter: none; } }
.toast.rw-shine { position: relative; overflow: hidden; }
.toast.rw-shine::after { content: ''; position: absolute; top: 0; bottom: 0; left: -40%; width: 40%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.45), transparent); animation: rwShine 900ms 150ms ease-out forwards; }
@keyframes rwShine { to { left: 120%; } }
/* the results card: the NEW RECORD stamp, BONKBOT cheering, a board rank, the score's count-up landing */
.results { position: relative; }
#rs-stamp { position: absolute; top: 16px; right: 20px; transform: rotate(-9deg); padding: 6px 14px 7px; border: 3px solid var(--amber); border-radius: 10px; color: var(--amber); background: rgba(40, 28, 0, 0.6); text-align: center; pointer-events: none; font-family: var(--font-display); box-shadow: inset 0 0 0 2px rgba(255, 189, 46, 0.25), 0 0 30px rgba(255, 189, 46, 0.35); z-index: 2; }
#rs-stamp b { display: block; font-size: 24px; letter-spacing: 0.12em; text-shadow: 0 0 18px rgba(255, 189, 46, 0.6); }
#rs-stamp small { display: block; font-size: 10px; letter-spacing: 0.3em; }
#rs-stamp.slam { animation: rwStamp 520ms cubic-bezier(0.2, 1.4, 0.4, 1) both; }
@keyframes rwStamp { 0% { opacity: 0; transform: rotate(-20deg) scale(3); } 55% { opacity: 1; transform: rotate(-7deg) scale(0.92); } 75% { transform: rotate(-10deg) scale(1.05); } 100% { transform: rotate(-9deg) scale(1); } }
#rs-cheer { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 12px; }
.rs-botwrap { position: relative; flex: none; width: 86px; height: 54px; padding: 5px; border-radius: 18px; background: linear-gradient(180deg, #ffd34d, #f0a81c); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4); margin-top: 14px; }
.rs-botwrap::before { content: ''; position: absolute; left: 50%; top: -12px; width: 3px; height: 12px; background: #c98a10; transform: translateX(-50%); }
.rs-botwrap::after { content: ''; position: absolute; left: 50%; top: -18px; width: 9px; height: 9px; border-radius: 50%; background: #46e0ff; box-shadow: 0 0 10px #46e0ff; transform: translateX(-50%); }
#rs-bot { display: block; width: 100%; height: 100%; }
#rs-cheer-text { font-family: var(--font-display); font-weight: 700; font-size: 14px; letter-spacing: 0.08em; padding: 8px 12px; border-radius: 12px 12px 12px 3px; background: rgba(255, 255, 255, 0.07); border: 1px solid var(--border-soft); }
#rs-cheer.bounce .rs-botwrap { animation: rwBob 520ms ease-in-out 3; }
@keyframes rwBob { 0%, 100% { transform: translateY(0) rotate(0); } 30% { transform: translateY(-10px) rotate(-6deg); } 60% { transform: translateY(0) rotate(4deg); } }
#rs-rank { font-family: var(--font-display); font-size: 13px; letter-spacing: 0.14em; color: #03140e; background: linear-gradient(180deg, #ffd34d, #ffbd2e); padding: 6px 12px; border-radius: 999px; box-shadow: 0 0 22px rgba(255, 189, 46, 0.45); }
#rs-rank.pop, .stat.rw-pop { animation: rwPop 460ms cubic-bezier(0.2, 1.4, 0.4, 1); }
.stat.rw-pop { border-color: var(--amber); box-shadow: 0 0 22px rgba(255, 189, 46, 0.4); }
@keyframes rwPop { 0% { transform: scale(1.3); } 100% { transform: none; } }
@media (max-width: 820px) {
  #combo.rw-flare b, #combo.rw-peak b { transform-origin: 0 60%; }
  #combo.rw-peak::after { right: auto; left: 0; }
  #rs-stamp { top: -12px; right: 10px; }   /* a sticker on the card's corner, clear of the title */
}
@media (orientation: landscape) and (max-height: 500px) { body.touch #combo.rw-flare b, body.touch #combo.rw-peak b { transform-origin: 100% 60%; } body.touch #combo.rw-peak::after { left: auto; right: 0; } }
@media (max-width: 600px) {
  #rs-stamp { padding: 4px 9px 5px; }
  #rs-stamp b { font-size: 16px; }
  #rs-stamp small { font-size: 8px; letter-spacing: 0.2em; }
  #rs-cheer-text { font-size: 12px; }
}
/* ---------------- THE CHAIN: the upgrade tree, an MMO-style skill tree (js/chainui.js, art in js/chainicons.js) ---------------- */
.modal-box.chainbox { width: min(1520px, 100%); height: calc(100vh - 32px - var(--safe-t) - var(--safe-b)); height: calc(100dvh - 32px - var(--safe-t) - var(--safe-b)); padding: 12px 14px 10px; display: flex; flex-direction: column;
  background: radial-gradient(110% 70% at 50% 0%, rgba(255, 189, 46, 0.08), rgba(0, 0, 0, 0) 60%), radial-gradient(90% 60% at 50% 110%, rgba(60, 90, 200, 0.12), rgba(0, 0, 0, 0) 70%), linear-gradient(180deg, rgba(9, 11, 26, 0.97), rgba(4, 5, 14, 0.98));
  border-color: rgba(255, 189, 46, 0.32); box-shadow: 0 24px 80px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 220, 150, 0.12); }
.modal-box.chainbox > .kicker, .modal-box.chainbox > h2, .modal-box.chainbox > .row { display: none; }
.modal-box.chainbox #menu-body { flex: 1; min-height: 0; display: flex; }
.chain { --u: 32px; --lh: 52px; --rootpad: 30px; position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; width: 100%; }
.chain button { font-family: var(--font-display); }
html:has(.chain), html:has(.chain) body { overscroll-behavior-x: none; }   /* a swipe between branches never turns into the browser's "back" */
:where(.chain) .ci { display: block; width: 100%; height: 100%; overflow: visible; }

/* ---- the top bar: the big $BONK counter, CHAIN POWER, ranks, RESPEC, BACK ---- */
.ch-top { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto auto; gap: 8px; align-items: stretch; }
.ch-title { display: flex; flex-direction: column; justify-content: center; padding: 0 6px 0 2px; }
.ch-title small { font-family: var(--font-display); font-size: 9px; letter-spacing: 0.32em; color: var(--amber); font-weight: 700; }
.ch-title b { font-family: var(--font-display); font-size: 28px; line-height: 1; letter-spacing: 0.04em; background: linear-gradient(180deg, #fff 20%, #ffbd2e 75%, #ff8a2b); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 2px 10px rgba(255, 160, 40, 0.35)); white-space: nowrap; }
.ch-stat { padding: 5px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.34); border: 1px solid var(--border-soft); min-width: 0; }
.ch-stat small { display: flex; align-items: center; gap: 4px; font-family: var(--font-display); font-size: 9.5px; letter-spacing: 0.22em; color: var(--dim); font-weight: 700; }
.ch-stat b { font-family: var(--font-display); font-size: 20px; white-space: nowrap; }
.ch-stat b i { font-style: normal; font-size: 12px; color: var(--dim); }
.ch-bank { position: relative; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 3px 18px 4px; min-width: 150px; overflow: hidden;
  background: radial-gradient(90% 120% at 50% 0%, rgba(255, 196, 64, 0.22), rgba(255, 196, 64, 0) 70%), rgba(10, 8, 2, 0.5); border-color: rgba(255, 200, 80, 0.45); box-shadow: inset 0 0 18px rgba(255, 180, 40, 0.12); }
.ch-bank::before { content: ''; position: absolute; inset: 3px; border-radius: 9px; border: 1px solid rgba(255, 216, 132, 0.18); pointer-events: none; }
.ch-bank b { font-size: 31px; line-height: 1.05; letter-spacing: 0.01em; background: linear-gradient(180deg, #fffbe8 10%, #ffd84a 55%, #ff9f1a); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 10px rgba(255, 190, 40, 0.45)); }
.ch-bank.long b { font-size: 24px; }
.ch-bank small { justify-content: center; font-size: 8.5px; letter-spacing: 0.26em; color: #e9c56a; }
.ch-power { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; }
.ch-power small { grid-column: 1 / -1; }
.ch-pi { width: 11px !important; height: 11px !important; color: var(--lime); }
.ch-power b { color: var(--lime); text-shadow: 0 0 14px rgba(60, 245, 167, 0.45); }
.ch-power span { grid-column: 1 / -1; font-family: var(--font-mono); font-size: 10px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-power span em { font-style: normal; color: var(--text); }
.ch-pbar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.ch-pbar i { display: block; height: 100%; background: linear-gradient(90deg, #ffb020, #7fe3ff 30%, #c07bff 55%, #3cf5a7 80%, #46ffd8); box-shadow: 0 0 10px rgba(60, 245, 167, 0.6); }
.ch-worn { display: flex; align-items: center; gap: 4px; margin-top: 1px; font-family: var(--font-display); font-weight: 700; font-size: 9.5px; letter-spacing: 0.12em; color: #ffd884; white-space: nowrap; }
.ch-worn .ci { width: 12px; height: 12px; }
.ch-worn.full { color: #ffbd2e; text-shadow: 0 0 8px rgba(255, 189, 46, 0.6); }
.ch-respec { border-color: rgba(255, 138, 43, 0.55); color: #ffb37a; padding: 5px 14px; }
.ch-respec small { display: block; font-size: 10px; color: var(--dim); font-family: var(--font-body, inherit); letter-spacing: 0; }
.ch-respec:hover:not(:disabled) { border-color: #ff8a2b; background: rgba(255, 138, 43, 0.12); }
.ch-back { padding: 5px 16px; align-self: center; }

/* ---- branch tabs, the swipe hint (one branch at a time) ---- */
.ch-tabs { display: none; gap: 6px; }
.ch-tab { position: relative; flex: 1; display: flex; align-items: center; gap: 6px; padding: 6px 8px; min-height: 44px; font-size: 11px; border-color: rgba(255, 255, 255, 0.1); min-width: 0; overflow: hidden; }
.ch-tab .ci { width: 18px; height: 18px; flex: none; color: var(--c); }
.ch-tab b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-tab small { margin: 0 0 0 auto; font-family: var(--font-mono); font-size: 10px; color: var(--dim); }
.ch-tab kbd { display: none; }
.ch-tbar { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--c); box-shadow: 0 0 6px var(--c); }
.ch-tab.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 16%, rgba(10, 14, 32, 0.9)); box-shadow: 0 0 14px color-mix(in srgb, var(--c) 30%, transparent); }
.ch-tab.on small { color: var(--text); }
.ch-swipe { display: none; align-items: center; justify-content: center; gap: 8px; font-family: var(--font-display); font-weight: 700; font-size: 10px; letter-spacing: 0.26em; color: #e9d9b0; text-shadow: 0 1px 4px #000; pointer-events: none; }
.ch-swipe > i { font-style: normal; color: var(--amber); letter-spacing: -0.1em; font-size: 13px; }
.ch-dots { display: flex; gap: 5px; margin-left: 4px; }
.ch-dots b { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, 0.18); transition: transform 200ms, background 200ms; }
.ch-dots b.on { background: var(--c); box-shadow: 0 0 8px var(--c); transform: scale(1.3); }

/* ---- the columns ---- */
.ch-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 262px; gap: 10px; container-type: inline-size; }
.ch-lanes { position: relative; min-height: 0; overflow-y: auto; overflow-x: hidden; display: grid; grid-template-columns: 26px repeat(5, minmax(0, 1fr)); gap: 6px; scrollbar-width: thin; padding: 2px;
  --u: clamp(26px, min(calc((100cqw - 320px) / 27), calc((100vh - 250px) / 12.5)), 50px); }
.ch-ruler { display: flex; flex-direction: column; padding: 0; }
.ch-rh { height: var(--lh); flex: none; }
.ch-ruler .ch-tiers { flex: 1; display: grid; grid-template-rows: repeat(6, minmax(calc(var(--u) * 1.95), 1fr)); }
.ch-rf { height: var(--rootpad); flex: none; }
.ch-rb { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.ch-rb b { display: grid; place-items: center; width: 22px; height: 19px; clip-path: polygon(25% 2%, 75% 2%, 100% 50%, 75% 98%, 25% 98%, 0 50%); background: linear-gradient(180deg, #ffd884, #a8701a); color: #1a1000; font-family: var(--font-display); font-size: 11px; }
.ch-rb small { font-family: var(--font-display); font-weight: 700; font-size: 6.5px; letter-spacing: 0.1em; color: var(--faint); writing-mode: vertical-rl; transform: rotate(180deg); }

.ch-lane { position: relative; z-index: 0; border-radius: 14px; display: flex; flex-direction: column; min-width: 0; padding: 0 2px;
  background: linear-gradient(180deg, rgba(8, 10, 24, 0.86), rgba(3, 4, 12, 0.92)); border: 1px solid color-mix(in srgb, var(--c) 24%, transparent);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--c) 30%, transparent), inset 0 -40px 60px -30px color-mix(in srgb, var(--c) 22%, transparent); }
/* the branch's glowing art: its own backdrop, brighter the more of it you own */
.ch-lane::before, .ch-lane::after { content: ''; position: absolute; z-index: -1; inset: 0; border-radius: inherit; pointer-events: none; }
.ch-lane::before { background: radial-gradient(ellipse 90% 58% at 50% 100%, color-mix(in srgb, var(--c) 38%, transparent), transparent 74%), radial-gradient(ellipse 60% 30% at 50% 0%, color-mix(in srgb, var(--c) 10%, transparent), transparent 80%); opacity: calc(0.4 + 0.6 * var(--spent)); }
.ch-lane::after { background-position: center bottom; background-size: 100% auto; background-repeat: no-repeat; opacity: calc(0.14 + 0.3 * var(--spent));
  -webkit-mask-image: linear-gradient(to top, #000 0%, rgba(0, 0, 0, 0.6) 45%, rgba(0, 0, 0, 0.1) 100%); mask-image: linear-gradient(to top, #000 0%, rgba(0, 0, 0, 0.6) 45%, rgba(0, 0, 0, 0.1) 100%); }
.ch-lh { position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; column-gap: 6px; padding: 7px 6px 0; height: var(--lh); flex: none; align-content: center; }
.ch-em { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; color: var(--c); background: radial-gradient(circle, color-mix(in srgb, var(--c) 26%, transparent), transparent 75%); filter: drop-shadow(0 0 5px color-mix(in srgb, var(--c) 70%, transparent)); }
.ch-em .ci { width: 20px; height: 20px; }
.ch-lh b { display: block; font-family: var(--font-display); font-size: 12.5px; letter-spacing: 0.07em; color: var(--c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 0 10px color-mix(in srgb, var(--c) 45%, transparent); }
.ch-lh small { display: block; font-size: 8.5px; letter-spacing: 0.22em; color: var(--dim); font-family: var(--font-display); font-weight: 700; }
.ch-lr { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.ch-lr i { font-style: normal; font-size: 10px; color: var(--dim); }
.ch-lbar { position: relative; grid-column: 1 / -1; height: 5px; margin-top: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.07); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05); }
.ch-lbar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 60%, #000), var(--c) 70%, color-mix(in srgb, var(--c) 50%, #fff)); box-shadow: 0 0 8px var(--c); }
.ch-lbar u { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: rgba(0, 0, 0, 0.75); border-radius: 1px; }
.ch-lbar u.on { background: color-mix(in srgb, var(--c) 40%, #fff); }

.ch-field { position: relative; flex: 1; display: flex; flex-direction: column; padding-bottom: var(--rootpad); }
.ch-field > .ch-tiers { flex: 1; display: grid; grid-template-rows: repeat(6, minmax(calc(var(--u) * 1.95), 1fr)); }
.ch-root { position: absolute; left: 50%; bottom: 5px; width: 20px; height: 20px; margin-left: -10px; display: grid; place-items: center; border-radius: 6px; rotate: 45deg; color: var(--faint);
  background: radial-gradient(circle, #1a2040, #070a18); border: 1.5px solid color-mix(in srgb, var(--c) 40%, #2a3150); }
.ch-root .ci { width: 12px; height: 12px; rotate: -45deg; }
.ch-root.on { color: #fff; border-color: var(--c); background: radial-gradient(circle, color-mix(in srgb, var(--c) 70%, #fff), color-mix(in srgb, var(--c) 40%, #050816)); box-shadow: 0 0 12px var(--c); }

/* the wires (one SVG per branch, drawn by chainui.js wire()) */
.ch-wires { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.ch-wires path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ch-wires .w.locked { stroke: rgba(150, 160, 200, 0.22); stroke-width: 1.4; stroke-dasharray: 3 4; }
.ch-wires .w.open { stroke: color-mix(in srgb, var(--c) 50%, rgba(150, 160, 200, 0.6)); stroke-width: 1.8; }
.ch-wires .w.lit { stroke: color-mix(in srgb, var(--c) 55%, #fff); stroke-width: 2.8; }
.ch-wires .glow { stroke: var(--c); stroke-width: 9; opacity: 0.28; }
.ch-wires .pulse { stroke: #fff; stroke-width: 2.2; stroke-dasharray: 3 23; opacity: 0.95; animation: chPulse 1.1s linear infinite; }
@keyframes chPulse { from { stroke-dashoffset: 26; } to { stroke-dashoffset: 0; } }
.ch-wires .jn { fill: #0b0f22; stroke: color-mix(in srgb, var(--c) 40%, rgba(130, 140, 180, 0.6)); stroke-width: 1.2; }
.ch-wires .jn.lit { fill: color-mix(in srgb, var(--c) 60%, #fff); stroke: var(--c); }
.ch-wires .fresh { stroke: #fff; stroke-width: 3.4; stroke-dasharray: 1 1; stroke-dashoffset: 1; filter: drop-shadow(0 0 4px var(--c)); animation: chDraw 420ms cubic-bezier(0.3, 0.7, 0.4, 1) forwards, chFade 500ms 700ms forwards; }
@keyframes chDraw { to { stroke-dashoffset: 0; } }
@keyframes chFade { to { opacity: 0; } }
.ch-wires .drain path { fill: none; stroke: color-mix(in srgb, var(--c) 72%, #fff); stroke-width: 2.6; stroke-dasharray: 1 1; stroke-dashoffset: 0; animation: chDrain 650ms ease-in forwards; }
@keyframes chDrain { to { stroke-dashoffset: 1; opacity: 0.2; } }

/* a block ("tier") row */
.ch-tier { position: relative; display: flex; align-items: center; justify-content: center; }
.ch-row { position: relative; display: flex; align-items: center; justify-content: space-evenly; width: 100%; padding: 0 2px; }
.ch-pair { position: relative; display: flex; align-items: center; gap: 1px; }
.ch-or { display: none; font-family: var(--font-display); font-weight: 700; font-size: 7px; letter-spacing: 0.1em; color: var(--faint); }
.ch-tl { position: absolute; left: 6px; top: 2px; display: none; align-items: baseline; gap: 4px; pointer-events: none; }
.ch-tl b { font-family: var(--font-mono); font-size: 10px; color: var(--c); opacity: 0.9; }
.ch-tl small { font-family: var(--font-display); font-weight: 700; font-size: 7.5px; letter-spacing: 0.14em; color: var(--faint); }
.ch-gate { position: absolute; z-index: 3; left: 50%; top: 100%; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 4px; padding: 2px 8px 2px 5px; border-radius: 999px; background: rgba(4, 6, 14, 0.9); border: 1px solid rgba(255, 255, 255, 0.12); font-family: var(--font-display); font-weight: 700; font-size: 8.5px; letter-spacing: 0.06em; color: var(--faint); white-space: nowrap; max-width: 98%; pointer-events: none; }
.ch-gate .ci { width: 11px; height: 11px; flex: none; color: #9aa4c2; }
.ch-gate.next { padding: 3px 9px 3px 6px; font-size: 9px; color: #e6e9f5; background: rgba(4, 6, 14, 0.96); border-color: color-mix(in srgb, var(--c) 60%, transparent); box-shadow: 0 0 12px color-mix(in srgb, var(--c) 28%, transparent); }
.ch-gate.next .ci { color: var(--c); }
.ch-gate span { overflow: hidden; text-overflow: ellipsis; }
.ch-gate.under { opacity: 0; }
.chain.hovering .hx.sel .hx-n { opacity: 0; visibility: hidden; }   /* one name at a time: the one under the pointer */
.ch-kswipe { display: none !important; }
.ch-opened { position: absolute; z-index: 4; left: 50%; top: 100%; transform: translate(-50%, -50%); padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--c) 85%, #fff); color: #06070f; font-family: var(--font-display); font-weight: 800; font-size: 9.5px; letter-spacing: 0.14em; white-space: nowrap; pointer-events: none; box-shadow: 0 0 18px var(--c); animation: chOpened 1.6s ease-out forwards; }
@keyframes chOpened { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.12); } 30% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }

/* ---- the nodes: a minor (round, rank pips on its ring), a notable (framed square), a mutation side (diamond), a capstone (emblem) ---- */
.hx { --box: calc(var(--u) + 12px); position: relative; display: grid; place-items: center; width: var(--box); height: var(--box); flex: none; padding: 0; margin: 0; background: none; border: 0; border-radius: 50%; cursor: pointer; color: var(--text); -webkit-tap-highlight-color: transparent; }
.hx:hover, .hx:focus { background: none; transform: none; outline: none; }
.hx > * { grid-area: 1 / 1; }
.hx-f { position: relative; display: grid; place-items: center; width: var(--u); height: var(--u); border-radius: 50%; color: color-mix(in srgb, var(--c) 70%, #aab3d0);
  background: radial-gradient(circle at 50% 32%, #1d2446, #080b1a 78%); border: 2px solid color-mix(in srgb, var(--c) 48%, #262c48); box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.5); transition: scale 160ms var(--ease); }
.hx-f .ci { width: 58%; height: 58%; }
.hx-pips { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.hx-pips .pip { fill: none; stroke: rgba(170, 180, 220, 0.16); stroke-width: 3.6; stroke-linecap: round; }
.hx-pips .pip.on { stroke: color-mix(in srgb, var(--c) 82%, #fff); filter: drop-shadow(0 0 2px var(--c)); }
/* the halo: pulses on a node you can buy now, glows on one you own */
.hx::before { content: ''; position: absolute; left: 50%; top: 50%; width: calc(var(--u) + 18px); height: calc(var(--u) + 18px); margin: calc((var(--u) + 18px) / -2) 0 0 calc((var(--u) + 18px) / -2); border-radius: 50%; pointer-events: none; opacity: 0;
  background: radial-gradient(circle, color-mix(in srgb, var(--c) 55%, transparent) 30%, transparent 68%); }
.hx.avail::before { opacity: 0.6; will-change: opacity, transform; animation: hxReady 1.7s ease-in-out infinite; }
@keyframes hxReady { 0%, 100% { opacity: 0.28; transform: scale(0.92); } 50% { opacity: 0.85; transform: scale(1.1); } }
.hx.owned::before { opacity: 0.55; }
.hx.avail .hx-f { border-color: var(--c); color: color-mix(in srgb, var(--c) 85%, #fff); background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--c) 22%, #1d2446), #080b1a 80%); }
.hx.poor .hx-f { border-color: color-mix(in srgb, var(--c) 55%, #262c48); }
.hx.owned .hx-f { color: #fff; border-color: color-mix(in srgb, var(--c) 65%, #fff); background: radial-gradient(circle at 50% 28%, color-mix(in srgb, var(--c) 88%, #fff), color-mix(in srgb, var(--c) 62%, #0a0c1c) 62%, color-mix(in srgb, var(--c) 30%, #05060f)); box-shadow: 0 0 10px color-mix(in srgb, var(--c) 60%, transparent), inset 0 -3px 6px rgba(0, 0, 0, 0.35); }
.hx.owned .hx-f .ci { filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.6)); }
.hx.maxed .hx-f { box-shadow: 0 0 14px var(--c), 0 0 0 1.5px rgba(255, 255, 255, 0.55), inset 0 -3px 6px rgba(0, 0, 0, 0.35); }
/* locked: dark, desaturated, a padlock */
.hx.gated { --c: #6a7290; }
.hx.gated .hx-f { color: #5d6683; background: radial-gradient(circle at 50% 32%, #141831, #06080f 78%); border-color: #2c3250; box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.7); }
.hx.gated .hx-pips .pip { stroke: rgba(120, 130, 170, 0.1); }
.hx.gated::after { content: ''; position: absolute; right: calc(50% - var(--u) / 2 - 5px); bottom: calc(50% - var(--u) / 2 - 4px); width: 14px; height: 14px; border-radius: 50%; pointer-events: none;
  background: #0b0e1e url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='%239aa4c2' stroke-width='2.6' stroke-linecap='round'%3E%3Crect x='5' y='10.5' width='14' height='10' rx='2'/%3E%3Cpath d='M8.5 10.5V8a3.5 3.5 0 0 1 7 0v2.5'/%3E%3C/g%3E%3C/svg%3E") center / 9px no-repeat; border: 1px solid #353c5c; }
.hx.soon .hx-f { background: repeating-linear-gradient(135deg, rgba(160, 170, 210, 0.18) 0 4px, rgba(160, 170, 210, 0.06) 4px 8px), #090c1a; color: #7a83a6; }
/* selection and keyboard focus: a ring you can see from across the room */
.hx:hover .hx-f { scale: 1.07; }
.hx.sel .hx-f { scale: 1.1; outline: 2px solid #fff; outline-offset: 3px; }
.hx:focus-visible .hx-f { scale: 1.1; outline: 2.5px solid #ffd84a; outline-offset: 4px; box-shadow: 0 0 0 7px rgba(255, 216, 74, 0.22), 0 0 16px rgba(255, 216, 74, 0.6); }
.hx.pad-focus .hx-f { outline: 2.5px solid #ffd84a; outline-offset: 4px; }

/* notable: a framed square */
.hx.notable { --box: calc(var(--u) * 1.18 + 8px); border-radius: 8px; }
.hx.notable .hx-f { width: calc(var(--u) * 1.18); height: calc(var(--u) * 1.18); border-radius: 5px; border-width: 2px; box-shadow: 0 0 0 2.5px #080a16, 0 0 0 4px color-mix(in srgb, var(--c) 55%, #ffd884), inset 0 2px 8px rgba(0, 0, 0, 0.6); }
.hx.notable .hx-f .ci { width: 60%; height: 60%; }
.hx.notable.owned .hx-f { box-shadow: 0 0 0 2.5px #080a16, 0 0 0 4px #ffe7a0, 0 0 16px var(--c); }
.hx.notable.gated .hx-f { box-shadow: 0 0 0 2.5px #080a16, 0 0 0 4px #2c3250; }
.hx.notable::before { border-radius: 12px; }
.hx.notable.sel .hx-f, .hx.notable:focus-visible .hx-f { outline-offset: 7px; }
/* a mutation side: a diamond, its weapon's badge under it */
.hx.mut { --box: calc(var(--u) * 1.24); border-radius: 6px; }
.hx.mut .hx-f { width: calc(var(--u) * 0.86); height: calc(var(--u) * 0.86); border-radius: 5px; rotate: 45deg; border-width: 2px; box-shadow: 0 0 0 2px #080a16, 0 0 0 3.2px color-mix(in srgb, var(--c) 40%, #c07bff), inset 0 2px 6px rgba(0, 0, 0, 0.6); }
.hx.mut .hx-f .ci { rotate: -45deg; width: 74%; height: 74%; }
.hx.mut.spare .hx-f { color: #fff; background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--c) 55%, #3a2a5a), #0d0a1e 80%); border-color: color-mix(in srgb, var(--c) 60%, #c07bff); }
.hx.mut.active .hx-f { box-shadow: 0 0 0 2px #080a16, 0 0 0 3.5px #e7d4ff, 0 0 16px var(--c), 0 0 22px rgba(192, 123, 255, 0.55); }
.hx.mut.active::before { opacity: 0.8; background: radial-gradient(circle, rgba(192, 123, 255, 0.5) 25%, transparent 68%); }
.hx.mut.sel .hx-f, .hx.mut:focus-visible .hx-f { outline-offset: 4px; }
.hx-w { position: absolute; left: 50%; top: 50%; width: 15px; height: 15px; margin: calc(var(--u) * 0.62 - 6px) 0 0 -7.5px; display: grid; place-items: center; border-radius: 50%; background: #090c1c; border: 1px solid rgba(255, 255, 255, 0.22); pointer-events: none; }
.hx-w svg { width: 11px; height: 11px; }
.hx.gated .hx-w { opacity: 0.45; filter: grayscale(1); }
.ch-pair.mutation1, .ch-pair.mutation2 { gap: 0; }
/* the capstone: a big emblem, spiked crest behind, a glow ring; WORN shows a crown */
.hx.cap { --box: calc(var(--u) * 1.5 + 16px); }
.hx.cap .hx-f { width: calc(var(--u) * 1.5); height: calc(var(--u) * 1.5); border-width: 3px; border-color: color-mix(in srgb, var(--c) 55%, #ffd884); box-shadow: 0 0 0 2px #070912, 0 0 0 3.5px rgba(255, 216, 132, 0.35), inset 0 3px 10px rgba(0, 0, 0, 0.7); }
.hx.cap .hx-f .ci { width: 56%; height: 56%; }
.hx-o { position: absolute; left: 50%; top: 50%; width: calc(var(--u) * 1.5 + 14px); height: calc(var(--u) * 1.5 + 14px); margin: calc((var(--u) * 1.5 + 14px) / -2) 0 0 calc((var(--u) * 1.5 + 14px) / -2); pointer-events: none; opacity: 0.55;
  clip-path: polygon(50% 0%, 56% 12%, 69% 4%, 70% 18%, 85% 15%, 81% 29%, 96% 31%, 87% 43%, 100% 50%, 87% 57%, 96% 69%, 81% 71%, 85% 85%, 70% 82%, 69% 96%, 56% 88%, 50% 100%, 44% 88%, 31% 96%, 30% 82%, 15% 85%, 19% 71%, 4% 69%, 13% 57%, 0% 50%, 13% 43%, 4% 31%, 19% 29%, 15% 15%, 30% 18%, 31% 4%, 44% 12%);
  background: conic-gradient(from 0deg, color-mix(in srgb, var(--c) 60%, #ffd884), #5a4416, color-mix(in srgb, var(--c) 60%, #ffd884), #5a4416, color-mix(in srgb, var(--c) 60%, #ffd884)); }
.hx.cap::before { width: calc(var(--u) * 1.5 + 30px); height: calc(var(--u) * 1.5 + 30px); margin: calc((var(--u) * 1.5 + 30px) / -2) 0 0 calc((var(--u) * 1.5 + 30px) / -2); background: radial-gradient(circle, transparent 46%, color-mix(in srgb, var(--c) 60%, #ffd884) 52%, transparent 70%); }
.hx.cap.owned .hx-o { opacity: 0.9; }
.hx.cap.owned .hx-f { border-color: #ffe7a0; }
.hx.cap.worn::before { opacity: 1; background: conic-gradient(from 0deg, transparent 0 8%, #ffd884 14%, transparent 22% 58%, #ffd884 64%, transparent 72%); -webkit-mask: radial-gradient(circle, transparent 54%, #000 56%, #000 66%, transparent 68%); mask: radial-gradient(circle, transparent 54%, #000 56%, #000 66%, transparent 68%); will-change: transform; animation: hxSpin 5s linear infinite; }
@keyframes hxSpin { to { transform: rotate(360deg); } }
.hx.cap.worn .hx-f { box-shadow: 0 0 0 2px #070912, 0 0 0 4px #ffd884, 0 0 22px #ffd884, inset 0 3px 10px rgba(0, 0, 0, 0.4); }
.hx.cap.gated .hx-o { opacity: 0.18; filter: grayscale(1); }
.hx.cap.gated .hx-f { border-color: #333a58; }
.hx.cap.sel .hx-f, .hx.cap:focus-visible .hx-f { outline-offset: 9px; }
.ch-pair.capstone { gap: calc(var(--u) * 0.5); }
/* tags: ON / OWN / WORN / a notable's tick */
.hx-r { position: absolute; z-index: 2; left: calc(50% + var(--u) * 0.18); top: calc(50% - var(--u) / 2 - 8px); display: flex; align-items: center; gap: 2px; font-family: var(--font-display); font-weight: 700; font-size: 8px; line-height: 12px; letter-spacing: 0.06em; padding: 0 4px; border-radius: 5px; background: #0b0f20; border: 1px solid color-mix(in srgb, var(--c) 60%, transparent); color: var(--text); pointer-events: none; white-space: nowrap; }
.hx-r .ci { width: 9px; height: 9px; }
.hx-r.on { background: var(--c); color: #04050c; border-color: transparent; }
.hx.cap .hx-r { left: calc(50% + var(--u) * 0.36); top: calc(50% - var(--u) * 0.75 - 8px); }
.hx.cap .hx-r.on { background: linear-gradient(180deg, #fff3c8, #ffbd2e); color: #2a1800; box-shadow: 0 0 10px rgba(255, 216, 132, 0.8); }
.hx-r.ok { padding: 0 2px; background: var(--c); color: #04050c; border-color: transparent; }
.hx-r.soon { font-size: 7px; color: #b8c0dc; border-color: rgba(255, 255, 255, 0.25); }
/* the name: only on hover, focus or selection */
.hx-n { position: absolute; z-index: 20; left: 50%; bottom: calc(100% + 2px); top: auto; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 3px 8px 4px; border-radius: 8px; white-space: nowrap; pointer-events: none;
  background: rgba(5, 7, 16, 0.95); border: 1px solid color-mix(in srgb, var(--c) 55%, transparent); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6); opacity: 0; visibility: hidden; transition: opacity 120ms; }
/* the name is the label's own text; what it is now (rank, price) comes from data-sub; a capstone's drawback last, in red */
.hx-n { font-family: var(--font-display); font-weight: 700; font-size: 10.5px; letter-spacing: 0.04em; color: #fff; }
.hx-n::before { content: attr(data-sub); order: 1; font-family: var(--font-mono); font-weight: 400; font-size: 9px; letter-spacing: 0; color: color-mix(in srgb, var(--c) 70%, #fff); }
.hx-dw { order: 2; font-family: var(--font-display); font-weight: 700; font-size: 8.5px; letter-spacing: 0.06em; color: #ff6b81; }
.hx:hover .hx-n, .hx:focus-visible .hx-n, .hx.sel .hx-n { opacity: 1; visibility: visible; }
.hx.edge-l .hx-n { left: 0; transform: none; align-items: flex-start; }
.hx.edge-r .hx-n { left: auto; right: 0; transform: none; align-items: flex-end; }
.ch-tier[data-tier="6"] .hx-n, .ch-tier[data-tier="5"] .hx-n { bottom: auto; top: calc(100% + 2px); }
/* a purchase: the node fills (pop), its new pip draws on, sparks fly */
.hx.fresh .hx-f { animation: hxFill 620ms 240ms cubic-bezier(0.2, 1.4, 0.4, 1) both; }
@keyframes hxFill { 0% { scale: 0.82; filter: brightness(2.2) saturate(0.4); } 45% { scale: 1.22; filter: brightness(1.6); } 100% { scale: 1.1; filter: none; } }
.hx-pips .pip.new { stroke-dasharray: 1 1; stroke-dashoffset: 1; animation: chDraw 420ms 300ms ease-out forwards; }
.hx.pop .hx-f { animation: hxFill 520ms cubic-bezier(0.2, 1.4, 0.4, 1); }
.ch-burst { position: absolute; z-index: 15; width: 0; height: 0; pointer-events: none; }
.ch-burst i { position: absolute; left: -2.5px; top: -2.5px; width: 5px; height: 5px; border-radius: 50%; background: color-mix(in srgb, var(--c) 50%, #fff); box-shadow: 0 0 6px var(--c); opacity: 0; transform: rotate(var(--a)) translateY(0) scale(var(--s)); animation: chSpark 720ms 300ms cubic-bezier(0.1, 0.8, 0.3, 1) forwards; }
@keyframes chSpark { 0% { opacity: 1; transform: rotate(var(--a)) translateY(-6px) scale(var(--s)); } 100% { opacity: 0; transform: rotate(var(--a)) translateY(calc(var(--d) * -1)) scale(0.2); } }
.ch-burst.big i { animation-duration: 900ms; }
.ch-burst .ring { position: absolute; left: -20px; top: -20px; width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--c); opacity: 0; animation: chRing 600ms 260ms ease-out forwards; }
@keyframes chRing { 0% { opacity: 0.9; transform: scale(0.5); } 100% { opacity: 0; transform: scale(1.9); } }
.ch-burst .flash { position: absolute; left: -16px; top: -16px; width: 32px; height: 32px; border-radius: 50%; background: radial-gradient(circle, #fff, transparent 70%); opacity: 0; animation: chFlash 380ms 250ms ease-out forwards; }
@keyframes chFlash { 0% { opacity: calc(0.9 * var(--flash, 1)); transform: scale(0.6); } 100% { opacity: 0; transform: scale(1.6); } }
.ch-ghost { position: absolute; z-index: 14; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; border: 2px solid var(--c); box-shadow: 0 0 12px var(--c); pointer-events: none; opacity: 0; animation: chGhost 700ms ease-in forwards; }
@keyframes chGhost { 0% { opacity: 0.9; transform: scale(1); } 100% { opacity: 0; transform: scale(0.4); } }
.hx-float { position: absolute; left: 50%; top: -8px; z-index: 25; transform: translateX(-50%); font-family: var(--font-display); font-weight: 700; font-size: 12px; white-space: nowrap; color: #ffd84a; text-shadow: 0 2px 6px #000; pointer-events: none; animation: hxFloat 1.1s var(--ease) forwards; }
.hx-float.bad { color: #ff8a8a; font-size: 10px; }
@keyframes hxFloat { from { opacity: 1; transform: translate(-50%, 0); } to { opacity: 0; transform: translate(-50%, -30px); } }

/* ---- the detail panel ---- */
.ch-panel { position: relative; min-height: 0; overflow-y: auto; border-radius: 14px; background: linear-gradient(180deg, rgba(14, 17, 36, 0.92), rgba(4, 6, 14, 0.94)); border: 1px solid var(--border-soft); scrollbar-width: thin; }
.ch-sheet-h { display: none; }
.cp-body { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.cp-head { display: grid; grid-template-columns: 50px 1fr; gap: 10px; align-items: center; }
.cp-ic { display: grid; place-items: center; width: 44px; height: 44px; margin: 3px; border-radius: 50%; color: #fff; border: 2px solid var(--c); background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--c) 60%, #1c2446), #070a18 85%); box-shadow: 0 0 14px color-mix(in srgb, var(--c) 45%, transparent); }
.cp-ic .ci { width: 26px; height: 26px; }
.cp-ic.notable { border-radius: 7px; box-shadow: 0 0 0 2px #080a16, 0 0 0 3.5px #ffd884, 0 0 14px color-mix(in srgb, var(--c) 45%, transparent); }
.cp-ic.mut { width: 34px; height: 34px; margin: 8px; border-radius: 6px; rotate: 45deg; }
.cp-ic.mut .ci { rotate: -45deg; width: 24px; height: 24px; }
.cp-ic.cap { border-color: #ffd884; box-shadow: 0 0 0 2px #080a16, 0 0 0 3.5px rgba(255, 216, 132, 0.5), 0 0 18px rgba(255, 216, 132, 0.5); }
.cp-head.locked .cp-ic { --c: #6a7290; color: #8a93b0; box-shadow: none; }
.cp-head small { display: block; font-family: var(--font-display); font-weight: 700; font-size: 9px; letter-spacing: 0.16em; color: var(--c); }
.cp-head b { display: block; font-family: var(--font-display); font-size: 19px; line-height: 1.1; }
.cp-pips { display: none; gap: 3px; margin-top: 3px; }
.cp-pips i { width: 14px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.14); }
.cp-pips i.on { background: var(--c); box-shadow: 0 0 6px var(--c); }
.cp-desc { margin: 0; font-size: 12px; color: var(--dim); line-height: 1.4; }
.cp-rank { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 13px; }
.cp-rank span { color: var(--dim); font-size: 10px; letter-spacing: 0.16em; font-weight: 700; }
.cp-rank b i { font-style: normal; margin: 0 4px; color: var(--lime); }
.cp-rank b small { font-size: 10px; color: var(--dim); }
.cp-rank .pips { margin: 0 0 0 auto; display: flex; gap: 4px; }
.cp-rank .pips i { width: 16px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); }
.cp-rank .pips i.on { background: var(--lime); box-shadow: 0 0 6px rgba(60, 245, 167, 0.6); }
.cp-rank .pips i.next { background: rgba(60, 245, 167, 0.28); box-shadow: inset 0 0 0 1px rgba(60, 245, 167, 0.6); }
.cp-eff { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cp-eff > div { padding: 7px 8px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.07); }
.cp-eff > div + div { border-color: color-mix(in srgb, var(--lime) 35%, transparent); }
.cp-eff > div.dim { opacity: 0.5; }
.cp-eff small { display: block; font-family: var(--font-display); font-weight: 700; font-size: 9px; letter-spacing: 0.16em; color: var(--dim); }
.cp-eff b { font-family: var(--font-display); font-size: 12.5px; line-height: 1.25; }
.cp-eff > div + div b { color: var(--lime); }
.cp-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-family: var(--font-display); font-size: 12px; }
.cp-meta span { display: flex; align-items: center; gap: 4px; color: var(--dim); font-size: 10px; letter-spacing: 0.12em; font-weight: 700; }
.cp-meta span .ci { width: 11px; height: 11px; }
.cp-meta b { text-align: right; color: #ffd84a; }
.cp-meta b.short { color: #ff8a8a; }
.cp-needs b { color: #c8cee6; }
.cp-meta.big { padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, 0.1); font-size: 16px; }
.cp-buy { width: 100%; min-height: 44px; padding: 10px 8px; font-size: 13px; white-space: nowrap; }
.cp-buy.danger { background: linear-gradient(180deg, #ffa24a, #e0661c); color: #1c0a00; box-shadow: 0 6px 24px rgba(255, 138, 43, 0.35); }
.cp-refund { width: 100%; padding: 8px; font-size: 12px; }
.cp-why { margin: -2px 0 0; font-family: var(--font-display); font-weight: 700; font-size: 10px; letter-spacing: 0.08em; color: #ff9a9a; text-align: center; }
.cp-free { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 11px; letter-spacing: 0.1em; color: var(--lime); }
.cp-note { margin: 0; font-size: 11px; color: var(--faint); line-height: 1.4; }
.cp-soon { align-self: flex-start; font-family: var(--font-display); font-weight: 700; font-size: 10px; letter-spacing: 0.24em; padding: 3px 10px; border-radius: 999px; background: rgba(192, 123, 255, 0.16); color: #d7b8ff; border: 1px solid rgba(192, 123, 255, 0.45); }
.cp-choices { display: grid; gap: 6px; }
.cp-choice { padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.035); border: 1px dashed rgba(255, 255, 255, 0.14); }
.cp-choice.on { border-style: solid; border-color: var(--c); background: color-mix(in srgb, var(--c) 8%, transparent); }
.cp-choice.inuse { border-style: solid; border-color: var(--c); box-shadow: inset 0 0 18px color-mix(in srgb, var(--c) 18%, transparent); }
.cp-choice small { display: flex; align-items: center; gap: 4px; font-family: var(--font-display); font-weight: 700; font-size: 9px; letter-spacing: 0.12em; color: var(--dim); }
.cp-choice small svg { width: 14px; height: 14px; flex: none; }
.cp-choice small em { font-style: normal; color: var(--lime); }
.cp-choice.cap small .ci { color: #ffd884; }
.cp-choice b { display: flex; align-items: center; gap: 6px; font-family: var(--font-display); font-size: 14px; }
.cp-mi { width: 18px !important; height: 18px !important; flex: none; color: var(--c); }
.cp-dws { display: none; }
.cp-choice p { margin: 2px 0 0; font-size: 11.5px; color: var(--dim); line-height: 1.35; }
.cp-choice p.cp-draw { color: #ff9a9a; }
.cp-choice.cap .cp-draw { font-family: var(--font-display); font-weight: 700; font-size: 11px; letter-spacing: 0.02em; color: #ff6b81; }
.cp-prev { display: block; width: 100%; max-width: 232px; height: auto; aspect-ratio: 232 / 84; margin: 4px 0 2px; border-radius: 8px; background: radial-gradient(120% 120% at 50% 100%, rgba(40, 52, 96, 0.55), rgba(6, 8, 18, 0.8)); border: 1px solid rgba(255, 255, 255, 0.08); }
.cp-mbtn { width: 100%; min-height: 40px; margin-top: 6px; padding: 7px 8px; font-size: 12px; white-space: nowrap; }
.cp-tot { margin-top: 4px; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.cp-tot h4 { margin: 0 0 4px; font-family: var(--font-display); font-size: 11px; letter-spacing: 0.22em; color: var(--amber); }
.cp-tot h5 { margin: 6px 0 2px; font-family: var(--font-display); font-size: 9px; letter-spacing: 0.2em; color: var(--faint); }
.cp-tot div { display: flex; justify-content: space-between; gap: 6px; font-size: 11px; padding: 1px 0; }
.cp-tot div span { display: flex; align-items: center; gap: 5px; color: var(--dim); }
.cp-tot div span .ci { width: 12px; height: 12px; color: var(--faint); }
.cp-tot div b { font-family: var(--font-mono); font-size: 11px; color: var(--lime); }
body.touch .chain kbd { display: none !important; }   /* no keyboard on a phone */
.ch-foot { margin: 0; font-size: 10.5px; color: var(--faint); text-align: center; line-height: 1.35; }

/* ---- one branch at a time (narrow or short screens): pages you swipe, tabs to jump; the panel beside it ---- */
@media (max-width: 1099px), (max-height: 520px) {
  .ch-tabs { display: flex; }
  .ch-lanes { display: flex; align-items: flex-start; gap: 0; padding: 0; overflow-x: auto; overflow-y: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; --u: clamp(40px, calc(100cqw / 9.5), 50px); }
  .ch-lanes::-webkit-scrollbar { display: none; }
  .ch-ruler { display: none; }
  .ch-lane { flex: 0 0 100%; width: 100%; min-height: 100%; scroll-snap-align: start; scroll-snap-stop: always; border-radius: 14px; }
  .ch-lane > .ch-lh, .ch-lane > .ch-field { width: min(100%, 540px); margin: 0 auto; }
  .ch-tl { display: flex; }
  .ch-or { display: block; margin: 0 1px; }
  .ch-field > .ch-tiers { grid-template-rows: repeat(6, minmax(calc(var(--u) * 1.8 + 6px), 1fr)); }
  .hx { min-width: 44px; min-height: 44px; }
  .hx-n { font-size: 11.5px; }
  .ch-gate { font-size: 10px; }
  .ch-tab kbd { display: inline; margin-left: 2px; }
  body.touch .ch-swipe { display: flex; }
}
@media (max-width: 1099px) and (min-width: 641px) and (min-height: 521px) {
  .ch-main { grid-template-columns: minmax(0, 1fr) 270px; }
}
@media (max-width: 760px) {
  .ch-top { grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) auto auto; }
  .ch-title b { font-size: 22px; }
  .ch-ranks { display: none; }
  .ch-power span { display: none; }
  .ch-tab b { display: none; }
  .ch-tab { justify-content: center; flex-direction: column; gap: 2px; padding: 5px 4px; }
  .ch-tab small { margin: 0; }
  .ch-tab kbd { display: none; }
  .ch-foot { display: none; }
}

/* ---- phones: the panel is a bottom sheet (peeking: the name and the main button; open: all of it) ---- */
@media (max-width: 640px), (max-height: 520px) {
  .chain { --peek: 150px; }
  .ch-main { grid-template-columns: minmax(0, 1fr); }
  .ch-lanes { padding-bottom: var(--peek); scroll-padding-bottom: var(--peek); }
  .ch-panel { position: absolute; z-index: 40; left: 0; right: 0; bottom: 0; max-height: var(--peek); overflow: hidden; border-radius: 18px 18px 12px 12px; border-color: rgba(255, 255, 255, 0.16);
    background: linear-gradient(180deg, rgba(18, 22, 46, 0.98), rgba(6, 8, 18, 0.99)); box-shadow: 0 -12px 34px rgba(0, 0, 0, 0.7); transition: max-height 280ms var(--ease); }
  .chain.sheet-open .ch-panel { max-height: 80%; overflow-y: auto; }
  .ch-sheet-h { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; padding: 0; border: 0; border-radius: 0; background: none; color: var(--dim); font-size: 10px; letter-spacing: 0.22em; position: sticky; top: 0; z-index: 2; background: linear-gradient(180deg, rgba(18, 22, 46, 1) 60%, rgba(18, 22, 46, 0)); }
  .ch-sheet-h i { width: 38px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.35); }
  .ch-sheet-h:hover { background: linear-gradient(180deg, rgba(18, 22, 46, 1) 60%, rgba(18, 22, 46, 0)); }
  .cp-body { padding: 0 14px 12px; gap: 8px; }
  .cp-pips { display: flex; }
  .chain:not(.sheet-open) .cp-body > :not(.cp-head):not(.cp-buy):not(.cp-choices) { display: none; }
  .chain:not(.sheet-open) .cp-choice:not(.on) { display: none; }
  .chain:not(.sheet-open) .cp-choice.on { padding: 0; border: 0; background: none; box-shadow: none; display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 8px; }
  .chain:not(.sheet-open) .cp-choice.on > :not(.cp-mbtn):not(.cp-dws) { display: none; }
  .chain:not(.sheet-open) .cp-choice.on .cp-dws { display: block; font-family: var(--font-display); font-weight: 700; font-size: 10px; letter-spacing: 0.1em; color: #ff6b81; }
  .chain:not(.sheet-open) .cp-choice.on .cp-mbtn { margin: 0; grid-column: 1 / -1; }
  .chain:not(.sheet-open) .cp-choice.cap.on .cp-dws:not(:empty) ~ .cp-mbtn { grid-column: 2; }
  .cp-head b { font-size: 17px; }
  .cp-eff b { font-size: 12px; }
  .ch-foot { display: none; }
}
/* a phone upright: tabs, the swipe hint, the branch, the sheet */
@media (max-width: 640px) and (min-height: 521px) {
  .modal-box.chainbox { padding: 10px 10px 0; border-radius: 18px 18px 0 0; }
  .ch-top { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: 'bank power back' 'bank power respec'; gap: 6px; }
  .ch-title, .ch-ranks { display: none; }
  .ch-bank { grid-area: bank; min-width: 0; padding: 4px 8px; } .ch-power { grid-area: power; padding: 4px 10px; } .ch-back { grid-area: back; padding: 5px 12px; min-height: 40px; } .ch-respec { grid-area: respec; padding: 3px 10px; min-height: 40px; }
  .ch-bank b { font-size: 27px; } .ch-bank.long b { font-size: 20px; } .ch-bank small { letter-spacing: 0.14em; white-space: nowrap; }
  .ch-power b { font-size: 18px; }
  .ch-power .ch-pbar { width: 56px; }
  .ch-respec small { display: none; }
  .ch-swipe { display: flex; padding: 1px 0; }
  .ch-lane > .ch-lh { padding-top: 6px; }
}
/* a phone held sideways: a rail of branch tabs on the left, a one-row sheet */
@media (max-height: 520px) {
  .screen:has(> .modal-box.chainbox) { padding: calc(6px + var(--safe-t)) calc(8px + var(--safe-r)) calc(4px + var(--safe-b)) calc(8px + var(--safe-l)); }
  .modal-box.chainbox { height: calc(100vh - 10px - var(--safe-t) - var(--safe-b)); height: calc(100dvh - 10px - var(--safe-t) - var(--safe-b)); padding: 6px 8px 0; border-radius: 14px 14px 0 0; }
  .chain { --peek: 66px; --lh: 0px; --rootpad: 26px; display: grid; grid-template-columns: 92px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 6px; }
  .ch-top { grid-column: 1 / -1; gap: 6px; grid-template-columns: auto auto minmax(0, 1fr) auto auto; }
  .ch-ranks { display: none; }
  .ch-title b { font-size: 18px; } .ch-title small { font-size: 7.5px; letter-spacing: 0.24em; }
  .ch-stat { padding: 2px 10px; }
  .ch-bank { min-width: 0; padding: 1px 14px 2px; } .ch-bank b { font-size: 21px; } .ch-bank.long b { font-size: 18px; } .ch-bank small { font-size: 7px; }
  .ch-stat b { font-size: 15px; } .ch-stat small { font-size: 7.5px; }
  .ch-power span { display: none; }
  .ch-respec, .ch-back { padding: 3px 12px; font-size: 12px; min-height: 40px; }
  .ch-respec small { display: none; }
  .ch-tabs { flex-direction: column; gap: 4px; min-height: 0; margin-bottom: calc(var(--peek) - 4px); overflow-y: auto; scrollbar-width: none; }
  .ch-tab { flex: 1 0 44px; flex-direction: row; justify-content: flex-start; gap: 5px; padding: 3px 6px; }
  .ch-tab b { display: none; }
  .ch-tab small { margin-left: auto; }
  .ch-main { min-height: 0; }
  .ch-lanes { --u: 40px; }
  .ch-lane > .ch-lh { display: none; }
  .ch-field > .ch-tiers { grid-template-rows: repeat(6, minmax(58px, 1fr)); }
  /* sideways there is no row to spare: the swipe hint takes the title's kicker line, so it never covers a node */
  .ch-swipe, body.touch .ch-swipe { display: none; }
  .ch-kick { display: none; }
  .ch-kswipe { display: block !important; color: #e9d9b0 !important; letter-spacing: 0.14em !important; white-space: nowrap; }
  .chain:not(.sheet-open) .ch-panel { display: grid; grid-template-columns: minmax(0, 1fr) 54px; align-items: center; }
  .chain:not(.sheet-open) .ch-sheet-h { grid-column: 2; grid-row: 1; position: static; background: none; min-height: 44px; width: 44px; }
  .chain:not(.sheet-open) .ch-sheet-h span { display: none; }
  .chain:not(.sheet-open) .ch-sheet-h i { width: 12px; height: 12px; border-radius: 0; background: none; border-left: 2.5px solid var(--dim); border-top: 2.5px solid var(--dim); rotate: 45deg; margin-top: 6px; }
  .chain:not(.sheet-open) .cp-body { grid-column: 1; grid-row: 1; flex-direction: row; align-items: center; padding: 8px 0 8px 12px; gap: 12px; }
  .chain:not(.sheet-open) .cp-head { flex: 1; min-width: 0; grid-template-columns: 46px 1fr; }
  .chain:not(.sheet-open) .cp-head b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .chain:not(.sheet-open) .cp-buy, .chain:not(.sheet-open) .cp-choices { width: min(46%, 300px); flex: none; }
  .cp-prev { max-width: 180px; }
}
@media (prefers-reduced-motion: reduce) {
  .ch-wires .pulse, .hx.avail::before, .hx.cap.worn::before, .hx-pips .pip.new, .ch-wires .fresh, .ch-wires .drain, .ch-burst, .ch-ghost { animation: none !important; }
  .ch-wires .pulse { display: none; }
  .hx.avail::before { opacity: 0.7; transform: none; }
  .ch-panel { transition: none; }
}
.chain.calm .ch-wires .pulse { display: none; }
.chain.calm .hx.avail::before { animation: none; opacity: 0.7; }
.chain.calm .hx.cap.worn::before { animation: none; }
.chain.calm .hx.fresh .hx-f { animation: none; box-shadow: 0 0 0 3px #fff, 0 0 18px var(--c); }
.chain.calm .hx.fresh::before { opacity: 1; }

/* ---------------- the title stage (js/titlestage.js): the selected operator live on a fan, 3D portraits on the cards ---------------- */
.char-hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-bottom: 12px; }
#title.staged .char-hero { grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); align-items: stretch; }
#title.staged #char-detail { margin-top: 0; display: flex; flex-direction: column; justify-content: center; }
#char-stage { position: relative; height: 300px; border-radius: 14px; overflow: hidden; border: 1px solid rgba(34, 228, 255, 0.28); box-shadow: inset 0 0 40px rgba(34, 228, 255, 0.08), 0 10px 30px rgba(0, 0, 0, 0.35);
  background: radial-gradient(ellipse at 50% 58%, #16264a 0%, #0b1226 55%, #04060f 100%); }
#char-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 260ms ease; }
/* drag the operator round (js/spinfling.js): a sideways drag is ours, the page still scrolls up and down from here */
#char-stage.live { touch-action: pan-y; cursor: grab; }
#char-stage.live.grabbing { cursor: grabbing; }
.spin-whoa { position: absolute; z-index: 3; transform: translate(-50%, -100%); pointer-events: none; font: 900 clamp(16px, 2.4vw, 26px) var(--font-display, sans-serif); letter-spacing: 0.06em; color: #ffd84a; text-shadow: 0 2px 0 #7a3a00, 0 0 14px rgba(255, 190, 40, 0.55); white-space: nowrap; }
.spin-whoa[hidden] { display: none; }
#spin-layer { position: fixed; inset: 0; z-index: 60; pointer-events: none; overflow: hidden; }
#char-stage .spin-whoa { font-size: 17px; }
.spin-whoa.pop { animation: spin-whoa 1.4s ease-out both; }
.spin-whoa.pop.calm { animation: spin-whoa-calm 1.4s ease-out both; }
@keyframes spin-whoa { 0% { opacity: 0; transform: translate(-50%, -60%) scale(0.4) rotate(-8deg); } 14% { opacity: 1; transform: translate(-50%, -100%) scale(1.15) rotate(4deg); } 26% { transform: translate(-50%, -100%) scale(1) rotate(-2deg); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -150%) scale(1); } }
@keyframes spin-whoa-calm { 0% { opacity: 0; transform: translate(-50%, -100%); } 15% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -100%); } }
@media (prefers-reduced-motion: reduce) { .spin-whoa.pop { animation-name: spin-whoa-calm; } }
#char-stage.live canvas { opacity: 1; }
#char-stage .stage-fallback { position: absolute; inset: 0; display: grid; place-items: center; transition: opacity 260ms ease; }
#char-stage .stage-fallback img { height: 74%; width: auto; object-fit: contain; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.6)); }
#char-stage .stage-fallback .dot { width: 34%; height: 62%; border-radius: 22px; opacity: 0.85; }
#char-stage.live .stage-fallback { opacity: 0; }
.char .av canvas.portrait { width: 100%; height: 100%; border-radius: 10px; display: block; }
.char.has-portrait .av { width: 54px; height: 64px; }
@media (max-width: 820px) {
  #title.staged .char-hero { grid-template-columns: minmax(0, 1fr); }
  #char-stage { height: 250px; }
  .char.has-portrait .av { width: 40px; height: 48px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  #title.staged .char-hero { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); }
  #char-stage { height: 210px; }
}
/* ---------------- THE CHAIN's mutations in a run: the HUD's weapon mark, the level-up card ---------------- */
.slot.mut { border-color: #c07bff; box-shadow: 0 0 10px rgba(192, 123, 255, 0.55); }
.slot.mut.evo { box-shadow: 0 0 12px rgba(255, 189, 46, 0.6), 0 0 0 2px rgba(192, 123, 255, 0.7); }
.slot .mm { position: absolute; left: -4px; top: -4px; width: 13px; height: 12px; clip-path: polygon(25% 2%, 75% 2%, 100% 50%, 75% 98%, 25% 98%, 0 50%); background: linear-gradient(180deg, #f0d8ff, #9b5cff); box-shadow: 0 0 6px #c07bff; }
.card .mutl { margin-top: 6px; font-size: 11px; font-weight: 800; letter-spacing: 0.08em; color: #d7b8ff; text-shadow: 0 0 8px rgba(192, 123, 255, 0.7); }
.cp-off { margin-top: 8px; }
.cp-off .cp-mbtn { margin-top: 0; opacity: 0.9; }
/* ---------------- THE CHAIN's capstones in a run: the HUD slot ---------------- */
.slot.cap { border-color: #ffd884; box-shadow: 0 0 10px rgba(255, 216, 132, 0.5); overflow: hidden; }
.slot.cap .cb { position: absolute; left: 0; bottom: 0; height: 3px; width: 0; background: #ffd884; box-shadow: 0 0 6px #ffd884; }
.slot.cap.bad { border-color: #ff4d6d; box-shadow: 0 0 12px rgba(255, 77, 109, 0.7); }
.slot.cap.bad .cb { background: #ff4d6d; box-shadow: 0 0 6px #ff4d6d; }
