/* self-hosted (SIL Open Font License): no third-party requests */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(/fonts/outfit-latin.woff2) format('woff2');
}
@font-face {
  font-family: 'Righteous';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/righteous-latin.woff2) format('woff2');
}

:root {
  --bg: #05070d;
  --ink: #eef1ff;
  --muted: #8089ab;
  --faint: #4d5578;
  --cyan: #3ef2ff;
  --pink: #ff4fd8;
  --lime: #b8ff3c;
  --orange: #ff8a3d;
  --gold: #ffd23f;
  --danger: #ff5577;
  --aqua: #2fe4ff;
  --magma: #ff6a3c;
  --panel: rgba(10, 14, 28, 0.84);
  --panel-soft: rgba(12, 17, 34, 0.62);
  --edge: rgba(120, 140, 255, 0.18);
  --font: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Righteous', 'Outfit', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}

canvas#game {
  position: fixed;
  inset: 0;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

button { font-family: inherit; cursor: pointer; color: inherit; }
.hidden { display: none !important; }
kbd {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font: 600 11px var(--font);
}

/* ------------------------------------------------------------------ menu */
#menu {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px 14px;
  overflow-y: auto;
  scrollbar-width: none;
  background:
    radial-gradient(ellipse 70% 55% at 50% 40%, rgba(5, 7, 13, 0.35), rgba(5, 7, 13, 0.82) 70%, rgba(3, 4, 9, 0.95));
  transition: opacity 0.35s ease, visibility 0s;
}
#menu::-webkit-scrollbar { display: none; }
#menu.fade {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0s linear 0.35s;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  z-index: 2;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.profile { display: flex; align-items: center; gap: 10px; }
.lvbadge {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(145deg, #2a1f63, #121634);
  border: 1.5px solid rgba(62, 242, 255, 0.45);
  box-shadow: 0 0 16px rgba(62, 242, 255, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  line-height: 1;
}
.lvbadge span { font-size: 9px; font-weight: 700; letter-spacing: 0.12em; color: var(--cyan); }
.lvbadge b { font: 400 20px var(--display); margin-top: -8px; }
.xpwrap { display: flex; flex-direction: column; gap: 4px; }
.xpbar {
  width: 150px;
  height: 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.xpbar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--pink));
  box-shadow: 0 0 10px rgba(255, 79, 216, 0.6);
  transition: width 1.2s cubic-bezier(.2, .8, .2, 1);
}
#xpText { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.settings { display: flex; gap: 8px; }
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 42px;
  height: 42px;
  padding: 0 10px;
  border-radius: 12px;
  border: 1px solid var(--edge);
  background: var(--panel-soft);
  color: #c9d2ff;
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(6px);
  transition: border-color 0.15s, color 0.15s, transform 0.15s;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn b { font-size: 18px; }
.icon-btn:hover { border-color: rgba(62, 242, 255, 0.6); color: #fff; transform: translateY(-1px); }
.icon-btn.off { color: var(--faint); }

/* the menu fills the first screen; the about section starts below it */
.menu-screen { display: flex; flex-direction: column; align-items: center; flex: none; width: 100%; min-height: 100%; }
.menu-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 540px;
  margin-top: clamp(70px, 12vh, 130px);
}

.brand { display: flex; flex-direction: column; align-items: center; margin: 0; font: inherit; }
.logo {
  display: flex;
  align-items: center;
  margin: 0;
  font: 400 clamp(58px, 14vw, 108px) / 1 var(--display);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.logo .spiral { width: 0.82em; height: 0.82em; margin-right: 0.16em; filter: drop-shadow(0 0 12px rgba(62, 242, 255, 0.6)); animation: spin 14s linear infinite; }
.logo .w {
  color: #effeff;
  text-shadow: 0 0 6px rgba(62, 242, 255, 0.9), 0 0 22px rgba(62, 242, 255, 0.6), 0 0 48px rgba(31, 168, 255, 0.45);
}
.logo .b {
  color: #ffe9fb;
  text-shadow: 0 0 6px rgba(255, 79, 216, 0.95), 0 0 22px rgba(255, 79, 216, 0.6), 0 0 48px rgba(255, 79, 216, 0.4);
  animation: flicker 5s infinite;
}
.tagline {
  display: block;
  margin: 6px 0 22px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.38em;
  text-transform: uppercase;
}
.tagline i { color: var(--pink); font-style: normal; }

.final { margin: -6px 0 16px; color: var(--muted); font-size: 17px; text-align: center; }
.final b { color: #fff; font-weight: 700; }

.badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 9px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--orange));
  color: #2a1400;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  vertical-align: 2px;
  animation: pop 0.5s cubic-bezier(.2, 1.6, .4, 1) both;
}

.join { display: flex; gap: 10px; width: 100%; }
.skin-chip {
  flex: none;
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 16px;
  border: 1.5px solid var(--edge);
  background: var(--panel);
  transition: border-color 0.15s, transform 0.15s;
}
.skin-chip:hover { border-color: var(--cyan); transform: scale(1.05); }
.skin-chip canvas { width: 100%; height: 100%; display: block; }
#nick {
  flex: 1;
  min-width: 0;
  height: 56px;
  padding: 0 18px;
  border-radius: 16px;
  border: 1.5px solid var(--edge);
  background: var(--panel);
  color: var(--ink);
  font: 600 18px var(--font);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  user-select: text;
  -webkit-user-select: text;
}
#nick::placeholder { color: var(--faint); }
#nick:focus { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(62, 242, 255, 0.12); }

.modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
  margin-top: 12px;
}
.mode {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px 12px 10px;
  border-radius: 16px;
  border: 1.5px solid var(--edge);
  background: var(--panel);
  text-align: left;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.mode svg { width: 28px; height: 28px; color: var(--cyan); margin-bottom: 4px; }
.mode b { font-size: 16px; font-weight: 700; }
.mode .desc { font-size: 12px; color: var(--muted); }
.mode .live { margin-top: 6px; font-size: 11px; font-weight: 600; color: var(--lime); }
.mode .live::before { content: '● '; }
.mode:hover { transform: translateY(-2px); border-color: rgba(62, 242, 255, 0.45); }
.mode[aria-checked='true'] {
  border-color: transparent;
  background:
    linear-gradient(var(--panel), var(--panel)) padding-box,
    linear-gradient(135deg, var(--cyan), var(--pink)) border-box;
  box-shadow: 0 0 22px rgba(255, 79, 216, 0.22), 0 0 12px rgba(62, 242, 255, 0.2);
}
.mode[aria-checked='true'] svg { color: #fff; }

.btn-play {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 66px;
  margin-top: 14px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(100deg, var(--pink), var(--orange));
  color: #fff;
  box-shadow: 0 10px 34px rgba(255, 79, 216, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s;
}
.btn-play span { font: 400 28px / 1 var(--display); letter-spacing: 0.06em; text-shadow: 0 2px 10px rgba(120, 0, 70, 0.5); }
.btn-play small { font-size: 11px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; opacity: 0.85; margin-top: 3px; }
.btn-play:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.08); box-shadow: 0 14px 40px rgba(255, 79, 216, 0.5); }
.btn-play:active:not(:disabled) { transform: scale(0.98); }
.btn-play:disabled { filter: grayscale(0.7) brightness(0.7); cursor: default; }
.btn-play:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }

.btn-ghost {
  margin-top: 14px;
  padding: 9px 18px;
  border-radius: 12px;
  border: 1px solid var(--edge);
  background: rgba(255, 255, 255, 0.04);
  font-weight: 600;
  font-size: 14px;
}
.btn-ghost:hover { border-color: var(--pink); }

.tip {
  min-height: 20px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  transition: opacity 0.4s;
}
.tip b { color: var(--cyan); font-weight: 600; }

.menu-foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 22px;
  z-index: 2;
}
.foot-row { display: flex; gap: 10px; }
.legal { color: var(--faint); font-size: 12px; text-decoration: none; }
.legal:hover { color: var(--muted); text-decoration: underline; }
.legal-row { display: flex; gap: 18px; }

/* about the game: below the menu, for new players and search engines */
.about {
  width: 100%;
  max-width: 680px;
  margin: 56px auto 24px;
  padding: 26px 26px 22px;
  border-radius: 20px;
  background: var(--panel-soft);
  border: 1px solid var(--edge);
  color: #c9d0ec;
  font-size: 15px;
  line-height: 1.6;
  user-select: text;
  -webkit-user-select: text;
  z-index: 2;
  scroll-margin-top: 76px;
}
.about h2 { margin: 26px 0 8px; font: 400 21px / 1.25 var(--display); letter-spacing: 0.02em; color: #fff; }
.about h2:first-child { margin-top: 0; color: var(--cyan); }
.about h3 { margin: 16px 0 4px; font-size: 15px; font-weight: 700; color: #fff; }
.about p { margin: 0 0 10px; }
.about ul { margin: 0 0 10px; padding-left: 20px; }
.about li { margin: 5px 0; }
.about b { color: #fff; }
.about-play { text-align: center; }
.about-play .btn-ghost { display: inline-block; color: var(--ink); text-decoration: none; }
@media (max-width: 480px) {
  .about { padding: 20px 16px 16px; font-size: 14px; }
}

/* Google sign-in button (light theme per Google's branding guidance) */
.gbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 42px;
  padding: 0 16px 0 12px;
  border-radius: 12px;
  border: 1px solid #dadce0;
  background: #fff;
  color: #1f1f1f;
  font: 600 14px var(--font);
  transition: box-shadow 0.15s, transform 0.15s;
}
.gbtn .g { width: 20px; height: 20px; flex: none; }
.gbtn:hover { box-shadow: 0 0 0 3px rgba(62, 242, 255, 0.35); transform: translateY(-1px); }
.gbtn.compact { height: 42px; padding: 0 12px 0 10px; }
.acct-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 42px;
  max-width: 180px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(62, 242, 255, 0.45);
  background: var(--panel-soft);
  font-weight: 700;
  font-size: 14px;
  backdrop-filter: blur(6px);
}
.acct-chip i { font-style: normal; color: var(--cyan); }
.acct-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-chip:hover { border-color: var(--cyan); }

.save-cta {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 12px;
  padding: 10px 10px 10px 14px;
  border-radius: 14px;
  background: rgba(62, 242, 255, 0.07);
  border: 1px solid rgba(62, 242, 255, 0.3);
  animation: rise 0.45s cubic-bezier(.2, .9, .3, 1) both;
}
.save-cta p { flex: 1; margin: 0; font-size: 13px; color: #c9d0ec; line-height: 1.4; text-align: left; }
.save-cta .gbtn { flex: none; }
@media (max-width: 480px) {
  .save-cta { flex-direction: column; text-align: center; }
  .save-cta p { text-align: center; }
}
.save-cta b { color: #fff; }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tab {
  flex: 1;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--edge);
  background: rgba(255, 255, 255, 0.03);
  font-weight: 600;
  font-size: 13px;
}
.tab[aria-selected='true'] { border-color: var(--cyan); color: #fff; background: rgba(62, 242, 255, 0.1); }
.leaders-list { margin: 0; padding: 0; list-style: none; counter-reset: ld; min-height: 120px; }
.leaders-list li { display: flex; gap: 10px; padding: 6px 4px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); font-size: 14px; }
.leaders-list li::before { counter-increment: ld; content: counter(ld); width: 22px; color: var(--faint); font-weight: 700; }
.leaders-list li:nth-child(1)::before { color: var(--gold); }
.leaders-list li:nth-child(2)::before { color: #d7dcf0; }
.leaders-list li:nth-child(3)::before { color: #e0a36b; }
.leaders-list li .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaders-list li .m { color: var(--muted); font-variant-numeric: tabular-nums; }
.leaders-list li.me { color: var(--pink); font-weight: 700; }
.leaders-list .empty { justify-content: center; color: var(--muted); border: 0; }
.leaders-list .empty::before { display: none; }
.note { margin: 10px 0 0; font-size: 12px; color: var(--faint); text-align: center; }

.acct-box { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--edge); text-align: center; font-size: 14px; color: var(--muted); }
.acct-box b { color: var(--ink); }
.acct-box .row { display: flex; justify-content: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.acct-box .danger { border-color: rgba(255, 85, 119, 0.4); color: #ffb3c1; }
.acct-box .danger:hover { border-color: var(--danger); }
.foot-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 14px;
  border: 1px solid var(--edge);
  background: var(--panel-soft);
  font-weight: 600;
  font-size: 14px;
  backdrop-filter: blur(6px);
  transition: border-color 0.15s, transform 0.15s;
}
.foot-btn svg { width: 18px; height: 18px; color: var(--cyan); }
.foot-btn:hover { border-color: var(--cyan); transform: translateY(-1px); }

#menu.has-results .menu-main { margin-top: clamp(64px, 8vh, 90px); }
#menu.has-results .logo { font-size: clamp(46px, 9vw, 72px); }
#menu.has-results .tagline { margin-bottom: 14px; }

/* ------------------------------------------------------------------ cards & panels */
.card, .panel {
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--edge);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}
.card {
  width: 100%;
  margin-top: 16px;
  padding: 16px 18px 14px;
  animation: rise 0.45s cubic-bezier(.2, .9, .3, 1) both;
}
.card h2, .panel h2 { margin: 0; font: 400 22px var(--display); letter-spacing: 0.02em; }
.card h2 { text-align: center; margin-bottom: 10px; }
.place {
  margin: -4px 0 10px;
  text-align: center;
  font: 400 30px var(--display);
  color: var(--gold);
  text-shadow: 0 0 18px rgba(255, 210, 63, 0.5);
}
.place.win { font-size: 34px; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px 12px;
  text-align: center;
}
.stats-grid span { display: block; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.stats-grid b { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats-grid .span2 { grid-column: span 3; }
#rChart { display: block; width: 100%; height: 64px; margin-top: 12px; }
.killer { margin: 10px 0 0; text-align: center; color: var(--muted); font-size: 13px; }
.killer b { color: var(--danger); }
.xp-gain { margin-top: 6px; text-align: center; font-size: 19px; font-weight: 800; color: var(--cyan); }
.unlock { margin: 6px 0 0; text-align: center; color: var(--gold); font-size: 14px; font-weight: 700; }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(3, 4, 10, 0.72);
  backdrop-filter: blur(3px);
}
.panel {
  width: min(460px, 100%);
  max-height: calc(100% - 16px);
  overflow-y: auto;
  padding: 16px 18px 18px;
  animation: rise 0.3s cubic-bezier(.2, .9, .3, 1) both;
}
.panel header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--edge);
  background: rgba(255, 255, 255, 0.04);
  font-size: 22px;
  line-height: 1;
}
.close:hover { border-color: var(--pink); }

.panel.locker { width: min(720px, 100%); }
#skinPreview { display: block; width: 100%; height: 130px; border-radius: 14px; background: rgba(0, 0, 0, 0.25); }
.skin-name { display: flex; justify-content: center; align-items: baseline; gap: 10px; margin: 10px 0 12px; }
.skin-name b { font: 400 22px var(--display); }
.skin-name span { color: var(--gold); font-size: 13px; font-weight: 600; }
.skin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
}
.skin-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px 7px;
  border-radius: 12px;
  border: 1.5px solid var(--edge);
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.15s, transform 0.15s;
}
.skin-tile canvas { width: 100%; height: 44px; display: block; }
.skin-tile span { font-size: 12px; font-weight: 600; }
.skin-tile small { font-size: 10px; color: var(--gold); font-weight: 700; }
.skin-tile:hover { transform: translateY(-2px); border-color: rgba(62, 242, 255, 0.5); }
.skin-tile.locked canvas { filter: grayscale(0.85) brightness(0.55); }
.skin-tile.locked span { color: var(--faint); }
.skin-tile.sel { border-color: var(--cyan); box-shadow: 0 0 14px rgba(62, 242, 255, 0.35); }

.panel.help { width: min(560px, 100%); }
.howto { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.howto li { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.45; color: #c9d0ec; }
.howto b { color: #fff; }
.howto .ic {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-style: normal;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
}
.ic.c1 { color: var(--cyan); }
.ic.c2 { color: var(--orange); }
.ic.c3 { color: var(--pink); }
.ic.c4 { color: #bff8ff; }
.ic.c5 { color: var(--gold); }
.ic.c6 { color: var(--lime); }
.howto-modes { display: grid; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--edge); font-size: 13px; color: var(--muted); }
.howto-modes b { color: var(--ink); margin-right: 6px; }

/* ------------------------------------------------------------------ lobby */
#lobby {
  position: fixed;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  width: min(420px, calc(100% - 32px));
}
.lobby-card {
  padding: 18px 20px;
  border-radius: 18px;
  text-align: center;
  background: var(--panel);
  border: 1px solid rgba(255, 79, 216, 0.4);
  box-shadow: 0 0 30px rgba(255, 79, 216, 0.2);
  animation: rise 0.35s ease both;
}
.kicker { font-size: 11px; font-weight: 800; letter-spacing: 0.3em; text-transform: uppercase; color: var(--pink); }
.lobby-card h2 { margin: 6px 0 4px; font: 400 26px var(--display); }
.lobby-card h2 b { color: var(--cyan); font-weight: 400; font-variant-numeric: tabular-nums; }
.lobby-card p { margin: 0; color: var(--muted); font-size: 14px; }

/* ------------------------------------------------------------------ HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }

#leaderboard {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 220px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(8, 11, 22, 0.55);
  border: 1px solid rgba(120, 140, 255, 0.12);
  font-size: 13.5px;
}
#leaderboard h3 { margin: 0 0 6px; font: 400 15px var(--display); letter-spacing: 0.08em; color: var(--cyan); text-transform: uppercase; }
#lbList { margin: 0; padding: 0; list-style: none; counter-reset: lb; }
#lbList li, #lbMe { display: flex; justify-content: space-between; gap: 8px; line-height: 1.5; color: rgba(238, 241, 255, 0.82); }
#lbList li::before { counter-increment: lb; content: counter(lb); width: 20px; flex: none; color: var(--faint); font-weight: 700; }
#lbList li .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#lbList li .m { color: var(--muted); font-variant-numeric: tabular-nums; }
#lbList li.me, #lbMe { color: var(--pink); font-weight: 700; }
#lbList li.t1 .n { color: var(--aqua); }
#lbList li.t2 .n { color: var(--magma); }
#lbList li:first-child .n::after { content: ' 👑'; }
#lbList li.acct .n::before { content: '✓ '; color: var(--cyan); font-weight: 700; }
#lbMe { margin-top: 4px; padding-top: 4px; border-top: 1px solid rgba(255, 255, 255, 0.08); }

#modebar { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); }
#teambar, #brbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(8, 11, 22, 0.6);
  border: 1px solid rgba(120, 140, 255, 0.14);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.tn.a { color: var(--aqua); }
.tn.b { color: var(--magma); }
.tn b { color: #fff; font-variant-numeric: tabular-nums; }
.tbar { width: 160px; height: 8px; border-radius: 99px; background: var(--magma); overflow: hidden; }
.tbar i { display: block; height: 100%; width: 50%; background: var(--aqua); transition: width 0.8s ease; }
#brbar b { color: var(--cyan); font-size: 16px; }
#brbar .sep { color: var(--faint); }
#brZone.danger { color: var(--pink); }

#scorebox {
  position: absolute;
  left: 16px;
  bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}
#scorebox .len { display: flex; align-items: baseline; gap: 6px; }
#scorebox .len b { font: 400 34px / 1 var(--display); color: #fff; text-shadow: 0 0 14px rgba(62, 242, 255, 0.5); font-variant-numeric: tabular-nums; }
#scorebox .len span { font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; font-size: 11px; }
#scorebox .rank b { color: var(--ink); }
.chips { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 6px;
  border-radius: 10px;
  background: rgba(8, 11, 22, 0.6);
  border: 1px solid rgba(191, 248, 255, 0.35);
  color: #bff8ff;
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
}
.chip i { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: #bff8ff; transform-origin: left; }
.chip.cooling { color: var(--faint); border-color: rgba(120, 140, 255, 0.15); }
.chip.locked { opacity: 0.45; }
.touch .chip kbd { display: none; }
#powers { display: flex; gap: 8px; }
.power {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  border: 1.5px solid var(--c);
  box-shadow: 0 0 12px var(--c);
}
.power svg.ring { position: absolute; inset: -3px; width: 42px; height: 42px; transform: rotate(-90deg); }
.power svg.ring circle { fill: none; stroke: var(--c); stroke-width: 3; }

#minimap { position: absolute; right: 14px; bottom: 14px; width: 156px; height: 156px; }
#hud.watching #scorebox, #hud.watching #touchBtns, #hud.watching #emoteWheel { display: none; }

#killfeed {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: min(360px, 40vw);
}
.kf {
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(8, 11, 22, 0.5);
  font-size: 13px;
  color: rgba(238, 241, 255, 0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: slidein 0.3s ease both, fadeout 0.6s ease 5s forwards;
}
.kf b { color: #fff; font-weight: 700; }
.kf.me { background: rgba(120, 30, 110, 0.55); border: 1px solid rgba(255, 79, 216, 0.4); }

#toasts {
  position: absolute;
  top: 19%;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.toast {
  font: 400 clamp(26px, 4.6vw, 44px) var(--display);
  letter-spacing: 0.03em;
  color: #fff;
  text-shadow: 0 0 18px var(--c, var(--pink)), 0 0 4px var(--c, var(--pink));
  animation: toast 1.9s cubic-bezier(.2, 1.4, .4, 1) forwards;
}
.toast.small { font: 700 clamp(15px, 2.4vw, 20px) var(--font); letter-spacing: 0.08em; }

#netinfo {
  position: fixed;
  left: 50%;
  bottom: 3px;
  transform: translateX(-50%);
  color: rgba(238, 241, 255, 0.25);
  font-size: 11px;
  pointer-events: none;
  z-index: 11;
}

#touchBtns {
  display: none;
  position: absolute;
  right: 16px;
  bottom: 20px;
  align-items: flex-end;
  gap: 12px;
}
#touchBtns button {
  border-radius: 50%;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.06em;
  pointer-events: auto;
  touch-action: none;
}
#boostBtn {
  width: 86px;
  height: 86px;
  border: 2px solid rgba(255, 138, 61, 0.7);
  background: radial-gradient(circle at 50% 35%, rgba(255, 79, 216, 0.55), rgba(255, 138, 61, 0.35));
  font-size: 14px;
}
#boostBtn.on { transform: scale(0.94); background: radial-gradient(circle at 50% 35%, rgba(255, 120, 230, 0.85), rgba(255, 150, 80, 0.7)); }
#shedBtn {
  width: 62px;
  height: 62px;
  margin-bottom: 40px;
  border: 2px solid rgba(191, 248, 255, 0.6);
  background: radial-gradient(circle at 50% 35%, rgba(62, 242, 255, 0.4), rgba(20, 60, 90, 0.5));
  font-size: 11px;
}
#shedBtn.cooling { opacity: 0.4; }
.touch #touchBtns { display: flex; }
.touch #minimap { bottom: 124px; width: 112px; height: 112px; }

/* ------------------------------------------------------------------ extras */
.noscript { position: fixed; inset: auto 0 40% 0; text-align: center; color: var(--ink); font-size: 18px; z-index: 50; }
.errbar { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px; background: rgba(40, 8, 20, 0.92); border: 1px solid var(--danger); color: var(--ink); font-size: 14px; text-align: center; z-index: 60; }

/* analytics consent (built by analytics.js); only shown over the menu, never in a match */
.consent {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  max-width: 540px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 12px 12px 16px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--edge);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  z-index: 25;
  animation: rise 0.45s cubic-bezier(.2, .9, .3, 1) both;
}
#menu.fade ~ .consent { display: none; }
.consent p { flex: 1; margin: 0; font-size: 13px; line-height: 1.45; color: #c9d0ec; }
.consent b { color: #fff; }
.consent a { color: var(--cyan); }
.consent div { display: flex; gap: 8px; flex: none; }
.consent button { padding: 9px 14px; border-radius: 12px; border: 1px solid var(--edge); background: rgba(255, 255, 255, 0.04); font-weight: 600; font-size: 14px; }
.consent button:hover { border-color: var(--pink); }
.consent button.yes { border-color: rgba(62, 242, 255, 0.5); }
.consent button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
@media (max-width: 480px) {
  .consent { flex-direction: column; align-items: stretch; text-align: center; }
  .consent div button { flex: 1; }
}

.online-now { margin: -14px 0 16px; min-height: 18px; font-size: 13px; font-weight: 600; color: var(--muted); }
.online-now b { color: var(--lime); }
.online-now::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 8px var(--lime); vertical-align: 1px; animation: breathe 2.4s ease-in-out infinite; }
.online-now:empty::before, .online-now.idle::before { display: none; }

.missions {
  width: 100%;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--panel-soft);
  border: 1px solid var(--edge);
}
.missions header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.missions header b { font: 400 15px var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold); }
.missions header span { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
#missionList { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.mission { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; font-size: 13px; color: #c9d0ec; }
.mission .xp { font-weight: 700; color: var(--cyan); font-size: 12px; }
.mission .bar { grid-column: span 2; height: 5px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.mission .bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--orange)); transition: width 0.8s cubic-bezier(.2, .8, .2, 1); }
.mission.done { color: var(--muted); }
.mission.done .label { text-decoration: line-through; text-decoration-color: rgba(184, 255, 60, 0.6); }
.mission.done .xp { color: var(--lime); }
.mission.done .bar i { background: var(--lime); }

.r-actions { display: flex; justify-content: center; margin-top: 10px; }
.r-actions .btn-ghost { display: inline-flex; align-items: center; gap: 7px; margin: 0; }
.r-actions svg { width: 16px; height: 16px; color: var(--cyan); }

.recent { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--edge); }
.recent h3 { margin: 0 0 8px; font: 400 15px var(--display); letter-spacing: 0.05em; color: var(--cyan); text-transform: uppercase; }
#recentList { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; font-size: 13px; }
#recentList li { display: grid; grid-template-columns: 100px 1fr auto; gap: 8px; color: #c9d0ec; }
#recentList .rmode { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#recentList .xp { color: var(--cyan); font-weight: 700; }

.settings-panel .setting { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.settings-panel .setting:last-child { border-bottom: 0; }
.settings-panel .setting b { display: block; font-size: 15px; }
.settings-panel .setting span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.seg { display: flex; padding: 3px; border-radius: 11px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--edge); }
.seg button { padding: 6px 14px; border: 0; border-radius: 8px; background: none; font-weight: 700; font-size: 13px; color: var(--muted); }
.seg button[aria-checked='true'] { background: linear-gradient(100deg, var(--pink), var(--orange)); color: #fff; }
#volume { width: 150px; accent-color: var(--pink); }
.toggle { cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle i { flex: none; position: relative; width: 44px; height: 26px; border-radius: 99px; background: rgba(255, 255, 255, 0.12); transition: background 0.2s; }
.toggle i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.2s cubic-bezier(.2, .9, .3, 1.2); }
.toggle input:checked + i { background: linear-gradient(100deg, var(--cyan), var(--pink)); }
.toggle input:checked + i::after { transform: translateX(18px); }
.toggle input:focus-visible + i { outline: 2px solid var(--cyan); outline-offset: 2px; }

#flash {
  position: fixed;
  inset: 0;
  z-index: 12;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at center, rgba(255, 40, 90, 0) 35%, rgba(255, 40, 90, 0.55) 100%);
}
#flash.on { animation: flash 0.9s ease-out; }

#scorebox .len b { display: inline-block; transform-origin: left bottom; }
#scorebox .len b.bump { animation: bump 0.35s cubic-bezier(.2, 1.6, .4, 1); }

#netinfo i { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; vertical-align: 0; }
#netinfo i.good { background: var(--lime); }
#netinfo i.ok { background: var(--gold); }
#netinfo i.bad { background: var(--danger); }

.confetti { position: fixed; top: 0; left: 0; width: 8px; height: 12px; border-radius: 2px; pointer-events: none; z-index: 40; animation: confetti 1.6s cubic-bezier(.2, .6, .4, 1) forwards; }

/* ------------------------------------------------------------------ party row (create / join / practice) */
.party-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; margin-top: 10px; }
.party-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1.5px solid var(--edge);
  background: var(--panel);
  text-align: left;
  transition: border-color 0.15s, transform 0.15s;
}
.party-btn svg { flex: none; width: 22px; height: 22px; color: var(--cyan); }
.party-btn span { display: flex; flex-direction: column; min-width: 0; }
.party-btn b { font-size: 14px; font-weight: 700; white-space: nowrap; }
.party-btn small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.party-btn:hover { transform: translateY(-2px); border-color: rgba(62, 242, 255, 0.55); }
#createBtn svg { color: var(--pink); }
#practiceBtn svg { color: var(--lime); }

.btn-play.small { height: 52px; margin-top: 0; }
.btn-play.small span { font-size: 22px; }
.btn-ghost.small { margin: 0; padding: 6px 12px; font-size: 13px; border-radius: 10px; display: inline-flex; align-items: center; gap: 6px; }
.btn-ghost.small svg { width: 15px; height: 15px; color: var(--cyan); }
.foot-btn .count { margin-left: 2px; padding: 0 6px; border-radius: 99px; background: rgba(255, 210, 63, 0.18); color: var(--gold); font-size: 11px; font-weight: 800; }
.foot-btn .count:empty { display: none; }
.skin-chip.small { width: 46px; height: 46px; border-radius: 13px; }
.panel-sub { margin: -6px 0 12px; font-size: 13px; color: var(--muted); }
.form-error { min-height: 18px; margin: 8px 0 0; font-size: 13px; font-weight: 600; color: var(--danger); text-align: center; }
.form-error:empty { display: none; }
.mode .live::before { content: '● '; }

/* ------------------------------------------------------------------ round HUD */
#roundbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(8, 11, 22, 0.66);
  border: 1px solid rgba(255, 210, 63, 0.3);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
#roundbar i { font-style: normal; }
#rbTimer { font: 400 20px var(--display); color: #fff; font-variant-numeric: tabular-nums; min-width: 44px; text-align: center; }
#rbTimer.danger { color: var(--danger); animation: breathe 0.8s ease-in-out infinite; }
#roundbar .sep { color: var(--faint); }
#rbText { color: #d7ddf5; }
#rbText.danger { color: var(--gold); }
#modebar { display: flex; flex-direction: column; align-items: center; gap: 6px; }

.role {
  display: inline-block;
  margin-bottom: 6px;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: rgba(8, 11, 22, 0.6);
  border: 1px solid var(--edge);
}
.role.hill { color: var(--gold); border-color: rgba(255, 210, 63, 0.45); }
.role.virus { color: #7dff5c; border-color: rgba(125, 255, 92, 0.5); box-shadow: 0 0 12px rgba(125, 255, 92, 0.25); }
.role.clean { color: var(--cyan); border-color: rgba(62, 242, 255, 0.45); }
#lbList li.inf .n { color: #7dff5c; }
#lbList li.inf .n::after { content: ' 🧬'; }
.kf.inf { border: 1px solid rgba(125, 255, 92, 0.35); }
.kf.inf b { color: #b8ff9c; }
.kf.chat { background: rgba(20, 40, 70, 0.55); }
#flash.green { background: radial-gradient(ellipse at center, rgba(90, 255, 60, 0) 35%, rgba(90, 255, 60, 0.45) 100%); }

/* quick chat */
.emote-chip { padding: 5px 9px; cursor: pointer; pointer-events: auto; font-size: 14px; line-height: 1; }
.emote-chip:hover { border-color: var(--cyan); }
.emote-wheel {
  position: absolute;
  left: 16px;
  bottom: 118px;
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 6px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(8, 11, 22, 0.88);
  border: 1px solid rgba(62, 242, 255, 0.35);
  pointer-events: auto;
  animation: rise 0.18s ease both;
}
.emote {
  position: relative;
  min-width: 56px;
  height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--edge);
  background: rgba(255, 255, 255, 0.05);
  font-weight: 700;
  font-size: 15px;
  transition: transform 0.12s, border-color 0.12s;
}
.emote:hover { transform: translateY(-2px); border-color: var(--cyan); }
.emote kbd { position: absolute; top: -7px; right: -5px; min-width: 16px; height: 16px; font-size: 9px; background: #1a2140; }
.touch .emote kbd { display: none; }

.big-count {
  position: fixed;
  top: 34%;
  left: 50%;
  z-index: 25;
  transform: translate(-50%, -50%);
  font: 400 clamp(90px, 18vw, 180px) / 1 var(--display);
  color: #fff;
  text-shadow: 0 0 30px var(--cyan), 0 0 8px var(--cyan);
  pointer-events: none;
  animation: count 0.9s cubic-bezier(.2, 1.3, .4, 1) forwards;
}
.big-count.go { color: #fff; text-shadow: 0 0 34px var(--pink), 0 0 10px var(--pink); }

/* ------------------------------------------------------------------ respawn / spectate */
#respawn {
  position: fixed;
  left: 50%;
  bottom: 18%;
  transform: translateX(-50%);
  z-index: 16;
  width: min(380px, calc(100% - 32px));
}
.respawn-card {
  padding: 16px 18px;
  border-radius: 18px;
  text-align: center;
  background: var(--panel);
  border: 1px solid rgba(255, 85, 119, 0.4);
  box-shadow: 0 0 30px rgba(255, 85, 119, 0.18);
  animation: rise 0.3s ease both;
}
.respawn-card h2 { margin: 4px 0 2px; font: 400 26px var(--display); }
.respawn-card p { margin: 0; font-size: 13px; color: var(--muted); }
.respawn-card p b { color: var(--danger); }
.respawn-card .kicker { color: var(--danger); }
.rs-stats { display: flex; justify-content: center; gap: 16px; margin: 10px 0 12px; font-size: 13px; color: var(--muted); }
.rs-stats b { color: #fff; font-size: 16px; }
.rs-actions { display: flex; gap: 8px; align-items: center; }
.rs-actions .btn-play { flex: 1; }
.rs-actions .btn-ghost { margin: 0; height: 52px; }
.btn-play small:empty { display: none; }

.spec-bar {
  position: fixed;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 14;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 6px 16px;
  border-radius: 999px;
  background: rgba(8, 11, 22, 0.8);
  border: 1px solid rgba(62, 242, 255, 0.35);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ round results */
.results-panel { width: min(520px, 100%); text-align: center; }
.results-panel h2 { margin: 4px 0 2px; font-size: 32px; }
.results-panel h2.win { color: var(--gold); text-shadow: 0 0 22px rgba(255, 210, 63, 0.55); }
.ro-sub { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 8px; margin: 6px 0 12px; }
.podium .step { display: flex; flex-direction: column; align-items: center; width: 31%; min-width: 0; }
.podium canvas { width: 100%; height: 64px; }
.podium .name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.podium .score { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.podium .block {
  display: grid;
  place-items: center;
  width: 100%;
  border-radius: 12px 12px 4px 4px;
  font: 400 26px var(--display);
  color: rgba(255, 255, 255, 0.9);
}
.podium .p1 .block { height: 84px; background: linear-gradient(180deg, rgba(255, 210, 63, 0.55), rgba(255, 138, 61, 0.25)); box-shadow: 0 0 24px rgba(255, 210, 63, 0.3); }
.podium .p2 .block { height: 60px; background: linear-gradient(180deg, rgba(215, 220, 240, 0.4), rgba(120, 140, 255, 0.15)); }
.podium .p3 .block { height: 44px; background: linear-gradient(180deg, rgba(224, 163, 107, 0.45), rgba(160, 90, 40, 0.15)); }
.podium .p1 .name { color: var(--gold); }
.ro-you { font-size: 15px; color: #d7ddf5; }
.ro-you b { color: #fff; }
.ro-actions { display: flex; gap: 8px; margin-top: 14px; }
.ro-actions .btn-play { flex: 1; }
.ro-actions .btn-ghost { margin: 0; }

/* ------------------------------------------------------------------ custom game lobby */
#room {
  position: fixed;
  inset: 0;
  z-index: 19;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 16px 16px;
  overflow-y: auto;
  scrollbar-width: none;
  background: radial-gradient(ellipse 80% 60% at 50% 40%, rgba(5, 7, 13, 0.55), rgba(5, 7, 13, 0.9) 70%, rgba(3, 4, 9, 0.96));
  animation: fadein 0.3s ease both;
}
#room::-webkit-scrollbar { display: none; }
.room-top { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 980px; }
.room-top .btn-ghost { flex: none; }
.room-title { flex: 1; text-align: center; min-width: 0; }
.room-title h2 { margin: 2px 0 0; font: 400 clamp(24px, 4vw, 34px) var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-spacer { width: 84px; flex: none; }
.room-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr 1fr;
  gap: 12px;
  width: 100%;
  max-width: 980px;
  margin-top: 14px;
}
.room-grid .card { margin: 0; animation: rise 0.4s cubic-bezier(.2, .9, .3, 1) both; }
.room-grid .card header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.room-grid .card header b { font: 400 15px var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--cyan); }
.room-grid .card header span { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.room-code { display: flex; flex-direction: column; align-items: center; text-align: center; }
.room-code .label { font-size: 11px; font-weight: 800; letter-spacing: 0.3em; text-transform: uppercase; color: var(--pink); }
.code {
  margin: 6px 0 10px;
  padding: 4px 14px;
  border: 0;
  border-radius: 14px;
  background: none;
  font: 400 clamp(44px, 7vw, 60px) / 1.1 var(--display);
  letter-spacing: 0.16em;
  color: #fff;
  text-shadow: 0 0 18px rgba(62, 242, 255, 0.7), 0 0 4px rgba(62, 242, 255, 0.9);
  transition: transform 0.15s;
}
.code:hover { transform: scale(1.04); }
.room-code .row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.room-code .note { margin: 10px 0 0; }
.room-code .note b { color: var(--ink); }
.room-me { display: flex; gap: 8px; width: 100%; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--edge); }
#roomNick {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 14px;
  border-radius: 13px;
  border: 1.5px solid var(--edge);
  background: rgba(0, 0, 0, 0.25);
  color: var(--ink);
  font: 600 16px var(--font);
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}
#roomNick:focus { border-color: var(--cyan); }
#roomPlayers { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; max-height: 280px; overflow-y: auto; }
#roomPlayers li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 14px;
  animation: slidein 0.25s ease both;
}
#roomPlayers li.me { background: rgba(255, 79, 216, 0.1); border: 1px solid rgba(255, 79, 216, 0.3); }
#roomPlayers .dot { flex: none; width: 14px; height: 14px; border-radius: 50%; box-shadow: 0 0 8px rgba(255, 255, 255, 0.2); }
#roomPlayers .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
#roomPlayers .tag { padding: 1px 6px; border-radius: 6px; font-size: 10px; font-weight: 800; letter-spacing: 0.06em; }
#roomPlayers .tag.host { background: rgba(255, 210, 63, 0.18); color: var(--gold); }
#roomPlayers .tag.you { background: rgba(255, 79, 216, 0.18); color: var(--pink); }
#roomPlayers .tag.acct { color: var(--cyan); }
#roomPlayers .kick { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--edge); background: none; color: var(--muted); font-size: 16px; line-height: 1; }
#roomPlayers .kick:hover { border-color: var(--danger); color: var(--danger); }
.room-mode { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; margin-bottom: 10px; }
.room-mode .ic { grid-row: span 2; font-style: normal; font-size: 26px; }
.room-mode b { font-size: 17px; }
.room-mode span { font-size: 12px; color: var(--muted); line-height: 1.35; }
.room-dl { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin: 0; font-size: 13px; }
.room-dl dt { color: var(--muted); }
.room-dl dd { margin: 0; font-weight: 700; text-align: right; }
.room-foot { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; max-width: 560px; margin-top: 14px; }
.room-foot .btn-play { margin: 0; }
.room-status { margin: 0; font-size: 14px; color: var(--muted); text-align: center; }
.room-chat { display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 20px; font-size: 13px; color: #c9d0ec; }
.room-chat .msg { animation: rise 0.25s ease both; transition: opacity 1s; }
.room-chat .msg.old { opacity: 0.4; }
.room-chat b { color: var(--cyan); }
.emote-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.emote-row .emote { min-width: 48px; height: 36px; font-size: 14px; }

/* ------------------------------------------------------------------ create / join */
.panel.create { width: min(560px, 100%); }
.mode-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mode-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1.5px solid var(--edge);
  background: rgba(255, 255, 255, 0.03);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
}
.mode-chip i { font-style: normal; font-size: 16px; }
.mode-chip span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mode-chip[aria-checked='true'] {
  border-color: transparent;
  background:
    linear-gradient(#141a33, #141a33) padding-box,
    linear-gradient(135deg, var(--cyan), var(--pink)) border-box;
}
.goal { margin: 10px 2px 4px; font-size: 13px; color: var(--gold); min-height: 18px; }
.options .setting, .panel.create .setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.options .setting b { font-size: 14px; }
.options .seg button { padding: 6px 10px; }
.panel.create .setting.listed b { display: block; font-size: 14px; }
.panel.create .setting.listed span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.panel.create .note { margin: 10px 0 12px; }
.panel.create .btn-play { width: 100%; }

.join-panel { width: min(460px, 100%); }
.code-form { display: flex; gap: 8px; }
#joinCode {
  flex: 1;
  min-width: 0;
  height: 56px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1.5px solid var(--edge);
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  font: 400 30px var(--display);
  letter-spacing: 0.3em;
  text-align: center;
  text-transform: uppercase;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}
#joinCode::placeholder { color: var(--faint); }
#joinCode:focus { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(62, 242, 255, 0.12); }
.code-form .btn-play { width: 110px; height: 56px; }
.open-games { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--edge); }
.open-games header { margin-bottom: 8px !important; }
.open-games header b { font: 400 15px var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--cyan); }
#openList { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; min-height: 60px; }
#openList li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.05); }
#openList .info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#openList .info b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#openList .info span { font-size: 12px; color: var(--muted); }
#openList .empty { justify-content: center; color: var(--muted); font-size: 13px; border: 0; background: none; }

/* ------------------------------------------------------------------ trophies */
.panel.trophies { width: min(640px, 100%); }
.trophy-head { margin-bottom: 12px; font-size: 14px; color: var(--muted); }
.trophy-head b { color: #fff; }
.xpbar.wide { width: 100%; margin-top: 6px; }
#trophyFill { background: linear-gradient(90deg, var(--gold), var(--orange)); }
.trophy-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.trophy-list li {
  display: grid;
  grid-template-columns: 34px 1fr;
  column-gap: 8px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  opacity: 0.6;
}
.trophy-list li.got { opacity: 1; border-color: rgba(255, 210, 63, 0.4); background: rgba(255, 210, 63, 0.06); }
.trophy-list .ic { grid-row: span 3; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: rgba(255, 255, 255, 0.06); font-style: normal; font-size: 18px; filter: grayscale(1); }
.trophy-list li.got .ic { filter: none; background: rgba(255, 210, 63, 0.16); }
.trophy-list b { font-size: 13px; }
.trophy-list .desc { font-size: 12px; color: var(--muted); line-height: 1.3; }
.trophy-list .xp { font-size: 11px; font-weight: 700; color: var(--cyan); margin-top: 3px; }
.trophy-list li.got .xp { color: var(--lime); }

.locker-tabs { margin: 0 0 10px; }
.tabs.slim .tab { height: 30px; font-size: 12px; }

/* ------------------------------------------------------------------ animation */
@keyframes breathe { 50% { opacity: 0.35; } }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.22); color: var(--gold); } 100% { transform: scale(1); } }
@keyframes confetti { to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; } }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slidein { from { transform: translateX(-16px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeout { to { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes count {
  0% { transform: translate(-50%, -50%) scale(2.2); opacity: 0; }
  25% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  75% { opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(0.85); opacity: 0; }
}
@keyframes flicker { 0%, 92%, 100% { opacity: 1; } 93% { opacity: 0.4; } 94% { opacity: 1; } 96% { opacity: 0.55; } 97% { opacity: 1; } }
@keyframes toast {
  0% { transform: scale(0.3); opacity: 0; }
  14% { transform: scale(1.12); opacity: 1; }
  24% { transform: scale(1); }
  78% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-26px); }
}

/* ------------------------------------------------------------------ small screens */
@media (max-width: 860px) {
  .room-grid { grid-template-columns: 1fr 1fr; }
  .room-code { grid-column: span 2; }
}
@media (max-width: 640px) {
  #menu { padding-bottom: 16px; }
  .party-row { gap: 6px; }
  .party-btn { flex-direction: column; gap: 4px; padding: 9px 6px; text-align: center; }
  .party-btn span { align-items: center; }
  .party-btn b { font-size: 13px; }
  .room-grid { grid-template-columns: 1fr; }
  .room-code { grid-column: auto; }
  /* the start button stays in reach on phones */
  .room-foot { position: sticky; bottom: -16px; padding: 12px 0 16px; background: linear-gradient(rgba(5, 7, 13, 0), rgba(5, 7, 13, 0.94) 22%); }
  #roomPlayers { max-height: none; }
  .room-spacer { display: none; }
  .mode-chips { grid-template-columns: repeat(2, 1fr); }
  .options .setting { flex-direction: column; align-items: flex-start; gap: 6px; }
  .options .seg { width: 100%; }
  .options .seg button { flex: 1; padding: 6px 4px; }
  .emote-wheel { left: 10px; bottom: 170px; grid-template-columns: repeat(4, auto); }
  .touch .emote-wheel { bottom: 200px; }
  #roundbar { padding: 6px 12px; font-size: 12px; }
  #rbTimer { font-size: 17px; min-width: 38px; }
  .spec-bar { top: auto; bottom: 12px; font-size: 12px; }
  .podium canvas { height: 50px; }
  .menu-main, #menu.has-results .menu-main { margin-top: 78px; }
  .xpbar { width: 96px; }
  .tagline { letter-spacing: 0.26em; margin-bottom: 16px; }
  .modes { grid-template-columns: 1fr 1fr; gap: 8px; }
  .mode { display: grid; grid-template-columns: 26px 1fr; column-gap: 8px; align-items: center; padding: 9px 10px; }
  .mode svg { grid-row: span 3; width: 24px; height: 24px; margin: 0; }
  .mode b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mode .desc { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mode .live { margin: 2px 0 0; font-size: 10.5px; }
  #leaderboard { width: 152px; font-size: 12px; padding: 7px 9px; }
  #leaderboard h3 { font-size: 12px; }
  #lbList li:nth-child(n + 6) { display: none; }
  #lbList li::before { width: 16px; }
  #minimap { width: 112px; height: 112px; }
  #modebar { top: 10px; left: 10px; transform: none; }
  #killfeed { top: 50px; max-width: calc(100% - 184px); }
  .tbar { width: 54px; }
  .tn { font-size: 0; }
  .tn b { font-size: 12px; }
  .tn.a b { color: var(--aqua); }
  .tn.b b { color: var(--magma); }
  #teambar, #brbar { gap: 6px; font-size: 12px; padding: 6px 10px; }
  #scorebox .len b { font-size: 28px; }
  .kf { font-size: 11px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid .span2 { grid-column: span 2; }
}
@media (max-width: 480px) {
  .gbtn.compact span, #qualityText { display: none; }
  .gbtn.compact { padding: 0 11px; }
  .acct-chip { max-width: 104px; padding: 0 9px; }
  .settings { gap: 6px; }
  .icon-btn { min-width: 38px; height: 38px; padding: 0 8px; }
  .gbtn.compact, .acct-chip { height: 38px; }
  .xpbar { width: 64px; }
  .topbar { padding: 12px; }
}
@media (max-height: 540px) {
  .menu-main, #menu.has-results .menu-main { margin-top: 62px; }
  .logo, #menu.has-results .logo { font-size: 44px; }
  .tagline { margin: 2px 0 10px; }
  .btn-play { height: 54px; }
  #rChart { display: none; }
  #leaderboard { width: 170px; font-size: 12px; padding: 7px 9px; }
  #lbList li:nth-child(n + 6) { display: none; }
  .touch #minimap { bottom: 12px; right: 190px; width: 96px; height: 96px; }
  #shedBtn { margin-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
