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

:root {
  --bg-primary: #09090b;
  --bg-secondary: #111113;
  --bg-elevated: #18181b;
  --bg-board-light: #b58863;
  --bg-board-dark: #8b5a2b;
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent: #c9a84c;
  --accent-dim: #a88b3a;
  --accent-secondary: #e8d48a;
  --accent-glow: rgba(201, 168, 76, 0.35);
  --border: #27272a;
  --border-subtle: #1c1c1f;
  --cta-from: #edd06a;
  --cta-mid: #d9bc58;
  --cta-to: #b8943f;
  --cta-text: #09090b;
  --success: #4caf50;
  --danger: #e53935;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
  --font-sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'Cascadia Code', 'Fira Code', monospace;
  --piece-user-color: #f5f5f5;
  --piece-opponent-color: #1a1a1a;
  --piece-user-stroke: 1.75px;
  --piece-opponent-shadow: none;
  /* Customization Engine defaults (overridden live by CustomizationStore) */
  --board-scale: 1;
  --piece-scale: 1;
}

/* ── UI Themes (ThemeManager) ── */

/* Midnight Obsidian — default high-contrast gold on obsidian */
html[data-ui-theme="midnight-obsidian"],
:root {
  --bg-primary: #09090b;
  --bg-secondary: #111113;
  --bg-elevated: #18181b;
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent: #c9a84c;
  --accent-dim: #a88b3a;
  --accent-secondary: #e8d48a;
  --accent-glow: rgba(201, 168, 76, 0.35);
  --border: #27272a;
  --border-subtle: #1c1c1f;
  --cta-from: #edd06a;
  --cta-mid: #d9bc58;
  --cta-to: #b8943f;
  --cta-text: #09090b;
  --success: #4caf50;
  --danger: #e53935;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
}

html[data-ui-theme="royal-forest"] {
  --bg-primary: #071410;
  --bg-secondary: #0c1f17;
  --bg-elevated: #122a1e;
  --text-primary: #f5f0e1;
  --text-secondary: #b8c9a8;
  --text-muted: #7a9470;
  --accent: #c4a574;
  --accent-dim: #9a7b4f;
  --accent-secondary: #e8d4b0;
  --accent-glow: rgba(196, 165, 116, 0.35);
  --border: #2a4a32;
  --border-subtle: #1a3324;
  --cta-from: #e8d4b0;
  --cta-mid: #c4a574;
  --cta-to: #8b6914;
  --cta-text: #071410;
  --success: #6b9b5e;
  --danger: #c9564b;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

html[data-ui-theme="grandmaster-slate"] {
  --bg-primary: #0c1017;
  --bg-secondary: #121820;
  --bg-elevated: #1a2230;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #60a5fa;
  --accent-dim: #3b82f6;
  --accent-secondary: #bfdbfe;
  --accent-glow: rgba(96, 165, 250, 0.35);
  --border: #334155;
  --border-subtle: #1e293b;
  --cta-from: #93c5fd;
  --cta-mid: #60a5fa;
  --cta-to: #2563eb;
  --cta-text: #0c1017;
  --success: #34d399;
  --danger: #f87171;
  --shadow: 0 8px 32px rgba(15, 23, 42, 0.45);
}

html[data-ui-theme="neon-cyber"] {
  --bg-primary: #0a0412;
  --bg-secondary: #12081c;
  --bg-elevated: #1a0c28;
  --text-primary: #f5e6ff;
  --text-secondary: #c4b5fd;
  --text-muted: #8b6bb8;
  --accent: #22d3ee;
  --accent-dim: #06b6d4;
  --accent-secondary: #f472b6;
  --accent-glow: rgba(34, 211, 238, 0.4);
  --border: #3b1d5c;
  --border-subtle: #2a1240;
  --cta-from: #22d3ee;
  --cta-mid: #818cf8;
  --cta-to: #f472b6;
  --cta-text: #0a0412;
  --success: #34d399;
  --danger: #fb7185;
  --shadow: 0 8px 32px rgba(244, 114, 182, 0.15);
}

html[data-ui-theme="neon-cyber"] .logo-icon,
html[data-ui-theme="neon-cyber"] .btn-primary {
  box-shadow: 0 0 14px var(--accent-glow);
}

html[data-ui-theme="sunset-amber"] {
  --bg-primary: #140c06;
  --bg-secondary: #1f1309;
  --bg-elevated: #2a1a0e;
  --text-primary: #fef3e2;
  --text-secondary: #d4a574;
  --text-muted: #9a7349;
  --accent: #f59e0b;
  --accent-dim: #d97706;
  --accent-secondary: #fbbf24;
  --accent-glow: rgba(245, 158, 11, 0.38);
  --border: #4a3020;
  --border-subtle: #352318;
  --cta-from: #fcd34d;
  --cta-mid: #f59e0b;
  --cta-to: #c2410c;
  --cta-text: #140c06;
  --success: #84cc16;
  --danger: #ef4444;
  --shadow: 0 8px 32px rgba(194, 65, 12, 0.2);
}

html[data-ui-theme="arctic-ice"] {
  --bg-primary: #e8f6fc;
  --bg-secondary: #f0f9ff;
  --bg-elevated: #ffffff;
  --text-primary: #0c4a6e;
  --text-secondary: #0369a1;
  --text-muted: #64748b;
  --accent: #06b6d4;
  --accent-dim: #0891b2;
  --accent-secondary: #67e8f9;
  --accent-glow: rgba(6, 182, 212, 0.35);
  --border: #bae6fd;
  --border-subtle: #e0f2fe;
  --cta-from: #a5f3fc;
  --cta-mid: #22d3ee;
  --cta-to: #0891b2;
  --cta-text: #0c4a6e;
  --success: #10b981;
  --danger: #f43f5e;
  --shadow: 0 8px 32px rgba(6, 182, 212, 0.12);
}

html[data-ui-theme="arctic-ice"] .logo-icon,
html[data-ui-theme="arctic-ice"] .btn-primary {
  box-shadow: 0 0 12px var(--accent-glow);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  width: 100%;
  margin: 0;
}

/* Floating Queen above Play Now — 3D SVG + monochromatic theme glow */
.play-now-with-piece {
  --theme-color: var(--accent);
  --theme-color-hi: var(--cta-from, var(--accent-secondary));
  --theme-color-lo: var(--cta-to, var(--accent-dim));
  --theme-glow: var(--accent-glow);
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 22rem;
  padding-top: 5.25rem;
  isolation: isolate;
  contain: layout style;
}

.play-now-with-piece .dashboard-cta-primary,
.play-now-with-piece .landing-neon-btn {
  position: relative;
  z-index: 1;
  width: 100%;
}

.floating-chess-piece {
  position: absolute;
  top: 0.15rem;
  left: 50%;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 5rem;
  margin: 0;
  padding: 0;
  pointer-events: none;
  transform: translate3d(-50%, 0, 0);
  color: var(--theme-color);
}

.floating-chess-piece__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  perspective: 480px;
  perspective-origin: 50% 40%;
  transform-style: preserve-3d;
}

.floating-chess-piece__float {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  transform: translateZ(0);
  transform-style: preserve-3d;
  animation: floating-chess-bob 3.6s ease-in-out infinite;
  filter: drop-shadow(0 0 8px var(--theme-glow))
    drop-shadow(0 0 16px color-mix(in srgb, var(--theme-color) 55%, transparent))
    drop-shadow(0 8px 14px color-mix(in srgb, var(--theme-color-lo) 35%, transparent));
  will-change: transform;
}

.floating-chess-piece__spin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform: translateZ(12px);
  animation: floating-chess-spin 8s ease-in-out infinite;
  will-change: transform;
  backface-visibility: hidden;
}

.floating-chess-piece__svg {
  display: block;
  width: 3.5rem;
  height: 5rem;
  overflow: visible;
  shape-rendering: geometricPrecision;
  transform: translateZ(0);
}

@keyframes floating-chess-bob {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(0, -0.75rem, 0);
  }
}

@keyframes floating-chess-spin {
  0%,
  100% {
    transform: rotateY(-22deg) rotateX(8deg) rotateZ(-2deg) translateZ(12px);
  }
  50% {
    transform: rotateY(22deg) rotateX(8deg) rotateZ(2deg) translateZ(12px);
  }
}

@media (max-width: 767px) {
  .play-now-with-piece {
    padding-top: 4.75rem;
    max-width: 100%;
  }

  .floating-chess-piece,
  .floating-chess-piece__svg {
    width: 3rem;
    height: 4.35rem;
  }

  .floating-chess-piece__stage {
    perspective: 360px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .floating-chess-piece__float,
  .floating-chess-piece__spin {
    animation: none;
    will-change: auto;
  }
}

body.mobile-nav-open {
  overflow: hidden;
  touch-action: none;
}

/* ── Header ── */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  max-width: 100%;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding-top: max(0.75rem, env(safe-area-inset-top));
  padding-bottom: 0.75rem;
  padding-inline: 0;
  margin: 0;
  box-sizing: border-box;
  overflow-x: clip;
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  max-width: 80rem; /* max-w-7xl */
  margin-inline: auto;
  padding-inline: 1rem;
  box-sizing: border-box;
}

@media (min-width: 640px) {
  .header-inner {
    padding-inline: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .header-inner {
    padding-inline: 2rem;
  }
}

.header-start {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-width: 0;
  flex: 1 1 auto;
}

.header-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  margin-inline-start: auto;
  padding: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 0.5rem 0.65rem;
}

.header-actions .profile-name-btn {
  max-width: min(14rem, 32vw);
}

.header-actions .profile-name-btn [data-auth-field="name"] {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
  transform-origin: center center;
  transition: all 0.3s ease-in-out;
  filter: drop-shadow(0 0 8px rgba(234, 179, 8, 0.4));
}

.logo:hover {
  filter: drop-shadow(0 0 15px rgba(234, 179, 8, 0.6));
  transform: scale(1.03);
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), #8b6914);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: box-shadow 0.3s ease-in-out;
  box-shadow: 0 0 10px rgba(234, 179, 8, 0.25);
}

.logo:hover .logo-icon {
  box-shadow: 0 0 16px rgba(234, 179, 8, 0.45);
}

.logo-text {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-text span {
  color: var(--accent);
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #d1d5db; /* gray-300 — quiet uniform nav color */
  text-decoration: none;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.2;
  transform-origin: center center;
  will-change: transform, filter, color;
  transition: all 0.3s ease-in-out;
}

.nav-link:hover {
  color: #eab308; /* yellow-500 */
  background: transparent;
  transform: scale(1.05);
  filter: drop-shadow(0 0 8px rgba(234, 179, 8, 0.5));
}

.nav-link.active {
  color: #eab308;
  background: color-mix(in srgb, rgba(234, 179, 8, 0.12) 100%, transparent);
  filter: drop-shadow(0 0 6px rgba(234, 179, 8, 0.35));
}

.nav-link.active:hover {
  transform: scale(1.05);
  filter: drop-shadow(0 0 10px rgba(234, 179, 8, 0.55));
}

.header-actions .btn {
  transform-origin: center center;
  transition: all 0.3s ease-in-out;
}

.header-actions .btn:hover {
  transform: scale(1.05);
}

.header-actions .btn-ghost:hover {
  color: #eab308;
  border-color: color-mix(in srgb, #eab308 45%, var(--border));
  box-shadow:
    0 0 0 1px rgba(234, 179, 8, 0.2),
    0 0 18px rgba(234, 179, 8, 0.28);
}

.header-actions .btn-primary:hover {
  box-shadow:
    0 0 0 1px rgba(255, 247, 214, 0.35),
    0 0 22px rgba(201, 168, 76, 0.55),
    0 0 40px rgba(234, 179, 8, 0.3);
}

@media (prefers-reduced-motion: reduce) {
  .logo,
  .nav-link,
  .header-actions .btn {
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, filter 0.2s ease;
  }

  .logo:hover,
  .nav-link:hover,
  .nav-link.active:hover,
  .header-actions .btn:hover {
    transform: none;
  }
}

.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.75rem;
  height: 2.75rem;
  min-width: 44px;
  min-height: 44px;
  padding: 0.55rem;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: 0.75rem;
  background: color-mix(in srgb, var(--bg-elevated) 80%, transparent);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 0 0 1px rgba(201, 168, 76, 0.08), 0 0 16px rgba(201, 168, 76, 0.12);
}

.mobile-menu-toggle:hover,
.mobile-menu-toggle[aria-expanded="true"] {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: var(--bg-primary);
  box-shadow: 0 0 20px rgba(201, 168, 76, 0.28);
}

.hamburger-line {
  display: block;
  width: 100%;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.mobile-nav-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: min(70dvh, 28rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: color-mix(in srgb, #03050c 92%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 40px rgba(201, 168, 76, 0.08);
  backdrop-filter: blur(12px);
  z-index: 99;
  padding-bottom: env(safe-area-inset-bottom);
}

.mobile-nav-panel:not(.hidden) {
  display: block;
}

.mobile-nav {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0.5rem 0.75rem;
  gap: 0.2rem;
}

.mobile-nav .profile-name-btn,
.mobile-nav #btn-sign-out-mobile {
  justify-content: flex-start;
}

.mobile-nav .profile-name-btn [data-auth-field="name"] {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 44px;
  padding: 0.75rem 1rem;
  color: #d1d5db;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.3s ease, background 0.3s ease, filter 0.3s ease, transform 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-link:hover {
  color: #eab308;
  background: color-mix(in srgb, rgba(234, 179, 8, 0.08) 100%, transparent);
  filter: drop-shadow(0 0 8px rgba(234, 179, 8, 0.5));
}

.mobile-nav-link.active {
  color: #eab308;
  background: color-mix(in srgb, rgba(234, 179, 8, 0.12) 100%, transparent);
  filter: drop-shadow(0 0 6px rgba(234, 179, 8, 0.35));
}

.mobile-nav-btn {
  border-top: 1px solid var(--border-subtle, var(--border));
  margin-top: 0.25rem;
  transition: color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.mobile-nav-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 0 16px rgba(234, 179, 8, 0.22);
}

.mobile-nav-btn:first-of-type {
  margin-top: 0.5rem;
}

.mobile-nav-btn--primary {
  margin-top: 0.35rem;
  justify-content: center;
  background: linear-gradient(135deg, #9333ea 0%, #3b82f6 100%);
  color: #fff;
  font-weight: 700;
  border-top: none;
}

.mobile-nav-btn--primary:hover,
.mobile-nav-btn--primary.active {
  color: #fff;
  filter: brightness(1.05);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.55rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

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

.btn-ghost {
  background: transparent;
  color: #d1d5db;
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: #eab308;
  border-color: color-mix(in srgb, #eab308 40%, var(--border));
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #a88a2e);
  color: #111;
}

.btn-primary:hover {
  box-shadow:
    0 0 0 1px rgba(255, 247, 214, 0.3),
    0 4px 16px var(--accent-glow),
    0 0 28px rgba(234, 179, 8, 0.35);
}

/* ── Main Layout ── */

.main {
  display: grid;
  grid-template-columns: 260px 1fr 280px;
  gap: 1.5rem;
  padding: 1.5rem 2rem;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - 130px);
}

/* ── Side Panels ── */

.panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.panel-header {
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.btn-sm {
  min-height: 44px;
  min-width: 44px;
  padding: 0.5rem 0.9rem;
  font-size: 0.8125rem;
  text-transform: none;
  letter-spacing: 0;
}

.panel-body {
  padding: 1.25rem;
}

.player-list {
  display: flex;
  flex-direction: column;
}

/* Player Card */

.player-card {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
}

.player-card:last-child {
  margin-bottom: 0;
}

.player-card.active {
  border: 1px solid var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.player-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.player-info {
  flex: 1;
}

.player-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.player-rating {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.player-clock {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  min-width: 4.5rem;
  text-align: right;
}

.player-clock.low {
  color: var(--danger);
}

.player-clock.expired {
  color: var(--danger);
  opacity: 0.75;
}

.player-clock.active-turn {
  color: #38bdf8;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
}

/* ── Difficulty Selector ── */

.settings-section {
  margin-bottom: 1.75rem;
}

.settings-section:last-child {
  margin-bottom: 0;
}

.settings-section-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.settings-section-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.settings-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}

.settings-modal.hidden {
  display: none;
}

.settings-dialog {
  width: min(100%, 520px);
  max-height: min(90dvh, 720px);
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.settings-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.65rem 1rem 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-secondary);
}

.settings-tab {
  flex: 1;
  padding: 0.65rem 0.75rem;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.settings-tab:hover {
  color: var(--text-primary);
}

.settings-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.settings-tab-panel.hidden,
.settings-tab-panel[hidden] {
  display: none !important;
}

.settings-slider-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.settings-range {
  flex: 1;
  accent-color: var(--accent);
  height: 0.35rem;
  cursor: pointer;
}

.settings-slider-value {
  min-width: 3.25rem;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.settings-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.settings-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.settings-toggle-track {
  position: relative;
  width: 2.75rem;
  height: 1.5rem;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.settings-toggle-track::after {
  content: '';
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: var(--text-secondary);
  transition: transform 0.2s, background 0.2s;
}

.settings-toggle input:checked + .settings-toggle-track {
  background: color-mix(in srgb, var(--accent) 35%, var(--bg-elevated));
  border-color: var(--accent);
}

.settings-toggle input:checked + .settings-toggle-track::after {
  transform: translateX(1.2rem);
  background: var(--accent);
}

.settings-toggle-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.timer-style-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.timer-style-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding: 0.75rem 0.5rem;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.timer-style-option:hover {
  border-color: var(--accent);
}

.timer-style-option.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.timer-style-preview {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.timer-style-preview--classic {
  font-size: 1.1rem;
  font-weight: 700;
}

.timer-style-preview--compact {
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.85;
}

.timer-style-preview--bold {
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.timer-style-name {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.settings-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
}

.settings-close {
  width: 2.75rem;
  height: 2.75rem;
  min-width: 44px;
  min-height: 44px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.settings-close:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.settings-body {
  padding: 1.5rem;
  max-height: 70vh;
  overflow-y: auto;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.625rem;
}

.theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}

.theme-option:hover {
  border-color: var(--text-muted);
  transform: translateY(-1px);
}

.theme-option.active {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.theme-swatch {
  display: flex;
  width: 100%;
  height: 2.5rem;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.theme-swatch i {
  flex: 1;
  display: block;
}

.theme-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.theme-option.active .theme-name {
  color: var(--accent);
}

.team-color-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.625rem;
}

.team-color-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.75rem 0.5rem;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}

.team-color-option:hover {
  border-color: var(--text-muted);
  transform: translateY(-1px);
}

.team-color-option.active {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.team-swatch {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.team-swatch i {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.team-swatch .swatch-user {
  border-color: rgba(255, 255, 255, 0.35);
}

.team-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.team-pair {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.team-color-option.active .team-name {
  color: var(--accent);
}

.difficulty-grid {
  display: flex;
  gap: 0.5rem;
}

.difficulty-option {
  flex: 1;
  padding: 0.65rem 0.5rem;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.difficulty-option:hover {
  border-color: var(--text-muted);
}

.difficulty-option.active {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* Medium/Hard kept in markup for logic; hidden from players */
.difficulty-option[data-difficulty="medium"],
.difficulty-option[data-difficulty="hard"] {
  display: none;
}

.sound-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 1rem;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s, box-shadow 0.2s;
}

.sound-toggle:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.sound-toggle.active {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.sound-toggle-icon {
  font-size: 1.15rem;
  line-height: 1;
}

/* ── Chess Board Area ── */

.game-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

/* ── Play View: Chess.com-style flush board stack ── */

.play-view {
  background: #030712;
  min-height: calc(100dvh - 4.25rem);
  overflow-x: hidden;
}

/* Play Hub — Duolingo-style mode cards */
.play-hub {
  width: 100%;
  min-height: calc(100dvh - 4.25rem);
  padding: 1.25rem 1rem 2.5rem;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(34, 197, 94, 0.18), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 20%, rgba(14, 165, 233, 0.12), transparent 50%),
    #030712;
}

.play-hub.hidden {
  display: none;
}

.play-hub-inner {
  width: min(100%, 720px);
  margin-inline: auto;
}

.play-hub-header {
  text-align: center;
  margin-bottom: 1.35rem;
}

.play-hub-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #4ade80;
}

.play-hub-title {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #f8fafc;
}

.play-hub-subtitle {
  margin: 0.4rem 0 0;
  font-size: 0.95rem;
  color: #94a3b8;
}

.play-mode-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.75rem;
}

.play-mode-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  border: none;
  border-radius: 1.15rem;
  overflow: hidden;
  cursor: pointer;
  text-align: start;
  background: #111827;
  box-shadow:
    0 8px 0 rgba(0, 0, 0, 0.35),
    0 12px 28px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  color: #f8fafc;
}

.play-mode-card:hover {
  transform: translateY(-3px);
  box-shadow:
    0 11px 0 rgba(0, 0, 0, 0.32),
    0 16px 32px rgba(0, 0, 0, 0.4);
}

.play-mode-card:active {
  transform: translateY(2px);
  box-shadow:
    0 3px 0 rgba(0, 0, 0, 0.35),
    0 6px 14px rgba(0, 0, 0, 0.3);
}

.play-mode-card-top {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
  min-height: 7.5rem;
  padding: 1rem 0.75rem 1.65rem;
  background: linear-gradient(160deg, #58cc02 0%, #89e219 55%, #b8f03a 100%);
}

.play-mode-card-avatar-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.play-mode-card-cooldown {
  position: absolute;
  left: 50%;
  bottom: -1.15rem;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.88);
  color: #fef3c7;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  z-index: 2;
}

.play-mode-card-cooldown.hidden {
  display: none;
}

.play-mode-card-cooldown-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: #fbbf24;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.85);
  animation: play-cooldown-pulse 1s ease-in-out infinite;
}

@keyframes play-cooldown-pulse {
  0%,
  100% {
    opacity: 0.55;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.15);
  }
}

.play-mode-card--online.is-on-cooldown {
  cursor: not-allowed;
  opacity: 0.92;
}

.play-mode-card--online.is-on-cooldown:hover {
  transform: none;
  box-shadow:
    0 8px 0 rgba(0, 0, 0, 0.35),
    0 12px 28px rgba(0, 0, 0, 0.35);
}

.play-mode-card--online.is-on-cooldown .play-mode-card-top {
  filter: saturate(0.85);
}

.play-mode-card-top--ai {
  background: linear-gradient(160deg, #1a2744 0%, #243b6b 45%, #c9a84c 160%);
}

.play-mode-card-top--tournaments {
  background: linear-gradient(160deg, #4c1d95 0%, #7c3aed 48%, #f59e0b 145%);
}

.play-mode-card--tournaments:hover {
  box-shadow:
    0 11px 0 rgba(0, 0, 0, 0.32),
    0 16px 32px rgba(124, 58, 237, 0.35),
    0 0 28px rgba(245, 158, 11, 0.22);
}

.play-mode-card-trophy {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 5.5rem;
  height: 5.5rem;
  font-size: 2.75rem;
  line-height: 1;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.16);
  filter: drop-shadow(0 0 18px rgba(245, 158, 11, 0.55));
  animation: tournaments-trophy-glow 2.4s ease-in-out infinite;
}

@keyframes tournaments-trophy-glow {
  0%,
  100% {
    transform: scale(0.96);
    filter: drop-shadow(0 0 12px rgba(245, 158, 11, 0.4));
  }
  50% {
    transform: scale(1.04);
    filter: drop-shadow(0 0 22px rgba(167, 139, 250, 0.65));
  }
}

.play-mode-card-xp--gold {
  background: rgba(168, 85, 247, 0.2);
  border-color: rgba(245, 158, 11, 0.55);
  color: #fcd34d;
}

.lumina-avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  --lumina-glow-rgb: 251, 191, 36;
}

.lumina-avatar::before {
  content: '';
  position: absolute;
  inset: -10%;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(var(--lumina-glow-rgb), 0.55) 0%,
    rgba(var(--lumina-glow-rgb), 0.18) 45%,
    transparent 70%
  );
  animation: lumina-pulse 2.2s ease-in-out infinite;
  pointer-events: none;
}

/* Evolution states — glow color + shape accents */
.lumina-avatar[data-glow='tactical'],
.chess-bot-option[data-glow='tactical'] {
  --lumina-glow-rgb: 251, 191, 36;
}

.lumina-avatar[data-glow='aggressive'],
.chess-bot-option[data-glow='aggressive'] {
  --lumina-glow-rgb: 234, 88, 12;
}

.lumina-avatar[data-glow='defensive'],
.chess-bot-option[data-glow='defensive'] {
  --lumina-glow-rgb: 59, 130, 246;
}

.lumina-avatar[data-glow='defensive']::after {
  content: '';
  position: absolute;
  inset: -4%;
  border-radius: 50%;
  border: 2px solid rgba(96, 165, 250, 0.55);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.45);
  pointer-events: none;
  z-index: 0;
  animation: lumina-shield 2.8s ease-in-out infinite;
}

.lumina-avatar[data-glow='expert'],
.chess-bot-option[data-glow='expert'] {
  --lumina-glow-rgb: 248, 250, 252;
}

.lumina-avatar[data-glow='expert']::before {
  animation: lumina-quantum-pulse 1.6s ease-in-out infinite;
}

.lumina-avatar[data-glow='expert']::after {
  content: '';
  position: absolute;
  inset: -14%;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.45);
  pointer-events: none;
  z-index: 0;
  animation: lumina-interference 3.2s linear infinite;
}

.lumina-avatar-img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
}

.lumina-avatar[data-glow='aggressive'] .lumina-avatar-img {
  border-radius: 18%;
}

.lumina-avatar--card {
  width: 6rem;
  height: 6rem;
}

.lumina-avatar--board {
  width: 3.25rem !important;
  height: 3.25rem !important;
  flex-shrink: 0;
}

.lumina-avatar--board .lumina-avatar-img,
.lumina-avatar--board img {
  width: 3.25rem !important;
  height: 3.25rem !important;
}

.lumina-avatar--modal {
  width: 5.5rem;
  height: 5.5rem;
  margin: 0 auto 0.85rem;
}

@keyframes lumina-pulse {
  0%,
  100% {
    transform: scale(0.92);
    opacity: 0.65;
  }
  50% {
    transform: scale(1.12);
    opacity: 1;
  }
}

@keyframes lumina-shield {
  0%,
  100% {
    transform: scale(0.96);
    opacity: 0.55;
  }
  50% {
    transform: scale(1.05);
    opacity: 1;
  }
}

@keyframes lumina-quantum-pulse {
  0%,
  100% {
    transform: scale(0.88);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
}

@keyframes lumina-interference {
  to {
    transform: rotate(360deg);
  }
}

.lumina-fallback-modal.hidden {
  display: none;
}

.lumina-fallback-modal {
  position: fixed;
  inset: 0;
  z-index: 410;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.lumina-fallback-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 12, 0.65);
  backdrop-filter: blur(5px);
}

.lumina-fallback-dialog {
  position: relative;
  width: min(100%, 400px);
  padding: 1.4rem 1.25rem 1.25rem;
  border-radius: 18px;
  border: 1px solid rgba(201, 168, 76, 0.45);
  background: linear-gradient(165deg, rgba(28, 30, 38, 0.96), rgba(12, 14, 20, 0.98));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 40px rgba(201, 168, 76, 0.12);
  text-align: center;
}

.lumina-fallback-title {
  margin: 0 0 0.45rem;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent-secondary);
}

.lumina-fallback-msg {
  margin: 0 0 1.15rem;
  color: var(--text-secondary);
  line-height: 1.45;
  font-size: 0.95rem;
}

.lumina-fallback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.lumina-fallback-actions .btn {
  flex: 1 1 9rem;
}

.play-mode-card-avatar {
  width: 5.5rem;
  height: 5.5rem;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.25));
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.2);
  padding: 0.35rem;
}

.play-mode-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.95rem 0.9rem 1.1rem;
}

.play-mode-card-kicker {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}

.play-mode-card-title {
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.3;
  color: #f1f5f9;
}

.play-mode-card-reward {
  margin-top: 0.35rem;
}

.play-mode-card-xp {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: rgba(234, 179, 8, 0.18);
  border: 1px solid rgba(234, 179, 8, 0.45);
  color: #fbbf24;
  font-size: 0.78rem;
  font-weight: 800;
}

.play-recent {
  width: 100%;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(17, 24, 39, 0.72);
  padding: 1rem 0.9rem 0.85rem;
  backdrop-filter: blur(10px);
  box-sizing: border-box;
}

.play-recent-title {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #e2e8f0;
  text-align: start;
}

.play-recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  box-sizing: border-box;
}

.play-recent-empty {
  width: 100%;
  padding: 0.85rem 0.5rem;
  text-align: center;
  color: #64748b;
  font-size: 0.9rem;
}

/* Desktop (default): horizontal row, left-aligned */
.match-card,
.play-recent-row.match-card {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr) auto;
  align-items: center;
  justify-content: initial;
  text-align: start;
  gap: 0.55rem;
  padding: 0.7rem 0.75rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border-radius: 0.75rem;
  background: rgba(2, 6, 23, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  overflow: hidden;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.15s ease,
    background 0.2s ease;
}

.match-card > *,
.play-recent-row.match-card > * {
  width: auto;
  display: revert;
  justify-content: initial;
  align-items: initial;
  box-sizing: border-box;
}

.match-card:hover,
.match-card:focus-visible,
.play-recent-row.match-card:hover,
.play-recent-row.match-card:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 0 16px var(--accent-glow);
  background: rgba(2, 6, 23, 0.7);
  transform: translateY(-1px);
}

.play-recent-type {
  font-size: 1rem;
  line-height: 1;
  width: auto;
  min-height: 0;
}

.play-recent-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
  min-width: 0;
  text-align: start;
}

.play-recent-name {
  display: block;
  width: auto;
  max-width: 100%;
  font-weight: 800;
  font-size: 0.92rem;
  color: #f8fafc;
  text-align: start;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.play-recent-elo {
  display: block;
  width: auto;
  font-size: 0.72rem;
  font-weight: 500;
  color: #94a3b8;
  text-align: start;
  font-variant-numeric: tabular-nums;
}

.play-recent-when {
  display: block;
  width: auto;
  font-size: 0.65rem;
  font-weight: 500;
  line-height: 1.3;
  color: #94a3b8;
  text-align: start;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.play-recent-result {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}

/* Mobile only: centered card stack + 3-per-page UX */
@media (max-width: 768px) {
  .play-recent-title {
    text-align: center;
  }

  .play-recent-list {
    align-items: center;
    gap: 0.85rem;
  }

  .match-card,
  .play-recent-row.match-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
    padding: 15px;
  }

  .match-card > *,
  .play-recent-row.match-card > * {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .match-card > .play-recent-result,
  .play-recent-row.match-card > .play-recent-result {
    width: auto;
    display: inline-flex;
  }

  .play-recent-type {
    font-size: 1.55rem;
    min-height: 2.5rem;
    width: 100%;
  }

  .play-recent-meta {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    width: 100%;
  }

  .play-recent-name {
    width: 100%;
    font-size: 1rem;
    text-align: center;
  }

  .play-recent-when,
  .play-recent-elo {
    width: 100%;
    text-align: center;
    font-size: 0.68rem;
  }

  .play-recent-result {
    padding: 0.35rem 0.85rem;
  }
}

.play-recent-result--win {
  color: #166534;
  background: #bbf7d0;
}

.play-recent-result--loss {
  color: #991b1b;
  background: #fecaca;
}

.play-recent-result--draw {
  color: #334155;
  background: #e2e8f0;
}

.play-recent-load-more-wrap {
  margin-top: 0.75rem;
  display: flex;
  justify-content: center;
}

.play-recent-load-more-wrap[hidden] {
  display: none !important;
}

.play-recent-load-more {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  min-width: 10rem;
  padding: 0.55rem 1.1rem;
  border-radius: 0.65rem;
  border: 1px solid rgba(124, 58, 237, 0.45);
  background: rgba(2, 6, 23, 0.72);
  color: #f8fafc;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.play-recent-load-more:hover:not(:disabled),
.play-recent-load-more:focus-visible {
  outline: none;
  border-color: rgba(245, 158, 11, 0.65);
  background: rgba(124, 58, 237, 0.28);
  box-shadow: 0 0 14px rgba(124, 58, 237, 0.25);
}

.play-recent-load-more:disabled {
  opacity: 0.55;
  cursor: wait;
}

.play-recent-load-more-meta {
  font-size: 0.72rem;
  font-weight: 600;
  color: #94a3b8;
}

.play-recent-scroll-sentinel {
  width: 100%;
  height: 1px;
  pointer-events: none;
}

/* Legacy pagination — kept for cached markup */
.play-recent-pagination {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.play-recent-pagination[hidden] {
  display: none !important;
}

.play-recent-pagination-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.play-recent-page-btn {
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.55rem;
  border-radius: 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(2, 6, 23, 0.55);
  color: #cbd5e1;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

.play-recent-page-btn:hover,
.play-recent-page-btn:focus-visible {
  outline: none;
  border-color: rgba(124, 58, 237, 0.55);
  color: #f8fafc;
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.25);
}

.play-recent-page-btn.is-active {
  border-color: rgba(245, 158, 11, 0.65);
  background: rgba(124, 58, 237, 0.35);
  color: #fef3c7;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.2);
}

/* Recent Matches compact pagination — mobile only */
@media (max-width: 768px) {
  .play-recent-load-more-wrap:has(.play-recent-pagination-inner) {
    width: 100%;
    margin-top: 0.65rem;
    padding-inline: 0.25rem;
    overflow: hidden;
  }

  .play-recent-pagination-inner {
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: clamp(0.28rem, 2vw, 0.45rem);
  }

  .play-recent-page-btn {
    flex: 0 0 2.25rem;
    width: 2.25rem;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border-radius: 0.55rem;
    border: 1px solid rgba(139, 92, 246, 0.4);
    background: rgba(8, 12, 24, 0.94);
    color: #cbd5e1;
    font-size: 0.82rem;
    box-shadow:
      inset 0 0 8px rgba(124, 58, 237, 0.08),
      0 0 6px rgba(124, 58, 237, 0.12);
    touch-action: manipulation;
  }

  .play-recent-page-btn:active {
    transform: scale(0.94);
    border-color: rgba(167, 139, 250, 0.85);
    box-shadow: 0 0 14px rgba(124, 58, 237, 0.55);
  }

  .play-recent-page-btn.is-active {
    border-color: rgba(245, 158, 11, 0.85);
    background: linear-gradient(145deg, rgba(91, 33, 182, 0.8), rgba(30, 41, 59, 0.96));
    color: #fff7d6;
    box-shadow:
      inset 0 0 9px rgba(245, 158, 11, 0.16),
      0 0 14px rgba(245, 158, 11, 0.38);
  }

  .play-recent-page-gap {
    flex: 0 0 1rem;
    width: 1rem;
    color: #64748b;
    font-size: 0.9rem;
    line-height: 2.25rem;
    text-align: center;
    user-select: none;
  }
}

.tournaments-modal.hidden {
  display: none;
}

/* ── Blitz Rush Tournament Lobby ── */
.blitz-lobby.hidden {
  display: none !important;
}

.blitz-lobby {
  display: block;
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
}

.blitz-lobby-inner {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.blitz-lobby-header {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.blitz-lobby-eyebrow {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}

.blitz-lobby-title {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: #f1f5f9;
}

.blitz-lobby-status,
.blitz-lobby-countdown,
.blitz-lobby-meta {
  margin: 0;
  color: #cbd5e1;
  font-size: 0.95rem;
}

.blitz-lobby-countdown {
  color: #38bdf8;
  font-variant-numeric: tabular-nums;
}

.blitz-lobby-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .blitz-lobby-grid {
    grid-template-columns: 1.4fr 0.9fr;
    align-items: start;
  }
}

.blitz-lobby-panel,
.blitz-lobby-aside {
  background: linear-gradient(165deg, rgba(15, 23, 42, 0.92), rgba(2, 6, 23, 0.88));
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  padding: 1rem 1.1rem;
}

.blitz-lobby-panel-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: #e2e8f0;
}

.blitz-lobby-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(52vh, 420px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.blitz-lobby-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.55);
}

.blitz-lobby-row--eliminated {
  opacity: 0.55;
}

.blitz-lobby-name {
  color: #f8fafc;
  font-size: 0.92rem;
}

.blitz-lobby-you {
  color: #38bdf8;
  font-size: 0.8rem;
}

.blitz-lobby-row-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #94a3b8;
  font-size: 0.8rem;
  white-space: nowrap;
}

.blitz-lobby-ready-badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
  font-size: 0.7rem;
}

.blitz-lobby-empty {
  color: #64748b;
  padding: 0.75rem 0.25rem;
}

.blitz-lobby-rules {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
  color: #cbd5e1;
  font-size: 0.88rem;
  line-height: 1.45;
}

.blitz-lobby-rules p {
  margin: 0;
}

.blitz-lobby-lives {
  margin: 0 0 0.85rem;
  color: #fbbf24;
  font-weight: 600;
  font-size: 0.95rem;
}

.blitz-lobby-ready {
  width: 100%;
}

.blitz-lobby-ready:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.blitz-lobby-ready-hint {
  margin: 0.65rem 0 0;
  color: #94a3b8;
  font-size: 0.82rem;
  line-height: 1.4;
}

.tournaments-modal {
  position: fixed;
  inset: 0;
  z-index: 420;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(4, 6, 12, 0.62);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.tournaments-modal.is-open {
  opacity: 1;
}

.tournaments-modal-dialog {
  position: relative;
  width: min(100%, 420px);
  max-height: min(88vh, 560px);
  overflow: auto;
  padding: 1.35rem 1.2rem 1.15rem;
  border-radius: 1.1rem;
  border: 1px solid rgba(167, 139, 250, 0.4);
  background: linear-gradient(165deg, rgba(36, 22, 54, 0.97), rgba(12, 14, 20, 0.98));
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.55),
    0 0 40px rgba(124, 58, 237, 0.18);
}

.tournaments-modal-close {
  position: absolute;
  top: 0.65rem;
  inset-inline-end: 0.75rem;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.tournaments-modal-close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.tournaments-modal-eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c4b5fd;
}

.tournaments-modal-title {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
  font-weight: 800;
  color: #fef3c7;
}

.tournaments-modal-subtitle {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: #94a3b8;
}

.tournaments-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.tournaments-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.8rem 0.85rem;
  border-radius: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(2, 6, 23, 0.5);
}

.tournaments-item--live {
  border-color: rgba(34, 197, 94, 0.35);
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.12);
}

.tournaments-item--upcoming {
  border-color: rgba(245, 158, 11, 0.3);
}

.tournaments-item--soon {
  opacity: 0.88;
}

.tournaments-item-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.tournaments-item-name {
  font-weight: 800;
  font-size: 0.95rem;
  color: #f8fafc;
}

.tournaments-item-reward {
  font-size: 0.78rem;
  font-weight: 600;
  color: #fcd34d;
}

.tournaments-item-status {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.25);
  color: #e9d5ff;
  white-space: nowrap;
}

.tournaments-item--live .tournaments-item-status {
  background: rgba(34, 197, 94, 0.22);
  color: #bbf7d0;
}

.tournaments-modal-actions {
  display: flex;
  justify-content: flex-end;
}

.tournaments-item--playable {
  cursor: pointer;
  gap: 0.75rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.tournaments-item--playable:hover,
.tournaments-item--playable:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent-glow) 45%, transparent);
  transform: translateY(-1px);
}

.tournaments-item-cta {
  flex: 0 0 auto;
  min-height: 2.25rem;
  padding: 0.4rem 0.85rem;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--cta-text, #09090b);
  background: linear-gradient(135deg, var(--cta-from, var(--accent)), var(--cta-to, var(--accent-dim)));
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent-glow) 55%, transparent);
  cursor: pointer;
  white-space: nowrap;
}

.tournaments-item-cta:hover {
  filter: brightness(1.06);
}

.tournaments-item--blitz {
  align-items: flex-start;
}

.tournaments-item-meta {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.tournaments-item-countdown {
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tournaments-item-cta:disabled {
  opacity: 0.65;
  cursor: default;
  filter: none;
}

/* Blitz Rush match results + interstitial */
.blitz-results-modal {
  position: fixed;
  inset: 0;
  z-index: 470;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.blitz-results-modal.hidden {
  display: none;
}

.blitz-results-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.blitz-results-dialog {
  width: min(100%, 26rem);
  padding: 1.75rem 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  background: #0f1115;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7);
}

.blitz-results-eyebrow {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.blitz-results-title {
  margin: 0.45rem 0 0.35rem;
  font-size: 1.55rem;
}

.blitz-results-message {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.45;
}

.blitz-interstitial {
  margin-top: 1.15rem;
  padding: 1rem;
  border-radius: var(--radius-md, 0.75rem);
  border: 1px dashed color-mix(in srgb, var(--accent) 40%, var(--border));
  background: color-mix(in srgb, var(--bg-elevated) 90%, transparent);
}

.blitz-interstitial-badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 0.35rem;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0a0a0a;
  background: var(--accent);
}

.blitz-interstitial-copy {
  margin: 0.55rem 0 0.75rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.blitz-interstitial-progress {
  height: 0.35rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.blitz-interstitial-progress span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cta-from, var(--accent)), var(--cta-to, var(--accent-dim)));
}

.blitz-interstitial-note {
  margin: 0.55rem 0 0;
  font-size: 0.72rem;
  color: var(--text-secondary);
  opacity: 0.85;
}

.blitz-results-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1.15rem;
}

.avatar-frame--gold,
.avatar-frame--blitz-king {
  position: relative;
  border-radius: 50%;
  box-shadow:
    0 0 0 2px #f6e27a,
    0 0 0 4px #b8860b,
    0 0 18px rgba(234, 179, 8, 0.55);
}

.avatar-frame--gold::after,
.avatar-frame--blitz-king::after {
  content: '♛';
  position: absolute;
  top: -0.35rem;
  right: -0.2rem;
  font-size: 0.85rem;
  filter: drop-shadow(0 0 6px rgba(234, 179, 8, 0.8));
}

.blitz-title-badge {
  display: inline-flex;
  align-items: center;
  margin-inline-start: 0.35rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1a1200;
  background: linear-gradient(135deg, #f6e27a, #c9a84c);
}

.avatar-frame--neon {
  position: relative;
  border-radius: 50%;
  box-shadow:
    0 0 0 2px #67e8f9,
    0 0 0 4px #0891b2,
    0 0 20px rgba(34, 211, 238, 0.55);
}

.avatar-frame--neon::after {
  content: '✦';
  position: absolute;
  top: -0.3rem;
  right: -0.15rem;
  font-size: 0.8rem;
  color: #67e8f9;
  filter: drop-shadow(0 0 6px rgba(34, 211, 238, 0.9));
}

/* Broadcast and Referral Modals */
.broadcast-modal,
.referral-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Floating action stack: Support + Admin announcements */
.floating-fab-stack {
  position: fixed;
  inset-inline-end: 1.35rem;
  bottom: 1.35rem;
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.broadcast-fab,
.support-fab {
  position: relative;
  inset-inline-end: auto;
  bottom: auto;
  z-index: 1;
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 3.6rem;
  height: 3.6rem;
  padding: 0;
  border: 1px solid rgba(255, 230, 160, 0.45);
  border-radius: 999px;
  cursor: pointer;
  color: #1a1408;
  background:
    radial-gradient(circle at 30% 25%, #ffe7a0 0%, transparent 45%),
    linear-gradient(160deg, #efd078 0%, #c9a84c 42%, #8f6d24 100%);
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.45),
    0 2px 0 rgba(255, 240, 190, 0.55) inset,
    0 -3px 8px rgba(80, 50, 0, 0.35) inset,
    0 0 18px rgba(201, 168, 76, 0.35),
    0 0 34px rgba(201, 168, 76, 0.18);
  transform: translateZ(0);
  transition: transform 0.2s ease, box-shadow 0.25s ease, filter 0.2s ease;
  animation: broadcast-fab-float 3.6s ease-in-out infinite;
}

.support-fab {
  border-color: rgba(125, 211, 252, 0.4);
  color: #071018;
  background:
    radial-gradient(circle at 30% 25%, #bae6fd 0%, transparent 45%),
    linear-gradient(160deg, #7dd3fc 0%, #38bdf8 45%, #0284c7 100%);
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.45),
    0 2px 0 rgba(224, 242, 254, 0.55) inset,
    0 -3px 8px rgba(7, 40, 70, 0.35) inset,
    0 0 18px rgba(56, 189, 248, 0.35),
    0 0 34px rgba(14, 165, 233, 0.18);
  animation-delay: 0.35s;
}

.support-fab__glow {
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.45) 0%, transparent 68%);
  opacity: 0.75;
  pointer-events: none;
  filter: blur(2px);
  z-index: 0;
}

.support-fab__face {
  position: relative;
  z-index: 1;
  display: inline-flex;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.35));
}

.support-fab:hover {
  transform: translateY(-3px) scale(1.06);
  filter: brightness(1.06);
  box-shadow:
    0 14px 28px rgba(0, 0, 0, 0.5),
    0 2px 0 rgba(224, 242, 254, 0.65) inset,
    0 -3px 10px rgba(7, 40, 70, 0.4) inset,
    0 0 26px rgba(56, 189, 248, 0.55),
    0 0 48px rgba(14, 165, 233, 0.28);
}

/* Admin announcement FAB — always visible, 3D gold glow */
.broadcast-fab {
  /* base shared above */
}

.broadcast-fab__glow {
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  background: radial-gradient(circle, rgba(201, 168, 76, 0.45) 0%, transparent 68%);
  opacity: 0.75;
  pointer-events: none;
  filter: blur(2px);
  z-index: 0;
}

.broadcast-fab__face {
  position: relative;
  z-index: 1;
  display: inline-flex;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.35));
}

.broadcast-fab:hover {
  transform: translateY(-3px) scale(1.06);
  filter: brightness(1.06);
  box-shadow:
    0 14px 28px rgba(0, 0, 0, 0.5),
    0 2px 0 rgba(255, 245, 210, 0.65) inset,
    0 -3px 10px rgba(80, 50, 0, 0.4) inset,
    0 0 26px rgba(201, 168, 76, 0.55),
    0 0 48px rgba(201, 168, 76, 0.28);
}

.broadcast-fab:active,
.support-fab:active {
  transform: translateY(-1px) scale(1.02);
}

.broadcast-fab.has-unread {
  animation:
    broadcast-fab-float 3.6s ease-in-out infinite,
    broadcast-fab-pulse 1.7s ease-in-out infinite;
}

.broadcast-fab__badge {
  position: absolute;
  top: 0.1rem;
  inset-inline-end: 0.1rem;
  z-index: 2;
  width: 0.95rem;
  height: 0.95rem;
}

.broadcast-fab__badge.hidden {
  display: none !important;
}

.broadcast-fab__badge-ping {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #f87171;
  opacity: 0.7;
  animation: broadcast-badge-ping 1.4s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.broadcast-fab__badge-dot {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #ef4444;
  border: 2px solid #14161c;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.7);
}

@keyframes broadcast-fab-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

@keyframes broadcast-fab-pulse {
  0%,
  100% {
    box-shadow:
      0 10px 22px rgba(0, 0, 0, 0.45),
      0 2px 0 rgba(255, 240, 190, 0.55) inset,
      0 -3px 8px rgba(80, 50, 0, 0.35) inset,
      0 0 18px rgba(201, 168, 76, 0.4),
      0 0 34px rgba(201, 168, 76, 0.22);
  }
  50% {
    box-shadow:
      0 12px 26px rgba(0, 0, 0, 0.5),
      0 2px 0 rgba(255, 245, 210, 0.7) inset,
      0 -3px 8px rgba(80, 50, 0, 0.35) inset,
      0 0 28px rgba(234, 179, 8, 0.75),
      0 0 56px rgba(201, 168, 76, 0.45);
  }
}

@keyframes broadcast-badge-ping {
  75%,
  100% {
    transform: scale(1.9);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .broadcast-fab,
  .support-fab,
  .broadcast-fab.has-unread,
  .broadcast-fab__badge-ping {
    animation: none;
  }
}

/* Mobile: compact floating FABs so they don't cover cards */
@media (max-width: 767px) {
  .floating-fab-stack {
    inset-inline-end: 0.85rem;
    bottom: 0.85rem;
    gap: 0.95rem;
  }

  .broadcast-fab,
  .support-fab {
    width: 2.75rem;
    height: 2.75rem;
    box-shadow:
      0 7px 16px rgba(0, 0, 0, 0.42),
      0 1.5px 0 rgba(255, 240, 190, 0.5) inset,
      0 -2px 6px rgba(80, 50, 0, 0.32) inset,
      0 0 12px rgba(201, 168, 76, 0.32),
      0 0 22px rgba(201, 168, 76, 0.16);
  }

  .support-fab {
    box-shadow:
      0 7px 16px rgba(0, 0, 0, 0.42),
      0 1.5px 0 rgba(224, 242, 254, 0.5) inset,
      0 -2px 6px rgba(7, 40, 70, 0.32) inset,
      0 0 12px rgba(56, 189, 248, 0.32),
      0 0 22px rgba(14, 165, 233, 0.16);
  }

  .support-fab__glow,
  .broadcast-fab__glow {
    inset: -4px;
  }

  .support-fab__face svg,
  .broadcast-fab__face svg {
    width: 18px;
    height: 18px;
  }

  .broadcast-fab__badge {
    width: 0.72rem;
    height: 0.72rem;
    top: 0.05rem;
    inset-inline-end: 0.05rem;
  }

  @keyframes broadcast-fab-float {
    0%,
    100% {
      transform: translateY(0);
    }
    50% {
      transform: translateY(-3px);
    }
  }
}

/* Support modal */
.support-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.support-modal.is-open {
  display: flex;
}

.support-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 12, 0.72);
  backdrop-filter: blur(6px);
}

.support-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 28rem);
  max-height: min(90vh, 40rem);
  overflow: auto;
  padding: 1.25rem 1.25rem 1.35rem;
  border-radius: 1rem;
  border: 1px solid rgba(56, 189, 248, 0.28);
  background: linear-gradient(160deg, rgba(22, 28, 40, 0.98), rgba(12, 16, 24, 0.98));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(56, 189, 248, 0.12);
}

.support-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.support-dialog-title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: #f8fafc;
}

.support-dialog-title-icon {
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.45));
}

.support-dialog-close {
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.support-dialog-close:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.06);
}

.support-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.support-field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
}

.support-field input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 0.7rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(8, 12, 20, 0.7);
  color: #e2e8f0;
  font-size: 0.92rem;
}

.support-field input[readonly] {
  opacity: 0.88;
  cursor: default;
}

.support-editor-shell {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 0.75rem;
  overflow: hidden;
  background: rgba(8, 12, 20, 0.7);
}

.support-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(255, 255, 255, 0.03);
}

.support-tool {
  min-width: 2rem;
  height: 1.85rem;
  padding: 0 0.55rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 0.45rem;
  background: rgba(15, 23, 42, 0.7);
  color: #e2e8f0;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.support-tool:hover,
.support-tool.is-active {
  border-color: rgba(56, 189, 248, 0.55);
  color: #7dd3fc;
  background: rgba(14, 165, 233, 0.12);
}

.support-editor {
  min-height: 9rem;
  max-height: 14rem;
  overflow: auto;
  padding: 0.85rem 0.9rem;
  color: #f1f5f9;
  font-size: 0.95rem;
  line-height: 1.5;
  outline: none;
}

.support-editor:empty::before {
  content: attr(data-placeholder);
  color: #64748b;
  pointer-events: none;
}

.support-editor ul {
  margin: 0.35rem 0;
  padding-inline-start: 1.25rem;
}

.support-status {
  margin: 0;
  font-size: 0.85rem;
}

.support-status.is-error {
  color: #f87171;
}

.support-status.is-success {
  color: #34d399;
}

.support-submit {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(125, 211, 252, 0.4);
  border-radius: 0.85rem;
  background: linear-gradient(180deg, #7dd3fc 0%, #38bdf8 50%, #0284c7 100%);
  color: #071018;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(14, 165, 233, 0.28);
}

.support-submit:hover:not(:disabled) {
  filter: brightness(1.05);
}

.support-submit:disabled {
  opacity: 0.65;
  cursor: wait;
}

/* ——— Daily Streak system ——— */
.streak-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.streak-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.streak-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 8, 14, 0.72);
  backdrop-filter: blur(6px);
}

.streak-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 26rem);
  max-height: min(92vh, 40rem);
  overflow: auto;
  border-radius: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(56, 189, 248, 0.18), transparent 55%),
    linear-gradient(165deg, #141a28 0%, #0c1018 100%);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.55);
  transform: translateY(10px) scale(0.97);
  transition: transform 0.32s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.streak-modal.is-open .streak-dialog {
  transform: none;
}

.streak-dialog-close {
  position: absolute;
  top: 0.75rem;
  inset-inline-end: 0.75rem;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.streak-hero {
  text-align: center;
  padding: 1.75rem 1.5rem 1rem;
}

/* ——— 3D streak fire (frozen → shatter → blaze) ——— */
.streak-fire {
  position: relative;
  width: 7.25rem;
  height: 7.25rem;
  margin: 0 auto 0.85rem;
  display: grid;
  place-items: center;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  perspective: 520px;
  -webkit-tap-highlight-color: transparent;
}

.streak-fire:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 50%;
}

.streak-fire-3d {
  position: relative;
  width: 4.6rem;
  height: 5.4rem;
  transform-style: preserve-3d;
  transform: rotateX(12deg) rotateY(-8deg);
  filter: drop-shadow(0 10px 18px rgba(120, 40, 20, 0.45));
  transition: filter 0.45s ease, transform 0.45s ease;
}

.streak-fire-3d--mini {
  width: 1.35rem;
  height: 1.55rem;
  transform: rotateX(10deg) rotateY(-6deg);
  filter: drop-shadow(0 2px 6px rgba(120, 40, 20, 0.4));
}

.streak-fire-glow,
.streak-fire-base,
.streak-fire-outer,
.streak-fire-mid,
.streak-fire-core,
.streak-fire-tip {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 50% 50% 45% 45% / 60% 60% 40% 40%;
  pointer-events: none;
}

.streak-fire-glow {
  bottom: 0.15rem;
  width: 140%;
  height: 70%;
  background: radial-gradient(ellipse at center, rgba(201, 168, 76, 0.55), transparent 68%);
  filter: blur(8px);
  opacity: 0.85;
  animation: streak-fire-glow-pulse 1.8s ease-in-out infinite;
}

.streak-fire-base {
  bottom: 0;
  width: 62%;
  height: 28%;
  background: radial-gradient(ellipse at center, #7a1f2e 0%, #3d0c14 70%, transparent 75%);
  filter: blur(1px);
  opacity: 0.9;
}

.streak-fire-outer,
.streak-fire-mid,
.streak-fire-core,
.streak-fire-tip {
  transform-origin: 50% 100%;
  animation: streak-fire-flicker 0.9s ease-in-out infinite alternate;
}

.streak-fire-outer {
  bottom: 0.2rem;
  width: 78%;
  height: 88%;
  background:
    linear-gradient(180deg, rgba(232, 212, 138, 0.15) 0%, transparent 28%),
    radial-gradient(ellipse at 50% 80%, #8b1e2d 0%, #5c1020 42%, #2a0810 78%, transparent 82%);
  animation-duration: 1.15s;
  box-shadow: 0 0 18px rgba(139, 30, 45, 0.45);
}

.streak-fire-mid {
  bottom: 0.35rem;
  width: 56%;
  height: 78%;
  background:
    linear-gradient(180deg, #e8d48a 0%, #c9a84c 28%, #b33a2b 62%, #6b1520 100%);
  animation-duration: 0.85s;
  animation-delay: 0.08s;
  box-shadow: 0 0 14px rgba(201, 168, 76, 0.4);
}

.streak-fire-core {
  bottom: 0.5rem;
  width: 34%;
  height: 62%;
  background: linear-gradient(180deg, #fff6d6 0%, #f0d78c 35%, #e8a54b 70%, #c45c28 100%);
  animation-duration: 0.7s;
  animation-delay: 0.12s;
  box-shadow: 0 0 12px rgba(255, 220, 140, 0.55);
}

.streak-fire-tip {
  bottom: 2.55rem;
  width: 18%;
  height: 38%;
  background: linear-gradient(180deg, #fffcea 0%, #ffe9a8 45%, transparent 100%);
  animation-duration: 0.55s;
  filter: blur(0.3px);
  opacity: 0.95;
}

.streak-fire-ember {
  position: absolute;
  bottom: 55%;
  width: 0.28rem;
  height: 0.28rem;
  border-radius: 50%;
  background: #e8d48a;
  box-shadow: 0 0 6px #c9a84c;
  opacity: 0;
  animation: streak-ember-rise 2.2s ease-in infinite;
}

.streak-fire-ember--1 { left: 28%; animation-delay: 0.2s; }
.streak-fire-ember--2 { left: 52%; animation-delay: 0.9s; width: 0.2rem; height: 0.2rem; }
.streak-fire-ember--3 { left: 68%; animation-delay: 1.4s; }

@keyframes streak-fire-flicker {
  0% { transform: translateX(-50%) scaleX(1) scaleY(1) skewX(0deg); }
  50% { transform: translateX(-48%) scaleX(0.96) scaleY(1.06) skewX(-2deg); }
  100% { transform: translateX(-52%) scaleX(1.04) scaleY(0.97) skewX(2deg); }
}

@keyframes streak-fire-glow-pulse {
  0%, 100% { opacity: 0.7; transform: translateX(-50%) scale(0.95); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.08); }
}

@keyframes streak-ember-rise {
  0% { opacity: 0; transform: translateY(0) scale(1); }
  20% { opacity: 0.9; }
  100% { opacity: 0; transform: translateY(-2.4rem) scale(0.4); }
}

/* Frozen / ice fire */
.streak-fire.is-frozen .streak-fire-3d,
.dashboard-streak-fire.is-frozen .streak-fire-3d {
  filter: drop-shadow(0 8px 16px rgba(56, 189, 248, 0.45));
  animation: streak-ice-wobble 2.8s ease-in-out infinite;
}

.streak-fire.is-frozen .streak-fire-glow,
.dashboard-streak-fire.is-frozen .streak-fire-glow {
  background: radial-gradient(ellipse at center, rgba(125, 211, 252, 0.55), transparent 68%);
  animation: none;
  opacity: 0.75;
}

.streak-fire.is-frozen .streak-fire-base,
.dashboard-streak-fire.is-frozen .streak-fire-base {
  background: radial-gradient(ellipse at center, #1e3a5f 0%, #0b1c2e 70%, transparent 75%);
}

.streak-fire.is-frozen .streak-fire-outer,
.dashboard-streak-fire.is-frozen .streak-fire-outer {
  background:
    linear-gradient(180deg, rgba(224, 242, 254, 0.35) 0%, transparent 30%),
    radial-gradient(ellipse at 50% 80%, #7dd3fc 0%, #38bdf8 40%, #0ea5e9 70%, #0c4a6e 100%);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.5);
  animation: streak-frozen-flicker 1.6s ease-in-out infinite alternate;
}

.streak-fire.is-frozen .streak-fire-mid,
.dashboard-streak-fire.is-frozen .streak-fire-mid {
  background: linear-gradient(180deg, #e0f2fe 0%, #7dd3fc 35%, #38bdf8 70%, #0369a1 100%);
  box-shadow: 0 0 14px rgba(125, 211, 252, 0.55);
  animation-duration: 1.4s;
}

.streak-fire.is-frozen .streak-fire-core,
.dashboard-streak-fire.is-frozen .streak-fire-core {
  background: linear-gradient(180deg, #f0f9ff 0%, #bae6fd 40%, #7dd3fc 100%);
  box-shadow: 0 0 10px rgba(186, 230, 253, 0.7);
}

.streak-fire.is-frozen .streak-fire-tip,
.dashboard-streak-fire.is-frozen .streak-fire-tip {
  background: linear-gradient(180deg, #ffffff 0%, #e0f2fe 50%, transparent 100%);
}

.streak-fire.is-frozen .streak-fire-ember {
  background: #bae6fd;
  box-shadow: 0 0 6px #7dd3fc;
  animation-play-state: paused;
  opacity: 0;
}

.streak-frost {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 28% 28%, rgba(255, 255, 255, 0.55), transparent 42%),
    linear-gradient(160deg, rgba(186, 230, 253, 0.45), rgba(14, 165, 233, 0.18));
  box-shadow:
    inset 0 0 18px rgba(224, 242, 254, 0.55),
    0 0 22px rgba(56, 189, 248, 0.35);
  border: 1px solid rgba(186, 230, 253, 0.35);
  transition: opacity 0.35s ease;
}

.streak-fire.is-frozen .streak-frost,
.dashboard-streak-fire.is-frozen .streak-frost {
  opacity: 1;
}

.streak-shards {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}

.streak-shard {
  position: absolute;
  width: 0.85rem;
  height: 0.85rem;
  background: linear-gradient(135deg, #f0f9ff, #7dd3fc 55%, #38bdf8);
  opacity: 0;
  clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
  box-shadow: 0 0 8px rgba(125, 211, 252, 0.7);
}

.streak-shard.s1 { top: 18%; left: 22%; }
.streak-shard.s2 { top: 12%; right: 24%; clip-path: polygon(20% 0, 100% 30%, 70% 100%, 0 60%); }
.streak-shard.s3 { bottom: 28%; left: 16%; }
.streak-shard.s4 { bottom: 22%; right: 18%; }
.streak-shard.s5 { top: 40%; left: 8%; width: 0.55rem; height: 0.55rem; }
.streak-shard.s6 { top: 36%; right: 10%; width: 0.6rem; height: 0.6rem; }

.streak-fire.is-shattering .streak-frost,
.dashboard-streak-fire.is-shattering .streak-frost {
  animation: streak-ice-crack 0.75s ease forwards;
}

.streak-fire.is-shattering .streak-shards,
.dashboard-streak-fire.is-shattering .streak-shards {
  opacity: 1;
}

.streak-fire.is-shattering .streak-shard,
.dashboard-streak-fire.is-shattering .streak-shard {
  animation: streak-shard-fly 0.75s ease forwards;
}

.streak-fire.is-shattering .streak-shard.s1 { --sx: -36px; --sy: -42px; --rot: -48deg; }
.streak-fire.is-shattering .streak-shard.s2 { --sx: 40px; --sy: -38px; --rot: 52deg; animation-delay: 0.04s; }
.streak-fire.is-shattering .streak-shard.s3 { --sx: -44px; --sy: 18px; --rot: -72deg; animation-delay: 0.06s; }
.streak-fire.is-shattering .streak-shard.s4 { --sx: 42px; --sy: 22px; --rot: 68deg; animation-delay: 0.08s; }
.streak-fire.is-shattering .streak-shard.s5 { --sx: -28px; --sy: -8px; --rot: -30deg; animation-delay: 0.05s; }
.streak-fire.is-shattering .streak-shard.s6 { --sx: 30px; --sy: -12px; --rot: 36deg; animation-delay: 0.07s; }

.streak-fire.is-shattering .streak-fire-3d {
  animation: streak-fire-ignite 0.75s ease forwards;
}

.streak-fire.is-blazing .streak-fire-3d,
.dashboard-streak-fire.is-blazing .streak-fire-3d {
  filter: drop-shadow(0 12px 22px rgba(139, 30, 45, 0.55)) drop-shadow(0 0 28px rgba(201, 168, 76, 0.55));
  transform: rotateX(14deg) rotateY(-10deg) scale(1.06);
}

.streak-fire.is-blazing .streak-frost,
.dashboard-streak-fire.is-blazing .streak-frost {
  opacity: 0;
}

.streak-dialog.is-ignited,
.streak-modal.is-open .streak-dialog:has(.streak-fire.is-blazing) {
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(201, 168, 76, 0.22), transparent 55%),
    linear-gradient(165deg, #1a1210 0%, #0c1018 100%);
}

@keyframes streak-ice-wobble {
  0%, 100% { transform: rotateX(12deg) rotateY(-8deg) translateY(0); }
  50% { transform: rotateX(10deg) rotateY(-4deg) translateY(2px); }
}

@keyframes streak-frozen-flicker {
  0% { transform: translateX(-50%) scaleX(1) scaleY(1); filter: brightness(1); }
  100% { transform: translateX(-51%) scaleX(0.98) scaleY(1.03); filter: brightness(1.12); }
}

@keyframes streak-ice-crack {
  0% { opacity: 1; transform: scale(1); filter: blur(0); }
  40% { opacity: 0.95; transform: scale(1.06) rotate(-2deg); filter: blur(0.4px); }
  100% { opacity: 0; transform: scale(1.4); filter: blur(3px); }
}

@keyframes streak-shard-fly {
  0% { opacity: 0.95; transform: translate(0, 0) rotate(0deg) scale(1); }
  100% { opacity: 0; transform: translate(var(--sx, 28px), var(--sy, -36px)) rotate(var(--rot, 48deg)) scale(0.4); }
}

@keyframes streak-fire-ignite {
  0% { filter: drop-shadow(0 8px 16px rgba(56, 189, 248, 0.45)); transform: rotateX(12deg) rotateY(-8deg) scale(0.94); }
  45% { filter: drop-shadow(0 0 24px rgba(255, 255, 255, 0.7)); transform: rotateX(8deg) rotateY(0deg) scale(1.12); }
  100% { filter: drop-shadow(0 12px 22px rgba(139, 30, 45, 0.55)) drop-shadow(0 0 28px rgba(201, 168, 76, 0.55)); transform: rotateX(14deg) rotateY(-10deg) scale(1.06); }
}

.streak-count {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #f8fafc;
  font-variant-numeric: tabular-nums;
  transition: color 0.35s ease, text-shadow 0.35s ease;
}

.streak-fire.is-blazing ~ .streak-count,
.streak-hero:has(.streak-fire.is-blazing) .streak-count {
  color: #e8d48a;
  text-shadow: 0 0 18px rgba(201, 168, 76, 0.45);
}

.streak-dialog-title {
  margin: 0.35rem 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: #f1f5f9;
}

.streak-dialog-body {
  margin: 0;
  color: #94a3b8;
  font-size: 0.95rem;
  line-height: 1.5;
}

.streak-thaw-btn {
  margin-top: 1rem;
  border: 0;
  border-radius: 0.85rem;
  padding: 0.7rem 1.15rem;
  font-weight: 700;
  cursor: pointer;
  color: #1a1208;
  background: linear-gradient(135deg, #e8d48a, #c9a84c 45%, #8b1e2d);
  box-shadow: 0 0 24px rgba(201, 168, 76, 0.4);
}

.streak-thaw-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.streak-secondary-btn {
  margin-top: 0.65rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 0.85rem;
  padding: 0.55rem 1rem;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
}

.streak-panel {
  padding: 0 1.35rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 0.25rem;
  padding-top: 1rem;
}

.streak-goal-label,
.streak-milestones-title {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

.streak-goal-select {
  width: 100%;
  margin-bottom: 1rem;
  border-radius: 0.65rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.85);
  color: #e2e8f0;
  padding: 0.55rem 0.75rem;
}

.streak-milestones-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
  max-height: 11rem;
  overflow: auto;
}

.streak-milestone {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0.65rem;
  border-radius: 0.55rem;
  background: rgba(255, 255, 255, 0.03);
  color: #94a3b8;
  font-size: 0.88rem;
}

.streak-milestone.is-done {
  color: #cbd5e1;
  background: rgba(34, 197, 94, 0.12);
}

.streak-milestone.is-ready {
  outline: 1px solid rgba(251, 191, 36, 0.45);
}

.streak-retention-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0 1.5rem 1.5rem;
}

.dashboard-neon-stat--streak {
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-neon-stat--streak:hover,
.dashboard-neon-stat--streak:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.dashboard-neon-value--streak {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
}

.dashboard-streak-fire {
  position: relative;
  width: 1.6rem;
  height: 1.7rem;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}

.dashboard-neon-stat--streak.is-frozen .dashboard-neon-value--streak,
[data-streak-wrap].is-frozen [data-streak-count] {
  color: #7dd3fc;
  text-shadow: 0 0 12px rgba(125, 211, 252, 0.45);
}

.dashboard-neon-stat--streak.is-blazing .dashboard-neon-value--streak,
[data-streak-wrap].is-blazing [data-streak-count] {
  color: var(--accent, #c9a84c);
  text-shadow: 0 0 14px rgba(201, 168, 76, 0.45);
}

.dashboard-streak-goal {
  display: block;
  width: 100%;
  margin-top: 0.15rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
}

.streak-next-hint {
  min-height: 1.1rem;
}

@media (prefers-reduced-motion: reduce) {
  .streak-fire-outer,
  .streak-fire-mid,
  .streak-fire-core,
  .streak-fire-tip,
  .streak-fire-glow,
  .streak-fire-ember,
  .streak-fire.is-frozen .streak-fire-3d {
    animation: none !important;
  }
}

.broadcast-modal.is-open,
.referral-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.broadcast-dialog,
.referral-dialog {
  background: linear-gradient(145deg, var(--bg-elevated), var(--bg-secondary));
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75), 0 0 40px rgba(201, 168, 76, 0.1);
  width: 100%;
  max-width: 28rem;
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.broadcast-modal.is-open .broadcast-dialog,
.referral-modal.is-open .referral-dialog {
  transform: scale(1);
}
.coronation-modal {
  position: fixed;
  inset: 0;
  z-index: 480;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.84);
  backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.coronation-modal.hidden {
  display: none;
}

.coronation-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.coronation-dialog {
  width: min(100%, 26rem);
  padding: 1.75rem 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  background: radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--accent) 18%, #111), #0a0a0a 60%);
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7), 0 0 40px color-mix(in srgb, var(--accent-glow) 40%, transparent);
}

.coronation-eyebrow {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.coronation-crest {
  margin: 0.75rem auto 0.35rem;
  font-size: 2.4rem;
  filter: drop-shadow(0 0 16px var(--accent-glow));
}

.coronation-title {
  margin: 0;
  font-size: 1.7rem;
}

.coronation-subtitle {
  margin: 0.4rem 0 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.45;
}

.coronation-rewards {
  list-style: none;
  margin: 1.15rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.coronation-reward {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.75rem;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  text-align: start;
}

.coronation-reward-kind {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.coronation-reward-value {
  font-weight: 800;
  color: var(--text-primary);
}

.coronation-cash-slot {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 0.85rem;
  border: 1px solid color-mix(in srgb, #4ade80 45%, var(--border));
  background: linear-gradient(135deg, rgba(22, 101, 52, 0.35), rgba(6, 20, 12, 0.9));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.coronation-cash-slot.hidden {
  display: none;
}

.coronation-cash-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #86efac;
}

.coronation-cash-value {
  font-size: 1.25rem;
  color: #bbf7d0;
}

.coronation-actions {
  margin-top: 1.2rem;
}

.play-game-room.hidden {
  display: none;
}

.play-game-room-toolbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.15rem;
}

/* ── Neon Cup ── */

.neon-cup-hud {
  flex: 1 1 12rem;
  min-width: 0;
  max-width: 28rem;
  margin-inline-start: auto;
}

.neon-cup-hud.hidden {
  display: none;
}

.neon-cup-hud-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 0.25rem 0.65rem;
  align-items: center;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
}

.neon-cup-hud-copy {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.neon-cup-hud-copy strong {
  color: var(--accent);
  font-size: 0.8rem;
}

.neon-cup-hud-prize {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.7rem;
}

.neon-cup-progress-track {
  width: 100%;
  height: 0.45rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-primary) 70%, #000);
  overflow: hidden;
}

.neon-cup-progress-track--hud {
  grid-column: 1 / -1;
}

.neon-cup-progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cta-from, var(--accent)), var(--cta-to, var(--accent-dim)));
  box-shadow: 0 0 10px var(--accent-glow);
  transition: width 0.45s ease;
}

.neon-cup-progress-label {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.neon-cup-modal {
  position: fixed;
  inset: 0;
  z-index: 460;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.neon-cup-modal.hidden {
  display: none;
}

.neon-cup-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.neon-cup-modal-dialog {
  width: min(100%, 26rem);
  padding: 1.75rem 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  background: #111111;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65), 0 0 40px color-mix(in srgb, var(--accent-glow) 35%, transparent);
  transform: translateY(14px) scale(0.96);
  transition: transform 0.3s ease;
}

.neon-cup-modal.is-open .neon-cup-modal-dialog {
  transform: translateY(0) scale(1);
}

.neon-cup-chests-dialog {
  width: min(100%, 34rem);
}

.neon-cup-modal-title {
  margin: 0.75rem 0 0.35rem;
  font-size: 1.45rem;
  color: var(--text-primary);
}

.neon-cup-modal-message {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.45;
}

.neon-cup-hint {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--accent);
}

.neon-cup-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.neon-cup-vault {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  width: 5.5rem;
  height: 5.5rem;
  margin-inline: auto;
  border-radius: 1rem;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--accent) 22%, transparent), #0a0a0a 70%);
  transition: box-shadow 0.4s ease, border-color 0.4s ease, filter 0.4s ease;
}

.neon-cup-vault-lock {
  font-size: 1.6rem;
  line-height: 1;
}

.neon-cup-vault-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.neon-cup-vault--compact {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 0.65rem;
  grid-row: 1 / 2;
}

.neon-cup-vault--glow-1 {
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent-glow) 25%, transparent);
}
.neon-cup-vault--glow-2 {
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent-glow) 40%, transparent);
}
.neon-cup-vault--glow-3 {
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent-glow) 55%, transparent);
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
}
.neon-cup-vault--glow-4 {
  box-shadow: 0 0 24px color-mix(in srgb, var(--accent-glow) 70%, transparent);
  filter: saturate(1.1);
}
.neon-cup-vault--glow-5,
.neon-cup-vault--open {
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent),
    0 0 28px color-mix(in srgb, var(--accent-glow) 85%, transparent),
    0 0 48px color-mix(in srgb, var(--accent) 35%, transparent);
  animation: neon-cup-vault-pulse 1.6s ease-in-out infinite;
}

@keyframes neon-cup-vault-pulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.18);
  }
}

.neon-cup-chests-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: 1.15rem;
}

.neon-cup-chest {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.85rem;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  background: linear-gradient(160deg, #1a1408, #0c0c0c 55%);
  color: var(--text-primary);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease, opacity 0.25s ease;
}

.neon-cup-chest:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent-glow) 55%, transparent);
}

.neon-cup-chest-icon {
  font-size: 1.55rem;
  line-height: 1;
  transition: transform 0.35s ease;
}

.neon-cup-chest.is-dimmed {
  opacity: 0.45;
  filter: grayscale(0.35);
}

.neon-cup-chest.is-opening .neon-cup-chest-icon {
  transform: scale(1.2) rotate(-8deg);
}

.neon-cup-chest.is-open {
  border-color: color-mix(in srgb, var(--accent) 70%, #fff);
  box-shadow: 0 0 26px color-mix(in srgb, var(--accent-glow) 80%, transparent);
  animation: neon-cup-chest-burst 0.7s ease;
}

@keyframes neon-cup-chest-burst {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}

.neon-cup-chest-result {
  margin: 1rem 0 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent);
  text-shadow: 0 0 16px var(--accent-glow);
}

.neon-cup-chest-result.hidden {
  display: none;
}

@media (max-width: 640px) {
  .neon-cup-chests-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.4rem;
  }

  .neon-cup-chest-icon {
    font-size: 1.25rem;
  }

  .neon-cup-hud {
    max-width: none;
    flex-basis: 100%;
    margin-inline-start: 0;
  }
}

@media (max-width: 900px) {
  .play-mode-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
  }

  .play-mode-card-kicker {
    font-size: 0.62rem;
  }

  .play-mode-card-title {
    font-size: 0.88rem;
  }

  .play-mode-card-avatar,
  .play-mode-card-trophy,
  .lumina-avatar--card {
    width: 4.75rem;
    height: 4.75rem;
  }

  .play-mode-card-trophy {
    font-size: 2.25rem;
  }
}

@media (max-width: 560px) {
  .play-mode-row {
    grid-template-columns: 1fr;
  }

  .play-mode-card-top {
    min-height: 6.5rem;
  }

  .play-mode-card-avatar,
  .play-mode-card-trophy,
  .lumina-avatar--card {
    width: 5.5rem;
    height: 5.5rem;
  }
}

.play-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.play-arena {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.4rem;
  width: 100%;
  max-width: min(48rem, 100%);
  margin: 0 auto;
  padding: 0.5rem 0.75rem 0.75rem;
  background: #030712;
  color: var(--text-primary);
  box-sizing: border-box;
  min-height: min(100%, calc(100dvh - 5.5rem));
}

/* Board + Move History side-by-side (history always to the visual right) */
.play-game-layout {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: center;
  gap: clamp(0.4rem, calc(0.55rem * var(--board-scale, 1)), 0.85rem);
  width: 100%;
  direction: ltr;
  flex: 1 1 auto;
  min-height: 0;
}

.play-xp-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  width: 100%;
  padding: 0.4rem 0.55rem;
  background: rgba(17, 24, 39, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.65rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  flex-shrink: 0;
}

.play-xp-bar-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.play-xp-level {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.play-xp-track {
  flex: 1;
  height: 0.35rem;
  min-width: 3.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.play-xp-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  box-shadow: 0 0 10px var(--accent-glow);
  transition: width 0.35s ease;
}

.play-xp-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.play-xp-coins {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.play-board-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  gap: 0;
  flex: 1 1 auto;
  min-width: 0;
  margin-block: 0;
}

.play-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  width: calc(var(--board-scale, 1) * 100%);
  max-width: 100%;
  padding: 0.3rem 0.45rem 0.35rem;
  background: var(--bg-secondary);
  border: 2px solid color-mix(in srgb, var(--accent) 42%, var(--border));
  border-radius: 0.5rem;
  min-height: 2.25rem;
  order: unset !important;
  margin-left: auto;
  margin-right: auto;
  flex-shrink: 0;
  box-sizing: border-box;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent),
    0 0 14px var(--accent-glow),
    0 4px 14px rgba(0, 0, 0, 0.22);
  transition:
    width 0.2s ease,
    background-color 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease,
    color 0.3s ease;
}

.play-bar-main {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 2rem;
}

.captured-strip,
.captured-tray {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.12rem 0.2rem;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  margin: 0;
  padding: 0.2rem 0.1rem 0.05rem;
  box-sizing: border-box;
  background: transparent;
  border: none;
  border-radius: 0;
  transition: box-shadow 0.35s ease, background 0.35s ease;
}

.captured-strip.is-empty,
.captured-tray.is-empty {
  display: none;
}

.captured-strip:not(.is-empty),
.captured-tray:not(.is-empty) {
  display: flex;
  min-height: 1.4rem;
  margin-top: 0.15rem;
  padding-top: 0.25rem;
  border-top: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  transition: border-color 0.3s ease;
}

.captured-tray--flash,
.captured-card--flash,
.captured-strip.captured-tray--flash {
  background: transparent;
  box-shadow: none;
}

.captured-piece {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.3rem;
  height: 1.3rem;
  line-height: 0;
  opacity: 0.92;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}

/* Soft theme-aware glow on the user's captured pieces */
.board-player-bar--human .captured-strip .captured-piece,
.captured-strip--human .captured-piece {
  filter:
    drop-shadow(0 0 4px var(--accent-glow))
    drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 28%, transparent))
    drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3));
  transition: filter 0.3s ease;
}

.captured-piece.is-new {
  animation: captured-piece-glow 0.65s ease;
}

.captured-piece-svg {
  display: block;
  width: 100%;
  height: 100%;
}

@keyframes captured-piece-glow {
  0% {
    transform: scale(0.55);
    opacity: 0;
    filter: drop-shadow(0 0 0 rgba(251, 191, 36, 0));
  }
  45% {
    transform: scale(1.18);
    opacity: 1;
    filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.9));
  }
  100% {
    transform: scale(1);
    opacity: 0.92;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
  }
}

@keyframes captured-piece-glow-human {
  0% {
    transform: scale(0.55);
    opacity: 0;
    filter: drop-shadow(0 0 0 rgba(251, 191, 36, 0));
  }
  45% {
    transform: scale(1.18);
    opacity: 1;
    filter: drop-shadow(0 0 12px rgba(251, 191, 36, 0.95));
  }
  100% {
    transform: scale(1);
    opacity: 0.92;
    filter:
      drop-shadow(0 0 4px rgba(201, 168, 76, 0.45))
      drop-shadow(0 0 8px rgba(251, 191, 36, 0.22))
      drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3));
  }
}

.board-player-bar--human .captured-strip .captured-piece.is-new,
.captured-strip--human .captured-piece.is-new {
  animation: captured-piece-glow-human 0.65s ease;
}

.play-bar-left {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  flex: 1;
}

.play-bar-avatar,
.play-bar .board-player-avatar {
  width: 28px !important;
  height: 28px !important;
  border-width: 1px;
}

.play-bar .board-player-name {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.15;
  color: #e5e7eb;
}

.play-bar .board-player-rating {
  font-size: 0.6875rem;
  line-height: 1.15;
  color: #9ca3af;
}

.play-bar-clock {
  flex-shrink: 0;
  font-family: var(--font-mono), ui-monospace, Menlo, Consolas, monospace;
  font-size: 1.125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  min-width: 3.75rem;
  text-align: right;
  line-height: 1;
  color: #f3f4f6;
  background: #111827;
  padding: 0.3rem 0.45rem;
  border-radius: 0.25rem;
}

.play-board-host {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  overflow: hidden;
  flex-shrink: 0;
}

.play-board-frame {
  order: unset !important;
  width: calc(var(--board-scale, 1) * 100%);
  max-width: 100%;
  padding: 0 !important;
  margin-left: auto;
  margin-right: auto;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none !important;
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
  transition: width 0.2s ease;
}

.play-board {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  max-width: 100%;
  margin: 0;
  border: none;
  border-radius: 0;
  overflow: hidden;
  container-type: size;
}

.play-turn {
  margin: 0.35rem auto 0;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  line-height: 1.3;
  color: #9ca3af;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: fit-content;
  max-width: min(100%, 28rem);
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  transition:
    background 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease,
    color 0.25s ease,
    transform 0.25s ease;
}

.play-turn .status-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.play-turn.is-result {
  margin-top: 0.55rem;
  padding: 0.7rem 1.25rem;
  font-family: Syne, var(--font-sans), sans-serif;
  font-size: clamp(0.95rem, 2.4vw, 1.15rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent-secondary);
  border-color: rgba(201, 168, 76, 0.45);
  background:
    linear-gradient(180deg, rgba(201, 168, 76, 0.14), rgba(15, 23, 42, 0.75));
  box-shadow:
    0 0 0 1px rgba(201, 168, 76, 0.12) inset,
    0 8px 24px rgba(0, 0, 0, 0.35),
    0 0 28px rgba(201, 168, 76, 0.18);
  animation: play-result-banner-in 0.45s ease;
}

.play-turn.is-result #game-status-text {
  text-shadow: 0 0 18px rgba(201, 168, 76, 0.35);
}

.play-turn.is-result .status-dot {
  width: 0.55rem;
  height: 0.55rem;
  box-shadow: 0 0 10px currentColor;
}

.play-turn.is-result-win {
  color: #86efac;
  border-color: rgba(52, 211, 153, 0.45);
  background:
    linear-gradient(180deg, rgba(52, 211, 153, 0.16), rgba(15, 23, 42, 0.75));
  box-shadow:
    0 0 0 1px rgba(52, 211, 153, 0.12) inset,
    0 8px 24px rgba(0, 0, 0, 0.35),
    0 0 28px rgba(52, 211, 153, 0.18);
}

.play-turn.is-result-win #game-status-text {
  text-shadow: 0 0 18px rgba(52, 211, 153, 0.35);
}

.play-turn.is-result-loss {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.45);
  background:
    linear-gradient(180deg, rgba(248, 113, 113, 0.14), rgba(15, 23, 42, 0.75));
  box-shadow:
    0 0 0 1px rgba(248, 113, 113, 0.12) inset,
    0 8px 24px rgba(0, 0, 0, 0.35),
    0 0 28px rgba(248, 113, 113, 0.16);
}

.play-turn.is-result-loss #game-status-text {
  text-shadow: 0 0 18px rgba(248, 113, 113, 0.3);
}

.play-turn.is-result-draw {
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.35);
}

@keyframes play-result-banner-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.play-actions {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
}

/* ── Play view: Glassmorphism customization overlay ── */

.play-settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 160;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.play-settings-overlay.hidden {
  display: none;
}

.play-settings-card {
  position: relative;
  width: min(100%, 24rem);
  max-height: min(90dvh, 36rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.5rem;
  background: rgba(17, 24, 39, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.play-settings-close {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  width: 2.75rem;
  height: 2.75rem;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.play-settings-close:hover {
  color: var(--text-primary);
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.12);
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.35);
}

.play-settings-title {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-bottom: 0.35rem;
  padding-right: 2rem;
}

.play-settings-subtitle {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.play-settings-controls {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.play-settings-control-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.play-settings-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.play-settings-value {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #60a5fa;
}

.play-settings-range {
  width: 100%;
  height: 0.4rem;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  accent-color: #3b82f6;
  cursor: pointer;
  transition: box-shadow 0.2s ease, filter 0.2s ease;
}

.play-settings-range:hover,
.play-settings-range:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.22), 0 0 16px rgba(59, 130, 246, 0.45);
  filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.35));
}

.play-settings-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: #3b82f6;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.55);
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.play-settings-range:hover::-webkit-slider-thumb,
.play-settings-range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.25), 0 0 18px rgba(59, 130, 246, 0.65);
  transform: scale(1.08);
}

.play-settings-range::-moz-range-thumb {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: #3b82f6;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.55);
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.play-settings-range:hover::-moz-range-thumb,
.play-settings-range:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.25), 0 0 18px rgba(59, 130, 246, 0.65);
  transform: scale(1.08);
}

.play-settings-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.play-settings-toggle:hover {
  border-color: rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.08);
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.18);
}

.play-settings-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.play-settings-toggle-box {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 0.3rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.play-settings-toggle-box::after {
  content: '';
  width: 0.35rem;
  height: 0.6rem;
  border: solid #60a5fa;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  margin-top: -0.1rem;
  transition: transform 0.15s ease;
}

.play-settings-toggle input:checked + .play-settings-toggle-box {
  border-color: rgba(59, 130, 246, 0.65);
  background: rgba(59, 130, 246, 0.18);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.35);
}

.play-settings-toggle input:checked + .play-settings-toggle-box::after {
  transform: rotate(45deg) scale(1);
}

.play-settings-toggle-text {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.play-moves {
  display: flex;
  flex-direction: column;
  flex: 0 1 auto;
  width: clamp(6.25rem, calc(9.75rem * var(--board-scale, 1)), 11.25rem);
  max-width: min(11.25rem, 30%);
  min-width: 5.75rem;
  align-self: stretch;
  min-height: 0;
  overflow: hidden;
  background: color-mix(in srgb, var(--bg-secondary) 88%, transparent);
  border: 2px solid color-mix(in srgb, var(--accent) 42%, var(--border));
  border-radius: 0.5rem;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent),
    0 0 14px var(--accent-glow),
    0 4px 14px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-sizing: border-box;
  transition:
    width 0.2s ease,
    max-width 0.2s ease,
    background-color 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

.play-moves .panel-header {
  flex-shrink: 0;
  padding: 0.45rem 0.65rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  background: transparent;
}

.play-moves .panel-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0.35rem 0.4rem 0.45rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Subtle board coordinates */
.coord {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  font-size: 0.55rem;
  font-weight: 700;
  line-height: 1;
  opacity: 0.85;
  user-select: none;
}

.play-board .coord,
.puzzle-board .coord {
  font-size: 9cqmin;
}

.coord-file {
  right: 0.15rem;
  bottom: 0.1rem;
}

.coord-rank {
  left: 0.15rem;
  top: 0.1rem;
}

.square.light .coord {
  color: rgba(88, 64, 40, 0.75);
}

.square.dark .coord {
  color: rgba(240, 217, 181, 0.8);
}

@media (min-width: 768px) {
  .play-arena {
    max-width: min(52rem, 100%);
    padding: 0.75rem 1rem 1rem;
    gap: 0.5rem;
  }

  .play-bar {
    min-height: 2.5rem;
    padding: 0.35rem 0.55rem;
  }

  .play-bar-avatar,
  .play-bar .board-player-avatar {
    width: 32px !important;
    height: 32px !important;
  }

  .play-bar-clock {
    font-size: 1.25rem;
    min-width: 4.25rem;
  }

  .play-moves {
    width: clamp(7rem, calc(10.5rem * var(--board-scale, 1)), 12rem);
    max-width: min(12rem, 28%);
  }

  .coord {
    font-size: 0.65rem;
  }
}

/* Mobile: compact play chrome; allow vertical scroll so nothing clips */
@media (max-width: 767px) {
  .play-view {
    min-height: calc(100dvh - 4.5rem);
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  }

  .play-arena {
    height: auto;
    min-height: 0;
    max-width: 28rem;
    width: 100%;
    padding: 0.35rem 0.5rem 0.75rem;
    gap: 0.35rem;
    justify-content: flex-start;
  }

  .play-game-layout {
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
  }

  .play-board-stack {
    flex: 0 1 auto;
    width: 100%;
    max-width: 100%;
  }

  .play-board-host {
    width: 100%;
  }

  .play-board-frame {
    max-width: min(100%, calc(100dvh - 14rem));
    max-height: min(100vw - 1rem, calc(100dvh - 14rem));
    margin-inline: auto;
  }

  .play-bar {
    min-height: 2.75rem;
    padding: 0.35rem 0.5rem;
  }

  .play-bar-clock {
    font-size: 1.05rem;
    min-width: 3.4rem;
    min-height: 44px;
    padding: 0.35rem 0.45rem;
  }

  .play-moves {
    display: flex;
    width: calc(var(--board-scale, 1) * 100%);
    max-width: 100%;
    min-width: 0;
    max-height: 7.5rem;
    align-self: center;
  }

  .play-actions {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .play-actions .btn {
    flex: 1 1 calc(50% - 0.5rem);
    min-height: 44px;
    padding: 0.55rem 0.75rem;
    font-size: 0.8125rem;
  }

  .btn-play-online {
    min-height: 48px;
    width: 100%;
    max-width: 20rem;
  }

  .matchmaking-dialog {
    width: min(calc(100vw - 1.5rem), 22rem);
    max-height: min(90dvh, 34rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .matchmaking-cooldown-toast {
    top: max(0.65rem, env(safe-area-inset-top));
    width: min(calc(100% - 1rem), 26rem);
  }

  .result-modal,
  .level-up-modal,
  .promotion-modal {
    padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) max(0.75rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
    align-items: flex-end;
  }

  .result-dialog,
  .level-up-dialog,
  .promotion-dialog {
    width: min(100%, 24rem);
    max-height: min(88dvh, 36rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

.board-stage {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
  width: min(100%, 560px);
}

.board-player-bar {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.625rem 0.875rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* Unified in-game player card: identity row + embedded captured strip */
.play-bar.board-player-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0.3rem 0.45rem 0.35rem;
  background: var(--bg-secondary);
  border: 2px solid color-mix(in srgb, var(--accent) 42%, var(--border));
  border-radius: 0.5rem;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent),
    0 0 14px var(--accent-glow),
    0 4px 14px rgba(0, 0, 0, 0.22);
  transition:
    width 0.2s ease,
    background-color 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease,
    color 0.3s ease;
}

/* User card — slightly stronger glow highlight vs opponent */
.play-bar.board-player-bar--human {
  border-color: color-mix(in srgb, var(--accent) 68%, var(--border));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent),
    0 0 18px var(--accent-glow),
    0 0 32px color-mix(in srgb, var(--accent) 22%, transparent),
    0 4px 16px rgba(0, 0, 0, 0.28);
}

.play-simple .board-player-bar--opponent,
.play-simple .board-player-bar--human,
.play-simple .board-wrapper {
  order: unset;
}

.board-player-bar--opponent {
  order: 1;
}

.board-wrapper {
  order: 2;
  position: relative;
  padding: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.board-player-bar--human {
  order: 3;
}

.board-player-avatar {
  position: relative;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--border);
  background: var(--bg-elevated);
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.board-player-avatar.is-thinking {
  border-color: var(--accent);
  box-shadow:
    0 0 0 2px rgba(201, 168, 76, 0.25),
    0 0 18px rgba(201, 168, 76, 0.45);
  animation: ai-avatar-glow 1.4s ease-in-out infinite;
}

.board-player-bar--opponent.is-ai-active .board-player-name {
  color: var(--accent);
}

.ai-thinking-spinner {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-thinking-spinner.hidden {
  display: none;
}

.ai-thinking-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(var(--lumina-glow-rgb, 251, 191, 36), 0.55);
  box-shadow: 0 0 10px rgba(var(--lumina-glow-rgb, 251, 191, 36), 0.35);
  animation: ai-thinking-ring 1.8s ease-out infinite;
  opacity: 0;
}

.ai-thinking-pulse:nth-child(2) {
  animation-delay: 0.45s;
}

.ai-thinking-pulse:nth-child(3) {
  animation-delay: 0.9s;
}

.ai-thinking-spinner::after {
  content: '';
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: rgba(var(--lumina-glow-rgb, 251, 191, 36), 0.95);
  box-shadow: 0 0 10px rgba(var(--lumina-glow-rgb, 251, 191, 36), 0.85);
  animation: ai-thinking-core 1.1s ease-in-out infinite;
}

@keyframes ai-thinking-ring {
  0% {
    transform: scale(0.55);
    opacity: 0.85;
  }
  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}

@keyframes ai-thinking-core {
  0%,
  100% {
    transform: scale(0.85);
    opacity: 0.65;
  }
  50% {
    transform: scale(1.25);
    opacity: 1;
  }
}

@keyframes ai-spinner {
  to { transform: rotate(360deg); }
}

@keyframes ai-avatar-glow {
  0%, 100% {
    box-shadow:
      0 0 0 2px rgba(201, 168, 76, 0.2),
      0 0 14px rgba(201, 168, 76, 0.35);
  }
  50% {
    box-shadow:
      0 0 0 3px rgba(201, 168, 76, 0.35),
      0 0 22px rgba(201, 168, 76, 0.55);
  }
}

.board-player-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.board-player-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.board-player-name-row {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  max-width: 100%;
}

.board-player-flag {
  display: inline-flex;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 3px;
}

.board-player-flag img,
.board-player-flag .country-flag {
  width: 18px !important;
  height: 18px !important;
  object-fit: cover;
  border-radius: 3px;
  display: block;
}

.board-player-name {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-player-rating {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.board-player-bar .player-clock {
  flex-shrink: 0;
}

.board {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 3px solid var(--bg-elevated);
  transform: none;
}

.board.orientation-white,
.board[data-orientation="white"],
.board.orientation-black,
.board[data-orientation="black"] {
  transform: none;
}

.square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  user-select: none;
  cursor: pointer;
  transition: background 0.15s, filter 0.15s;
  container-type: size;
}

.play-board .square,
.puzzle-board .square {
  font-size: inherit;
}

.piece {
  cursor: grab;
  line-height: 1;
  z-index: 2;
  width: 80%;
  max-width: 80%;
  height: 80%;
  max-height: 80%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: calc(62.5cqmin * var(--piece-scale, 1));
  transform: none;
  transform-origin: center center;
  transition: font-size 0.1s, color 0.2s, -webkit-text-stroke-color 0.2s;
}

body.hide-avatars .play-bar-avatar,
body.hide-avatars .board-player-avatar {
  display: none !important;
}

body.timer-style-compact .play-bar-clock,
body.timer-style-compact .player-clock {
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.2rem 0.35rem;
  min-width: 3rem;
}

body.timer-style-bold .play-bar-clock,
body.timer-style-bold .player-clock {
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  min-width: 4.5rem;
}

/* Human pieces: hollow outline with transparent fill */
.piece-user {
  color: transparent;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke-width: var(--piece-user-stroke);
  -webkit-text-stroke-color: var(--piece-user-color);
  paint-order: stroke fill;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}

/* Opponent pieces: solid filled glyphs */
.piece-opponent {
  color: var(--piece-opponent-color);
  -webkit-text-fill-color: var(--piece-opponent-color);
  -webkit-text-stroke-width: 0;
  -webkit-text-stroke-color: transparent;
  text-shadow: var(--piece-opponent-shadow);
}

.piece:active {
  cursor: grabbing;
}

.piece.dragging {
  opacity: 0.4;
}

/* Check alert — pulsing red glow + light shake on the threatened king */
.piece.piece-in-check {
  border-radius: 50%;
  animation:
    king-check-pulse 0.9s ease-in-out infinite,
    king-check-shake 0.45s ease-in-out infinite;
  will-change: transform, box-shadow;
  z-index: 3;
}

@keyframes king-check-pulse {
  0%,
  100% {
    box-shadow:
      0 0 0 2px rgba(255, 0, 0, 0.45),
      0 0 10px 2px rgba(255, 0, 0, 0.6),
      0 0 18px rgba(255, 0, 0, 0.35);
  }
  50% {
    box-shadow:
      0 0 0 3px rgba(255, 0, 0, 0.7),
      0 0 16px 4px rgba(255, 0, 0, 0.6),
      0 0 28px rgba(255, 0, 0, 0.5);
  }
}

@keyframes king-check-shake {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  20% {
    transform: translate3d(-1.5px, 0.5px, 0);
  }
  40% {
    transform: translate3d(1.5px, -0.5px, 0);
  }
  60% {
    transform: translate3d(-1px, 0, 0);
  }
  80% {
    transform: translate3d(1px, 0.5px, 0);
  }
}

.square.in-check {
  overflow: visible;
  z-index: 3;
  background-color: rgba(255, 40, 40, 0.28) !important;
  box-shadow: inset 0 0 18px rgba(255, 0, 0, 0.35);
}

.square.selected {
  background-color: rgba(201, 168, 76, 0.55) !important;
}

.square.legal-move::after {
  content: '';
  position: absolute;
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.25);
  pointer-events: none;
  z-index: 1;
}

.square.legal-move:has(.piece)::after {
  width: 85%;
  height: 85%;
  border-radius: 50%;
  background: transparent;
  border: 4px solid rgba(0, 0, 0, 0.25);
}

/* Safe king escape squares — glowing circles while king is selected in check */
.square.king-escape {
  overflow: visible;
  z-index: 2;
}

.square.king-escape::after {
  content: '';
  position: absolute;
  width: 34%;
  height: 34%;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 70, 70, 0.95) 0%,
    rgba(255, 40, 40, 0.55) 45%,
    rgba(255, 0, 0, 0.12) 70%,
    transparent 100%
  );
  box-shadow:
    0 0 10px 3px rgba(255, 0, 0, 0.55),
    0 0 18px 6px rgba(255, 60, 60, 0.35);
  pointer-events: none;
  z-index: 1;
  animation: king-escape-glow 1.1s ease-in-out infinite;
}

.square.king-escape:has(.piece)::after {
  width: 38%;
  height: 38%;
  background: radial-gradient(
    circle,
    rgba(255, 90, 90, 1) 0%,
    rgba(255, 40, 40, 0.6) 50%,
    rgba(255, 0, 0, 0.15) 75%,
    transparent 100%
  );
  border: none;
  box-shadow:
    0 0 10px 3px rgba(255, 0, 0, 0.6),
    0 0 18px 6px rgba(255, 60, 60, 0.4);
}

@keyframes king-escape-glow {
  0%,
  100% {
    opacity: 0.75;
    transform: scale(0.92);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  .piece.piece-in-check,
  .square.king-escape::after {
    animation: none;
  }

  .piece.piece-in-check {
    box-shadow:
      0 0 0 3px rgba(255, 0, 0, 0.7),
      0 0 14px 4px rgba(255, 0, 0, 0.6);
  }
}

.square.drag-over {
  filter: brightness(1.15);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.square.light {
  background-color: var(--bg-board-light);
}

.square.dark {
  background-color: var(--bg-board-dark);
}

.square:hover {
  filter: brightness(1.08);
}

.square.highlight {
  background-color: rgba(201, 168, 76, 0.45) !important;
}

.square.last-move {
  background-color: rgba(255, 255, 100, 0.3) !important;
}

.board-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.board.board-locked {
  pointer-events: none;
}

.board.board-locked .piece {
  cursor: default;
}

.ai-error-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid rgba(220, 38, 38, 0.35);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-primary);
}

.ai-error-banner.hidden {
  display: none;
}

.ai-error-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.game-avatar-root {
  min-height: 7.5rem;
  margin-bottom: 0.75rem;
}

.game-avatar-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

.game-avatar-faces {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 5.5rem;
}

.game-avatar-faces.is-duel {
  gap: 0.5rem;
}

.game-avatar-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.game-avatar-face img {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: #111827;
  box-shadow: 0 6px 16px rgb(15 23 42 / 0.18);
}

.game-avatar-caption {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  max-width: 6.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-avatar-vs {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent);
  padding: 0 0.25rem;
}

.game-avatar-message {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin: 0;
  max-width: 22rem;
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.35;
  color: var(--text-primary);
  text-align: center;
}

.game-avatar-panel[data-state='notFound'] .game-avatar-message,
.game-avatar-panel[data-state='defeat'] .game-avatar-message,
.game-avatar-panel[data-state='penalty'] .game-avatar-message {
  color: color-mix(in srgb, var(--danger, #ef4444) 80%, var(--text-primary));
}

.game-avatar-panel[data-state='victory'] .game-avatar-message {
  color: color-mix(in srgb, var(--success, #22c55e) 75%, var(--text-primary));
}

.game-avatar-spinner {
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
  animation: online-spin 0.7s linear infinite;
}

.game-avatar-timer {
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}

.online-lobby-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.online-lobby-preview-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 12px rgb(15 23 42 / 0.2);
  border: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
}

.matchmaking-cooldown-toast {
  position: fixed;
  top: 0.85rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: min(calc(100% - 1.5rem), 26rem);
  padding: 0.7rem 0.75rem 0.7rem 0.9rem;
  border-radius: 0.85rem;
  border: 1px solid color-mix(in srgb, #f59e0b 45%, var(--border));
  background: color-mix(in srgb, var(--bg-elevated, #1e293b) 92%, #78350f);
  box-shadow: 0 10px 28px rgb(15 23 42 / 0.35);
  color: var(--text-primary);
  pointer-events: auto;
  animation: cooldown-toast-in 0.28s ease;
}

.matchmaking-cooldown-toast.hidden {
  display: none;
}

.matchmaking-cooldown-toast-icon {
  flex-shrink: 0;
  font-size: 1.1rem;
  line-height: 1;
}

.matchmaking-cooldown-toast-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}

.matchmaking-cooldown-toast-title {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.matchmaking-cooldown-toast-msg {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.35;
}

#matchmaking-cooldown-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: #fbbf24;
}

.matchmaking-cooldown-toast-dismiss {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border: none;
  border-radius: 0.45rem;
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.matchmaking-cooldown-toast-dismiss:hover {
  background: color-mix(in srgb, var(--bg-primary) 40%, transparent);
  color: var(--text-primary);
}

@keyframes cooldown-toast-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.matchmaking-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.matchmaking-modal.hidden {
  display: none;
}

.matchmaking-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(15 23 42 / 0.55);
  backdrop-filter: blur(2px);
}

.matchmaking-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 22rem);
  padding: 1.25rem 1.35rem 1.1rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: var(--bg-elevated, var(--bg-secondary));
  box-shadow: 0 20px 40px rgb(15 23 42 / 0.35);
  text-align: center;
  animation: matchmaking-pop 0.28s ease;
}

@keyframes matchmaking-pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.matchmaking-modal-title {
  margin: 0 0 0.85rem;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.matchmaking-modal-actions {
  display: flex;
  justify-content: center;
  margin-top: 0.85rem;
}

.btn-play-online.is-penalized {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.25);
  transform: none !important;
  box-shadow: none;
}

.online-lobby {
  margin: 0.75rem 0 0.25rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--bg-elevated) 85%, transparent);
  text-align: center;
}

.online-lobby-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1rem;
}

.btn-play-online {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0 auto;
  padding: 0.85rem 1.85rem;
  border: none;
  border-radius: 0.85rem;
  background: linear-gradient(135deg, #9333ea 0%, #3b82f6 100%);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  cursor: pointer;
  box-shadow:
    0 10px 15px -3px rgb(59 130 246 / 0.5),
    0 4px 6px -4px rgb(59 130 246 / 0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  will-change: transform;
}

.btn-play-online-icon {
  flex-shrink: 0;
  display: block;
}

.btn-play-online:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow:
    0 14px 22px -4px rgb(59 130 246 / 0.55),
    0 6px 10px -4px rgb(147 51 234 / 0.4);
  filter: brightness(1.05);
}

.btn-play-online:active:not(:disabled) {
  transform: scale(0.95);
  box-shadow:
    0 6px 10px -3px rgb(59 130 246 / 0.4),
    0 2px 4px -2px rgb(59 130 246 / 0.35);
}

.btn-play-online:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 3px;
}

.btn-play-online:disabled {
  cursor: not-allowed;
  opacity: 0.7;
  transform: none;
}

.online-join {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.4rem 0.5rem;
  flex: 1 1 12rem;
}

.online-join-label {
  width: 100%;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.online-room-input {
  flex: 1 1 6rem;
  min-width: 5.5rem;
  max-width: 9rem;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.online-lobby-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 1rem 0 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.online-search-spinner {
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
  animation: online-spin 0.7s linear infinite;
}

.online-lobby.is-searching #btn-play-online {
  pointer-events: none;
  opacity: 0.65;
}

.play-view.is-online-mode #chess-bot-picker-play {
  display: none !important;
}

@keyframes online-spin {
  to {
    transform: rotate(360deg);
  }
}

.online-wallet {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
}

.game-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
}

.status-dot.is-pulsing {
  background: var(--accent);
  animation: pulse 1s infinite;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.game-controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* ── Move List (side panel) ── */

.move-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.35;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  padding-inline-end: 0.15rem;
}

.move-list:hover,
.move-list:focus-within {
  scrollbar-color: color-mix(in srgb, var(--accent) 45%, var(--border)) transparent;
}

.move-list::-webkit-scrollbar {
  width: 5px;
}

.move-list::-webkit-scrollbar-track {
  background: transparent;
}

.move-list::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 999px;
}

.move-list:hover::-webkit-scrollbar-thumb,
.move-list:focus-within::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.move-row {
  display: grid;
  grid-template-columns: 1.75rem minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.3rem;
  align-items: baseline;
  padding: 0.28rem 0.2rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border-subtle) 90%, transparent);
}

.move-row:last-child {
  border-bottom: none;
}

.move-number {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.72rem;
}

.move-white,
.move-black {
  color: var(--text-secondary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.move-black.current,
.move-white.current {
  color: var(--accent);
  font-weight: 700;
}

.move-empty {
  color: var(--text-muted);
  font-size: 0.78rem;
  text-align: center;
  padding: 1rem 0.35rem;
  margin: 0;
}

/* ── Promotion Modal ── */

.promotion-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(17, 17, 17, 0.88);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.promotion-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.promotion-modal.hidden {
  display: none;
}

.promotion-modal:not(.hidden) {
  display: flex;
}

.promotion-dialog {
  width: min(100%, 22rem);
  background: #1a1a1a;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.25rem;
  text-align: center;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  transform: translateY(14px) scale(0.96);
  transition: transform 0.25s ease;
}

.promotion-modal.is-open .promotion-dialog {
  transform: translateY(0) scale(1);
}

.promotion-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.promotion-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.promotion-pieces {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.promotion-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 4.5rem;
  padding: 0.5rem 0.25rem;
  background: #111111;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.promotion-btn .promotion-piece {
  width: auto;
  max-width: none;
  height: auto;
  max-height: none;
  display: inline-block;
  font-size: clamp(1.75rem, 6vw, 2.25rem);
  line-height: 1;
  cursor: pointer;
}

.promotion-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.promotion-btn:hover,
.promotion-btn:focus-visible {
  background: var(--bg-elevated);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 0 16px var(--accent-glow);
  outline: none;
}

.promotion-btn:hover .promotion-label,
.promotion-btn:focus-visible .promotion-label {
  color: var(--accent);
}

@media (max-width: 480px) {
  .promotion-pieces {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.625rem;
  }

  .promotion-btn {
    min-height: 5rem;
    padding: 0.75rem 0.5rem;
  }

  .promotion-label {
    font-size: 0.7rem;
  }
}

/* ── Match Analysis Modal (Recent Matches coach) ── */

.match-analysis-modal {
  position: fixed;
  inset: 0;
  z-index: 420;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(3, 7, 18, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.match-analysis-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.match-analysis-modal.hidden {
  display: none;
}

.match-analysis-modal:not(.hidden) {
  display: flex;
}

.match-analysis-dialog {
  position: relative;
  width: min(100%, 26rem);
  max-height: min(92dvh, 40rem);
  overflow: auto;
  padding: 1.25rem 1.2rem 1.15rem;
  background: color-mix(in srgb, var(--bg-secondary) 92%, transparent);
  border: 2px solid color-mix(in srgb, var(--accent) 48%, var(--border));
  border-radius: 1rem;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 14%, transparent),
    0 0 28px var(--accent-glow),
    0 18px 40px rgba(0, 0, 0, 0.45);
  transform: translateY(10px) scale(0.98);
  transition: transform 0.28s ease;
}

.match-analysis-modal.is-open .match-analysis-dialog {
  transform: translateY(0) scale(1);
}

.match-analysis-close {
  position: absolute;
  top: 0.55rem;
  inset-inline-end: 0.65rem;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.match-analysis-close:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.match-analysis-eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.match-analysis-title {
  margin: 0 0 0.85rem;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.match-analysis-board-wrap {
  width: min(100%, 18rem);
  margin: 0 auto 0.65rem;
}

.match-analysis-board-frame {
  width: 100%;
  max-width: 100%;
  padding: 0 !important;
  margin: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none !important;
  position: relative;
  overflow: visible;
}

.match-analysis-board-frame .analysis-board {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 2px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  border-radius: var(--radius-sm);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent),
    0 0 18px var(--accent-glow);
  position: relative;
  overflow: hidden;
  pointer-events: none;
}

.board.play-board {
  position: relative;
}

.board-arrow-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 6;
}

.match-analysis-hint {
  margin: 0 0 0.85rem;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.match-analysis-summary-card {
  padding: 0.85rem 0.9rem;
  margin-bottom: 1rem;
  border-radius: 0.75rem;
  background: rgba(2, 6, 23, 0.45);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}

.match-analysis-summary-label {
  margin: 0 0 0.35rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.match-analysis-summary {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--text-primary);
}

.match-analysis-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: center;
}

.match-analysis-modal[data-result="win"] .match-analysis-eyebrow {
  color: #4ade80;
}

.match-analysis-modal[data-result="loss"] .match-analysis-eyebrow {
  color: #f87171;
}

.match-analysis-modal[data-result="draw"] .match-analysis-eyebrow {
  color: #94a3b8;
}

/* ── Game Result Modal ── */

.result-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(17, 17, 17, 0.92);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.result-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.result-modal.hidden {
  display: none;
}

.result-modal:not(.hidden) {
  display: flex;
}

.result-dialog {
  position: relative;
  width: min(100%, 24rem);
  background: #111111;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 1.75rem;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
  transform: translateY(18px) scale(0.94);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.3, 1), opacity 0.3s ease;
  overflow: visible;
}

.result-modal.is-open .result-dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.result-avatar-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.result-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 6.5rem;
  height: 6.5rem;
  border-radius: 50%;
  font-size: 3.25rem;
  line-height: 1;
  background: var(--bg-elevated);
  border: 3px solid var(--border);
  animation: result-pop 0.45s cubic-bezier(0.2, 0.8, 0.3, 1) 0.1s both;
}

.result-avatar img,
.result-avatar video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* State-based accent colors */
.result-modal[data-result="win"] .result-avatar {
  border-color: var(--accent);
  box-shadow: 0 0 28px var(--accent-glow);
}

.result-modal[data-result="loss"] .result-avatar {
  border-color: var(--danger);
  box-shadow: 0 0 28px rgba(229, 57, 53, 0.35);
}

.result-modal[data-result="draw"] .result-avatar {
  border-color: var(--text-muted);
}

.result-title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.result-modal[data-result="win"] .result-title {
  color: var(--accent);
}

.result-modal[data-result="loss"] .result-title {
  color: var(--danger);
}

.result-message {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 1.75rem;
}

.result-rank-points {
  margin: -1rem 0 1.25rem;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--accent-secondary, var(--accent));
  text-shadow: 0 0 18px var(--accent-glow);
  opacity: 0;
  transform: translateY(8px) scale(0.92);
  transition:
    opacity 0.35s ease,
    transform 0.45s ease;
}

.result-rank-points.is-pop {
  opacity: 1;
  transform: translateY(0) scale(1);
  animation: result-points-float 1.8s ease-in-out 1;
}

.result-rank-points.hidden {
  display: none;
}

@keyframes result-points-float {
  0% {
    transform: translateY(6px) scale(0.9);
    opacity: 0;
  }
  25% {
    transform: translateY(0) scale(1.08);
    opacity: 1;
  }
  70% {
    transform: translateY(-4px) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(-10px) scale(1);
    opacity: 0.92;
  }
}

.rank-points-burst {
  position: absolute;
  left: 50%;
  top: 0.35rem;
  z-index: 6;
  transform: translate(-50%, 8px);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--cta-text, #09090b);
  background: linear-gradient(135deg, var(--cta-from, var(--accent)), var(--cta-to, var(--accent-dim)));
  box-shadow: 0 0 20px var(--accent-glow);
  pointer-events: none;
  opacity: 0;
  transition:
    opacity 0.25s ease,
    transform 0.9s ease;
}

.rank-points-burst.is-visible {
  opacity: 1;
  transform: translate(-50%, -1.25rem);
}

.rank-points-burst.is-done {
  opacity: 0;
  transform: translate(-50%, -2.25rem);
}

.nav-user-points {
  display: inline-flex;
  align-items: center;
  margin-inline-start: 0.15rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--cta-text, #09090b);
  background: color-mix(in srgb, var(--accent) 85%, transparent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.nav-user-points[hidden] {
  display: none !important;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.result-actions .btn {
  width: 100%;
}

/* ── Level Up Modal ── */

.level-up-modal {
  position: fixed;
  inset: 0;
  z-index: 450;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.level-up-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.level-up-modal.hidden {
  display: none;
}

.level-up-modal:not(.hidden) {
  display: flex;
}

.level-up-dialog {
  position: relative;
  width: min(100%, 22rem);
  padding: 2rem 1.75rem 1.5rem;
  text-align: center;
  background: rgba(17, 24, 39, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1rem;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.65),
    0 0 48px rgba(201, 168, 76, 0.22);
  transform: translateY(20px) scale(0.92);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.3, 1), opacity 0.35s ease;
  overflow: hidden;
}

.level-up-modal.is-open .level-up-dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.level-up-glow {
  position: absolute;
  inset: -40%;
  background: radial-gradient(circle at center, rgba(201, 168, 76, 0.35), transparent 65%);
  animation: level-up-glow-pulse 2.4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes level-up-glow-pulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}

.level-up-avatar-wrap {
  position: relative;
  z-index: 1;
  margin-bottom: 0.75rem;
}

.level-up-avatar {
  width: 4.5rem;
  height: 4.5rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.25rem;
  border-radius: 50%;
  background: rgba(201, 168, 76, 0.15);
  border: 2px solid rgba(201, 168, 76, 0.55);
  box-shadow: 0 0 28px rgba(201, 168, 76, 0.45);
  animation: level-up-avatar-pop 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes level-up-avatar-pop {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.12); }
  100% { transform: scale(1); opacity: 1; }
}

.level-up-title {
  position: relative;
  z-index: 1;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  text-shadow: 0 0 18px var(--accent-glow);
  margin-bottom: 0.35rem;
}

.level-up-level {
  position: relative;
  z-index: 1;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.level-up-xp {
  position: relative;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: #60a5fa;
  margin-bottom: 0.5rem;
}

.level-up-message {
  position: relative;
  z-index: 1;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.level-up-badges {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.level-up-badges.hidden,
.level-up-level.hidden,
.level-up-xp.hidden {
  display: none !important;
}

.level-up-badge-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  background: rgba(201, 168, 76, 0.12);
  border: 1px solid rgba(201, 168, 76, 0.35);
  box-shadow: 0 0 14px rgba(201, 168, 76, 0.2);
}

.level-up-badge-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.level-up-badge-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-secondary);
}

.level-up-btn {
  position: relative;
  z-index: 1;
  width: 100%;
}

/* ── Badges grid (dashboard) ── */

.badge-section-desc {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.badge-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.65rem 0.45rem;
  border-radius: 0.65rem;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.badge-cell--earned {
  border-color: rgba(201, 168, 76, 0.4);
  background: rgba(201, 168, 76, 0.08);
  box-shadow: 0 0 12px rgba(201, 168, 76, 0.15);
}

.badge-cell--locked {
  opacity: 0.45;
  filter: grayscale(0.85);
}

.badge-cell-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.badge-cell-name {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.badge-cell-threshold {
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.badge-cell-earned {
  position: absolute;
  top: 0.3rem;
  right: 0.35rem;
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--accent);
}

/* ── Avatar customizer (DiceBear) ── */

.settings-section--avatar {
  padding-bottom: 0.25rem;
}

.avatar-customizer {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.avatar-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  padding: 0.25rem;
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.avatar-mode-tab {
  border: 0;
  border-radius: 0.55rem;
  padding: 0.55rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  color: #94a3b8;
  background: transparent;
  transition: background 0.2s ease, color 0.2s ease;
}

.avatar-mode-tab.is-active {
  color: #111827;
  background: linear-gradient(135deg, #e8d48a, #c9a84c);
}

.avatar-preset-panel,
.avatar-upload-panel {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.avatar-upload-hint {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text-muted, #94a3b8);
}

.avatar-upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.avatar-upload-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  overflow: hidden;
}

.avatar-upload-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

.avatar-upload-status {
  margin: 0;
  font-size: 0.8rem;
  color: #86efac;
}

.avatar-upload-status.is-error {
  color: #fca5a5;
}

.avatar-preview-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(17, 24, 39, 0.55);
  overflow: hidden;
}

.avatar-preview-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(201, 168, 76, 0.2), transparent 70%);
  pointer-events: none;
}

.avatar-preview-img {
  position: relative;
  z-index: 1;
  width: 7.5rem;
  height: 7.5rem;
  border-radius: 50%;
  border: 2px solid rgba(201, 168, 76, 0.45);
  box-shadow: 0 0 24px rgba(201, 168, 76, 0.25);
  background: #111827;
  object-fit: cover;
}

.avatar-control {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.avatar-control-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.avatar-opt-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.avatar-opt-row--hair,
.avatar-opt-row--glasses {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.avatar-opt {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-height: 2.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, color 0.15s;
}

.avatar-opt:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.avatar-opt.active {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.avatar-opt-swatch {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.avatar-opt-row--skin .avatar-opt {
  flex: 1;
  min-width: 3.5rem;
}

.avatar-opt-label {
  line-height: 1.2;
  text-align: center;
}

.avatar-customizer-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.avatar-save-status {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
}

.avatar-save-status.hidden {
  display: none !important;
}

/* ── Chess bot picker ── */

.chess-bot-picker-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.45;
}

.chess-bot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.chess-bot-picker--compact .chess-bot-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.chess-bot-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.55rem 0.4rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.chess-bot-option:hover {
  border-color: var(--accent);
}

.chess-bot-option.active {
  border-color: var(--accent);
  background: rgba(201, 168, 76, 0.1);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.chess-bot-option-img {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: none;
  background: transparent;
  object-fit: contain;
}

.chess-bot-option-avatar {
  width: 2.5rem;
  height: 2.5rem;
  --lumina-glow-rgb: 251, 191, 36;
}

.chess-bot-option[data-glow='aggressive'] .chess-bot-option-avatar {
  --lumina-glow-rgb: 234, 88, 12;
}

.chess-bot-option[data-glow='tactical'] .chess-bot-option-avatar {
  --lumina-glow-rgb: 251, 191, 36;
}

.chess-bot-option[data-glow='expert'] .chess-bot-option-avatar {
  --lumina-glow-rgb: 248, 250, 252;
}

.chess-bot-option[data-glow='defensive'] .chess-bot-option-avatar {
  --lumina-glow-rgb: 59, 130, 246;
}

.chess-bot-option-avatar.lumina-avatar--picker::before {
  inset: -18%;
}

.chess-bot-picker--compact .chess-bot-option-img,
.chess-bot-picker--compact .chess-bot-option-avatar {
  width: 2rem;
  height: 2rem;
}

.chess-bot-option-name {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.chess-bot-picker--compact .chess-bot-option-name {
  font-size: 0.58rem;
}

.chess-bot-option-meta {
  font-size: 0.52rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  max-width: 100%;
  padding: 0 0.15rem;
}

.play-settings-control--bots .chess-bot-grid {
  margin-top: 0.35rem;
}

@keyframes result-pop {
  0% {
    transform: scale(0.4);
    opacity: 0;
  }
  70% {
    transform: scale(1.08);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}

@media (max-width: 480px) {
  .result-dialog {
    padding: 1.5rem 1.25rem;
  }

  .result-avatar {
    width: 5.5rem;
    height: 5.5rem;
    font-size: 2.75rem;
  }

  .result-title {
    font-size: 1.35rem;
  }
}

/* ── Language Switcher ── */

.language-switcher {
  appearance: none;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 2rem 0.45rem 0.75rem;
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a0a0a0' d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  min-width: 8.5rem;
}

.language-switcher:hover,
.language-switcher:focus {
  border-color: var(--text-muted);
  outline: none;
}

.language-switcher:focus-visible {
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.language-switcher--settings {
  width: 100%;
  max-width: 20rem;
}

.language-switcher--mobile {
  width: 100%;
  margin: 0.25rem 0 0.5rem;
}

.mobile-nav-language {
  display: block;
  padding: 0.5rem 1rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── RTL Support ── */

html[dir="rtl"] .header-inner {
  direction: rtl;
}

html[dir="rtl"] .header-start {
  flex-direction: row-reverse;
}

html[dir="rtl"] .header-end {
  flex-direction: row-reverse;
}

html[dir="rtl"] .header-actions {
  flex-direction: row-reverse;
}

html[dir="rtl"] .language-switcher {
  background-position: left 0.6rem center;
  padding: 0.45rem 0.75rem 0.45rem 2rem;
}

html[dir="rtl"] .panel-header-row,
html[dir="rtl"] .board-player-bar,
html[dir="rtl"] .game-controls,
html[dir="rtl"] .settings-header,
html[dir="rtl"] .result-actions {
  flex-direction: row-reverse;
}

html[dir="rtl"] .move-list,
html[dir="rtl"] .move-row,
html[dir="rtl"] .player-clock,
html[dir="rtl"] .board {
  direction: ltr;
}

html[dir="rtl"] .settings-close {
  margin-inline-start: auto;
  margin-inline-end: 0;
}

/* ── View switching ── */

.view-hidden {
  display: none !important;
}

/* ── Progress HUD ── */

.progress-hud {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.35rem 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-width: 0;
}

.progress-hud-coins {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.progress-hud-coins-icon {
  font-size: 1.1rem;
}

.progress-hud-streak {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.progress-hud-streak-icon {
  font-size: 1.1rem;
}

.progress-hud-xp {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 7rem;
  flex: 1;
}

.progress-hud-xp-track {
  height: 6px;
  background: var(--bg-primary);
  border-radius: 999px;
  overflow: hidden;
}

.progress-hud-xp-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #e8c96a);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.progress-hud-xp-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.progress-hud-level {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

/* ── Learning Path ── */

.path-screen {
  max-width: 1040px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.path-hero {
  text-align: center;
  margin-bottom: 2.5rem;
}

.path-hero-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.path-hero-desc {
  color: var(--text-secondary);
  max-width: 32rem;
  margin: 0 auto;
}

.path-unit {
  margin-bottom: 3rem;
}

.path-unit-header {
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.path-unit-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
}

.path-unit-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.path-track {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.path-node {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: min(100%, 320px);
  padding: 0.85rem 1rem;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  cursor: pointer;
  text-align: start;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.path-node--left {
  align-self: flex-start;
  margin-inline-start: 0;
}

.path-node--right {
  align-self: flex-end;
  margin-inline-end: 0;
}

.path-node--current {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.path-node--completed {
  border-color: var(--success);
  background: linear-gradient(135deg, var(--bg-secondary), rgba(76, 175, 80, 0.08));
}

.path-node--locked {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

.path-node:not(:disabled):hover {
  border-color: var(--accent);
}

.path-node-icon {
  font-size: 1.75rem;
  line-height: 1;
  flex-shrink: 0;
}

.path-node-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
  min-width: 0;
}

.path-node-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.path-node-xp {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
}

.path-node-status {
  font-size: 1rem;
  flex-shrink: 0;
}

.path-connector {
  width: 4px;
  height: 2rem;
  background: var(--border);
  border-radius: 2px;
}

.path-connector--done {
  background: linear-gradient(180deg, var(--success), var(--accent));
}

/* ── Global summary ── */

.path-summary {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  max-width: 32rem;
  margin: 1.25rem auto 0;
}

.path-summary-counter {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

/* ── Path layout: navigator + main ── */

.path-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: 1.75rem;
  align-items: start;
}

/* Section navigator (sidebar on desktop) */
.path-nav {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  position: sticky;
  top: 1rem;
}

.path-nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 0.85rem;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  cursor: pointer;
  text-align: start;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s, background 0.2s;
}

.path-nav-item:not(:disabled):hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.path-nav-item--active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: linear-gradient(135deg, var(--bg-secondary), color-mix(in srgb, var(--accent) 10%, transparent));
}

.path-nav-item--done {
  border-color: var(--success);
}

.path-nav-item--locked {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

.path-nav-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
}

.path-nav-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-width: 0;
}

.path-nav-step {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.path-nav-title {
  font-weight: 700;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.path-nav-mini {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.path-nav-mini-track {
  flex: 1;
  height: 5px;
  background: var(--bg-primary);
  border-radius: 999px;
  overflow: hidden;
}

.path-nav-mini-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  border-radius: 999px;
  transition: width 0.4s ease;
}

.path-nav-count {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Main area */
.path-main {
  min-width: 0;
}

.path-main--enter {
  animation: path-main-enter 0.35s ease;
}

@keyframes path-main-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.path-main-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.path-main-heading {
  min-width: 0;
}

.path-main-tier {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  margin-bottom: 0.4rem;
}

.path-main-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
}

.path-main-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.3rem;
}

.path-main-progress {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 150px;
  flex: 1 1 150px;
  max-width: 240px;
}

.path-main-progress-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.path-main-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  border-radius: 999px;
  transition: width 0.5s ease;
}

.path-main-progress-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Unit grid */
.path-unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.85rem;
}

.path-unit-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 1rem 0.85rem 0.9rem;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  cursor: pointer;
  text-align: center;
  justify-content: center;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.path-unit-card:not(:disabled):hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.path-unit-card--current {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.path-unit-card--completed {
  border-color: var(--success);
  background: linear-gradient(135deg, var(--bg-secondary), rgba(76, 175, 80, 0.08));
}

.path-unit-card--locked {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.45);
}

.path-unit-card--boss {
  background: linear-gradient(135deg, rgba(178, 60, 60, 0.16), var(--bg-secondary));
  border-color: var(--danger);
}

.path-unit-card--boss.path-unit-card--completed {
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.14), var(--bg-secondary));
  border-color: var(--success);
}

.path-unit-card--boss:not(:disabled):hover {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(178, 60, 60, 0.25);
}

.path-unit-status {
  position: absolute;
  top: 0.55rem;
  inset-inline-end: 0.6rem;
  font-size: 0.9rem;
  line-height: 1;
}

.path-unit-icon {
  font-size: 2rem;
  line-height: 1;
}

.path-unit-type {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.path-unit-card--boss .path-unit-type {
  color: var(--danger);
}

.path-unit-title {
  font-weight: 600;
  font-size: 0.82rem;
  line-height: 1.2;
}

.path-unit-reward {
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 600;
}

/* ── Responsive: mobile carousel navigator ── */

@media (max-width: 768px) {
  .path-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .path-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    gap: 0.6rem;
    padding-bottom: 0.5rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  .path-nav-item {
    flex: 0 0 auto;
    width: 180px;
    scroll-snap-align: start;
  }

  .path-main-head {
    align-items: flex-start;
  }

  .path-unit-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.6rem;
  }

  .path-unit-card {
    padding: 0.85rem 0.6rem;
  }
}

@media (max-width: 420px) {
  .path-unit-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Puzzle Engine UI ── */

.puzzle-launcher {
  margin-bottom: 2.5rem;
}

.puzzle-launcher-title {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.puzzle-launcher-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.puzzle-launcher-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}

.puzzle-launcher-card:hover {
  border-color: var(--accent);
}

.puzzle-launcher-icon {
  font-size: 2rem;
}

.puzzle-launcher-name {
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
}

.puzzle-player {
  position: relative;
  max-width: 28rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.lesson-stage {
  width: 100%;
  margin-bottom: 1rem;
}

.lesson-stage-instruction {
  margin-bottom: 0;
}

.lesson-stage-avatar .avatar-mentor-bubble {
  max-width: 18rem;
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
}

/* ── Feedback & Reward pop-up (AvatarFeedback — no emoji icons) ── */

.lesson-feedback-mount {
  position: static;
}

.lesson-feedback {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  background: rgba(8, 10, 16, 0.55);
  backdrop-filter: blur(3px);
}

.lesson-feedback.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.lesson-feedback-card {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  width: min(90%, 20rem);
  padding: 1.4rem 1.5rem;
  background: linear-gradient(150deg, var(--bg-elevated), var(--bg-secondary));
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.lesson-feedback[data-status='error'] .lesson-feedback-card {
  border-color: var(--accent);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4), 0 0 22px var(--accent-glow);
}

.lesson-feedback[data-status='success'] .lesson-feedback-card {
  border-color: var(--success);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.5), 0 0 30px rgba(76, 175, 80, 0.45);
}

.lesson-feedback-avatar {
  width: 6rem;
  height: 6rem;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--border);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lesson-feedback[data-status='error'] .lesson-feedback-avatar {
  border-color: var(--accent);
  box-shadow: 0 0 18px var(--accent-glow);
}

.lesson-feedback[data-status='success'] .lesson-feedback-avatar {
  border-color: var(--success);
  box-shadow: 0 0 18px rgba(76, 175, 80, 0.45);
}

.avatar-feedback-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.lesson-feedback-message {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.lesson-feedback-attempts {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.lesson-feedback-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

/* Pop / bounce-in for the card each time it appears */
.lesson-feedback.lf-pop .lesson-feedback-card {
  animation: lesson-feedback-pop 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lesson-feedback.lf-pop .lesson-feedback-avatar {
  animation: lesson-feedback-avatar-pop 0.55s ease;
}

@keyframes lesson-feedback-pop {
  0% {
    opacity: 0;
    transform: scale(0.82) translateY(-12px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes lesson-feedback-avatar-pop {
  0%,
  100% {
    transform: scale(1) rotate(0);
  }
  35% {
    transform: scale(1.12) rotate(-6deg);
  }
  65% {
    transform: scale(1.08) rotate(6deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .lesson-feedback.lf-pop .lesson-feedback-card,
  .lesson-feedback.lf-pop .lesson-feedback-avatar {
    animation: none;
  }
}

.puzzle-player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.puzzle-player-meta {
  text-align: center;
  flex: 1;
}

.puzzle-lesson-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.puzzle-progress {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.puzzle-instruction {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}

.puzzle-player-actions {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin: 0;
}

.puzzle-board-wrap {
  position: relative;
  width: min(100%, calc(400px * var(--board-scale, 1)));
  max-width: 400px;
  margin: 0 auto;
  overflow: hidden;
}

.puzzle-board {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  container-type: size;
}

.puzzle-marker {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Targets are intentionally enlarged so goal squares stand out */
  font-size: 2.25rem;
  pointer-events: none;
  z-index: 1;
}

.puzzle-marker--star {
  color: var(--accent);
  text-shadow: 0 0 16px var(--accent-glow);
  animation: puzzle-star-pulse 1.6s ease-in-out infinite;
}

@keyframes puzzle-star-pulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.15); opacity: 1; }
}

/* ── Path progress bar ── */

.path-progress {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 32rem;
  margin: 1.25rem auto 0;
}

.path-progress-track {
  flex: 1;
  height: 10px;
  background: var(--bg-elevated);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.path-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  border-radius: 999px;
  transition: width 0.5s ease;
}

.path-progress-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ── Anime Avatar Mentor ── */

.avatar-mentor {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  min-height: 0;
}

.avatar-mentor-face {
  font-size: 2.5rem;
  line-height: 1;
  width: 4.5rem;
  height: 4.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  overflow: hidden;
  margin: 0 auto;
  transition: border-color 0.3s, background 0.3s, box-shadow 0.3s;
}

.avatar-mentor-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.avatar-mentor-bubble {
  max-width: 22rem;
  padding: 0.5rem 0.85rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  color: var(--text-primary);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.avatar-mentor-bubble.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* State-driven expressions */
.avatar-mentor[data-state="success"] .avatar-mentor-face,
.avatar-mentor[data-state="happy"] .avatar-mentor-face {
  border-color: var(--success);
  box-shadow: 0 0 18px rgba(76, 175, 80, 0.4);
}

.avatar-mentor[data-state="sad"] .avatar-mentor-face,
.avatar-mentor[data-state="confused"] .avatar-mentor-face {
  border-color: var(--danger);
  box-shadow: 0 0 18px rgba(229, 57, 53, 0.35);
}

.avatar-mentor[data-state="hint"] .avatar-mentor-face,
.avatar-mentor[data-state="thinking"] .avatar-mentor-face {
  border-color: var(--accent);
  box-shadow: 0 0 18px var(--accent-glow);
}

/* Animations retriggered by AvatarMentor via .avatar--animate */
.avatar-mentor.avatar--animate[data-state="success"] .avatar-mentor-face,
.avatar-mentor.avatar--animate[data-state="happy"] .avatar-mentor-face {
  animation: avatar-joy 0.6s ease;
}

.avatar-mentor.avatar--animate[data-state="sad"] .avatar-mentor-face,
.avatar-mentor.avatar--animate[data-state="confused"] .avatar-mentor-face {
  animation: avatar-shake 0.5s ease;
}

.avatar-mentor.avatar--animate[data-state="hint"] .avatar-mentor-face,
.avatar-mentor.avatar--animate[data-state="thinking"] .avatar-mentor-face {
  animation: avatar-nudge 0.6s ease;
}

@keyframes avatar-joy {
  0%, 100% { transform: translateY(0) scale(1) rotate(0); }
  30% { transform: translateY(-10px) scale(1.12) rotate(-6deg); }
  60% { transform: translateY(0) scale(1.08) rotate(6deg); }
}

@keyframes avatar-shake {
  0%, 100% { transform: translateX(0) rotate(0); }
  20% { transform: translateX(-8px) rotate(-4deg); }
  40% { transform: translateX(8px) rotate(4deg); }
  60% { transform: translateX(-6px) rotate(-3deg); }
  80% { transform: translateX(6px) rotate(3deg); }
}

@keyframes avatar-nudge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* ── UI Theme picker ── */

.ui-theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

@media (min-width: 480px) {
  .ui-theme-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.ui-theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}

.ui-theme-option:hover {
  border-color: var(--accent);
}

.ui-theme-option.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.ui-theme-preview {
  width: 100%;
  height: 2.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ui-theme-preview--midnight-obsidian {
  background: linear-gradient(135deg, #09090b, #c9a84c);
}

.ui-theme-preview--royal-forest {
  background: linear-gradient(135deg, #071410, #c4a574 65%, #2a4a32);
}

.ui-theme-preview--grandmaster-slate {
  background: linear-gradient(135deg, #0c1017, #60a5fa 70%, #f1f5f9);
}

.ui-theme-preview--neon-cyber {
  background: linear-gradient(135deg, #0a0412, #22d3ee 45%, #f472b6);
}

.ui-theme-preview--sunset-amber {
  background: linear-gradient(135deg, #140c06, #f59e0b 55%, #c2410c);
}

.ui-theme-preview--arctic-ice {
  background: linear-gradient(135deg, #e8f6fc, #22d3ee 50%, #ffffff);
}

.ui-theme-name {
  font-size: 0.8rem;
  font-weight: 600;
}

.puzzle-hint-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.puzzle-hint-layer.is-visible {
  opacity: 1;
}

.puzzle-hint-arrow {
  position: absolute;
  height: 4px;
  transform-origin: left center;
  background: linear-gradient(90deg, var(--accent), transparent);
  border-radius: 2px;
}

.puzzle-hint-arrow::after {
  content: '';
  position: absolute;
  right: -2px;
  top: 50%;
  transform: translateY(-50%);
  border: 8px solid transparent;
  border-left-color: var(--accent);
}

.puzzle-feedback {
  text-align: center;
  min-height: 1.5rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.puzzle-feedback.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.puzzle-feedback[data-tone='error'] {
  color: var(--danger);
}

.puzzle-feedback[data-tone='success'] {
  color: var(--success);
}

.puzzle-move-log-wrap {
  max-width: 280px;
  margin: 1rem auto 0;
}

.puzzle-move-log-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.puzzle-move-log {
  list-style: decimal inside;
  font-size: 0.85rem;
  color: var(--text-muted);
  max-height: 120px;
  overflow-y: auto;
}

.square.puzzle-shake {
  animation: puzzle-shake-keyframes 0.4s ease;
}

@keyframes puzzle-shake-keyframes {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

/* ── Lesson Modal ── */

.lesson-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.75);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.lesson-modal.is-open {
  opacity: 1;
}

.lesson-modal.hidden {
  display: none;
}

.lesson-dialog {
  position: relative;
  width: min(100%, 400px);
  padding: 2rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transform: translateY(12px);
  transition: transform 0.25s ease;
}

.lesson-modal.is-open .lesson-dialog {
  transform: translateY(0);
}

.lesson-close {
  position: absolute;
  top: 0.75rem;
  inset-inline-end: 0.75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.lesson-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.lesson-desc {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.lesson-xp {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

/* ── Micro-animations ── */

@keyframes motion-press-keyframes {
  0% { transform: scale(1); }
  50% { transform: scale(0.96); }
  100% { transform: scale(1); }
}

@keyframes motion-piece-move-keyframes {
  0% { transform: scale(1); filter: brightness(1); }
  40% { transform: scale(1.12); filter: brightness(1.2); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes motion-xp-pop-keyframes {
  0% { transform: scale(1); color: var(--text-muted); }
  50% { transform: scale(1.15); color: var(--accent); }
  100% { transform: scale(1); color: var(--text-muted); }
}

@keyframes motion-streak-pulse-keyframes {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}

@keyframes motion-unlock-keyframes {
  0% { transform: scale(1); box-shadow: none; }
  50% { transform: scale(1.05); box-shadow: 0 0 24px var(--accent-glow); }
  100% { transform: scale(1); box-shadow: 0 0 0 3px var(--accent-glow); }
}

.motion-press {
  animation: motion-press-keyframes 0.22s ease;
}

.motion-piece-move {
  animation: motion-piece-move-keyframes 0.28s ease;
}

.motion-xp-pop {
  animation: motion-xp-pop-keyframes 0.6s ease;
}

.motion-streak-pulse {
  animation: motion-streak-pulse-keyframes 0.5s ease;
}

.motion-unlock {
  animation: motion-unlock-keyframes 0.7s ease;
}

/* ── Footer ── */

.footer {
  text-align: center;
  padding: 1.25rem 2rem 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem 1.15rem;
  margin: 0 0 0.75rem;
}

.footer a,
.footer-links a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.footer a:hover,
.footer-links a:hover {
  color: var(--accent-secondary);
}

/* ── Legal / info pages (AdSense-ready) ── */

.legal-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(201, 168, 76, 0.12), transparent 55%),
    var(--bg-primary);
  color: var(--text-primary);
}

.legal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(17, 17, 19, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.legal-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--text-primary);
}

.legal-brand-icon {
  color: var(--accent);
  font-size: 1.35rem;
}

.legal-brand-text {
  font-family: Syne, var(--font-sans), sans-serif;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.legal-brand-text span {
  color: var(--accent);
}

.legal-top-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
}

.legal-top-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.legal-top-links a:hover,
.legal-top-links a.is-active {
  color: var(--accent);
  border-bottom-color: rgba(201, 168, 76, 0.55);
}

.legal-shell {
  flex: 1;
  width: min(100% - 2rem, 46rem);
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.legal-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: clamp(1.35rem, 3vw, 2.25rem);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.legal-eyebrow {
  margin: 0 0 0.45rem;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.legal-card h1 {
  margin: 0 0 0.65rem;
  font-family: Syne, var(--font-sans), sans-serif;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 800;
  line-height: 1.15;
  color: var(--text-primary);
}

.legal-meta {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.legal-lead {
  margin: 0 0 1.5rem;
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.65;
}

.legal-section {
  margin-top: 1.5rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--border);
}

.legal-section h2 {
  margin: 0 0 0.65rem;
  font-family: Syne, var(--font-sans), sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-secondary);
}

.legal-section p,
.legal-section li {
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: 0.95rem;
}

.legal-section p {
  margin: 0 0 0.75rem;
}

.legal-section ul {
  margin: 0.35rem 0 0;
  padding-inline-start: 1.25rem;
}

.legal-section li {
  margin-bottom: 0.45rem;
}

.legal-section li strong {
  color: var(--text-primary);
  font-weight: 600;
}

.legal-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 1.25rem 0 0;
}

.legal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.7rem 1.15rem;
  border-radius: 0.65rem;
  border: 1px solid transparent;
  background: linear-gradient(160deg, var(--cta-from), var(--cta-to));
  color: var(--cta-text);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.legal-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.legal-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.legal-btn-ghost {
  background: transparent;
  border-color: rgba(201, 168, 76, 0.4);
  color: var(--accent);
}

.legal-form {
  display: grid;
  gap: 0.9rem;
  margin-top: 0.75rem;
}

.legal-field {
  display: grid;
  gap: 0.35rem;
}

.legal-field span {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
}

.legal-field input,
.legal-field textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 0.55rem;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font: inherit;
  resize: vertical;
}

.legal-field input:focus,
.legal-field textarea:focus {
  outline: none;
  border-color: rgba(201, 168, 76, 0.55);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.legal-form-status {
  margin: 0;
  font-size: 0.88rem;
}

.legal-form-status.is-success {
  color: #86efac;
}

.legal-form-status.is-error {
  color: #fca5a5;
}

.legal-footer {
  margin-top: auto;
}

@media (max-width: 640px) {
  .legal-topbar {
    padding: 0.85rem 1rem;
  }

  .legal-top-links {
    width: 100%;
    gap: 0.5rem 0.75rem;
  }

  .legal-shell {
    width: min(100% - 1.25rem, 46rem);
    padding-top: 1.25rem;
  }
}

/* ── Responsive ── */

@media (max-width: 1024px) {
  .main {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  .game-area {
    order: 1;
  }

  .panel-left {
    order: 2;
  }

  .panel-right {
    order: 3;
  }

  .player-list .player-card.player-opponent {
    order: 1;
  }

  .player-list .player-card.player-human {
    order: 2;
  }

  .nav {
    display: none;
  }

  .header-actions {
    display: none;
  }

  .mobile-menu-toggle {
    display: flex;
    margin-left: 0;
  }

  .mobile-nav-btn {
    display: flex;
  }
}

@media (max-width: 480px) {
  .header {
    padding-top: max(0.65rem, env(safe-area-inset-top));
    padding-bottom: 0.65rem;
    padding-inline: 0;
  }

  .header-inner {
    padding-inline: 0.75rem;
  }

  .progress-hud-level {
    min-width: 4.5rem;
  }

  .progress-hud-xp {
    min-width: 0;
    flex: 1 1 auto;
  }

  .path-node {
    width: 100%;
  }

  .path-node--left,
  .path-node--right {
    align-self: stretch;
  }

  .puzzle-launcher-grid {
    grid-template-columns: 1fr;
  }

  .main {
    padding: 1rem;
  }

  .logo-text {
    font-size: 1.05rem;
  }

  .language-switcher {
    min-width: 0;
    width: 100%;
  }
}

/* ── Tactical Puzzles page ── */

.puzzles-hub {
  max-width: 56rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.puzzles-hero {
  text-align: center;
  margin-bottom: 2rem;
}

.puzzles-hero-title {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.puzzles-hero-desc {
  color: var(--text-muted);
  max-width: 36rem;
  margin: 0 auto 1rem;
}

.puzzles-summary {
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--accent);
}

.puzzles-difficulty-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.puzzles-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.65rem 1.1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.puzzles-tab.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow);
}

.puzzles-tab.is-locked {
  opacity: 0.55;
  cursor: not-allowed;
}

.puzzles-tab-lock {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.puzzles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr));
  gap: 0.65rem;
}

.puzzles-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  aspect-ratio: 1;
  padding: 0.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.2s;
}

.puzzles-card:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.puzzles-card.is-done {
  border-color: #22c55e66;
  background: #22c55e14;
}

.puzzles-card.is-locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.puzzles-card.is-current {
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.puzzles-card-num {
  font-weight: 700;
  font-size: 1rem;
}

.puzzles-card-status {
  font-size: 0.85rem;
}

.puzzles-card-reward {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.coin-toast {
  position: fixed;
  top: 5.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  z-index: 99999;
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  background: linear-gradient(135deg, #f59e0b, #eab308);
  box-shadow: 0 8px 32px rgba(245, 158, 11, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.coin-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.coin-toast[data-tone="success"] {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 8px 32px rgba(34, 197, 94, 0.4);
}

.coin-toast[data-tone="error"] {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 8px 32px rgba(239, 68, 68, 0.4);
}

/* ── Image Puzzle Dashboard ── */

.puzzle-dashboard {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.puzzle-dashboard-hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.puzzle-dashboard-title {
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 800;
}

.puzzle-dashboard-desc {
  color: var(--text-muted);
  max-width: 38rem;
  margin-top: 0.35rem;
}

.puzzle-dashboard-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.puzzle-search-input {
  flex: 1;
  min-width: 12rem;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.puzzle-catalog-summary {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.puzzle-category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.puzzle-dash-tab {
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}

.puzzle-dash-tab.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.puzzle-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: 1rem;
}

.puzzle-catalog-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-elevated);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  text-align: left;
}

.puzzle-catalog-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.puzzle-catalog-card.is-done {
  border-color: #22c55e55;
}

.puzzle-catalog-thumb {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg-base);
}

.puzzle-catalog-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.puzzle-catalog-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: #22c55e;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
}

.puzzle-catalog-body {
  padding: 0.65rem 0.75rem 0.85rem;
}

.puzzle-catalog-title {
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.2rem;
}

.puzzle-catalog-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.puzzle-load-more {
  display: block;
  margin: 1.5rem auto 0;
}

/* ── Jigsaw player ── */

.jigsaw-player {
  max-width: 56rem;
  margin: 0 auto;
  padding: 1rem 1rem 2.5rem;
}

.jigsaw-player-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.jigsaw-player-meta h2 {
  font-size: 1.2rem;
  font-weight: 700;
}

.jigsaw-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.jigsaw-status {
  text-align: center;
  font-weight: 600;
  margin-bottom: 1rem;
  min-height: 1.5rem;
}

.jigsaw-layout {
  display: grid;
  grid-template-columns: 1fr minmax(10rem, 14rem);
  gap: 1rem;
  align-items: start;
}

.jigsaw-board {
  display: grid;
  grid-template-columns: repeat(var(--jigsaw-grid, 4), 1fr);
  grid-template-rows: repeat(var(--jigsaw-grid, 4), 1fr);
  aspect-ratio: 1;
  width: min(100%, 420px);
  margin: 0 auto;
  border: 2px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-elevated);
}

.jigsaw-slot {
  position: relative;
  border: 1px dashed color-mix(in srgb, var(--border) 80%, transparent);
  min-width: 0;
  min-height: 0;
}

.jigsaw-slot.is-hover {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
}

.jigsaw-slot.is-filled {
  border-style: solid;
  border-color: transparent;
}

.jigsaw-tray-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  background: var(--bg-elevated);
  max-height: min(70vh, 420px);
  overflow-y: auto;
}

.jigsaw-tray-label {
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.jigsaw-tray {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem;
}

.jigsaw-piece {
  aspect-ratio: 1;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: grab;
  background-repeat: no-repeat;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.jigsaw-piece.is-dragging {
  opacity: 0.35;
  cursor: grabbing;
}

.jigsaw-piece-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 200;
  margin: 0;
  opacity: 0.95;
  pointer-events: none;
  cursor: grabbing;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  will-change: transform;
}

.jigsaw-piece.is-locked {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 0;
  cursor: default;
  box-shadow: none;
  touch-action: auto;
}

.jigsaw-shake {
  animation: puzzle-shake 0.35s ease;
}

body.is-jigsaw-dragging {
  overflow: hidden !important;
  touch-action: none;
  overscroll-behavior: none;
}

body.is-jigsaw-dragging .jigsaw-tray-wrap {
  overflow: hidden;
  touch-action: none;
}

/* Mobile: board on top, horizontal bottom-dock piece tray */
@media (max-width: 720px) {
  .jigsaw-player {
    display: flex;
    flex-direction: column;
    min-height: calc(100dvh - 4.5rem);
    max-width: 100%;
    margin: 0;
    padding: 0.65rem 0.65rem calc(0.5rem + env(safe-area-inset-bottom));
    box-sizing: border-box;
  }

  .jigsaw-player-header {
    flex-shrink: 0;
    margin-bottom: 0.4rem;
    gap: 0.65rem;
  }

  .jigsaw-status {
    flex-shrink: 0;
    margin-bottom: 0.5rem;
    min-height: 1.25rem;
    font-size: 0.9rem;
  }

  .jigsaw-layout {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    gap: 0.55rem;
    overflow: hidden;
  }

  .jigsaw-board {
    flex: 0 1 auto;
    width: min(100%, calc(100dvh - 13.5rem));
    max-width: 100%;
    max-height: min(72vw, calc(100dvh - 13.5rem));
    margin-inline: auto;
  }

  .jigsaw-tray-wrap {
    flex: 0 0 auto;
    position: sticky;
    bottom: 0;
    z-index: 6;
    max-height: none;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    touch-action: pan-x;
    padding: 0.55rem 0.65rem calc(0.55rem + env(safe-area-inset-bottom));
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.2);
  }

  .jigsaw-tray-label {
    margin-bottom: 0.4rem;
  }

  .jigsaw-tray {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.45rem;
    width: max-content;
    min-height: 3.5rem;
    padding-bottom: 0.1rem;
  }

  .jigsaw-piece:not(.is-locked) {
    flex: 0 0 auto;
    width: clamp(52px, 17vw, 76px);
    height: auto;
    aspect-ratio: 1;
    min-width: 52px;
    min-height: 52px;
  }
}

/* ── Profile Modal (glassmorphism) ── */
.profile-name-btn {
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.profile-modal {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(6, 8, 14, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.profile-modal.hidden {
  display: none;
}

.profile-dialog {
  width: min(100%, 440px);
  max-height: min(90dvh, 720px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(201, 168, 76, 0.38);
  background: linear-gradient(
    160deg,
    rgba(28, 30, 38, 0.82) 0%,
    rgba(14, 16, 22, 0.88) 100%
  );
  box-shadow:
    0 0 0 1px rgba(201, 168, 76, 0.12),
    0 24px 64px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  color: var(--text-primary);
}

.profile-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(201, 168, 76, 0.18);
  flex-shrink: 0;
}

.profile-identity {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(201, 168, 76, 0.55);
  background: rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.profile-identity-text {
  min-width: 0;
}

.profile-title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-secondary);
}

.profile-display-name {
  margin: 0.2rem 0 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-close {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid rgba(201, 168, 76, 0.25);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.profile-close:hover {
  color: var(--accent);
  border-color: rgba(201, 168, 76, 0.5);
  background: rgba(201, 168, 76, 0.08);
}

.profile-body {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  padding: 1.15rem 1.25rem 1.35rem;
  overflow-y: auto;
}

.profile-section {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.profile-section-title {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.profile-section-desc {
  margin: -0.25rem 0 0;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.profile-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.profile-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.profile-input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgba(201, 168, 76, 0.22);
  background: rgba(8, 10, 16, 0.55);
  color: var(--text-primary);
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.profile-input-wrap .profile-input {
  padding-inline-end: 2.75rem;
}

.profile-input:focus {
  border-color: rgba(201, 168, 76, 0.55);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.15);
}

.profile-input--readonly {
  opacity: 0.85;
  cursor: default;
  color: var(--text-secondary);
}

.profile-eye {
  position: absolute;
  inset-inline-end: 0.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.profile-eye:hover,
.profile-eye[aria-pressed="true"] {
  color: var(--accent);
  background: rgba(201, 168, 76, 0.1);
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.profile-stat {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.85rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(201, 168, 76, 0.2);
  background: rgba(255, 255, 255, 0.03);
}

.profile-stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.profile-stat-value {
  font-size: 1.35rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent-secondary);
}

.profile-form-error {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  font-size: 0.85rem;
}

.profile-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.15rem;
}

.profile-save {
  min-width: 9.5rem;
}

@media (max-width: 480px) {
  .profile-dialog {
    width: 100%;
    border-radius: 14px;
  }

  .profile-header,
  .profile-body {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .profile-avatar {
    width: 54px;
    height: 54px;
  }

  .profile-display-name {
    font-size: 1.1rem;
  }
}

/* ── Global Leaderboard page ── */
#view-leaderboard {
  min-height: calc(100dvh - 4.5rem);
}

.glb-page {
  padding: 1.5rem 1rem 2.5rem;
}

.glb-shell {
  width: min(100%, 920px);
  margin-inline: auto;
}

.glb-header {
  margin-bottom: 1.25rem;
}

.glb-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.glb-title {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.glb-subtitle {
  margin: 0.45rem 0 0;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.glb-panel {
  border-radius: 18px;
  border: 1px solid rgba(201, 168, 76, 0.32);
  background: linear-gradient(
    165deg,
    rgba(28, 30, 38, 0.78) 0%,
    rgba(12, 14, 20, 0.88) 100%
  );
  box-shadow:
    0 0 0 1px rgba(201, 168, 76, 0.1),
    0 20px 50px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  overflow: hidden;
}

.glb-table-wrap {
  max-height: min(70dvh, 640px);
  overflow: auto;
  overscroll-behavior: contain;
}

.glb-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.glb-thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0.85rem 0.75rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: rgba(14, 16, 22, 0.94);
  border-bottom: 1px solid rgba(201, 168, 76, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  text-align: start;
}

.glb-col-rank {
  width: 5.5rem;
}

.glb-col-level,
.glb-col-rating {
  width: 5.5rem;
  text-align: center !important;
  font-variant-numeric: tabular-nums;
}

.glb-row td {
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.95rem;
  color: var(--text-primary);
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.glb-row:hover td {
  background: #1f2937;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.glb-row--gold td {
  background: rgba(201, 168, 76, 0.14);
  box-shadow: inset 0 0 0 1px rgba(201, 168, 76, 0.55), 0 0 18px rgba(201, 168, 76, 0.22);
}

.glb-row--silver td {
  background: rgba(170, 180, 195, 0.12);
  box-shadow: inset 0 0 0 1px rgba(192, 200, 212, 0.5), 0 0 16px rgba(180, 190, 205, 0.18);
}

.glb-row--bronze td {
  background: rgba(180, 120, 70, 0.14);
  box-shadow: inset 0 0 0 1px rgba(196, 140, 80, 0.5), 0 0 16px rgba(180, 120, 70, 0.2);
}

.glb-row--gold:hover td {
  background: rgba(201, 168, 76, 0.22);
}

.glb-row--silver:hover td {
  background: rgba(170, 180, 195, 0.2);
}

.glb-row--bronze:hover td {
  background: rgba(180, 120, 70, 0.22);
}

.glb-row--you td {
  box-shadow: inset 2px 0 0 var(--accent);
}

.glb-rank {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.glb-rank--podium .glb-rank-num {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.glb-medal {
  font-size: 1.15rem;
  line-height: 1;
}

.glb-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.glb-col-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.glb-you-badge {
  flex-shrink: 0;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(201, 168, 76, 0.45);
  background: rgba(201, 168, 76, 0.15);
  color: var(--accent-secondary);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.glb-col-level {
  font-weight: 700;
  color: var(--text-secondary);
}

.glb-col-rating {
  font-weight: 800;
  color: var(--accent);
}

.glb-tfoot {
  position: sticky;
  bottom: 0;
  z-index: 3;
}

.glb-row--sticky td {
  position: sticky;
  bottom: 0;
  background: linear-gradient(
    180deg,
    rgba(24, 26, 34, 0.96) 0%,
    rgba(18, 20, 28, 0.98) 100%
  ) !important;
  border-top: 1px solid rgba(201, 168, 76, 0.4);
  border-bottom: none;
  box-shadow:
    0 -10px 28px rgba(0, 0, 0, 0.45),
    inset 2px 0 0 var(--accent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.glb-row--sticky:hover td {
  background: #1f2937 !important;
}

.glb-sticky-note {
  margin: 0;
  padding: 0.65rem 1rem 0.9rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

@media (max-width: 640px) {
  .glb-page {
    padding: 1rem 0.75rem 2rem;
  }

  .glb-col-rank {
    width: 4.25rem;
  }

  .glb-col-level,
  .glb-col-rating {
    width: 3.75rem;
  }

  .glb-row td,
  .glb-thead th {
    padding: 0.7rem 0.45rem;
    font-size: 0.85rem;
  }

  .glb-rank--podium .glb-rank-num {
    display: none;
  }

  .glb-you-badge {
    display: none;
  }
}

/* Monthly challenge + player drawer + expanded columns */
.glb-challenge {
  margin-bottom: 1rem;
  padding: 0.95rem 1.1rem;
  border-radius: 14px;
  border: 1px solid rgba(201, 168, 76, 0.28);
  background: linear-gradient(135deg, rgba(28, 30, 38, 0.75), rgba(14, 16, 22, 0.85));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.glb-challenge-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.glb-challenge-label {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.glb-challenge-time {
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

.glb-progress {
  height: 0.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.glb-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent-secondary));
  box-shadow: 0 0 12px rgba(201, 168, 76, 0.45);
  transition: width 0.4s ease;
}

.glb-challenge-hint {
  margin: 0.55rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.glb-col-player {
  width: auto;
}

.glb-col-flag {
  width: 3.5rem;
  text-align: center !important;
}

.glb-col-points {
  width: 5rem;
  text-align: center !important;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.glb-col-trend {
  width: 3.75rem;
  text-align: center !important;
}

.glb-player-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  max-width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: start;
}

.glb-player-btn:hover .glb-name {
  color: var(--accent-secondary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.glb-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(201, 168, 76, 0.35);
  background: rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.glb-player-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.glb-tier {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.glb-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  line-height: 1;
}

.glb-flag .country-flag,
.country-flag {
  display: inline-block;
  width: 20px;
  height: 20px;
  object-fit: cover;
  border-radius: 3px;
  vertical-align: middle;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--border) 70%, transparent);
}

.country-flag--globe,
.country-flag--emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.country-flag--chip {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 16px;
  padding: 0 0.25rem;
  border-radius: 3px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #e8d48a;
  background: #1e293b;
  border: 1px solid color-mix(in srgb, var(--accent, #c9a84c) 55%, transparent);
  box-shadow: none;
  object-fit: unset;
}

.glb-history-private {
  margin: 0.35rem 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  border: 1px dashed color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-align: center;
}

.profile-name-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.nav-user-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid color-mix(in srgb, var(--accent, #c9a84c) 45%, transparent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent-glow, rgba(201, 168, 76, 0.35)) 50%, transparent);
  background: #111827;
}

.nav-user-flag .country-flag {
  width: 20px;
  height: 20px;
}

.settings-toggle--glow .settings-toggle-track {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent-glow) 35%, transparent);
}

.settings-toggle--glow input:checked + .settings-toggle-track {
  background: linear-gradient(135deg, var(--cta-from, var(--accent)), var(--cta-to, var(--accent-dim)));
  border-color: color-mix(in srgb, var(--accent) 65%, transparent);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent),
    0 0 18px var(--accent-glow);
}

.settings-section--privacy .settings-toggle-label {
  font-weight: 700;
  color: var(--accent-secondary);
}

.glb-trend {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 800;
}

.glb-trend--up {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.12);
}

.glb-trend--flat {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
}

.glb-trend--down {
  color: #f87171;
  background: rgba(248, 113, 113, 0.12);
}

.glb-row--inactive td {
  opacity: 0.72;
}

.glb-inactive-badge {
  flex-shrink: 0;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.12);
  color: #fca5a5;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.glb-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
}

.glb-drawer.hidden {
  display: none;
}

.glb-drawer {
  position: fixed;
  inset: 0;
  z-index: 320;
}

.glb-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 12, 0.55);
  backdrop-filter: blur(4px);
}

.glb-drawer-panel {
  position: absolute;
  top: 0;
  inset-inline-end: 0;
  width: min(100%, 380px);
  height: 100%;
  display: flex;
  flex-direction: column;
  border-inline-start: 1px solid rgba(201, 168, 76, 0.35);
  background: linear-gradient(180deg, rgba(24, 26, 34, 0.96), rgba(12, 14, 20, 0.98));
  box-shadow: -16px 0 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: glb-drawer-in 0.22s ease;
}

@keyframes glb-drawer-in {
  from {
    transform: translateX(12px);
    opacity: 0.6;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

html[dir='rtl'] .glb-drawer-panel {
  animation-name: glb-drawer-in-rtl;
}

@keyframes glb-drawer-in-rtl {
  from {
    transform: translateX(-12px);
    opacity: 0.6;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.glb-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.1rem 1.15rem;
  border-bottom: 1px solid rgba(201, 168, 76, 0.2);
}

.glb-drawer-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.glb-drawer-close {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 10px;
  border: 1px solid rgba(201, 168, 76, 0.25);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 1.35rem;
  cursor: pointer;
}

.glb-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.15rem;
}

.glb-drawer-identity {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.glb-drawer-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid rgba(201, 168, 76, 0.5);
  object-fit: cover;
}

.glb-drawer-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
}

.glb-drawer-sub {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.glb-drawer-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 1.15rem;
}

.glb-drawer-stat {
  padding: 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(201, 168, 76, 0.2);
  background: rgba(255, 255, 255, 0.03);
}

.glb-drawer-stat-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.glb-drawer-stat-value {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent-secondary);
}

.glb-drawer-section {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.glb-history {
  list-style: none;
  margin: 0 0 1.15rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.glb-history-item {
  display: grid;
  grid-template-columns: 3.5rem 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.15rem 0.55rem;
  padding: 0.65rem 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.2);
}

.glb-history-item--win {
  border-color: rgba(74, 222, 128, 0.25);
}

.glb-history-item--loss {
  border-color: rgba(248, 113, 113, 0.25);
}

.glb-history-result {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.glb-history-opp {
  font-size: 0.88rem;
  font-weight: 600;
}

.glb-history-pts {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--accent);
  justify-self: end;
}

.glb-history-when {
  grid-column: 1 / -1;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.glb-drawer-actions {
  display: flex;
  justify-content: stretch;
}

.glb-challenge-btn {
  width: 100%;
}

.glb-drawer-empty,
.glb-drawer-loading {
  color: var(--text-muted);
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  .glb-col-flag {
    width: 2.75rem;
  }

  .glb-col-trend {
    width: 2.5rem;
  }

  .glb-tier,
  .glb-inactive-badge {
    display: none;
  }

  .glb-avatar {
    width: 30px;
    height: 30px;
  }
}

/* Social + challenge + profile extras */
.glb-drawer-stats--3 {
  grid-template-columns: repeat(3, 1fr);
}

.glb-drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.glb-follow-btn {
  flex: 1 1 auto;
}

.glb-challenge-btn {
  flex: 1 1 auto;
}

.glb-challenge-status {
  margin: 0.65rem 0 0;
  font-size: 0.85rem;
  color: var(--accent-secondary);
}

.glb-history-item {
  grid-template-columns: 1.5rem 3.5rem 1fr auto;
}

.glb-history-type {
  font-size: 1rem;
  line-height: 1;
}

.profile-flag-line {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.35rem 0 0;
}

.profile-country-flag {
  font-size: 1.25rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.profile-country-flag .country-flag {
  width: 22px;
  height: 22px;
  border-radius: 3px;
}

.profile-country-code {
  display: none !important;
}

.profile-social-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.profile-social-stat {
  padding: 0.65rem 0.55rem;
  border-radius: 10px;
  border: 1px solid rgba(201, 168, 76, 0.2);
  background: rgba(255, 255, 255, 0.03);
  text-align: center;
}

.profile-social-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.profile-social-value {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent-secondary);
}

.challenge-modal.hidden,
.challenge-wait-banner.hidden {
  display: none;
}

.challenge-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.challenge-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 12, 0.6);
  backdrop-filter: blur(4px);
}

.challenge-modal-dialog {
  position: relative;
  width: min(100%, 380px);
  padding: 1.35rem 1.25rem;
  border-radius: 16px;
  border: 1px solid rgba(201, 168, 76, 0.4);
  background: linear-gradient(165deg, rgba(28, 30, 38, 0.95), rgba(12, 14, 20, 0.98));
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.challenge-modal-title {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent);
}

.challenge-modal-msg {
  margin: 0 0 1.15rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.challenge-modal-actions {
  display: flex;
  gap: 0.55rem;
}

.challenge-modal-actions .btn {
  flex: 1;
}

.challenge-wait-banner {
  position: fixed;
  top: 4.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 350;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(201, 168, 76, 0.4);
  background: rgba(18, 20, 28, 0.94);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  max-width: calc(100vw - 1.5rem);
}

.challenge-wait-spinner {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  border: 2px solid rgba(201, 168, 76, 0.25);
  border-top-color: var(--accent);
  animation: challenge-spin 0.8s linear infinite;
}

@keyframes challenge-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Auth page — password visibility + forgot password modal */
.auth-password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-password-wrap > input {
  padding-inline-end: 2.75rem;
}

.auth-eye {
  position: absolute;
  inset-inline-end: 0.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.auth-eye:hover,
.auth-eye[aria-pressed='true'] {
  color: var(--accent, #c9a84c);
  background: rgba(201, 168, 76, 0.1);
}

.auth-forgot-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-forgot-modal.hidden {
  display: none;
}

.auth-forgot-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 12, 0.72);
  backdrop-filter: blur(6px);
}

.auth-forgot-modal-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 26rem);
  padding: 1.5rem 1.35rem 1.35rem;
  border-radius: 1rem;
  border: 1px solid rgba(201, 168, 76, 0.28);
  background: rgba(18, 20, 28, 0.98);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.auth-forgot-close {
  position: absolute;
  top: 0.65rem;
  inset-inline-end: 0.75rem;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted, #94a3b8);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.auth-forgot-close:hover {
  color: var(--text-primary, #f8fafc);
  background: rgba(255, 255, 255, 0.06);
}

.auth-forgot-title {
  margin: 0 0 0.4rem;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary, #f8fafc);
}

.auth-forgot-desc {
  margin: 0 0 1.15rem;
  font-size: 0.9rem;
  color: var(--text-muted, #94a3b8);
  line-height: 1.45;
}

.auth-oauth-divider {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 1.15rem 0;
  color: var(--text-muted, #94a3b8);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.auth-oauth-divider::before,
.auth-oauth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(148, 163, 184, 0.28);
}

.auth-oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.auth-oauth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: 0.8rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary, #f8fafc);
  font-size: 0.92rem;
  font-weight: 650;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}

.auth-oauth-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(201, 168, 76, 0.45);
  transform: translateY(-1px);
}

.auth-oauth-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.auth-oauth-btn--facebook:hover:not(:disabled) {
  border-color: rgba(24, 119, 242, 0.55);
}

.auth-oauth-icon {
  display: inline-flex;
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
}

.auth-oauth-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.auth-signin-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.65rem;
}

.auth-remember {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 550;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  user-select: none;
}

.auth-remember input {
  width: 0.95rem;
  height: 0.95rem;
  accent-color: #c9a84c;
  cursor: pointer;
}

.auth-forgot-link {
  border: none;
  background: transparent;
  padding: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  transition: color 0.15s;
}

.auth-forgot-link:hover {
  color: #c9a84c;
}

.auth-submit-btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  padding: 0.95rem 1.1rem;
  border: 1px solid rgba(255, 220, 140, 0.35);
  border-radius: 0.9rem;
  background:
    linear-gradient(180deg, #dfc06a 0%, #c9a84c 48%, #a88632 100%);
  color: #14161c;
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow:
    0 0 0 1px rgba(201, 168, 76, 0.25),
    0 10px 28px rgba(201, 168, 76, 0.28),
    0 0 32px rgba(201, 168, 76, 0.18);
  transition:
    transform 0.18s ease,
    box-shadow 0.22s ease,
    filter 0.22s ease;
}

.auth-submit-btn__label {
  position: relative;
  z-index: 1;
}

.auth-submit-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    115deg,
    transparent 20%,
    rgba(255, 255, 255, 0.45) 48%,
    transparent 72%
  );
  transform: translateX(-120%);
  transition: transform 0.55s ease;
  z-index: 0;
}

.auth-submit-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow:
    0 0 0 1px rgba(255, 220, 140, 0.45),
    0 14px 34px rgba(201, 168, 76, 0.4),
    0 0 42px rgba(201, 168, 76, 0.32);
}

.auth-submit-btn:hover::before {
  transform: translateX(120%);
}

.auth-submit-btn:active {
  transform: translateY(0);
  filter: brightness(0.98);
}
