/* ChainDrop — Neon Arcade Glass theme (drop-in replacement for css/style.css) */
@property --spin { syntax: '<angle>'; initial-value: 0deg; inherits: false; }

:root {
  --bg: #05060b;
  --surface: rgba(16, 20, 33, 0.66);
  --surface-hover: rgba(30, 38, 62, 0.78);
  --border: rgba(148, 163, 255, 0.14);
  --text-main: #f8fafc;
  --text-muted: #7a869f;

  --glass: linear-gradient(160deg, rgba(34, 42, 70, 0.55), rgba(12, 15, 26, 0.7));
  --glass-edge: inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  --cyan: #38bdf8;
  --violet: #a855f7;
  --amber: #f59e0b;
  --hot: #ef4444;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  /* 26 Cosmic Food Chain Tiers */
  --t-common: #94a3b8;        /* Tier 1 */
  --t-uncommon: #10b981;      /* Tier 2 */
  --t-rare: #06b6d4;          /* Tier 3 */
  --t-vivid: #38bdf8;         /* Tier 4 */
  --t-epic: #a855f7;          /* Tier 5 */
  --t-overdrive: #ec4899;     /* Tier 6 */
  --t-legendary: #f59e0b;     /* Tier 7 */
  --t-mythic: #ef4444;        /* Tier 8 */
  --t-antimatter: #14b8a6;    /* Tier 9 */
  --t-event: #6366f1;         /* Tier 10 */
  --t-singularity: #c084fc;   /* Tier 11 */
  --t-bigbang: #fbbf24;       /* Tier 12 */
  --t-infinity: #38bdf8;      /* Tier 13 */
  --t-entropy: #f1f5f9;       /* Tier 14 */
  --t-omniverse: #f43f5e;     /* Tier 15 */
  --t-reality: #e11d48;       /* Tier 16 */
  --t-vigintillion: #8b5cf6;  /* Tier 17 */
  --t-googol: #eab308;        /* Tier 18 */
  --t-quadragint: #06b6d4;    /* Tier 19 */
  --t-quinquagint: #10b981;   /* Tier 20 */
  --t-sexagint: #ec4899;      /* Tier 21 */
  --t-septuagint: #f97316;    /* Tier 22 */
  --t-octogint: #a855f7;      /* Tier 23 */
  --t-nonagint: #38bdf8;      /* Tier 24 */
  --t-centillion: #facc15;    /* Tier 25 */
  --t-limit: #ffffff;         /* Tier 26 */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { background: var(--bg); }

body {
  background-color: var(--bg);
  background-image:
    radial-gradient(60rem 36rem at 12% -8%, rgba(168, 85, 247, 0.20), transparent 60%),
    radial-gradient(52rem 34rem at 100% 8%, rgba(56, 189, 248, 0.14), transparent 60%),
    radial-gradient(60rem 40rem at 50% 115%, rgba(236, 72, 153, 0.14), transparent 60%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* faint arcade grid fading out from the top */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(148, 163, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 255, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
  mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
}

input { user-select: text; }
button { font-family: inherit; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 255, 0.25); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Header ---------- */
header {
  width: calc(100% - 24px);
  max-width: 680px;
  margin: 14px auto 6px;
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 12px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--glass-edge), 0 12px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.nav-left, .nav-right { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.25rem; margin-right: 6px; }
.logo-icon { font-size: 1.4rem; filter: drop-shadow(0 0 10px rgba(236, 72, 153, 0.8)); }
.logo-text {
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #fff 10%, #c4b5fd 55%, #67e8f9);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-link {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  padding: 7px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s, transform 0.2s var(--ease);
}
.nav-link:hover { color: #fff; background: rgba(255, 255, 255, 0.06); border-color: var(--border); transform: translateY(-1px); }
.nav-link:active { transform: scale(0.96); }

.mode-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.25s var(--ease);
}
.mode-pill:hover { color: #fff; border-color: rgba(255, 255, 255, 0.3); }
.mode-pill:active { transform: scale(0.95); }
.mode-pill.active {
  background: linear-gradient(135deg, #fff, #c7d2fe);
  color: #0b0d17;
  border-color: #fff;
  box-shadow: 0 0 22px rgba(165, 180, 252, 0.55);
}

.sign-in-btn {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #e0f2fe;
  padding: 7px 13px;
  border-radius: 10px;
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.25s var(--ease);
}
.sign-in-btn:hover { background: rgba(56, 189, 248, 0.18); box-shadow: 0 0 18px rgba(56, 189, 248, 0.35); transform: translateY(-1px); }
.sign-in-btn:active { transform: scale(0.96); }

/* ---------- Layout ---------- */
.main-container {
  width: 100%;
  max-width: 580px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 16px 60px;
}

/* ---------- HUD ---------- */
.hud-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 18px;
  margin-bottom: 10px;
  box-shadow: var(--glass-edge), 0 10px 30px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.hud-item { display: flex; flex-direction: column; gap: 2px; }
.hud-item + .hud-item { padding-left: 14px; border-left: 1px solid var(--border); }
.hud-label { font-size: 0.62rem; color: var(--text-muted); font-weight: 800; letter-spacing: 0.1em; }
.hud-val { font-family: 'JetBrains Mono', monospace; font-size: 1rem; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.score-val { color: var(--cyan); text-shadow: 0 0 16px rgba(56, 189, 248, 0.65); transition: transform 0.2s var(--ease); }
.combo-val { color: var(--amber); text-shadow: 0 0 14px rgba(245, 158, 11, 0.55); }

/* ---------- Storm controls ---------- */
.storm-control-bar {
  width: 100%;
  position: relative;
  overflow: hidden;
  background: linear-gradient(110deg, rgba(245, 158, 11, 0.12), rgba(17, 23, 38, 0.7) 45%, rgba(239, 68, 68, 0.1));
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 16px;
  padding: 11px 14px 11px 16px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  box-shadow: var(--glass-edge), 0 10px 30px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.storm-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.storm-icon { font-size: 1.5rem; filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.9)); animation: stormFlicker 2.6s ease-in-out infinite; }
.storm-title { font-weight: 800; font-size: 0.8rem; color: #fbbf24; letter-spacing: 0.04em; }
.storm-desc { font-size: 0.7rem; color: var(--text-muted); line-height: 1.35; }

@keyframes stormFlicker {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.12); opacity: 0.8; }
}

.btn-storm {
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, #f59e0b, #ef4444 85%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 11px 16px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(239, 68, 68, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.2s var(--ease), box-shadow 0.2s, filter 0.2s;
}
.btn-storm::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: -60%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: skewX(-20deg);
  transition: left 0.6s var(--ease);
}
.btn-storm:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(239, 68, 68, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.btn-storm:hover::after { left: 130%; }
.btn-storm:active { transform: scale(0.96); }
.btn-storm:disabled { filter: grayscale(1) brightness(0.6); cursor: not-allowed; box-shadow: none; transform: none; }

/* Active storm countdown */
.storm-progress-container {
  width: 100%;
  height: 30px;
  background: rgba(15, 19, 28, 0.85);
  border: 1px solid rgba(245, 158, 11, 0.7);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.35);
}

.storm-progress-bar {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 100%;
  background:
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.14) 0 10px, transparent 10px 20px),
    linear-gradient(90deg, #f59e0b, #ef4444);
  background-size: 28px 100%, 100% 100%;
  animation: stormStripes 0.8s linear infinite;
  transition: width 0.05s linear;
}
@keyframes stormStripes { to { background-position: 28px 0, 0 0; } }

.storm-timer-text {
  position: relative;
  z-index: 2;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

/* ---------- Canvas cabinet ---------- */
.canvas-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border: 2px solid transparent;
  border-radius: 20px;
  background:
    linear-gradient(#090c14, #090c14) padding-box,
    conic-gradient(from var(--spin), #38bdf8, #a855f7, #ec4899, #f59e0b, #38bdf8) border-box;
  animation: spinBorder 9s linear infinite;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 0 50px rgba(168, 85, 247, 0.22), 0 24px 60px rgba(0, 0, 0, 0.85);
  cursor: crosshair;
}
@keyframes spinBorder { to { --spin: 360deg; } }

/* inner vignette */
.canvas-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 40%, transparent 55%, rgba(0, 0, 0, 0.45) 100%);
}

canvas { width: 100%; height: 100%; display: block; }

.drop-hint { position: absolute; inset: 0; pointer-events: none; }
.reticle-line {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, #67e8f9 0%, rgba(56, 189, 248, 0.25) 55%, transparent 100%);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.8);
  transform: translateX(-50%);
  left: 50%;
}

.hint-pill {
  position: absolute;
  top: 16px; left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 13, 22, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #fff;
  white-space: nowrap;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ---------- Run result overlay ---------- */
.run-result-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 30%, rgba(88, 28, 135, 0.35), rgba(5, 6, 11, 0.93) 70%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  z-index: 50;
  animation: fadeIn 0.3s ease-out;
}

.result-card {
  position: relative;
  width: 100%;
  max-height: 92%;
  background: var(--glass), #0d1018;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 22px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  overflow-y: auto;
  box-shadow: var(--glass-edge), 0 0 60px rgba(168, 85, 247, 0.22), 0 24px 60px rgba(0, 0, 0, 0.9);
  animation: popIn 0.45s var(--ease);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(18px) scale(0.95); } to { opacity: 1; transform: none; } }

.tier-pill {
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-shadow: 0 0 14px currentColor;
  cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.2s;
}
.tier-pill:hover { transform: scale(1.06); background: rgba(255, 255, 255, 0.1); }

.final-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  text-align: center;
  word-break: break-word;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-shadow: 0 0 22px rgba(255, 255, 255, 0.25);
}

.food-chain-badge {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.13);
  border: 1px solid rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.18);
  padding: 5px 14px;
  border-radius: 999px;
}

.next-tier-hint { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; text-align: center; }

/* Score pulse (class toggled by JS) */
.score-finish-glow { animation: scorePulseGlow 0.9s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards !important; }

@keyframes scorePulseGlow {
  0% { transform: scale(1); filter: brightness(1); }
  45% {
    transform: scale(1.25);
    filter: brightness(2.6);
    text-shadow: 0 0 25px currentColor, 0 0 50px currentColor, 0 0 80px currentColor;
  }
  100% {
    transform: scale(1);
    filter: brightness(1.2);
    text-shadow: 0 0 18px currentColor;
  }
}

.lifetime-score { font-size: 0.74rem; color: var(--text-muted); font-weight: 600; }

.action-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; width: 100%; justify-content: center; }

.btn-share {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: #fff;
  padding: 11px 18px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.25s var(--ease);
}
.btn-share:hover { background: rgba(255, 255, 255, 0.11); border-color: rgba(255, 255, 255, 0.3); transform: translateY(-2px); }
.btn-share:active { transform: scale(0.96); }

.btn-play-again {
  background: linear-gradient(135deg, #ffffff, #c7d2fe);
  color: #090a0f;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  border: none;
  border-radius: 12px;
  padding: 11px 22px;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(165, 180, 252, 0.4);
  transition: transform 0.2s var(--ease), box-shadow 0.2s;
}
.btn-play-again:hover { transform: translateY(-2px); box-shadow: 0 10px 32px rgba(165, 180, 252, 0.6); }
.btn-play-again:active { transform: scale(0.96); }

.timer-box { font-size: 0.75rem; color: var(--text-muted); font-weight: 700; margin-top: 4px; }
.timer-box span { color: #fff; font-family: 'JetBrains Mono', monospace; }

/* ---------- Badges breakdown ---------- */
.breakdown-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  margin-bottom: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.badge-count-tag { color: var(--text-muted); font-size: 0.7rem; }

.badge-list { width: 100%; display: flex; flex-direction: column; gap: 8px; }

.badge-card {
  width: 100%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--glass-edge);
  opacity: 0;
  transform: translateY(-12px);
  animation: badgeSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.badge-row-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.badge-title-group { display: flex; align-items: center; gap: 8px; }
.badge-icon { font-size: 1.15rem; filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.25)); }
.badge-name { font-weight: 800; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
.badge-tag { font-size: 0.6rem; font-weight: 800; padding: 2px 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); }
.badge-points { font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; font-weight: 800; text-shadow: 0 0 12px currentColor; }
.badge-desc { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }

/* ---------- Food chain ladder ---------- */
.ladder-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.ladder-row:hover { background: rgba(255, 255, 255, 0.06); transform: translateX(3px); }

.ladder-row.current-run-tier {
  border-color: var(--cyan);
  background: rgba(56, 189, 248, 0.12);
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.28);
}

.ladder-row.best-tier {
  border-color: var(--amber);
  background: rgba(245, 158, 11, 0.1);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.15);
}

.ladder-left { display: flex; align-items: center; gap: 10px; }
.ladder-rank { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; font-weight: 800; color: var(--text-muted); width: 28px; }
.ladder-emoji { font-size: 1.25rem; }
.ladder-name { font-weight: 800; font-size: 0.85rem; }
.ladder-req { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }

.ladder-tags { display: flex; gap: 6px; align-items: center; }
.tag-current { font-size: 0.65rem; font-weight: 800; padding: 3px 8px; border-radius: 999px; background: var(--cyan); color: #00131c; box-shadow: 0 0 12px rgba(56, 189, 248, 0.6); }
.tag-best { font-size: 0.65rem; font-weight: 800; padding: 3px 8px; border-radius: 999px; background: var(--amber); color: #1a0f00; box-shadow: 0 0 12px rgba(245, 158, 11, 0.6); }

/* ---------- Record card ---------- */
.best-run-card {
  position: relative;
  width: 100%;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px 18px;
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  box-shadow: var(--glass-edge), 0 14px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.best-run-tag { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.14em; color: var(--text-muted); }

.best-run-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(9, 12, 20, 0.8);
  border: 2px solid var(--t-mythic);
  border-radius: 14px;
  padding: 10px 20px;
  box-shadow: 0 0 28px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.08);
}

.best-run-coord { font-family: 'JetBrains Mono', monospace; font-size: 1.4rem; font-weight: 800; color: #fff; }
.best-run-score { font-family: 'JetBrains Mono', monospace; font-size: 1.15rem; font-weight: 800; color: var(--t-mythic); text-shadow: 0 0 16px rgba(239, 68, 68, 0.6); }

.best-run-meta { display: flex; gap: 14px; font-size: 0.75rem; color: var(--text-muted); }
.meta-user { color: #fff; }
.best-run-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }

.mini-badge {
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: 999px;
  color: #dbe2f5;
}

.best-run-count { font-size: 0.75rem; color: var(--text-muted); }

/* ---------- Modals ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 4, 9, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: none;
  justify-content: center;
  align-items: center;
  padding: 20px;
  z-index: 100;
}

.modal {
  background: var(--glass), #0c0f19;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--glass-edge), 0 0 60px rgba(99, 102, 241, 0.2), 0 30px 80px rgba(0, 0, 0, 0.9);
  animation: popIn 0.4s var(--ease);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.025);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 { font-size: 0.95rem; font-weight: 800; letter-spacing: 0.04em; }

.btn-close {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.btn-close:hover { color: #fff; background: rgba(239, 68, 68, 0.25); border-color: rgba(239, 68, 68, 0.5); transform: rotate(90deg); }

.modal-body { padding: 16px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }

#auth-username-input { transition: border-color 0.2s, box-shadow 0.2s; }
#auth-username-input:focus { outline: none; border-color: var(--cyan) !important; box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2), 0 0 20px rgba(56, 189, 248, 0.25); }

.book-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: background 0.2s, border-color 0.2s;
}
.book-item:hover { background: rgba(255, 255, 255, 0.065); border-color: rgba(255, 255, 255, 0.2); }
.book-item.locked { opacity: 0.35; filter: grayscale(1); }

/* ---------- Responsive & motion ---------- */
@media (max-width: 520px) {
  header { padding: 8px 10px; }
  .nav-link { padding: 6px 7px; font-size: 0.66rem; }
  .hud-bar { padding: 10px 12px; }
  .hud-item + .hud-item { padding-left: 10px; }
  .hud-val { font-size: 0.88rem; }
  .storm-control-bar { flex-wrap: wrap; }
  .btn-storm { width: 100%; }
  .final-score { font-size: 1.6rem; }
  .best-run-row { gap: 10px; padding: 8px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}