/* ═══════════════════════════════════════════════════════════════
   QUIZIO — Notebook / Paper Theme
   ═══════════════════════════════════════════════════════════════ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  /* Paper / Notebook Colors */
  --bg-primary: #f9f7f1;
  --bg-secondary: #f3f0e7;
  --bg-tertiary: #ede9dd;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.75);
  --bg-hover: rgba(99, 102, 241, 0.08);

  --text-primary: #2d2d2d;
  --text-secondary: #5f5f5f;
  --text-muted: #9e9e9e;

  --accent-primary: #4f46e5;
  --accent-secondary: #0891b2;
  --accent-warm: #d97706;
  --accent-danger: #dc2626;
  --accent-success: #16a34a;

  --gradient-main: linear-gradient(135deg, #4f46e5 0%, #0891b2 100%);
  --gradient-warm: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  --gradient-danger: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  --gradient-success: linear-gradient(135deg, #16a34a 0%, #0891b2 100%);

  --border-color: rgba(0, 0, 0, 0.1);
  --border-glow: rgba(99, 102, 241, 0.3);

  --shadow-sm: 2px 3px 6px rgba(0, 0, 0, 0.08);
  --shadow-md: 2px 4px 10px rgba(0, 0, 0, 0.1);
  --shadow-lg: 3px 6px 20px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.1);

  /* Notebook-specific */
  --line-blue: rgba(164, 191, 227, 0.45);
  --paper-bg: #f9f7f1;
  --sidebar-bg: #ffffff;
  --yellow-note: #fef9c3;
  --yellow-note-dark: #fef08a;
  --tape-color: rgba(254, 249, 195, 0.65);

  /* Typography */
  --font-display: "Patrick Hand", cursive;
  --font-main: "Roboto Slab", serif;
  --font-mono: "JetBrains Mono", monospace;

  /* Spacing */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  /* Prevent double-tap zoom on mobile */
  touch-action: manipulation;
}

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-secondary);
  text-decoration: none;
}

input,
select,
textarea,
button {
  font-family: var(--font-main);
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ── Selection ─────────────────────────────────────────────── */
::selection {
  background: #fef08a;
  color: #1f2937;
}

/* ── Particles Canvas (subtle in notebook theme) ───────────── */
#particles-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.08;
}

/* ── View System ───────────────────────────────────────────── */
.view {
  display: none;
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.view.active {
  display: flex;
}

/* ── Glass Card → Paper Card ───────────────────────────────── */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

/* ── Glow Card → Clean Notebook Card ───────────────────────── */
.glow-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: var(--transition);
  position: relative;
  overflow: visible;
  box-shadow: var(--shadow-md);
}

.glow-card:hover {
  border-color: var(--border-glow);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.5rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  font-family: var(--font-display);
  letter-spacing: 0.5px;
  transition: var(--transition);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: var(--transition);
}

.btn:hover::after {
  background: rgba(255, 255, 255, 0.1);
}

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

.btn-primary {
  background: #3b82f6;
  color: white;
  box-shadow: 2px 3px 8px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  background: #2563eb;
  box-shadow: 2px 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-accent {
  background: #06b6d4;
  color: white;
  box-shadow: 2px 3px 8px rgba(6, 182, 212, 0.3);
}

.btn-accent:hover {
  background: #0891b2;
}

.btn-warm {
  background: #f59e0b;
  color: #1a1a2e;
  box-shadow: 2px 3px 8px rgba(245, 158, 11, 0.3);
}

.btn-warm:hover {
  background: #d97706;
}

.btn-danger {
  background: #ef4444;
  color: white;
  box-shadow: 2px 3px 8px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-ghost {
  background: white;
  color: var(--text-secondary);
  border: 2px solid var(--border-color);
  box-shadow: none;
}

.btn-ghost:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.04);
}

.btn-sm {
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
}

.btn-full {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ── Inputs ────────────────────────────────────────────────── */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
}

.input-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: var(--font-display);
}

.input-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-display);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="number"],
select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: white;
  border: 2px solid #d1d5db;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1.05rem;
  transition: var(--transition);
  outline: none;
  font-family: var(--font-display);
}

input:focus,
select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

input::placeholder {
  color: var(--text-muted);
}

.input-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.input-row-3col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
}

/* ── Toggle Switch ─────────────────────────────────────────── */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-family: var(--font-display);
}

.toggle-label input {
  display: none;
}

.toggle-switch {
  width: 44px;
  height: 24px;
  background: #d1d5db;
  border-radius: 12px;
  position: relative;
  transition: var(--transition);
  border: 2px solid #b0b5bd;
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.15);
}

.toggle-label input:checked+.toggle-switch {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.toggle-label input:checked+.toggle-switch::after {
  transform: translateX(20px);
  background: white;
}

/* ═══════════════════════════════════════════════════════════════
   AUTH VIEW
   ═══════════════════════════════════════════════════════════════ */
#view-auth {
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background-color: var(--paper-bg);
  background-image:
    linear-gradient(var(--line-blue) 1px, transparent 1px),
    url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  background-size:
    100% 2rem,
    auto;
}

#view-profile-setup {
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background-color: var(--paper-bg);
  background-image:
    linear-gradient(var(--line-blue) 1px, transparent 1px),
    url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  background-size:
    100% 2rem,
    auto;
}

.auth-container {
  width: 100%;
  max-width: 440px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.logo-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 1rem;
  animation: float 5s ease-in-out infinite;
}

.logo-icon svg rect {
  fill: #4f46e5;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0) rotate(-3deg);
  }

  50% {
    transform: translateY(-8px) rotate(2deg);
  }
}

.logo-text {
  font-size: 3.5rem;
  font-weight: 700;
  font-family: var(--font-display);
  color: #312e81;
  letter-spacing: 6px;
}

.logo-tagline {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-top: 0.25rem;
  font-family: var(--font-display);
}

.auth-card {
  padding: 2rem;
  background: white;
  border: 2px solid #d1d5db;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  position: relative;
}

.auth-card::before {
  display: none;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  background: #f3f4f6;
  border-radius: 999px;
  padding: 4px;
  border: 2px solid #e5e7eb;
}

.auth-tab {
  flex: 1;
  padding: 0.6rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-weight: 700;
  cursor: pointer;
  border-radius: 999px;
  transition: var(--transition);
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.auth-tab.active {
  background: var(--accent-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-form.hidden {
  display: none;
}

.auth-error {
  background: rgba(239, 68, 68, 0.1);
  border: 2px solid rgba(239, 68, 68, 0.25);
  color: #dc2626;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-top: 0.75rem;
  font-family: var(--font-display);
}

.auth-error.hidden {
  display: none;
}

/* ── QUIZIO Auth Components ────────────────────────────────── */
.qv-google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0.85rem 1rem;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-display);
}

.qv-google-btn:hover {
  background: #f9fafb;
  border-color: #d1d5db;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.qv-divider {
  display: flex;
  align-items: center;
  margin: 1.25rem 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.qv-divider::before,
.qv-divider::after {
  content: "";
  flex: 1;
  height: 2px;
  background: #e5e7eb;
  border-radius: 1px;
}

.qv-divider span {
  padding: 0 14px;
}

.input-group {
  position: relative;
}

.qv-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1;
  display: flex;
  align-items: center;
}

.qv-input {
  padding-left: 42px !important;
}

.qv-submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 0.25rem;
  padding: 0.85rem 1rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.qv-forgot {
  text-align: right;
  margin-top: 4px;
  margin-bottom: 0;
}

.qv-forgot a {
  color: var(--accent-primary);
  font-size: 0.8rem;
  text-decoration: none;
  font-family: var(--font-display);
  transition: color 0.2s;
}

.qv-forgot a:hover {
  color: var(--accent-secondary);
  text-decoration: underline;
}

/* ── Avatar Upload ─────────────────────────────────────────── */
.qv-avatar-upload {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 4px;
  border-radius: 50%;
  cursor: pointer;
  overflow: hidden;
  border: 3px solid var(--accent-primary);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.25);
  transition: all 0.3s ease;
}

.qv-avatar-upload:hover {
  border-color: var(--accent-secondary);
  box-shadow: 0 4px 24px rgba(99, 102, 241, 0.4);
  transform: scale(1.03);
}

.qv-avatar-upload.drag-over {
  border-color: #00ceff;
  box-shadow:
    0 0 0 4px rgba(0, 206, 255, 0.2),
    0 4px 24px rgba(0, 206, 255, 0.3);
  transform: scale(1.06);
}

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

.qv-avatar-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.25s ease;
  font-size: 0.7rem;
  color: white;
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.qv-avatar-upload:hover .qv-avatar-overlay,
.qv-avatar-upload.drag-over .qv-avatar-overlay {
  opacity: 1;
}

.qv-avatar-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-family: var(--font-display);
  margin-bottom: 0;
}

/* ═══════════════════════════════════════════════════════════════
   DASHBOARD LAYOUT
   ═══════════════════════════════════════════════════════════════ */
#view-dashboard {
  flex-direction: column;
}

/* ── Top Nav ───────────────────────────────────────────────── */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  height: 64px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 2px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.nav-brand svg rect {
  fill: #4f46e5;
}

.brand-text {
  font-size: 1.6rem;
  font-weight: 700;
  font-family: var(--font-display);
  color: #312e81;
  letter-spacing: 3px;
}

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

.nav-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-main);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.nav-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.nav-avatar-letter {
  font-weight: 800;
  font-size: 1rem;
  color: white;
  font-family: var(--font-display);
}

.nav-user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.nav-username {
  font-weight: 700;
  font-size: 1.1rem;
  font-family: var(--font-display);
  color: var(--text-primary);
}

.nav-elo {
  font-size: 0.8rem;
  color: var(--accent-warm);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-elo svg {
  flex-shrink: 0;
}

.nav-points {
  font-size: 0.75rem;
  color: #f59e0b;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.nav-coin {
  font-size: 0.85rem;
}

/* ── Dashboard Grid ────────────────────────────────────────── */
.dashboard-layout {
  display: grid;
  grid-template-columns: 240px 1fr 280px;
  height: calc(100vh - 64px);
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  background: white;
  border-right: 3px solid #e5e7eb;
  padding: 1.5rem 0.75rem;
  position: relative;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.04);
}

/* Notebook holes decoration — removed for cleaner look */

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-left: 20px;
}

.sidebar-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--text-secondary);
  font-size: 1.05rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  width: 100%;
  text-align: left;
  font-family: var(--font-display);
  transform: translateX(0);
}

.sidebar-btn:hover {
  background: rgba(99, 102, 241, 0.06);
  color: var(--text-primary);
  transform: translateX(4px);
}

.sidebar-btn.active {
  background: rgba(79, 70, 229, 0.10);
  color: var(--accent-primary);
  border-left: 4px solid var(--accent-primary);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.06);
}

.sidebar-btn.active svg {
  stroke: var(--accent-primary);
}

.sidebar-badge {
  margin-left: auto;
  background: #ef4444;
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  min-width: 20px;
  text-align: center;
  font-family: var(--font-mono);
}

.sidebar-badge.hidden {
  display: none;
}

/* ── Main Content ──────────────────────────────────────────── */
.main-content {
  overflow-y: auto;
  padding: 2rem 2.5rem;
  background-color: var(--paper-bg);
  background-image:
    linear-gradient(var(--line-blue) 1px, transparent 1px),
    url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  background-size:
    100% 2rem,
    auto;
  background-attachment: local;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
  animation: panelFadeIn 0.2s ease;
}

@keyframes panelFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  font-family: var(--font-display);
  color: var(--text-primary);
}

.section-subtitle {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.subsection-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin: 1.5rem 0 0.75rem;
  font-family: var(--font-display);
}

/* ── Text Helpers ──────────────────────────────────────────── */
.text-gradient {
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-muted {
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}

/* ═══════════════════════════════════════════════════════════════
   HOME PANEL — Action Cards
   ═══════════════════════════════════════════════════════════════ */
.home-hero {
  margin-bottom: 0.75rem;
}

.home-hero .section-title {
  font-size: 1.6rem;
}

.home-hero .section-subtitle {
  margin-bottom: 0.75rem;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.5rem;
}

.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 1rem;
  padding-bottom: 1.25rem;
}

.action-card-icon {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
  background: rgba(99, 102, 241, 0.08);
  color: var(--accent, var(--accent-primary));
  transition: var(--transition);
}

.action-card:hover .action-card-icon {
  background: rgba(99, 102, 241, 0.15);
  transform: scale(1.08) rotate(-2deg);
}

.action-card h3 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  font-family: var(--font-display);
}

.action-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
  line-height: 1.5;
  flex: 1;
}

.action-card .btn {
  font-family: var(--font-display);
  font-size: 1.15rem;
  padding: 0.6rem 2rem;
  transition: var(--transition);
}

/* Different tinted backgrounds per card */
#card-quick-game {
  background: #eff6ff;
  border-color: #bfdbfe;
}

#card-quick-game .action-card-icon {
  background: rgba(59, 130, 246, 0.1);
}

#card-custom-game {
  background: #ecfeff;
  border-color: #a5f3fc;
}

#card-custom-game .action-card-icon {
  background: rgba(6, 182, 212, 0.1);
}

#card-preset-game {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

#card-preset-game .action-card-icon {
  background: rgba(22, 163, 74, 0.1);
}

#card-solo-mode {
  background: #fefce8;
  border-color: #fef08a;
}

#card-solo-mode .action-card-icon {
  background: rgba(202, 138, 4, 0.1);
}

#card-tournament-mode {
  background: #faf5ff;
  border-color: #e9d5ff;
}

#card-tournament-mode .action-card-icon {
  background: rgba(147, 51, 234, 0.1);
}

#card-wrong-answers {
  background: #fff1f2;
  border-color: #fecdd3;
}

#card-wrong-answers .action-card-icon {
  background: rgba(225, 29, 72, 0.08);
}

#card-pdf-mode {
  background: #f0fdf9;
  border-color: #99f6e4;
}

#card-pdf-mode .action-card-icon {
  background: rgba(0, 184, 148, 0.1);
}

/* PDF card reuse section */
.pdf-reuse-section {
  width: 100%;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.pdf-reuse-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  flex: unset;
}

.home-pdf-reuse {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  width: 100%;
}

.home-pdf-reuse .qv-select-sm {
  flex: 1;
  min-width: 0;
}

.home-pdf-reuse .btn-sm {
  flex-shrink: 0;
  white-space: nowrap;
}

/* Alternate tape rotation */
#card-custom-game::before,
#card-tournament-mode::before {
  transform: translateX(-50%) rotate(-2deg);
}

/* Pin decorations removed for cleaner look */

/* ═══════════════════════════════════════════════════════════════
   LOBBY BROWSER
   ═══════════════════════════════════════════════════════════════ */
.lobby-controls {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.lobby-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.lobby-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: var(--radius-md);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.lobby-item:hover {
  border-color: var(--border-glow);
  background: #f8faff;
  transform: translateY(-1px);
}

.lobby-item-info h4 {
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--font-display);
}

.lobby-item-info span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.lobby-item-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.lobby-item-players {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-secondary);
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 1.1rem;
  background: rgba(255, 255, 255, 0.6);
  border: 2px dashed #d1d5db;
  border-radius: var(--radius-lg);
}

.empty-state svg {
  margin-bottom: 1rem;
  opacity: 0.25;
}

.empty-state p {
  max-width: 320px;
  margin: 0 auto;
  line-height: 1.5;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* ═══════════════════════════════════════════════════════════════
   LEADERBOARD TOGGLE
   ═══════════════════════════════════════════════════════════════ */
.lb-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 1rem;
  background: rgba(79, 70, 229, 0.08);
  border-radius: 10px;
  padding: 3px;
  width: fit-content;
}
.lb-toggle-btn {
  padding: 0.45rem 1.3rem;
  border: none;
  background: transparent;
  color: var(--text-secondary, #94a3b8);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.lb-toggle-btn:hover {
  color: var(--text-primary, #e2e8f0);
}
.lb-toggle-btn.active {
  background: var(--accent, #4f46e5);
  color: #fff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

/* ═══════════════════════════════════════════════════════════════
   LEADERBOARD
   ═══════════════════════════════════════════════════════════════ */
.leaderboard-table {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.lb-row {
  display: grid;
  grid-template-columns: 50px 1fr 120px 100px;
  align-items: center;
  padding: 0.75rem 1rem;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.04);
}

.lb-row:hover {
  border-color: var(--border-glow);
  background: #f8faff;
}

.lb-row.lb-header {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: var(--font-display);
  box-shadow: none;
}

.lb-rank {
  font-weight: 800;
  font-size: 1.2rem;
  font-family: var(--font-display);
}

.lb-rank.gold {
  color: #d97706;
}

.lb-rank.silver {
  color: #6b7280;
}

.lb-rank.bronze {
  color: #92400e;
}

.lb-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lb-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: white;
  font-family: var(--font-display);
  overflow: hidden;
}

.lb-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.lb-username {
  font-weight: 700;
  font-family: var(--font-display);
}

.lb-elo {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-warm);
}

.lb-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  text-align: center;
  font-family: var(--font-display);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1.5px solid transparent;
}

/* Rank badge color variants */
.lb-badge[style*="cd7f32"] { background: #fef3c7; border-color: #f59e0b; color: #92400e; }
.lb-badge[style*="c0c0c0"] { background: #f1f5f9; border-color: #94a3b8; color: #475569; }
.lb-badge[style*="ffd700"] { background: #fef9c3; border-color: #eab308; color: #854d0e; }
.lb-badge[style*="e5e4e2"] { background: #f0f9ff; border-color: #7dd3fc; color: #0369a1; }
.lb-badge[style*="b9f2ff"] { background: #ecfeff; border-color: #22d3ee; color: #0e7490; }
.lb-badge[style*="9b59b6"] { background: #faf5ff; border-color: #a855f7; color: #7e22ce; }
.lb-badge[style*="e74c3c"] { background: #fff1f2; border-color: #f43f5e; color: #be123c; }

/* Top 3 leaderboard rows */
.lb-row:nth-child(2) {
  background: linear-gradient(90deg, rgba(234, 179, 8, 0.08) 0%, white 100%);
  border-color: #fde68a;
}
.lb-row:nth-child(3) {
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.08) 0%, white 100%);
  border-color: #cbd5e1;
}
.lb-row:nth-child(4) {
  background: linear-gradient(90deg, rgba(180, 83, 9, 0.06) 0%, white 100%);
  border-color: #fed7aa;
}

/* ═══════════════════════════════════════════════════════════════
   PROFILE
   ═══════════════════════════════════════════════════════════════ */
.profile-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--gradient-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 800;
  color: white;
  position: relative;
  font-family: var(--font-display);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

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

.profile-avatar::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 3px solid transparent;
  background: linear-gradient(white, white) padding-box, var(--gradient-main) border-box;
  opacity: 0.5;
}

.profile-name {
  font-size: 2rem;
  font-weight: 700;
  font-family: var(--font-display);
}

.profile-rank-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
  font-family: var(--font-display);
}

.rank-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-elo-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.elo-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: var(--font-display);
}

.elo-value {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-warm);
  font-size: 1.1rem;
}

.profile-bio {
  margin-bottom: 1.5rem;
}

.bio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.bio-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-secondary);
  font-family: var(--font-display);
}
.bio-header-actions { display: flex; align-items: center; gap: 0.5rem; }
.qv-select-sm {
  font-size: 0.75rem; padding: 0.25rem 0.5rem; border-radius: 6px;
  background: var(--bg-card, rgba(255,255,255,0.85)); border: 1px solid var(--border-color, rgba(0,0,0,0.12));
  color: var(--text-primary, #333); cursor: pointer;
}

.bio-text {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  font-style: italic;
  font-family: var(--font-display);
  padding: 0.75rem 1rem;
  background: rgba(79, 70, 229, 0.04);
  border-left: 3px solid var(--accent-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  text-align: center;
  padding: 1.25rem 1rem;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Color-code individual stat cards */
.stat-card:nth-child(1) { border-bottom: 3px solid #22c55e; }
.stat-card:nth-child(2) { border-bottom: 3px solid #ef4444; }
.stat-card:nth-child(3) { border-bottom: 3px solid #3b82f6; }
.stat-card:nth-child(4) { border-bottom: 3px solid var(--accent-primary); }

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--accent-primary);
}

.stat-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 0.25rem;
  letter-spacing: 0.5px;
  font-family: var(--font-display);
}

.profile-categories {
  margin-bottom: 1.5rem;
}

.profile-categories h3 {
  margin-bottom: 1rem;
  font-family: var(--font-display);
}

.category-stats-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cat-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px dashed var(--border-color);
}

.cat-stat-name {
  font-weight: 700;
  font-family: var(--font-display);
}

.cat-stat-bar {
  flex: 1;
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  margin: 0 1rem;
  overflow: hidden;
}

.cat-stat-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--gradient-main);
  transition: width 0.5s ease;
}

.cat-stat-value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
  min-width: 50px;
  text-align: right;
}

/* ═══════════════════════════════════════════════════════════════
   FRIENDS
   ═══════════════════════════════════════════════════════════════ */
.friends-add {
  margin-bottom: 1rem;
}

.friends-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.friend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.friend-item-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.friend-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  font-size: 0.9rem;
  font-family: var(--font-display);
}

.friend-name {
  font-weight: 700;
  font-family: var(--font-display);
}

.friend-status {
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.online {
  background: #16a34a;
  box-shadow: 0 0 6px rgba(22, 163, 74, 0.5);
}

.status-dot.offline {
  background: var(--text-muted);
}

.friend-item-actions {
  display: flex;
  gap: 0.5rem;
}

/* ── DM Panel ──────────────────────────────────────────────── */
.dm-panel {
  margin-top: 1.5rem;
  max-height: 400px;
  display: flex;
  flex-direction: column;
}

.dm-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px dashed var(--border-color);
  margin-bottom: 0.75rem;
}

.dm-username {
  font-weight: 700;
  font-family: var(--font-display);
}

.dm-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem 0;
  min-height: 200px;
  max-height: 250px;
}

.dm-msg {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  max-width: 80%;
  font-size: 0.9rem;
  line-height: 1.4;
  font-family: var(--font-display);
}

.dm-msg.sent {
  background: rgba(59, 130, 246, 0.12);
  margin-left: auto;
  border-bottom-right-radius: 4px;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.dm-msg.received {
  background: #f3f4f6;
  margin-right: auto;
  border-bottom-left-radius: 4px;
  border: 1px solid #e5e7eb;
}

.dm-msg .dm-msg-author {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 0.15rem;
}

.dm-input-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.dm-input-row input {
  flex: 1;
  padding: 0.5rem 0.75rem;
}

/* ═══════════════════════════════════════════════════════════════
   TOURNAMENT
   ═══════════════════════════════════════════════════════════════ */
.tournament-create {
  margin-bottom: 1.5rem;
}

.tournament-create h3 {
  margin-bottom: 1rem;
  font-family: var(--font-display);
}

.tournament-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tourney-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: var(--radius-md);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.tourney-item:hover {
  border-color: var(--border-glow);
  background: #f8faff;
}

.tourney-item-info h4 {
  font-weight: 700;
  font-family: var(--font-display);
}

.tourney-item-info span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.tourney-item-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.tourney-players {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-secondary);
}

/* ═══════════════════════════════════════════════════════════════
   CHAT SIDEBAR — Yellow notepad style
   ═══════════════════════════════════════════════════════════════ */
.chat-sidebar {
  background: #fefdf8;
  border-left: 2px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 64px);
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.04);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 2px solid #e5e7eb;
  background: rgba(255, 255, 255, 0.6);
}

.chat-header h3 {
  font-size: 1.3rem;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--text-primary);
}

.chat-online {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.online-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #16a34a;
  border: 2px solid #15803d;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: #fafaf8;
}

.chat-msg {
  font-size: 0.9rem;
  line-height: 1.4;
  word-break: break-word;
  font-family: var(--font-display);
}

.chat-msg-author {
  font-weight: 700;
  color: var(--accent-primary);
  margin-right: 0.35rem;
  font-size: 0.85rem;
}

.chat-msg-text {
  color: var(--text-secondary);
}

.chat-msg-time {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-left: 0.35rem;
}

/* ── Clickable User Badges & Chat Avatars ────────────────────── */
.clickable-user {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  font-weight: 700;
  color: var(--accent-primary);
  font-size: 0.85rem;
  vertical-align: middle;
  transition: opacity 0.15s;
}

.clickable-user:hover {
  opacity: 0.75;
}

.clickable-user-name {
  white-space: nowrap;
}

.chat-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.chat-avatar-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  font-family: var(--font-display);
  flex-shrink: 0;
}

.chat-msg .clickable-user {
  margin-right: 0.3rem;
}

/* Game-over score card avatar */
.go-score-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 0.35rem;
}

/* Full profile modal — scrollable, wider */
.modal-full-profile {
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
}

/* Clickable header in modal-user-profile */
.modal-profile-header-link {
  cursor: pointer;
  padding: 0.75rem;
  margin: -0.5rem -0.5rem 1rem;
  border-radius: var(--radius-md);
  transition: background 0.18s, box-shadow 0.18s;
}

.modal-profile-header-link:hover {
  background: rgba(79, 70, 229, 0.06);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.12);
}

.modal-profile-header-link:hover .profile-name {
  color: var(--accent-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.modal-profile-header-link:hover .profile-avatar {
  transform: scale(1.06);
  transition: transform 0.18s;
}

[data-theme="dark"] .modal-profile-header-link:hover {
  background: rgba(129, 140, 248, 0.1);
  box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.18);
}

.go-score-avatar-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-primary);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: var(--font-display);
}

.chat-input-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 2px solid #e5e7eb;
  background: white;
}

.chat-input-row input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  font-family: var(--font-display);
  border: 2px solid #d1d5db;
  border-radius: var(--radius-md);
}

/* ═══════════════════════════════════════════════════════════════
   OVERLAYS & MODALS
   ═══════════════════════════════════════════════════════════════ */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(249, 247, 241, 0.92);
  backdrop-filter: blur(12px);
}

.overlay.hidden {
  display: none;
}

.overlay-content {
  text-align: center;
  width: min(92vw, 480px);
  padding: 2.5rem 2rem 2rem;
  animation: modal-in 0.3s ease;
}

.overlay-content h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  margin-bottom: 0.3rem;
}

.overlay-topic-text {
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  min-height: 1.4em;
}

/* ── Gradient ring spinner ───────────────────────────────────── */
.overlay-spinner-ring {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0%, #a855f7 25%, #ec4899 55%, #fbbf24 80%, transparent 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #fff 0);
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #fff 0);
  animation: spin 1.1s linear infinite;
  margin: 0 auto 1.5rem;
}

/* Keep old queue-spinner for places still using it */
.queue-spinner {
  width: 56px;
  height: 56px;
  border: 4px solid #e5e7eb;
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  margin: 0 auto 1.5rem;
  animation: spin 1s linear infinite;
}

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

/* ── Diamond Pro perks strip ─────────────────────────────────── */
.loading-perks-wrap {
  margin: 0.5rem 0 1.25rem;
}

.loading-perks-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: linear-gradient(90deg, #a855f7, #ec4899, #fbbf24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.65rem;
}

.loading-perks-strip {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: nowrap;
}

.loading-perk-chip {
  flex: 1;
  min-width: 0;
  max-width: 130px;
  background: linear-gradient(135deg, rgba(168,85,247,0.07), rgba(251,191,36,0.07));
  border: 1px solid rgba(168,85,247,0.2);
  border-radius: 12px;
  padding: 0.6rem 0.5rem 0.55rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  animation: perk-in 0.35s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes perk-in {
  from { opacity: 0; transform: translateY(8px) scale(0.92); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.loading-perk-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.loading-perk-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  line-height: 1.2;
}

.loading-perk-desc {
  font-size: 0.64rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

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

.modal-content {
  position: relative;
  z-index: 1;
  width: 90%;
  max-width: 480px;
  padding: 2rem;
  animation: modal-in 0.3s ease;
  background: white;
  border: 2px solid #d1d5db;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

/* Tape decoration removed for cleaner modals */

@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }

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

.modal-content h2 {
  margin-bottom: 1.25rem;
  font-size: 1.6rem;
  font-family: var(--font-display);
}

.modal-content .input-group {
  margin-bottom: 1rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* ── Preset Cards ──────────────────────────────────────────── */
.preset-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.preset-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  width: 100%;
  color: var(--text-primary);
  font-family: var(--font-main);
  box-shadow: var(--shadow-sm);
}

.preset-card:hover {
  border-color: #86efac;
  background: #f0fdf4;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.preset-card:active {
  transform: scale(0.98);
}

.preset-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.preset-card-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.preset-card-info h4 {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-display);
}

.preset-card-info span {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-display);
}

/* ═══════════════════════════════════════════════════════════════
   LOBBY WAITING VIEW
   ═══════════════════════════════════════════════════════════════ */
#view-lobby {
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background-color: var(--paper-bg);
  background-image: linear-gradient(var(--line-blue) 1px, transparent 1px);
  background-size: 100% 2rem;
}

.lobby-view-container {
  width: 100%;
  max-width: 600px;
}

.lobby-info-card {
  text-align: center;
  background: white;
  border: 2px solid #d1d5db;
  box-shadow: var(--shadow-md);
}

.lobby-info-card h2 {
  font-size: 1.6rem;
  margin-bottom: 0.75rem;
  font-family: var(--font-display);
}

.lobby-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-family: var(--font-display);
}

.lobby-code {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-secondary);
  font-size: 1.1rem;
  letter-spacing: 3px;
  background: rgba(6, 182, 212, 0.1);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.lobby-players-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.lobby-player-card {
  text-align: center;
  padding: 1rem;
  background: #f9fafb;
  border-radius: var(--radius-md);
  min-width: 120px;
  border: 2px solid #e5e7eb;
}

.lobby-player-card.ready {
  border-color: #16a34a;
  background: #f0fdf4;
}

.lobby-player-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gradient-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  margin: 0 auto 0.5rem;
  font-size: 1.2rem;
  font-family: var(--font-display);
}

.lobby-player-name {
  font-weight: 700;
  font-size: 0.95rem;
  font-family: var(--font-display);
}

.lobby-player-status {
  font-size: 0.75rem;
  margin-top: 0.25rem;
  font-family: var(--font-display);
}

.lobby-player-status.ready-yes {
  color: #16a34a;
}

.lobby-player-status.ready-no {
  color: var(--text-muted);
}

.lobby-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

/* ═══════════════════════════════════════════════════════════════
   GAME VIEW
   ═══════════════════════════════════════════════════════════════ */
#view-game {
  align-items: stretch;
  justify-content: center;
  padding: 0;
  background-color: var(--paper-bg);
  background-image: linear-gradient(var(--line-blue) 1px, transparent 1px);
  background-size: 100% 2rem;
}

.game-layout {
  display: flex;
  width: 100%;
  min-height: 100vh;
  align-items: flex-start;
}

.game-players-sidebar {
  width: 176px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: rgba(255,255,255,0.75);
  border-right: 1px solid rgba(0,0,0,0.08);
  backdrop-filter: blur(8px);
  padding: 1rem 0.75rem;
  z-index: 10;
}

.game-players-sidebar.hidden { display: none !important; }

.sidebar-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: block;
}

.game-players-sidebar-inner {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.sidebar-player-card {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.35rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  border: 1px solid transparent;
}

.sidebar-player-card:hover {
  background: rgba(108,92,231,0.08);
  border-color: rgba(108,92,231,0.2);
}

.sidebar-player-card.is-me {
  border-color: rgba(108,92,231,0.35);
  background: rgba(108,92,231,0.06);
}

.sidebar-player-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
}

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

.sidebar-player-details {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}

.sidebar-player-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-player-elo {
  font-size: 0.67rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.sidebar-more-btn {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  width: 100%;
}

.game-leave-row {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.75rem;
  margin-top: auto;
}

/* In-game player profile popup */
.ingame-profile-popup {
  max-width: 320px;
  width: 90vw;
}

.ingame-profile-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* Clickable profile header — used on in-game popup */
.profile-clickable-header {
  cursor: pointer;
  padding: 0.6rem 0.75rem;
  margin: -0.5rem -0.5rem 1rem;
  border-radius: var(--radius-md);
  transition: background 0.18s, box-shadow 0.18s;
  position: relative;
}

.profile-clickable-header:hover {
  background: rgba(79, 70, 229, 0.06);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
}

.profile-clickable-header:hover .ingame-profile-name {
  color: var(--accent-primary);
}

.profile-clickable-header:hover .profile-link-arrow {
  opacity: 1;
  transform: translateX(2px);
}

.profile-link-arrow {
  opacity: 0.3;
  color: var(--text-secondary);
  flex-shrink: 0;
  margin-left: auto;
  transition: opacity 0.18s, transform 0.18s;
}

.ingame-profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.3rem;
  color: #fff;
  flex-shrink: 0;
}

.ingame-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ingame-profile-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.ingame-profile-rank {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.ingame-profile-elo {
  font-size: 0.82rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-primary);
  margin-top: 0.1rem;
}

.ingame-profile-stats {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.igp-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0,0,0,0.04);
  border-radius: 8px;
  padding: 0.5rem 0.2rem;
  gap: 0.1rem;
}

.igp-stat span:first-child {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.igp-stat span:last-child {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.game-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
  min-height: 100vh;
}

.game-header {
  margin-bottom: 1.5rem;
}

.game-scoreboard {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.game-player {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.game-player-left {
  align-items: flex-start;
}

.game-player-right {
  align-items: flex-end;
}

.game-player-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-secondary);
  font-family: var(--font-display);
}

.game-player-score {
  font-size: 2.5rem;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--accent-primary);
}

.game-vs {
  text-align: center;
}

.game-question-counter {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  font-family: var(--font-display);
}

.game-timer-bar {
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid #d1d5db;
}

.game-timer-fill {
  height: 100%;
  background: #3b82f6;
  border-radius: 3px;
  /* No CSS transition — JS drives this at 60fps with rAF for perfect sync */
  width: 100%;
  will-change: width;
}

.game-timer-fill.warning {
  background: #f59e0b;
}

.game-timer-fill.danger {
  background: #ef4444;
}

.game-question-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.game-topic-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent-secondary);
  margin-bottom: 0.75rem;
  font-family: var(--font-display);
}

.game-room-title {
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  padding: 0.4rem 1rem;
  background: var(--bg-secondary);
  border-radius: 999px;
  margin: 0 auto 0.5rem;
  width: fit-content;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generating-sub {
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.game-question-text {
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.4;
  margin-bottom: 2rem;
  max-width: 700px;
  font-family: var(--font-display);
  color: var(--text-primary);
}

.game-question-image {
  text-align: center;
  margin-bottom: 1.5rem;
  max-width: 500px;
  width: 100%;
}

.game-question-image img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  padding: 8px;
}

.game-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  width: 100%;
  max-width: 700px;
}

.game-option {
  padding: 1.1rem 1.25rem;
  background: white;
  border: 2px solid #d1d5db;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1.05rem;
  font-weight: 500;
  cursor: pointer;
  /* Fast transitions for instant feel — only what's needed */
  transition: border-color 0.1s ease, background-color 0.1s ease, transform 0.08s ease, box-shadow 0.1s ease;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-display);
  box-shadow: var(--shadow-sm);
  /* Eliminate 300ms tap delay on mobile */
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  will-change: transform;
}

.game-option:hover:not(.disabled):not(.selected):not(.correct):not(.wrong) {
  border-color: var(--accent-primary);
  background: #eef2ff;
  /* No translateY — avoids layout shift and "sloppy" feel */
  box-shadow: var(--shadow-md);
}

/* Immediate tactile press feedback */
.game-option:active:not(.disabled) {
  transform: scale(0.97);
  transition: transform 0.05s ease;
}

/* Instant visual selection shown BEFORE server responds */
.game-option.selected:not(.correct):not(.wrong) {
  border-color: var(--accent-primary) !important;
  background: #eef2ff !important;
}

.game-option.selected .option-letter {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.game-option .option-letter {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #eef2ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent-primary);
  flex-shrink: 0;
  border: 2px solid #c7d2fe;
}

.game-option.correct {
  border-color: #16a34a !important;
  background: #f0fdf4 !important;
}

.game-option.correct .option-letter {
  background: #16a34a;
  color: white;
  border-color: #16a34a;
}

.game-option.wrong {
  border-color: #dc2626 !important;
  background: #fef2f2 !important;
}

.game-option.wrong .option-letter {
  background: #dc2626;
  color: white;
  border-color: #dc2626;
}

.game-option.disabled {
  cursor: default;
}

/* Unanswered options after answer: fade them down slightly without washing out correct/wrong */
.game-option.disabled:not(.correct):not(.wrong):not(.selected) {
  opacity: 0.55;
}

.game-feedback {
  margin-top: 1.5rem;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1.2rem;
  text-align: center;
  animation: pop-in 0.3s ease;
  font-family: var(--font-display);
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.game-feedback.correct {
  background: #f0fdf4;
  border: 2px solid #86efac;
  color: #16a34a;
}

.game-feedback.wrong {
  background: #fef2f2;
  border: 2px solid #fecaca;
  color: #dc2626;
}

.game-feedback.timeout {
  background: #fffbeb;
  border: 2px solid #fde68a;
  color: #d97706;
}

.game-waiting-opponent {
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  animation: pulse-opacity 1.5s ease-in-out infinite;
}

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

/* ── Game Chat ─────────────────────────────────────────────── */
.game-chat-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #3b82f6;
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  z-index: 200;
  transition: var(--transition);
}

.game-chat-toggle:hover {
  transform: scale(1.1);
  background: #2563eb;
}

.game-chat-panel {
  position: fixed;
  bottom: 5rem;
  right: 1.5rem;
  width: 320px;
  max-height: 400px;
  background: white;
  border: 2px solid #d1d5db;
  border-radius: var(--radius-lg);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  z-index: 200;
  animation: slide-up 0.3s ease;
  box-shadow: var(--shadow-lg);
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

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

.game-chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 200px;
  max-height: 300px;
  padding: 0.5rem 0;
}

.game-chat-input-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.game-chat-input-row input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
}

/* ═══════════════════════════════════════════════════════════════
   GAME OVER VIEW
   ═══════════════════════════════════════════════════════════════ */
#view-game-over {
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background-color: var(--paper-bg);
  background-image: linear-gradient(var(--line-blue) 1px, transparent 1px);
  background-size: 100% 2rem;
}

.game-over-container {
  width: 100%;
  max-width: 700px;
}

.game-over-card {
  padding: 2rem;
  text-align: center;
  background: white;
  border: 2px solid #d1d5db;
  box-shadow: var(--shadow-lg);
}

.game-over-banner {
  margin-bottom: 2rem;
}

.game-over-banner h1 {
  font-size: 3rem;
  font-weight: 700;
  font-family: var(--font-display);
}

.game-over-banner.victory h1 {
  color: #16a34a;
}

.game-over-banner.defeat h1 {
  color: #dc2626;
}

.game-over-banner.draw h1 {
  color: #d97706;
}

.game-over-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-top: 0.5rem;
  font-family: var(--font-display);
}

.game-over-scores {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1.5rem;
}

.go-score-card {
  text-align: center;
  padding: 1rem 1.5rem;
  background: #f9fafb;
  border-radius: var(--radius-md);
  min-width: 140px;
  border: 2px solid #e5e7eb;
}

.go-score-card.winner {
  border-color: #16a34a;
  background: #f0fdf4;
}

.go-score-name {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.25rem;
  font-family: var(--font-display);
}

.go-score-value {
  font-size: 2.5rem;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--accent-primary);
}

.game-over-elo {
  margin-bottom: 1.5rem;
}

.elo-change {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
}

.elo-change.positive {
  color: #16a34a;
}

.elo-change.negative {
  color: #dc2626;
}

.game-over-review {
  text-align: left;
  margin-bottom: 1.5rem;
}

.game-over-review h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-family: var(--font-display);
}

.review-questions-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 350px;
  overflow-y: auto;
}

.review-item {
  padding: 1rem;
  background: #f9fafb;
  border-radius: var(--radius-sm);
  border: 2px solid #e5e7eb;
  border-left-width: 4px;
}

.review-item.review-correct {
  border-left-color: #16a34a;
}

.review-item.review-wrong {
  border-left-color: #dc2626;
}

.review-item.review-timeout {
  border-left-color: #d97706;
}

.review-question {
  font-weight: 700;
  margin-bottom: 0.5rem;
  font-family: var(--font-display);
}

.review-answer {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.review-your-answer {
  color: #dc2626;
}

.review-correct-answer {
  color: #16a34a;
}

.game-over-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

/* ═══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════ */
#toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  animation: toast-in 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 360px;
  font-family: var(--font-display);
  box-shadow: var(--shadow-md);
  border: 2px solid;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast.info {
  background: #eef2ff;
  color: #4f46e5;
  border-color: #c7d2fe;
}

.toast.success {
  background: #f0fdf4;
  color: #16a34a;
  border-color: #86efac;
}

.toast.error {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

.toast.warning {
  background: #fffbeb;
  color: #d97706;
  border-color: #fde68a;
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE NAVIGATION
   ═══════════════════════════════════════════════════════════════ */
.mobile-nav {
  display: none;
}

.mobile-more-menu {
  display: none;
}

.mobile-chat-overlay {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
    height: calc(100vh - 64px - 64px);
  }

  .sidebar,
  .chat-sidebar {
    display: none;
  }

  .main-content {
    padding: 1rem;
    padding-bottom: 80px;
  }

  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 500;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 2px solid #e5e7eb;
    padding: 0.35rem 0.25rem;
    padding-bottom: max(0.35rem, env(safe-area-inset-bottom));
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06);
  }

  .mobile-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    min-width: 56px;
    -webkit-tap-highlight-color: transparent;
    font-family: var(--font-display);
  }

  .mobile-nav-btn:active {
    transform: scale(0.92);
  }

  .mobile-nav-btn.active {
    color: var(--accent-primary);
  }

  .mobile-more-menu {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 600;
    align-items: flex-end;
    justify-content: center;
  }

  .mobile-more-menu.hidden {
    display: none !important;
  }

  .mobile-more-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(4px);
  }

  .mobile-more-content {
    position: relative;
    z-index: 1;
    background: white;
    border: 2px solid #e5e7eb;
    border-bottom: none;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 1.5rem 1rem;
    padding-bottom: max(1.5rem, calc(env(safe-area-inset-bottom) + 72px));
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    animation: slide-up 0.25s ease;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  }

  .mobile-more-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    text-align: left;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
    font-family: var(--font-display);
  }

  .mobile-more-item:hover,
  .mobile-more-item:active {
    background: var(--bg-hover);
    color: var(--text-primary);
  }

  .mobile-more-badge {
    margin-left: auto;
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    min-width: 20px;
    text-align: center;
  }

  .mobile-more-badge.hidden {
    display: none;
  }

  .mobile-chat-overlay {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0;
    z-index: 700;
    background: var(--paper-bg);
  }

  .mobile-chat-overlay.hidden {
    display: none !important;
  }

  .mobile-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 2px solid #e5e7eb;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
  }

  .mobile-chat-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    font-family: var(--font-display);
  }

  .mobile-chat-overlay .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .mobile-chat-overlay .chat-input-row {
    border-top: 2px solid #e5e7eb;
    padding: 0.75rem;
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
    background: white;
  }

  .top-nav {
    padding: 0.6rem 1rem;
    height: 60px;
  }

  .nav-brand svg {
    width: 28px;
    height: 28px;
  }

  .brand-text {
    font-size: 1.2rem;
  }

  .nav-username {
    font-size: 0.85rem;
  }

  .nav-elo {
    font-size: 0.7rem;
  }

  .lobby-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .lobby-item-meta {
    width: 100%;
    justify-content: space-between;
  }

  .lb-row {
    grid-template-columns: 40px 1fr 70px 60px;
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
  }

  .lb-avatar {
    width: 26px;
    height: 26px;
    font-size: 0.75rem;
  }

  .lb-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.35rem;
  }

  .modal-content {
    width: 95%;
    max-width: 440px;
    padding: 1.5rem;
    max-height: 90vh;
    overflow-y: auto;
  }

  .input-row-3col {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .input-row-3col .input-group:last-child {
    grid-column: 1 / -1;
  }

  .game-container {
    padding: 1rem;
  }

  .game-players-sidebar {
    width: 130px;
    padding: 0.75rem 0.5rem;
  }

  .sidebar-player-name { font-size: 0.7rem; }
  .sidebar-player-elo { font-size: 0.62rem; }

  .game-player-score {
    font-size: 1.8rem;
  }

  .tourney-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .tourney-item-meta {
    width: 100%;
    justify-content: space-between;
  }

  .game-over-container {
    max-width: 100%;
  }

  .game-over-card {
    padding: 1.5rem 1rem;
  }

  .game-over-banner h1 {
    font-size: 2rem;
  }

  .game-over-scores {
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
  }

  .go-score-card {
    width: 100%;
    max-width: 280px;
  }

  .overlay-content {
    max-width: 90%;
    padding: 2rem 1.5rem;
  }

  #toast-container {
    top: auto;
    bottom: 80px;
    right: 0.75rem;
    left: 0.75rem;
  }

  .toast {
    max-width: 100%;
  }

  .friend-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .friend-item-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .dm-panel {
    max-height: 350px;
  }

  .dm-messages {
    min-height: 150px;
    max-height: 200px;
  }

  .wrong-q-header {
    flex-direction: column;
    gap: 0.35rem;
  }

  .wrong-q-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .btn-explain {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .action-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .game-options {
    grid-template-columns: 1fr;
  }

  .profile-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
  }

  .game-question-text {
    font-size: 1.2rem;
    margin-bottom: 1.25rem;
  }

  .section-title {
    font-size: 1.6rem;
  }

  .section-subtitle {
    font-size: 1rem;
  }

  .home-hero {
    margin-bottom: 0.75rem;
  }

  .action-card {
    padding: 1.25rem;
  }

  .action-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    margin-bottom: 0.75rem;
  }

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

  .action-card h3 {
    font-size: 1.3rem;
  }

  .action-card p {
    font-size: 0.88rem;
    margin-bottom: 1rem;
  }

  .profile-header {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }

  .profile-info {
    align-items: center;
    display: flex;
    flex-direction: column;
  }

  .profile-avatar {
    width: 80px;
    height: 80px;
    font-size: 2rem;
  }

  .profile-name {
    font-size: 1.6rem;
  }

  .stat-card {
    padding: 0.85rem 0.5rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .game-option {
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
  }

  .game-option .option-letter {
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
  }

  .game-scoreboard {
    margin-bottom: 0.5rem;
  }

  .game-player-name {
    font-size: 0.85rem;
  }

  .game-player-score {
    font-size: 1.5rem;
  }

  .game-question-counter {
    font-size: 0.8rem;
  }

  .game-feedback {
    font-size: 1rem;
    padding: 0.75rem 1rem;
  }

  .auth-container {
    max-width: 100%;
  }

  .auth-card {
    padding: 1.5rem;
  }

  .logo-icon {
    width: 60px;
    height: 60px;
  }

  .logo-text {
    font-size: 2.5rem;
  }

  .logo-tagline {
    font-size: 0.9rem;
  }

  .game-chat-panel {
    right: 0.75rem;
    bottom: 4rem;
    width: calc(100vw - 1.5rem);
    max-width: 320px;
    max-height: 320px;
  }

  .game-chat-toggle {
    bottom: 1rem;
    right: 1rem;
    width: 42px;
    height: 42px;
  }

  .lobby-view-container {
    max-width: 100%;
  }

  .lobby-info-card {
    padding: 1.25rem;
  }

  .lobby-meta {
    flex-direction: column;
    gap: 0.5rem;
  }

  .lobby-player-card {
    min-width: 100px;
    padding: 0.75rem;
  }

  .lobby-player-avatar {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .round-results-card {
    padding: 0.6rem 0.75rem;
  }

  /* Game container tighter on tablet */
  .game-container {
    padding: 1rem;
  }

  /* Friend items stack better */
  .friend-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .friend-item-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 480px) {
  .main-content {
    padding: 0.75rem;
    padding-bottom: 80px;
  }

  .modal-content {
    width: 100%;
    max-width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    margin-top: auto;
  }

  .modal {
    align-items: flex-end;
  }

  .action-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
  }

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

  .profile-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .stat-value {
    font-size: 1.3rem;
  }

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

  .game-container {
    padding: 0.75rem;
  }

  .game-players-sidebar {
    width: 110px;
    padding: 0.6rem 0.4rem;
  }

  .sidebar-player-avatar {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
  }

  .game-over-card {
    padding: 1.25rem 0.75rem;
  }

  .game-over-banner h1 {
    font-size: 1.8rem;
  }

  .review-item {
    padding: 0.75rem;
  }

  .review-question {
    font-size: 0.95rem;
  }

  .input-row {
    flex-direction: column;
    gap: 0.75rem;
  }

  .lobby-actions {
    flex-direction: column;
    width: 100%;
  }

  .lobby-actions .btn {
    width: 100%;
  }

  .game-over-actions {
    flex-direction: column;
    width: 100%;
  }

  .game-over-actions .btn {
    width: 100%;
  }

  /* Game — tighter layout on small phones */
  .game-container {
    padding: 0.5rem 0.6rem;
    min-height: auto;
  }

  .game-header {
    margin-bottom: 0.75rem;
  }

  .game-room-title {
    font-size: 0.85rem;
  }

  .game-question-text {
    font-size: 1.05rem;
    margin-bottom: 0.75rem;
  }

  .game-option {
    padding: 0.75rem 0.85rem;
    font-size: 0.9rem;
    min-height: 48px;
  }

  .game-options {
    gap: 0.5rem;
  }

  .game-feedback {
    font-size: 0.9rem;
    padding: 0.6rem 0.85rem;
    margin-top: 0.75rem;
  }

  .game-leave-row {
    margin-top: 0.75rem;
  }

  /* Hide sidebar on very small screens — use scoreboard only */
  .game-players-sidebar {
    display: none !important;
  }

  /* Score display — more compact */
  .game-player-score {
    font-size: 1.3rem;
  }

  .game-player-name {
    font-size: 0.75rem;
  }

  /* Toast on mobile — above nav */
  #toast-container {
    left: 0.5rem;
    right: 0.5rem;
    top: auto;
    bottom: 72px;
  }

  /* Friend items on phone */
  .friend-item {
    padding: 0.6rem 0.75rem;
  }

  .friend-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
  }

  .friend-name {
    font-size: 0.85rem;
  }

  .friend-item-actions .btn {
    font-size: 0.75rem;
    padding: 0.4rem 0.6rem;
  }

  /* Lobby browser items */
  .lobby-item {
    padding: 0.75rem;
  }

  /* Prevent text selection on interactive areas */
  .game-options,
  .mobile-nav,
  .action-grid {
    user-select: none;
    -webkit-user-select: none;
  }
}

/* ── Round Results Strip (floats at bottom-right, doesn't block question) ── */
.round-results-overlay {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  left: auto;
  top: auto;
  z-index: 50;
  animation: slideInRight 0.3s ease;
  pointer-events: none;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.round-results-overlay.hidden {
  display: none;
}

.round-results-card {
  width: 260px;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.96);
  border: 2px solid #d1d5db;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

.round-results-card h3 {
  margin-bottom: 0.6rem;
  font-size: 0.85rem;
  font-family: var(--font-display);
  text-align: center;
}

.round-results-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.round-result-row {
  display: flex;
  align-items: center;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-left-width: 3px;
  border-left-color: var(--text-muted);
  gap: 0.3rem;
}

.round-result-row.first {
  border-left-color: #d97706;
  background: #fffbeb;
}

.round-result-row.second {
  border-left-color: #6b7280;
}

.round-result-row.third {
  border-left-color: #92400e;
}

.round-result-rank {
  font-weight: 700;
  width: 1.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-display);
}

.round-result-name {
  flex: 1;
  text-align: left;
  font-size: 0.8rem;
  font-family: var(--font-display);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.round-result-score {
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--accent-primary);
  font-family: var(--font-display);
}

.round-result-change {
  font-size: 0.7rem;
  min-width: 2rem;
  text-align: right;
  font-weight: 700;
}

.round-result-change.positive {
  color: #16a34a;
}

.round-result-change.negative {
  color: #dc2626;
}

/* Mobile: bottom-center strip */
@media (max-width: 768px) {
  .round-results-overlay {
    right: 0.5rem;
    left: 0.5rem;
    bottom: 0.5rem;
  }
  .round-results-card {
    width: 100%;
  }
}

/* ── Wrong Answers Panel ──────────────────────────────────── */
.wrong-count-badge {
  display: inline-block;
  background: #ef4444;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  margin-left: 0.5rem;
  vertical-align: middle;
  font-family: var(--font-display);
}

/* ── Redemption Quiz ─────────────────────────────────────── */
.redemption-quiz-section {
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.redemption-header {
  margin-bottom: 1rem;
}

.redemption-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  color: var(--text-primary);
  font-family: var(--font-display);
}

.redemption-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
}

.redemption-config {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.redemption-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
}

.redemption-row .input-group label {
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  display: block;
}

.redemption-row .qv-input {
  width: 100%;
  padding: 0.5rem;
  font-size: 0.9rem;
}

.redemption-status {
  text-align: center;
  padding: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-primary);
  margin-top: 0.5rem;
}

.redemption-status.error {
  color: var(--accent-danger);
}

@media (max-width: 520px) {
  .redemption-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

.wrong-questions-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.wrong-q-card {
  background: white;
  border: 2px solid #e5e7eb;
  border-left: 4px solid #ef4444;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.wrong-q-card:hover {
  border-color: #fecaca;
  box-shadow: var(--shadow-md);
}

.wrong-q-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  gap: 1rem;
}

.wrong-q-topic {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: var(--font-display);
}

.wrong-q-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.wrong-q-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  line-height: 1.4;
  font-family: var(--font-display);
}

.wrong-q-answers {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.wrong-q-answer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: var(--font-display);
}

.wrong-q-answer.your-wrong {
  background: #fef2f2;
  border: 2px solid #fecaca;
  color: #dc2626;
}

.wrong-q-answer.correct-ans {
  background: #f0fdf4;
  border: 2px solid #86efac;
  color: #16a34a;
}

.wrong-q-answer-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.wrong-q-answer-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  opacity: 0.7;
  margin-left: auto;
  font-family: var(--font-display);
}

.wrong-q-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.wrong-q-diff {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  letter-spacing: 0.5px;
  font-family: var(--font-display);
}

.wrong-q-diff.easy {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #86efac;
}

.wrong-q-diff.medium {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}

.wrong-q-diff.hard {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.btn-explain {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border: 2px solid #c7d2fe;
  background: #eef2ff;
  color: var(--accent-primary);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  margin-left: auto;
  font-family: var(--font-display);
}

.btn-explain:hover {
  background: #e0e7ff;
  border-color: var(--accent-primary);
}

.btn-explain:disabled {
  opacity: 0.5;
  cursor: wait;
}

.btn-explain .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.wrong-q-explanation {
  margin-top: 0.75rem;
  padding: 0.85rem;
  background: #eef2ff;
  border: 2px solid #c7d2fe;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.5;
  animation: fadeIn 0.3s ease;
  font-family: var(--font-display);
}

.wrong-q-explanation .explain-icon {
  color: var(--accent-warm);
  margin-right: 0.3rem;
}

/* ═══════════════════════════════════════════════════════════════
   SETTINGS PANEL
   ═══════════════════════════════════════════════════════════════ */
.settings-section {
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  border: 1.5px solid #e5e7eb;
  background: white;
}

.settings-heading {
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--font-display);
  margin-bottom: 0.6rem;
  color: var(--text-primary);
}

.settings-profile-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.settings-name-col { flex: 1; }
.settings-label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.3rem; display: block; }

.settings-avatar-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.settings-avatar-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 3px dashed #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}

.settings-avatar-preview:hover {
  border-color: var(--accent-primary);
  border-style: solid;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.settings-avatar-preview.drag-over {
  border-color: var(--accent-primary);
  border-style: solid;
  background: rgba(79, 70, 229, 0.06);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}

.settings-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Show upload icon when no image is set */
.settings-avatar-preview img[src=""],
.settings-avatar-preview img:not([src]) {
  display: none;
}

.settings-avatar-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(79, 70, 229, 0.06);
  color: var(--accent-primary);
  border-radius: 50%;
  opacity: 1;
  transition: opacity 0.2s, background 0.2s;
  font-size: 0.7rem;
  font-weight: 700;
  gap: 0.25rem;
  text-align: center;
  padding: 0.5rem;
  font-family: var(--font-display);
}

.settings-avatar-preview:hover .settings-avatar-overlay {
  background: rgba(79, 70, 229, 0.12);
}

/* When an actual avatar is loaded, hide the overlay unless hovering */
.settings-avatar-preview.has-avatar .settings-avatar-overlay {
  opacity: 0;
  background: rgba(0, 0, 0, 0.5);
  color: white;
}

.settings-avatar-preview.has-avatar:hover .settings-avatar-overlay {
  opacity: 1;
}

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

.settings-input-row .qv-input {
  flex: 1;
  max-width: 320px;
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
}

.settings-status {
  font-size: 0.9rem;
  color: #22c55e;
  font-weight: 600;
  font-family: var(--font-display);
  animation: fadeIn 0.3s ease;
}

/* ═══════════════════════════════════════════════════════════════
   NOTIFICATION PANEL
   ═══════════════════════════════════════════════════════════════ */
.notif-wrapper {
  position: relative;
}

.notif-bell {
  position: relative;
  padding: 0.4rem;
}

.notif-badge {
  position: absolute;
  top: -2px;
  right: -4px;
  background: #ef4444;
  color: white;
  font-size: 0.6rem;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  font-family: var(--font-mono);
  line-height: 1;
  animation: notifPop 0.3s ease;
}

@keyframes notifPop {
  0% {
    transform: scale(0);
  }

  50% {
    transform: scale(1.3);
  }

  100% {
    transform: scale(1);
  }
}

.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-height: 420px;
  background: white;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  overflow: hidden;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

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

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.notif-header h4 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.btn-xs {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
}

.notif-list {
  overflow-y: auto;
  max-height: 340px;
}

.notif-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: #999;
  font-size: 0.85rem;
  font-family: var(--font-display);
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  transition: background 0.15s;
  position: relative;
}

.notif-item:hover {
  background: rgba(79, 70, 229, 0.03);
}

.notif-item.unread {
  background: rgba(79, 70, 229, 0.06);
  border-left: 3px solid var(--accent-primary);
}

.notif-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.notif-content {
  flex: 1;
  min-width: 0;
}

.notif-title {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-primary);
  font-family: var(--font-display);
}

.notif-message {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.3;
}

.notif-time {
  font-size: 0.65rem;
  color: #aaa;
  margin-top: 4px;
  font-family: var(--font-mono);
}

.notif-dismiss {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 4px;
  line-height: 1;
  opacity: 0;
  transition:
    opacity 0.15s,
    color 0.15s;
}

.notif-item:hover .notif-dismiss {
  opacity: 1;
}

.notif-dismiss:hover {
  color: #ef4444;
}

/* ═══════════════════════════════════════════════════════════════
   ELO HISTORY CHART
   ═══════════════════════════════════════════════════════════════ */
.profile-section {
  margin-top: 1.5rem;
  padding: 1.25rem;
}

.profile-section .section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.profile-section .section-header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.elo-chart-container {
  width: 100%;
  position: relative;
}

.elo-chart-container canvas {
  width: 100%;
  border-radius: var(--radius-md);
}

.elo-chart-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: #999;
  font-size: 0.85rem;
  font-family: var(--font-display);
}

/* ═══════════════════════════════════════════════════════════════
   MATCH HISTORY
   ═══════════════════════════════════════════════════════════════ */
.match-history-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.match-history-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: #999;
  font-size: 0.85rem;
  font-family: var(--font-display);
}

.match-history-empty svg {
  margin-bottom: 0.5rem;
}

.mh-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  transition: background 0.15s;
}

.mh-row:hover {
  background: rgba(79, 70, 229, 0.03);
}

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

/* Result color hints */
.mh-row.mh-win {
  border-left: 3px solid #22c55e;
}

.mh-row.mh-loss {
  border-left: 3px solid #ef4444;
}

.mh-row.mh-draw {
  border-left: 3px solid #f59e0b;
}

.mh-result-badge {
  font-size: 1.3rem;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
}

.mh-details {
  flex: 1;
  min-width: 0;
}

.mh-opponent {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-primary);
  font-family: var(--font-display);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mh-meta {
  display: flex;
  gap: 0.5rem;
  margin-top: 2px;
  align-items: center;
}

.mh-topic {
  font-size: 0.72rem;
  color: var(--text-secondary);
  background: rgba(79, 70, 229, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-display);
}

.mh-type {
  font-size: 0.65rem;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: var(--font-mono);
}

.mh-scores {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.95rem;
}

.mh-my-score {
  color: var(--accent-primary);
}

.mh-separator {
  color: #ccc;
  font-weight: 400;
}

.mh-opp-score {
  color: var(--text-secondary);
}

.mh-right {
  text-align: right;
  flex-shrink: 0;
  min-width: 70px;
}

.mh-result-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: var(--font-display);
}

.mh-result-label.win {
  color: #22c55e;
}

.mh-result-label.loss {
  color: #ef4444;
}

.mh-result-label.draw {
  color: #f59e0b;
}

.mh-elo {
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.mh-elo.positive {
  color: #22c55e;
}

.mh-elo.negative {
  color: #ef4444;
}

.mh-date {
  font-size: 0.62rem;
  color: #aaa;
  font-family: var(--font-mono);
  margin-top: 2px;
}

/* ── Match History Pagination ────────────────────────────────── */
.mh-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 0.5rem 0.25rem;
}

.mh-load-more {
  font-size: 0.8rem;
  padding: 0.4rem 1.25rem;
}

.mh-page-info {
  font-size: 0.72rem;
  color: #aaa;
  font-family: var(--font-mono);
}

/* ── Match History Clickable Rows ──────────────────────────── */
.mh-row.mh-clickable {
  cursor: pointer;
}
.mh-row.mh-clickable:hover {
  background: rgba(79, 70, 229, 0.06);
}
.mh-row.mh-clickable .mh-expand-icon {
  font-size: 0.7rem;
  color: var(--text-secondary, #94a3b8);
  transition: transform 0.2s;
  margin-left: 4px;
}
.mh-row.mh-expanded .mh-expand-icon {
  transform: rotate(180deg);
}

/* ── Match Detail Panel ────────────────────────────────────── */
.mh-detail {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.35s ease, opacity 0.25s ease, padding 0.25s ease;
  padding: 0 0.75rem;
  background: rgba(79, 70, 229, 0.03);
  border-left: 3px solid var(--accent, #4f46e5);
  border-radius: 0 0 8px 8px;
}
.mh-detail.open {
  max-height: 2000px;
  opacity: 1;
  padding: 0.75rem;
}

.mh-detail-summary {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.mh-detail-stat {
  text-align: center;
}
.mh-detail-stat .label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary, #94a3b8);
  font-family: var(--font-mono);
}
.mh-detail-stat .value {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary, #e2e8f0);
  font-family: var(--font-display);
}

.mh-question-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.mh-question-item:last-child {
  border-bottom: none;
}
.mh-q-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.mh-q-num {
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(79, 70, 229, 0.15);
  color: var(--accent, #4f46e5);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  flex-shrink: 0;
}
.mh-q-text {
  font-size: 0.78rem;
  color: var(--text-primary, #e2e8f0);
  font-weight: 600;
}
.mh-q-answers {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 0.3rem 0 0.3rem 1.8rem;
}
.mh-q-option {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 4px;
  color: var(--text-secondary, #94a3b8);
}
.mh-q-option.correct {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
  font-weight: 700;
}
.mh-q-option.wrong {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  font-weight: 700;
}
.mh-q-meta {
  display: flex;
  gap: 0.75rem;
  margin-left: 1.8rem;
  margin-top: 2px;
}
.mh-q-meta span {
  font-size: 0.62rem;
  color: var(--text-secondary, #94a3b8);
  font-family: var(--font-mono);
}
.mh-q-opp {
  margin-left: 1.8rem;
  margin-top: 2px;
  font-size: 0.65rem;
  color: var(--text-secondary, #94a3b8);
}

/* ── ELO Chart Filter Bar ────────────────────────────────────── */
.elo-filter-bar {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.elo-filter-btn {
  padding: 0.3rem 0.75rem;
  font-size: 0.72rem;
  font-family: var(--font-display);
  font-weight: 600;
  border: 1.5px solid var(--border-color);
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.elo-filter-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.elo-filter-btn.active {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}

/* ── ELO Chart Tooltip ───────────────────────────────────────── */
.elo-tooltip {
  display: none;
  position: absolute;
  z-index: 9999;
  background: rgba(30, 30, 46, 0.92);
  color: #fff;
  font-size: 0.78rem;
  font-family: var(--font-display);
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  pointer-events: none;
  transform: translateX(-50%);
  white-space: nowrap;
  line-height: 1.4;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  backdrop-filter: blur(6px);
}

.elo-tooltip strong {
  font-size: 0.95rem;
  color: #a5b4fc;
}

/* ═══════════════════════════════════════════════════════════════
   CHALLENGE MODAL STYLES
   ═══════════════════════════════════════════════════════════════ */
.challenge-modal {
  text-align: center;
}

.challenge-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.challenge-swords-icon {
  font-size: 3rem;
  animation: challenge-pulse 1.5s ease-in-out infinite;
  filter: drop-shadow(0 4px 12px rgba(220, 38, 38, 0.3));
}

@keyframes challenge-pulse {

  0%,
  100% {
    transform: scale(1) rotate(0deg);
  }

  25% {
    transform: scale(1.15) rotate(-5deg);
  }

  50% {
    transform: scale(1.1) rotate(5deg);
  }

  75% {
    transform: scale(1.15) rotate(-3deg);
  }
}

.challenge-header h2 {
  font-size: 1.6rem;
  margin: 0;
  background: linear-gradient(135deg, #dc2626, #e17055);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.challenge-body {
  margin-bottom: 1rem;
}

.challenge-topic {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-weight: 600;
  font-family: var(--font-display);
  padding: 0.5rem 1rem;
  background: rgba(108, 92, 231, 0.08);
  border-radius: var(--radius-sm);
  display: inline-block;
}

.challenge-from-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 0.5rem;
}

.challenge-from-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #dc2626, #e17055);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.4rem;
  font-weight: 800;
  font-family: var(--font-display);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

.challenge-from-info strong {
  font-size: 1.15rem;
  font-family: var(--font-display);
  display: block;
}

.challenge-from-elo {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ── Challenge Pending — Red Dot on Avatar ───────────────────── */
.friend-avatar-wrap {
  position: relative;
  display: inline-block;
}

.challenge-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  background: #ef4444;
  border: 2px solid white;
  border-radius: 50%;
  animation: challenge-dot-pulse 1.5s ease-in-out infinite;
}

@keyframes challenge-dot-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { transform: scale(1.15); box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
}

/* ── Challenge Pending Indicator ─────────────────────────────── */
.challenge-pending-icon {
  display: inline-block;
  font-size: 0.9rem;
  animation: challenge-pending-bounce 1s ease-in-out infinite;
  margin-left: 4px;
}

@keyframes challenge-pending-bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-3px);
  }
}

.challenge-pending-label {
  display: inline-block;
  font-size: 0.72rem;
  color: #dc2626;
  font-weight: 700;
  margin-left: 0.5rem;
  animation: fade-pulse 2s ease-in-out infinite;
}

@keyframes fade-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

/* ── Tournament Settings Display ──────────────────────────────── */
.tourney-settings {
  display: block;
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.tournament-create .input-row-3col {
  margin-bottom: 0.75rem;
}

/* ══════════════════════════════════════════════════════════════════
   PDF / IMAGE MODE
   ══════════════════════════════════════════════════════════════════ */

.pdf-mode-actions {
  margin-bottom: 1rem;
}

/* Dropzone */
.pdf-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.3);
  margin-bottom: 1rem;
}

.pdf-dropzone:hover,
.pdf-dropzone.dragover {
  border-color: var(--accent-primary);
  background: rgba(79, 70, 229, 0.05);
}

.pdf-dropzone p {
  margin: 0.5rem 0 0;
}

/* File info strip */
.pdf-file-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: rgba(0, 184, 148, 0.08);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
}

.pdf-file-name,
#pdf-reuse-filename {
  font-weight: 600;
  word-break: break-all;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Page notice */
.pdf-page-notice {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.pdf-page-notice.warning {
  background: rgba(253, 203, 110, 0.15);
  border: 1px solid rgba(253, 203, 110, 0.4);
  color: #b57d10;
}

.pdf-page-notice.info {
  background: rgba(0, 206, 201, 0.1);
  border: 1px solid rgba(0, 206, 201, 0.3);
  color: #00928e;
}

/* Game type toggle */
.pdf-game-type {
  margin: 1rem 0;
}

.pdf-game-type-btns {
  display: flex;
  gap: 0.75rem;
}

.pdf-game-radio {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
  text-align: center;
}

.pdf-game-radio input {
  display: none;
}

.pdf-game-radio.active {
  border-color: #00b894;
  background: rgba(0, 184, 148, 0.08);
  color: #00b894;
}

.pdf-game-radio:hover {
  border-color: #00b894;
}

/* Saved PDFs list */
.saved-pdfs-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.saved-pdf-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
}

.saved-pdf-icon {
  flex-shrink: 0;
  color: #00b894;
}

.saved-pdf-info {
  flex: 1;
  min-width: 0;
}

.saved-pdf-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.saved-pdf-meta {
  font-size: 0.8rem;
  margin-top: 0.2rem;
}

.saved-pdf-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-danger-text {
  color: var(--danger) !important;
}

.btn-danger-text:hover {
  background: rgba(214, 48, 49, 0.08) !important;
}

@media (max-width: 600px) {
  .saved-pdf-card {
    flex-wrap: wrap;
  }

  .saved-pdf-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .pdf-game-type-btns {
    flex-direction: column;
  }
}

/* ── Modal saved PDFs quick-reuse bar ────────────────────────── */
.modal-saved-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.6;
  margin-bottom: 0.5rem;
}

.modal-pdf-saved-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 170px;
  overflow-y: auto;
  margin-bottom: 0.25rem;
  border-radius: var(--radius-md);
}

.modal-saved-pdf-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.85rem;
  background: rgba(0, 184, 148, 0.07);
  border: 1px solid rgba(0, 184, 148, 0.22);
  border-radius: var(--radius-md);
  min-width: 0;
}

.modal-saved-pdf-name {
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.modal-saved-pdf-btn {
  background: linear-gradient(135deg, #00b894, #00cec9) !important;
  flex-shrink: 0;
  min-height: 36px;
  padding: 0 0.9rem;
}

.modal-pdf-or-divider {
  text-align: center;
  color: var(--text-muted, #94a3b8);
  font-size: 0.82rem;
  margin: 0.85rem 0 0.6rem;
  position: relative;
}

.modal-pdf-or-divider::before,
.modal-pdf-or-divider::after {
  content: '';
  display: inline-block;
  width: 28%;
  height: 1px;
  background: var(--border, #e2e8f0);
  vertical-align: middle;
  margin: 0 0.5rem;
}

/* ── PDF modal mobile improvements ──────────────────────────── */
@media (max-width: 768px) {
  #modal-pdf-upload .modal-content,
  #modal-pdf-reuse .modal-content {
    max-height: 92vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .pdf-dropzone {
    padding: 1.75rem 1rem;
  }

  .pdf-game-radio {
    min-height: 44px;
  }

  .modal-saved-pdf-btn {
    min-height: 40px;
  }
}

@media (max-width: 480px) {
  #modal-pdf-upload .modal-content,
  #modal-pdf-reuse .modal-content {
    padding: 1.25rem 1rem;
    max-height: 95vh;
  }

  .modal-pdf-saved-list {
    max-height: 140px;
  }

  .pdf-dropzone {
    padding: 1.25rem 0.75rem;
  }

  .modal-actions {
    flex-direction: column-reverse;
    gap: 0.5rem;
  }

  .modal-actions .btn {
    width: 100%;
    min-height: 48px;
    justify-content: center;
  }
}

/* ── Dark mode for modal saved PDFs ─────────────────────────── */
[data-theme="dark"] .modal-saved-pdf-row {
  background: rgba(0, 184, 148, 0.1);
  border-color: rgba(0, 184, 148, 0.25);
}

/* ═══════════════════════════════════════════════════════════════
   DIAMOND PRO — Subscription Tier Styles
   ═══════════════════════════════════════════════════════════════ */

/* ── Diamond Nav Button ──────────────────────────────────────── */
.diamond-nav-btn { position: relative; }
.diamond-nav-btn .diamond-nav-icon { filter: drop-shadow(0 0 4px rgba(168,85,247,0.5)); transition: filter 0.3s; }
.diamond-nav-btn:hover .diamond-nav-icon { filter: drop-shadow(0 0 8px rgba(251,191,36,0.7)); }
.diamond-nav-btn::after {
  content: 'PRO';
  position: absolute;
  top: 4px; right: 4px;
  font-size: 8px; font-weight: 700; letter-spacing: 0.05em;
  background: linear-gradient(135deg, #a855f7, #fbbf24);
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
  line-height: 1.4;
}

/* ── Diamond Pro Avatar Animated Border ─────────────────────── */
.diamond-pro-avatar {
  position: relative;
  border-radius: 50%;
}
.diamond-pro-avatar::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  z-index: 0;
  background: linear-gradient(135deg, #a855f7, #ec4899, #fbbf24, #a855f7);
  background-size: 300% 300%;
  animation: diamond-border-spin 3s linear infinite;
}
.diamond-pro-avatar > * { position: relative; z-index: 1; }
@keyframes diamond-border-spin {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ── Diamond Pro Badge Icon ──────────────────────────────────── */
.diamond-pro-badge-icon {
  display: inline-block;
  vertical-align: middle;
  filter: drop-shadow(0 0 3px rgba(168,85,247,0.4));
}

/* ── Lock Badge on Diamond Features ─────────────────────────── */
.diamond-lock-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  background: linear-gradient(135deg, #a855f7, #fbbf24);
  color: #fff;
  padding: 2px 7px 2px 5px;
  border-radius: 10px;
  margin-left: 8px;
  vertical-align: middle;
  cursor: pointer;
  transition: opacity 0.2s;
}
.diamond-lock-badge:hover { opacity: 0.85; }

/* ── Bio Narrator Card Grid ─────────────────────────────────── */
.bio-narrator-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 4px;
}
.bio-narrator-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 6px 9px;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  text-align: center;
  font-family: var(--font-display);
  color: var(--text-primary);
  width: 100%;
}
.bio-narrator-card:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.22);
  transform: translateY(-1px);
}
.bio-narrator-card.active {
  border-color: var(--accent-primary);
  background: rgba(108,92,231,0.18);
}
.bio-narrator-card.bio-narrator-locked {
  opacity: 0.72;
}
.bio-narrator-card.bio-narrator-locked:hover {
  opacity: 0.92;
  border-color: rgba(168,85,247,0.5);
}
.bnc-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.bnc-name {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  margin-top: 1px;
}
.bnc-desc {
  font-size: 0.6rem;
  color: var(--text-muted);
  line-height: 1.2;
}
.bnc-lock-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a855f7, #fbbf24);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
@media (max-width: 480px) {
  .bio-narrator-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Super Explain Button ────────────────────────────────────── */
.btn-super-explain {
  background: linear-gradient(135deg, #a855f7 0%, #ec4899 50%, #fbbf24 100%);
  color: #fff;
  border: none;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  display: inline-flex; align-items: center; gap: 4px;
}
.btn-super-explain:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-super-explain.explain-locked { opacity: 0.7; }
.super-explanation { border-left: 3px solid #a855f7 !important; background: rgba(168,85,247,0.06) !important; }

/* ── Loading Tips ────────────────────────────────────────────── */
.generating-tip {
  font-size: 0.8rem;
  color: var(--text-muted, #888);
  max-width: 380px;
  margin: 0.75rem auto 0;
  text-align: center;
  min-height: 2.6em;
  opacity: 0;
  transition: opacity 0.4s ease;
  line-height: 1.5;
  padding: 0 0.5rem;
}
.generating-tip.tip-visible { opacity: 1; }

/* ── Loading screen mobile tweaks ─────────────────────────────── */
@media (max-width: 480px) {
  .overlay-content {
    padding: 1.75rem 1.25rem 1.5rem;
  }
  .loading-perks-strip {
    gap: 0.35rem;
  }
  .loading-perk-chip {
    padding: 0.5rem 0.35rem;
  }
  .loading-perk-icon { font-size: 1.2rem; }
  .loading-perk-label { font-size: 0.67rem; }
  .loading-perk-desc { display: none; }
}

/* ── Diamond Panel ───────────────────────────────────────────── */
.diamond-panel-hero {
  text-align: center;
  padding: 2.5rem 1.5rem 2rem;
  background: linear-gradient(160deg, rgba(168,85,247,0.07) 0%, rgba(251,191,36,0.04) 100%);
  border-radius: 16px;
  margin-bottom: 2rem;
  border: 1px solid rgba(168,85,247,0.15);
}
.diamond-hero-gem {
  margin-bottom: 1rem;
  display: flex; justify-content: center;
}
.diamond-hero-svg {
  filter: drop-shadow(0 4px 16px rgba(168,85,247,0.5));
  animation: gem-pulse 3s ease-in-out infinite;
}
@keyframes gem-pulse {
  0%, 100% { filter: drop-shadow(0 4px 16px rgba(168,85,247,0.5)); }
  50%       { filter: drop-shadow(0 4px 24px rgba(251,191,36,0.7)); }
}
.diamond-hero-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.diamond-gradient-text {
  background: linear-gradient(135deg, #a855f7, #ec4899, #fbbf24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.diamond-hero-sub {
  font-size: 1rem;
  color: var(--text-muted, #888);
  max-width: 480px;
  margin: 0 auto 1.5rem;
  line-height: 1.6;
}
.diamond-upgrade-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, #a855f7, #ec4899, #fbbf24);
  color: #fff; font-weight: 700; font-size: 1rem;
  padding: 0.75rem 2rem; border-radius: 10px;
  border: none; cursor: pointer;
  box-shadow: 0 4px 20px rgba(168,85,247,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}
.diamond-upgrade-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 28px rgba(168,85,247,0.5); }
.diamond-upgrade-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.diamond-bog-btn { background: linear-gradient(135deg, #e85d04, #f48c06); box-shadow: 0 4px 20px rgba(232,93,4,0.4); }
.diamond-bog-btn:hover { box-shadow: 0 6px 28px rgba(232,93,4,0.5); }
.diamond-payment-btns { display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: center; }
.diamond-cta-note { font-size: 0.75rem; color: var(--text-muted, #888); margin-top: 0.5rem; text-align: center; }
.diamond-plan-card {
  background: linear-gradient(135deg, rgba(168,85,247,0.08), rgba(236,72,153,0.06), rgba(251,191,36,0.05));
  border: 2px solid rgba(168,85,247,0.3);
  border-radius: 16px;
  padding: 1.5rem 1.75rem;
  margin: 1.5rem auto 0;
  max-width: 420px;
  text-align: center;
}
.diamond-plan-header { display: flex; align-items: center; justify-content: center; gap: 0.6rem; margin-bottom: 0.5rem; }
.diamond-plan-name { font-size: 1.3rem; font-weight: 800; background: linear-gradient(135deg, #a855f7, #ec4899); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.diamond-plan-tag {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.08em;
  background: linear-gradient(135deg, #a855f7, #ec4899); color: #fff;
  padding: 0.15rem 0.5rem; border-radius: 6px;
}
.diamond-plan-desc { font-size: 0.85rem; color: var(--text-muted, #888); margin-bottom: 0.75rem; }
.diamond-plan-perks {
  list-style: none; padding: 0; margin: 0 0 1rem; text-align: left;
}
.diamond-plan-perks li {
  font-size: 0.82rem; color: var(--text-primary, #333);
  padding: 0.3rem 0; padding-left: 1.2rem; position: relative;
}
.diamond-plan-perks li::before { content: "✦"; position: absolute; left: 0; color: #a855f7; font-size: 0.7rem; }
.diamond-active-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, rgba(168,85,247,0.15), rgba(251,191,36,0.1));
  border: 1.5px solid rgba(168,85,247,0.4);
  color: #a855f7; font-weight: 700; font-size: 1rem;
  padding: 0.6rem 1.5rem; border-radius: 10px;
}
.diamond-manage-area {
  margin-top: 1rem; text-align: center;
}
.diamond-expiry-text {
  color: var(--text-secondary, #666); font-size: 0.9rem; margin: 0.3rem 0;
}
.diamond-method-text {
  color: var(--text-muted, #888); font-size: 0.8rem; margin: 0.2rem 0 0.8rem;
}
.diamond-cancel-btn {
  background: transparent; color: #ef4444; border: 1.5px solid rgba(239,68,68,0.3);
  padding: 0.5rem 1.2rem; border-radius: 8px; font-size: 0.85rem; cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.diamond-cancel-btn:hover {
  background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.5);
}
.diamond-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.diamond-feature-card {
  background: var(--bg-card, rgba(255,255,255,0.85));
  border: 1.5px solid var(--border-color, rgba(0,0,0,0.08));
  border-radius: 14px;
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.diamond-feature-card:hover {
  border-color: rgba(168,85,247,0.4);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(168,85,247,0.12);
}
.diamond-feature-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background-color: rgba(0, 0, 0, 0.05);
  color: var(--fc, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1.5px solid rgba(0, 0, 0, 0.07);
  position: relative;
  overflow: hidden;
}
.diamond-feature-icon-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background: currentColor;
  opacity: 0.1;
  border-radius: inherit;
}
.diamond-feature-body {
  flex: 1;
  min-width: 0;
}
.diamond-feature-card h3 {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--text-primary, #2d2d2d);
  font-family: var(--font-display, sans-serif);
}
.diamond-feature-card p {
  font-size: 0.8rem;
  color: var(--text-muted, #888);
  line-height: 1.5;
  margin: 0;
}

/* ── Diamond Limits Table ────────────────────────────────────── */
.diamond-limits-table {
  background: var(--bg-card, rgba(255,255,255,0.85));
  border: 1.5px solid var(--border-color, rgba(0,0,0,0.08));
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.diamond-limits-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  font-family: var(--font-display, sans-serif);
  color: var(--text-primary, #2d2d2d);
}
.diamond-limits-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  font-size: 0.84rem;
  row-gap: 0;
  column-gap: 1rem;
  font-family: var(--font-display, sans-serif);
}
.diamond-limits-grid > div {
  padding: 0.55rem 0.3rem;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
}
.diamond-limits-grid > div:nth-last-child(-n+3) {
  border-bottom: none;
}
.dl-header {
  font-weight: 700;
  color: var(--text-muted, #888);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 2px solid rgba(0,0,0,0.1) !important;
  padding-bottom: 0.5rem;
}
.dl-diamond { color: #9333ea; font-weight: 700; }

/* ═══════════════════════════════════════════════════════════════
   CUSTOM QUIZ CREATOR
   ═══════════════════════════════════════════════════════════════ */
.cq-question-card {
  padding: 1rem;
  border: 2px solid var(--border-color);
  border-left: 4px solid #e17055;
  border-radius: var(--radius-md);
  position: relative;
}
.cq-q-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.cq-q-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: #e17055;
}
.cq-remove-btn {
  font-size: 1.3rem !important;
  line-height: 1;
  padding: 0.2rem 0.5rem !important;
  color: #ef4444 !important;
}
.cq-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.cq-img-upload {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.cq-img-name {
  font-size: 0.8rem;
  color: var(--text-muted);
  word-break: break-all;
}
.cq-img-preview {
  max-width: 120px;
  max-height: 80px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  object-fit: cover;
  margin-top: 0.5rem;
}
.cq-q-image {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  display: block;
}
@media (max-width: 480px) {
  .cq-options-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════
   THEME SELECTOR CARDS
   ═══════════════════════════════════════════════════════════════ */
.theme-selector-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.theme-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 0.5rem 0.65rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.theme-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.theme-card.active {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.theme-card.active::after {
  content: "✓";
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 0.7rem;
  font-weight: 800;
  color: white;
  background: var(--accent-primary);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.theme-preview {
  width: 100%;
  height: 56px;
  border-radius: 6px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  overflow: hidden;
}

.theme-preview-line {
  width: 100%;
  height: 2px;
  border-radius: 1px;
}

.theme-preview-dot {
  position: absolute;
  bottom: 8px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Notebook Preview */
.theme-preview-notebook {
  background: #f9f7f1;
  border: 1px solid #e5e7eb;
}
.theme-preview-notebook .theme-preview-line {
  background: rgba(164, 191, 227, 0.45);
}

/* Dark Preview */
.theme-preview-dark {
  background: #1a1a2e;
  border: 1px solid #2a2a4a;
}
.theme-preview-dark .theme-preview-line {
  background: rgba(129, 140, 248, 0.2);
}

/* Focus Preview */
.theme-preview-focus {
  background: #e5e5e5;
  border: 1px solid #ccc;
}
.theme-preview-focus .theme-preview-line {
  background: rgba(0, 0, 0, 0.12);
}

.theme-card-label {
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--text-primary);
}

.theme-card-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-display);
}

@media (max-width: 480px) {
  .theme-selector-grid {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem;
  }
  .theme-card {
    padding: 0.6rem 0.35rem 0.5rem;
  }
  .theme-preview {
    height: 42px;
  }
}


/* ═══════════════════════════════════════════════════════════════
   DARK MODE THEME
   A dark notebook with white text, keeping the same layout.
   ═══════════════════════════════════════════════════════════════ */
[data-theme="dark"] {
  --bg-primary: #0f0f1a;
  --bg-secondary: #16162a;
  --bg-tertiary: #1c1c32;
  --bg-card: rgba(28, 28, 50, 0.92);
  --bg-glass: rgba(22, 22, 42, 0.88);
  --bg-hover: rgba(140, 140, 200, 0.08);

  --text-primary: #dcdce8;
  --text-secondary: #9a9ab4;
  --text-muted: #5f5f78;

  --accent-primary: #9a9ad4;
  --accent-secondary: #6ec6d6;
  --accent-warm: #d4a54a;
  --accent-danger: #e07070;
  --accent-success: #50b88a;

  --gradient-main: linear-gradient(135deg, #7c7cbf 0%, #6ec6d6 100%);
  --gradient-warm: linear-gradient(135deg, #d4a54a 0%, #e07070 100%);
  --gradient-danger: linear-gradient(135deg, #e07070 0%, #c55050 100%);
  --gradient-success: linear-gradient(135deg, #50b88a 0%, #6ec6d6 100%);

  --border-color: rgba(255, 255, 255, 0.07);
  --border-glow: rgba(140, 140, 200, 0.25);

  --shadow-sm: 2px 3px 6px rgba(0, 0, 0, 0.35);
  --shadow-md: 2px 4px 10px rgba(0, 0, 0, 0.4);
  --shadow-lg: 3px 6px 20px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(140, 140, 200, 0.1);

  --line-blue: rgba(120, 120, 180, 0.12);
  --paper-bg: #0f0f1a;
  --sidebar-bg: #12122a;
  --yellow-note: #302a18;
  --yellow-note-dark: #3a3218;
  --tape-color: rgba(48, 42, 24, 0.65);
}

/* Dark body */
[data-theme="dark"] body {
  background: #0f0f1a;
  color: #dcdce8;
}

/* Dark scrollbar */
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #33335a;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: #4a4a70;
}

/* Dark selection */
[data-theme="dark"] ::selection {
  background: #4a4a80;
  color: #fff;
}

/* Dark particles */
[data-theme="dark"] #particles-canvas {
  opacity: 0.04;
}

/* ── Main content: keep notebook lines ─────────────────── */
[data-theme="dark"] .main-content {
  background-color: #0f0f1a;
  background-image:
    linear-gradient(rgba(120, 120, 180, 0.08) 1px, transparent 1px);
  background-size: 100% 2rem;
}

/* Auth / Background lined areas */
[data-theme="dark"] #view-auth,
[data-theme="dark"] #view-profile-setup {
  background-color: #0f0f1a;
  background-image:
    linear-gradient(rgba(120, 120, 180, 0.06) 1px, transparent 1px);
  background-size: 100% 2rem;
}

/* Auth card */
[data-theme="dark"] .auth-card {
  background: #1c1c32;
  border-color: rgba(255, 255, 255, 0.08);
}

/* Auth tabs */
[data-theme="dark"] .auth-tabs {
  background: #12122a;
  border-color: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .auth-tab {
  color: #5f5f78;
}
[data-theme="dark"] .auth-tab.active {
  background: #7c7cbf;
  color: white;
}

/* Inputs */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="url"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] select {
  background: #1a1a30;
  border-color: rgba(255, 255, 255, 0.1);
  color: #dcdce8;
}
[data-theme="dark"] input::placeholder {
  color: #4a4a65;
}
[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus {
  border-color: #7c7cbf;
  box-shadow: 0 0 0 3px rgba(124, 124, 191, 0.12);
}

/* Top Nav */
[data-theme="dark"] .top-nav {
  background: rgba(15, 15, 26, 0.94);
  border-bottom-color: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
}
[data-theme="dark"] .brand-text {
  color: #b8b8d8;
}
[data-theme="dark"] .nav-username {
  color: #dcdce8;
}

/* Logo */
[data-theme="dark"] .logo-text {
  color: #b8b8d8;
}
[data-theme="dark"] .logo-icon svg rect {
  fill: #7c7cbf;
}
[data-theme="dark"] .nav-brand svg rect {
  fill: #7c7cbf;
}

/* Sidebar */
[data-theme="dark"] .sidebar {
  background: #12122a;
  border-right-color: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .sidebar-btn {
  color: #9a9ab4;
}
[data-theme="dark"] .sidebar-btn:hover {
  background: rgba(140, 140, 200, 0.08);
  color: #b8b8d8;
}
[data-theme="dark"] .sidebar-btn.active {
  background: rgba(140, 140, 200, 0.12);
  color: #9a9ad4;
}

/* ── Chat sidebar ──────────────────────────────────────── */
[data-theme="dark"] .chat-sidebar {
  background: #12122a;
  border-left-color: rgba(255, 255, 255, 0.06);
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .chat-header {
  border-bottom-color: rgba(255, 255, 255, 0.06);
  background: rgba(18, 18, 42, 0.8);
}
[data-theme="dark"] .chat-messages {
  background: #0f0f1a;
}
[data-theme="dark"] .chat-input-row {
  background: #16162a;
  border-top-color: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .chat-input-row input {
  background: #1a1a30;
  border-color: rgba(255, 255, 255, 0.1);
  color: #dcdce8;
}
[data-theme="dark"] .chat-input-row button {
  background: #7c7cbf;
}

/* Btn ghost */
[data-theme="dark"] .btn-ghost {
  background: #1c1c32;
  color: #9a9ab4;
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .btn-ghost:hover {
  border-color: #7c7cbf;
  color: #9a9ad4;
  background: rgba(140, 140, 200, 0.08);
}

/* Glass card */
[data-theme="dark"] .glass-card {
  background: rgba(28, 28, 50, 0.92);
  border-color: rgba(255, 255, 255, 0.07);
}

/* Glow card */
[data-theme="dark"] .glow-card {
  background: rgba(28, 28, 50, 0.92);
  border-color: rgba(255, 255, 255, 0.07);
}
[data-theme="dark"] .glow-card:hover {
  border-color: rgba(140, 140, 200, 0.25);
}

/* ── Action cards (Home page) ──────────────────────────── */
[data-theme="dark"] #card-quick-game {
  background: rgba(59, 130, 246, 0.06);
  border-color: rgba(59, 130, 246, 0.15);
}
[data-theme="dark"] #card-quick-game .action-card-icon {
  background: rgba(59, 130, 246, 0.12);
}
[data-theme="dark"] #card-custom-game {
  background: rgba(6, 182, 212, 0.06);
  border-color: rgba(6, 182, 212, 0.15);
}
[data-theme="dark"] #card-custom-game .action-card-icon {
  background: rgba(6, 182, 212, 0.12);
}
[data-theme="dark"] #card-preset-game {
  background: rgba(22, 163, 74, 0.06);
  border-color: rgba(22, 163, 74, 0.15);
}
[data-theme="dark"] #card-preset-game .action-card-icon {
  background: rgba(22, 163, 74, 0.12);
}
[data-theme="dark"] #card-solo-mode {
  background: rgba(202, 138, 4, 0.06);
  border-color: rgba(202, 138, 4, 0.15);
}
[data-theme="dark"] #card-solo-mode .action-card-icon {
  background: rgba(202, 138, 4, 0.12);
}
[data-theme="dark"] #card-tournament-mode {
  background: rgba(147, 51, 234, 0.06);
  border-color: rgba(147, 51, 234, 0.15);
}
[data-theme="dark"] #card-tournament-mode .action-card-icon {
  background: rgba(147, 51, 234, 0.12);
}
[data-theme="dark"] #card-wrong-answers {
  background: rgba(225, 29, 72, 0.06);
  border-color: rgba(225, 29, 72, 0.15);
}
[data-theme="dark"] #card-wrong-answers .action-card-icon {
  background: rgba(225, 29, 72, 0.12);
}

/* PDF / Image Mode card */
[data-theme="dark"] #card-pdf-mode {
  background: rgba(0, 184, 148, 0.06);
  border-color: rgba(0, 184, 148, 0.18);
}
[data-theme="dark"] #card-pdf-mode .action-card-icon {
  background: rgba(0, 184, 148, 0.12);
}
[data-theme="dark"] .pdf-reuse-section {
  border-color: rgba(255, 255, 255, 0.08);
}

/* ── Leaderboard rows ──────────────────────────────────── */
[data-theme="dark"] .lb-row {
  background: #1c1c32;
  border-color: rgba(255, 255, 255, 0.07);
  box-shadow: none;
}
[data-theme="dark"] .lb-row:hover {
  background: #22224a;
  border-color: rgba(140, 140, 200, 0.2);
}
[data-theme="dark"] .lb-row.lb-header {
  background: transparent;
  border: none;
}
/* Top 3 leaderboard rows */
[data-theme="dark"] .lb-row:nth-child(2) {
  background: linear-gradient(90deg, rgba(234, 179, 8, 0.08) 0%, #1c1c32 100%);
  border-color: rgba(234, 179, 8, 0.2);
}
[data-theme="dark"] .lb-row:nth-child(3) {
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.06) 0%, #1c1c32 100%);
  border-color: rgba(148, 163, 184, 0.15);
}
[data-theme="dark"] .lb-row:nth-child(4) {
  background: linear-gradient(90deg, rgba(180, 83, 9, 0.06) 0%, #1c1c32 100%);
  border-color: rgba(180, 83, 9, 0.15);
}

/* ── Rank badges ───────────────────────────────────────── */
[data-theme="dark"] .lb-badge {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  color: #9a9ab4;
}
[data-theme="dark"] .lb-badge[style*="cd7f32"] { background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.3); color: #d4a54a; }
[data-theme="dark"] .lb-badge[style*="c0c0c0"] { background: rgba(148, 163, 184, 0.1); border-color: rgba(148, 163, 184, 0.25); color: #9a9ab4; }
[data-theme="dark"] .lb-badge[style*="ffd700"] { background: rgba(234, 179, 8, 0.12); border-color: rgba(234, 179, 8, 0.3); color: #d4a54a; }
[data-theme="dark"] .lb-badge[style*="e5e4e2"] { background: rgba(125, 211, 252, 0.08); border-color: rgba(125, 211, 252, 0.2); color: #6ec6d6; }
[data-theme="dark"] .lb-badge[style*="b9f2ff"] { background: rgba(34, 211, 238, 0.08); border-color: rgba(34, 211, 238, 0.2); color: #6ec6d6; }
[data-theme="dark"] .lb-badge[style*="9b59b6"] { background: rgba(168, 85, 247, 0.1); border-color: rgba(168, 85, 247, 0.25); color: #b88ae8; }
[data-theme="dark"] .lb-badge[style*="e74c3c"] { background: rgba(244, 63, 94, 0.1); border-color: rgba(244, 63, 94, 0.2); color: #e07070; }

/* ── Friends ───────────────────────────────────────────── */
[data-theme="dark"] .friend-item {
  background: #1c1c32;
  border-color: rgba(255, 255, 255, 0.07);
}
[data-theme="dark"] .friend-item:hover {
  border-color: rgba(140, 140, 200, 0.2);
}

/* ── Profile stats ─────────────────────────────────────── */
[data-theme="dark"] .stat-card {
  background: #1c1c32;
  border-color: rgba(255, 255, 255, 0.07);
}
/* Category stat bar bg */
[data-theme="dark"] .cat-stat-bar {
  background: #2a2a4a;
}

/* ── DM Messages ───────────────────────────────────────── */
[data-theme="dark"] .dm-msg.sent {
  background: rgba(124, 124, 191, 0.1);
  border-color: rgba(124, 124, 191, 0.2);
}
[data-theme="dark"] .dm-msg.received {
  background: #1c1c32;
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .dm-input-row input {
  background: #1a1a30;
  border-color: rgba(255, 255, 255, 0.1);
  color: #dcdce8;
}

/* Google btn */
[data-theme="dark"] .qv-google-btn {
  background: #1c1c32;
  border-color: rgba(255, 255, 255, 0.1);
  color: #dcdce8;
}
[data-theme="dark"] .qv-google-btn:hover {
  background: #22224a;
  border-color: rgba(255, 255, 255, 0.15);
}

/* Divider */
[data-theme="dark"] .qv-divider::before,
[data-theme="dark"] .qv-divider::after {
  background: rgba(255, 255, 255, 0.08);
}

/* Modals */
[data-theme="dark"] .modal-card {
  background: #1c1c32;
  border-color: rgba(255, 255, 255, 0.1);
}

/* ── Overlays ──────────────────────────────────────────── */
[data-theme="dark"] .overlay {
  background: rgba(5, 5, 15, 0.85);
}
[data-theme="dark"] .overlay-content {
  color: #dcdce8;
}
[data-theme="dark"] .loading-perk-chip {
  background: linear-gradient(135deg, rgba(168,85,247,0.12), rgba(251,191,36,0.08));
  border-color: rgba(168,85,247,0.28);
}
[data-theme="dark"] .game-option {
  background: #1c1c32;
  border-color: rgba(255,255,255,0.12);
  color: #e8e8f0;
}
[data-theme="dark"] .game-option:hover:not(.disabled):not(.selected):not(.correct):not(.wrong) {
  background: rgba(79,70,229,0.15);
  border-color: var(--accent-primary);
}
[data-theme="dark"] .game-option.selected:not(.correct):not(.wrong) {
  background: rgba(79,70,229,0.2) !important;
}

/* Game view */
[data-theme="dark"] .game-card {
  background: #1c1c32;
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .game-option {
  background: #1a1a30;
  border-color: rgba(255, 255, 255, 0.1);
  color: #dcdce8;
}
[data-theme="dark"] .game-option:hover:not(.disabled) {
  border-color: #7c7cbf;
  background: rgba(140, 140, 200, 0.08);
}

/* Toast */
[data-theme="dark"] .toast {
  background: #1c1c32;
  color: #dcdce8;
  border-color: rgba(255, 255, 255, 0.08);
}

/* Mobile nav */
[data-theme="dark"] .mobile-nav {
  background: #12122a;
  border-top-color: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .mobile-nav-btn {
  color: #5f5f78;
}
[data-theme="dark"] .mobile-nav-btn.active {
  color: #9a9ad4;
}

/* Mobile more menu */
[data-theme="dark"] .mobile-more-content {
  background: #1c1c32;
}
[data-theme="dark"] .mobile-more-item {
  color: #9a9ab4;
}

/* Mobile chat overlay */
[data-theme="dark"] .mobile-chat-overlay {
  background: #0f0f1a;
}
[data-theme="dark"] .mobile-chat-header {
  background: #12122a;
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

/* Toggle switch */
[data-theme="dark"] .toggle-switch {
  background: #33335a;
  border-color: #44446a;
}

/* Wrong q cards */
[data-theme="dark"] .wrong-q-card {
  background: #1c1c32;
  border-color: rgba(255, 255, 255, 0.08);
}

/* Lobby */
[data-theme="dark"] .lobby-player-card {
  background: #1c1c32;
  border-color: rgba(255, 255, 255, 0.08);
}

/* Profile */
[data-theme="dark"] .profile-rank-badge {
  background: rgba(140, 140, 200, 0.1);
}
[data-theme="dark"] .profile-bio-text {
  background: rgba(140, 140, 200, 0.04);
}

/* Diamond panel */
[data-theme="dark"] .diamond-plan-card {
  background: rgba(28, 28, 50, 0.95);
  border-color: rgba(168, 85, 247, 0.2);
}
[data-theme="dark"] .diamond-feature-card {
  background: rgba(28, 28, 50, 0.85);
  border-color: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .diamond-limits-grid > div {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

/* Lobby view */
[data-theme="dark"] #view-lobby {
  background: #0f0f1a;
}

/* Game view */
[data-theme="dark"] #view-game {
  background: #0f0f1a;
}

/* ── Browse panel ──────────────────────────────────────── */
[data-theme="dark"] .lobby-table th {
  background: #16162a;
  color: #9a9ab4;
  border-bottom-color: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .lobby-table td {
  border-bottom-color: rgba(255, 255, 255, 0.05);
}

/* ── Settings ──────────────────────────────────────────── */
[data-theme="dark"] .settings-actions {
  border-color: rgba(255, 255, 255, 0.06);
}

/* ── Notification badge ────────────────────────────────── */
[data-theme="dark"] .sidebar-badge {
  background: #e07070;
}

/* ── PDF select / dropdowns ────────────────────────────── */
[data-theme="dark"] .pdf-select,
[data-theme="dark"] .custom-select {
  background: #1a1a30;
  color: #dcdce8;
  border-color: rgba(255, 255, 255, 0.1);
}

/* ── Bio narrator cards ────────────────────────────────── */
[data-theme="dark"] .bio-narrator-card {
  background: #1c1c32;
  border-color: rgba(255, 255, 255, 0.07);
}
[data-theme="dark"] .bio-narrator-card:hover {
  border-color: rgba(140, 140, 200, 0.2);
}
[data-theme="dark"] .bio-narrator-card.active {
  border-color: #7c7cbf;
}

/* ── Theme card in dark ────────────────────────────────── */
[data-theme="dark"] .theme-card {
  background: #1c1c32;
  border-color: rgba(255, 255, 255, 0.07);
}
[data-theme="dark"] .theme-card:hover {
  border-color: #7c7cbf;
}
[data-theme="dark"] .theme-card.active {
  border-color: #7c7cbf;
  box-shadow: 0 0 0 3px rgba(124, 124, 191, 0.15);
}
[data-theme="dark"] .theme-card.active::after {
  background: #7c7cbf;
}

/* ── Dark: Lobby view lines ──────────────────────────── */
[data-theme="dark"] #view-lobby {
  background-color: #0f0f1a;
  background-image: linear-gradient(rgba(120,120,180,0.06) 1px, transparent 1px);
  background-size: 100% 2rem;
}
[data-theme="dark"] .lobby-info-card {
  background: #1c1c32;
  border-color: rgba(255,255,255,0.08);
}

/* ── Dark: Game view lines ───────────────────────────── */
[data-theme="dark"] #view-game {
  background-color: #0f0f1a;
  background-image: linear-gradient(rgba(120,120,180,0.06) 1px, transparent 1px);
  background-size: 100% 2rem;
}
[data-theme="dark"] .game-players-sidebar {
  background: rgba(18,18,42,0.9);
  border-right-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .game-timer-bar {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .game-room-title {
  background: #1c1c32;
  color: #5f5f78;
}
[data-theme="dark"] .game-feedback.correct {
  background: rgba(80,184,138,0.1);
  border-color: rgba(80,184,138,0.3);
  color: #50b88a;
}
[data-theme="dark"] .game-feedback.wrong {
  background: rgba(224,112,112,0.1);
  border-color: rgba(224,112,112,0.3);
  color: #e07070;
}
[data-theme="dark"] .game-feedback.timeout {
  background: rgba(212,165,74,0.1);
  border-color: rgba(212,165,74,0.3);
  color: #d4a54a;
}
[data-theme="dark"] .game-option.correct {
  border-color: #50b88a !important;
  background: rgba(80,184,138,0.12) !important;
}
[data-theme="dark"] .game-option.correct .option-letter {
  background: #50b88a;
  color: white;
  border-color: #50b88a;
}
[data-theme="dark"] .game-option.wrong {
  border-color: #e07070 !important;
  background: rgba(224,112,112,0.12) !important;
}
[data-theme="dark"] .game-option.wrong .option-letter {
  background: #e07070;
  color: white;
  border-color: #e07070;
}
[data-theme="dark"] .game-option .option-letter {
  background: rgba(140,140,200,0.12);
  border-color: rgba(140,140,200,0.25);
  color: #9a9ad4;
}
[data-theme="dark"] .game-over-container,
[data-theme="dark"] .game-results-card,
[data-theme="dark"] .round-results-overlay {
  background: rgba(20,20,40,0.95);
  border-color: rgba(255,255,255,0.08);
  color: #dcdce8;
}
[data-theme="dark"] .game-chat-panel {
  background: rgba(18,18,42,0.95);
  border-color: rgba(255,255,255,0.08);
}

/* ── Dark: Wrong answers extras ──────────────────────── */
[data-theme="dark"] .wrong-q-card {
  border-left-color: #e07070;
}
[data-theme="dark"] .wrong-q-answer.your-wrong {
  background: rgba(224,112,112,0.08);
  border-color: rgba(224,112,112,0.25);
  color: #e07070;
}
[data-theme="dark"] .wrong-q-answer.correct-ans {
  background: rgba(80,184,138,0.08);
  border-color: rgba(80,184,138,0.25);
  color: #50b88a;
}
[data-theme="dark"] .wrong-q-diff.easy { background: rgba(80,184,138,0.08); border-color: rgba(80,184,138,0.25); color: #50b88a; }
[data-theme="dark"] .wrong-q-diff.medium { background: rgba(212,165,74,0.08); border-color: rgba(212,165,74,0.25); color: #d4a54a; }
[data-theme="dark"] .wrong-q-diff.hard { background: rgba(224,112,112,0.08); border-color: rgba(224,112,112,0.25); color: #e07070; }
[data-theme="dark"] .btn-explain { background: rgba(140,140,200,0.1); border-color: rgba(140,140,200,0.25); color: #9a9ad4; }
[data-theme="dark"] .btn-explain:hover { background: rgba(140,140,200,0.18); }
[data-theme="dark"] .wrong-q-explanation { background: rgba(140,140,200,0.06); border-color: rgba(140,140,200,0.15); color: #b8b8d8; }

/* ── Dark: Generating overlay ────────────────────────── */
[data-theme="dark"] #view-generating { background-color: #0f0f1a; }
[data-theme="dark"] .ingame-profile-popup { background: #1c1c32; border-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .profile-clickable-header:hover { background: rgba(129,140,248,0.1); box-shadow: 0 0 0 2px rgba(129,140,248,0.2); }
[data-theme="dark"] .igp-stat { background: rgba(255,255,255,0.04); }

/* ── Dark: Custom quiz creator ───────────────────────── */
[data-theme="dark"] .cq-question-card {
  background: #1c1c32;
  border-color: rgba(255,255,255,0.08);
  border-left-color: #e17055;
}
[data-theme="dark"] .cq-q-num { color: #ff8c69; }
[data-theme="dark"] #card-custom-quiz {
  background: rgba(225,112,85,0.06);
  border-color: rgba(225,112,85,0.15);
}
[data-theme="dark"] #card-custom-quiz .action-card-icon {
  background: rgba(225,112,85,0.12);
}

/* ── Dark: Tournament ────────────────────────────────── */
[data-theme="dark"] .tournament-card {
  background: #1c1c32;
  border-color: rgba(255,255,255,0.07);
}
[data-theme="dark"] .tournament-card:hover {
  border-color: rgba(140,140,200,0.2);
}

/* ── Dark: Game Over View ───────────────────────────── */
[data-theme="dark"] #view-game-over {
  background-color: #0f0f1a;
  background-image: linear-gradient(rgba(120,120,180,0.06) 1px, transparent 1px);
  background-size: 100% 2rem;
}
[data-theme="dark"] .game-over-card {
  background: #1c1c32;
  border-color: rgba(255,255,255,0.08);
  color: #dcdce8;
}
[data-theme="dark"] .go-score-card {
  background: #16162a;
  border-color: rgba(255,255,255,0.08);
  color: #dcdce8;
}
[data-theme="dark"] .go-score-card.winner {
  border-color: #50b88a;
  background: rgba(80,184,138,0.08);
}
[data-theme="dark"] .go-score-name {
  color: #b8b8d8;
}
[data-theme="dark"] .review-item {
  background: #16162a;
  border-color: rgba(255,255,255,0.08);
  color: #dcdce8;
}
[data-theme="dark"] .review-item.review-correct {
  border-left-color: #50b88a;
}
[data-theme="dark"] .review-item.review-wrong {
  border-left-color: #e07070;
}
[data-theme="dark"] .review-item.review-timeout {
  border-left-color: #d4a54a;
}
[data-theme="dark"] .review-question {
  color: #dcdce8;
}
[data-theme="dark"] .review-your-answer {
  color: #e07070;
}
[data-theme="dark"] .review-correct-answer {
  color: #50b88a;
}
[data-theme="dark"] .game-over-review h3 {
  color: #9a9ab4;
}
[data-theme="dark"] .game-over-actions .btn-ghost {
  background: #1c1c32;
  color: #9a9ab4;
  border-color: rgba(255,255,255,0.08);
}
[data-theme="dark"] .game-over-actions .btn-ghost:hover {
  border-color: #7c7cbf;
  color: #b8b8d8;
}

/* ── Dark: Lobby Items ──────────────────────────────── */
[data-theme="dark"] .lobby-item {
  background: #1c1c32;
  border-color: rgba(255,255,255,0.08);
  color: #dcdce8;
}
[data-theme="dark"] .lobby-item:hover {
  background: #22224a;
  border-color: rgba(140,140,200,0.2);
}

/* ── Dark: Empty State ──────────────────────────────── */
[data-theme="dark"] .empty-state {
  background: rgba(28,28,50,0.6);
  border-color: rgba(255,255,255,0.08);
  color: #5f5f78;
}

/* ── Dark: Notif Panel ──────────────────────────────── */
[data-theme="dark"] .notif-panel {
  background: #1c1c32;
  border-color: rgba(255,255,255,0.08);
}
[data-theme="dark"] .notif-item {
  border-bottom-color: rgba(255,255,255,0.06);
}

/* ═══════════════════════════════════════════════════════════════
   FOCUS MODE THEME
   Minimal, grey, barebones — no fancy fonts, no flashy colors,
   no extra visual elements. Pure concentration.
   ═══════════════════════════════════════════════════════════════ */
[data-theme="focus"] {
  --bg-primary: #e8e8e8;
  --bg-secondary: #ddd;
  --bg-tertiary: #d2d2d2;
  --bg-card: #f0f0f0;
  --bg-glass: rgba(240, 240, 240, 0.95);
  --bg-hover: rgba(0, 0, 0, 0.04);

  --text-primary: #222;
  --text-secondary: #555;
  --text-muted: #888;

  --accent-primary: #555;
  --accent-secondary: #666;
  --accent-warm: #777;
  --accent-danger: #b00;
  --accent-success: #070;

  --gradient-main: linear-gradient(135deg, #555 0%, #666 100%);
  --gradient-warm: linear-gradient(135deg, #777 0%, #888 100%);
  --gradient-danger: linear-gradient(135deg, #b00 0%, #900 100%);
  --gradient-success: linear-gradient(135deg, #070 0%, #090 100%);

  --border-color: rgba(0, 0, 0, 0.15);
  --border-glow: rgba(0, 0, 0, 0.3);

  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --shadow-glow: none;

  --line-blue: transparent;
  --paper-bg: #e8e8e8;
  --sidebar-bg: #f0f0f0;

  --font-display: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Consolas", "Courier New", monospace;
}

/* Focus body */
[data-theme="focus"] body {
  background: #e8e8e8;
  color: #222;
}

/* No particles */
[data-theme="focus"] #particles-canvas {
  display: none !important;
}

/* No box-shadows anywhere */
[data-theme="focus"] .glow-card,
[data-theme="focus"] .glass-card,
[data-theme="focus"] .auth-card,
[data-theme="focus"] .btn,
[data-theme="focus"] .modal-card {
  box-shadow: none;
}

[data-theme="focus"] .glow-card:hover {
  transform: none;
  box-shadow: none;
}

/* Flat buttons */
[data-theme="focus"] .btn {
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0;
  box-shadow: none;
}
[data-theme="focus"] .btn::after {
  display: none;
}
[data-theme="focus"] .btn-primary {
  background: #555;
  color: white;
  box-shadow: none;
}
[data-theme="focus"] .btn-primary:hover {
  background: #444;
  box-shadow: none;
}
[data-theme="focus"] .btn-accent {
  background: #666;
  color: white;
  box-shadow: none;
}
[data-theme="focus"] .btn-warm {
  background: #777;
  color: white;
  box-shadow: none;
}
[data-theme="focus"] .btn-danger {
  background: #b00;
  color: white;
  box-shadow: none;
}
[data-theme="focus"] .btn-ghost {
  background: #f0f0f0;
  color: #555;
  border: 1px solid rgba(0, 0, 0, 0.2);
  box-shadow: none;
}
[data-theme="focus"] .btn-ghost:hover {
  border-color: #444;
  color: #333;
  background: #e8e8e8;
}

/* Flat inputs */
[data-theme="focus"] input[type="text"],
[data-theme="focus"] input[type="password"],
[data-theme="focus"] input[type="email"],
[data-theme="focus"] input[type="url"],
[data-theme="focus"] input[type="number"],
[data-theme="focus"] select {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  color: #222;
}
[data-theme="focus"] input:focus,
[data-theme="focus"] select:focus {
  border-color: #444;
  box-shadow: none;
}

/* No animations on cards */
[data-theme="focus"] .action-card-icon {
  animation: none !important;
}
[data-theme="focus"] .logo-icon {
  animation: none !important;
}

/* Plain auth */
[data-theme="focus"] #view-auth,
[data-theme="focus"] #view-profile-setup {
  background-color: #e8e8e8;
  background-image: none;
}
[data-theme="focus"] .auth-card {
  background: #f5f5f5;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}
[data-theme="focus"] .auth-tabs {
  background: #eee;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  padding: 2px;
}
[data-theme="focus"] .auth-tab {
  border-radius: 3px;
}
[data-theme="focus"] .auth-tab.active {
  background: #555;
  color: white;
}

/* Plain sidebar */
[data-theme="focus"] .sidebar {
  background: #f0f0f0;
  border-right: 1px solid rgba(0, 0, 0, 0.1);
}

/* Plain top nav */
[data-theme="focus"] .top-nav {
  background: #f0f0f0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  backdrop-filter: none;
}
[data-theme="focus"] .brand-text {
  color: #333;
  letter-spacing: 1px;
}
[data-theme="focus"] .logo-text {
  color: #333;
  letter-spacing: 2px;
}
[data-theme="focus"] .logo-icon svg rect {
  fill: #555;
}
[data-theme="focus"] .nav-brand svg rect {
  fill: #555;
}

/* Plain chat sidebar */
[data-theme="focus"] .chat-sidebar {
  background: #f0f0f0;
  border-left: 1px solid rgba(0, 0, 0, 0.1);
}

/* Plain glass/glow cards */
[data-theme="focus"] .glass-card,
[data-theme="focus"] .glow-card {
  background: #f0f0f0;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 4px;
  backdrop-filter: none;
}

/* Nav avatar */
[data-theme="focus"] .nav-avatar {
  background: #777;
}

/* Modal */
[data-theme="focus"] .modal-card {
  border-radius: 4px;
  background: #f5f5f5;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

/* Mobile nav */
[data-theme="focus"] .mobile-nav {
  background: #f0f0f0;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}
[data-theme="focus"] .mobile-nav-btn.active {
  color: #333;
}
[data-theme="focus"] .mobile-more-content {
  background: #f0f0f0;
}

/* Focus overrides for scrollbar */
[data-theme="focus"] ::-webkit-scrollbar-thumb {
  background: #bbb;
  border-radius: 2px;
}
[data-theme="focus"] ::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* Selection */
[data-theme="focus"] ::selection {
  background: #bbb;
  color: #111;
}

/* Game */
[data-theme="focus"] .game-option {
  border-radius: 4px;
}

/* Overlay */
[data-theme="focus"] .overlay-content {
  border-radius: 4px;
}

/* ══════════════════════════════════════════════════════════════ */
/* SHOP                                                         */
/* ══════════════════════════════════════════════════════════════ */
.shop-points-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.2rem 0.75rem;
  border-radius: 20px;
  margin-left: 0.5rem;
  vertical-align: middle;
  font-family: var(--font-mono);
}

.shop-items-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.shop-section-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  opacity: 0.8;
}

.shop-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.shop-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.25rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  transition: transform 0.2s, box-shadow 0.2s;
  text-align: center;
}
.shop-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.shop-card-owned {
  border-color: rgba(34, 197, 94, 0.3);
}

/* Frame preview ring */
.shop-frame-preview {
  margin-bottom: 0.75rem;
}
.shop-frame-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}
.shop-frame-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg-primary, #1a1a2e);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Membership preview */
.shop-membership-preview {
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shop-card-info {
  margin-bottom: 0.75rem;
  flex: 1;
}
.shop-card-name {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.shop-card-desc {
  font-size: 0.8rem;
  opacity: 0.6;
  line-height: 1.3;
}

.shop-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 0.5rem;
}
.shop-card-price {
  font-size: 1rem;
  font-weight: 800;
  color: #f59e0b;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.shop-coin-icon {
  font-size: 1.1rem;
}
.shop-card-action {
  display: flex;
  gap: 0.5rem;
}

.btn-shop-buy {
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: linear-gradient(135deg, #6366f1, #818cf8);
  color: #fff;
  transition: opacity 0.15s, transform 0.15s;
}
.btn-shop-buy:hover:not(:disabled) {
  transform: translateY(-1px);
}
.btn-shop-buy:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-shop-equip {
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  border: 2px solid #22c55e;
  border-radius: 10px;
  cursor: pointer;
  background: transparent;
  color: #22c55e;
  transition: all 0.15s;
}
.btn-shop-equip:hover {
  background: #22c55e;
  color: #fff;
}

.btn-shop-equipped {
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  background: #22c55e;
  color: #fff;
  cursor: default;
}

.shop-owned-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #22c55e;
  text-transform: uppercase;
}

/* ══════════════════════════════════════════════════════════════ */
/* POINTS EARNED (game-over)                                    */
/* ══════════════════════════════════════════════════════════════ */
.game-over-points {
  text-align: center;
  padding: 0.5rem 0;
}
.points-earned-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  padding: 0.4rem 1.2rem;
  border-radius: 24px;
  font-family: var(--font-mono);
  animation: pointsPop 0.5s ease-out;
}
@keyframes pointsPop {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

/* ══════════════════════════════════════════════════════════════ */
/* AVATAR FRAMES                                                */
/* ══════════════════════════════════════════════════════════════ */
.avatar-frame-frame_gold {
  border: 3px solid transparent;
  border-radius: 50%;
  background-image: linear-gradient(var(--bg-primary, #1a1a2e), var(--bg-primary, #1a1a2e)), linear-gradient(135deg, #ffd700, #f0c040, #ffd700);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: 0 0 10px rgba(255,215,0,0.4);
}

.avatar-frame-frame_diamond {
  border: 3px solid transparent;
  border-radius: 50%;
  background-image: linear-gradient(var(--bg-primary, #1a1a2e), var(--bg-primary, #1a1a2e)), linear-gradient(135deg, #b9f2ff, #7dd3fc, #e0f7ff);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: 0 0 12px rgba(125,211,252,0.45);
}

.avatar-frame-frame_fire {
  border: 3px solid transparent;
  border-radius: 50%;
  background-image: linear-gradient(var(--bg-primary, #1a1a2e), var(--bg-primary, #1a1a2e)), linear-gradient(135deg, #ff6b35, #ff4500, #ff8c00);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: 0 0 12px rgba(255,69,0,0.4);
  animation: fireGlow 2s ease-in-out infinite alternate;
}
@keyframes fireGlow {
  0% { box-shadow: 0 0 8px rgba(255,69,0,0.3); }
  100% { box-shadow: 0 0 18px rgba(255,69,0,0.6); }
}

.avatar-frame-frame_neon {
  border: 3px solid transparent;
  border-radius: 50%;
  background-image: linear-gradient(var(--bg-primary, #1a1a2e), var(--bg-primary, #1a1a2e)), linear-gradient(135deg, #39ff14, #00ff88, #00ffcc);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: 0 0 12px rgba(57,255,20,0.4);
  animation: neonPulse 1.5s ease-in-out infinite alternate;
}
@keyframes neonPulse {
  0% { box-shadow: 0 0 8px rgba(57,255,20,0.3); }
  100% { box-shadow: 0 0 20px rgba(57,255,20,0.6); }
}

/* Frame on nav-avatar (small) */
.nav-avatar.avatar-frame-frame_gold,
.nav-avatar.avatar-frame-frame_diamond,
.nav-avatar.avatar-frame-frame_fire,
.nav-avatar.avatar-frame-frame_neon {
  padding: 2px;
}

/* Frame on profile-avatar (large) */
.profile-avatar.avatar-frame-frame_gold,
.profile-avatar.avatar-frame-frame_diamond,
.profile-avatar.avatar-frame-frame_fire,
.profile-avatar.avatar-frame-frame_neon {
  padding: 3px;
}

@media (max-width: 520px) {
  .shop-cards {
    grid-template-columns: 1fr;
  }
}

