:root {
  --hud-white: #f4f1e8;
  --hud-green: #6fd36a;
  --hud-pink: #ff7aa8;
  --hud-gold: #ffcc33;
  --hud-blue: #7ec8ff;
  --ink: #111;
  --paper: #f3eedf;
  --outline: 0 2px 0 #000, 2px 0 0 #000, 0 -2px 0 #000, -2px 0 0 #000, 2px 2px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000;
  --font-hud: 'Bangers', Impact, 'Arial Black', sans-serif;
  --font-body: 'Oswald', 'Arial Narrow', Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: var(--hud-white); font-family: var(--font-body); }
button { font: inherit; }

/* The canvas renders at ~640x360 and is stretched; the browser's bilinear upscale is the PS2 blur. */
#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
#game.wasted { filter: grayscale(1) contrast(1.15) brightness(0.85); transition: filter 1.2s; }

.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud-tr { position: absolute; top: 16px; right: 22px; text-align: right; font-family: var(--font-hud); letter-spacing: 1px; }
.clock-row { font-size: 34px; text-shadow: var(--outline); }
#hud-clock-label { font-size: 18px; color: #cfd8dc; }
#hud-weapons { display: flex; gap: 6px; justify-content: flex-end; margin: 6px 0; }
.wslot { width: 50px; height: 50px; border: 3px solid #000; background: rgba(255, 255, 255, 0.82); border-radius: 6px; position: relative; display: grid; place-items: center; font-size: 28px; box-shadow: 0 2px 0 rgba(0,0,0,.5); }
.wslot.q-rare { border-color: #1976d2; } .wslot.q-epic { border-color: #8e24aa; }
.wslot.q-legendary { border-color: #ffb300; box-shadow: 0 0 10px rgba(255, 179, 0, .8); }
.wslot i { position: absolute; bottom: -4px; right: -4px; font-style: normal; font-size: 13px; background: #000; color: var(--hud-gold); padding: 0 4px; border-radius: 3px; }
.hp-row { font-size: 34px; color: var(--hud-pink); text-shadow: var(--outline); }
.hp-row .heart { margin-right: 6px; }
#hud-hp-bar { width: 220px; height: 10px; margin: 2px 0 4px auto; border: 2px solid #000; background: rgba(0,0,0,.45); }
#hud-hp-fill { height: 100%; width: 100%; background: linear-gradient(#ff9bc0, #e2477d); transition: width .15s; }
#hud-money { font-size: 38px; color: var(--hud-green); text-shadow: var(--outline); }
/* mayhem stars: lit in --tier (gold in a normal run; endless tiers set it), with the tier numeral in front */
#hud-wanted { --tier: var(--hud-gold); display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
#hud-tier { font-size: 24px; color: var(--tier); text-shadow: var(--outline); letter-spacing: 1px; }
#hud-stars { font-size: 30px; letter-spacing: 2px; color: rgba(0,0,0,.45); -webkit-text-stroke: 1px rgba(255,255,255,.35); text-shadow: 0 0 2px #000; }
#hud-stars span { display: inline-block; }
#hud-stars span.on { color: var(--tier); -webkit-text-stroke: 0; text-shadow: var(--outline), 0 0 8px var(--tier); }
#hud-stars span.pop { animation: starpop .5s ease-out; }
@keyframes starpop { from { transform: scale(2.2); filter: brightness(2.2); } to { transform: scale(1); filter: none; } }
#hud-wanted.tier-up { animation: tierglow 1.4s ease-out; }
#hud-wanted.tier-up #hud-stars span { animation: tierstar .9s cubic-bezier(.2, 1.5, .4, 1) both; animation-delay: calc(var(--i) * .07s); }
#hud-wanted.tier-up #hud-tier { animation: tiernum .8s ease-out; }
@keyframes tierglow { 0%, 35% { filter: drop-shadow(0 0 14px var(--tier)) brightness(1.7); } 100% { filter: none; } }
@keyframes tierstar { 0% { transform: scale(2.8) rotate(-200deg); opacity: 0; } 60% { transform: scale(1.25) rotate(12deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }
@keyframes tiernum { 0% { transform: scale(3.2); opacity: 0; } 45% { transform: scale(.9); opacity: 1; } 100% { transform: scale(1); } }

/* name tags over the packs wandering the streets before the fighting starts */
#pack-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.pack-label { position: absolute; left: 0; top: 0; transform-origin: 50% 100%; text-align: center; white-space: nowrap; will-change: transform, opacity; }
.pack-label .pl-name { font-family: var(--font-hud); font-size: 23px; letter-spacing: 1.5px; text-shadow: var(--outline); }

/* Character panel (C): a WoW-style paper doll and backpack */
#charpanel { position: fixed; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .45); }
.cp-window { width: min(860px, 100%); max-height: 100%; overflow: auto; background: linear-gradient(#2b241d, #171310); border: 3px solid #000; box-shadow: inset 0 0 0 2px #8b6b2e, 0 14px 50px rgba(0,0,0,.7); padding: 10px 16px 8px; }
.cp-head { display: flex; align-items: baseline; gap: 12px; border-bottom: 2px solid #8b6b2e; padding-bottom: 4px; margin-bottom: 8px; }
.cp-name { font-family: var(--font-hud); font-size: 32px; letter-spacing: 2px; color: var(--hud-gold); text-shadow: var(--outline); }
#cp-sub { font: 600 14px var(--font-body); color: #cbb994; letter-spacing: 1px; }
.cp-x { margin-left: auto; background: #3a2f25; color: #eee; border: 2px solid #000; width: 30px; height: 30px; cursor: pointer; font-size: 15px; }
.cp-x:hover { background: #a12c2c; }
.cp-body { display: grid; grid-template-columns: auto 1fr; gap: 14px; }
.cp-doll { display: grid; grid-template-columns: 50px 210px 50px; gap: 8px; align-items: center; align-content: start; }
.cp-weap { grid-column: 1 / -1; display: flex; justify-content: center; gap: 8px; }
.cp-col { display: flex; flex-direction: column; gap: 8px; }
.cp-model { position: relative; height: 224px; border: 2px solid #000; box-shadow: inset 0 0 0 1px #5c4720; background: radial-gradient(ellipse at 50% 38%, #4e6f86 0%, #263746 55%, #121a20 100%); }
#cp-model { width: 100%; height: 100%; display: block; cursor: grab; }
#cp-model:active { cursor: grabbing; }
.cp-hint { position: absolute; bottom: 4px; left: 0; right: 0; text-align: center; font: 600 11px var(--font-body); color: rgba(255,255,255,.45); pointer-events: none; }
.cp-slot { position: relative; width: 50px; height: 50px; background: linear-gradient(#1b1714, #0d0b09); border: 3px solid #6b6b6b; box-shadow: inset 0 0 0 1px #000; display: grid; place-items: center; font-size: 26px; cursor: default; }
.cp-slot[data-act] { cursor: pointer; } .cp-slot[data-act]:hover { filter: brightness(1.35); }
.cp-slot.gear.empty { font-size: 9px; letter-spacing: .5px; }
.cp-perks .cp-slot { width: 40px; height: 40px; font-size: 21px; }
.cp-slot.empty { border-color: #3d352c; opacity: .55; font-size: 12px; color: #8a7d68; font-family: var(--font-body); text-align: center; line-height: 1.1; }
.cp-slot.q-rare { border-color: #1976d2; } .cp-slot.q-epic { border-color: #8e24aa; }
.cp-slot.q-legendary { border-color: #ffb300; box-shadow: inset 0 0 0 1px #000, 0 0 10px rgba(255, 179, 0, .7); }
.cp-slot i { position: absolute; bottom: -3px; right: -3px; font: 700 12px var(--font-body); font-style: normal; background: #000; color: var(--hud-gold); padding: 0 4px; border-radius: 3px; }
.cp-slot b { position: absolute; top: -3px; left: -3px; font: 700 10px var(--font-body); background: #000; color: #cbb994; padding: 0 3px; border-radius: 3px; letter-spacing: .5px; }
.cp-stats { background: rgba(0,0,0,.35); border: 2px solid #000; box-shadow: inset 0 0 0 1px #5c4720; padding: 5px 12px; font: 400 12.5px/1.35 var(--font-body); min-width: 0; }
.cp-stats h4 { margin: 5px 0 1px; font: 700 12px var(--font-body); letter-spacing: 2px; color: var(--hud-gold); border-bottom: 1px solid #5c4720; }
.cp-stats h4:first-child { margin-top: 0; }
.cp-stats .row { display: flex; justify-content: space-between; gap: 10px; }
.cp-stats .row span:first-child { color: #cbb994; }
.cp-stats .up { color: #7ee07a; } .cp-stats .down { color: #ff6b6b; }
.cp-xp { height: 6px; background: #000; margin: 2px 0 4px; } .cp-xp div { height: 100%; background: #b388ff; }
.cp-bag { margin-top: 8px; }
.cp-bag-head { display: flex; justify-content: space-between; font: 700 12px var(--font-body); letter-spacing: 2px; color: var(--hud-gold); border-bottom: 1px solid #5c4720; margin-bottom: 8px; }
#cp-cash { font-family: var(--font-hud); font-size: 20px; letter-spacing: 1px; color: var(--hud-green); text-shadow: var(--outline); }
.cp-grid { display: grid; grid-template-columns: repeat(auto-fill, 50px); gap: 7px; margin-bottom: 6px; }
.cp-perks { grid-template-columns: repeat(auto-fill, 40px); }
#cp-bagcount { color: #8a7d68; letter-spacing: 1px; }
/* the safe pocket (run) and stash mode (title → Stash) */
.cp-slot.pocket { border-style: dashed; }
.cp-slot.pocket.empty { opacity: 1; border-color: #43a047; color: #7ee07a; font: 700 9px var(--font-body); letter-spacing: .5px; background: linear-gradient(#17261a, #0b120c); }
.cp-slot b.safe { color: #7ee07a; }
#charpanel.dragging .cp-slot.pocket { box-shadow: inset 0 0 0 1px #000, 0 0 12px #7ee07a; }
.cp-slot.armed { border-color: #e53935; box-shadow: inset 0 0 0 1px #000, 0 0 10px rgba(229, 57, 53, .8); }
#charpanel.stash .run-only { display: none; }
#cp-tip .safe { color: #7ee07a; font-weight: 700; } #cp-tip .warn { color: #ff6b6b; font-weight: 700; }
#cp-tip .cmp { margin-top: 6px; padding-top: 5px; border-top: 1px solid #5c4720; }
#cp-tip .hint { color: #cbb994; font-size: 12px; margin-top: 5px; }
.cp-foot { margin-top: 6px; text-align: center; font: 400 12px var(--font-body); color: #8a7d68; }
.cp-foot b { color: var(--hud-gold); }
#cp-tip { position: fixed; z-index: 7; max-width: 300px; pointer-events: none; background: rgba(12, 10, 8, .96); border: 2px solid #8b6b2e; padding: 8px 10px; font: 400 13px var(--font-body); color: #ddd; box-shadow: 0 6px 20px rgba(0,0,0,.6); }
#cp-tip .t { font: 700 16px var(--font-body); color: #fff; }
#cp-tip .t.rare { color: #42a5f5; } #cp-tip .t.epic { color: #ce5cff; } #cp-tip .t.legendary { color: #ffb300; }
#cp-tip .s { color: #cbb994; font-size: 12px; margin-bottom: 4px; }
#cp-tip .g { color: #7ee07a; } #cp-tip .q { color: #9e9e9e; font-style: italic; margin-top: 4px; }
#cp-tip .kv { display: flex; justify-content: space-between; gap: 14px; }
@media (max-width: 760px) { .cp-body { grid-template-columns: 1fr; } .cp-doll { justify-content: center; } }


#hud-boss { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); width: min(560px, 50vw); text-align: center; }
.boss-name { font-family: var(--font-hud); font-size: 30px; color: #ffe0ec; text-shadow: var(--outline); letter-spacing: 2px; }
.boss-name small { display: block; font-size: 15px; color: #cfd8dc; letter-spacing: 1px; }
.boss-bar { height: 16px; border: 3px solid #000; background: rgba(0,0,0,.5); margin-top: 2px; }
#hud-boss-fill { height: 100%; width: 100%; background: linear-gradient(#ff6b6b, #b71c1c); transition: width .1s; }

#hud-prompt { position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%); background: rgba(0,0,0,.72); border: 2px solid #000; padding: 8px 16px; font-size: 20px; border-radius: 4px; }
#hud-prompt b { background: var(--hud-white); color: #000; padding: 0 7px; border-radius: 3px; }
#hud-prompt .ok { color: var(--hud-green); font-weight: 700; }
#hud-prompt .no { color: #ff5252; font-weight: 700; }
#hud-prompt { text-align: center; }
#hud-prompt small { display: block; font-size: 13px; color: #bbb; margin-top: 2px; }
#hud-prompt .tier-common { color: #cfd8dc; font-weight: 700; }
#hud-prompt .tier-rare { color: #42a5f5; font-weight: 700; }
#hud-prompt .tier-epic { color: #ce5cff; font-weight: 700; }
#hud-prompt .tier-legendary { color: #ffc107; font-weight: 700; }
#hud-prompt .club { color: #ff6fd8; font-weight: 700; }
#girl-label { position: absolute; left: 0; top: 0; transform-origin: 50% 100%; text-align: center; white-space: nowrap; pointer-events: none; will-change: transform; }
#girl-label .gl-name { font-family: var(--font-hud); font-size: 19px; letter-spacing: 1.5px; color: #ff6fd8; text-shadow: var(--outline); }
#girl-label .gl-level { font: 700 11px var(--font-body); color: #fff; text-shadow: var(--outline); letter-spacing: .5px; }

#streak { position: absolute; right: 18px; bottom: 64px; width: 250px; }
.streak-label { display: flex; justify-content: space-between; font-family: var(--font-hud); font-size: 20px; letter-spacing: 1px; color: #ffd1ec; text-shadow: var(--outline); }
.streak-bar { height: 10px; border: 2px solid #000; background: rgba(0,0,0,.5); }
#streak-fill { height: 100%; width: 0; background: linear-gradient(90deg, #ff4fa3, #b24bff); }
#streak.maxed #streak-fill { background: linear-gradient(90deg, #ffd54f, #ff8f00); }
#streak-perk { text-align: right; font-family: var(--font-hud); font-size: 16px; letter-spacing: 1px; color: #ff9ec7; text-shadow: var(--outline); margin-top: 2px; }
#streak.low #streak-fill { background: #ff1744; animation: streakblink .25s steps(2) infinite; }
@keyframes streakblink { 50% { opacity: .3; } }
/* the punch: bottom centre, always visible, lights up when someone's in reach */
#punch { position: absolute; left: 50%; bottom: 52px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; }
.punch-btn { position: relative; width: 56px; height: 56px; border: 3px solid #000; border-radius: 8px; background: rgba(255, 255, 255, .88); display: grid; place-items: center; font-size: 30px; box-shadow: 0 3px 0 rgba(0,0,0,.6); }
.punch-btn i { position: absolute; bottom: -6px; right: -6px; font: 700 15px var(--font-body); font-style: normal; background: #000; color: var(--hud-gold); padding: 0 6px; border-radius: 3px; z-index: 1; }
#punch-cd { position: absolute; left: 0; right: 0; top: 0; height: 0; background: rgba(0, 0, 0, .55); border-radius: 4px 4px 0 0; }
#punch { transition: opacity .5s, transform .5s; }
#punch.gone { opacity: 0; transform: translateX(-50%) scale(.6); pointer-events: none; }
#punch.reach .punch-btn { border-color: #ffd54f; animation: punchpulse .55s ease-in-out infinite alternate; }
@keyframes punchpulse { from { box-shadow: 0 0 6px rgba(255, 213, 79, .6), 0 3px 0 rgba(0,0,0,.6); } to { box-shadow: 0 0 18px rgba(255, 213, 79, 1), 0 3px 0 rgba(0,0,0,.6); } }
.punch-label { font-family: var(--font-hud); font-size: 24px; letter-spacing: 1px; text-shadow: var(--outline); }
#punch-hint { font: 600 14px var(--font-body); max-width: 300px; text-shadow: 0 1px 2px #000, 0 0 4px #000; }
#hud-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 18px 14px; }
#hud-passives { display: flex; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
#minimap { display: block; width: 172px; height: 172px; margin-bottom: 8px; border-radius: 50%; box-shadow: 0 3px 0 rgba(0,0,0,.5); }
@media (max-width: 700px), (max-height: 560px) { #minimap { width: 128px; height: 128px; } }
.pslot { width: 38px; height: 38px; background: rgba(0,0,0,.55); border: 2px solid #000; border-radius: 5px; display: grid; place-items: center; font-size: 20px; position: relative; }
.pslot i { position: absolute; bottom: -5px; right: -5px; font: 700 12px var(--font-body); font-style: normal; background: var(--hud-gold); color: #000; border-radius: 3px; padding: 0 3px; }
.xp-row { display: flex; align-items: center; gap: 12px; font-family: var(--font-hud); font-size: 24px; text-shadow: var(--outline); letter-spacing: 1px; }
#hud-xp { flex: 1; height: 14px; border: 3px solid #000; background: rgba(0,0,0,.5); }
#hud-xp-fill { height: 100%; width: 0; background: linear-gradient(#ffc061, #ff8a00); }
#lock-hint { position: absolute; left: 50%; top: 128px; transform: translateX(-50%); max-width: min(560px, 40vw); text-align: center; font: 600 14px var(--font-body); background: rgba(0,0,0,.6); padding: 4px 12px; border-radius: 4px; color: #fff; }
/* breaking news (a faction joins the fight, a boss turns up): a TV lower-third that slides in at the top left */
#warning { position: absolute; left: 18px; top: 16px; width: min(460px, 64vw); box-shadow: 0 6px 18px rgba(0,0,0,.5); animation: newsIn .4s cubic-bezier(.2, 1.15, .4, 1); transition: transform .4s ease-in, opacity .4s; }
#warning.out { transform: translateX(-115%); opacity: 0; }
.bn-top { display: flex; align-items: stretch; }
.bn-tag { background: #d50000; color: #fff; font-family: var(--font-hud); font-size: 19px; letter-spacing: 2px; padding: 2px 10px 0; }
.bn-live { background: #111; color: #e0e0e0; font: 700 12px 'Courier Prime', monospace; letter-spacing: 1px; padding: 6px 8px 0; }
.bn-live i { font-style: normal; color: #ff5252; animation: warnBlink 1s steps(2) infinite; }
.bn-head { background: linear-gradient(#ffffff, #e6e6e6); color: #111; border-left: 6px solid #d50000; padding: 4px 10px 2px; font-family: var(--font-hud); font-size: 25px; letter-spacing: .5px; line-height: 1.1; }
.bn-head em { font-style: normal; color: #d50000; }
#warn-body { background: rgba(10, 22, 50, .92); color: #e8eef8; border-left: 6px solid #1565c0; padding: 4px 10px 6px; font: 500 14px/1.3 var(--font-body); }
@keyframes newsIn { from { transform: translateX(-115%); } to { transform: translateX(0); } }
@keyframes warnBlink { 50% { opacity: .35; } }
/* debug readout: under the stars, top right */
#hud-fps { display: inline-block; margin-top: 6px; font: 700 12px 'Courier Prime', monospace; letter-spacing: 0; color: #fff; text-align: right; background: rgba(0,0,0,.55); padding: 2px 6px; white-space: pre; text-shadow: none; }

/* floating damage numbers & barks */
#fx-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.floater { position: absolute; left: 0; top: 0; white-space: nowrap; will-change: transform; }
.floater.dmg { font-family: var(--font-hud); font-size: 20px; color: #fff; text-shadow: var(--outline); }
.floater.dmg.big { font-size: 28px; color: var(--hud-gold); }
.floater.bark { font: 700 15px var(--font-body); color: #fff; background: rgba(0,0,0,.65); padding: 2px 8px; border-radius: 10px; }
.floater.bark.heal { color: var(--hud-green); }
.floater.bark.chatter { font-weight: 500; font-style: italic; background: rgba(255,255,255,.85); color: #222; }
.floater.bark.ko { font-family: var(--font-hud); font-size: 64px; color: #ffeb3b; background: none; text-shadow: var(--outline), 0 0 18px rgba(255, 120, 0, .9); letter-spacing: 3px; }
.floater.bark.pow { font-family: var(--font-hud); font-size: 26px; color: #fff176; background: none; text-shadow: var(--outline); letter-spacing: 1px; }
.floater.bark.honk { font-family: var(--font-hud); font-size: 22px; color: #ffeb3b; background: rgba(120, 0, 0, .75); letter-spacing: 1px; }
.floater.bark.reveal { font-family: var(--font-hud); font-size: 26px; background: linear-gradient(90deg, #ff7eb6, #6ec6ff); color: #fff; text-shadow: var(--outline); }
.floater.bark.loot-common { color: #e0e0e0; } .floater.bark.loot-rare { color: #42a5f5; }
.floater.bark.loot-epic { color: #ce5cff; } .floater.bark.loot-legendary { color: #ffb300; font-size: 18px; }
.floater.bark.girl { color: #ffd1f3; background: rgba(90, 0, 60, .7); }
.floater.bark.boss { font-family: var(--font-hud); font-size: 26px; color: #ffe0ec; background: rgba(60,0,20,.75); text-shadow: var(--outline); }

#vignette { position: fixed; inset: 0; pointer-events: none; opacity: 0; box-shadow: inset 0 0 160px 40px rgba(220, 0, 0, .75); }
#flash { position: fixed; inset: 0; pointer-events: none; background: #fff; opacity: 0; z-index: 4; }
#flash.on { animation: flash .35s ease-out; }
@keyframes flash { from { opacity: .85; } to { opacity: 0; } }
/* the knockout's "WEAPON ACQUIRED" banner: lower middle, pops in, holds, fades */
#weapon-get { position: absolute; left: 50%; top: 60%; transform: translateX(-50%); text-align: center; pointer-events: none; background: rgba(0, 0, 0, .78); border: 3px solid #ffb300; box-shadow: 0 0 30px rgba(255, 179, 0, .55); padding: 8px 26px 10px; border-radius: 6px; }
#weapon-get.on { animation: wgpop 3.2s ease-out forwards; }
@keyframes wgpop { 0% { transform: translateX(-50%) scale(.3); opacity: 0; } 10% { transform: translateX(-50%) scale(1.12); opacity: 1; } 16% { transform: translateX(-50%) scale(1); } 85% { opacity: 1; } 100% { opacity: 0; } }
.wg-tag { font-family: var(--font-hud); font-size: 22px; letter-spacing: 4px; color: #ffb300; text-shadow: var(--outline); }
.wg-row { display: flex; align-items: center; justify-content: center; gap: 12px; font-family: var(--font-hud); font-size: clamp(30px, 4.4vw, 48px); letter-spacing: 2px; color: #fff; text-shadow: var(--outline); }
#wg-icon { font-size: 1.1em; }
.wg-sub { font: 600 14px var(--font-body); color: #ddd; }
#vignette.hit { animation: hit .45s ease-out; }
@keyframes hit { from { opacity: 1; } to { opacity: 0; } }

/* ---------- cutscenes ---------- */
#letterbox { position: fixed; inset: 0; pointer-events: none; }
#letterbox .bar { position: absolute; left: 0; right: 0; height: 0; background: #000; transition: height .5s; }
#letterbox .bar.top { top: 0; }
#letterbox .bar.bottom { bottom: 0; }
#letterbox.on .bar { height: 12vh; }
#subtitle { position: absolute; left: 50%; bottom: calc(12vh + 18px); transform: translateX(-50%); width: min(980px, 90vw); text-align: center; opacity: 0; transition: opacity .3s; }
#letterbox.on #subtitle { opacity: 1; }
#sub-speaker { font: 700 16px var(--font-body); letter-spacing: 2px; margin-bottom: 4px; text-shadow: var(--outline); }
#sub-text { font: 600 25px/1.3 var(--font-body); color: #fff; text-shadow: var(--outline); min-height: 2.6em; }
.sp-fm { color: #ffb36b; } .sp-darlene { color: #ffd54f; } .sp-karen { color: #ff7aa8; } .sp-radio { color: #9fd3ff; } .sp-tip { color: #b9f6ca; }
#skip-hint { position: absolute; right: 18px; bottom: calc(12vh - 30px); font: 600 13px var(--font-body); color: #bbb; opacity: 0; }
#letterbox.on #skip-hint { opacity: 1; }

/* ---------- level up ---------- */
#levelup { position: fixed; inset: 0; background: radial-gradient(ellipse at center, rgba(0,0,0,.55), rgba(0,0,0,.85)); display: flex; flex-direction: column; align-items: center; padding: 16px; overflow-y: auto; }
#levelup > :first-child { margin-top: auto; }
#levelup > :last-child { margin-bottom: auto; }
#levelup-title { font-family: var(--font-hud); font-size: clamp(42px, 7vw, 76px); margin: 0; color: var(--hud-gold); text-shadow: var(--outline); letter-spacing: 3px; }
#levelup-sub { font-size: 18px; color: #ddd; margin-bottom: 18px; }
#levelup-cards { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.levelup-hint { margin-top: 18px; color: #aaa; font-size: 15px; }
#levelup-reroll { margin-top: 18px; font-size: 17px; padding: 8px 20px; background: #ffcc33; }
#levelup-reroll + .levelup-hint { margin-top: 10px; }
.card { width: clamp(200px, 28vw, 260px); background: var(--paper); color: var(--ink); padding: 12px 14px 10px; border: 1px solid #c9c1aa; box-shadow: 0 10px 30px rgba(0,0,0,.6); transform: rotate(-1.2deg); cursor: pointer; transition: transform .12s; display: flex; flex-direction: column; position: relative; }
.card:nth-child(2) { transform: rotate(1deg); }
.card:nth-child(3) { transform: rotate(-0.4deg); }
.card:hover { transform: rotate(0) scale(1.05); }
.masthead { font-family: 'UnifrakturMaguntia', serif; font-size: clamp(17px, 2vw, 24px); white-space: nowrap; text-align: center; border-bottom: 3px double #333; padding-bottom: 2px; }
.dateline { display: flex; justify-content: space-between; font-size: 11px; letter-spacing: 1px; border-bottom: 1px solid #333; padding: 2px 0; margin-bottom: 6px; text-transform: uppercase; }
.dateline .tag { font-weight: 700; color: #b71c1c; }
.headline { font: 700 clamp(15px, 1.7vw, 19px)/1.08 var(--font-body); text-transform: uppercase; margin-bottom: 6px; min-height: 4.4em; }
.photo { font-size: clamp(32px, 4vw, 46px); text-align: center; background: repeating-linear-gradient(45deg, #ddd6c3, #ddd6c3 3px, #e8e2d1 3px, #e8e2d1 6px); border: 1px solid #aaa; padding: 6px 0; filter: grayscale(.25); }
.desc { font-size: 15px; margin-top: 8px; line-height: 1.25; flex: 1; }
.desc b { display: block; font-size: 17px; }
.foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.rarity { font: 700 12px var(--font-body); letter-spacing: 2px; text-transform: uppercase; padding: 2px 8px; border-radius: 3px; background: #888; color: #fff; }
.key { font-family: var(--font-hud); font-size: 20px; background: #111; color: #fff; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 4px; }
.rarity-rare .rarity { background: #1976d2; } .rarity-rare { outline: 3px solid #1976d2; }
.rarity-epic .rarity { background: #8e24aa; } .rarity-epic { outline: 3px solid #8e24aa; }
.rarity-mystery .rarity { background: #455a64; letter-spacing: 4px; }
.rarity-legendary .rarity { background: #ff8f00; } .rarity-legendary { outline: 4px solid #ffb300; box-shadow: 0 0 30px rgba(255, 179, 0, .6); }
/* a weapon card's quality bonus, on top of the level-up */
.desc .bonus { display: block; margin-top: 4px; font-weight: 700; }
.rarity-rare .bonus { color: #1976d2; } .rarity-epic .bonus { color: #8e24aa; } .rarity-legendary .bonus { color: #e65100; }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; overflow: auto; }
#title { background: linear-gradient(180deg, rgba(10, 20, 40, .2), rgba(10, 5, 20, .75)); }
.title-wrap { text-align: center; max-width: 760px; }
.logo { font-family: var(--font-hud); line-height: .9; transform: rotate(-3deg); }
.logo .l1 { display: block; font-size: clamp(48px, 9vw, 104px); color: #7ef9ff; text-shadow: var(--outline), 0 0 28px rgba(0, 220, 255, .6); letter-spacing: 4px; }
.logo .l2 { display: block; font-size: clamp(70px, 14vw, 160px); color: #ff4fa3; text-shadow: var(--outline), 0 0 36px rgba(255, 60, 160, .7); letter-spacing: 6px; }
.tagline { font: 600 22px var(--font-body); letter-spacing: 6px; text-transform: uppercase; margin: 10px 0 24px; text-shadow: var(--outline); }
.buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.buttons.col { flex-direction: column; }
.btn { font: 700 20px var(--font-body); letter-spacing: 1px; text-transform: uppercase; padding: 12px 26px; border: 3px solid #000; background: #f4f1e8; color: #111; cursor: pointer; box-shadow: 0 4px 0 #000; }
.btn:hover { transform: translateY(-2px); }
.btn.primary { background: #ff4fa3; color: #fff; text-shadow: 0 2px 0 #000; }
.btn.debug { background: #ffcc33; }
#btn-endless { background: #ffcc33; color: #111; text-shadow: none; }
.controls { display: grid; grid-template-columns: repeat(3, auto); gap: 6px 22px; justify-content: center; margin: 26px 0 16px; font-size: 16px; text-shadow: var(--outline); }
.controls b { color: var(--hud-gold); }
.disclaimer { font-size: 13px; color: #ccc; max-width: 620px; margin: 10px auto 0; line-height: 1.4; text-shadow: 0 1px 0 #000; }

#pause { background: rgba(0, 0, 0, .65); }
.panel { background: #1c1c1c; border: 3px solid #000; padding: 24px 30px; min-width: min(380px, 92vw); box-shadow: 0 10px 40px rgba(0,0,0,.6); }
.panel h2 { font-family: var(--font-hud); font-size: 54px; margin: 0 0 12px; text-align: center; color: var(--hud-gold); text-shadow: var(--outline); letter-spacing: 3px; }
.panel label { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 10px 0; font-size: 17px; }
.panel input[type=range] { width: 160px; accent-color: #ff4fa3; }
.panel .small { font-size: 13px; color: #999; text-align: center; margin: 14px 0 0; }

#wasted { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--font-hud); font-size: clamp(80px, 16vw, 200px); color: #d32f2f; text-shadow: var(--outline), 0 0 40px rgba(0,0,0,.8); letter-spacing: 8px; pointer-events: none; animation: wasted 1.2s ease-out; }
@keyframes wasted { from { opacity: 0; transform: scale(1.6); } to { opacity: 1; transform: scale(1); } }

#results { background: rgba(0, 0, 0, .55); }
.paper { background: var(--paper); color: var(--ink); width: min(760px, 94vw); padding: 22px 30px 26px; box-shadow: 0 20px 60px rgba(0,0,0,.7); transform: rotate(-.6deg); }
.paper-mast { font-family: 'UnifrakturMaguntia', serif; font-size: clamp(34px, 6vw, 58px); text-align: center; border-bottom: 4px double #222; }
.paper-date { text-align: center; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; border-bottom: 1px solid #222; padding: 3px 0; }
.paper-kicker { margin-top: 14px; font: 700 14px var(--font-body); letter-spacing: 3px; color: #b71c1c; }
#res-headline { font: 700 clamp(26px, 4.2vw, 42px)/1.02 var(--font-body); text-transform: uppercase; margin: 4px 0 10px; }
.paper-sub { font-size: 17px; font-style: italic; margin: 0 0 14px; }
.paper-stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 2px solid #222; border-bottom: 2px solid #222; padding: 10px 0; margin-bottom: 12px; text-align: center; }
.paper-stats b { display: block; font: 700 30px var(--font-body); }
.paper-stats span { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: #555; }
.paper-build { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.chip { font-size: 14px; border: 1px solid #999; padding: 3px 8px; background: #fffaf0; }
.chip i { font-style: normal; font-weight: 700; color: #b71c1c; }
.paper-pocket { margin: -8px 0 16px; padding: 6px 10px; border: 1px dashed #555; font-size: 14px; }
.paper-pocket b { text-transform: uppercase; letter-spacing: 1px; font-size: 12px; margin-right: 4px; }
.paper-pocket .q-rare { color: #1565c0; } .paper-pocket .q-epic { color: #7b1fa2; } .paper-pocket .q-legendary { color: #b26a00; }
#results.won .paper-kicker { color: #2e7d32; }

#toast { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); z-index: 5; pointer-events: none; text-align: center; background: rgba(0,0,0,.82); border: 2px solid #ffcc33; padding: 6px 18px 8px; animation: toast 2.6s ease-out forwards; }
#toast-title { font-family: var(--font-hud); font-size: 28px; letter-spacing: 2px; color: #ffcc33; text-shadow: var(--outline); }
#toast-sub { font: 600 13px var(--font-body); color: #ddd; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -12px); } 10%, 75% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }
.panel label input[type=checkbox] { width: 20px; height: 20px; accent-color: #ff4fa3; margin-left: auto; }
.key-hint { font: 700 13px 'Courier Prime', monospace; background: #333; color: #ffcc33; padding: 0 6px; border-radius: 3px; }
#loading { position: fixed; inset: 0; display: grid; place-items: center; font-family: var(--font-hud); font-size: 40px; background: #000; color: #ff4fa3; padding: 16px; text-align: center; }

@media (max-width: 700px) {
  .paper-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .controls { grid-template-columns: repeat(2, auto); }
  #hud-tr { transform: scale(.8); transform-origin: top right; }
}

/* ---------- co-op ---------- */
.lobby-panel { width: min(460px, 92vw); }
.lobby-panel input[type=text] { font: 700 18px var(--font-body); letter-spacing: 1px; padding: 6px 10px; border: 3px solid #000; background: #f4f1e8; color: #111; width: 200px; }
.lobby-join { display: flex; gap: 8px; justify-content: center; }
.lobby-join input { text-transform: uppercase; text-align: center; width: 170px; }
.lobby-code-row { display: flex; justify-content: space-between; align-items: baseline; margin: 6px 0 10px; font-size: 17px; }
.lobby-code-row b { font: 400 44px var(--font-hud); letter-spacing: 6px; color: var(--hud-gold); text-shadow: var(--outline); user-select: all; }
.btn.small-btn { font-size: 14px; padding: 6px 14px; }
#lobby-players { margin: 14px 0; display: grid; gap: 6px; }
.lobby-player { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: rgba(255,255,255,.06); border-left: 4px solid var(--seat, #555); font-size: 18px; }
.lobby-player .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--seat); }
.lobby-player .nm { flex: 1; }
.lobby-player .tags i { font: 700 11px var(--font-body); font-style: normal; text-transform: uppercase; letter-spacing: 1px; background: #333; color: #ddd; padding: 1px 6px; border-radius: 3px; margin-left: 4px; }
.lobby-player.empty { color: #777; font-size: 14px; border-left-color: #333; }
#lobby-status { min-height: 1.2em; }
#lobby-status.bad { color: #ff8a80; }
.paper-wait { text-align: center; margin-top: 10px; font-style: italic; color: #555; }
/* the banner: who we're waiting on, who's down, how a revive's going */
#coop-banner { position: absolute; left: 50%; top: 92px; transform: translateX(-50%); font-family: var(--font-hud); font-size: 26px; letter-spacing: 1.5px; color: #fff; text-shadow: var(--outline); background: rgba(0,0,0,.45); padding: 2px 16px; border-radius: 4px; white-space: nowrap; }
/* the team, just above the radar (clear of the breaking news) */
#team { position: absolute; left: 18px; bottom: 280px; display: grid; gap: 6px; width: 200px; }
.tm { font-family: var(--font-hud); font-size: 19px; letter-spacing: 1px; text-shadow: var(--outline); color: var(--seat); }
.tm .bar { height: 7px; background: rgba(0,0,0,.6); border: 2px solid #000; margin-top: 1px; }
.tm .bar div { height: 100%; background: var(--hud-pink); }
.tm.down { opacity: .75; } .tm.down .bar div { background: #777; }
.tm.gone { opacity: .4; }
.tm small { font: 700 11px var(--font-body); color: #ff8a80; margin-left: 6px; letter-spacing: 1px; }
/* name tags over teammates */
#team-tags { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.team-tag { position: absolute; left: 0; top: 0; transform-origin: 50% 100%; white-space: nowrap; text-align: center; font-family: var(--font-hud); font-size: 20px; letter-spacing: 1px; color: var(--seat); text-shadow: var(--outline); will-change: transform; }
.team-tag small { display: block; font: 700 11px var(--font-body); color: #ff8a80; letter-spacing: 1px; }

/* ---------- touch screens (ui/touch.js) ----------
   Everything here hangs off html.touch, which only a touch screen gets, so desktop is untouched.
   Phones first (a landscape phone is ~390px tall); tablets get a little more room at the end. */
html:not(.touch) .touch-only, html.touch .desk-only { display: none !important; }
html.touch {
  --sat: env(safe-area-inset-top, 0px); --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px);
  --L: calc(var(--sal) + 14px); --R: calc(var(--sar) + 14px); --B: calc(var(--sab) + 12px); --gap: 12px;
  /* the right-hand cluster: the stick, then two columns of buttons */
  --cluster: calc(var(--stick) + 2 * var(--btn) + 3 * var(--gap));
  /* no pinch or double-tap zoom, pull-to-refresh, text selection or long-press menus */
  touch-action: none; overscroll-behavior: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
.touch body { overscroll-behavior: none; }
.touch #game { width: 100%; height: 100%; }
.touch input[type=text] { -webkit-user-select: text; user-select: text; touch-action: manipulation; }
/* menus that can outgrow a phone scroll up and down (and nothing else) */
.touch .screen, .touch #levelup, .touch .cp-window { touch-action: pan-y; overscroll-behavior: contain; }
.touch #cp-model { touch-action: none; }
.touch .screen { align-items: flex-start; justify-content: flex-start; padding: calc(var(--sat) + 12px) calc(var(--sar) + 12px) calc(var(--sab) + 12px) calc(var(--sal) + 12px); }
.touch .screen > * { margin: auto; } /* centred, but still scrollable when it doesn't fit */
.touch #levelup { padding: calc(var(--sat) + 10px) calc(var(--sar) + 10px) calc(var(--sab) + 10px) calc(var(--sal) + 10px); }
.touch .btn:hover { transform: none; } /* a tap leaves hover stuck on */
.rotate-hint { font: 600 16px var(--font-body); color: var(--hud-gold); text-shadow: var(--outline); margin: 12px 0 0; }
@media (orientation: landscape) { .rotate-hint { display: none !important; } }

/* the controls */
#touch { position: fixed; inset: 0; z-index: 8; pointer-events: none; }
#touch > * { position: absolute; pointer-events: auto; touch-action: none; }
#touch button { -webkit-appearance: none; appearance: none; margin: 0; cursor: pointer; }
#touch:not(.play) :is(#t-dpad, #t-stick, .t-btn), #touch:not(.play) :is(#t-pause, #t-panel), #touch.inpanel #t-sys { display: none; }
#t-sys { left: var(--L); top: calc(var(--sat) + 8px); display: flex; gap: 6px; }
.t-sys { width: 42px; height: 42px; padding: 0; border: 2px solid #000; border-radius: 8px; background: rgba(0, 0, 0, .5); color: #fff; font-size: 20px; line-height: 1; display: grid; place-items: center; }
.t-sys:active, #t-full.on { background: rgba(255, 204, 51, .8); color: #000; }
#t-skip { display: none; right: var(--R); top: calc(var(--sat) + 10px); font: 700 16px var(--font-body); letter-spacing: 1px; padding: 8px 14px; border: 2px solid #000; border-radius: 6px; background: rgba(0, 0, 0, .6); color: #fff; }
#touch.cut #t-skip { display: block; }
/* the D-pad: a GTA-pad cross, its arms lit while held */
#t-dpad { left: var(--L); bottom: var(--B); width: var(--dpad); height: var(--dpad); }
#t-dpad::before, #t-stick::before { content: ''; position: absolute; inset: -18px; border-radius: 50%; } /* a bigger target than it looks */
#t-dpad i { position: absolute; display: grid; place-items: center; font: normal 15px/1 sans-serif; color: rgba(255, 255, 255, .7); background: rgba(20, 20, 20, .45); border: 2px solid rgba(0, 0, 0, .75); pointer-events: none; }
#t-dpad .up, #t-dpad .down { left: 33%; width: 34%; height: 36%; }
#t-dpad .left, #t-dpad .right { top: 33%; width: 36%; height: 34%; }
#t-dpad .up { top: 0; border-bottom: 0; border-radius: 9px 9px 0 0; } #t-dpad .up::after { content: '▲'; }
#t-dpad .down { bottom: 0; border-top: 0; border-radius: 0 0 9px 9px; } #t-dpad .down::after { content: '▼'; }
#t-dpad .left { left: 0; border-right: 0; border-radius: 9px 0 0 9px; } #t-dpad .left::after { content: '◀'; }
#t-dpad .right { right: 0; border-left: 0; border-radius: 0 9px 9px 0; } #t-dpad .right::after { content: '▶'; }
#t-dpad .hub { left: 33%; top: 33%; width: 34%; height: 34%; border: 0; }
#t-dpad.w .up, #t-dpad.s .down, #t-dpad.a .left, #t-dpad.d .right { background: rgba(255, 204, 51, .75); color: #000; }
/* the camera stick */
#t-stick { right: var(--R); bottom: var(--B); width: var(--stick); height: var(--stick); border-radius: 50%; border: 2px solid rgba(0, 0, 0, .75); background: radial-gradient(circle, rgba(20, 20, 20, .25) 0 45%, rgba(20, 20, 20, .5) 70%); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .18); }
#t-knob { position: absolute; left: 27%; top: 27%; width: 46%; height: 46%; border-radius: 50%; border: 2px solid #000; background: radial-gradient(circle at 40% 35%, #fff, #b8b8b8); opacity: .85; pointer-events: none; }
/* the buttons, beside the stick */
.t-btn { width: var(--btn); height: var(--btn); padding: 0; border: 3px solid #000; border-radius: 50%; background: rgba(255, 255, 255, .85); color: #111; box-shadow: 0 3px 0 rgba(0, 0, 0, .6); display: grid; place-items: center; align-content: center; line-height: 1; }
.t-btn span { font-size: 24px; }
.t-btn b { font: 700 11px var(--font-body); letter-spacing: 1px; margin-top: 1px; }
.t-btn.down { transform: translateY(2px); filter: brightness(.82); box-shadow: 0 1px 0 rgba(0, 0, 0, .6); }
.t-btn.ready, #t-use { border-color: #ffd54f; animation: punchpulse .55s ease-in-out infinite alternate; }
#t-use { background: rgba(255, 213, 79, .95); }
#t-jork { background: rgba(255, 170, 210, .92); }
#t-jump { right: calc(var(--R) + var(--stick) + var(--gap)); bottom: var(--B); }
#t-use { right: calc(var(--R) + var(--stick) + var(--gap)); bottom: calc(var(--B) + var(--btn) + var(--gap)); }
#t-jork { right: calc(var(--R) + var(--stick) + 2 * var(--gap) + var(--btn)); bottom: var(--B); }
/* the punch: the HUD's own 👊, in the jork button's place (you only have fists until your first weapon) */
.touch #punch { left: auto; right: calc(var(--R) + var(--stick) + 2 * var(--gap) + var(--btn)); bottom: var(--B); transform: none; flex-direction: column-reverse; align-items: flex-end; gap: 6px; }
.touch #punch.gone { transform: scale(.6); }
.touch .punch-btn { width: var(--btn); height: var(--btn); border-radius: 50%; overflow: hidden; pointer-events: auto; touch-action: none; }
.touch .punch-btn i, .touch .punch-label { display: none; }
.touch #punch-cd { border-radius: 0; }
.touch .punch-text { text-align: right; }
.touch #punch-hint { max-width: 220px; font-size: 12.5px; }

/* the HUD, clear of the thumbs and the notch */
.touch #hud-tr { top: calc(var(--sat) + 8px); right: calc(var(--sar) + 10px); transform: scale(.55); transform-origin: top right; }
.touch #hud-bottom { left: var(--L); right: auto; top: calc(var(--sat) + 60px); bottom: auto; padding: 0; }
.touch #minimap { width: 88px; height: 88px; margin-bottom: 6px; }
.touch #hud-passives { max-width: 230px; gap: 4px; }
.touch .pslot { width: 28px; height: 28px; font-size: 15px; border-radius: 4px; }
.touch .pslot i { font-size: 10px; bottom: -4px; right: -4px; }
.touch .xp-row { position: fixed; left: calc(var(--L) + var(--dpad) + 22px); right: calc(var(--R) + var(--cluster) + 8px); bottom: calc(var(--sab) + 6px); font-size: 16px; gap: 8px; }
.touch #hud-xp { height: 10px; border-width: 2px; }
.touch #team { left: calc(var(--L) + var(--dpad) + 22px); right: calc(var(--R) + var(--cluster) + 8px); bottom: calc(var(--sab) + 32px); width: auto; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 4px 10px; }
.touch .tm { font-size: 14px; } .touch .tm .bar { height: 5px; }
.touch #streak { right: var(--R); bottom: calc(var(--B) + var(--stick) + var(--gap) + 6px); width: 190px; }
.touch .streak-label { font-size: 16px; }
.touch #hud-prompt { bottom: calc(var(--B) + var(--stick) + 56px); max-width: min(520px, calc(100vw - var(--L) - var(--R) - 2 * var(--dpad))); font-size: 16px; padding: 6px 12px; pointer-events: auto; touch-action: none; }
.touch #hud-prompt small { font-size: 11.5px; }
.touch #hud-boss { top: calc(var(--sat) + 6px); width: min(560px, 46vw); }
.touch .boss-name { font-size: 20px; } .touch .boss-name small { font-size: 11px; }
.touch .boss-bar { height: 11px; border-width: 2px; }
.touch #warning { left: calc(var(--L) + 196px); top: calc(var(--sat) + 8px); width: min(400px, calc(100vw - var(--L) - var(--R) - 196px - 170px)); }
.touch .bn-tag { font-size: 15px; } .touch .bn-live { font-size: 10px; padding-top: 4px; }
.touch .bn-head { font-size: 18px; } .touch #warn-body { font-size: 12px; }
.touch #coop-banner { top: calc(var(--sat) + 70px); font-size: 18px; }
.touch .pack-label .pl-name { font-size: 17px; }
.touch #toast { top: calc(var(--sat) + 10px); max-width: 86vw; }
.touch #toast-title { font-size: 22px; }
.touch #sub-text { font-size: 18px; } .touch #sub-speaker { font-size: 13px; }
.touch #skip-hint { right: var(--R); }
.touch .cp-x { width: 40px; height: 40px; font-size: 18px; }

/* the character panel: a tap picks an item and its tooltip carries the buttons */
#cp-tip.tap { pointer-events: auto; max-width: min(320px, 92vw); }
.cp-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cp-acts button { font: 700 14px var(--font-body); letter-spacing: .5px; text-transform: uppercase; padding: 8px 12px; border: 2px solid #000; background: #f4f1e8; color: #111; cursor: pointer; }
.cp-acts button.bad { background: #c62828; color: #fff; }
.cp-slot.picked { outline: 2px solid #fff; outline-offset: 1px; }

/* a short screen: a landscape phone */
@media (max-height: 520px) {
  .touch .logo .l1 { font-size: 38px; } .touch .logo .l2 { font-size: 60px; }
  .touch .tagline { font-size: 14px; margin: 4px 0 10px; }
  .touch .btn { font-size: 15px; padding: 8px 14px; }
  .touch .controls { margin: 10px 0 6px; font-size: 13px; grid-template-columns: repeat(4, auto); }
  .touch .disclaimer { font-size: 11px; margin-top: 4px; }
  .touch .panel { padding: 12px 18px; }
  .touch .panel h2 { font-size: 34px; margin-bottom: 4px; }
  .touch .panel label { margin: 5px 0; font-size: 15px; }
  .touch #pause .buttons.col { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .touch .lobby-code-row b { font-size: 32px; }
  .touch #lobby-players { margin: 8px 0; }
  .touch #levelup-title { font-size: 32px; }
  .touch #levelup-sub { font-size: 14px; margin-bottom: 8px; }
  .touch #levelup-cards { gap: 10px; flex-wrap: nowrap; }
  .touch .card { width: clamp(150px, 30vw, 230px); padding: 8px 10px; }
  .touch .masthead { font-size: 15px; }
  .touch .dateline { font-size: 9px; margin-bottom: 4px; }
  .touch .headline { font-size: 13.5px; min-height: 0; margin-bottom: 4px; }
  .touch .photo { font-size: 24px; padding: 2px 0; }
  .touch .desc { font-size: 12.5px; margin-top: 5px; } .touch .desc b { font-size: 14px; }
  .touch .foot { margin-top: 5px; } .touch .key { display: none; }
  .touch .levelup-hint, .touch #levelup-reroll { margin-top: 8px; }
  .touch .paper { padding: 12px 18px 14px; }
  .touch .paper-mast { font-size: 30px; }
  .touch #res-headline { font-size: 22px; margin-bottom: 6px; }
  .touch .paper-sub { font-size: 14px; margin-bottom: 8px; }
  .touch .paper-stats { padding: 5px 0; margin-bottom: 8px; } .touch .paper-stats b { font-size: 22px; }
  .touch .paper-build { margin-bottom: 10px; }
  .touch #charpanel { padding: calc(var(--sat) + 4px) calc(var(--sar) + 4px) calc(var(--sab) + 4px) calc(var(--sal) + 4px); }
  .touch .cp-window { padding: 6px 10px; }
  .touch .cp-name { font-size: 24px; }
  .touch .cp-body { grid-template-columns: auto 1fr; gap: 10px; } /* side by side, even on a narrow phone */
  .touch .cp-model { height: 132px; }
  .touch .cp-doll { grid-template-columns: 44px 130px 44px; gap: 6px; }
  .touch .cp-stats { font-size: 11.5px; padding: 4px 10px; }
  .touch .cp-bag { margin-top: 4px; }
  .touch .cp-slot { width: 44px; height: 44px; font-size: 22px; }
  .touch .cp-grid { grid-template-columns: repeat(auto-fill, 44px); gap: 6px; }
}

/* a phone held upright: the buttons go in a row over the stick, and the bars over the controls */
@media (orientation: portrait) {
  .touch { --row: calc(var(--B) + var(--dpad) + var(--gap)); --ctop: calc(var(--row) + var(--btn)); }
  .touch #t-jump { right: var(--R); bottom: var(--row); }
  .touch #t-use { right: calc(var(--R) + var(--btn) + var(--gap)); bottom: var(--row); }
  .touch #t-jork, .touch #punch { right: calc(var(--R) + 2 * (var(--btn) + var(--gap))); bottom: var(--row); }
  .touch .xp-row { left: var(--L); right: var(--R); bottom: calc(var(--ctop) + 6px); }
  .touch #team { left: var(--L); right: calc(var(--R) + 200px); bottom: calc(var(--ctop) + 32px); }
  .touch #streak { bottom: calc(var(--ctop) + 32px); }
  .touch #hud-prompt { bottom: calc(var(--ctop) + 150px); max-width: calc(100vw - var(--L) - var(--R)); }
  .touch #warning { left: var(--L); top: calc(var(--sat) + 190px); width: min(460px, calc(100vw - var(--L) - var(--R))); }
}

/* a tablet: room for a bigger HUD */
@media (min-width: 700px) and (min-height: 600px) {
  .touch #hud-tr { transform: scale(.85); }
  .touch #minimap { width: 128px; height: 128px; }
  .touch #warning { width: min(460px, calc(100vw - var(--L) - var(--R) - 196px - 230px)); }
}
