* {
  box-sizing: border-box;
}

:root {
  --bg: #f2f7ff;
  --text: #1f2c3c;
  --game-bg: radial-gradient(circle at 20% 20%, #f8fcff 0%, #dde8f6 72%);
  --panel-bg: rgba(255, 255, 255, 0.85);
  --panel-border: rgba(86, 112, 145, 0.28);
  --panel-shadow: rgba(80, 112, 156, 0.14);
  --input-bg: rgba(255, 255, 255, 0.94);
  --input-border: rgba(77, 104, 139, 0.35);
  --mode-bg: rgba(236, 244, 255, 0.95);
  --mode-border: rgba(86, 112, 145, 0.32);
  --bar-bg: rgba(90, 120, 160, 0.2);
  --score-bg: rgba(255, 255, 255, 0.6);
  --score-border: rgba(85, 112, 146, 0.24);
  --xp-fill: linear-gradient(90deg, #5ab2ff, #7ad7ff);
}

html[data-theme="dark"] {
  --bg: #0f1824;
  --text: #d6e4ff;
  --game-bg: radial-gradient(circle at 20% 20%, #1c2b3f 0%, #111a28 72%);
  --panel-bg: rgba(16, 26, 40, 0.86);
  --panel-border: rgba(117, 148, 188, 0.36);
  --panel-shadow: rgba(0, 0, 0, 0.38);
  --input-bg: rgba(20, 33, 49, 0.94);
  --input-border: rgba(107, 141, 184, 0.48);
  --mode-bg: rgba(26, 42, 61, 0.96);
  --mode-border: rgba(95, 129, 170, 0.5);
  --bar-bg: rgba(102, 134, 176, 0.28);
  --score-bg: rgba(24, 37, 54, 0.78);
  --score-border: rgba(95, 129, 170, 0.34);
  --xp-fill: linear-gradient(90deg, #4a94f1, #6bc6f1);
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
}

#game {
  width: 100vw;
  height: 100vh;
  display: block;
  background: var(--game-bg);
  transform-origin: center;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  transform-origin: center;
}

#fpsCounter {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 35;
  pointer-events: none;
  min-width: 76px;
  padding: 5px 9px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--panel-bg);
  box-shadow: 0 8px 18px var(--panel-shadow);
  color: var(--text);
  font: 700 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-align: center;
}

.panel {
  position: fixed;
  pointer-events: auto;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  backdrop-filter: blur(6px);
  padding: 10px;
  box-shadow: 0 10px 22px var(--panel-shadow);
}

.badge {
  background: #4a90e2;
  color: #fff;
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 11px;
  margin-left: 4px;
  vertical-align: middle;
}

#profile-panel {
  right: calc(50% + 260px);
  top: 12px;
  width: 260px;
  z-index: 12;
}
@media (max-width: 1020px) {
  #profile-panel {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    top: 12px;
    width: min(500px, calc(100vw - 32px));
  }
}

#helpPanel {
  color: #dce8ff;
}

#top-left {
  left: 50%;
  transform: translateX(-50%);
  top: 12px;
  width: min(500px, calc(100vw - 32px));
  display: grid;
  gap: 6px;
}

/* ── Rank sidebar: always hidden, replaced by #rankPopup ──── */
#rank-panel { display: none !important; }

/* ── Rank popup (above player bar rank section) ──────────── */
#rankPopup {
  position: fixed;
  z-index: 100;
  pointer-events: auto;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  backdrop-filter: blur(12px);
  padding: 12px 14px;
  box-shadow: 0 8px 28px var(--panel-shadow);
  font-size: 11px;
  width: 200px;
  display: none;
  transform-origin: bottom center;
}
#rankPopup.visible {
  display: block;
  animation: rankPopupIn 0.14s ease;
}
@keyframes rankPopupIn {
  from { opacity: 0; transform: translateY(6px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)   scale(1);    }
}
.rp-title {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .1em;
  opacity: 0.42;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.rp-rank-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 5px;
  font-weight: 700;
  font-size: 12px;
}
.rp-xp-bar {
  height: 5px;
  border-radius: 99px;
  background: var(--bar-bg);
  margin-bottom: 4px;
  overflow: hidden;
}
.rp-xp-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--xp-fill);
  transition: width 0.5s ease;
}
.rp-xp-text {
  font-size: 10px;
  opacity: 0.55;
  margin-bottom: 7px;
}
.rp-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
}
.rp-stat {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.rp-stat-val {
  font-weight: 800;
  font-size: 13px;
}
.rp-stat-lbl {
  font-size: 9px;
  opacity: 0.45;
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* ── Perk tooltip ────────────────────────────────────────── */
#perkTooltip {
  position: fixed;
  z-index: 400;
  background: rgba(8,14,28,0.96);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 7px 11px;
  pointer-events: none;
  display: none;
  max-width: 190px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.55);
  color: #fff;
}
.perk-tip-name {
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 3px;
  letter-spacing: .02em;
  color: #fff;
}
.perk-tip-desc {
  font-size: 10px;
  opacity: 0.65;
  line-height: 1.45;
  color: #fff;
}

/* ── Left column: chat + stats stacked at bottom-left ─────── */
#left-col {
  position: fixed;
  left: 12px;
  bottom: 12px;
  width: 260px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  z-index: 10;
}
#left-col > * { pointer-events: auto; }

/* ── Chat panel: in right column below minimap ───────────── */
#chatPanel {
  position: relative;
  background: rgba(8, 14, 22, 0.28);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  backdrop-filter: blur(4px);
  padding: 6px 8px;
  box-shadow: none;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 5px;
  height: 180px;
  transition: background 0.2s;
}
#chatPanel:hover,
#chatPanel:focus-within {
  background: rgba(8, 14, 22, 0.55);
}
html:not([data-theme="dark"]) #chatPanel {
  background: rgba(220, 235, 255, 0.22);
  border-color: rgba(0,0,0,0.08);
}
html:not([data-theme="dark"]) #chatPanel:hover,
html:not([data-theme="dark"]) #chatPanel:focus-within {
  background: rgba(220, 235, 255, 0.55);
}
#chatPanel.hidden { display: none; }
#chatPanel.collapsed { height: auto; }
#chatPanel.collapsed #chatLog,
#chatPanel.collapsed #chatInput { display: none; }

/* ── Siege base status panel ──────────────────────────────── */
#siegeBaseStatus {
  background: rgba(5, 9, 20, 0.86);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 9px;
  backdrop-filter: blur(12px);
  padding: 7px 9px 5px;
  min-width: 182px;
}
.sbs-title {
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: rgba(255,255,255,0.32);
  text-transform: uppercase;
  margin-bottom: 5px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sbs-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 3px;
  border-radius: 4px;
  margin-bottom: 2px;
  min-height: 17px;
}
.sbs-row.sbs-me { background: rgba(255,255,255,0.08); }
.sbs-row.sbs-dead { opacity: 0.58; }
.sbs-sw {
  width: 3px;
  border-radius: 2px;
  align-self: stretch;
  flex-shrink: 0;
  min-height: 12px;
}
.sbs-lbl {
  font-size: 9px;
  font-weight: 800;
  width: 40px;
  flex-shrink: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: rgba(255,255,255,0.80);
  letter-spacing: 0.02em;
}
.sbs-row.sbs-me .sbs-lbl { color: #fff; font-weight: 900; }
.sbs-row.sbs-dead .sbs-lbl {
  color: rgba(255,255,255,0.35);
  text-decoration: line-through;
  text-decoration-color: rgba(255,255,255,0.22);
}
.sbs-bar-wrap {
  flex: 1;
  height: 5px;
  background: rgba(255,255,255,0.07);
  border-radius: 3px;
  overflow: hidden;
  min-width: 0;
}
.sbs-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.25s linear;
}
.sbs-pct {
  font-size: 9px;
  font-weight: 700;
  min-width: 30px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  color: rgba(255,255,255,0.60);
  white-space: nowrap;
}
.sbs-row.sbs-me .sbs-pct { color: #fff; font-weight: 900; }
.sbs-dead-txt {
  flex: 1;
  text-align: right;
  font-size: 8px;
  font-weight: 700;
  color: rgba(255,255,255,0.28);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sbs-lives {
  font-size: 6px;
  color: rgba(255,208,0,0.82);
  flex-shrink: 0;
  line-height: 1;
  margin-left: -2px;
}

#stats {
  position: relative;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  padding: 4px 0;
}

/* ── Bottom player bar ───────────────────────────────────── */
#playerBar {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: min(960px, calc(100vw - 280px));
  height: 58px;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 29px;
  box-shadow: 0 8px 28px var(--panel-shadow);
  backdrop-filter: blur(10px);
  pointer-events: none;
  z-index: 15;
}
#playerBar.visible { display: flex; }
.pbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid rgba(74, 158, 255, 0.45);
  display: none;
}
.pbar-avatar.has-img { display: block; }
.pbar-identity {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  flex-shrink: 0;
  max-width: 150px;
}
.pbar-name {
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.15;
}
.pbar-tank {
  font-size: 10px;
  opacity: 0.5;
  white-space: nowrap;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.pbar-divider {
  width: 1px;
  height: 30px;
  flex-shrink: 0;
  background: var(--panel-border);
  opacity: 0.6;
}
.pbar-lvl {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.07em;
  background: linear-gradient(110deg, #2a7fe2, #5ba6ff);
  color: #fff;
  border-radius: 6px;
  padding: 4px 10px;
  flex-shrink: 0;
  white-space: nowrap;
  text-shadow: none;
  pointer-events: auto;
  cursor: default;
}
.pbar-lvl .rank-badge {
  cursor: pointer;
}
.pbar-xp-wrap {
  flex: 1;
  position: relative;
  height: 13px;
  min-width: 80px;
  border-radius: 99px;
  background: var(--bar-bg);
  overflow: hidden;
}
.pbar-xp-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--xp-fill);
  transition: width 0.4s cubic-bezier(.25, .8, .25, 1);
}
.pbar-xp-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}
.pbar-score-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
  line-height: 1.2;
}
.pbar-score-label {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.1em;
  opacity: 0.45;
  text-transform: uppercase;
}
.pbar-score-val {
  font-size: 16px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.pbar-order {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 99px;
  white-space: nowrap;
  flex-shrink: 0;
  display: none;
}
.pbar-order.defend { display: block; color: #93c5fd; background: rgba(96,165,250,0.15); }
.pbar-order.attack { display: block; color: #fca5a5; background: rgba(248,113,113,0.15); }

/* ── Persistent rank progress in player bar ──────────────── */
.pbar-rank-sec {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  pointer-events: auto;
  cursor: pointer;
  border-radius: 6px;
  padding: 3px 6px;
  transition: background 0.15s;
}
.pbar-rank-sec:hover { background: rgba(255,255,255,0.07); }
.pbar-perk-chip { pointer-events: auto; }
.menu-coin-badge {
  font-size: 11px;
  font-weight: 700;
  color: #FFD700;
  white-space: nowrap;
  letter-spacing: 0.03em;
  margin-left: 2px;
}
.coin-hud-float {
  position: fixed;
  bottom: 84px;
  right: 24px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
  color: #FFD700;
  background: var(--panel-bg);
  border: 1px solid rgba(255, 215, 0, 0.25);
  border-radius: 20px;
  padding: 4px 12px;
  pointer-events: none;
  z-index: 15;
  backdrop-filter: blur(8px);
}
.pbar-rank-lbl {
  font-size: 7px;
  font-weight: 800;
  letter-spacing: .1em;
  opacity: 0.38;
  text-transform: uppercase;
  white-space: nowrap;
}
.pbar-rank-cur {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: .02em;
  white-space: nowrap;
}
.pbar-rank-bar {
  width: 50px;
  height: 5px;
  background: rgba(255,255,255,0.1);
  border-radius: 99px;
  overflow: hidden;
  flex-shrink: 0;
}
.pbar-rank-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.5s cubic-bezier(.25,.8,.25,1);
}
.pbar-rank-nxt {
  font-size: 14px;
  font-weight: 700;
  opacity: 0.32;
  white-space: nowrap;
}

#right-col {
  position: fixed;
  right: 12px;
  top: 12px;
  width: 220px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 24px);
  pointer-events: none;
  z-index: 10;
}
#right-col > * { pointer-events: auto; }

/* Leaderboard: solid panel, no border */
#leaderboard {
  position: relative;
  background: rgba(255, 255, 255, 0.94);
  border: none;
  box-shadow: none;
  backdrop-filter: blur(10px);
  border-radius: 10px;
  padding: 6px 6px;
  color: #1a2332;
}
html[data-theme="dark"] #leaderboard {
  background: rgba(8, 16, 34, 0.90);
  color: #d4e2f4;
}

/* Minimap: always visible, no border */
#minimapPanel {
  position: relative;
  height: 210px;
  flex-shrink: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  padding: 0;
  opacity: 1;
}
html[data-theme="dark"] #minimapPanel { opacity: 0.92; }

#minimapCanvas {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  border: none;
  background: transparent;
  display: block;
}

/* Upgrades: fixed top-left, no border */
#upgrades {
  position: fixed;
  top: 56px;
  left: 12px;
  width: 254px;
  max-height: calc(100vh - 56px - 90px);
  overflow-y: auto;
  display: none;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  pointer-events: auto;
  z-index: 10;
}
#upgrades.in-game { display: block; }

#top-left.in-game {
  display: none;
}

.hidden {
  display: none !important;
}

#chatLog {
  overflow-y: auto;
  padding-right: 4px;
  font-size: 12px;
  line-height: 1.35;
}

.chat-line {
  margin-bottom: 4px;
  color: #2a3950;
}

.chat-line .from {
  font-weight: 700;
  margin-right: 6px;
}

.chat-line.system {
  color: #6a7b95;
  font-style: italic;
}

.event-feed {
  position: fixed;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  width: min(360px, calc(100vw - 280px));
  display: grid;
  gap: 2px;
  z-index: 20;
  pointer-events: none;
}

.event-item {
  background: transparent;
  border: none;
  border-radius: 4px;
  padding: 1px 6px;
  color: rgba(31, 44, 60, 0.82);
  font-size: 12px;
  font-weight: 600;
  box-shadow: none;
  backdrop-filter: none;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: eventFadeIn 0.15s ease;
}

@keyframes eventFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

html[data-theme="dark"] .event-item {
  color: rgba(214, 228, 255, 0.65);
}

.event-item.kill  { color: rgba(74, 222, 128, 0.9); }
.event-item.dead  { color: rgba(248, 113, 113, 0.9); }

.kf-sep { opacity: 0.4; padding: 0 2px; }

#bossWarningEl {
  display: none;
  position: fixed;
  bottom: 56px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
  text-align: center;
  pointer-events: none;
  user-select: none;
  background: rgba(8,14,28,0.88);
  border: 1.5px solid rgba(248,113,113,0.45);
  border-radius: 12px;
  padding: 6px 20px 8px;
  display: none;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}
#bossWarningEl.active { display: flex; animation: bwPulse 1s ease-in-out infinite; }
.bw-label {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: #ef4444;
  text-shadow: 0 0 10px rgba(239,68,68,0.55);
  text-transform: uppercase;
}
.bw-count {
  font-size: 24px;
  font-weight: 900;
  color: #f87171;
  line-height: 1;
  min-width: 28px;
  text-shadow: 0 0 14px rgba(248,113,113,0.7);
}
@keyframes bwPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.78; }
}

html[data-theme="dark"] .chat-line {
  color: #b8cfe8;
}

html[data-theme="dark"] .chat-line.system {
  color: #6a8aaa;
}

/* event-item.kill / .dead colors defined above */

.kill-banner {
  position: fixed;
  left: 50%;
  top: 118px;
  z-index: 24;
  min-width: min(360px, calc(100vw - 48px));
  max-width: calc(100vw - 48px);
  transform: translate(-50%, -16px) scale(0.98);
  pointer-events: none;
  opacity: 0;
  text-align: center;
  transition: opacity 0.16s ease, transform 0.16s ease;
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.55);
}

.kill-banner.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.kill-banner-title {
  color: #FACC15;
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

.kill-banner-subtitle {
  margin-top: 6px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

input,
select,
button {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  padding: 8px 10px;
}

button {
  background: linear-gradient(110deg, #2a7fe2, #5ba6ff);
  border: none;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
}

button:hover {
  filter: brightness(1.08);
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.mode-arena {
  grid-template-columns: repeat(3, 1fr);
}

.mode-btn {
  font-size: 12px;
  padding: 7px 8px;
  background: var(--mode-bg);
  color: var(--text);
  border: 1px solid var(--mode-border);
}

.mode-btn.active {
  background: linear-gradient(110deg, #2a7fe2, #5ba6ff);
  color: #fff;
  border: none;
}

.lobby-count {
  display: inline-block;
  background: rgba(255,255,255,0.22);
  border-radius: 8px;
  font-size: 10px;
  padding: 1px 5px;
  margin-left: 3px;
  min-width: 14px;
  text-align: center;
  visibility: hidden;
}
.lobby-count.has-players {
  visibility: visible;
}

.small {
  font-size: 12px;
  opacity: 0.92;
}

.hint {
  opacity: 0.7;
}

.title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  opacity: 0.88;
  margin-bottom: 7px;
}

.game-logo {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: center;
  color: #4a9eff;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.game-logo span {
  color: #f9b458;
}

.row {
  display: grid;
  grid-template-columns: minmax(110px, 1.35fr) minmax(110px, 1.7fr) auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 5px;
  font-size: 12px;
}

.bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--bar-bg);
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #e76f51, #f7b267);
}

.xp-bar > i {
  background: var(--xp-fill);
}

.stat-bar > i {
  background: linear-gradient(90deg, var(--stat-color, #5a8fdd), var(--stat-color, #5a8fdd));
}

.row-label {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-value {
  min-width: 38px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}

.tank-btn {
  width: 100%;
  margin-bottom: 6px;
  text-align: left;
  font-size: 12px;
  background: var(--mode-bg);
  border: 1px solid var(--mode-border);
  color: var(--text);
}

.upgrade-tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
  margin-top: 4px;
}

.tank-upgrade-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px 6px;
  gap: 4px;
  width: 100%;
  margin-bottom: 0;
  text-align: center;
}

.tank-upgrade-tile.locked {
  opacity: 0.65;
  cursor: default;
  filter: grayscale(0.2);
}

.tank-preview {
  width: 80px;
  height: 54px;
  display: block;
}

.tank-upgrade-tile .tank-preview {
  width: 100%;
  height: 42px;
}

.tank-upgrade-name {
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.tank-upgrade-key {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border-radius: 5px;
  background: rgba(77, 150, 255, 0.22);
  border: 1px solid rgba(77, 150, 255, 0.4);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  padding: 0 3px;
}

.tank-btn:last-child {
  margin-bottom: 0;
}

/* ── Leaderboard rows (ghost style) ─────────────────────── */
.lb-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  padding: 2px 2px;
  overflow: hidden;
}
.lb-tc {
  width: 3px;
  align-self: stretch;
  border-radius: 2px;
  flex-shrink: 0;
  min-height: 14px;
  opacity: 0.85;
}
.lb-rank {
  opacity: 0.55;
  min-width: 14px;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
  text-align: right;
}
.lb-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: block;
}
.lb-info {
  flex: 1;
  overflow: hidden;
  min-width: 0;
}
.lb-name {
  font-weight: 800;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.lb-tank-name {
  font-size: 9.5px;
  opacity: 0.6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.lb-score {
  font-size: 10.5px;
  font-weight: 700;
  opacity: 0.78;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  margin-left: 2px;
}
.lb-hp-track {
  height: 2px;
  background: rgba(128, 128, 128, 0.2);
  border-radius: 1px;
  margin-bottom: 3px;
}
.lb-hp-fill {
  height: 100%;
  border-radius: 1px;
  transition: width 0.3s;
}

/* ── Stat panel: points badge ────────────────────────────── */
.pnl-points {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #4ade80;
  text-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
  margin-bottom: 5px;
  padding: 0 2px;
}

/* ── Chat title (inside chatPanel) ──────────────────────── */
.chat-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  opacity: 0.5;
}

.dead-screen {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 40px));
  padding: 28px 24px;
  border-radius: 16px;
  border: 1px solid var(--panel-border);
  background: color-mix(in srgb, var(--panel-bg) 92%, transparent 8%);
  color: var(--text);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
  backdrop-filter: blur(12px);
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}

.dead-screen.show {
  opacity: 1;
}

.dead-screen h2 {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #F87171;
}

.dead-screen p {
  margin: 0;
  font-size: 13px;
  opacity: 0.75;
}

#menuBtn {
  position: fixed;
  top: 12px;
  left: 12px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px var(--panel-shadow);
  backdrop-filter: blur(6px);
  padding: 0;
  width: 36px;
  pointer-events: auto;
  z-index: 10;
}

#menuBtn.visible {
  display: flex;
}

#menuBtn:hover {
  filter: brightness(1.15);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

#chatToggleBtn {
  width: auto;
  padding: 2px 8px;
  font-size: 11px;
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
}

#chatToggleBtn:hover {
  filter: brightness(1.2);
}

#chatPanel.collapsed #chatLog,
#chatPanel.collapsed #chatInput {
  display: none;
}

#chatPanel.collapsed {
  height: auto;
  min-height: 0;
}

#stats { transition: opacity 0.3s; }
#stats.no-points { opacity: 0.5; }
#stats.no-points:hover { opacity: 1; }
#stats.has-points { opacity: 1; }

@keyframes statsPulse {
  0%   { filter: drop-shadow(0 0 6px rgba(74, 222, 128, 0.7)); }
  100% { filter: drop-shadow(0 0 0px rgba(74, 222, 128, 0)); }
}

/* ── Stat point ready indicator ────────────────────────── */
@keyframes pointsGlow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(22,197,94,0.45), 0 0 12px rgba(22,197,94,0.3);
    background: linear-gradient(135deg, #0c4a22 0%, #166534 55%, #0c4a22 100%);
    border-color: rgba(34,197,94,0.75);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(22,197,94,0.18), 0 0 38px rgba(22,197,94,0.95), 0 0 65px rgba(22,197,94,0.38);
    background: linear-gradient(135deg, #14532d 0%, #16a34a 55%, #14532d 100%);
    border-color: rgba(74,222,128,1);
    transform: scale(1.05);
  }
}
@keyframes pointsArrow {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-3px); }
}
@keyframes pointsSheen {
  0%        { left: -60%; opacity: 0; }
  6%        { opacity: 1; }
  50%, 100% { left: 160%; opacity: 0; }
}
.pnl-points {
  position: relative;
  overflow: hidden;
  animation: pointsGlow 0.85s ease-in-out infinite;
  transform-origin: center;
  will-change: transform, box-shadow;
  font-size: 12px;
  font-weight: 900;
  color: #4ade80;
  border: 2px solid rgba(34,197,94,0.75);
  border-radius: 7px;
  padding: 6px 12px;
  text-align: center;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  cursor: default;
  text-shadow: 0 0 18px rgba(34,197,94,1), 0 0 6px rgba(74,222,128,0.8), 0 1px 3px rgba(0,0,0,0.5);
}
.pnl-points::before {
  content: "";
  position: absolute;
  top: -10%;
  left: -60%;
  width: 45%;
  height: 120%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.42) 50%, transparent);
  transform: skewX(-18deg);
  animation: pointsSheen 1.7s ease-in-out infinite;
  pointer-events: none;
}
.pnl-points-arrow {
  display: inline-block;
  animation: pointsArrow 0.7s ease-in-out infinite;
  margin-right: 4px;
}

/* ── Dash indicator in player bar ─────────────────────── */
.dash-ind {
  position: relative;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.dash-ring {
  position: absolute;
  top: 0; left: 0;
  width: 38px; height: 38px;
  transform: rotate(-90deg);
}
.dash-track {
  fill: none;
  stroke: rgba(255,255,255,0.1);
  stroke-width: 3;
}
.dash-fill {
  fill: none;
  stroke: #5BBFFF;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 94.25;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.12s linear, stroke 0.2s;
}
.dash-q-label {
  position: relative;
  z-index: 1;
  font-size: 12px;
  font-weight: 900;
  color: #5BBFFF;
  line-height: 1;
  margin-top: 2px;
}
.dash-sub {
  position: relative;
  z-index: 1;
  font-size: 6px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #5BBFFF;
  opacity: 0.7;
  line-height: 1;
}

/* ── Siege HUD bars ──────────────────────────────────────── */
#siegeHud {
  display: flex;
  flex-direction: row;
  gap: 8px;
  flex-shrink: 0;
  align-items: flex-end;
}
.siege-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 100px;
}
.siege-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px;
}
.siege-bar-lbl {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.65);
  text-transform: uppercase;
}
.siege-bar-pct {
  font-size: 9px;
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  font-variant-numeric: tabular-nums;
}
.siege-bar-track {
  width: 100%;
  height: 9px;
  background: rgba(255,255,255,0.1);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
}
.siege-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.15s linear, background 0.4s;
}
.siege-bar-ally  { background: #44dd66; }
.siege-bar-enemy { background: #ff4444; }

/* ── Perk chips in player bar ──────────────────────────── */
.pbar-perks {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  align-items: center;
  max-width: 120px;
  flex-shrink: 0;
}
.pbar-perk-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  padding: 2px 5px;
  border-radius: 4px;
  opacity: 0.92;
  cursor: default;
  white-space: nowrap;
}

@media (max-width: 900px) {
  #right-col { width: 190px; }
  #left-col   { width: 220px; }
  #upgrades   { width: 220px; }
  #minimapPanel { height: 180px; }
  #playerBar {
    width: calc(100vw - 260px);
    height: 50px;
    padding: 0 14px;
    gap: 10px;
  }
  .pbar-name { font-size: 13px; }
  .pbar-score-val { font-size: 14px; }
}

/* ── Tank Tree Panel ─────────────────────────────────────── */
.tt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 10px;
  border-bottom: 1px solid rgba(116,192,252,0.2);
  flex-shrink: 0;
}
.tt-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #74C0FC;
}
.tt-close {
  background: none;
  border: 1px solid rgba(116,192,252,0.3);
  color: #74C0FC;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tt-close:hover { background: rgba(116,192,252,0.15); }
.tt-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 10px 16px 16px;
  overflow-y: auto;
  flex: 1;
}
.tt-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}
.tt-row-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(116,192,252,0.08);
  align-self: flex-start;
}
.tt-cards {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
}
.tt-connector {
  padding-left: 20px;
  color: rgba(180,210,255,0.35);
  font-size: 13px;
  margin-bottom: 2px;
  user-select: none;
}
.tt-card {
  background: rgba(16,28,50,0.7);
  border: 1px solid;
  border-radius: 7px;
  padding: 5px 7px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  cursor: pointer;
  transition: background 0.12s;
}
.tt-card:hover { background: rgba(116,192,252,0.1); }
.tt-card.tt-selected {
  background: rgba(116,192,252,0.18);
  box-shadow: 0 0 0 2px rgba(116,192,252,0.55);
}
.tt-preview { display: block; }
.tt-name {
  font-size: 11px;
  font-weight: 700;
  color: #d6e4ff;
}
.tt-has-children {
  font-size: 9px;
  color: rgba(180,210,255,0.45);
  margin-top: 1px;
}

/* ── Servers button ───────────────────────────────────────────── */
.servers-btn {
  width: 100%;
  margin-top: 4px;
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid rgba(94,234,212,0.35);
  background: rgba(94,234,212,0.08);
  color: #5eead4;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.servers-btn:hover { background: rgba(94,234,212,0.18); border-color: rgba(94,234,212,0.6); }

/* Arena button running indicator */
.mode-btn.arena-running::after {
  content: "●";
  font-size: 7px;
  color: #5eead4;
  margin-left: 4px;
  vertical-align: super;
}

/* Play button join-mode variant */
#spawnBtn.join-mode {
  background: linear-gradient(135deg, #0d4f3c 0%, #1a6b52 100%);
  border-color: rgba(94,234,212,0.5);
  color: #5eead4;
}

/* ── Servers panel ────────────────────────────────────────────── */
.sv-empty {
  color: rgba(180,210,255,0.45);
  font-size: 12px;
  margin-top: 24px;
  text-align: center;
}
.sv-card {
  background: rgba(16,28,50,0.8);
  border: 1px solid rgba(94,234,212,0.2);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.sv-label {
  font-size: 13px;
  font-weight: 700;
  color: #d6e4ff;
  flex: 1;
}
.sv-meta {
  font-size: 11px;
  color: rgba(180,210,255,0.5);
  display: flex;
  gap: 5px;
  align-items: center;
}
.sv-players { color: #5eead4; font-weight: 700; }
.sv-dot { opacity: 0.35; }
.sv-join-btn {
  padding: 6px 16px;
  border-radius: 6px;
  border: 1px solid rgba(94,234,212,0.5);
  background: rgba(94,234,212,0.1);
  color: #5eead4;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s;
}
.sv-join-btn:hover { background: rgba(94,234,212,0.25); }

/* ── Admin panel ──────────────────────────────────────────────── */
.adm-auth {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 40px;
}
.adm-label {
  font-size: 11px;
  color: rgba(180,210,255,0.5);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.adm-input {
  padding: 7px 12px;
  border-radius: 6px;
  border: 1px solid rgba(248,113,113,0.4);
  background: rgba(10,20,40,0.8);
  color: #f8d6d6;
  font-size: 13px;
  width: 220px;
  outline: none;
}
.adm-input:focus { border-color: rgba(248,113,113,0.8); }
.adm-btn {
  padding: 7px 24px;
  border-radius: 6px;
  border: 1px solid rgba(248,113,113,0.5);
  background: rgba(248,113,113,0.12);
  color: #f87171;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s;
}
.adm-btn:hover { background: rgba(248,113,113,0.25); }
.adm-err { font-size: 11px; color: #f87171; margin-top: 2px; }
.adm-list { display: flex; flex-direction: column; gap: 8px; }
.adm-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(16,28,50,0.8);
  border: 1px solid rgba(248,113,113,0.18);
  border-radius: 8px;
  padding: 10px 14px;
}
.adm-row-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.adm-row-label { font-size: 13px; font-weight: 700; color: #d6e4ff; }
.adm-row-meta { font-size: 10px; color: rgba(180,210,255,0.45); }
.adm-stop-btn {
  padding: 5px 14px;
  border-radius: 6px;
  border: 1px solid rgba(248,113,113,0.5);
  background: rgba(248,113,113,0.12);
  color: #f87171;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s;
}
.adm-stop-btn:hover { background: rgba(248,113,113,0.28); }
.adm-stop-btn:disabled { opacity: 0.4; cursor: default; }

/* ── Mobile / Touch ─────────────────────────────────────────────── */
@media (pointer: coarse) {
  /* Bigger tap targets on lobby screen */
  #spawnBtn { padding: 13px 10px; font-size: 15px; }
  #menuBtn { width: 44px; height: 44px; font-size: 20px; }
  .mode-btn { padding: 6px 8px; font-size: 11px; }
  input, select { font-size: 16px; }

  @media (max-width: 540px) {
    #top-left { width: 180px; }
    #top-left .small { font-size: 10px; }
  }

  /* ── During gameplay: clean canvas-first layout ── */
  body.mobile-playing #top-left   { display: none !important; }
  body.mobile-playing #left-col   { display: none !important; }
  body.mobile-playing #upgrades   { display: none !important; }
  body.mobile-playing #fpsCounter { display: none !important; }
  body.mobile-playing #menuBtn    { display: flex; position: fixed; top: 8px; left: 8px; z-index: 80; }

  /* Right column: minimap on top, leaderboard below — narrow strip */
  body.mobile-playing #right-col {
    display: flex !important;
    flex-direction: column;
    width: 120px;
    position: fixed;
    top: 8px;
    right: 8px;
    gap: 3px;
    z-index: 65;
  }
  body.mobile-playing #minimapPanel {
    height: 110px;
    border-radius: 8px;
    overflow: hidden;
  }
  body.mobile-playing #leaderboard {
    font-size: 9px;
    max-height: 160px;
    overflow: hidden;
    border-radius: 8px;
  }

  /* Player bar: bottom status strip */
  body.mobile-playing #playerBar {
    bottom: 12px;
    width: calc(100vw - 16px);
    max-width: none;
    left: 8px;
    right: 8px;
    height: 50px;
    transform: none;
  }
}

/* ── Mobile Controls Overlay ───────────────────────────────────── */
#mobCtrl {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 68;
  pointer-events: none;
}
body.touch-device.mobile-playing #mobCtrl { display: block; }

#mobJoyPad {
  position: absolute;
  left: 20px;
  bottom: 78px;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  border: 2.5px solid rgba(255,255,255,0.22);
  pointer-events: auto;
  touch-action: none;
  user-select: none;
}
#mobJoyKnob {
  position: absolute;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(126,200,245,0.65);
  box-shadow: 0 0 14px rgba(126,200,245,0.45);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: transform 0.04s linear;
}

#mobFireZone {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 78px;
  width: 55%;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding-bottom: 28px;
  padding-right: 28px;
}
#mobFireZone::after {
  content: "";
  display: block;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: rgba(248,113,113,0.08);
  border: 2.5px solid rgba(248,113,113,0.25);
  pointer-events: none;
  transition: background 0.08s, border-color 0.08s;
}
#mobFireZone.active::after {
  background: rgba(248,113,113,0.28);
  border-color: rgba(248,113,113,0.65);
}

#mobTopBtns {
  position: absolute;
  left: 8px;
  bottom: 216px;
  display: flex;
  flex-direction: row;
  gap: 8px;
  pointer-events: auto;
}
.mob-toggle-btn {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.35);
  color: rgba(255,255,255,0.6);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
}
.mob-toggle-btn.active {
  background: rgba(96,165,250,0.28);
  border-color: rgba(96,165,250,0.55);
  color: #93c5fd;
}

/* ── Mobile Stat Strip ─────────────────────────────────────────── */
#mobStatStrip {
  display: none;
  position: fixed;
  top: 8px;
  left: 8px;
  right: 136px;
  z-index: 70;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 5px;
  padding: 4px 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
#mobStatStrip::-webkit-scrollbar { display: none; }
body.touch-device.mobile-playing #mobStatStrip { display: flex; }

.mob-stat-btn {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  height: 52px;
  border-radius: 10px;
  background: rgba(8,14,28,0.72);
  border: 1.5px solid rgba(255,255,255,0.1);
  gap: 2px;
  cursor: pointer;
  padding: 4px 6px;
}
.mob-stat-btn.can-up {
  border-color: var(--sc, rgba(255,255,255,0.3));
  background: rgba(8,14,28,0.85);
}
.mob-stat-btn.full { opacity: 0.22; }

/* ── Perk choice modal ─────────────────────────────────── */
.perk-modal-box {
  background: rgba(10,17,32,0.97);
  border: 1px solid rgba(96,165,250,0.3);
  border-radius: 12px;
  padding: 28px 32px 24px;
  max-width: 680px;
  width: 90vw;
  text-align: center;
  color: #e2e8f0;
  font-family: -apple-system, "Segoe UI", sans-serif;
}
.perk-modal-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #93c5fd;
  margin-bottom: 4px;
}
.perk-modal-subtitle {
  font-size: 11px;
  opacity: 0.5;
  margin-bottom: 20px;
}
.perk-cards {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-bottom: 16px;
}
.perk-card {
  flex: 1;
  max-width: 180px;
  border: 1.5px solid rgba(96,165,250,0.2);
  border-radius: 8px;
  padding: 14px 12px;
  cursor: pointer;
  background: rgba(30,41,59,0.7);
  transition: border-color 0.15s, background 0.15s;
}
.perk-card:hover { border-color: rgba(96,165,250,0.55); background: rgba(30,41,59,0.95); }
.perk-card.selected { border-color: #60a5fa; background: rgba(30,58,100,0.8); }
.perk-card-name {
  font-size: 13px;
  font-weight: 600;
  color: #bfdbfe;
  margin-bottom: 6px;
}
.perk-card-desc {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.45;
}
.perk-modal-error {
  font-size: 11px;
  color: #f87171;
  min-height: 16px;
  margin-bottom: 10px;
}
.perk-confirm-btn {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 28px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.15s;
}
.perk-confirm-btn:not([disabled]) { opacity: 1; }
.perk-confirm-btn:not([disabled]):hover { background: #1d4ed8; }

/* ── Second wind toast ────────────────────────────────── */
.second-wind-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(16,185,129,0.92);
  color: #fff;
  font-family: -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 12px 28px;
  border-radius: 8px;
  z-index: 400;
  pointer-events: none;
  animation: swToastFade 2.2s ease-out forwards;
}
@keyframes swToastFade {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(1); }
}
