/* VOID SURGE — Neon Cyber-Cosmic UI & Responsive Stylesheet */
:root {
  --bg-deep: #060714;
  --bg-mid: #100b2a;
  --panel-bg: rgba(11, 13, 34, 0.86);
  --panel-border: rgba(0, 240, 255, 0.24);
  --cyan: #00f0ff;
  --cyan-dim: rgba(0, 240, 255, 0.16);
  --magenta: #ff2a85;
  --orange: #ff7a1a;
  --gold: #ffd94a;
  --violet: #a855f7;
  --text: #eef6ff;
  --text-muted: #8fa3c7;
  --font-display: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --beat-scale: 1;
  --beat-glow: 0.4;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #140d33 0%, #060714 75%);
  color: var(--text);
  font-family: var(--font-display);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  overscroll-behavior: none;
}

#gameCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.hidden {
  display: none !important;
}

/* ===== SCREEN FLASH ===== */
.screen-flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 15;
  opacity: 0;
  background: var(--cyan);
  transition: opacity 0.28s ease-out;
}

/* ===== OVERLAY SCREENS ===== */
.overlay-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(16px + var(--safe-top)) calc(16px + var(--safe-right)) calc(16px + var(--safe-bottom)) calc(16px + var(--safe-left));
  background: radial-gradient(circle at 50% 45%, rgba(16, 11, 42, 0.58), rgba(4, 5, 16, 0.84));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transform: scale(1.02);
  transition: opacity 0.16s ease-out, transform 0.16s ease-out;
}

.overlay-screen.active {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
  transition: opacity 0.24s var(--ease-out), transform 0.24s var(--ease-out);
}

#screenTitle {
  justify-content: space-between;
  background: radial-gradient(circle at 50% 42%, rgba(12, 10, 36, 0.36), rgba(4, 5, 16, 0.72));
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

/* ===== TITLE SCREEN ===== */
.title-top-bar {
  width: 100%;
  max-width: 960px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.title-top-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.title-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 680px;
  margin: auto 0;
}

.logo-container {
  position: relative;
  text-align: center;
  padding: 12px 18px;
  transform: scale(var(--beat-scale));
  transition: transform 0.08s linear;
}

.logo-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 240px;
  height: 240px;
  margin: -120px 0 0 -120px;
  border-radius: 50%;
  border: 1px solid rgba(0, 240, 255, 0.18);
  box-shadow: 0 0 60px rgba(0, 240, 255, calc(0.14 + var(--beat-glow) * 0.25)),
              inset 0 0 40px rgba(255, 42, 133, 0.14);
  pointer-events: none;
  animation: spinSlow 24s linear infinite;
}

@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.logo-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.32em;
  color: var(--cyan);
  opacity: 0.9;
  margin-bottom: 6px;
}

.game-logo {
  margin: 0;
  font-size: clamp(44px, 11vw, 84px);
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 0.95;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.16em;
  text-transform: uppercase;
}

.logo-void {
  color: #ffffff;
  text-shadow: 0 0 18px rgba(0, 240, 255, 0.85), 0 0 44px rgba(0, 240, 255, 0.4);
}

.logo-surge {
  color: var(--cyan);
  text-shadow: 0 0 18px rgba(0, 240, 255, 0.9), 0 0 46px rgba(255, 42, 133, 0.55);
}

.logo-sub {
  margin: 10px 0 0;
  font-size: clamp(13px, 2.8vw, 16px);
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

/* Starter weapon selector */
.starter-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.starter-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.24em;
  color: var(--text-muted);
}

.starter-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.starter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(14, 18, 44, 0.72);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}

.starter-chip svg {
  width: 16px;
  height: 16px;
}

.starter-chip.selected {
  color: #fff;
  border-color: var(--cyan);
  background: rgba(0, 240, 255, 0.16);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.3);
}

.starter-chip.locked {
  opacity: 0.42;
  cursor: not-allowed;
}

.title-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 440px;
}

.title-secondary-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}

.controls-hint {
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.78;
  text-align: center;
}

.hint-mobile { display: none; }
@media (pointer: coarse) {
  .hint-desktop { display: none; }
  .hint-mobile { display: inline; }
}

.title-footer {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--gold);
  text-shadow: 0 0 12px rgba(255, 217, 74, 0.4);
}

/* ===== BUTTONS ===== */
button {
  font-family: inherit;
  border: none;
  outline: none;
  cursor: pointer;
  color: var(--text);
}

button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.btn-primary {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 14px 26px;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #04101d;
  background: linear-gradient(135deg, #00f0ff 0%, #3ef9ff 50%, #00c4ff 100%);
  box-shadow: 0 0 26px rgba(0, 240, 255, 0.45), 0 8px 24px rgba(0, 0, 0, 0.45);
  transition: transform 0.16s var(--ease-spring), box-shadow 0.2s var(--ease-out);
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.015);
  box-shadow: 0 0 36px rgba(0, 240, 255, 0.7), 0 12px 28px rgba(0, 0, 0, 0.5);
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-glow {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 25%, rgba(255, 255, 255, 0.5) 50%, transparent 75%);
  transform: translateX(-100%);
  animation: shimmer 3.2s infinite;
  pointer-events: none;
}

@keyframes shimmer {
  0%, 55% { transform: translateX(-110%); }
  100% { transform: translateX(110%); }
}

.btn-secondary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: rgba(18, 22, 54, 0.82);
  border: 1px solid rgba(0, 240, 255, 0.25);
  color: var(--text);
  transition: transform 0.15s var(--ease-out), border-color 0.2s, background 0.2s;
}

.btn-secondary:hover {
  border-color: var(--cyan);
  background: rgba(0, 240, 255, 0.14);
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: scale(0.96);
}

.btn-danger {
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: rgba(255, 42, 133, 0.15);
  border: 1px solid rgba(255, 42, 133, 0.45);
  color: #ff7fb2;
  transition: all 0.18s;
}

.btn-danger:hover {
  background: rgba(255, 42, 133, 0.28);
  color: #fff;
}

.btn-sm {
  min-height: 38px;
  padding: 6px 14px;
}

.ic-play { width: 20px; height: 20px; flex-shrink: 0; }
.ic-btn { width: 16px; height: 16px; flex-shrink: 0; }
.ic-sm { width: 14px; height: 14px; flex-shrink: 0; }
.ic-crystal { width: 16px; height: 16px; color: var(--gold); filter: drop-shadow(0 0 6px rgba(255, 217, 74, 0.7)); }

.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 20, 48, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
  font-size: 17px;
  transition: border-color 0.18s, background 0.18s, transform 0.14s;
}

.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { border-color: var(--cyan); background: rgba(0, 240, 255, 0.15); }
.icon-btn:active { transform: scale(0.92); }

.pill-btn, .crystal-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 13px;
  border-radius: 999px;
  background: rgba(14, 18, 44, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.pseudo-pill:hover { border-color: var(--cyan); }
.crystal-pill { border-color: rgba(255, 217, 74, 0.35); color: var(--gold); font-family: var(--font-mono); }
.crystal-pill-lg { font-size: 15px; height: 40px; padding: 0 15px; }

.dot-online {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22ff88;
  box-shadow: 0 0 8px #22ff88;
}
.dot-online.offline { background: var(--orange); box-shadow: 0 0 8px var(--orange); }

/* ===== HUD ===== */
.hud {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  display: flex;
  flex-direction: column;
}

.xp-bar-wrap {
  position: relative;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.xp-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00f0ff 0%, #ffd94a 100%);
  box-shadow: 0 0 14px rgba(255, 217, 74, 0.85);
  transition: width 0.12s linear;
}

.hud-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  padding: calc(10px + var(--safe-top)) calc(14px + var(--safe-right)) 0 calc(14px + var(--safe-left));
  gap: 8px;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.level-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 5px 11px;
  border-radius: 10px;
  background: rgba(8, 12, 32, 0.72);
  border: 1px solid rgba(0, 240, 255, 0.35);
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.15);
}

.label-tiny {
  font-size: 10px;
  font-weight: 800;
  color: var(--cyan);
  letter-spacing: 0.12em;
}

.level-num {
  font-size: 18px;
  font-weight: 900;
  font-family: var(--font-mono);
  color: #fff;
}

.hud-loadout {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 240px;
}

.loadout-slot {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 14, 38, 0.75);
  border: 1px solid rgba(0, 240, 255, 0.35);
  color: var(--cyan);
}

.loadout-slot.passive { border-color: rgba(168, 85, 247, 0.45); color: #c084fc; }
.loadout-slot.evolved { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 10px rgba(255, 217, 74, 0.45); }
.loadout-slot svg { width: 17px; height: 17px; }
.loadout-lv {
  position: absolute;
  right: -2px;
  bottom: -3px;
  font-size: 9px;
  font-weight: 900;
  font-family: var(--font-mono);
  background: #060714;
  padding: 0 3px;
  border-radius: 4px;
  color: #fff;
}

.hud-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hud-score {
  font-family: var(--font-mono);
  font-size: clamp(24px, 5vw, 36px);
  font-weight: 900;
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 16px rgba(0, 240, 255, 0.55);
  letter-spacing: 0.04em;
}

.hud-subrow {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.hud-sep { opacity: 0.4; }

.combo-wrap {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  animation: comboPop 0.16s var(--ease-spring);
}

@keyframes comboPop {
  0% { transform: scale(1.22); }
  100% { transform: scale(1); }
}

.combo-row {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.combo-count {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 12px rgba(255, 217, 74, 0.8);
}

.combo-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--orange);
}

.combo-bar-bg {
  width: 96px;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.combo-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--orange), var(--gold));
  transform-origin: left center;
}

.hud-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  pointer-events: auto;
}

/* Boss Banner & HP */
.boss-banner {
  position: fixed;
  left: 0;
  right: 0;
  top: 22%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  background: linear-gradient(90deg, transparent, rgba(255, 42, 133, 0.25) 20%, rgba(255, 42, 133, 0.28) 80%, transparent);
  animation: bannerPulse 0.45s ease-in-out infinite alternate;
}

@keyframes bannerPulse {
  from { opacity: 0.78; transform: scale(0.99); }
  to { opacity: 1; transform: scale(1.01); }
}

.boss-banner-line {
  width: min(85vw, 560px);
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--magenta), var(--orange), var(--magenta), transparent);
}

.boss-banner-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.boss-tag {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.28em;
  color: var(--orange);
}

.boss-title {
  font-size: clamp(22px, 5vw, 34px);
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #fff;
  text-shadow: 0 0 22px var(--magenta);
}

.boss-hp-wrap {
  position: fixed;
  top: calc(96px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  width: min(86vw, 420px);
  padding: 7px 12px;
  border-radius: 10px;
  background: rgba(12, 8, 28, 0.78);
  border: 1px solid rgba(255, 42, 133, 0.48);
  box-shadow: 0 0 20px rgba(255, 42, 133, 0.22);
}

.boss-hp-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #ff9bc3;
  margin-bottom: 5px;
}

.boss-hp-track {
  height: 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.boss-hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--magenta), var(--orange));
  box-shadow: 0 0 12px var(--magenta);
  transition: width 0.08s linear;
}

.hud-toast {
  position: fixed;
  bottom: calc(28px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 999px;
  background: rgba(10, 14, 38, 0.9);
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
  box-shadow: 0 0 24px rgba(255, 217, 74, 0.4);
  white-space: nowrap;
}

/* ===== DEBUG OVERLAY ===== */
.debug-overlay {
  position: fixed;
  right: calc(12px + var(--safe-right));
  top: calc(64px + var(--safe-top));
  z-index: 60;
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(4, 6, 18, 0.84);
  border: 1px solid rgba(0, 240, 255, 0.3);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.4;
  color: #7ef9ff;
  pointer-events: none;
}

/* Scrollbars néon sombres */
.shop-grid, .lb-table-wrap, .go-board-list, .settings-list, .gameover-panel, .levelup-container {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 240, 255, 0.32) transparent;
}
.shop-grid::-webkit-scrollbar, .lb-table-wrap::-webkit-scrollbar, .go-board-list::-webkit-scrollbar, .settings-list::-webkit-scrollbar {
  width: 6px;
}
.shop-grid::-webkit-scrollbar-track, .lb-table-wrap::-webkit-scrollbar-track, .go-board-list::-webkit-scrollbar-track, .settings-list::-webkit-scrollbar-track {
  background: transparent;
}
.shop-grid::-webkit-scrollbar-thumb, .lb-table-wrap::-webkit-scrollbar-thumb, .go-board-list::-webkit-scrollbar-thumb, .settings-list::-webkit-scrollbar-thumb {
  background: rgba(0, 240, 255, 0.32);
  border-radius: 6px;
}

/* ===== LEVEL UP CARDS ===== */
.levelup-container {
  width: 100%;
  max-width: 860px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  max-height: 100%;
  overflow-y: auto;
  padding: 6px 2px;
}

.levelup-header {
  text-align: center;
}

.levelup-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.28em;
  color: var(--gold);
}

.levelup-title {
  margin: 4px 0 2px;
  font-size: clamp(28px, 6vw, 44px);
  font-weight: 900;
  letter-spacing: 0.1em;
  color: #fff;
  text-shadow: 0 0 24px rgba(0, 240, 255, 0.7);
}

.levelup-sub {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.power-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  width: 100%;
}

.power-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 18px 14px;
  border-radius: 18px;
  background: linear-gradient(165deg, rgba(18, 22, 54, 0.94), rgba(9, 11, 28, 0.96));
  border: 2px solid var(--card-accent, var(--cyan));
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.15), 0 12px 30px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  opacity: 0;
  transform: translateY(22px) scale(0.95);
  animation: cardIn 0.36s var(--ease-spring) forwards;
  animation-delay: var(--delay, 0s);
  transition: transform 0.16s var(--ease-spring), box-shadow 0.2s;
}

@keyframes cardIn {
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.power-card:hover {
  transform: translateY(-5px) scale(1.025);
  box-shadow: 0 0 34px var(--card-glow, rgba(0, 240, 255, 0.45)), 0 16px 36px rgba(0, 0, 0, 0.6);
}

.power-card:active { transform: scale(0.97); }

.power-card.rarity-common { --card-accent: #00f0ff; --card-glow: rgba(0, 240, 255, 0.45); }
.power-card.rarity-rare { --card-accent: #a855f7; --card-glow: rgba(168, 85, 247, 0.5); }
.power-card.rarity-epic { --card-accent: #ffd94a; --card-glow: rgba(255, 217, 74, 0.52); }
.power-card.rarity-evolution {
  --card-accent: #ff2a85;
  --card-glow: rgba(255, 42, 133, 0.68);
  background: linear-gradient(160deg, rgba(46, 12, 48, 0.95), rgba(14, 10, 38, 0.96));
  border-color: var(--gold);
  box-shadow: 0 0 36px rgba(255, 42, 133, 0.5), inset 0 0 28px rgba(255, 217, 74, 0.18);
}

.card-key {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.card-tag {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--card-accent);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-accent);
}

.card-icon {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.14), rgba(0, 0, 0, 0.25));
  color: var(--card-accent);
  filter: drop-shadow(0 0 12px var(--card-glow));
}

.card-icon svg { width: 36px; height: 36px; }

.card-name {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
}

.card-stars {
  display: flex;
  gap: 4px;
  font-size: 15px;
  line-height: 1;
}

.star-on { color: var(--gold); text-shadow: 0 0 8px rgba(255, 217, 74, 0.7); }
.star-next { color: var(--cyan); animation: starPulse 0.7s ease-in-out infinite alternate; }
.star-off { color: rgba(255, 255, 255, 0.16); }

@keyframes starPulse {
  from { opacity: 0.45; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1.22); }
}

.card-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: #cbd8f0;
  min-height: 36px;
}

.card-synergy {
  margin-top: auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  background: rgba(255, 217, 74, 0.1);
  border: 1px solid rgba(255, 217, 74, 0.3);
  border-radius: 8px;
  padding: 4px 8px;
}

.levelup-footer {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-reroll { padding: 8px 18px; }
.kbd-hint { font-size: 11px; color: var(--text-muted); }
@media (pointer: coarse) { .kbd-hint { display: none; } }

/* ===== PANELS & MODALS ===== */
.panel {
  width: 100%;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 0 40px rgba(0, 240, 255, 0.12), 0 20px 60px rgba(0, 0, 0, 0.65);
  max-height: calc(100dvh - 32px - var(--safe-top) - var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}

.modal-sm { max-width: 380px; }
.modal-md { max-width: 480px; }
.modal-lg { max-width: 720px; }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-title {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: #fff;
}

.modal-sub {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.modal-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ===== GAME OVER ===== */
.gameover-panel {
  max-width: 520px;
  overflow-y: auto;
}

.go-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.record-badge {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.2em;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 217, 74, 0.18);
  border: 1px solid var(--gold);
  color: var(--gold);
}

.go-title {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: var(--magenta);
  text-shadow: 0 0 18px rgba(255, 42, 133, 0.6);
}

.go-score {
  font-family: var(--font-mono);
  font-size: clamp(38px, 9vw, 56px);
  font-weight: 900;
  line-height: 1.05;
  color: #fff;
  text-shadow: 0 0 26px rgba(0, 240, 255, 0.65);
}

.go-rank-pill {
  font-size: 13px;
  font-weight: 800;
  color: var(--cyan);
  background: rgba(0, 240, 255, 0.12);
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: 999px;
  padding: 4px 14px;
}

.go-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.stat-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 9px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-box-gold {
  border-color: rgba(255, 217, 74, 0.35);
  background: rgba(255, 217, 74, 0.08);
}

.stat-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

.stat-val {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 800;
  color: #fff;
}

.stat-box-gold .stat-val { color: var(--gold); }

.go-board-wrap {
  background: rgba(6, 8, 22, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  padding: 10px 12px;
}

.go-board-head {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.board-status { color: var(--cyan); }
.board-status.offline { color: var(--orange); }

.go-board-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 150px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 12px;
}

.go-board-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.03);
}

.go-board-row.me {
  background: rgba(0, 240, 255, 0.16);
  border: 1px solid rgba(0, 240, 255, 0.5);
  color: #fff;
  font-weight: 800;
}

.go-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.go-secondary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ===== SHOP ===== */
.shop-tabs {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 3px;
  gap: 4px;
  align-self: flex-start;
}

.tab-btn {
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: transparent;
  color: var(--text-muted);
  transition: all 0.18s;
}

.tab-btn.active {
  background: rgba(0, 240, 255, 0.2);
  color: var(--cyan);
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  overflow-y: auto;
  padding-right: 4px;
}

.shop-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 13px;
  border-radius: 14px;
  background: rgba(16, 20, 48, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: border-color 0.18s, transform 0.15s;
}

.shop-item.affordable { border-color: rgba(255, 217, 74, 0.35); }
.shop-item.maxed { border-color: rgba(0, 240, 255, 0.45); }

.shop-item-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shop-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 240, 255, 0.12);
  color: var(--cyan);
  flex-shrink: 0;
}
.shop-icon svg { width: 22px; height: 22px; }

.shop-item-title {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
}

.shop-item-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
}

.shop-pips {
  display: flex;
  gap: 4px;
}

.shop-pip {
  height: 5px;
  flex: 1;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
}

.shop-pip.filled {
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.6);
}

.shop-buy-btn {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(255, 217, 74, 0.16);
  border: 1px solid rgba(255, 217, 74, 0.55);
  color: var(--gold);
  transition: all 0.16s;
}

.shop-buy-btn:hover:not(:disabled) {
  background: rgba(255, 217, 74, 0.3);
  transform: translateY(-1px);
}

.shop-buy-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.shop-buy-btn.equipped {
  opacity: 1;
  border-color: var(--cyan);
  background: rgba(0, 240, 255, 0.18);
  color: var(--cyan);
}

/* ===== LEADERBOARD ===== */
.lb-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.lb-table-wrap {
  overflow-y: auto;
  flex: 1;
  min-height: 200px;
  border-radius: 12px;
  background: rgba(6, 8, 22, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.lb-table th {
  position: sticky;
  top: 0;
  background: #0c102a;
  text-align: left;
  padding: 10px 12px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.lb-table td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-family: var(--font-mono);
}

.lb-table td:nth-child(2) { font-family: var(--font-display); font-weight: 700; }
.lb-table tr.me { background: rgba(0, 240, 255, 0.15); }
.lb-table tr.rank-1 td:first-child { color: var(--gold); font-weight: 900; }
.lb-table tr.rank-2 td:first-child { color: #d6e4ff; font-weight: 900; }
.lb-table tr.rank-3 td:first-child { color: var(--orange); font-weight: 900; }

.lb-empty {
  padding: 36px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ===== SETTINGS ===== */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding-right: 4px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
}

.setting-col {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.slider-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 52%;
}

input[type="range"] {
  flex: 1;
  accent-color: var(--cyan);
  cursor: pointer;
}

.slider-val {
  font-family: var(--font-mono);
  font-size: 12px;
  width: 38px;
  text-align: right;
  color: var(--cyan);
}

.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  transition: background 0.2s;
  cursor: pointer;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s var(--ease-spring);
}

.switch input:checked + .switch-track {
  background: rgba(0, 240, 255, 0.45);
  border-color: var(--cyan);
}

.switch input:checked + .switch-track::after {
  transform: translateX(20px);
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}

.seg-control {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}

.seg-btn {
  padding: 6px 11px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  background: transparent;
  color: var(--text-muted);
}

.seg-btn.active {
  background: rgba(0, 240, 255, 0.24);
  color: var(--cyan);
}

.pseudo-edit-row, .pseudo-input-row {
  display: flex;
  gap: 8px;
}

input[type="text"] {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 14px;
  border-radius: 11px;
  border: 1px solid rgba(0, 240, 255, 0.3);
  background: rgba(6, 8, 22, 0.85);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  outline: none;
}

input[type="text"]:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.3);
}

.pseudo-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-error {
  font-size: 12px;
  color: #ff6ea6;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 680px) {
  .power-cards {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .power-card {
    flex-direction: row;
    text-align: left;
    padding: 12px 14px;
    gap: 12px;
  }

  .card-icon { width: 46px; height: 46px; flex-shrink: 0; }
  .card-icon svg { width: 28px; height: 28px; }
  .card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
  .card-desc { min-height: 0; font-size: 12px; }
  .card-key, .kbd-hint { display: none; }

  .shop-grid { grid-template-columns: 1fr; }
  .go-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .hud-loadout { max-width: 132px; }
  .title-secondary-row { gap: 8px; }
  .btn-secondary { padding: 10px 8px; font-size: 11px; }
}

@media (max-height: 520px) {
  .logo-ring { width: 150px; height: 150px; margin: -75px 0 0 -75px; }
  .title-center { gap: 10px; }
  .btn-primary { min-height: 44px; font-size: 15px; }
}
