:root {
  --bg: #050810;
  --panel: rgba(12, 17, 36, 0.66);
  --panel-solid: #0c1124;
  --line: rgba(130, 170, 255, 0.14);
  --line-strong: rgba(130, 170, 255, 0.28);
  --text: #eaf0ff;
  --muted: #8b97ba;
  --cyan: #3cf2ff;
  --violet: #9b6bff;
  --pink: #ff3cac;
  --lime: #b6ff3c;
  --radius: 20px;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Unbounded', 'Manrope', system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

#bg, #game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#game { cursor: crosshair; touch-action: none; }

/* ---------- lobby ---------- */
#lobby {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px clamp(16px, 4vw, 40px);
}
.brand-mini {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: 0.18em; color: var(--muted);
}
.pulse {
  width: 8px; height: 8px; border-radius: 50%; background: var(--lime);
  box-shadow: 0 0 0 0 rgba(182, 255, 60, 0.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(182, 255, 60, 0.55); }
  70% { box-shadow: 0 0 0 10px rgba(182, 255, 60, 0); }
  100% { box-shadow: 0 0 0 0 rgba(182, 255, 60, 0); }
}
.top-actions { display: flex; align-items: center; gap: 10px; }
.online { font-size: 13px; color: var(--muted); margin-right: 6px; }
.icon-btn {
  height: 38px; min-width: 38px; padding: 0 12px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-weight: 700; font-size: 13px; letter-spacing: 0.06em;
  transition: border-color 0.2s, color 0.2s, transform 0.15s;
}
.icon-btn:hover { border-color: var(--line-strong); color: var(--cyan); }
.icon-btn:active { transform: scale(0.95); }

.lobby-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 16px 40px;
}

.logo {
  margin: clamp(8px, 3vh, 36px) 0 0;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(42px, 8vw, 96px);
  line-height: 1;
  letter-spacing: -0.01em;
  background: linear-gradient(95deg, var(--cyan) 0%, var(--violet) 45%, var(--pink) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 28px rgba(60, 242, 255, 0.28));
  animation: sheen 8s ease-in-out infinite alternate;
  text-align: center;
}
.logo span { font-weight: 500; margin-left: 0.12em; }
@keyframes sheen { from { background-position: 0% 0; } to { background-position: 100% 0; } }
.tagline { margin: 14px 0 26px; color: var(--muted); font-size: clamp(14px, 1.6vw, 17px); font-weight: 600; text-align: center; }

.modes { display: flex; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; justify-content: center; }
.mode {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px 10px 12px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  text-align: left; transition: border-color 0.2s, box-shadow 0.2s;
}
.mode.active { border-color: rgba(60, 242, 255, 0.55); box-shadow: 0 0 0 1px rgba(60, 242, 255, 0.2), 0 0 30px rgba(60, 242, 255, 0.12); }
.mode:disabled { cursor: default; opacity: 0.6; }
.mode-icon { width: 46px; height: 46px; border-radius: 12px; flex: none; display: block; box-shadow: 0 0 0 1px rgba(130, 170, 255, 0.18); }
.mode.active .mode-icon { box-shadow: 0 0 0 1px rgba(60, 242, 255, 0.5), 0 0 18px rgba(60, 242, 255, 0.35); }
.mode-wrap { position: relative; }
.mode { padding-right: 44px; }
.info-btn {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 50%;
  font-family: var(--display); font-weight: 900; font-size: 13px; line-height: 1;
  color: var(--cyan); background: rgba(60, 242, 255, 0.08); border: 1px solid rgba(60, 242, 255, 0.4);
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
.info-btn:hover { background: rgba(60, 242, 255, 0.2); transform: translateY(-50%) scale(1.1); }
.info-btn.on { background: var(--cyan); color: #041018; }
.info-pop {
  position: relative; width: min(920px, 100%); margin: 0 0 18px; padding: 22px 26px;
  animation: pop 0.3s cubic-bezier(0.2, 1.3, 0.4, 1);
}
.info-close { position: absolute; top: 10px; right: 14px; font-size: 24px; line-height: 1; color: var(--muted); width: 32px; height: 32px; border-radius: 10px; }
.info-close:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.info-title { font-family: var(--display); font-weight: 700; font-size: 20px; }
.info-goal { margin: 6px 0 18px; font-size: 15px; font-weight: 600; color: #c9d3f0; line-height: 1.5; }
.info-cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 26px; }
.info-cols ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.info-cols li { font-size: 14px; font-weight: 600; line-height: 1.45; color: #dce3fa; padding-left: 16px; position: relative; }
.info-cols ul:not(.keys) li::before { content: ''; position: absolute; left: 0; top: 0.55em; width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.info-cols .keys li { padding-left: 0; display: flex; align-items: center; gap: 10px; }
kbd {
  flex: none; min-width: 96px; text-align: center; padding: 5px 9px; border-radius: 8px;
  font: 800 12.5px var(--font); color: var(--text);
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line-strong); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.35);
}
.keys span { color: var(--muted); font-size: 13.5px; }
.mode-text { display: flex; flex-direction: column; }
.mode-name { font-family: var(--display); font-weight: 700; font-size: 15px; }
.mode-sub { font-size: 12px; color: var(--muted); font-weight: 600; }
.badge {
  position: absolute; top: -8px; right: -8px;
  padding: 3px 8px; border-radius: 99px; font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  background: linear-gradient(90deg, var(--pink), var(--violet)); color: #fff;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.play-card {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  padding: 28px;
}
.col { display: flex; flex-direction: column; min-width: 0; }
.field-label { font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.field-label:not(:first-child) { margin-top: 20px; }

.input {
  width: 100%; height: 50px; padding: 0 16px; border-radius: 14px;
  background: rgba(3, 6, 16, 0.6); border: 1px solid var(--line); color: var(--text);
  font: 700 17px var(--font); outline: none; transition: border-color 0.2s, box-shadow 0.2s;
  user-select: text;
}
.input::placeholder { color: #56618a; font-weight: 600; }
.input:focus { border-color: rgba(60, 242, 255, 0.6); box-shadow: 0 0 0 4px rgba(60, 242, 255, 0.1); }

.skin-picker {
  display: flex; align-items: center; gap: 8px;
  background: rgba(3, 6, 16, 0.45); border: 1px solid var(--line); border-radius: 16px; padding: 6px;
}
#skin-preview { flex: 1; min-width: 0; height: 110px; display: block; }
.arrow {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  font-size: 26px; line-height: 1; color: var(--muted);
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line);
  transition: color 0.2s, border-color 0.2s, transform 0.12s;
}
.arrow:hover { color: var(--cyan); border-color: var(--line-strong); }
.arrow:active { transform: scale(0.92); }
.skin-name { text-align: center; font-family: var(--display); font-weight: 700; font-size: 14px; margin: 10px 0 8px; letter-spacing: 0.04em; }
.skin-dots { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; }
.skin-dot {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.12); transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.skin-dot:hover { transform: scale(1.15); }
.skin-dot.sel { border-color: #fff; box-shadow: 0 0 12px rgba(255, 255, 255, 0.45); }
.skin-note { margin-top: 10px; text-align: center; font-size: 12px; color: #5d6890; font-weight: 600; }

.rooms { display: flex; flex-direction: column; gap: 10px; }
.rooms-empty { padding: 26px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 14px; }
.room {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: 14px; text-align: left;
  background: rgba(255, 255, 255, 0.025); border: 1px solid var(--line);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s, transform 0.12s;
}
.room:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.045); }
.room:active { transform: scale(0.99); }
.room.sel { border-color: rgba(60, 242, 255, 0.6); background: rgba(60, 242, 255, 0.06); box-shadow: 0 0 24px rgba(60, 242, 255, 0.1); }
.room-name { font-family: var(--display); font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.room-tag { font-family: var(--font); font-size: 10px; font-weight: 800; letter-spacing: 0.08em; padding: 2px 6px; border-radius: 6px; background: rgba(155, 107, 255, 0.18); color: #c9b3ff; }
.room-sub { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 3px; }
.room-r { text-align: right; flex: none; }
.room-players { font-weight: 800; font-size: 14px; display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.room-bots { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #3a4466; }
.live-dot.on { background: var(--lime); box-shadow: 0 0 8px var(--lime); }

.btn-play {
  position: relative; overflow: hidden;
  margin-top: 18px; height: 58px; border-radius: 16px;
  font-family: var(--display); font-weight: 900; font-size: 20px; letter-spacing: 0.08em; text-transform: uppercase; color: #041018;
  background: linear-gradient(95deg, var(--cyan), #7dffcf 50%, var(--lime));
  box-shadow: 0 10px 40px rgba(60, 242, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
}
.btn-play::after {
  content: ''; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-20deg); animation: shine 3.2s ease-in-out infinite;
}
@keyframes shine { 0%, 60% { left: -60%; } 100% { left: 130%; } }
.btn-play:hover { transform: translateY(-2px); box-shadow: 0 16px 50px rgba(60, 242, 255, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.6); filter: brightness(1.05); }
.btn-play:active { transform: translateY(0) scale(0.98); }
.btn-ghost {
  height: 50px; padding: 0 22px; border-radius: 14px; font-weight: 800; font-size: 15px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line-strong);
  transition: background 0.2s, border-color 0.2s;
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.35); }
.btn-ghost.wide { width: 100%; margin-top: 18px; }
.hint { margin-top: 12px; text-align: center; font-size: 12.5px; color: var(--muted); font-weight: 600; }

.pillars {
  list-style: none; padding: 0; margin: 26px 0 0;
  width: min(920px, 100%);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.pillars li {
  padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line);
  background: rgba(8, 12, 28, 0.5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; flex-direction: column; gap: 4px;
}
.pillars b { font-size: 13.5px; color: var(--text); }
.pillars span { font-size: 12.5px; color: var(--muted); font-weight: 500; line-height: 1.45; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud button, #hud .panel { pointer-events: auto; }
.panel {
  background: rgba(8, 12, 28, 0.6); border: 1px solid var(--line); border-radius: 16px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.hud-tl { position: absolute; top: 14px; left: 14px; display: flex; flex-direction: column; gap: 10px; }
.hud-btns { display: flex; gap: 8px; }
.hud-btn {
  height: 36px; padding: 0 14px; border-radius: 11px; font-weight: 800; font-size: 13px;
  background: rgba(8, 12, 28, 0.6); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: border-color 0.2s, color 0.2s;
}
.hud-btn:hover { border-color: var(--line-strong); color: var(--cyan); }
#killfeed { display: flex; flex-direction: column; gap: 5px; }
.feed-item {
  align-self: flex-start;
  padding: 6px 11px; border-radius: 10px; font-size: 12.5px; font-weight: 700;
  background: rgba(8, 12, 28, 0.55); border: 1px solid var(--line);
  animation: feedIn 0.25s ease-out; transition: opacity 0.5s, transform 0.5s;
}
.feed-item.out { opacity: 0; transform: translateX(-10px); }
@keyframes feedIn { from { opacity: 0; transform: translateX(-12px); } }

.hud-tr { position: absolute; top: 14px; right: 14px; width: 230px; padding: 12px 14px; }
.panel-title { font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
#lb-list { list-style: none; margin: 0; padding: 0; counter-reset: none; }
#lb-list li { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; padding: 3px 0; }
#lb-list li.me { color: var(--cyan); }
#lb-list .pos { width: 18px; color: var(--muted); font-size: 12px; text-align: right; flex: none; }
#lb-list li:nth-child(1) .pos { color: #ffd23c; }
#lb-list li:nth-child(2) .pos { color: #cfd8ff; }
#lb-list li:nth-child(3) .pos { color: #ff9f6b; }
#lb-list .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#lb-list .bot { font-style: normal; font-size: 9.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: #6f7aa3; border: 1px solid #333d63; border-radius: 5px; padding: 0 4px; vertical-align: 1px; }
#lb-list .sc { font-variant-numeric: tabular-nums; color: #c4cdea; }
#lb-me { margin-top: 6px; padding-top: 7px; border-top: 1px solid var(--line); font-size: 12.5px; font-weight: 800; color: var(--cyan); }
#lb-me:empty { display: none; }

.hud-bl { position: absolute; left: 18px; bottom: 16px; }
.score { display: flex; align-items: baseline; gap: 8px; }
#hud-score {
  font-family: var(--display); font-weight: 900; font-size: 40px; line-height: 1;
  background: linear-gradient(90deg, #fff, #bfefff); -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 24px rgba(60, 242, 255, 0.25);
  font-variant-numeric: tabular-nums;
}
.score-lbl { font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; }
.kills { font-size: 13px; font-weight: 700; color: var(--muted); margin-top: 4px; }
.kills span:first-child { color: var(--pink); font-weight: 900; }

#minimap { position: absolute; right: 16px; bottom: 16px; border-radius: 50%; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); }
#hud-stats { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
#hud-help {
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  padding: 9px 16px; border-radius: 12px; font-size: 13px; font-weight: 700; white-space: nowrap;
  background: rgba(8, 12, 28, 0.6); border: 1px solid var(--line); transition: opacity 1s;
}
#hud-help.fade { opacity: 0; }
#boost-btn {
  display: none; position: absolute; right: 24px; bottom: 150px;
  width: 84px; height: 84px; border-radius: 50%;
  font-family: var(--display); font-weight: 900; font-size: 12px; letter-spacing: 0.06em;
  background: radial-gradient(circle at 40% 35%, rgba(255, 60, 172, 0.55), rgba(155, 107, 255, 0.35));
  border: 2px solid rgba(255, 255, 255, 0.25); touch-action: none;
}
@media (pointer: coarse) {
  #boost-btn { display: block; }
  #hud-help { display: none; }
}

/* ---------- Tron HUD ---------- */
#tron-hud { position: fixed; inset: 0; pointer-events: none; }
#tron-hud button, #tron-hud .panel { pointer-events: auto; }
.tr-top { position: absolute; top: 72px; left: 18px; width: 262px; }
.tr-phase { font-family: var(--display); font-weight: 700; font-size: 26px; line-height: 1.2; letter-spacing: 0.01em; }
.tr-sub { margin-top: 8px; font-size: 15px; font-weight: 700; color: var(--muted); line-height: 1.45; }
.tr-panel { position: absolute; top: 16px; right: 16px; width: 268px; padding: 16px 18px; }
.tr-panel .panel-title { font-size: 12.5px; margin-bottom: 10px; }
.tr-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 16px; font-weight: 700; }
.tr-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-row .w { color: var(--muted); font-size: 13px; }
.tr-row.dead { opacity: 0.4; text-decoration: line-through; }
.tr-row.me .nm { color: #fff; }
.tr-row.me { background: rgba(60, 242, 255, 0.08); margin: 0 -8px; padding: 7px 8px; border-radius: 10px; }
.dot { display: inline-block; width: 14px; height: 14px; border-radius: 4px; flex: none; }
.bot { font-style: normal; font-size: 10px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: #6f7aa3; border: 1px solid #333d63; border-radius: 5px; padding: 0 4px; vertical-align: 2px; }
.tr-queue {
  width: 100%; margin-top: 14px; height: 48px; border-radius: 13px; font-weight: 800; font-size: 16px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line-strong);
}
.tr-queue.on { color: #041018; border: 0; background: linear-gradient(95deg, var(--cyan), var(--lime)); }
.tr-count {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-family: var(--display); font-weight: 900; font-size: clamp(80px, 16vw, 200px); line-height: 1;
  color: #fff; text-shadow: 0 0 30px rgba(60, 242, 255, 0.8), 0 0 80px rgba(155, 107, 255, 0.6);
}
.tr-count.pop { animation: countPop 0.9s ease-out; }
.tr-count.word { font-size: clamp(40px, 6vw, 84px); letter-spacing: 0.04em; }
@keyframes countPop { from { transform: translate(-50%, -50%) scale(1.6); opacity: 0; } 25% { opacity: 1; } to { transform: translate(-50%, -50%) scale(1); } }
#tr-stats { position: absolute; bottom: 16px; right: 18px; font-size: 13px; font-weight: 700; color: var(--muted); }
.hud-help {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 700; text-align: center; max-width: calc(100vw - 32px);
  background: rgba(8, 12, 28, 0.7); border: 1px solid var(--line); transition: opacity 1s;
}
.hud-help.fade { opacity: 0; }
#tr-help { left: 18px; transform: none; width: 262px; text-align: left; line-height: 1.5; font-size: 14px; }
#tr-help.fade { opacity: 1; }
.tr-result {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(440px, calc(100vw - 32px)); padding: 28px; text-align: center; pointer-events: auto;
  animation: pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.tr-res-title { font-family: var(--display); font-weight: 900; font-size: 34px; text-shadow: 0 0 24px currentColor; }
.tr-res-list { list-style: none; margin: 18px 0 14px; padding: 0; text-align: left; }
.tr-res-list li { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 11px; font-weight: 700; font-size: 17px; }
.tr-res-list li.me { background: rgba(60, 242, 255, 0.1); }
.tr-res-list .pos { width: 22px; color: var(--muted); text-align: right; }
.tr-res-list li:first-child .pos { color: #ffd23c; }
.tr-res-next { font-size: 15px; color: var(--muted); font-weight: 700; }
@media (max-width: 979px) {
  .tr-top { top: 58px; left: 50%; transform: translateX(-50%); width: calc(100vw - 32px); text-align: center; }
  .tr-phase { font-size: 19px; }
  .tr-sub { margin-top: 3px; font-size: 13px; }
  .tr-panel { top: auto; bottom: 10px; right: 10px; width: 190px; padding: 10px 12px; background: rgba(8, 12, 28, 0.82); }
  .tr-row { font-size: 13.5px; padding: 3px 0; }
  .tr-queue { height: 40px; font-size: 14px; margin-top: 8px; }
  #tr-help { left: 50%; transform: translateX(-50%); width: auto; text-align: center; font-size: 13px; top: auto; }
  #tr-help.fade { opacity: 0; }
}

/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(2, 4, 12, 0.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.3s ease-out;
  z-index: 10;
}
@keyframes fadeIn { from { opacity: 0; } }
.death-card { width: min(440px, 100%); padding: 30px 28px 24px; text-align: center; animation: pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes pop { from { transform: scale(0.9); opacity: 0; } }
.death-title {
  font-family: var(--display); font-weight: 900; font-size: 30px;
  background: linear-gradient(90deg, var(--pink), var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.death-sub { margin-top: 8px; color: var(--muted); font-weight: 700; min-height: 1.3em; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 22px 0; }
.stats div { padding: 14px 10px; border-radius: 14px; background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.stats b { font-family: var(--display); font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats span { font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.death-actions { display: flex; gap: 10px; }
.death-actions .btn-play { flex: 1; margin-top: 0; height: 50px; font-size: 16px; }

.settings-card { width: min(460px, 100%); padding: 26px 24px 22px; max-height: calc(100vh - 32px); overflow-y: auto; }
.settings-title { font-family: var(--display); font-weight: 700; font-size: 20px; margin-bottom: 14px; }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 14px; cursor: default; }
label.set-row { cursor: pointer; }
.seg { display: flex; background: rgba(3, 6, 16, 0.6); border: 1px solid var(--line); border-radius: 11px; padding: 3px; }
.seg button { padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 700; color: var(--muted); transition: background 0.2s, color 0.2s; }
.seg button.on { background: linear-gradient(90deg, rgba(60, 242, 255, 0.22), rgba(155, 107, 255, 0.22)); color: var(--text); box-shadow: inset 0 0 0 1px rgba(60, 242, 255, 0.35); }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: #1b2240; border: 1px solid var(--line); transition: background 0.2s; pointer-events: none; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #8b97ba; transition: transform 0.2s, background 0.2s; }
.switch input:checked + i { background: linear-gradient(90deg, rgba(60, 242, 255, 0.45), rgba(155, 107, 255, 0.45)); }
.switch input:checked + i::after { transform: translateX(18px); background: #fff; }
.range { width: 160px; accent-color: var(--cyan); }

#toast {
  position: fixed; top: 70px; left: 50%; transform: translate(-50%, -10px);
  padding: 10px 18px; border-radius: 12px; font-weight: 800; font-size: 14px;
  background: rgba(8, 12, 28, 0.8); border: 1px solid rgba(255, 60, 172, 0.45); box-shadow: 0 0 30px rgba(255, 60, 172, 0.25);
  opacity: 0; pointer-events: none; z-index: 20; white-space: nowrap;
}
#toast.show { animation: toast 2.2s ease-out forwards; }
@keyframes toast {
  0% { opacity: 0; transform: translate(-50%, -10px); }
  12%, 75% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -6px); }
}

@media (max-width: 760px) {
  .play-card { grid-template-columns: 1fr; gap: 8px; padding: 20px 16px; }
  .col + .col .field-label { margin-top: 18px; }
  .pillars { grid-template-columns: 1fr; }
  .info-cols { grid-template-columns: 1fr; gap: 16px; }
  .info-pop { padding: 18px 16px; }
  .online { display: none; }
  .hud-tr { width: 170px; padding: 9px 10px; }
  #lb-list li { font-size: 11.5px; }
  #lb-list li:nth-child(n+6) { display: none; }
  #hud-score { font-size: 30px; }
}

/* ---------- coins ---------- */
/* USDC coin icon (same design as the coins on the map) */
.coin {
  display: inline-block; width: 1em; height: 1em; border-radius: 50%; flex: none; vertical-align: -0.14em; margin-right: 0.35em;
  background: url(/img/usdc.svg) center / contain no-repeat;
  box-shadow: 0 0 0.55em rgba(60, 140, 255, 0.45);
}
.balance-chip {
  height: 38px; padding: 0 14px; border-radius: 12px; display: inline-flex; align-items: center;
  background: linear-gradient(90deg, rgba(255, 207, 58, 0.14), rgba(255, 207, 58, 0.05)); border: 1px solid rgba(255, 207, 58, 0.35);
  font-weight: 800; font-size: 15px; color: #ffe27a; font-variant-numeric: tabular-nums;
}
.balance-chip.shake { animation: shake 0.45s; border-color: #ff4b6e; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.stakes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stake {
  height: 46px; border-radius: 13px; font-family: var(--display); font-weight: 700; font-size: 17px; color: #ffe27a;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); transition: border-color 0.2s, background 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.stake:hover { border-color: rgba(255, 207, 58, 0.45); }
.stake.on { border-color: #ffcf3a; background: rgba(255, 207, 58, 0.12); box-shadow: 0 0 20px rgba(255, 207, 58, 0.18); }
.stake.dim { opacity: 0.4; }
.stake-note { margin: 8px 0 2px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.stake-note.warn { color: #ff7a8a; }
.play-stake { margin-left: 12px; padding: 4px 10px; border-radius: 10px; background: rgba(4, 16, 24, 0.18); font-size: 16px; display: inline-flex; align-items: center; }
.btn-play.poor { filter: grayscale(0.85) brightness(0.7); }

.hud-coins {
  position: absolute; left: 18px; bottom: 96px; width: 210px; padding: 12px 14px; border-radius: 16px;
  background: rgba(8, 12, 28, 0.66); border: 1px solid rgba(255, 207, 58, 0.28);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); pointer-events: auto;
}
.hc-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 700; color: var(--muted); }
.hc-row b { font-family: var(--display); font-size: 22px; color: #ffe27a; display: inline-flex; align-items: center; font-variant-numeric: tabular-nums; }
.hc-row.small { margin-top: 4px; }
.hc-row.small b { font-family: var(--font); font-size: 14px; color: var(--text); }
.cash-btn {
  position: relative; overflow: hidden; width: 100%; height: 40px; margin-top: 10px; border-radius: 11px;
  font-weight: 800; font-size: 13.5px; color: #1b1300; background: linear-gradient(95deg, #ffe27a, #ffb21e);
  touch-action: none;
}
.cash-btn i { position: absolute; inset: 0; background: rgba(255, 255, 255, 0.55); transform-origin: left; transform: scaleX(0); }
.cash-btn span { position: relative; }
.cash-btn.active { box-shadow: 0 0 24px rgba(255, 200, 40, 0.6); }
.death-coins { margin-top: 12px; font-family: var(--display); font-weight: 700; font-size: 20px; }
.death-coins:empty { display: none; }
.death-coins.lost { color: #ff7a8a; }
.death-coins.won { color: #ffe27a; }
.death-title.win { background: linear-gradient(90deg, #ffe27a, #ffb21e); -webkit-background-clip: text; background-clip: text; }
.tr-money { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.tr-money div { display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: 700; color: var(--muted); padding: 8px 12px; border-radius: 12px; background: rgba(255, 207, 58, 0.06); border: 1px solid rgba(255, 207, 58, 0.2); }
.tr-money b { color: #ffe27a; font-family: var(--display); font-size: 18px; display: inline-flex; align-items: center; }
.tr-res-money { margin-top: 10px; font-family: var(--display); font-weight: 700; font-size: 20px; }
.tr-res-money:empty { display: none; }
.tr-res-money.won { color: #ffe27a; }
.tr-res-money.lost { color: #ff7a8a; font-size: 15px; }
#lb-list .sc { display: inline-flex; align-items: center; }
@media (max-width: 979px) {
  .tr-money { flex-direction: row; justify-content: center; margin-top: 6px; }
  .tr-money div { padding: 4px 10px; gap: 8px; }
}
@media (max-width: 760px) {
  .hud-coins { width: 170px; bottom: 80px; left: 10px; padding: 9px 10px; }
  .hc-row b { font-size: 18px; }
}
/* ---------- Tron match result in the lobby ---------- */
.match-result { position: relative; width: min(920px, 100%); margin: 0 0 18px; padding: 20px 26px; text-align: center; animation: pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1); }
.mr-kicker { font-size: 12px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.mr-title { margin-top: 6px; font-family: var(--display); font-weight: 900; font-size: 30px; text-shadow: 0 0 24px currentColor; }
.mr-money { margin-top: 6px; font-family: var(--display); font-weight: 700; font-size: 20px; }
.mr-money:empty { display: none; }
.mr-money.won { color: #ffe27a; }
.mr-money.lost { color: #ff7a8a; font-size: 15px; }
.mr-list { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 14px 0 0; padding: 0; }
.mr-list li { padding: 5px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); font-size: 13px; font-weight: 700; }
.mr-list li:first-child { border-color: rgba(255, 210, 60, 0.5); color: #ffe27a; }
/* ---------- login ---------- */
.login-card { width: min(420px, 100%); padding: 26px 24px 22px; position: relative; text-align: center; }
.login-sub { color: var(--muted); font-size: 14px; font-weight: 600; line-height: 1.5; margin: 6px 0 18px; }
.google-btn {
  width: 100%; height: 48px; border-radius: 13px; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: #fff; color: #1f1f1f; font-weight: 800; font-size: 15px; transition: transform 0.12s, box-shadow 0.2s;
}
.google-btn:hover { box-shadow: 0 6px 24px rgba(255, 255, 255, 0.15); }
.google-btn:active { transform: scale(0.98); }
.login-or { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; }
.login-or::before, .login-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.check { display: flex; gap: 10px; align-items: flex-start; text-align: left; margin: 14px 0 4px; font-size: 13px; font-weight: 600; color: #c9d3f0; cursor: pointer; line-height: 1.4; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--cyan); flex: none; }
.btn-play.small { width: 100%; height: 48px; font-size: 14px; margin-top: 14px; }
.login-msg { min-height: 1.3em; margin-top: 10px; color: #ff7a8a; font-size: 13px; font-weight: 700; }
.sent-icon { color: var(--cyan); margin: 8px auto 4px; display: block; }
.user-menu { position: relative; }
.user-chip { gap: 8px; max-width: 240px; }
.user-chip #user-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; letter-spacing: 0; }
.avatar { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; font-size: 12px; font-weight: 900; color: #041018; background: linear-gradient(135deg, var(--cyan), var(--violet)); }
.user-drop { position: absolute; right: 0; top: 46px; padding: 6px; min-width: 150px; z-index: 5; }
.user-drop button { width: 100%; text-align: left; padding: 9px 12px; border-radius: 9px; font-weight: 700; font-size: 14px; }
.user-drop button:hover { background: rgba(255, 255, 255, 0.06); }
.login-btn { color: var(--cyan); border-color: rgba(60, 242, 255, 0.4); }
@media (max-width: 760px) { .user-chip #user-email { display: none; } }
/* ---------- mobile controls (Pro) ---------- */
.joy-base { position: fixed; z-index: 3; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; border: 3px solid rgba(130, 170, 255, 0.4); background: rgba(12, 17, 36, 0.35); pointer-events: none; }
.joy-knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; border-radius: 50%; background: rgba(60, 242, 255, 0.55); box-shadow: 0 0 18px rgba(60, 242, 255, 0.5); transform: translate(-50%, -50%); }
.dpad { display: none; position: absolute; right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: 180px; height: 180px; pointer-events: auto; }
.dpad button { position: absolute; width: 64px; height: 64px; border-radius: 18px; font-size: 24px; color: var(--cyan); background: rgba(12, 17, 36, 0.7); border: 2px solid var(--line-strong); touch-action: none; }
.dpad button:active { background: rgba(60, 242, 255, 0.25); }
.dpad [data-d="0"] { left: 58px; top: 0; }
.dpad [data-d="3"] { left: 0; top: 58px; }
.dpad [data-d="1"] { right: 0; top: 58px; }
.dpad [data-d="2"] { left: 58px; bottom: 0; }
@media (pointer: coarse) {
  .dpad { display: block; }
  #tr-help { display: none; }
  #boost-btn { width: 96px; height: 96px; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); font-size: 14px; }
  .hud-coins { bottom: auto; top: 64px; left: 10px; width: 170px; }
  .cash-btn { height: 48px; font-size: 14px; }
}
/* ---------- Streak on phones: arena, D-pad and panels never overlap ---------- */
.touch-only { display: none; }
@media (pointer: coarse) { .touch-only { display: flex; } }
.dpad { transform-origin: center; }
/* landscape: [info] [arena] [pad]; .pad-left mirrors it */
#tron-hud.m-land .tr-top { top: 62px; left: 10px; right: auto; transform: none; width: calc(var(--col) - 20px); text-align: left; }
#tron-hud.m-land .tr-phase { font-size: 16px; }
#tron-hud.m-land .tr-sub { font-size: 12px; margin-top: 2px; }
#tron-hud.m-land .tr-money { flex-direction: column; margin-top: 8px; gap: 5px; }
#tron-hud.m-land .tr-money div { padding: 4px 9px; font-size: 12px; }
#tron-hud.m-land .tr-money b { font-size: 15px; }
#tron-hud.m-land .tr-panel { top: auto; bottom: 8px; left: 10px; right: auto; width: calc(var(--col) - 20px); padding: 8px 10px; }
#tron-hud.m-land .tr-row { font-size: 12.5px; padding: 2px 0; }
#tron-hud.m-land .tr-queue { height: 36px; font-size: 13px; margin-top: 6px; }
#tron-hud.m-land .dpad { right: calc((var(--col) - 180px) / 2); left: auto; top: 50%; bottom: auto; transform: translateY(-50%) scale(var(--pad-scale)); }
#tron-hud.m-land #tr-stats { right: auto; left: 50%; transform: translateX(-50%); bottom: 2px; }
#tron-hud.m-land.pad-left .dpad { left: calc((var(--col) - 180px) / 2); right: auto; }
#tron-hud.m-land.pad-left .tr-top, #tron-hud.m-land.pad-left .tr-panel { left: auto; right: 10px; }
#tron-hud.m-land.pad-left .hud-tl { left: auto; right: 10px; }
/* portrait: arena under the title, D-pad and queue side by side below */
#tron-hud.m-port .dpad { bottom: calc(10px + env(safe-area-inset-bottom, 0px)); right: 12px; left: auto; top: auto; transform: none; }
#tron-hud.m-port .tr-panel { top: auto; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); left: 12px; right: auto; width: calc(100vw - 180px - 40px); max-width: 240px; }
#tron-hud.m-port.pad-left .dpad { left: 12px; right: auto; }
#tron-hud.m-port.pad-left .tr-panel { left: auto; right: 12px; }

/* ---------- Glowbite Money: dollars, lobby leaderboard ---------- */
.faucet-btn { color: var(--lime); border-color: rgba(182, 255, 60, 0.4); }
.lobby-lb { width: min(920px, 100%); margin-top: 18px; padding: 18px 22px; }
.lb-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.lb-head .field-label { margin: 0; }
.lb-filters { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.seg.small button { padding: 5px 10px; font-size: 12.5px; }
.lobby-lb-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; }
.lobby-lb-list li { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 700; }
.lobby-lb-list li.me { color: var(--cyan); }
.lobby-lb-list .pos { width: 24px; text-align: right; color: var(--muted); }
.lobby-lb-list li:nth-child(1) .pos { color: #ffd23c; }
.lobby-lb-list li:nth-child(2) .pos { color: #cfd8ff; }
.lobby-lb-list li:nth-child(3) .pos { color: #ff9f6b; }
.lobby-lb-list .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-lb-list .val { font-variant-numeric: tabular-nums; color: #dfe6ff; }
.lobby-lb-list .val.neg { color: #ff7a8a; }
.lobby-lb-list .empty { grid-column: 1 / -1; justify-content: center; color: var(--muted); border: 0; }
.lobby-lb-me { margin-top: 10px; font-size: 13px; font-weight: 800; color: var(--cyan); }
.lobby-lb-me:empty { display: none; }
@media (max-width: 760px) { .lobby-lb-list { grid-template-columns: 1fr; } .lobby-lb { padding: 14px; } }
/* ---------- wallet ---------- */
.balance-chip { cursor: pointer; }
.wallet-card { width: min(520px, 100%); padding: 24px 22px 18px; position: relative; max-height: calc(100vh - 32px); overflow-y: auto; }
.wallet-bal { display: flex; justify-content: space-between; align-items: baseline; margin: 6px 0 14px; color: var(--muted); font-weight: 700; }
.wallet-bal b { font-family: var(--display); font-size: 28px; color: var(--text); }
.w-tabs, .w-nets { margin-bottom: 14px; }
.w-tabs button, .w-nets button { flex: 1; }
.w-addr { display: flex; gap: 8px; align-items: center; background: rgba(3, 6, 16, 0.6); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.w-addr code { flex: 1; min-width: 0; word-break: break-all; font-size: 13px; color: var(--cyan); user-select: all; }
.btn-ghost.small { height: 36px; padding: 0 12px; font-size: 13px; }
.w-note { font-size: 13px; color: var(--muted); line-height: 1.45; margin: 10px 0 0; }
.w-note.warn { color: #ffd23c; background: rgba(255, 210, 60, 0.07); border: 1px solid rgba(255, 210, 60, 0.25); border-radius: 10px; padding: 9px 11px; }
.w-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.w-fact { background: rgba(3, 6, 16, 0.6); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.w-fact span { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.w-fact b { font-size: 15px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-qr-row { display: flex; gap: 14px; align-items: flex-start; }
.w-qr { width: 132px; height: 132px; flex: none; border-radius: 12px; background: #fff; padding: 6px; }
.w-qr-side { flex: 1; min-width: 0; }
.w-qr-side .w-note { margin-top: 8px; }
.w-steps { margin: 14px 0 0; padding-left: 20px; font-size: 13px; line-height: 1.5; color: #cfd6f2; }
.w-steps li { margin: 3px 0; }
.w-amt-row { display: flex; gap: 8px; align-items: center; }
.w-amt-row .input { flex: 1; }
@media (max-width: 480px) {
  .w-qr-row { flex-direction: column; align-items: center; }
  .w-qr { width: 168px; height: 168px; }
  .w-qr-side { width: 100%; }
}
.w-quote { margin-top: 10px; font-size: 13.5px; font-weight: 700; color: #dfe6ff; min-height: 1.3em; }
.w-quote.err { color: #ff7a8a; }
#wallet-body .input + .field-label { margin-top: 14px; }
.w-history { display: flex; flex-direction: column; gap: 8px; }
.w-row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); }
.w-row-l, .w-row-r { display: flex; flex-direction: column; gap: 2px; }
.w-row-r { align-items: flex-end; }
.w-row-l span, .w-status { font-size: 12px; color: var(--muted); }
.w-row b.pos { color: var(--lime); }
.w-row b.neg { color: #ffd6dc; }
.w-status.failed { color: #ff7a8a; }
.w-status.sent, .w-status.credited { color: var(--lime); }
#wallet-msg.info { color: var(--lime); }


/* legal links: login form + page footer */
.login-legal { font-size: 13px; text-align: center; color: #8a93b8; }
.login-legal a, .legal-foot a { color: #9fb7e8; }
.legal-foot { text-align: center; font-size: 13px; color: #6f789c; padding: 24px 16px 32px; }
