:root {
  --bg-0: #050811;
  --bg-1: #0b1120;
  --bg-2: #11192e;
  --card: rgba(15, 23, 42, 0.84);
  --card-solid: #0f172a;
  --border: rgba(148, 163, 184, 0.14);
  --border-hi: rgba(245, 158, 11, 0.35);
  --text: #f1f5f9;
  --text-dim: #94a3b8;
  --gold: #f59e0b;
  --gold-bright: #fbbf24;
  --emerald: #10b981;
  --emerald-bright: #34d399;
  --cyan: #38bdf8;
  --purple: #a855f7;
  --red: #ef4444;
  --radius: 14px;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.5);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
}

* { box-sizing: border-box; }
.hidden { display: none !important; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 540px at 12% -5%, rgba(16, 185, 129, 0.12), transparent 65%),
    radial-gradient(820px 500px at 88% 0%, rgba(245, 158, 11, 0.11), transparent 62%),
    radial-gradient(700px 600px at 50% 100%, rgba(56, 189, 248, 0.08), transparent 65%),
    linear-gradient(180deg, #050811 0%, #090e1c 55%, #060912 100%);
}

/* ==================== TOPBAR ==================== */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 9px 18px 8px;
  background: rgba(7, 11, 22, 0.92);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 2px 0 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 10px;
  flex-shrink: 0;
}
.brand:hover { background: rgba(255,255,255,0.04); }

.brand-crest {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 21px;
  background: linear-gradient(135deg, #f59e0b, #10b981);
  color: #050811;
  font-weight: 900;
  box-shadow: 0 0 22px rgba(245, 158, 11, 0.35);
}

.brand-text {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.1;
}
.brand-text strong {
  font-size: 16px;
  letter-spacing: 0.1em;
  background: linear-gradient(90deg, #fbbf24, #34d399);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-text small {
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: var(--text-dim);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 2px 0 0;
  border-top: 1px solid rgba(148, 163, 184, 0.08);
  padding-top: 7px;
}

.nav-pill {
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim);
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.nav-pill:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}
.nav-pill.active {
  color: #050811;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.32);
}

.nav-dot-live {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald-bright);
  box-shadow: 0 0 8px var(--emerald-bright);
}
.nav-pill.active .nav-dot-live { background: #050811; box-shadow: none; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.72);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
}
.hud-pill:hover { border-color: var(--border-hi); background: rgba(30, 41, 59, 0.95); }

.hud-rank-code {
  background: rgba(245, 158, 11, 0.18);
  color: var(--gold-bright);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
}

.hud-combo.hot {
  border-color: rgba(245, 158, 11, 0.65);
  background: rgba(245, 158, 11, 0.16);
  color: var(--gold-bright);
  animation: pulseGlow 1.4s infinite;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 rgba(245, 158, 11, 0); }
  50% { box-shadow: 0 0 18px rgba(245, 158, 11, 0.45); }
}

.btn-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(30, 41, 59, 0.7);
  color: var(--text);
  cursor: pointer;
  font-size: 15px;
  display: grid;
  place-items: center;
  transition: all 0.16s;
}
.btn-icon:hover { border-color: var(--border-hi); transform: translateY(-1px); }

.lang-switch-pill {
  padding: 5px 9px;
  gap: 4px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
}
.lang-opt {
  padding: 1px 5px;
  border-radius: 5px;
  color: var(--text-dim);
  transition: all 0.16s;
}
.lang-opt.active {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: #050811;
  font-weight: 800;
}
.lang-sep { color: var(--text-dim); opacity: 0.45; }

/* ==================== MAIN VIEWS & COMMON UI ==================== */
.views-root {
  flex: 1;
  width: 100%;
  max-width: 1460px;
  margin: 0 auto;
  padding: 18px 18px 34px;
}

.view { display: none; animation: fadeIn 0.2s ease; }
.view.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--emerald-bright);
  margin-bottom: 4px;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 6px 0; line-height: 1.55; }
.muted { color: var(--text-dim); font-size: 13px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}
.btn:hover:not(:disabled) { transform: translateY(-1px); background: rgba(255, 255, 255, 0.13); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: #050811;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.28);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.07); background: linear-gradient(135deg, var(--gold-bright), var(--gold)); }
.btn-emerald {
  background: linear-gradient(135deg, var(--emerald-bright), var(--emerald));
  color: #04120c;
  font-weight: 700;
}
.btn-emerald:hover:not(:disabled) { filter: brightness(1.07); background: linear-gradient(135deg, var(--emerald-bright), var(--emerald)); }
.btn-danger {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}
.btn-danger:hover:not(:disabled) { background: rgba(239, 68, 68, 0.28); }
.btn-ghost {
  background: rgba(30, 41, 59, 0.55);
  border-color: var(--border);
}
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }

.btn-group { display: flex; flex-wrap: wrap; gap: 7px; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(148, 163, 184, 0.14);
  color: var(--text);
}
.tag-gold { background: rgba(245, 158, 11, 0.18); color: var(--gold-bright); }
.tag-emerald { background: rgba(16, 185, 129, 0.18); color: var(--emerald-bright); }
.tag-cyan { background: rgba(56, 189, 248, 0.18); color: var(--cyan); }
.tag-purple { background: rgba(168, 85, 247, 0.18); color: #d8b4fe; }
.tag-red { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }

.input, .select, .textarea {
  width: 100%;
  background: rgba(10, 15, 29, 0.9);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.16s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--gold); }
.textarea { font-family: var(--mono); font-size: 12px; resize: vertical; }

/* ==================== BOARD STAGE LAYOUT ==================== */
.arena-layout {
  display: grid;
  grid-template-columns: minmax(0, 620px) minmax(320px, 1fr);
  gap: 18px;
  align-items: start;
}

.arena-layout.wide-side {
  grid-template-columns: minmax(0, 560px) minmax(360px, 1fr);
}

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

.board-and-eval {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.board-frame {
  flex: 1;
  aspect-ratio: 1 / 1;
  max-width: 580px;
  width: 100%;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.65), 0 0 0 2px rgba(245, 158, 11, 0.22);
}

/* Eval Bar */
.eval-bar-wrap {
  width: 36px;
  border-radius: 8px;
  background: #171e2e;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  flex-shrink: 0;
}
.eval-bar-fill {
  width: 100%;
  height: 50%;
  background: linear-gradient(180deg, #f8fafc, #e2e8f0);
  transition: height 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.eval-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9.5px;
  font-weight: 800;
  font-family: var(--mono);
  padding: 2px 3px;
  border-radius: 4px;
  z-index: 2;
  white-space: nowrap;
}
.eval-label.eval-white { bottom: 5px; color: #0f172a; background: rgba(255,255,255,0.75); }
.eval-label.eval-black { top: 5px; color: #f8fafc; background: rgba(15,23,42,0.75); }

/* Player Strip & Clocks */
.player-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border);
}
.player-strip.active-turn {
  border-color: rgba(245, 158, 11, 0.55);
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.14);
}
.player-id {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.player-avatar {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
  font-size: 17px;
  flex-shrink: 0;
}
.player-meta { display: flex; flex-direction: column; min-width: 0; }
.player-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-sub { font-size: 11.5px; color: var(--text-dim); }

.clock-box {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 9px;
  background: rgba(5, 8, 17, 0.85);
  border: 1px solid var(--border);
  min-width: 90px;
  text-align: center;
  letter-spacing: 0.04em;
}
.clock-box.running {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.6);
  color: var(--gold-bright);
}
.clock-box.low {
  background: rgba(239, 68, 68, 0.25);
  border-color: var(--red);
  color: #fecaca;
  animation: pulseGlow 0.8s infinite;
}

/* ==================== INTERACTIVE CHESSBOARD ==================== */
.cb-root {
  width: 100%;
  height: 100%;
  position: relative;
  user-select: none;
  touch-action: none;
}
.cb-grid {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
}
.cb-sq {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* 5 Luxury Board Themes */
.cb-theme-walnut .cb-light { background: #ebd5b3; color: #7c512d; }
.cb-theme-walnut .cb-dark  { background: #9c6639; color: #f5e6cc; }

.cb-theme-emerald .cb-light { background: #eeeed2; color: #567d46; }
.cb-theme-emerald .cb-dark  { background: #598553; color: #eeeed2; }

.cb-theme-obsidian .cb-light { background: #cbd5e1; color: #334155; }
.cb-theme-obsidian .cb-dark  { background: #3b4b68; color: #e2e8f0; }

.cb-theme-ocean .cb-light { background: #dee8f2; color: #46698c; }
.cb-theme-ocean .cb-dark  { background: #4f79a3; color: #e8f1fa; }

.cb-theme-mahogany .cb-light { background: #f0d9b5; color: #8c4830; }
.cb-theme-mahogany .cb-dark  { background: #8f3f29; color: #f5e2c6; }

.cb-sq.cb-last-move::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(250, 204, 21, 0.36);
  pointer-events: none;
}
.cb-sq.cb-selected::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(16, 185, 129, 0.45);
  box-shadow: inset 0 0 0 3px rgba(52, 211, 153, 0.9);
  pointer-events: none;
}
.cb-sq.cb-user-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(239, 68, 68, 0.45);
  pointer-events: none;
}
.cb-sq.cb-hl-good::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(16, 185, 129, 0.48);
  pointer-events: none;
}
.cb-sq.cb-hl-bad::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(239, 68, 68, 0.5);
  pointer-events: none;
}
.cb-sq.cb-hl-target::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(56, 189, 248, 0.46);
  box-shadow: inset 0 0 0 3px #38bdf8;
  pointer-events: none;
}
.cb-sq.cb-in-check {
  background: radial-gradient(circle, rgba(239, 68, 68, 0.95) 0%, rgba(185, 28, 28, 0.72) 55%, transparent 85%) !important;
}

.cb-piece {
  width: 90%;
  height: 90%;
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.32));
  transition: transform 0.12s ease;
}
.cb-piece svg { width: 100%; height: 100%; display: block; }

.cb-drag-ghost {
  position: fixed;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 9999;
  filter: drop-shadow(0 12px 16px rgba(0, 0, 0, 0.5));
}
.cb-drag-ghost svg { width: 100%; height: 100%; }

.cb-coord {
  position: absolute;
  font-size: 10.5px;
  font-weight: 800;
  pointer-events: none;
  z-index: 1;
  opacity: 0.85;
}
.cb-coord-rank { top: 2px; left: 4px; }
.cb-coord-file { bottom: 2px; right: 4px; }

.cb-move-dot {
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.34);
  z-index: 3;
  pointer-events: none;
}
.cb-capture-ring {
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  border: 5px solid rgba(15, 23, 42, 0.36);
  z-index: 3;
  pointer-events: none;
}

.cb-arrows-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

.cb-fx-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
  overflow: hidden;
}

.cb-float-badge {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 13px;
  white-space: nowrap;
  animation: floatUp 1.05s cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
.cb-badge-good { background: var(--emerald); color: #04120c; }
.cb-badge-brilliant { background: linear-gradient(135deg, #38bdf8, #f59e0b); color: #050811; font-size: 14px; }
.cb-badge-bad { background: var(--red); color: #fff; }
.cb-badge-gold { background: var(--gold-bright); color: #050811; }

@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(0.7); }
  20% { opacity: 1; transform: translate(-50%, -70%) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -175%) scale(0.95); }
}

.cb-particle {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  animation: burstOut 0.65s ease-out forwards;
}
@keyframes burstOut {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.1); }
}

.cb-promo-modal {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 17, 0.78);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 20;
}
.cb-promo-modal.hidden { display: none; }
.cb-promo-box {
  background: #0f172a;
  border: 1px solid var(--border-hi);
  border-radius: 14px;
  padding: 14px 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.cb-promo-title { font-size: 13px; font-weight: 700; color: var(--gold-bright); margin-bottom: 10px; }
.cb-promo-row { display: flex; gap: 10px; }
.cb-promo-btn {
  width: 58px;
  height: 58px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  padding: 6px;
  transition: all 0.15s;
}
.cb-promo-btn:hover { background: rgba(245, 158, 11, 0.28); border-color: var(--gold); transform: scale(1.08); }

/* ==================== HUB & DASHBOARD ==================== */
.hub-hero {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.radar-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
}

.rank-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.rank-crest-big {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(16, 185, 129, 0.2));
  border: 2px solid var(--gold);
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 900;
  color: var(--gold-bright);
  flex-shrink: 0;
}
.xp-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin: 8px 0 6px;
}
.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--emerald), var(--gold-bright));
  border-radius: 999px;
  transition: width 0.5s ease;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.stat-tile {
  background: rgba(5, 8, 17, 0.55);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 8px;
  text-align: center;
}
.stat-tile strong { display: block; font-size: 18px; color: var(--gold-bright); }
.stat-tile span { font-size: 11px; color: var(--text-dim); }

.wings-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.wing-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  color: var(--text);
}
.wing-card:hover {
  border-color: var(--border-hi);
  transform: translateY(-3px);
  box-shadow: 0 14px 36px rgba(245, 158, 11, 0.14);
}
.wing-icon { font-size: 26px; }
.wing-card h4 { font-size: 15px; }
.wing-card p { font-size: 12.5px; color: var(--text-dim); margin: 0; }

/* Quests */
.quest-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.quest-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(5, 8, 17, 0.55);
  border: 1px solid var(--border);
  font-size: 13px;
}
.quest-row.done { border-color: rgba(16, 185, 129, 0.5); background: rgba(16, 185, 129, 0.08); }

/* ==================== MOVE LISTS, LISTS, TABS ==================== */
.move-list {
  max-height: 220px;
  overflow-y: auto;
  background: rgba(5, 8, 17, 0.65);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  font-family: var(--mono);
  font-size: 13px;
  display: grid;
  grid-template-columns: 34px 1fr 1fr;
  gap: 3px 6px;
  align-content: start;
}
.move-num { color: var(--text-dim); text-align: right; padding-right: 4px; }
.move-cell {
  padding: 3px 7px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
}
.move-cell:hover { background: rgba(255, 255, 255, 0.08); }
.move-cell.active { background: rgba(245, 158, 11, 0.25); color: var(--gold-bright); font-weight: 700; }

.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.subtab {
  padding: 7px 13px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.7);
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s;
}
.subtab:hover { color: var(--text); border-color: rgba(255,255,255,0.25); }
.subtab.active {
  background: rgba(16, 185, 129, 0.18);
  border-color: var(--emerald);
  color: var(--emerald-bright);
}

.scroll-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 440px;
  overflow-y: auto;
  padding-right: 4px;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(5, 8, 17, 0.55);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  color: var(--text);
  width: 100%;
}
.list-item:hover { border-color: rgba(245, 158, 11, 0.45); background: rgba(30, 41, 59, 0.72); }
.list-item.active { border-color: var(--gold); background: rgba(245, 158, 11, 0.14); }
.list-item.beaten { border-left: 3px solid var(--emerald); }

/* AI Level Grid */
.ai-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: 310px;
  overflow-y: auto;
  padding-right: 4px;
}
.ai-card {
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(5, 8, 17, 0.6);
  border: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: all 0.15s;
}
.ai-card:hover { border-color: rgba(245, 158, 11, 0.5); }
.ai-card.active {
  border-color: var(--gold);
  background: rgba(245, 158, 11, 0.14);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.18);
}

/* TC Grid */
.tc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.tc-btn {
  padding: 11px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(5, 8, 17, 0.65);
  color: var(--text);
  cursor: pointer;
  text-align: center;
  transition: all 0.16s;
}
.tc-btn:hover { border-color: var(--gold); background: rgba(245, 158, 11, 0.12); transform: translateY(-1px); }
.tc-btn.active { border-color: var(--emerald); background: rgba(16, 185, 129, 0.18); }
.tc-btn strong { display: block; font-size: 16px; font-family: var(--mono); }
.tc-btn small { font-size: 11px; color: var(--text-dim); }

/* Engine MultiPV Lines */
.pv-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(5, 8, 17, 0.68);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12.5px;
  cursor: pointer;
}
.pv-line:hover { border-color: var(--cyan); }
.pv-score {
  min-width: 54px;
  text-align: center;
  padding: 3px 7px;
  border-radius: 6px;
  font-weight: 800;
  background: rgba(56, 189, 248, 0.18);
  color: var(--cyan);
}
.pv-moves { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Feedback Banner */
.feedback-box {
  padding: 12px 14px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: rgba(5, 8, 17, 0.72);
  font-size: 13.5px;
  line-height: 1.55;
}
.feedback-box.good { border-color: rgba(16, 185, 129, 0.55); background: rgba(16, 185, 129, 0.1); }
.feedback-box.bad { border-color: rgba(239, 68, 68, 0.55); background: rgba(239, 68, 68, 0.1); }
.feedback-box.info { border-color: rgba(56, 189, 248, 0.45); background: rgba(56, 189, 248, 0.08); }

/* Fever Meter */
.fever-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-top: 6px;
}
.fever-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #f59e0b, #ef4444);
  transition: width 0.35s ease;
}

/* Piece Palette for Flash Memory */
.piece-palette {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin: 10px 0;
}
.pal-btn {
  aspect-ratio: 1 / 1;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  padding: 4px;
  display: grid;
  place-items: center;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}
.pal-btn.active { border-color: var(--gold); background: rgba(245, 158, 11, 0.24); }
.pal-btn svg { width: 100%; height: 100%; }

/* Chat Box */
.chat-log {
  height: 120px;
  overflow-y: auto;
  background: rgba(5, 8, 17, 0.65);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 12.5px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Review Chart */
.review-chart-wrap {
  width: 100%;
  height: 115px;
  background: rgba(5, 8, 17, 0.72);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(3, 6, 15, 0.78);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 16px;
}
.modal-backdrop.hidden { display: none; }
.modal-card {
  width: 100%;
  max-width: 440px;
  background: #0f172a;
  border: 1px solid var(--border-hi);
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.7);
}
.form-field { margin-bottom: 12px; }
.form-field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-dim); margin-bottom: 5px; }

/* Toast */
.toast-root {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 11px 16px;
  border-radius: 11px;
  background: #0f172a;
  border: 1px solid var(--border-hi);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.2s ease;
}

/* Responsive */
@media (max-width: 1080px) {
  .arena-layout, .arena-layout.wide-side, .hub-hero {
    grid-template-columns: 1fr;
  }
  .board-frame { max-width: 540px; margin: 0 auto; }
  .wings-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .topbar { padding: 8px 10px; }
  .views-root { padding: 12px 10px 26px; }
  .wings-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .ai-grid { grid-template-columns: 1fr; }
}
