/* Hobley Kart 64 shell (builder S). N64 menus: a bright sky, a scrolling checker floor, chunky bevelled boxes with a
   white rim and a dark outline, bitmap-font headings (js/ui/pixel.js) and bold primaries. No web fonts. */
:root {
  --ink: #140a2a; --sky1: #3fb4ff; --sky2: #bdeeff; --navy: #1b2a8c; --navy2: #101a5c; --deep: #0c0a26;
  --red: #ff3b30; --yel: #ffcc00; --grn: #34c759; --blu: #2f8cff; --pnk: #ff2d92; --org: #ff9500;
  --txt: #ffffff; --dim: #b9c6ff; --mut: #8090d0;
  --chunk: "Arial Black", "Arial Bold", Gadget, Impact, sans-serif;
  --body: "Trebuchet MS", "Verdana", Arial, sans-serif;
  --strip-top: 0px; --strip-bot: 0px; --cam-w: 112px; --cam-h: 84px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: var(--deep); color: var(--txt); font: 15px/1.4 var(--body); -webkit-tap-highlight-color: transparent; }
body.booting > *:not(#loading):not(#menubg) { visibility: hidden; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; }
kbd { display: inline-block; min-width: 1.6em; padding: 1px 6px; margin: 0 2px; border: 2px solid var(--ink); border-bottom-width: 4px; border-radius: 5px; background: #f4f0ff; color: var(--ink);
  font: 12px/1.3 var(--chunk); text-align: center; -webkit-font-smoothing: none; }
a { color: var(--yel); }
.ic { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
svg.px { display: block; height: 100%; width: auto; overflow: visible; }

/* ---------- the menu background: sky, clouds, hills, checker floor */
#menubg { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: linear-gradient(var(--sky1), var(--sky2) 62%); }
body.in-game #menubg { display: none; }
.mb-clouds { position: absolute; left: 0; right: -1400px; top: 4%; height: 40%; opacity: .95; will-change: transform;
  background:
    radial-gradient(60px 26px at 12% 30%, #fff 96%, transparent), radial-gradient(90px 34px at 18% 36%, #fff 96%, transparent),
    radial-gradient(70px 28px at 52% 18%, #fff 96%, transparent), radial-gradient(110px 36px at 58% 24%, #fff 96%, transparent),
    radial-gradient(60px 22px at 84% 40%, #fff 96%, transparent), radial-gradient(80px 30px at 90% 45%, #fff 96%, transparent);
  background-size: 1400px 100%; background-repeat: repeat-x; animation: clouds 90s linear infinite; image-rendering: pixelated; }
@keyframes clouds { to { transform: translateX(-1400px); } }
.mb-hills { position: absolute; left: -5%; right: -5%; bottom: 34%; height: 22%;
  background: radial-gradient(48% 120% at 18% 100%, #2fa84a 98%, transparent), radial-gradient(40% 100% at 62% 100%, #3cbf55 98%, transparent), radial-gradient(36% 140% at 95% 100%, #279a40 98%, transparent); }
.mb-floor { position: absolute; left: -50%; right: -50%; bottom: -10%; height: 46%; transform-origin: 50% 0; transform: perspective(380px) rotateX(58deg);
  overflow: hidden; border-top: 6px solid #fff;
  -webkit-mask: linear-gradient(transparent, #000 25%); mask: linear-gradient(transparent, #000 25%); }
/* the checker scrolls by transform (compositor only, no repaint per frame) */
.mb-floor::before { content: ''; position: absolute; left: 0; right: 0; top: -80px; bottom: 0; will-change: transform;
  background: repeating-conic-gradient(#ffffff 0 25%, #1c1c2c 0 50%) 0 0 / 80px 80px; animation: floor 1.2s linear infinite; }
@keyframes floor { from { transform: translateY(0); } to { transform: translateY(80px); } }

/* ---------- screens */
#scene { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 1; display: none; background: #000; }
body.in-game #scene { display: block; }
.screen { position: fixed; inset: 0; z-index: 2; overflow: auto; }
.menu-wrap { max-width: 1240px; margin: 0 auto; padding: 26px 28px 40px; }
.menu-wrap.narrow { max-width: 460px; padding-top: 7vh; }
#bootLayer { position: fixed; inset: 0; z-index: 80; background: #000; }

/* the logo */
.logo { text-align: center; margin-bottom: 22px; filter: drop-shadow(0 6px 0 rgba(20, 10, 42, .35)); }
.logo .logo-k { height: 30px; display: flex; justify-content: center; margin-bottom: 6px; }
.logo .logo-main { height: 92px; display: flex; justify-content: center; animation: bob 2.6s ease-in-out infinite; }
.logo-tag { margin-top: 12px; font: 15px var(--chunk); color: var(--ink); text-shadow: 0 2px 0 #fff8; letter-spacing: .5px; -webkit-font-smoothing: none; }
.logo.small { margin: 0; text-align: left; }
.logo.small .logo-main { height: 46px; justify-content: flex-start; animation: none; }
@keyframes bob { 50% { transform: translateY(-5px) rotate(-1deg); } }

/* ---------- the N64 box */
.card { position: relative; background: linear-gradient(#2b44c4, var(--navy) 40%, var(--navy2)); border: 3px solid #fff; border-radius: 10px; padding: 18px 20px;
  box-shadow: 0 0 0 3px var(--ink), 6px 8px 0 3px rgba(20, 10, 42, .45), inset 0 3px 0 rgba(255, 255, 255, .25), inset 0 -4px 0 rgba(0, 0, 0, .25); margin-bottom: 18px; }
.card h3 { margin: 0 0 14px; height: 26px; display: flex; }
.card h3.sub { height: auto; font: 14px var(--chunk); color: var(--yel); margin: 18px 0 8px; -webkit-font-smoothing: none; }
.card h5, .tab h5, .lbx h5 { margin: 14px 0 8px; font: 13px var(--chunk); color: var(--yel); text-transform: uppercase; letter-spacing: 1px; -webkit-font-smoothing: none; }
label { display: block; margin: 0 0 12px; font: 13px var(--chunk); color: var(--dim); -webkit-font-smoothing: none; }
input:not([type]), input[type=password], input[type=text] { display: block; width: 100%; margin-top: 5px; padding: 10px 12px; border: 3px solid var(--ink); border-radius: 7px;
  background: #f4f6ff; color: var(--ink); font: 16px var(--chunk); box-shadow: inset 0 3px 0 rgba(0, 0, 0, .15); outline: none; }
input::placeholder { color: #9aa2c8; font-family: var(--body); font-weight: normal; }
input:focus { border-color: var(--yel); box-shadow: 0 0 0 3px var(--ink), inset 0 3px 0 rgba(0, 0, 0, .15); }
.err { color: #ffd0cc; background: rgba(255, 59, 48, .25); border-radius: 6px; padding: 0 8px; min-height: 0; margin: 4px 0 10px; font-weight: bold; }
.err:empty { display: none; }
.fine { color: var(--dim); font-size: 12.5px; margin: 10px 0 0; }
.arcade-link { display: inline-block; margin-top: 14px; font: 13px var(--chunk); -webkit-font-smoothing: none; }
.invite-note { background: var(--yel); color: var(--ink); padding: 10px 12px; border-radius: 7px; font-weight: bold; border: 3px solid var(--ink); }

/* chunky buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border: 3px solid var(--ink); border-radius: 8px; cursor: pointer;
  background: linear-gradient(#f4f6ff, #c4ccf0); color: var(--ink); font: 14px var(--chunk); letter-spacing: .3px; text-transform: uppercase;
  box-shadow: 0 4px 0 var(--ink), inset 0 2px 0 #fff; transition: transform .06s, box-shadow .06s; -webkit-font-smoothing: none; white-space: nowrap; }
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink), inset 0 2px 0 #fff; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: linear-gradient(#ffe46a, var(--yel) 50%, #f0a800); }
.btn.danger { background: linear-gradient(#ff8a80, var(--red)); color: #fff; }
.btn.big { width: 100%; padding: 13px; font-size: 17px; }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.btn.wide { width: 100%; margin-top: 10px; }
.btn kbd { margin-left: 4px; }

.tabs2 { display: flex; gap: 8px; margin-bottom: 16px; }
.tabs2 button { flex: 1; padding: 9px; border: 3px solid var(--ink); border-radius: 8px; background: var(--navy2); color: var(--dim); font: 14px var(--chunk); cursor: pointer; -webkit-font-smoothing: none; }
.tabs2 button.on { background: var(--red); color: #fff; box-shadow: inset 0 3px 0 rgba(255, 255, 255, .3); }
#authForm .reg-only { display: none; }
#authForm.register .reg-only { display: block; }

/* segmented choices */
.seg { display: inline-flex; flex-wrap: wrap; gap: 0; border: 3px solid var(--ink); border-radius: 8px; overflow: hidden; background: var(--ink); }
.seg button { padding: 7px 12px; border: 0; background: #2a3a9c; color: var(--dim); font: 12.5px var(--chunk); cursor: pointer; -webkit-font-smoothing: none; border-right: 2px solid var(--ink); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: linear-gradient(#ffe46a, var(--yel)); color: var(--ink); }
.seg.ro button { cursor: default; }
.seg.ro button:not(.on) { opacity: .55; }
.mode-seg { margin-bottom: 12px; display: flex; }
.mode-seg button { flex: 1; }

.tog { display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--txt); }
.tog input { display: none; }
.tog i { width: 42px; height: 24px; border-radius: 14px; background: #0a0f3a; border: 3px solid var(--ink); position: relative; flex: none; }
.tog i::after { content: ''; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--mut); transition: left .12s; }
.tog input:checked + i { background: var(--grn); }
.tog input:checked + i::after { left: 20px; background: #fff; }

/* ---------- lobby browser */
.mtop { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.mtop .logo { flex: 1; }
.me-chip { display: flex; gap: 12px; align-items: center; padding: 8px 14px; background: var(--ink); border: 3px solid #fff; border-radius: 10px; font: 13px var(--chunk); -webkit-font-smoothing: none; }
.me-chip span { color: var(--yel); }
.me-chip a { color: var(--dim); text-decoration: none; }
.lb-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 22px; }
.chars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.chars button { display: flex; flex-direction: column; align-items: stretch; text-align: left; padding: 6px 6px 10px; border: 3px solid var(--ink); border-radius: 9px; cursor: pointer;
  background: #0d1650; box-shadow: 0 4px 0 var(--ink); transition: transform .1s; }
.chars button canvas { width: 100%; aspect-ratio: 6 / 5; height: auto; border-radius: 5px; background: #5ec8ff; image-rendering: auto; }
.chars button b { font: 17px var(--chunk); margin: 8px 4px 2px; -webkit-font-smoothing: none; }
.chars button span { font-size: 12px; color: var(--dim); margin: 0 4px; }
.chars button.on { background: linear-gradient(#ff5a4a, #c01810); transform: translateY(-3px); box-shadow: 0 0 0 3px var(--yel), 0 7px 0 var(--ink); }
.chars button.on span { color: #ffe0dc; }
.row-btns { display: flex; gap: 12px; align-items: center; margin-top: 14px; }
.row-btns .fine { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
.st { background: rgba(0, 0, 0, .28); border: 2px solid rgba(255, 255, 255, .18); border-radius: 8px; padding: 9px 10px; }
.st b { display: block; font: 21px var(--chunk); color: var(--yel); -webkit-font-smoothing: none; }
.st span { font-size: 11.5px; color: var(--dim); text-transform: uppercase; letter-spacing: .5px; }
.st.wide { grid-column: span 4; }
.lobby-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; max-height: 300px; overflow: auto; }
.lobby-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: rgba(0, 0, 0, .28); border: 2px solid rgba(255, 255, 255, .2); border-radius: 9px; }
.lobby-list li.empty { justify-content: center; color: var(--dim); font: 14px var(--chunk); padding: 22px; -webkit-font-smoothing: none; }
.ll-main { flex: 1; min-width: 0; }
.ll-main b { font: 15px var(--chunk); -webkit-font-smoothing: none; }
.ll-main .meta { font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ll-main em { font-style: normal; color: var(--grn); }
.ll-main em.live { color: var(--org); }
.ll-count { font: 13px var(--chunk); color: var(--dim); }
.ll-count b { color: #fff; font-size: 17px; }
.row { display: flex; gap: 10px; }
.code-in { text-transform: uppercase; letter-spacing: 6px; font-size: 20px !important; margin-top: 0 !important; }
.lb-notice { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; padding: 10px 14px; background: var(--yel); color: var(--ink); border: 3px solid var(--ink); border-radius: 9px; font-weight: bold; }
.lb-notice span { flex: 1; }
.lb-notice button { background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--ink); }
.touch-note { padding: 10px 14px; background: var(--red); border: 3px solid var(--ink); border-radius: 9px; margin-bottom: 16px; font-weight: bold; }
.howto-card summary { cursor: pointer; font: 16px var(--chunk); color: var(--yel); -webkit-font-smoothing: none; }
.howto-card[open] summary { margin-bottom: 14px; }

/* ---------- how to play */
.howto { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 16px; }
.ht { background: rgba(0, 0, 0, .25); border-radius: 9px; padding: 12px 14px; border: 2px solid rgba(255, 255, 255, .14); }
.ht h4 { margin: 0 0 10px; height: 18px; display: flex; }
.ht p { font-size: 13px; color: #dfe5ff; margin: 8px 0; }
.ht .kr { display: flex; gap: 10px; font-size: 12.5px; margin: 5px 0; }
.ht .kr b { flex: 0 0 96px; color: var(--yel); }
.ht .kr span { color: #dfe5ff; }
.ht .keys kbd { margin: 2px 4px 2px 0; }
table.ctl { border-collapse: collapse; width: 100%; font-size: 12.5px; }
table.ctl th { text-align: left; color: var(--mut); font: 11px var(--chunk); text-transform: uppercase; padding: 2px 4px; }
table.ctl td { padding: 3px 4px; vertical-align: top; color: #dfe5ff; }
table.ctl kbd { font-size: 11px; white-space: nowrap; }

/* ---------- in game */
#game { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
#game > * { pointer-events: auto; }
body.in-game .screen.menu { display: none; }
/* builder E's HUD: keep its top row under the cam strip */
body .hk-hud { --hk-top: calc(var(--strip-top) + 12px) !important; }
.net-pill { position: fixed; left: 50%; top: calc(var(--strip-top) + 70px); transform: translateX(-50%); z-index: 30; padding: 8px 18px; background: var(--red); border: 3px solid #fff;
  box-shadow: 0 0 0 3px var(--ink); border-radius: 20px; font: 14px var(--chunk); -webkit-font-smoothing: none; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .6; } }

/* cam strip */
.camstrip { position: fixed; left: 12px; right: 128px; display: flex; gap: 6px; z-index: 20; pointer-events: none; justify-content: center; }
.camstrip-top { top: 8px; }
.camstrip-bot { bottom: 8px; }
.camstrip.off { display: none; }
.cam-tile { position: relative; width: var(--cam-w); height: var(--cam-h); border-radius: 7px; overflow: hidden; background: var(--pc, #555);
  border: 3px solid var(--pc, #888); box-shadow: 0 0 0 2px var(--ink), 0 3px 0 2px rgba(0, 0, 0, .4); pointer-events: auto; transition: filter .3s, opacity .3s; }
.cam-init { position: absolute; inset: 0; display: grid; place-items: center; font: calc(var(--cam-h) * .5) var(--chunk); color: rgba(255, 255, 255, .85); text-shadow: 3px 3px 0 var(--ink);
  background: linear-gradient(rgba(255, 255, 255, .2), rgba(0, 0, 0, .3)); -webkit-font-smoothing: none; }
.cam-cv { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; image-rendering: auto; filter: saturate(1.15) contrast(1.05) blur(.35px); }
.cam-tile.live .cam-cv { opacity: 1; }
.cam-tile.live .cam-init { display: none; }
.cam-name { position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 5px; background: linear-gradient(transparent, rgba(0, 0, 0, .75)); font: 11px var(--chunk); display: flex; gap: 3px; align-items: center;
  white-space: nowrap; overflow: hidden; -webkit-font-smoothing: none; text-shadow: 1px 1px 0 #000; }
.cam-crown { display: none; color: var(--yel); }
.cam-crown .ic { width: 12px; height: 12px; }
.cam-tile.host .cam-crown { display: inline; }
.cam-mute { position: absolute; right: 3px; top: 3px; display: none; color: #fff; background: var(--red); border-radius: 50%; padding: 2px; }
.cam-mute .ic { width: 12px; height: 12px; display: block; }
.cam-tile.muted .cam-mute { display: block; }
.cam-eq { position: absolute; left: 4px; top: 4px; display: none; gap: 2px; align-items: flex-end; height: 12px; }
.cam-eq i { width: 3px; height: 12px; background: var(--grn); transform-origin: 50% 100%; animation: eq .4s ease-in-out infinite alternate; will-change: transform; }
.cam-eq i:nth-child(2) { animation-delay: .13s; } .cam-eq i:nth-child(3) { animation-delay: .26s; }
@keyframes eq { from { transform: scaleY(.25); } to { transform: scaleY(1); } }
.cam-tile.speaking { box-shadow: 0 0 0 2px var(--ink), 0 0 0 5px var(--grn), 0 3px 0 5px rgba(0, 0, 0, .4); }
.cam-tile.speaking .cam-eq { display: flex; }
.cam-tile.away { opacity: .45; }
.cam-tile.ghost { filter: grayscale(1) brightness(.9); }
.cam-pos { position: absolute; right: 3px; bottom: 15px; font: 15px var(--chunk); color: #fff; text-shadow: 2px 2px 0 var(--ink), -1px -1px 0 var(--ink); -webkit-font-smoothing: none; }
.cam-tile.pos-1 .cam-pos { color: var(--yel); } .cam-tile.pos-2 .cam-pos { color: #dfe6f0; } .cam-tile.pos-3 .cam-pos { color: #ffab5a; }
.cam-tile.me { border-color: #fff; }
.cam-dock { position: fixed; right: 12px; top: 10px; z-index: 21; display: flex; gap: 6px; }
.cam-dock button { width: 34px; height: 34px; display: grid; place-items: center; border: 3px solid var(--ink); border-radius: 8px; background: #f4f6ff; color: var(--ink); cursor: pointer; box-shadow: 0 3px 0 var(--ink); }
.cam-dock button.on { background: var(--grn); color: #fff; }
.cam-dock button.muted { background: var(--red); color: #fff; }

/* the shell overlay: warm-up pill, start pill, countdown, toasts */
.ov { position: fixed; inset: 0; z-index: 15; pointer-events: none; }
.ov-top { position: absolute; left: 0; right: 0; top: calc(var(--strip-top) + 10px); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ov .warm-pill, .ov .start-cta { display: none; }
.ov.phase-lobby .warm-pill { display: flex; }
.ov.phase-lobby:not(.cd-on) .start-cta { display: block; }
.warm-pill { align-items: center; gap: 10px; padding: 6px 14px 6px 6px; background: rgba(20, 10, 42, .82); border: 3px solid #fff; border-radius: 22px; box-shadow: 0 0 0 3px var(--ink); font-size: 13px; }
.warm-pill b { background: var(--grn); color: #fff; font: 12px var(--chunk); padding: 3px 10px; border-radius: 14px; border: 2px solid var(--ink); -webkit-font-smoothing: none; }
.start-cta { pointer-events: auto; }
.start-cta .btn.start { font-size: 20px; padding: 12px 24px; background: linear-gradient(#ff8070, var(--red) 55%, #b81008); color: #fff; text-shadow: 2px 2px 0 var(--ink);
  box-shadow: 0 0 0 3px #fff, 0 6px 0 3px var(--ink); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.05); } }
.start-cta .sc-inv { flex-direction: column; gap: 0; text-transform: none; padding: 9px 18px; }
.start-cta .sc-inv small { font: 11px var(--body); opacity: .7; }
.sc-w { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: rgba(20, 10, 42, .82); border: 3px solid #fff; border-radius: 22px; box-shadow: 0 0 0 3px var(--ink); font-size: 14px; }
.sc-w i { width: 10px; height: 10px; border-radius: 50%; background: var(--yel); animation: blink .8s steps(2) infinite; }
.sc-w b { color: var(--yel); }
.cdown { display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: auto; }
.cdown.in { animation: pop .4s ease-out; }
@keyframes pop { 0% { transform: scale(.3); opacity: 0; } 70% { transform: scale(1.1); } 100% { transform: scale(1); } }
.cd-dial { position: relative; width: 128px; height: 128px; }
.cd-dial.tick { animation: tick .3s ease-out; }
@keyframes tick { 0% { transform: scale(1.18); } 100% { transform: scale(1); } }
.cd-ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.cd-track { fill: rgba(20, 10, 42, .85); stroke: #fff; stroke-width: 10; }
.cd-arc { fill: none; stroke: var(--yel); stroke-width: 10; stroke-linecap: butt; transition: stroke-dashoffset .1s linear; }
.cdown.final .cd-arc { stroke: var(--red); }
.cd-in { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.cd-in small { font: 11px var(--chunk); color: var(--dim); -webkit-font-smoothing: none; }
.cd-in b { height: 44px; display: flex; }
.cd-sub { font: 13px var(--chunk); color: #fff; text-shadow: 2px 2px 0 var(--ink); -webkit-font-smoothing: none; }
.toasts { position: absolute; left: 50%; bottom: calc(var(--strip-bot) + 130px); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.toast { padding: 8px 16px; background: var(--ink); border: 3px solid var(--yel); border-radius: 9px; font: 14px var(--chunk); -webkit-font-smoothing: none; animation: pop .25s ease-out; transition: opacity .4s, transform .4s; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* chat feed */
.chatfeed { position: fixed; left: 14px; bottom: calc(var(--strip-bot) + 150px); width: 340px; z-index: 16; pointer-events: none; }
.cf-log { max-height: 180px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; }
.cf-log .m { font-size: 13.5px; text-shadow: 1px 1px 0 #000, 0 0 3px #000; transition: opacity 1s; }
.cf-log .m.sys { color: var(--yel); }
.cf-log .m.old { opacity: 0; }
.chatfeed.typing .cf-log .m.old { opacity: 1; }
.cf-form { display: flex; align-items: center; gap: 6px; margin-top: 6px; opacity: 0; pointer-events: auto; }
.chatfeed.typing .cf-form { opacity: 1; }
.cf-form input { flex: 1; padding: 6px 9px; border-radius: 7px; border: 3px solid var(--ink); background: #f4f6ff; color: var(--ink); font: 13px var(--body); }
body.menu-open .chatfeed { display: none; }

/* ---------- the lobby panel */
.panel-ov { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(12, 10, 38, .55); padding: calc(var(--strip-top) + 8px) 18px calc(var(--strip-bot) + 14px); }
.pn { width: min(1220px, 100%); max-height: 100%; display: flex; flex-direction: column; background: linear-gradient(#2b44c4, var(--navy) 22%, var(--navy2)); border: 3px solid #fff; border-radius: 12px;
  box-shadow: 0 0 0 3px var(--ink), 8px 10px 0 3px rgba(0, 0, 0, .4), inset 0 3px 0 rgba(255, 255, 255, .25); overflow: hidden; }
.pn-head { display: flex; align-items: center; gap: 14px; padding: 12px 16px; background: rgba(0, 0, 0, .25); border-bottom: 3px solid var(--ink); }
.pn-logo { height: 30px; display: flex; }
.pn-lobby { display: flex; flex-direction: column; min-width: 0; }
.pn-lobby b { font: 17px var(--chunk); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -webkit-font-smoothing: none; }
.pn-lobby span { font-size: 12.5px; color: var(--dim); }
.code-chip { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border: 3px solid var(--ink); border-radius: 9px; background: var(--yel); color: var(--ink); cursor: pointer; box-shadow: 0 3px 0 var(--ink); }
.code-chip small { font: 10px var(--chunk); -webkit-font-smoothing: none; }
.code-chip b { font: 21px var(--chunk); letter-spacing: 4px; -webkit-font-smoothing: none; }
.code-chip.copied { background: var(--grn); color: #fff; }
.code-chip.copied .chip-copy::after { content: ' ✓'; }
.pn-head .sp { flex: 1; }
.btn.ghost-btn { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .5); box-shadow: none; }
.btn.play { background: linear-gradient(#7af08a, var(--grn)); color: var(--ink); }
.pn-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 270px 1fr 300px; }
.pn-col { padding: 14px 16px; min-height: 0; overflow: auto; }
.pn-players { border-right: 3px solid var(--ink); background: rgba(0, 0, 0, .15); }
.pn-chat { border-left: 3px solid var(--ink); background: rgba(0, 0, 0, .15); display: flex; flex-direction: column; }
.pn-voice { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.vbtn { flex: 1; padding: 7px 8px; font-size: 11.5px; }
.pn-h { display: flex; justify-content: space-between; align-items: baseline; margin: 6px 0 8px; }
.pn-h b { font: 13px var(--chunk); color: var(--yel); letter-spacing: 1px; -webkit-font-smoothing: none; }
.pn-h span { font: 12px var(--chunk); color: var(--dim); }
.plist { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.plist li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: rgba(0, 0, 0, .25); border: 2px solid transparent; }
.plist li.me { border-color: rgba(255, 255, 255, .35); }
.plist li.speaking { border-color: var(--grn); }
.plist li.away { opacity: .5; }
.pdot { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; font: 14px var(--chunk); color: #fff; text-shadow: 1px 1px 0 var(--ink); border: 2px solid var(--ink); flex: none; font-style: normal; }
.pdot.sm { width: 14px; height: 14px; display: inline-block; vertical-align: -2px; margin-right: 6px; border-width: 2px; }
.pdot.big { width: 54px; height: 54px; font-size: 28px; border-width: 3px; }
.pwho { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pwho b { font: 13.5px var(--chunk); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -webkit-font-smoothing: none; }
.pwho small { color: var(--dim); font-family: var(--body); font-weight: normal; }
.pwho span { font-size: 11.5px; color: var(--dim); }
.crown { color: var(--yel); }
.pmic.on { color: var(--grn); } .pmic.off { color: var(--mut); } .pmic.muted { color: var(--red); }
.pcam { color: var(--blu); }
.kick, .hostto { background: none; border: 0; color: var(--mut); cursor: pointer; padding: 2px; }
.kick:hover { color: var(--red); } .hostto:hover { color: var(--yel); }
.charsw { display: flex; gap: 6px; }
.charsw button { flex: 1; padding: 7px 4px; border: 3px solid var(--ink); border-radius: 8px; background: #0d1650; color: var(--dim); font: 12px var(--chunk); cursor: pointer; -webkit-font-smoothing: none; }
.charsw button.on { background: var(--red); color: #fff; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { display: flex; align-items: center; gap: 7px; padding: 8px 13px; border: 3px solid var(--ink); border-radius: 8px; background: #0d1650; color: var(--dim); font: 13px var(--chunk); cursor: pointer; -webkit-font-smoothing: none; }
.tabs button.on { background: linear-gradient(#ffe46a, var(--yel)); color: var(--ink); box-shadow: 0 3px 0 var(--ink); }
.tab { display: none; }
.tab.on { display: block; }
.mform { display: flex; flex-direction: column; gap: 9px; }
.mrow { display: flex; align-items: center; gap: 12px; }
.mrow > span { flex: 0 0 64px; font: 12.5px var(--chunk); color: var(--dim); -webkit-font-smoothing: none; }
.cta { margin-top: 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.cta .btn.start { font-size: 19px; padding: 12px 22px; background: linear-gradient(#ff8070, var(--red) 55%, #b81008); color: #fff; text-shadow: 2px 2px 0 var(--ink); }
.cta .btn.start.cancel-cd { background: linear-gradient(#ffe46a, var(--yel)); color: var(--ink); text-shadow: none; }
.cta-note { flex-basis: 100%; font-size: 12.5px; color: var(--dim); }
.wait { padding: 12px 16px; background: rgba(0, 0, 0, .28); border-radius: 9px; border: 2px dashed rgba(255, 255, 255, .3); font-size: 14px; }
.wait b { color: var(--yel); }
.wait small { color: var(--dim); }
.chatlog { flex: 1; min-height: 120px; overflow: auto; display: flex; flex-direction: column; gap: 4px; font-size: 13px; padding-right: 4px; }
.chatlog .m.sys { color: var(--yel); font-size: 12.5px; }
.chatform { display: flex; gap: 6px; margin-top: 8px; }
.chatform input { flex: 1; padding: 7px 9px; border-radius: 7px; border: 3px solid var(--ink); background: #f4f6ff; color: var(--ink); font: 13px var(--body); margin: 0; }
.set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.rng { display: grid; grid-template-columns: 70px 1fr 44px; align-items: center; gap: 10px; margin: 0 0 8px; color: var(--txt); }
.rng b { font: 12px var(--chunk); color: var(--yel); text-align: right; }
.rng input { accent-color: var(--yel); }
.padtest { background: rgba(0, 0, 0, .28); border-radius: 9px; padding: 10px; border: 2px solid rgba(255, 255, 255, .15); }
.pt-name { font: 12px var(--chunk); color: var(--dim); margin-bottom: 8px; -webkit-font-smoothing: none; }
.pt-btns { display: flex; flex-wrap: wrap; gap: 4px; }
.pt-btns i { font: 10px var(--chunk); font-style: normal; padding: 3px 6px; border-radius: 5px; background: #0d1650; border: 2px solid var(--ink); color: var(--mut); }
.pt-btns i.on { background: var(--grn); color: #fff; }
.pt-axes { display: flex; gap: 14px; margin-top: 8px; }
.stick { position: relative; width: 52px; height: 52px; border-radius: 50%; background: #0d1650; border: 3px solid var(--ink); }
.stick b { position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px; border-radius: 50%; background: var(--yel); border: 2px solid var(--ink); }

/* compact + full leaderboards */
.pb-t, .lbx-t { width: 100%; border-collapse: separate; border-spacing: 0 4px; font-size: 13.5px; }
.pb-t th, .lbx-t th { text-align: left; font: 11px var(--chunk); color: var(--mut); text-transform: uppercase; padding: 2px 8px; -webkit-font-smoothing: none; }
.pb-t td, .lbx-t td { padding: 6px 8px; background: rgba(0, 0, 0, .25); }
.pb-t td:first-child, .lbx-t td:first-child { border-radius: 7px 0 0 7px; }
.pb-t td:last-child, .lbx-t td:last-child { border-radius: 0 7px 7px 0; }
.pb-t tr.me td, .lbx-t tr.me td { background: rgba(255, 204, 0, .2); }
.pb-t .rk, .lbx-t .rk { font: 15px var(--chunk); color: var(--yel); width: 36px; -webkit-font-smoothing: none; }
.lbx-t tr.top1 .rk { color: var(--yel); } .lbx-t tr.top2 .rk { color: #dfe6f0; } .lbx-t tr.top3 .rk { color: #ffab5a; }
.pb-t button, .lbx-t button { background: none; border: 0; cursor: pointer; display: flex; align-items: center; gap: 8px; font: 13.5px var(--chunk); padding: 0; text-align: left; -webkit-font-smoothing: none; }
.pb-t button i, .lbx-t button i { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-style: normal; font-size: 12px; border: 2px solid var(--ink); }
.lbx-t th button { font: 11px var(--chunk); color: var(--mut); text-transform: uppercase; }
.lbx-t th button.on { color: var(--yel); }
.lbx-t .ms { font-family: var(--chunk); color: #fff; -webkit-font-smoothing: none; }
.lbx-t small { display: block; color: var(--dim); font-size: 11px; }
.lbx-t .dash { color: var(--mut); }
.pb-full { margin-top: 12px; }
.lbx-empty { padding: 26px; text-align: center; display: flex; flex-direction: column; gap: 4px; }
.lbx-empty b { font: 15px var(--chunk); -webkit-font-smoothing: none; }
.lbx-empty span { color: var(--dim); font-size: 13px; }
.lbx-skel { display: flex; flex-direction: column; gap: 6px; }
.lbx-skel i { height: 32px; border-radius: 7px; background: linear-gradient(90deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .14), rgba(255, 255, 255, .06)); background-size: 200% 100%; animation: skel 1s linear infinite; }
@keyframes skel { to { background-position: -200% 0; } }
.lbx { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(12, 10, 38, .7); padding: 24px; }
.lbx-card { width: min(980px, 100%); max-height: 100%; overflow: auto; background: linear-gradient(#2b44c4, var(--navy) 18%, var(--navy2)); border: 3px solid #fff; border-radius: 12px; padding: 16px 20px 20px;
  box-shadow: 0 0 0 3px var(--ink), 8px 10px 0 3px rgba(0, 0, 0, .4); }
.lbx-head { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.lbx-title { height: 34px; display: flex; flex: 1; }
.lap-list { margin-top: 14px; }
.pcard .pc-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.pcard .pc-name { height: 30px; display: flex; }
.pcard .pc-head small { color: var(--dim); }
.pcard .stats { grid-template-columns: repeat(6, 1fr); }
.aws { display: flex; flex-wrap: wrap; gap: 6px; }
.aw { padding: 4px 10px; border-radius: 14px; background: var(--ink); border: 2px solid var(--yel); font: 12px var(--chunk); -webkit-font-smoothing: none; }
.aw b { color: var(--yel); }

@media (max-width: 1100px) {
  .lb-grid { grid-template-columns: 1fr; }
  .pn-body { grid-template-columns: 230px 1fr; }
  .pn-chat { display: none; }
  .howto { grid-template-columns: 1fr; }
}

/* the menu backdrop only animates when it can be seen (not under the 3D menus or the race) */
body.boot-open #menubg .mb-clouds, body.boot-open #menubg .mb-floor::before { animation-play-state: paused; }
body.boot-open #menubg { visibility: hidden; }
/* the race HUD lives on <body> above #game: keep it out of the way while the lobby menu is open */
body.menu-open .hk-hud { visibility: hidden; }
