/* BANKSHOT shell UI (phase 2). House rules: playbook references/menu-ui.md, mobile-ui.md. */
@font-face { font-family: 'Press Start 2P'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(../../assets/fonts/pressstart2p-latin.woff2) format('woff2'); }
/* Rubik (OFL) for body / explanatory text; the pixel font is for titles, buttons, key caps and short labels */
@font-face { font-family: 'Rubik'; font-style: normal; font-weight: 300 800; font-display: swap; src: url(../../assets/fonts/rubik-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Rubik'; font-style: normal; font-weight: 300 800; font-display: swap; src: url(../../assets/fonts/rubik-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --bg: #120d16; --ink: #f4ecdf; --dim: #b3a7bd; --lilac: #d9c8ef; --gold: #ffd34a; --gold2: #c9951c; --red: #e0453a;
  --card: rgba(22, 16, 26, .88); --px: 'Press Start 2P', ui-monospace, Menlo, monospace;
  --body: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --emoji: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); overflow: hidden;
  font-family: var(--px); -webkit-user-select: none; user-select: none; touch-action: none; -webkit-tap-highlight-color: transparent; }
button { font-family: var(--px); color: var(--ink); cursor: pointer; }
.hidden { display: none !important; }
.sr { position: fixed; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; pointer-events: none; }
.dim { color: var(--dim); }

#stage { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
#game { image-rendering: crisp-edges; image-rendering: pixelated; background: #000; display: block; }
body.playing #game.aim-mouse { cursor: none; }
#touchRoot { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
body:not(.playing) #touchRoot { display: none; }
#vign { position: fixed; inset: 0; pointer-events: none; z-index: 2;
  background: radial-gradient(ellipse at center, rgba(8,5,10,.32) 0%, rgba(8,5,10,.5) 55%, rgba(8,5,10,.74) 100%); }
body.playing #vign { display: none; }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(6px, 1.6vh, 14px); padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
.screen.layer { z-index: 14; background: rgba(12,8,14,.95); }
#setup { background: rgba(12,8,14,.55); }
.dimBg { background: rgba(10, 7, 12, .72); }
.inner { justify-content: flex-start; }
h2 { margin: 0; font-size: clamp(13px, 2.2vw, 20px); font-weight: normal; color: var(--gold); text-shadow: 3px 3px 0 #000; letter-spacing: 1px; text-align: center; }
.panel { background: var(--card); border: 3px solid #000; box-shadow: 0 6px 0 #000; padding: 16px 18px; display: flex; flex-direction: column; align-items: center; gap: 10px; border-radius: 6px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; align-items: center; }

/* ---------- buttons ---------- */
.btnY { font-size: 15px; background: var(--gold); color: #241806; border: 3px solid #000; border-radius: 6px;
  box-shadow: 0 6px 0 var(--gold2), 0 9px 0 #000; padding: 12px 22px; min-height: 48px; transition: transform .08s, box-shadow .08s, filter .08s; text-shadow: none; }
.btnY.big { font-size: clamp(16px, 2.4vw, 24px); padding: 14px 26px; }
.btnS { font-size: 10px; background: #2a2131; border: 3px solid #000; border-radius: 5px; box-shadow: 0 4px 0 #000; padding: 9px 10px; min-height: 40px; transition: transform .08s, box-shadow .08s; }
.btnS.wide { min-width: 220px; }
.btnS.on { border-color: var(--gold); color: var(--gold); background: #3d2f22; }
.btnY:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--gold2), 0 4px 0 #000; }
.btnS:active { transform: translateY(3px); box-shadow: 0 1px 0 #000; }
@media (hover: hover) {
  .btnY:hover { transform: translateY(-3px); box-shadow: 0 9px 0 var(--gold2), 0 12px 0 #000, 0 0 22px rgba(255,211,74,.55); filter: brightness(1.07); }
  .btnS:hover, .mcard:not(.off):hover { border-color: var(--gold); color: var(--gold); transform: translateY(-2px); box-shadow: 0 6px 0 #000, 0 0 14px rgba(217,200,239,.35); }
}
.armed, .btnS.armed, .back.armed { background: var(--red) !important; color: #fff !important; border-color: #000 !important; box-shadow: 0 4px 0 #7a1d16, 0 6px 0 #000 !important; animation: armPulse .9s infinite alternate; }
@keyframes armPulse { to { filter: brightness(1.3); } }
:focus { outline: none; }
:focus-visible, .kbnav [data-nav]:focus { outline: 3px solid var(--gold); outline-offset: 3px; }
.link { background: none; border: 0; color: var(--gold); font-size: 10px; padding: 6px 0; text-decoration: underline; text-underline-offset: 4px; min-height: 28px; text-align: left; }
.back { width: 44px; height: 40px; font-size: 22px; line-height: 1; background: #2a2131; border: 3px solid #000; border-radius: 5px; box-shadow: 0 4px 0 #000; padding: 0; }
.back.armed { width: auto; padding: 0 10px; font-size: 10px; }

/* ---------- corner: fullscreen / speaker / pause ---------- */
#corner { position: fixed; z-index: 30; top: max(6px, env(safe-area-inset-top)); right: max(6px, env(safe-area-inset-right)); display: flex; gap: 6px; }
.icoBtn { width: 42px; height: 40px; padding: 0; background: rgba(24,17,28,.86); border: 3px solid #000; border-radius: 5px; box-shadow: 0 3px 0 #000; display: flex; align-items: center; justify-content: center; }
.icoBtn .ico { font-family: var(--emoji); font-size: 18px; line-height: 1; }
.icoBtn .pz { font-size: 12px; letter-spacing: -2px; }
#sndBtn.muted { border-color: var(--red); }
.pop { position: fixed; z-index: 31; top: calc(max(6px, env(safe-area-inset-top)) + 48px); right: max(6px, env(safe-area-inset-right));
  width: 236px; background: rgba(20,14,24,.97); border: 3px solid #000; box-shadow: 0 6px 0 #000; border-radius: 6px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.sndRow { font-size: 11px; padding: 12px 8px; background: #2a2131; border: 3px solid #000; border-radius: 5px; }
.sndRow.muted { border-color: var(--red); color: #ff8a7a; }
.sndTwo { display: flex; gap: 8px; }
.sndTog { flex: 1; font-size: 10px; padding: 10px 4px; background: #2a2131; border: 3px solid #000; border-radius: 5px; }
.sndTog.off { color: #6d6275; text-decoration: line-through; background: #1b1520; }
.sndVol { display: flex; align-items: center; gap: 8px; font-size: 9px; color: var(--dim); }
.sndVol input { flex: 1; accent-color: var(--gold); }
.sndHint { font-size: 8px; color: var(--dim); text-align: center; }
body.touch .kbOnly { display: none !important; }

/* ---------- home ---------- */
#home { --colW: min(820px, 94vw); }
.logo { position: relative; display: flex; flex-direction: column; align-items: center; line-height: 1; }
.logoTxt { font-size: clamp(30px, 7.4vw, 76px); color: var(--gold); letter-spacing: 2px;
  text-shadow: 0 -3px 0 #fff2b8, 4px 4px 0 #8a2a12, 7px 7px 0 #000, 0 0 30px rgba(255,170,60,.35); }
#logoTrail { width: clamp(90px, 16vw, 180px); height: auto; image-rendering: pixelated; margin-top: 4px; }
.tagline { font-size: clamp(8px, 1vw, 11px); color: var(--lilac); text-shadow: 2px 2px 0 #000; letter-spacing: 1px; }
.playStrip { width: var(--colW); display: flex; align-items: center; gap: 14px; padding: 8px 12px 8px 8px;
  background: rgba(46,36,14,.93); border: 3px solid var(--gold); border-radius: 8px; box-shadow: 0 6px 0 #000; }
@media (min-width: 900px) { .playStrip { width: calc(var(--colW) + 36px); } }
.psPort { width: clamp(76px, 11vw, 124px); height: clamp(76px, 11vw, 124px); flex: none; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 60%, rgba(255,200,80,.42), rgba(255,200,80,0) 68%); }
.psPort canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.psInfo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.lbl { font-size: 8px; color: var(--dim); letter-spacing: 1px; }
.psName { font-size: clamp(11px, 1.5vw, 15px); color: #fff; text-shadow: 2px 2px 0 #000; }
.psLv, .psDaily { font-size: 8px; color: var(--lilac); line-height: 1.4; }
.psDaily.done { color: #8fe36b; }
.lvBar { display: inline-block; width: 70px; height: 6px; background: #000; border: 1px solid #000; vertical-align: middle; margin-left: 6px; }
.lvBar i { display: block; height: 100%; background: var(--gold); }
.mcards { width: var(--colW); display: flex; gap: 10px; }
.mcard { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 9px 10px; text-align: left; background: var(--card);
  border: 3px solid #000; border-radius: 7px; box-shadow: 0 5px 0 #000; transition: transform .08s, box-shadow .08s; }
.mcard .mico { width: clamp(40px, 5vw, 60px); height: clamp(40px, 5vw, 60px); flex: none; image-rendering: pixelated; }
.mcard span { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mcard b { font-weight: normal; font-size: clamp(10px, 1.2vw, 13px); color: var(--gold); text-shadow: 2px 2px 0 #000; }
.mcard small { font-size: 8px; line-height: 1.35; color: #cfc4da; }
.mcard.off { opacity: .55; cursor: default; }
.mcard.off small { color: var(--gold); }
.smallRow { width: var(--colW); display: grid; grid-template-columns: repeat(4, minmax(0, 200px)); justify-content: center; gap: 8px; }
.smallRow .btnS { width: 100%; padding: 8px 4px; }
.setRow { display: flex; flex-wrap: wrap; gap: 8px 14px; justify-content: center; align-items: center; max-width: 94vw; }
.setRow .grp { display: flex; align-items: center; gap: 6px; }
.setRow .grp > span { font-size: 8px; color: var(--dim); }
.setRow .btnS { min-height: 34px; padding: 7px 9px; font-size: 9px; }
#homeSettings { background: rgba(14,10,17,.9); border: 3px solid #000; border-radius: 6px; padding: 8px 10px; }
.keyHint { width: var(--colW); font-size: 8px; color: var(--lilac); text-shadow: 1px 1px 0 #000; line-height: 1.9; text-align: center; max-width: 94vw; }
.kc { display: inline-block; min-width: 18px; padding: 2px 4px 1px; margin: 0 1px; background: var(--gold); color: #1b1206; border: 2px solid #000; border-bottom-width: 4px; border-radius: 3px; font-size: 8px; line-height: 1.2; text-align: center; text-shadow: none; }

/* first-play offer */
.askPanel p { font-size: 9px; line-height: 1.6; margin: 0; text-align: center; max-width: 420px; }

/* ---------- setup ---------- */
.topRow { width: min(1100px, 100%); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; flex: none; }
.topRow .back { justify-self: start; }
.topR { justify-self: end; display: flex; gap: 6px; padding-right: 150px; }
.setupBody { width: min(1100px, 100%); flex: 1; min-height: 0; display: flex; gap: 12px; }
.gridWrap { flex: 1; min-width: 0; overflow-y: auto; padding: 4px 4px 72px; scrollbar-width: thin;
  -webkit-mask-image: linear-gradient(#000 calc(100% - 40px), transparent); mask-image: linear-gradient(#000 calc(100% - 40px), transparent); }
.gsGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(78px, 9vw, 104px), 1fr)); gap: 8px; }
.gs { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px 6px; background: var(--card);
  border: 3px solid #000; border-radius: 6px; box-shadow: 0 4px 0 #000; }
.gs canvas { width: 100%; max-width: 96px; aspect-ratio: 1; image-rendering: pixelated; }
.gs b { font-weight: normal; font-size: 7px; color: #e9dff2; text-align: center; line-height: 1.3; }
.gs.sel { border-color: var(--gold); background: rgba(70,52,16,.95); }
.gs.sel b { color: var(--gold); }
.gs .who { position: absolute; top: 4px; left: 4px; font-size: 8px; padding: 2px 4px; background: var(--gold); color: #000; border: 2px solid #000; }
.gs .who.p2 { left: auto; right: 4px; background: #4fb3e8; }
.gs.lock canvas { filter: brightness(0) opacity(.55); }
.gs.lock .lockLv { position: absolute; top: 36%; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--gold); text-shadow: 2px 2px 0 #000; }
.side { width: clamp(220px, 28vw, 300px); flex: none; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; padding: 8px 8px 70px; align-self: flex-start; max-height: 100%; background: rgba(14,10,17,.82); border: 3px solid #000; border-radius: 6px; }
.chipLbl { font-size: 8px; color: var(--dim); margin-top: 4px; }
.seg { display: flex; flex-wrap: wrap; gap: 5px; }
.seg .btnS { flex: 1 1 auto; min-height: 34px; padding: 7px 6px; font-size: 9px; }
.arenaChip { display: flex; align-items: center; gap: 8px; padding: 6px; background: var(--card); border: 3px solid #000; border-radius: 6px; box-shadow: 0 4px 0 #000; text-align: left; }
.arenaChip canvas { width: 96px; height: 54px; border: 2px solid #000; image-rendering: pixelated; flex: none; }
.arenaChip span { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.arenaChip small { font-size: 8px; color: var(--dim); }
.arenaChip b { font-weight: normal; font-size: 11px; color: var(--gold); }
.arenaChip i { font-style: normal; font-size: 14px; color: var(--gold); }
@media (hover: hover) { .arenaChip:hover, .gs:hover { border-color: var(--gold); } }
.sticky { position: fixed; left: 0; right: 0; bottom: max(10px, env(safe-area-inset-bottom)); display: flex; justify-content: center; pointer-events: none; z-index: 12; }
.sticky > * { pointer-events: auto; }

/* arena picker */
.arenaGrid { width: min(1100px, 100%); flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 30vw), 1fr)); align-content: start; gap: 12px; padding: 6px 4px 80px;
  -webkit-mask-image: linear-gradient(#000 calc(100% - 50px), transparent); mask-image: linear-gradient(#000 calc(100% - 50px), transparent); }
.aCard { display: flex; flex-direction: column; gap: 6px; padding: 6px; background: var(--card); border: 3px solid #000; border-radius: 6px; box-shadow: 0 4px 0 #000; text-align: left; }
.aCard canvas { width: 100%; aspect-ratio: 16 / 9; border: 2px solid #000; image-rendering: pixelated; background: #1b1420; }
.aCard b { font-weight: normal; font-size: 11px; color: var(--gold); }
.aCard small { font-size: 8px; color: #cfc4da; line-height: 1.4; }
.aCard.sel { border-color: var(--gold); background: rgba(70,52,16,.95); }
/* arena the selected mode can't use (DYNAMITE without sites): greyed, tagged, not selectable */
.aCard { position: relative; }
.aCard.off, .aCard.off:disabled { opacity: 1; filter: none; cursor: not-allowed; background: rgba(20,16,24,.9); box-shadow: 0 2px 0 #000; }
.aCard.off canvas, .aCard.off b { filter: grayscale(1) brightness(.55); }
.aCard.off b { color: var(--dim); }
.aCard .offTag { position: absolute; top: 12%; left: 50%; transform: translateX(-50%); white-space: nowrap; font-style: normal; font-size: 7px; line-height: 1;
  padding: 3px 5px; color: #ffb27a; background: #000; border: 1px solid #ff9a3a; border-radius: 3px; pointer-events: none; }
.arenaGrid.inline.fit .aCard .offTag { font-size: 8px; }
@media (hover: hover) { .aCard.off:hover { border-color: #000; } }

/* pause / settings */
.pausePanel { min-width: 280px; }
.setPanel { width: min(720px, 96vw); }
.setPanel .topRow { width: 100%; }
.setPanel .topR { padding-right: 0; }

/* ---------- results ---------- */
.resWrap { width: min(980px, 100%); height: 100%; display: flex; flex-direction: column; gap: clamp(5px, 1.2vh, 10px); justify-content: center; }
.resTop { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; }
.resTop h2 { font-size: clamp(16px, 3vw, 28px); }
.resScore { display: flex; gap: 8px; font-size: clamp(12px, 1.8vw, 18px); }
.resScore span { padding: 5px 9px; background: #000; border: 2px solid currentColor; }
.resMid { display: flex; gap: 10px; align-items: stretch; }
.resStats { flex: 1.3; background: var(--card); border: 3px solid #000; border-radius: 6px; padding: 6px 8px; overflow: hidden; }
.resStats table { width: 100%; border-collapse: collapse; font-size: 8px; }
.resStats th { color: var(--dim); font-weight: normal; text-align: right; padding: 3px 4px; }
.resStats th:first-child, .resStats td:first-child { text-align: left; }
.resStats td { text-align: right; padding: 4px 4px; border-top: 1px solid #3a2f40; }
.resStats td canvas { width: 22px; height: 22px; vertical-align: middle; image-rendering: pixelated; margin-right: 4px; }
.mvp { display: inline-block; font-size: 7px; padding: 2px 3px; margin-left: 4px; background: var(--gold); color: #000; border: 1px solid #000; }
.xpStrip { flex: 1; overflow-y: auto; scrollbar-width: none; background: rgba(46,36,14,.93); border: 3px solid var(--gold); border-radius: 6px; padding: 7px 9px; display: flex; flex-direction: column; gap: 5px; font-size: 8px; min-width: 0; }
.xpLine { display: flex; justify-content: space-between; color: var(--lilac); opacity: 0; animation: xpIn .3s forwards; }
.xpLine b { font-weight: normal; color: var(--gold); }
@keyframes xpIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
.xpLv { display: flex; align-items: center; gap: 6px; color: #fff; margin-top: 2px; }
.xpBar { flex: 1; height: 8px; background: #000; border: 1px solid #000; }
.xpBar i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .8s ease-out; }
.xpUp { color: var(--gold); font-size: 11px; text-shadow: 2px 2px 0 #000; animation: xpIn .3s forwards, pop .4s; }
.xpNew { color: #8fe36b; }
@keyframes pop { 0% { transform: scale(1.6); } 100% { transform: scale(1); } }
.voteHead { display: flex; justify-content: space-between; align-items: center; font-size: 9px; color: var(--dim); }
.clock { font-size: 14px; color: var(--gold); min-width: 28px; text-align: right; }
.vote { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.vote .aCard { padding: 5px; gap: 4px; position: relative; }
.vote .aCard canvas { aspect-ratio: 16 / 7; object-fit: cover; }
.vote .aCard > b { font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vote .aCard .mTag { display: flex; align-items: center; gap: 4px; font-size: 7px; color: var(--lilac); white-space: nowrap; overflow: hidden; }
.vote .aCard .mTag canvas.mIco { width: 33px; height: 15px; aspect-ratio: auto; border: 0; background: none; flex: none; image-rendering: pixelated; }
.vote .aCard .mTag i { font-style: normal; font-size: 6px; padding: 1px 3px; background: #000; color: #b9a6ff; border: 1px solid #6b5aa8; }
.vote .aCard .mTag.m-dynamite { color: #ff9a3a; } .vote .aCard .mTag.m-gold { color: var(--gold); }
.vote .aCard .againB { position: absolute; top: 9px; left: 9px; font-size: 7px; padding: 3px 4px; background: var(--gold); color: #000; border: 2px solid #000; box-shadow: 0 2px 0 #000; }
/* results: the share card thumbnail (tap = SHARE) */
.resCard { position: relative; flex: none; width: clamp(200px, 27vw, 340px); padding: 0; background: #120d16; border: 3px solid #000; border-radius: 6px; box-shadow: 0 4px 0 #000; overflow: hidden; align-self: flex-start; }
.resCard canvas { display: block; width: 100%; height: auto; aspect-ratio: 1200 / 630; }
.resCard span { position: absolute; right: 6px; bottom: 6px; font-size: 8px; padding: 3px 5px; background: rgba(0,0,0,.8); color: var(--gold); border: 1px solid var(--gold); border-radius: 3px; }
@media (hover: hover) { .resCard:hover { border-color: var(--gold); } }
.resBtns { display: flex; justify-content: center; gap: 12px; align-items: center; }

/* ---------- profile / achievements ---------- */
.achBody { width: min(980px, 100%); flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 2px 4px 30px; }
.profile { display: flex; gap: 12px; align-items: center; background: rgba(46,36,14,.93); border: 3px solid var(--gold); border-radius: 6px; padding: 8px 10px; }
.profile canvas { width: 72px; height: 72px; image-rendering: pixelated; flex: none; }
.pfMain { flex: 1; display: flex; flex-direction: column; gap: 6px; font-size: 9px; }
.pfMain b { font-weight: normal; color: var(--gold); font-size: 12px; }
.pfStats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 10px; font-size: 8px; color: var(--lilac); }
.pfStats span b { color: #fff; font-size: 9px; }
.emoBox { background: var(--card); border: 3px solid #000; border-radius: 6px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.emoSlots, .emoGrid { display: flex; flex-wrap: wrap; gap: 6px; }
.emo { width: 46px; height: 46px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; background: #2a2131; border: 3px solid #000; border-radius: 6px; padding: 0; }
.emo .e { font-family: var(--emoji); font-size: 20px; line-height: 1; }
.emo small { font-size: 6px; color: var(--dim); }
.emo.eq { border-color: var(--gold); }
.emo.lock .e { filter: grayscale(1) opacity(.4); }
.emo.slot { width: 52px; border-style: dashed; }
.emo.slot.cur { border-color: var(--gold); border-style: solid; }
.achList { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.achItem { display: flex; gap: 8px; align-items: center; padding: 6px 8px; background: var(--card); border: 3px solid #000; border-radius: 6px; font-size: 8px; line-height: 1.4; }
.achItem .ck { width: 20px; height: 20px; flex: none; display: flex; align-items: center; justify-content: center; border: 2px solid #000; background: #1b1520; color: #000; font-size: 10px; }
.achItem.done .ck { background: #8fe36b; }
.achItem b { font-weight: normal; color: #fff; display: block; font-size: 9px; }
.achItem.done b { color: var(--gold); }
.achItem small { color: var(--dim); font-size: 7px; }

/* controls / credits */
.ctlBody, .credBody { width: min(900px, 100%); flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; font-size: 9px; line-height: 1.9; color: var(--lilac); padding: 4px 6px 30px; }
.ctlBody h3 { margin: 6px 0 0; font-weight: normal; font-size: 10px; color: var(--gold); }
.credBody p { margin: 0; }

/* ---------- in match: emote bubbles + controls card ---------- */
#emoteLayer { position: fixed; inset: 0; pointer-events: none; z-index: 8; }
.bub { position: absolute; transform: translate(-50%, -100%); background: #fff; border: 2px solid #000; border-radius: 8px; padding: 2px 5px 1px;
  font-family: var(--emoji); font-size: 20px; line-height: 1.15; box-shadow: 0 3px 0 rgba(0,0,0,.6); animation: bubPop .22s ease-out; }
.bub::after { content: ''; position: absolute; left: 50%; bottom: -7px; margin-left: -5px; border: 5px solid transparent; border-top-color: #000; border-bottom: 0; }
@keyframes bubPop { 0% { transform: translate(-50%, -100%) scale(.2); } 70% { transform: translate(-50%, -100%) scale(1.2); } 100% { transform: translate(-50%, -100%) scale(1); } }
#ctlCard.dimmed { opacity: .4; }
#ctlCard { position: fixed; left: max(10px, env(safe-area-inset-left)); top: 54px; z-index: 7; pointer-events: none; background: rgba(14,10,17,.82); border: 3px solid #000; border-radius: 6px;
  padding: 8px 10px; font-size: 8px; line-height: 2; color: var(--lilac); transition: opacity .6s; max-width: 300px; }
#ctlCard.fade { opacity: 0; }
#ctlCard b { font-weight: normal; color: var(--gold); }

/* toast + rotate */
#toast { position: fixed; left: max(12px, env(safe-area-inset-left)); bottom: max(70px, calc(env(safe-area-inset-bottom) + 70px)); transform: translateY(8px);
  background: rgba(13,9,16,.92); color: var(--ink); border: 3px solid #000; padding: 7px 10px; font-size: 9px; opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; z-index: 40; }
#toast.show { opacity: 1; transform: none; }
#rotate { position: fixed; inset: 0; background: var(--bg); display: none; align-items: center; justify-content: center; font-size: 14px; line-height: 1.8; text-align: center; padding: 20px; z-index: 60; color: var(--gold); }
@media (orientation: portrait) and (pointer: coarse) { #rotate { display: flex; } }

/* ---------- short landscape (phones) ---------- */
@media (max-height: 520px) {
  .screen { gap: 6px; }
  .logoTxt { font-size: clamp(22px, 9vh, 40px); text-shadow: 0 -2px 0 #fff2b8, 3px 3px 0 #8a2a12, 5px 5px 0 #000; }
  #logoTrail { display: none; }
  .tagline { font-size: 7px; }
  .playStrip { padding: 5px 10px 5px 5px; gap: 10px; }
  .psPort { width: 64px; height: 64px; }
  .psInfo { gap: 3px; }
  .btnY.big { font-size: 15px; padding: 11px 18px; }
  .mcard { padding: 5px 8px; gap: 8px; }
  .mcard .mico { width: 40px; height: 40px; }
  .mcard b { font-size: 10px; }
  .mcard small { font-size: 7px; }
  .smallRow .btnS { min-height: 34px; padding: 6px 3px; font-size: 8px; }
  .keyHint { display: none; }
  .topR { padding-right: 140px; }
  .side { width: 220px; gap: 4px; }
  .seg .btnS, .setRow .btnS { min-height: 32px; padding: 5px 5px; font-size: 8px; }
  .gsGrid { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; }
  .arenaChip canvas { width: 72px; height: 40px; }
  .resStats td { padding: 2px 4px; }
  .resStats td canvas { width: 16px; height: 16px; }
  .xpStrip { padding: 5px 7px; gap: 3px 10px; font-size: 7px; display: grid; grid-template-columns: 1fr 1fr; align-content: start; }
  .xpStrip .xpLv, .xpStrip .xpUp { grid-column: 1 / -1; }
  .resMid { max-height: 34vh; }
  .vote .aCard { gap: 3px; }
  .vote .aCard canvas { aspect-ratio: 16 / 5; }
  .vote .aCard small { display: none; }
  .btnY { min-height: 42px; padding: 9px 16px; font-size: 13px; }
  .resBtns .btnS { min-height: 40px; }
  .pausePanel { padding: 10px 14px; gap: 7px; }
  .pausePanel .btnS { min-height: 38px; }
  #ctlCard { top: 46px; font-size: 7px; line-height: 1.9; }
  .bub { font-size: 16px; }
  .profile canvas { width: 54px; height: 54px; }
}
/* the one phone breakpoint (≤ 440 px tall: portal phones are 290–430 px; render.js / main.js use the same number) */
@media (max-height: 440px) { .tagline { display: none; } }
/* the daily line: always one compact line, at every height (it used to vanish at ≤ 400 px, i.e. on most portal phones) */
.psDaily { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (orientation: portrait) {
  .mcards { flex-direction: column; }
  .smallRow { grid-template-columns: repeat(2, 1fr); }
  #home { justify-content: flex-start; overflow-y: auto; }
}
body.touch #ctlCard { max-width: 200px; line-height: 1.7; }

/* audit round 1: opaque layers (nothing from the screen below reads through), taken gunslinger, results backdrop */
.screen.layer, .screen.layer.dimBg { background: rgba(12, 8, 14, .96); }
#results { background: rgba(10, 7, 12, .9); }
#pause { background: rgba(10, 7, 12, .82); }
.gs.taken { opacity: .45; cursor: not-allowed; }
.xpStrip.hidden { display: none !important; }
#ctlCard { left: 50%; transform: translateX(-50%); top: auto; max-width: 92vw; white-space: nowrap; line-height: 1.6; padding: 5px 10px; font-size: 8px; }
body.touch #ctlCard { max-width: 92vw; line-height: 1.6; }

/* audit round 2 */
#ctlCard { white-space: normal; text-align: center; max-width: min(92vw, 900px); }
#ctlCard.kcHide { display: none !important; }
button:disabled { opacity: .45; filter: grayscale(.8); cursor: not-allowed; transform: none !important; }
.achItem:focus-visible, .kbnav .achItem:focus { outline: 3px solid var(--gold); outline-offset: 2px; }
#sndVol:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
@media (max-height: 520px) { .resTop { padding-right: 150px; } .resScore { flex-wrap: wrap; font-size: 11px; } .resScore span { padding: 3px 6px; } }
.seatRow { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.seatRow b { font-weight: normal; font-size: 8px; color: var(--lilac); min-width: 22px; }
.seatHint { font-size: 7px; color: var(--gold); min-height: 9px; }
#ctlCard { max-width: 96vw; }
#ctlCard.strip { bottom: max(6px, env(safe-area-inset-bottom)); max-width: min(46vw, 420px); font-size: 7px; line-height: 1.5; padding: 4px 8px; }
body:not(.touch) #ctlCard.strip { max-width: min(80vw, 760px); }
#ctlCard.same { font-size: 7px; line-height: 1.5; padding: 4px 8px; }
#ctlCard.same .kc { font-size: 7px; padding: 1px 3px 0; border-bottom-width: 3px; }

/* ---------- online (phase 3) ---------- */
#online, #room { background: rgba(12, 8, 14, .78); }
.nameRow { display: flex; align-items: center; gap: 6px; justify-content: center; }
.nameRow input, .codeIn { font-family: var(--px); font-size: 12px; color: var(--ink); background: #1b1520; border: 3px solid #000; border-radius: 5px; padding: 8px 8px; width: 170px; text-transform: uppercase; user-select: text; -webkit-user-select: text; }
.nameRow input:focus, .codeIn:focus { border-color: var(--gold); outline: none; }
.dice { min-width: 40px; font-family: var(--emoji); font-size: 16px; padding: 4px 6px; }
.onPanels { width: min(1000px, 100%); display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 10px; flex: 1; min-height: 0; }
.onPanel { background: var(--card); border: 3px solid #000; border-radius: 6px; box-shadow: 0 4px 0 #000; padding: 10px; display: flex; flex-direction: column; gap: 8px; align-items: stretch; min-height: 0; }
.onHead { font-size: 10px; color: var(--gold); display: flex; justify-content: space-between; align-items: center; }
.onDesc { font-size: 8px; line-height: 1.5; min-height: 24px; }
.codeIn { width: 100%; font-size: 18px; text-align: center; letter-spacing: 4px; }
.roomList { display: flex; flex-direction: column; gap: 5px; overflow-y: auto; min-height: 0; font-size: 9px; }
.roomRow { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; align-items: center; padding: 6px 8px; background: #2a2131; border: 3px solid #000; border-radius: 5px; text-align: left; font-size: 9px; }
.roomRow b { font-weight: normal; color: var(--gold); letter-spacing: 1px; }
.roomRow .live { color: #ff8a7a; } .roomRow .wait { color: #8fe36b; }
.onNote { font-size: 9px; color: var(--gold); min-height: 12px; text-align: center; }
.roomBody { width: min(1100px, 100%); flex: 1; min-height: 0; display: flex; gap: 12px; }
.roomMain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; padding-bottom: 70px; }
.codeBox { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; background: rgba(46,36,14,.93); border: 3px solid var(--gold); border-radius: 6px; padding: 8px 10px; }
.codeBox b { font-weight: normal; font-size: clamp(18px, 3.2vw, 30px); color: #fff; letter-spacing: 4px; text-shadow: 3px 3px 0 #000; user-select: text; -webkit-user-select: text; }
.codeBox .dim { font-size: 8px; }
.roster { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.team { background: var(--card); border: 3px solid #000; border-radius: 6px; padding: 6px; display: flex; flex-direction: column; gap: 5px; }
.team > small { font-size: 8px; }
.seatC { display: flex; align-items: center; gap: 8px; padding: 4px; background: #1b1520; border: 2px solid #000; border-radius: 5px; font-size: 9px; min-height: 44px; }
.seatC canvas { width: 36px; height: 36px; image-rendering: pixelated; flex: none; }
.seatC .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seatC .tag { font-size: 7px; color: var(--dim); }
.seatC.me { border-color: var(--gold); }
.seatC .chg { font-size: 8px; padding: 4px 6px; min-height: 30px; }
.series { font-size: 9px; color: var(--lilac); display: flex; flex-wrap: wrap; gap: 6px 14px; }
.series b { font-weight: normal; color: var(--gold); }
.hostPicks { font-size: 8px; text-align: center; padding: 4px; border: 2px dashed #5a4a63; border-radius: 4px; }
.roomSide.ro .seg .btnS:not(.on), .roomSide.ro .arenaChip { opacity: .55; pointer-events: none; }
.roomSide.ro .seg .btnS.on { pointer-events: none; }
.waitHost { font-size: 10px; color: var(--lilac); background: rgba(14,10,17,.9); border: 3px solid #000; padding: 12px 16px; border-radius: 6px; }
.linkChip { font-size: 8px; color: var(--dim); }
#netNote { position: fixed; left: 50%; top: max(52px, calc(env(safe-area-inset-top) + 52px)); transform: translateX(-50%); z-index: 35; background: rgba(13,9,16,.92); border: 3px solid #000; border-radius: 5px; padding: 6px 10px; font-size: 9px; color: var(--gold); pointer-events: none; }
#netChip { position: fixed; left: max(6px, env(safe-area-inset-left)); bottom: max(6px, env(safe-area-inset-bottom)); z-index: 9; font-size: 7px; color: var(--dim); background: rgba(13,9,16,.7); padding: 3px 5px; border-radius: 3px; pointer-events: none; }
#netChip.relay { color: #ffb070; } #netChip.bad { color: #ff8a7a; }
body.touch #netChip { bottom: auto; top: max(54px, env(safe-area-inset-top)); }
.vote .aCard.spin { border-color: #fff; }
.vote .aCard .votes { font-size: 8px; color: var(--lilac); }
@media (max-height: 520px) {
  .onPanels { gap: 6px; } .onPanel { padding: 6px; gap: 5px; } .onDesc { min-height: 0; }
  .codeIn { font-size: 14px; padding: 5px; } .nameRow input { padding: 5px; font-size: 10px; width: 130px; }
  .codeBox { padding: 4px 8px; gap: 4px 10px; } .seatC { min-height: 34px; padding: 2px 4px; } .seatC canvas { width: 28px; height: 28px; }
  .roster { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 5px; }
  #room .topRow .nameRow .chipLbl { display: none; }
}
.onPanels { flex: 0 1 auto; max-height: 72vh; }
.onPanel { align-self: start; }
.onList { align-self: stretch; }
#room .topRow > .btnS { justify-self: start; }
#netNote { top: auto; bottom: max(76px, calc(env(safe-area-inset-bottom) + 76px)); }
#room.guest #roomPub .btnS:not(.on) { opacity: .45; pointer-events: none; }
#room.guest #roomPub .btnS.on { pointer-events: none; }

/* real logo (assets/logo.png, 600×283; @2x 1200): menu-ui.md "Logo, big"; the text logo shows only if the image fails */
.logoImg { display: block; width: min(540px, 76vw); max-height: 36vh; height: auto; object-fit: contain; filter: drop-shadow(0 6px 0 rgba(0,0,0,.55)) drop-shadow(0 0 22px rgba(0,0,0,.45)); user-select: none; -webkit-user-drag: none; }
.logo .logoTxt { display: none; }
.logo.noimg .logoImg { display: none; }
.logo.noimg .logoTxt { display: block; }
@media (max-height: 520px) { .logoImg { width: auto; height: 16vh; max-height: none; } }
@media (orientation: portrait) { .logoImg { width: 100%; max-width: 360px; max-height: none; } }

/* pause: one column of equal-width buttons, RESUME the yellow primary */
.pausePanel { width: min(320px, 92vw); align-items: stretch; }
.pausePanel h2 { margin-bottom: 4px; }
.pausePanel .btnY, .pausePanel .btnS, .pausePanel .btnS.wide { width: 100%; min-width: 0; margin: 0; }
.pausePanel .btnY { margin-bottom: 4px; }

/* one focus ring for the whole kit: a 3 px ring with a small gap; white on the gold buttons so it reads */
:focus-visible, .kbnav [data-nav]:focus, .kbnav .gs:focus, .kbnav .aCard:focus, .kbnav .emo:focus, .kbnav .btnS:focus { outline: 3px solid var(--gold); outline-offset: 2px; }
.btnY:focus-visible, .kbnav .btnY:focus { outline-color: #fff; outline-offset: 2px; }

/* ---------- body text in Rubik (readable long text) ---------- */
.body, .credBody, .ctlBody .note, .onDesc, #byeText, .askPanel p, .aCard small, .achItem small, #netNote, #toast, .tagline-body {
  font-family: var(--body); font-weight: 500; letter-spacing: 0; }
.credBody { font-size: clamp(13px, 1.25vw, 16px); line-height: 1.5; max-width: 70ch; color: var(--ink); }
.credBody b { font-family: var(--px); font-weight: normal; font-size: .8em; color: var(--gold); }
.onDesc, #byeText, .askPanel p { font-size: clamp(12px, 1.1vw, 15px); line-height: 1.45; }
.aCard small { font-size: clamp(11px, 1vw, 13px); line-height: 1.35; }
.achItem small { font-size: clamp(11px, .95vw, 13px); line-height: 1.35; }
#netNote, #toast { font-size: 13px; }

/* ---------- CONTROLS: an opaque panel, device tabs, a clean action → keys table ---------- */
#controls { background: rgba(12, 8, 14, .97); }
.ctlBody { width: min(860px, 100%); gap: 10px; line-height: 1.5; color: var(--ink); font-size: inherit; padding: 4px 6px 24px; overflow-y: auto; }
.ctlTabs { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.ctlTable { width: 100%; border-collapse: collapse; font-family: var(--body); font-weight: 500; font-size: clamp(13px, 1.2vw, 16px); }
.ctlTable th { font-family: var(--px); font-weight: normal; font-size: 9px; color: var(--dim); text-align: left; padding: 4px 8px; }
.ctlTable td { padding: 5px 8px; border-top: 1px solid #3a2f40; vertical-align: middle; }
.ctlTable td:first-child { color: var(--lilac); width: 42%; }
.ctlTable tr.grp td { font-family: var(--px); font-size: 10px; color: var(--gold); border-top: 0; padding-top: 12px; }
.ctlTable .kc { font-family: var(--px); font-size: 9px; margin: 1px 2px; }
.ctlTable .alt { color: var(--dim); font-size: .9em; }
.rules { font-family: var(--body); font-weight: 500; font-size: clamp(13px, 1.2vw, 16px); line-height: 1.5; margin: 4px 0 0; padding-left: 20px; max-width: 70ch; color: var(--ink); }
.rules li { margin: 2px 0; }
.ctlH { font-family: var(--px); font-size: 10px; color: var(--gold); margin-top: 6px; }
@media (max-height: 520px) { .ctlTable td { padding: 3px 6px; } .ctlTable tr.grp td { padding-top: 6px; } }
/* text-heavy layers: fully opaque, nothing reads through */
.screen.layer, .screen.layer.dimBg, #controls, #credits, #ach, #arenaPick, #settings { background: #120d16; }
.ctlTable { font-size: clamp(13px, 1.1vw, 15px); line-height: 1.3; }
.ctlTable td { padding: 3px 8px; }
.ctlTable tr.grp td { padding-top: 7px; }
.ctlBody { gap: 6px; }
.rules { margin-top: 0; }
.ctlBody { width: min(1100px, 100%); }
.ctlGrid { display: grid; grid-template-columns: 1fr; gap: 8px 20px; align-items: start; }
@media (min-width: 1000px) { .ctlGrid { grid-template-columns: minmax(0, 1fr) 280px; } .ctlSide { padding-top: 24px; } }

/* ---------- TRICK SHOT ---------- */
.mcards { gap: 8px; }
.mcard small { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
#trick { background: rgba(12, 8, 14, .9); }
.trickNote { font-size: clamp(12px, 1.1vw, 15px); line-height: 1.45; max-width: 70ch; text-align: center; color: var(--lilac); margin: 0; }
.trickTotal { font-size: 10px; color: var(--gold); }
.trickGrid { width: min(900px, 100%); display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; overflow-y: auto; padding: 4px 4px 20px; }
.lvl { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px 8px; background: var(--card); border: 3px solid #000; border-radius: 6px; box-shadow: 0 4px 0 #000; }
.lvl b { font-weight: normal; font-size: clamp(14px, 1.8vw, 20px); color: var(--gold); }
.lvl small { font-family: var(--body); font-weight: 500; font-size: 12px; color: var(--lilac); text-align: center; line-height: 1.2; min-height: 2.4em; }
.lvl.lock { opacity: .5; } .lvl.lock b { color: #8a7b92; }
.lvl.next { border-color: var(--gold); }
.stars { display: flex; gap: 3px; }
.star { width: 13px; height: 13px; background: #3a2f40; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.star.on { background: var(--gold); }
.starRow { display: flex; gap: 8px; justify-content: center; }
.starRow .star { width: 34px; height: 34px; }
.starRow .star.on { animation: pop .4s backwards; }
.trickPanel { min-width: min(420px, 92vw); }
.trickResLine { font-size: clamp(13px, 1.2vw, 16px); color: var(--ink); text-align: center; }
.trickPanel .xpStrip { width: 100%; }
@media (max-height: 520px) { .trickGrid { gap: 6px; } .lvl { padding: 5px 4px; gap: 3px; } .lvl small { font-size: 11px; min-height: 0; } .trickNote { font-size: 12px; } .starRow .star { width: 24px; height: 24px; } }
@media (max-width: 700px) { .mcard small { display: none; } }
.rules b { font-family: var(--px); font-weight: normal; font-size: .7em; color: var(--gold); }
.modeNote { font-size: 12px; line-height: 1.35; color: var(--lilac); }

/* ---------- CUSTOM setup v3: mode cards · arena grid (hero) · gunslinger + settings side ---------- */
.setupBody { align-items: stretch; }
.setupMain { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.modeRow { flex: none; display: flex; gap: 10px; overflow-x: auto; overflow-y: hidden; padding: 4px 4px 8px; scrollbar-width: thin; }
.modeWrap { position: relative; flex: none; width: clamp(190px, 21vw, 250px); }
.modeCard { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 8px 10px; text-align: left;
  background: var(--card); border: 3px solid #000; border-radius: 7px; box-shadow: 0 5px 0 #000; }
.modeCard .modeArt { height: 64px; width: auto; align-self: center; image-rendering: pixelated; }
.modeCard b { font-weight: normal; font-size: 12px; color: var(--gold); text-shadow: 2px 2px 0 #000; }
.modeCard small { font-size: 12px; line-height: 1.3; color: var(--ink); }
.modeCard .ptag { font-size: 7px; color: var(--dim); margin-top: auto; }
.modeCard .dark { font-size: 7px; padding: 2px 4px; margin-left: 6px; background: #000; color: #b9a6ff; border: 1px solid #6b5aa8; vertical-align: 2px; }
.modeCard.sel { border-color: var(--gold); background: rgba(70,52,16,.95); box-shadow: 0 5px 0 #000, 0 0 16px rgba(255,211,74,.3); }
.modeInfo { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; padding: 0; font-family: var(--body); font-weight: 700; font-size: 14px; background: #2a2131; border: 2px solid #000; color: var(--lilac); }
@media (hover: hover) { .modeCard:hover { border-color: var(--gold); } .modeInfo:hover { color: var(--gold); border-color: var(--gold); } }
.arenaLbl { margin: 0 4px; }
.arenaWrap { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 4px 74px; scrollbar-width: thin; }
.arenaGrid.inline { width: 100%; flex: none; overflow: visible; padding: 0; -webkit-mask-image: none; mask-image: none; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.arenaGrid.inline .aCard { padding: 5px; gap: 4px; }
.arenaGrid.inline .aCard small { display: none; }
.arenaGrid.inline .aCard b { font-size: 10px; }
/* fitted tiles (shell.js fitArenas): bigger name, one line */
.arenaGrid.inline.fit { gap: 10px; }
.arenaGrid.inline.fit .aCard { padding: 6px; gap: 6px; }
.arenaGrid.inline.fit .aCard b { font-size: var(--aFs, 10px); line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* big windows: the setup flow scales as a whole (--uiZ from shell.js uiScale, 1 on phones / 1280×720) */
#setup, #gsPick, #howTo { zoom: var(--uiZ, 1); }
#setup .side { gap: 5px; }
.gsChip { display: flex; align-items: center; gap: 8px; padding: 5px 8px; text-align: left; background: rgba(46,36,14,.93); border: 3px solid var(--gold); border-radius: 6px; box-shadow: 0 4px 0 #000; }
.gsChip canvas { width: 40px; height: 40px; image-rendering: pixelated; flex: none; }
.gsChip span { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.gsChip small { font-size: 7px; color: var(--dim); } .gsChip b { font-weight: normal; font-size: 10px; color: #fff; } .gsChip i { font-style: normal; font-size: 8px; color: var(--gold); }
#gsChips { display: flex; flex-direction: column; gap: 5px; }
#gsPick .gridWrap { width: min(1000px, 100%); flex: 1; min-height: 0; }
/* HOW IT WORKS */
#howTo { background: rgba(10, 7, 12, .96); justify-content: center; }
.howWrap { width: min(900px, 96vw); display: flex; flex-direction: column; align-items: center; gap: 14px; }
.howWrap h2 { font-size: clamp(18px, 3vw, 30px); }
.howSteps { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.howStep { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 10px; background: var(--card); border: 3px solid #000; border-radius: 7px; box-shadow: 0 5px 0 #000; }
.howStep .howN { position: absolute; top: 6px; left: 8px; font-size: 12px; color: var(--gold); }
.howStep .howArt { width: 100%; max-width: 198px; height: auto; image-rendering: pixelated; }
.howStep p { margin: 0; font-size: clamp(13px, 1.25vw, 16px); line-height: 1.4; text-align: center; color: var(--ink); }
.howStep .kc, .howExtra .kc { font-family: var(--px); }
.howExtra { font-size: clamp(13px, 1.3vw, 16px); color: #b9a6ff; text-align: center; }
@media (max-height: 520px) {
  .modeWrap { width: 180px; } .modeCard { padding: 5px 8px; gap: 2px; } .modeCard .modeArt { height: 40px; }
  .modeCard small { font-size: 11px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .arenaGrid.inline { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
  .howWrap { gap: 8px; } .howStep { padding: 6px; gap: 4px; } .howStep .howArt { max-width: 132px; } .howStep p { font-size: 12px; }
}
@media (max-height: 440px) { .setupMain { overflow-y: auto; } .arenaWrap { flex: none; overflow: visible; } }

/* DYNAMITE contextual hint over your fighter (Rubik text + pixel key cap) */
.ctxHint { position: fixed; z-index: 8; transform: translate(-50%, -100%); pointer-events: none; white-space: nowrap;
  font-family: var(--body); font-weight: 700; font-size: clamp(13px, 1.2vw, 16px); color: #fff; background: rgba(13,9,16,.86);
  border: 2px solid var(--gold); border-radius: 6px; padding: 4px 9px; box-shadow: 0 3px 0 #000; display: flex; align-items: center; gap: 6px; transition: opacity .2s; }
.ctxHint.defuse { border-color: #8ad0ff; } .ctxHint.carry { border-color: #ff9a3a; }
.ctxHint b { font-weight: 800; color: #ffb27a; }
.ctxHint .dynIco { width: 6px; height: 14px; flex: none; background: #c84030; box-shadow: inset 0 3px 0 #7a1e14, inset 0 -3px 0 #7a1e14, 0 -4px 0 -2px #ffd34a; margin: 4px 2px 0; }
.ctxHint.fade { opacity: 0; }
.ctxHint:not(.hidden):not(.fade) { animation: hintIn .15s ease-out; }
@keyframes hintIn { from { opacity: 0; } to { opacity: 1; } }
.ctxHint .kc { font-family: var(--px); font-size: 10px; }
.ctxHint .arr { font-family: var(--px); color: #ff9a3a; font-size: 12px; }
.ctxHint .ring { width: 18px; height: 18px; border-radius: 50%; background: conic-gradient(var(--gold) var(--p, 0%), #3a2f40 0); }
.ctxHint.defuse .ring { background: conic-gradient(#8ad0ff var(--p, 0%), #3a2f40 0); }

/* online room: compact mode cards */
.modeMini { display: flex; flex-direction: column; gap: 4px; }
.modeMini .mini { display: flex; align-items: center; gap: 8px; padding: 4px 6px; text-align: left; background: var(--card); border: 3px solid #000; border-radius: 5px; }
.modeMini .mini.on { border-color: var(--gold); background: rgba(70,52,16,.95); }
.modeMini .mini canvas { width: 66px; height: 30px; image-rendering: pixelated; flex: none; }
.modeMini .mini span { display: flex; flex-direction: column; gap: 3px; } .modeMini .mini b { font-weight: normal; font-size: 9px; color: var(--gold); } .modeMini .mini small { font-size: 7px; color: var(--dim); }
.roomSide.ro .modeMini .mini:not(.on) { opacity: .55; pointer-events: none; } .roomSide.ro .modeMini .mini.on { pointer-events: none; }

/* ---------- portal phone pass (docs/crazygames-build.md) ---------- */
/* phones: toasts and net notices are slim strips. On touch the toast sits at the top centre, below the canvas HUD
   (score plate + mode clock), clear of both thumb zones; net notices stay low between the thumbs */
@media (max-height: 520px), (max-width: 640px) {
  #toast, #netNote { font-size: 10px; line-height: 1.35; padding: 4px 8px; border-width: 2px; max-width: 40vw; text-align: center; box-sizing: border-box; }
  body.touch #toast { left: 50%; bottom: auto; top: calc(env(safe-area-inset-top, 0px) + clamp(54px, 26vh, 84px)); transform: translate(-50%, -8px); }
  body.touch #toast.show { transform: translate(-50%, 0); }
  body.touch #netNote { bottom: max(40px, calc(env(safe-area-inset-bottom) + 40px)); }
}
/* the 💬 emote button: a pulse in the first touch matches, until it's used once (main.js); no text label on phones
   (party playbook: no secondary-feature callouts) */
.bk-emote-open.hint { animation: emoHint 1.1s ease-in-out infinite; }
@keyframes emoHint { 50% { box-shadow: 0 0 0 5px rgba(255,211,74,.5); } }
/* short phones (≤ 440 px): the thumb buttons shrink around the corner (JUMP 80 → 66 px, SHOOT/SLASH 68 → 56 px; ≥ 44 px
   targets even at ≤ 300 px), so they cover less of a 240–430 px tall frame */
@media (max-height: 440px) {
  #touchRoot .bk-btns { transform: scale(.82); transform-origin: 100% 100%; }
  #touchRoot .bk-btn { background: rgba(128,128,128,.28); }
}
@media (max-height: 300px) { #touchRoot .bk-btns { transform: scale(.7); } }

/* ---------- TYPE RULE (user, 2026-10-24): Press Start 2P only for titles, big numbers / scores, buttons and key caps;
   Rubik for everything else (labels, table headers, names in tables, card descriptions, mode tags, XP lines, hints,
   toasts, settings labels, the online room text). Readability first; the in-canvas HUD stays pixel. ---------- */
body { font-family: var(--body); font-weight: 500; }
h1, h2, h3, button, .kc, .clock, .resScore, .codeIn, .roomCode, #roomCode, .mvp, .xpUp, .lockLv, .trickTotal, #banner, .howN, .logo { font-family: var(--px); font-weight: normal; }
/* labels / headings of groups */
.lbl, .chipLbl, .setRow .grp > span, .voteHead > span:first-child, .sndVol, .seatRow b, .onHead > span:first-child { font-family: var(--body); font-weight: 700; font-size: 12px; letter-spacing: .06em; }
/* card / chip descriptions inside buttons (buttons are pixel, their small print is not) */
.mcard small, .aCard small, .arenaChip small, .modeCard small, .modeCard .ptag, .gsChip small, .gsChip i, .gs b, .gs .who, .lvl small, .modeMini .mini small,
.vote .aCard .mTag, .vote .aCard .votes, .seatC, .seatC .tag, .roomRow, .resCard span, .aCard .offTag, .againB, .modeCard .dark, .vote .aCard .mTag i { font-family: var(--body); font-weight: 600; }
.mcard small { font-size: 12px; } .aCard small { font-size: 12px; } .arenaChip small { font-size: 12px; }
.modeCard .ptag { font-size: 11px; } .modeCard .dark, .vote .aCard .mTag i { font-size: 10px; padding: 0 4px; }
.gsChip small { font-size: 11px; } .gsChip i { font-size: 12px; } .gs b { font-size: 11px; line-height: 1.15; } .gs .who { font-size: 11px; }
.vote .aCard .mTag { font-size: 12px; } .vote .aCard .votes { font-size: 12px; }
.aCard .offTag, .arenaGrid.inline.fit .aCard .offTag { font-size: 10px; font-weight: 700; } .againB, .vote .aCard .againB { font-size: 11px; font-weight: 700; }
.resCard span { font-size: 12px; font-weight: 700; }
/* results: stats table + XP panel (compact, fits its content) */
.resStats table { font-family: var(--body); font-size: 14px; font-weight: 500; }
.resStats th { font-family: var(--body); font-weight: 700; font-size: 11px; letter-spacing: .06em; }
.resStats td:first-child span { font-weight: 700; }
.xpStrip { font-family: var(--body); font-size: 13px; font-weight: 500; align-self: flex-start; flex: 1; gap: 4px; max-height: 100%; }
.xpLine b { font-weight: 700; }
.xpNext { color: #d9c8ef; font-size: 12px; } .xpNext b { color: #fff; text-align: right; }
.xpLine.xpNext span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 8px; }
.voteHead > span:first-child { color: var(--dim); }
/* home, profile, achievements, settings, sound, asks */
.psLv, .psDaily, .sndHint, .askPanel p, .keyHint, .pfMain, .pfStats, .achItem, .achItem small, .emo small { font-family: var(--body); font-weight: 500; }
.psLv, .psDaily { font-size: 11px; line-height: 1.15; } .lbl { font-size: 11px; line-height: 1.2; } .sndHint { font-size: 12px; } .askPanel p { font-size: 14px; line-height: 1.45; } .keyHint { font-size: 13px; line-height: 1.7; }
.pfMain { font-size: 13px; } .pfStats { font-size: 12px; } .pfStats span b { font-size: 13px; font-family: var(--px); font-weight: normal; }
.achItem { font-size: 13px; } .achItem b { font-family: var(--body); font-weight: 700; font-size: 13px; } .achItem small { font-size: 12px; }
.emo small { font-size: 10px; }
/* controls / credits / help text */
.ctlBody, .credBody, .ctlTable th, .ctlTable tr.grp td, .ctlH { font-family: var(--body); }
.ctlBody { font-size: 14px; } .ctlTable th { font-weight: 700; font-size: 12px; letter-spacing: .06em; } .ctlTable tr.grp td { font-weight: 700; font-size: 13px; letter-spacing: .06em; } .ctlH { font-weight: 700; font-size: 14px; }
.ctlBody h3 { font-family: var(--px); }
/* in-match DOM text: controls card, toasts, net notices */
#ctlCard, #toast, #netNote, #netChip { font-family: var(--body); font-weight: 600; }
#ctlCard { font-size: 12px; line-height: 1.75; } #ctlCard.strip, #ctlCard.same { font-size: 11px; line-height: 1.6; } #ctlCard.same .kc { font-size: 8px; }
#toast, #netNote { font-size: 14px; } #netChip { font-size: 11px; }
/* online screens */
.onDesc, .roomList, .onNote, .codeBox .dim, .team > small, .series, .hostPicks, .waitHost, .linkChip, .seatHint { font-family: var(--body); font-weight: 500; }
.onDesc { font-size: 13px; line-height: 1.4; } .roomList { font-size: 13px; } .onNote { font-size: 13px; font-weight: 700; } .codeBox .dim { font-size: 12px; }
.team > small { font-size: 12px; } .seatC { font-size: 13px; } .seatC .tag { font-size: 11px; } .series { font-size: 13px; } .hostPicks { font-size: 12px; font-weight: 700; }
.waitHost { font-size: 14px; } .linkChip { font-size: 12px; } .seatHint { font-size: 11px; font-weight: 700; } .seatRow b { font-size: 12px; }
@media (max-height: 520px) {
  .lbl, .chipLbl, .setRow .grp > span { font-size: 11px; }
  .resStats table { font-size: 12px; } .resStats th { font-size: 10px; }
  .xpStrip { font-size: 11px; gap: 2px 10px; } .xpNext { font-size: 11px; }
  .mcard small, .aCard small { font-size: 11px; } .vote .aCard .mTag { font-size: 11px; } .gs b { font-size: 10px; }
  #ctlCard { font-size: 11px; } #ctlCard.strip, #ctlCard.same { font-size: 10px; }
  .onDesc, .roomList, .seatC, .series { font-size: 12px; }
  .xpStrip { grid-template-columns: 1fr; } .resStats th, .resStats td { padding: 2px 3px; letter-spacing: 0; } .resCard { width: 160px; }
}
.roomRow b { font-family: var(--px); font-weight: normal; }

.clock.paused { font-size: 10px; color: var(--lilac); }

/* ---------- phone pass 2 (2026-11, worklist 11–16): the ≤ 440 px breakpoint ---------- */
.xpAchN { display: none !important; }
@media (max-height: 440px) {
  /* results XP panel, collapsed: LV bar with the XP total · LEVEL UP / NEW · next unlock · daily; achievements as a count */
  .xpStrip .xpSrc, .xpStrip .xpAch { display: none; }
  .xpStrip .xpAchN { display: flex !important; }
  .xpStrip .xpUp { font-size: 9px; }
  .xpLine.xpNew span, .xpLine.xpNew { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* home: the info column is the tallest thing in the strip */
  .playStrip .lbl { display: none; }
  .playStrip .link { min-height: 22px; padding: 2px 0; }
}
/* the shortest portal frames (Safari + CrazyGames bars: 240–300 px) */
@media (max-height: 300px) {
  .screen { gap: 4px; padding-top: max(4px, env(safe-area-inset-top)); padding-bottom: max(4px, env(safe-area-inset-bottom)); }
  .logoImg { height: 13vh; }
  .playStrip { padding: 3px 8px 3px 3px; }
  .psPort { width: 48px; height: 48px; }
  .psInfo { gap: 2px; }
  .btnY.big { font-size: 13px; padding: 8px 14px; min-height: 38px; }
  .mcard { padding: 3px 6px; gap: 6px; }
  .mcard .mico { width: 30px; height: 30px; }
  .mcard small { display: none; }
  .smallRow .btnS { min-height: 30px; padding: 4px 3px; }
  /* pause: RESUME full width, the rest in a 2-column grid */
  .pausePanel { width: min(460px, 92vw); display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 6px 10px; }
  .pausePanel h2, .pausePanel .btnY { grid-column: 1 / -1; }
  .pausePanel h2 { margin: 0; font-size: 13px; }
  .pausePanel .btnY { min-height: 38px; padding: 6px 12px; margin-bottom: 2px; }
  .pausePanel .btnS { min-height: 34px; padding: 5px 6px; }
  /* results */
  .resWrap { gap: 4px; }
  .resTop h2 { font-size: 15px; }
  .resMid { max-height: 38vh; }
  .vote .aCard > canvas { display: none; } /* names + mode tags only: the arena thumbs don't fit a 240 px frame */
  .resTop { gap: 10px; }
  .vote .aCard .againB { left: auto; right: 5px; top: 5px; } /* no thumb under it now: keep it off the arena name */
  .btnY { min-height: 36px; padding: 6px 14px; }
  .resBtns .btnS { min-height: 34px; }
}
/* the idle ghost stick: fainter on short phones, almost gone while your own fighter stands under it (main.js) */
@media (max-height: 440px) { #touchRoot .bk-idle .bk-base, #touchRoot .bk-idle .bk-knob { opacity: .22; } }
#touchRoot.stickOver .bk-idle .bk-base, #touchRoot.stickOver .bk-idle .bk-knob { opacity: .06; transition: opacity .2s; }
