:root {
  --bg: #05010d;
  --pink: #ff2a6d;
  --cyan: #05d9e8;
  --yellow: #f9f871;
  --violet: #b967ff;
  --lime: #39ff14;
  --ink: #e8e6ff;
  --dim: #8b86b8;
  --panel: rgba(12, 4, 30, 0.72);
  --edge: rgba(185, 103, 255, 0.55);
  --font-d: 'Orbitron', 'Segoe UI', sans-serif;
  --font-b: 'Rajdhani', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink);
  font-family: var(--font-b); font-size: 17px; -webkit-font-smoothing: antialiased;
  user-select: none; -webkit-user-select: none; touch-action: none;
}
#scene, #gl, #text { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
#text { pointer-events: none; }
canvas { display: block; }
#ui { position: fixed; inset: 0; pointer-events: none; }
.hidden { display: none !important; }

/* ------------------------------------------------------------------ screens */
.screen {
  position: absolute; inset: 0; display: none; align-items: flex-start; justify-content: center;
  padding: 24px; overflow-y: auto; pointer-events: none;
}
.screen > * { margin: auto; } /* centred when it fits, scrollable from the top when it doesn't */
.screen.active { display: flex; animation: screenIn 0.35s ease-out; pointer-events: auto; }
.screen.active > * { pointer-events: auto; }
@keyframes screenIn { from { opacity: 0; transform: scale(1.03); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }

.panel {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 14px;
  padding: 22px 24px;
  backdrop-filter: blur(8px);
  box-shadow: 0 0 0 1px rgba(5, 217, 232, 0.12) inset, 0 0 40px rgba(185, 103, 255, 0.25), 0 0 120px rgba(255, 42, 109, 0.12);
  position: relative;
  min-width: min(440px, 92vw);
  max-width: 92vw;
}
.panel::before {
  content: ''; position: absolute; inset: -1px; border-radius: 14px; padding: 1px; pointer-events: none;
  background: linear-gradient(120deg, var(--pink), var(--violet), var(--cyan), var(--lime), var(--pink));
  background-size: 300% 300%; animation: edge 6s linear infinite;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; opacity: 0.8;
}
@keyframes edge { to { background-position: 300% 0; } }
.panel.wide { width: min(860px, 94vw); }

h2, h3 { font-family: var(--font-d); letter-spacing: 0.12em; margin: 0 0 14px; }
h2 { font-size: 26px; color: #fff; text-shadow: 0 0 12px var(--cyan), 0 0 30px var(--violet); }
h3 { font-size: 14px; color: var(--cyan); text-shadow: 0 0 8px var(--cyan); }
.label { font-family: var(--font-d); font-size: 11px; letter-spacing: 0.25em; color: var(--dim); margin: 12px 0 6px; }
.hint { color: var(--dim); font-size: 15px; margin: 8px 0; }

/* ------------------------------------------------------------------ title */
.title-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 100%; }
#screen-title { flex-direction: column; }
.logo {
  position: relative; margin: 0; font-family: var(--font-d); font-weight: 900;
  font-size: clamp(34px, 12vw, 150px); letter-spacing: 0.08em; color: #fff;
  text-shadow: 0 0 6px #fff, 0 0 18px var(--pink), 0 0 40px var(--pink), 0 0 90px var(--violet);
  animation: flicker 5s infinite;
  isolation: isolate;
}
.logo::before, .logo::after {
  content: attr(data-text); position: absolute; inset: 0; pointer-events: none; text-shadow: none; z-index: -1;
}
.logo::before { color: var(--cyan); transform: translate(-3px, 0); opacity: 0.7; animation: glitchA 2.6s infinite steps(1); }
.logo::after { color: var(--pink); transform: translate(3px, 0); opacity: 0.7; animation: glitchB 3.1s infinite steps(1); }
@keyframes flicker {
  0%, 18%, 22%, 25%, 53%, 57%, 100% { opacity: 1; }
  20%, 24%, 55% { opacity: 0.55; }
}
@keyframes glitchA {
  0%, 100% { clip-path: inset(0 0 0 0); transform: translate(-3px, 0); }
  30% { clip-path: inset(20% 0 55% 0); transform: translate(-12px, 2px); }
  32% { clip-path: inset(60% 0 10% 0); transform: translate(8px, -2px); }
  34% { clip-path: inset(0 0 0 0); transform: translate(-3px, 0); }
}
@keyframes glitchB {
  0%, 100% { clip-path: inset(0 0 0 0); transform: translate(3px, 0); }
  60% { clip-path: inset(40% 0 30% 0); transform: translate(14px, 0); }
  62% { clip-path: inset(5% 0 80% 0); transform: translate(-10px, 1px); }
  64% { clip-path: inset(0 0 0 0); transform: translate(3px, 0); }
}
.tagline { font-family: var(--font-d); font-size: clamp(11px, 1.6vw, 15px); letter-spacing: 0.35em; color: var(--cyan); text-shadow: 0 0 10px var(--cyan); margin-bottom: 18px; text-align: center; }
.tagline span { color: var(--pink); }
.title-grid { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; align-items: stretch; }
.title-grid .panel { min-width: 300px; width: 360px; }
.menu { display: flex; flex-direction: column; gap: 10px; }
.join-row { display: flex; gap: 8px; }
.join-row input { flex: 1; text-align: center; letter-spacing: 0.5em; text-transform: uppercase; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.offline-note { color: var(--yellow); font-size: 14px; }
.credits { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; font-family: var(--font-d); font-size: 12px; letter-spacing: 0.2em; color: var(--dim); pointer-events: none; }
.credits b { color: #fff; text-shadow: 0 0 8px var(--violet); font-weight: 700; }
.credits span { color: var(--pink); }
.credits-inline { font-family: var(--font-d); font-size: 12px; letter-spacing: 0.15em; color: var(--dim); }

/* ------------------------------------------------------------------ controls */
.btn {
  font-family: var(--font-d); font-weight: 700; letter-spacing: 0.14em; font-size: 14px;
  color: #fff; background: rgba(185, 103, 255, 0.08); border: 1px solid rgba(5, 217, 232, 0.6);
  border-radius: 8px; padding: 11px 16px; cursor: pointer; transition: all 0.12s;
  text-shadow: 0 0 8px var(--cyan); position: relative; overflow: hidden;
}
.btn:hover { background: rgba(5, 217, 232, 0.2); border-color: #fff; box-shadow: 0 0 18px var(--cyan), 0 0 40px rgba(5, 217, 232, 0.4); transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn.big { font-size: 18px; padding: 15px 18px; border-color: var(--pink); text-shadow: 0 0 10px var(--pink); }
.btn.big:hover { background: rgba(255, 42, 109, 0.22); box-shadow: 0 0 22px var(--pink), 0 0 60px rgba(255, 42, 109, 0.4); }
.btn.big small { display: block; font-family: var(--font-b); font-weight: 600; letter-spacing: 0.2em; font-size: 12px; color: var(--dim); text-shadow: none; margin-top: 2px; }
.btn.small { font-size: 12px; padding: 9px 10px; }
.btn.tiny { font-size: 12px; padding: 5px 10px; min-width: 34px; }
.btn:disabled { opacity: 0.35; pointer-events: none; }
.btn.start { animation: pulseBtn 1.4s ease-in-out infinite; }
@keyframes pulseBtn { 50% { box-shadow: 0 0 26px var(--pink), 0 0 70px rgba(255, 42, 109, 0.5); } }
.toggle.on { border-color: var(--lime); text-shadow: 0 0 8px var(--lime); }

input[type=text], input:not([type]) {
  font-family: var(--font-d); font-size: 16px; color: #fff; background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(185, 103, 255, 0.6); border-radius: 8px; padding: 10px 12px; outline: none; width: 100%;
  user-select: text; -webkit-user-select: text;
}
input:focus { border-color: var(--cyan); box-shadow: 0 0 14px rgba(5, 217, 232, 0.5); }
input[type=range] { accent-color: var(--pink); width: 160px; }

.seg { display: inline-flex; border: 1px solid rgba(5, 217, 232, 0.5); border-radius: 8px; overflow: hidden; }
.seg button { font-family: var(--font-d); font-size: 12px; letter-spacing: 0.1em; background: transparent; color: var(--dim); border: 0; padding: 7px 12px; cursor: pointer; }
.seg button.on { background: rgba(5, 217, 232, 0.25); color: #fff; text-shadow: 0 0 8px var(--cyan); }
.seg button:hover { color: #fff; }

.setting { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 0; border-bottom: 1px dashed rgba(185, 103, 255, 0.2); }
.setting > span { font-family: var(--font-d); font-size: 12px; letter-spacing: 0.18em; color: var(--ink); }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper b { font-family: var(--font-d); font-size: 18px; min-width: 22px; text-align: center; color: var(--yellow); text-shadow: 0 0 10px var(--yellow); }
.panel > .btn { margin-top: 14px; }

/* profile */
.profile h3 { margin-bottom: 10px; }
.icon-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.icon-grid button, .color-grid button { background: rgba(0, 0, 0, 0.35); border: 1px solid transparent; border-radius: 6px; padding: 3px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.icon-grid button.on { border-color: #fff; box-shadow: 0 0 10px var(--cyan); background: rgba(5, 217, 232, 0.15); }
.color-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }
.color-grid button { height: 26px; }
.color-grid button.on { border-color: #fff; transform: scale(1.12); }

/* ------------------------------------------------------------------ lobby */
.lobby { width: min(760px, 94vw); }
.lobby-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.room-code { font-family: var(--font-d); font-weight: 900; font-size: 46px; letter-spacing: 0.3em; color: #fff; text-shadow: 0 0 12px var(--pink), 0 0 36px var(--pink); }
.lobby-share { text-align: right; }
.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.slot { display: flex; align-items: center; gap: 10px; padding: 8px 10px; min-height: 52px; border-radius: 10px; background: rgba(0, 0, 0, 0.35); border: 1px solid rgba(255, 255, 255, 0.08); }
.slot.filled { border-color: var(--c); box-shadow: inset 0 0 18px color-mix(in srgb, var(--c) 30%, transparent), 0 0 12px color-mix(in srgb, var(--c) 35%, transparent); animation: slotIn 0.3s ease-out; }
@keyframes slotIn { from { transform: translateX(-10px); opacity: 0; } }
.slot .nm { font-family: var(--font-d); font-weight: 700; font-size: 15px; letter-spacing: 0.08em; color: var(--c); text-shadow: 0 0 8px var(--c); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot .tag { font-family: var(--font-d); font-size: 10px; letter-spacing: 0.15em; color: var(--dim); border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 4px; padding: 2px 6px; }
.slot .tag.host { color: var(--yellow); border-color: var(--yellow); }
.slot .tag.you { color: var(--lime); border-color: var(--lime); }
.slot.empty { color: var(--dim); font-family: var(--font-d); font-size: 12px; letter-spacing: 0.2em; justify-content: center; opacity: 0.6; }
.slot select { font-family: var(--font-d); font-size: 11px; background: #0b0420; color: #fff; border: 1px solid rgba(5, 217, 232, 0.5); border-radius: 5px; padding: 3px; }
.slot .x { background: none; border: 0; color: var(--pink); font-size: 20px; cursor: pointer; padding: 0 4px; }
.lobby-cols { display: flex; gap: 20px; margin-top: 16px; flex-wrap: wrap; }
.lobby-settings { flex: 1; min-width: 260px; }
.lobby-bots { flex: 1; min-width: 220px; }
.bot-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.spectators { color: var(--dim); font-size: 14px; margin-top: 10px; }
.lobby-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.wait { color: var(--dim); font-family: var(--font-d); font-size: 12px; letter-spacing: 0.15em; animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: 0.35; } }
body:not(.is-host) .host-only { display: none !important; }
body.is-host #lobby-wait, body.is-host #results-wait { display: none; }
body.is-host .lobby-settings .seg button { pointer-events: auto; }
body:not(.is-host) .lobby-settings .seg button { pointer-events: none; }

/* ------------------------------------------------------------------ results / tables */
.results { width: min(760px, 94vw); }
.results-stats { text-align: center; font-family: var(--font-d); font-size: 12px; letter-spacing: 0.15em; color: var(--dim); margin: -6px 0 12px; }
.results-stats b { color: var(--yellow); text-shadow: 0 0 8px var(--yellow); }
.results-title { font-family: var(--font-d); font-weight: 900; font-size: clamp(30px, 6vw, 60px); text-align: center; letter-spacing: 0.1em; margin-bottom: 14px; }
.table { width: 100%; border-collapse: collapse; font-size: 16px; }
.table th { font-family: var(--font-d); font-size: 10px; letter-spacing: 0.2em; color: var(--dim); text-align: left; padding: 6px; border-bottom: 1px solid rgba(185, 103, 255, 0.4); }
.table td { padding: 7px 6px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.table td.n { font-family: var(--font-d); font-weight: 700; }
.table .pl { display: flex; align-items: center; gap: 8px; font-family: var(--font-d); font-weight: 700; letter-spacing: 0.06em; }
.table tr.first td { background: linear-gradient(90deg, rgba(249, 248, 113, 0.15), transparent); }
.table tr.me td { background: rgba(57, 255, 20, 0.1); }
.table .tag { font-family: var(--font-d); font-size: 9px; letter-spacing: 0.12em; border: 1px solid; border-radius: 4px; padding: 1px 5px; }
#lb-sort { margin-bottom: 12px; }
#lb-body { max-height: 55vh; overflow-y: auto; }

/* ------------------------------------------------------------------ how to */
.howto p { line-height: 1.45; }
.howto .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.howto ul { padding-left: 18px; margin: 0 0 12px; line-height: 1.5; }
.pu-list { display: grid; gap: 6px; }
.pu { display: flex; gap: 10px; align-items: center; font-size: 15px; }
.pu i { font-style: normal; font-family: var(--font-d); font-weight: 900; font-size: 12px; min-width: 36px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 6px; border: 2px solid var(--c); color: #fff; box-shadow: 0 0 10px var(--c); }
.pu b { font-family: var(--font-d); font-size: 12px; letter-spacing: 0.1em; color: var(--c); }

/* ------------------------------------------------------------------ HUD */
#hud { position: absolute; inset: 0; pointer-events: none; }
#scoreboard { position: absolute; top: 12px; left: 12px; display: flex; flex-direction: column; gap: 4px; }
.sb { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 6px; background: rgba(5, 0, 15, 0.6); border-left: 3px solid var(--c); border-radius: 4px; font-family: var(--font-d); font-size: 12px; letter-spacing: 0.06em; min-width: 190px; transition: opacity 0.3s; }
.sb .nm { color: var(--c); text-shadow: 0 0 6px var(--c); font-weight: 700; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.sb .lv { color: #fff; letter-spacing: 0; }
.sb .sc { color: var(--dim); min-width: 44px; text-align: right; }
.sb.dead { opacity: 0.35; text-decoration: line-through; }
.sb.me { background: rgba(57, 255, 20, 0.08); }
#roominfo { position: absolute; top: 12px; right: 14px; font-family: var(--font-d); font-size: 12px; letter-spacing: 0.15em; color: var(--dim); text-align: right; }
#roominfo b { color: #fff; }
#feed { position: absolute; top: 60px; right: 14px; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.fd { font-family: var(--font-d); font-size: 12px; padding: 4px 10px; background: rgba(5, 0, 15, 0.6); border-radius: 4px; animation: feedIn 0.25s ease-out; }
.fd.out { opacity: 0; transition: opacity 0.6s; }
@keyframes feedIn { from { transform: translateX(30px); opacity: 0; } }
#spectate { position: absolute; bottom: 60px; left: 0; right: 0; text-align: center; font-family: var(--font-d); font-weight: 900; font-size: 22px; letter-spacing: 0.3em; color: var(--pink); text-shadow: 0 0 14px var(--pink); }
#spectate small { font-size: 12px; letter-spacing: 0.15em; color: var(--dim); text-shadow: none; }
#controls-hint { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; font-family: var(--font-d); font-size: 11px; letter-spacing: 0.25em; color: var(--dim); opacity: 0.8; transition: opacity 1s; }

.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(3, 0, 10, 0.55); pointer-events: auto; }
.overlay .panel { display: flex; flex-direction: column; gap: 10px; min-width: 320px; }
.overlay .panel .btn { margin: 0; }

#toast { position: absolute; left: 50%; bottom: 80px; transform: translateX(-50%); font-family: var(--font-d); font-size: 14px; letter-spacing: 0.1em; padding: 10px 18px; border-radius: 8px; background: rgba(12, 4, 30, 0.9); border: 1px solid var(--pink); box-shadow: 0 0 20px rgba(255, 42, 109, 0.5); opacity: 0; transition: opacity 0.3s; pointer-events: none; }
#toast.show { opacity: 1; }
#fps { position: absolute; bottom: 8px; right: 10px; font-family: var(--font-d); font-size: 11px; color: var(--lime); }

body.in-game { cursor: crosshair; }

@media (max-width: 700px) {
  .slots { grid-template-columns: 1fr; }
  .howto .cols { grid-template-columns: 1fr; }
  .room-code { font-size: 34px; }
  .sb { min-width: 0; font-size: 10px; }
  .credits { font-size: 10px; }
}

/* ------------------------------------------------------------------ v0.3: pilot levels, trails, modes */
.pilot-head { display: flex; justify-content: space-between; align-items: baseline; }
.pilot-head h3 { margin-bottom: 6px; }
.pilot-lv { font-family: var(--font-d); font-size: 11px; color: var(--dim); letter-spacing: 0.1em; display: flex; gap: 8px; align-items: baseline; }
.pilot-lv b { font-size: 18px; color: var(--yellow); text-shadow: 0 0 10px var(--yellow); }
.xp-track { height: 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.08); overflow: hidden; border: 1px solid rgba(249, 248, 113, 0.3); }
.xp-track.small { height: 5px; margin-bottom: 10px; }
.xp-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--pink), var(--yellow)); box-shadow: 0 0 10px var(--yellow); transition: width 1.4s cubic-bezier(.2, .8, .2, 1); }
.hint-inline { letter-spacing: 0.05em; font-family: var(--font-b); font-size: 12px; color: var(--dim); }
.trail-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.trail { font-family: var(--font-d); font-size: 9px; letter-spacing: 0.06em; color: #fff; background: rgba(0, 0, 0, 0.35); border: 1px solid rgba(5, 217, 232, 0.35); border-radius: 6px; padding: 6px 2px; cursor: pointer; line-height: 1.2; }
.trail small { display: block; color: var(--dim); font-size: 8px; }
.trail.on { border-color: #fff; background: rgba(5, 217, 232, 0.2); box-shadow: 0 0 10px var(--cyan); }
.trail.locked { opacity: 0.4; border-style: dashed; }
.mode-desc { font-size: 14px; color: var(--cyan); padding: 0 0 6px; min-height: 18px; }
.setting.dim { opacity: 0.35; }
.select { font-family: var(--font-d); font-size: 12px; background: #0b0420; color: #fff; border: 1px solid rgba(5, 217, 232, 0.5); border-radius: 6px; padding: 5px 8px; }
.slot .tag.lvl { color: var(--yellow); border-color: rgba(249, 248, 113, 0.5); }
.teambtn { font-family: var(--font-d); font-size: 10px; letter-spacing: 0.12em; color: var(--tc); border: 1px solid var(--tc); background: transparent; border-radius: 4px; padding: 3px 7px; cursor: pointer; box-shadow: 0 0 8px color-mix(in srgb, var(--tc) 50%, transparent); }
.teambtn:disabled { cursor: default; }
.results-xp { margin: 0 0 14px; }
.xp-line { display: flex; justify-content: space-between; font-family: var(--font-d); font-size: 13px; letter-spacing: 0.12em; margin-bottom: 6px; }
.xp-line b { color: var(--yellow); text-shadow: 0 0 10px var(--yellow); }
.xp-line span { color: var(--dim); }
.levelup { margin-top: 8px; font-family: var(--font-d); font-weight: 900; font-size: 15px; letter-spacing: 0.12em; color: var(--lime); text-shadow: 0 0 12px var(--lime); text-align: center; animation: blink 0.8s 4; }
.sb { box-shadow: inset -3px 0 0 var(--tc, transparent); }

/* ------------------------------------------------------------------ touch controls */
.touch-btn { display: none; position: absolute; pointer-events: auto; font-family: var(--font-d); font-weight: 900; color: #fff; border-radius: 50%; border: 2px solid var(--cyan); background: rgba(5, 0, 15, 0.45); backdrop-filter: blur(4px); touch-action: none; -webkit-tap-highlight-color: transparent; }
body.touch .touch-btn { display: flex; align-items: center; justify-content: center; }
body.touch .touch-btn.hidden { display: none; }
#btn-menu { top: 10px; right: 10px; width: 40px; height: 40px; font-size: 18px; border-radius: 10px; }
#btn-smash { right: 18px; bottom: 22px; width: 92px; height: 92px; font-size: 14px; letter-spacing: 0.05em; border-color: rgba(255, 255, 255, 0.35); color: var(--dim); }
#btn-smash.ready { border-color: #fff; color: #fff; box-shadow: 0 0 22px var(--pink), inset 0 0 18px rgba(255, 42, 109, 0.5); text-shadow: 0 0 10px var(--pink); }
#btn-smash.hit { transform: scale(0.9); background: rgba(255, 255, 255, 0.3); }
#btn-emote { left: 16px; bottom: 26px; width: 52px; height: 52px; font-size: 13px; border-color: var(--violet); }
#emote-row { position: absolute; left: 16px; bottom: 88px; display: flex; flex-wrap: wrap; gap: 6px; max-width: 240px; pointer-events: auto; }
body:not(.touch) #emote-row { display: none; }
body.touch #controls-hint { display: none; }
body.touch #roominfo { right: 60px; }

/* ------------------------------------------------------------------ small screens / phones */
@media (max-width: 760px), (max-height: 520px) {
  .screen { padding: 12px; }
  .panel { padding: 16px 14px; min-width: 0; width: 100%; }
  .title-grid .panel { width: 100%; min-width: 0; }
  .title-grid { gap: 12px; width: 100%; }
  .tagline { letter-spacing: 0.2em; margin-bottom: 8px; }
  .btn.big { font-size: 16px; padding: 12px 14px; }
  .icon-grid { grid-template-columns: repeat(8, 1fr); }
  .trail-grid { grid-template-columns: repeat(5, 1fr); }
  .lobby-cols { flex-direction: column; gap: 10px; }
  .seg button { padding: 7px 8px; font-size: 11px; }
  .table { font-size: 13px; }
  .table th:nth-child(5), .table td:nth-child(5) { display: none; }
  .credits { position: static; margin: 14px auto 0; }
  .title-wrap { width: 100%; }
  #scoreboard { top: 6px; left: 6px; gap: 2px; }
  .sb { min-width: 0; padding: 2px 6px 2px 4px; font-size: 9px; gap: 5px; }
  .sb .nm { max-width: 70px; }
  .sb .sc { display: none; }
  #feed { top: 54px; right: 6px; }
  .fd { font-size: 10px; padding: 3px 7px; }
  #feed .fd:nth-child(n+4) { display: none; }
  #roominfo { font-size: 10px; top: 8px; }
  #spectate { font-size: 15px; bottom: 130px; }
  .overlay .panel { min-width: 0; width: min(340px, 92vw); }
}
@media (max-width: 760px) and (orientation: portrait) {
  .slot { min-height: 44px; }
  .lobby-actions { flex-wrap: wrap; }
  .lobby-actions .start { width: 100%; order: -1; }
}
