/* 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 80px;
  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); }

.menu-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 540px;
  margin-top: clamp(70px, 12vh, 130px);
}

.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 {
  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 {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  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; }

/* 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 .menu-foot { position: static; transform: none; margin-top: 18px; }
#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; }

#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; }

/* ------------------------------------------------------------------ animation */
@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 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: 640px) {
  #menu { padding-bottom: 16px; }
  .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; gap: 8px; }
  .mode { display: grid; grid-template-columns: 30px 1fr auto; column-gap: 12px; align-items: center; padding: 10px 12px; }
  .mode svg { grid-row: span 2; margin: 0; }
  .mode .live { grid-column: 3; grid-row: 1 / span 2; margin: 0; }
  .menu-foot { position: static; transform: none; margin-top: auto; padding-top: 20px; }
  #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; }
}
