/* ============================================================================
   GLOBALS.CSS — Quiz App
   Light theme · blue neon accent · mobile-first responsive layer
   ============================================================================

   CONTENTS
   ────────────────────────────────────────────────────────────────────────
   01. DESIGN TOKENS
   02. RESET & BASE
   03. CANVAS BACKGROUNDS
   04. LAYOUT PRIMITIVES
   05. NAVBAR
   06. BUTTONS
   07. CARDS & SURFACES
   08. TYPOGRAPHY & HEADINGS
   09. HERO
   10. FORMS & INPUTS
   11. TOGGLES & SLIDERS
   12. AVATARS & SUBJECTS
   13. TRUTH GATE
   14. QUIZ ROOM — TEACHER
   15. QUIZ ROOM — STUDENT
   16. WAITING ROOMS
   17. MODALS
   18. STATS & METRICS
   19. COOKIE / LEGAL / LONG-FORM PAGES
   20. FOOTER
   21. ACCESSIBILITY
   22. MOBILE APP-STYLE LAYER
   ============================================================================ */


/* ══════════════════════════════════════════════════════════════════════
   01. DESIGN TOKENS
   ══════════════════════════════════════════════════════════════════════ */

:root {
  /* Base colors (light theme) */
  --bg:          #f4f7fb;
  --surface:     rgba(255, 255, 255, 0.85);
  --card:        rgba(255, 255, 255, 0.9);
  --text:        #0f172a;
  --text-muted:  #475569;
  --text-dim:    #64748b;
  --border:      rgba(59, 130, 246, 0.2);
  --neon:        #2563eb;
  --green:       #059669;
  --red:         #dc2626;
  --yellow:      #d97706;
  --purple:      #7c3aed;

  /* Shadows & glows */
  --glow:   0 0 15px rgba(37, 99, 235, 0.3), 0 0 35px rgba(37, 99, 235, 0.15);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);

  /* Spacing */
  --sp-1: 0.5rem;
  --sp-2: 1rem;
  --sp-3: 1.5rem;
  --sp-4: 2rem;
  --sp-5: 2.5rem;
  --sp-6: 3rem;

  /* Radii */
  --r-card:  40px;
  --r-btn:   60px;
  --r-input: 60px;

  /* Transitions */
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
}


/* ══════════════════════════════════════════════════════════════════════
   02. RESET & BASE
   ══════════════════════════════════════════════════════════════════════ */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 100px;
}

html,
body {
  min-height: 100%;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

body, h1, h2, h3, h4, p, a, span, div {
  overflow-wrap: break-word;
  word-wrap: break-word;
}


/* ══════════════════════════════════════════════════════════════════════
   03. CANVAS BACKGROUNDS
   Sized by JS to exact viewport (DPR-aware) — no 100vw scrollbar bug.
   ══════════════════════════════════════════════════════════════════════ */

#bgCanvas,
#particleCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  display: block;
}

#bgCanvas       { opacity: 0.7; }
#particleCanvas { opacity: 0.5; }


/* ══════════════════════════════════════════════════════════════════════
   04. LAYOUT PRIMITIVES
   ══════════════════════════════════════════════════════════════════════ */

.page-wrapper {
  position: relative;
  z-index: 10;
  max-width: 1300px;
  margin: 0 auto;
  padding: calc(80px + env(safe-area-inset-top, 0px)) var(--sp-4) 0;
}

.section-container {
  padding: var(--sp-6) var(--sp-4);
  max-width: 1300px;
  margin: 0 auto;
  width: 100%;
}

/* Skip link (accessibility) */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 9999;
  background: var(--neon);
  color: #fff;
  padding: 0.7rem 1.2rem;
  border-radius: 0 0 12px 0;
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus { left: 0; }


/* ══════════════════════════════════════════════════════════════════════
   05. NAVBAR
   ══════════════════════════════════════════════════════════════════════ */

.fixed-navbar-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  padding: 0.8rem var(--sp-4);
  background: rgba(244, 247, 251, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(37, 99, 235, 0.12);
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.04);
}

.navbar {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.3rem 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text);
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.logo-text em {
  font-style: italic;
  color: var(--neon);
  font-weight: 400;
}

.logo-icon {
  width: 42px;
  height: 42px;
  background-image: url("../public/favicon.svg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  position: relative;
  transition: color 0.25s var(--ease);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--neon);
  transition: width 0.3s var(--ease);
  border-radius: 2px;
}

.nav-links a:hover         { color: var(--neon); }
.nav-links a:hover::after  { width: 100%; }

.nav-actions {
  display: flex;
  align-items: center;
}

.btn-nav-primary {
  display: inline-flex;
  align-items: center;
  padding: 0.65rem 1.6rem;
  background: var(--neon);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: 50px;
  transition: all 0.25s var(--ease);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
}

.btn-nav-primary:hover {
  background: #1d4ed8;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}


/* ══════════════════════════════════════════════════════════════════════
   06. BUTTONS
   ══════════════════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  border-radius: var(--r-btn);
  padding: 1.3rem 3.8rem;
  text-decoration: none;
  transition: all 0.3s var(--ease);
  cursor: pointer;
  font-size: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  backdrop-filter: blur(4px);
}

.btn-teacher { border-color: var(--neon);   color: var(--neon);   }
.btn-student { border-color: var(--green);  color: var(--green);  }
.btn-self    { border-color: var(--purple); color: var(--purple); }

.btn-teacher:hover {
  background: var(--neon);
  color: #fff;
  box-shadow: var(--glow);
  transform: translateY(-4px);
}
.btn-student:hover {
  background: var(--green);
  color: #fff;
  box-shadow: 0 0 15px var(--green);
  transform: translateY(-4px);
}
.btn-self:hover {
  background: var(--purple);
  color: #fff;
  box-shadow: 0 0 15px var(--purple);
  transform: translateY(-4px);
}

.btn-primary {
  width: 100%;
  background: var(--neon);
  color: #fff;
  border: none;
  border-radius: var(--r-btn);
  padding: 1rem 2rem;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all 0.3s var(--ease);
}

.btn-primary:hover:not(:disabled) {
  background: #1d4ed8;
  box-shadow: var(--glow);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-submit-large {
  width: 100%;
  padding: 1.4rem;
  font-size: 1.15rem;
  border-radius: var(--r-btn);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  box-shadow: 0 8px 25px rgba(37, 99, 235, 0.25);
}

.btn-manage {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid var(--border);
  border-radius: var(--r-btn);
  padding: 0.75rem 1.8rem;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s var(--ease);
  text-decoration: none;
}

.btn-manage:hover {
  background: var(--neon);
  color: #fff;
  box-shadow: var(--glow);
  transform: translateY(-2px);
}


/* ══════════════════════════════════════════════════════════════════════
   07. CARDS & SURFACES
   ══════════════════════════════════════════════════════════════════════ */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: var(--sp-2);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  transition: all 0.4s var(--ease);
}

.card:hover {
  transform: translateY(-8px);
  border-color: var(--neon);
  box-shadow: var(--glow);
}

.card-icon {
  width: 64px;
  height: 64px;
  background: rgba(37, 99, 235, 0.1);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: var(--neon);
  margin-bottom: var(--sp-3);
}

.card h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.8rem;
}

.card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Generic form surface */
.form-card {
  padding: var(--sp-4);
  border-radius: var(--r-card);
  background: var(--card);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.form-card-header {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-bottom: var(--sp-3);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid rgba(37, 99, 235, 0.1);
}

.form-card-header h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.form-card-header p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* Simple form section (student_join, self_practice) */
.form-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: var(--sp-3);
  margin-bottom: var(--sp-2);
  backdrop-filter: blur(8px);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-section:hover {
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: 0 8px 25px rgba(37, 99, 235, 0.06);
}

.form-section label {
  display: block;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: var(--sp-1);
}

.required-star {
  color: var(--red);
  font-weight: bold;
}


/* ══════════════════════════════════════════════════════════════════════
   08. TYPOGRAPHY & HEADINGS
   ══════════════════════════════════════════════════════════════════════ */

.section-header {
  text-align: center;
  margin-bottom: var(--sp-5);
}

.section-label {
  color: var(--neon);
  font-weight: 700;
  font-style: italic;
  font-size: 1.2rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: var(--sp-1);
  display: inline-block;
  background: rgba(37, 99, 235, 0.1);
  padding: 0.4rem 2rem;
  border-radius: 60px;
  border: 1px solid var(--border);
}

.section-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2.8rem, 6vw, 4.5rem);
  font-weight: 300;
}

.section-title strong {
  font-weight: 600;
  font-style: italic;
  color: var(--neon);
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-top: var(--sp-1);
}

.section-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--neon);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}


/* ══════════════════════════════════════════════════════════════════════
   09. HERO
   ══════════════════════════════════════════════════════════════════════ */

.hero-section {
  min-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-6) var(--sp-2);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid var(--border);
  border-radius: 60px;
  padding: 0.6rem 1.6rem;
  font-size: 0.85rem;
  color: var(--neon);
  margin-bottom: var(--sp-1);
}

.hero-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2.8rem, 8vw, 5.5rem);
  font-weight: 300;
  line-height: 1.1;
}

.hero-title em {
  font-style: italic;
  color: var(--neon);
  text-shadow: 0 0 12px rgba(37, 99, 235, 0.4);
}

.hero-subtitle {
  max-width: 720px;
  font-size: 1.15rem;
  color: var(--text-muted);
  margin: var(--sp-3) 0 var(--sp-4);
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  justify-content: center;
}

/* Short-form hero used on cookie policy */
.hero {
  text-align: center;
  margin-bottom: 3rem;
}

.hero-sub {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.6rem;
}


/* ══════════════════════════════════════════════════════════════════════
   10. FORMS & INPUTS
   ══════════════════════════════════════════════════════════════════════ */

.neon-input,
.code-input {
  width: 100%;
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: var(--r-input);
  color: var(--text);
  font-size: 1rem;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: all 0.2s;
}

.neon-input:focus,
.code-input:focus {
  border-color: var(--neon);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.code-input {
  font-size: 24px;
  letter-spacing: 8px;
  text-align: center;
  font-family: 'Cormorant Garamond', monospace, serif;
  font-weight: 700;
}

/* Grid helpers used across forms */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}

.input-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

/* Slider wrapper (teacher quiz creation) */
.slider-wrapper {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.5rem;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-weight: 600;
  color: var(--text);
}

.slider-badge {
  background: var(--neon);
  color: #fff;
  padding: 0.3rem 0.9rem;
  border-radius: 50px;
  font-size: 0.85rem;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.3);
}

/* Difficulty total status */
.total-status-bar {
  margin-top: var(--sp-3);
  padding: 0.8rem 1.2rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-valid   { color: var(--green); font-weight: 700; display: flex; align-items: center; gap: 0.5rem; }
.status-invalid { color: var(--red);   font-weight: 700; display: flex; align-items: center; gap: 0.5rem; }
.status-hint    { font-size: 0.85rem; color: var(--text-dim); }


/* ══════════════════════════════════════════════════════════════════════
   11. TOGGLES & SLIDERS
   ══════════════════════════════════════════════════════════════════════ */

.toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.2rem;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: border-color 0.2s;
}

.toggle-item:hover { border-color: var(--neon); }

.toggle-info span {
  display: block;
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

.toggle-info p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.switch .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  transition: 0.3s;
}

.switch .slider::before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: #fff;
  transition: 0.3s;
}

.switch input:checked + .slider { background-color: var(--neon); }
.switch input:checked + .slider::before { transform: translateX(22px); }

.switch .slider.round { border-radius: 34px; }
.switch .slider.round::before { border-radius: 50%; }

/* Count slider */
.count-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.count-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  border-radius: 5px;
  outline: none;
  background: rgba(37, 99, 235, 0.15);
  cursor: pointer;
}

.count-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--neon);
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.5);
  cursor: pointer;
  border: 3px solid #fff;
}

.count-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--neon);
  border: 3px solid #fff;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.5);
  cursor: pointer;
}

.count-val {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--neon);
  min-width: 48px;
  text-align: center;
  line-height: 1;
}

.slider-bound {
  font-weight: 600;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.count-hint {
  font-size: 0.76rem;
  color: var(--text-dim);
  margin-top: 0.5rem;
}

.percent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.8rem;
}

#percent-total        { font-weight: 600; color: var(--green); }
#percent-total.invalid{ color: var(--red); }
#percent-error        { color: var(--red); font-weight: 600; font-size: 0.85rem; }


/* ══════════════════════════════════════════════════════════════════════
   12. AVATARS & SUBJECTS
   ══════════════════════════════════════════════════════════════════════ */

/* Avatar — flex version (older student_join style) */
.avatar-selection {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 30px 0;
  flex-wrap: wrap;
  max-height: 200px;
  overflow-y: auto;
  padding: 10px;
}

.avatar-option {
  cursor: pointer;
  border: 3px solid transparent;
  border-radius: 50%;
  transition: all 0.3s ease;
  position: relative;
}

.avatar-option:hover      { transform: scale(1.1); }
.avatar-option.selected   { transform: scale(1.15); border-color: var(--neon); box-shadow: 0 0 20px var(--neon); }
.avatar-option img {
  width: 65px;
  height: 65px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  border: 2px solid var(--border);
}

/* Avatar — grid version (newer style) */
.avatar-selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 0.8rem;
  max-height: 240px;
  overflow-y: auto;
  padding: 0.8rem;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.avatar-option-item {
  position: relative;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 50%;
  aspect-ratio: 1;
  padding: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-option-item:hover    { transform: scale(1.08); border-color: var(--neon); }
.avatar-option-item.selected {
  border-color: var(--neon);
  box-shadow: 0 0 14px rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.05);
}

.avatar-option-item img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.selected-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background: var(--neon);
  color: #fff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Subject grid */
.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.subject-card {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1rem 0.7rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.subject-card:hover    { border-color: var(--neon); color: var(--text); }
.subject-card.selected {
  border-color: var(--neon);
  color: var(--neon);
  background: rgba(37, 99, 235, 0.1);
  box-shadow: 0 0 15px rgba(37, 99, 235, 0.2);
}
.subject-card i {
  display: block;
  font-size: 1.9rem;
  margin-bottom: 0.5rem;
  color: var(--neon);
}

.subjects-loading {
  text-align: center;
  padding: 2rem;
  color: var(--neon);
  font-weight: 500;
  grid-column: 1 / -1;
}


/* ══════════════════════════════════════════════════════════════════════
   13. TRUTH GATE
   ══════════════════════════════════════════════════════════════════════ */

.verification-container {
  text-align: center;
  position: relative;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(239, 246, 255, 0.8));
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 2.2rem 1.8rem;
  margin: var(--sp-4) 0;
  backdrop-filter: blur(8px);
}

.verification-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--neon);
  background: rgba(37, 99, 235, 0.1);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  margin-bottom: 0.8rem;
}

.verification-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.2rem;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  margin-bottom: 0.3rem;
}

.verification-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.truth-gate {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 1.2rem 0;
}

.gate-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 3px solid var(--border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.gate-symbol {
  width: 48px;
  height: 48px;
  fill: var(--text-muted);
  transition: fill 0.3s ease;
}

.gate-circle.active {
  border-color: var(--neon);
  animation: gatePulse 1.2s infinite;
}
.gate-circle.active .gate-symbol {
  fill: var(--neon);
  filter: drop-shadow(0 0 8px var(--neon));
}

.gate-circle.verified {
  border-color: var(--green);
  background: rgba(5, 150, 105, 0.08);
  box-shadow: 0 0 25px rgba(5, 150, 105, 0.3);
}
.gate-circle.verified .gate-symbol {
  fill: var(--green);
  filter: drop-shadow(0 0 8px var(--green));
}

@keyframes gatePulse {
  0%   { transform: scale(1);    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
  70%  { transform: scale(1.06); box-shadow: 0 0 0 14px rgba(37, 99, 235, 0); }
  100% { transform: scale(1);    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.ritual-text {
  text-align: center;
  font-style: italic;
  font-weight: 600;
  color: var(--text-muted);
  min-height: 2rem;
  margin: 1rem 0 1.5rem;
}

.verification-controls {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  margin: 1.5rem 0 0.5rem;
  flex-wrap: wrap;
}

.verification-btn {
  border: none;
  background: var(--neon);
  color: #fff;
  font-weight: 600;
  padding: 0.7rem 1.4rem;
  border-radius: 30px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.2s ease;
}

.verification-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}
.verification-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.verification-btn.btn-secondary {
  background: rgba(15, 23, 42, 0.05);
  color: var(--text);
  border: 1px solid var(--border);
}
.verification-btn.btn-secondary:hover:not(:disabled) {
  background: rgba(15, 23, 42, 0.09);
  box-shadow: none;
}

/* IMPORTANT: default hidden — JS toggles via inline display */
.verification-success,
.verification-error {
  display: none;
  margin-top: 1.2rem;
  padding: 0.8rem 1.2rem;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.verification-success {
  background: rgba(5, 150, 105, 0.1);
  color: var(--green);
}

.verification-error {
  background: rgba(220, 38, 38, 0.1);
  color: var(--red);
}


/* ══════════════════════════════════════════════════════════════════════
   14. QUIZ ROOM — TEACHER
   ══════════════════════════════════════════════════════════════════════ */

.quiz-host-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
}

.room-status-badge {
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.2);
  color: var(--neon);
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.host-question-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.question-progress-pill {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-muted);
}

.difficulty-badge {
  text-transform: capitalize;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.25rem 0.7rem;
  border-radius: 12px;
  background: rgba(165, 206, 243, 0.788);
}

.timer-badge {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  position: relative;
}

.timer-value {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--neon);
}

/* SVG timer ring */
.timer-ring-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.12) 0%, rgba(15, 23, 42, 0) 70%);
  box-shadow: 0 0 20px rgba(37, 99, 235, 0.18), inset 0 0 12px rgba(37, 99, 235, 0.08);
  transition: all 0.4s ease;
}

.timer-ring-wrap svg {
  display: block;
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
  overflow: visible;
}

.timer-ring-track {
  fill: none;
  stroke: rgba(37, 99, 235, 0.15);
  stroke-width: 7;
}

.timer-ring-progress {
  fill: none;
  stroke: var(--neon);
  stroke-width: 7;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.9s linear, stroke 0.3s ease, filter 0.3s ease;
  filter: drop-shadow(0 0 6px var(--neon)) drop-shadow(0 0 12px rgba(37, 99, 235, 0.5));
}

.timer-ring-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--neon);
  text-shadow: 0 0 12px rgba(37, 99, 235, 0.5);
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

.timer-ring-wrap.warning {
  background: radial-gradient(circle, rgba(234, 179, 8, 0.15) 0%, rgba(15, 23, 42, 0) 70%);
  box-shadow: 0 0 25px rgba(234, 179, 8, 0.25);
}
.timer-ring-wrap.warning .timer-ring-progress {
  stroke: var(--yellow);
  filter: drop-shadow(0 0 8px var(--yellow)) drop-shadow(0 0 16px rgba(234, 179, 8, 0.6));
}
.timer-ring-wrap.warning .timer-ring-value {
  color: var(--yellow);
  text-shadow: 0 0 14px rgba(234, 179, 8, 0.7);
}

.timer-ring-wrap.critical {
  background: radial-gradient(circle, rgba(239, 68, 68, 0.2) 0%, rgba(15, 23, 42, 0) 70%);
  animation: timerCriticalPulse 0.8s ease-in-out infinite alternate;
}
.timer-ring-wrap.critical .timer-ring-progress {
  stroke: var(--red);
  filter: drop-shadow(0 0 10px var(--red)) drop-shadow(0 0 22px rgba(239, 68, 68, 0.8));
}
.timer-ring-wrap.critical .timer-ring-value {
  color: var(--red);
  text-shadow: 0 0 16px rgba(239, 68, 68, 0.85);
}

@keyframes timerCriticalPulse {
  0%   { transform: scale(1);    box-shadow: 0 0 15px rgba(239, 68, 68, 0.25); }
  100% { transform: scale(1.06); box-shadow: 0 0 32px rgba(239, 68, 68, 0.6); }
}

.question-prompt {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 1.5rem;
}

.answers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
  margin-bottom: 1.5rem;
}

.answer-card-option {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.9rem 1.1rem;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  font-weight: 600;
  color: var(--text);
  transition: all 0.2s ease;
}

.answer-card-option.correct {
  border-color: var(--green);
  background: rgba(16, 185, 129, 0.08);
  color: #059669;
}

.option-prefix {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(8, 8, 8, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 700;
  flex-shrink: 0;
}

.answer-card-option.correct .option-prefix {
  background: #10b981;
  color: #fff;
}

.answer-explanation-banner {
  padding: 1rem 1.2rem;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 14px;
  margin-bottom: 1.5rem;
}

.feedback-heading {
  font-weight: 700;
  color: #059669;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.host-controls-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.results-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

/* Leaderboard sidebar */
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.participant-rank-card {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.6rem 0.8rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.rank-number {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.rank-number.rank-1 { background: #f59e0b; color: #fff; }
.rank-number.rank-2 { background: #94a3b8; color: #fff; }
.rank-number.rank-3 { background: #d97706; color: #fff; }

.rank-tag {
  margin-left: auto;
  font-weight: 700;
  color: var(--neon);
  font-size: 0.92rem;
}

/* Toast */
.toast-notification {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.9rem 1.4rem;
  border-radius: 30px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.toast-notification.success { background: #10b981; color: #fff; }
.toast-notification.error   { background: #ef4444; color: #fff; }


/* ══════════════════════════════════════════════════════════════════════
   15. QUIZ ROOM — STUDENT
   ══════════════════════════════════════════════════════════════════════ */

/* Top HUD */
.student-hud-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: var(--r-card);
  padding: 0.9rem 1.4rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.05), 0 0 15px rgba(37, 99, 235, 0.05);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.student-hud-card::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 50%;
  height: 200%;
  background: linear-gradient(60deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  transform: rotate(30deg);
  animation: hudShineSweep 6s infinite ease-in-out;
  pointer-events: none;
}

@keyframes hudShineSweep {
  0%         { left: -60%; }
  20%, 100%  { left: 140%; }
}

.hud-player-profile {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  position: relative;
  z-index: 2;
}

.hud-avatar-wrapper {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px solid var(--neon);
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.35), inset 0 0 6px rgba(37, 99, 235, 0.2);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hud-avatar-wrapper:hover {
  transform: scale(1.05);
  box-shadow: 0 0 18px rgba(37, 99, 235, 0.55);
}

.hud-avatar-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hud-player-meta {
  display: flex;
  flex-direction: column;
}

.hud-player-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}

.hud-player-status {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.hud-stats-group {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  position: relative;
  z-index: 2;
  flex-wrap: wrap;
}

.hud-stat-pill {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(248, 250, 252, 0.9);
  border: 1px solid var(--border);
  padding: 0.5rem 0.95rem;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.hud-stat-pill:hover {
  transform: translateY(-2px);
  background: #ffffff;
  border-color: rgba(37, 99, 235, 0.3);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

.hud-stat-pill i {
  font-size: 1.1rem;
  transition: transform 0.25s ease;
}
.hud-stat-pill:hover i { transform: scale(1.2); }

.gold-star {
  color: #f59e0b;
  filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.5));
  animation: starGlowPulse 2.5s infinite alternate ease-in-out;
}

.flame-icon {
  color: #ef4444;
  filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.6));
  animation: flameFlicker 1.8s infinite ease-in-out;
}

.check-icon {
  color: #10b981;
  filter: drop-shadow(0 0 5px rgba(16, 185, 129, 0.5));
}

@keyframes starGlowPulse {
  0%   { filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.3)); transform: scale(1); }
  100% { filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.8)); transform: scale(1.08); }
}

@keyframes flameFlicker {
  0%, 100% { transform: scale(1) rotate(0deg); filter: drop-shadow(0 0 5px rgba(239, 68, 68, 0.5)); }
  50%      { transform: scale(1.12) rotate(-4deg); filter: drop-shadow(0 0 10px rgba(239, 68, 68, 0.85)); }
}

.hud-timer-container {
  position: relative;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.12) 0%, rgba(255, 255, 255, 0) 70%);
  box-shadow: 0 0 15px rgba(37, 99, 235, 0.15);
  z-index: 2;
  transition: transform 0.3s ease;
}
.hud-timer-container:hover { transform: scale(1.06); }

.hud-timer-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 0 6px var(--neon));
}

.hud-timer-text {
  position: absolute;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--neon);
  text-shadow: 0 0 8px rgba(37, 99, 235, 0.5);
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

/* Waiting stage */
.waiting-stage-card {
  padding: 3.5rem 1.5rem;
}

.waiting-pulse-orb {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.1);
  color: var(--neon);
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.2rem;
  animation: gatePulse 1.4s infinite;
}

.waiting-stage-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.waiting-stage-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* Active quiz arena */
.active-quiz-card {
  padding: 1.8rem;
}

.question-arena-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.question-order-pill {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.arena-question-text {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 1.8rem;
}

.arena-answers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.arena-answer-button {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem 1.2rem;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 16px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.arena-answer-button:hover:not(:disabled) {
  border-color: var(--neon);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.arena-answer-button:disabled {
  cursor: not-allowed;
  opacity: 0.85;
}

.arena-answer-button.is-correct {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
  color: #059669;
}

.arena-answer-button.is-incorrect {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
}

.answer-key-badge {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(8, 8, 8, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

.arena-answer-button.is-correct .answer-key-badge { background: #10b981; color: #fff; }
.arena-answer-button.is-incorrect .answer-key-badge { background: #ef4444; color: #fff; }

.answer-option-label { flex: 1; }
.outcome-icon       { font-size: 1.1rem; }

/* Feedback banner */
.feedback-result-banner {
  padding: 1.1rem 1.3rem;
  border-radius: 16px;
  margin-top: 1rem;
}

.banner-correct {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #059669;
}

.banner-incorrect {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #dc2626;
}

.banner-status-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.status-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
}

.points-award-pill {
  font-size: 0.85rem;
  background: #fff;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
}

.banner-explanation {
  font-size: 0.9rem;
  line-height: 1.4;
  margin: 0;
}

/* Results stage */
.quiz-results-card {
  padding: 3rem 1.5rem;
}

.trophy-award-orb {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
  font-size: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.2rem;
}

.results-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.3rem;
}

.results-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.results-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  max-width: 600px;
  margin: 0 auto 2rem;
}

.metric-card {
  background: rgba(249, 250, 251, 0.8);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.2rem 1rem;
  text-align: center;
}

.metric-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.metric-icon.gold  { color: #f59e0b; }
.metric-icon.green { color: #10b981; }
.metric-icon.blue  { color: var(--neon); }

.metric-value {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
}

.metric-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}


/* ══════════════════════════════════════════════════════════════════════
   16. WAITING ROOMS
   ══════════════════════════════════════════════════════════════════════ */

.waiting-room-container {
  max-width: 900px;
  margin: 0 auto;
  padding-bottom: var(--sp-6);
}

/* PIN hero card */
.code-hero-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(239, 246, 255, 0.6));
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: var(--sp-4) var(--sp-3);
  text-align: center;
  box-shadow: var(--shadow);
}

.code-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.code-display-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.session-code {
  font-family: 'Cormorant Garamond', serif;
  font-size: 3.5rem;
  font-weight: 700;
  letter-spacing: 0.25rem;
  color: var(--neon);
  text-shadow: 0 0 15px rgba(37, 99, 235, 0.2);
}

.action-icon-btn {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--neon);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.action-icon-btn:hover {
  transform: translateY(-2px);
  background: var(--neon);
  color: #fff;
}

.code-actions-grid {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.action-btn {
  border-radius: 30px;
  padding: 0.6rem 1.4rem;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Stats row (waiting rooms) */
.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.stat-card {
  padding: 1.2rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  border-radius: var(--r-card);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--neon);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-icon.pulse      { animation: pulse 2s infinite; }
.stat-icon.live       { background: rgba(5, 150, 105, 0.1); color: var(--green); }

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.status-live { color: var(--green); font-size: 1.2rem; }

/* Participants container */
.participants-container {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 0;
}

.empty-roster {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
}

.radar-spinner {
  font-size: 2.5rem;
  color: var(--neon);
  margin-bottom: 1rem;
  animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%      { transform: scale(1.35); opacity: 0.6; }
}

.participant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  width: 100%;
}

.participant-card {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.participant-card:hover {
  transform: translateY(-3px);
  border-color: var(--neon);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
}

.participant-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.05);
  padding: 4px;
  border: 1px solid var(--border);
}

.participant-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  word-break: break-word;
}

.participant-badge {
  font-size: 0.75rem;
  color: var(--green);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  background: rgba(5, 150, 105, 0.1);
  border: 1px solid rgba(5, 150, 105, 0.25);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.participant-badge.joined {
  color: var(--yellow);
  background: rgba(217, 119, 6, 0.1);
  border-color: rgba(217, 119, 6, 0.25);
}

/* QR modal */
.qr-modal-box   { max-width: 380px; }
.qr-image-wrapper {
  background: #fff;
  padding: 1rem;
  border-radius: 16px;
  margin: 1rem 0;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 0 0 1px var(--border);
}
.qr-image {
  width: 100%;
  height: auto;
  border-radius: 8px;
}
.qr-hint {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
}

/* Player profile badge */
.player-profile-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  flex-wrap: wrap;
  padding: 1rem 1.2rem;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.player-info-flex {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.player-avatar-ring {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 3px solid var(--neon);
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.25);
  overflow: hidden;
  flex-shrink: 0;
}

.player-avatar-ring img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-details { flex: 1; }

.player-name {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.3rem;
}

.pin-pill-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pin-pill-tag strong {
  color: var(--neon);
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
}

.ready-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--green);
  background: rgba(16, 185, 129, 0.1);
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.green {
  width: 8px;
  height: 8px;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

/* Card header with count */
.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 1.25rem;
}

.card-header-flex h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.7rem;
  font-weight: 700;
  margin: 0;
}

.count-badge {
  background: rgba(37, 99, 235, 0.1);
  color: var(--neon);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  border: 1px solid rgba(37, 99, 235, 0.2);
}

/* Players lobby grid (student waiting room) */
.players-grid-container { min-height: 140px; }

.empty-players-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  gap: 0.6rem;
}

.empty-players-state i {
  font-size: 2rem;
  opacity: 0.6;
  color: var(--neon);
}

.players-lobby-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.85rem;
}

.player-card-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 30px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.player-card-chip:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.player-card-chip.is-self {
  border-color: var(--neon);
  background: rgba(37, 99, 235, 0.04);
}

.chip-avatar-wrapper {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.chip-avatar-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chip-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.waiting-status-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  padding: 1.1rem;
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 16px;
  color: var(--neon);
  font-weight: 600;
  font-size: 0.95rem;
}

.pulse-loader { font-size: 1.1rem; }


/* ══════════════════════════════════════════════════════════════════════
   17. MODALS
   ══════════════════════════════════════════════════════════════════════ */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal.open { display: flex; }

.modal-content {
  background: var(--card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: var(--sp-4);
  max-width: 450px;
  width: 90%;
  box-shadow: var(--glow);
}

.modal-content h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.8rem;
  margin-bottom: 0.4rem;
}

.modal-content p {
  color: var(--text-muted);
  margin-bottom: 1.2rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
}

.modal-actions .btn-primary {
  width: auto;
  padding: 0.7rem 1.6rem;
}

.modal-icon {
  font-size: 2.8rem;
  margin-bottom: 0.8rem;
}

.modal-icon.error   { color: var(--red); }
.modal-icon.success { color: var(--green); }


/* ══════════════════════════════════════════════════════════════════════
   18. STATS & METRICS (homepage stats, faq, grid layouts)
   ══════════════════════════════════════════════════════════════════════ */

.stats-section {
  padding: var(--sp-3) var(--sp-4);
}

.stats-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.stat-item {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4) var(--sp-3);
  position: relative;
  text-align: center;
}

.stat-item + .stat-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--neon), transparent);
}

.stat-number {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  font-weight: 600;
  color: var(--neon);
  line-height: 1;
  margin-bottom: 0.35rem;
}

/* FAQ */
.faq-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: var(--sp-5);
  backdrop-filter: blur(8px);
}

.faq-item {
  margin-bottom: var(--sp-3);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.faq-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.faq-item h4 {
  color: var(--neon);
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.faq-item p {
  color: var(--text-muted);
}

/* Grid layouts */
.grid-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--sp-4);
}


/* ══════════════════════════════════════════════════════════════════════
   19. COOKIE / LEGAL / LONG-FORM PAGES
   ══════════════════════════════════════════════════════════════════════ */

.page-wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 2rem 1.2rem 8rem;
  position: relative;
  z-index: 10;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.88rem;
  transition: color 0.2s;
  margin-bottom: 2rem;
}
.back-link:hover { color: var(--neon); }

.effective {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid var(--border);
  border-radius: 60px;
  padding: 0.3rem 0.9rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.8rem;
}

/* Card variant used on cookie/legal pages */
.card h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.7rem;
  font-weight: 400;
  margin-bottom: 1rem;
  color: var(--text);
}

.card h3 {
  color: var(--neon);
  font-weight: 600;
}

.divider {
  height: 1px;
  background: linear-gradient(to right, transparent, var(--neon), transparent);
  opacity: 0.2;
  margin: 1.4rem 0;
}

/* Cookie table */
.cookie-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.85rem;
}

.cookie-table th {
  text-align: left;
  padding: 0.65rem 1rem;
  background: rgba(37, 99, 235, 0.08);
  border-bottom: 1px solid rgba(37, 99, 235, 0.2);
  color: var(--neon);
  font-weight: 600;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.cookie-table th:first-child { border-radius: 12px 0 0 0; }
.cookie-table th:last-child  { border-radius: 0 12px 0 0; }

.cookie-table td {
  padding: 0.7rem 1rem;
  color: var(--text-muted);
  font-size: 0.84rem;
  border-bottom: 1px solid rgba(37, 99, 235, 0.08);
  vertical-align: top;
}

.cookie-table tr:last-child td { border-bottom: none; }
.cookie-table tr:hover td      { background: rgba(37, 99, 235, 0.03); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.65rem;
  border-radius: 60px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-required {
  background: rgba(5, 150, 105, 0.15);
  color: var(--green);
  border: 1px solid rgba(5, 150, 105, 0.25);
}

.badge-optional {
  background: rgba(37, 99, 235, 0.1);
  color: var(--neon);
  border: 1px solid var(--border);
}

.badge-analytics {
  background: rgba(217, 119, 6, 0.1);
  color: var(--yellow);
  border: 1px solid rgba(217, 119, 6, 0.25);
}

/* Highlight box */
.highlight {
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.1rem 1.3rem;
  margin: 1rem 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.highlight strong { color: var(--text); }

.highlight.green  { background: rgba(5, 150, 105, 0.06);  border-color: rgba(5, 150, 105, 0.2); }
.highlight.yellow { background: rgba(217, 119, 6, 0.06); border-color: rgba(217, 119, 6, 0.2); }

/* Rights grid */
.rights-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  margin: 1rem 0;
}

.right-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
}

.right-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(37, 99, 235, 0.12);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--neon);
  font-size: 0.8rem;
  margin-top: 0.1rem;
}

.right-text {
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.right-text strong {
  color: var(--text);
  display: block;
  margin-bottom: 0.1rem;
}

/* Contact card */
.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 1.2rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.contact-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(37, 99, 235, 0.12);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--neon);
  font-size: 1.1rem;
}

.contact-text {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.contact-text a {
  color: var(--neon);
  text-decoration: none;
}

.contact-text a:hover { text-decoration: underline; }

/* Generic shimmer used by card top border */
@keyframes shimmer {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 1; }
}


/* ══════════════════════════════════════════════════════════════════════
   20. FOOTER
   ══════════════════════════════════════════════════════════════════════ */

footer {
  text-align: center;
  padding: var(--sp-5) 0;
  color: var(--text-dim);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
  margin-top: var(--sp-6);
  background: rgba(255, 255, 255, 0.5);
}

footer a {
  color: var(--neon);
  text-decoration: none;
}

footer a:hover { text-decoration: underline; }

/* Shared pulse keyframe used by stat-icon, waiting orbs, etc. */
@keyframes pulse {
  0%   { transform: scale(1);   opacity: 1; }
  50%  { transform: scale(1.08); opacity: 0.8; }
  100% { transform: scale(1);   opacity: 1; }
}


/* ══════════════════════════════════════════════════════════════════════
   21. ACCESSIBILITY
   ══════════════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  #bgCanvas,
  #particleCanvas { display: none; }

  .timer-critical .timer-text,
  .stat-icon.pulse,
  .radar-spinner,
  .waiting-pulse-orb { animation: none !important; }
}


/* ══════════════════════════════════════════════════════════════════════
   22. MOBILE APP-STYLE LAYER
   Scoped to phones only. Overrides the desktop-first defaults above.
   ══════════════════════════════════════════════════════════════════════ */

/* ---------- 22.1 Scale down design tokens ---------- */
@media (max-width: 640px) {
  :root {
    --sp-1: 0.4rem;
    --sp-2: 0.75rem;
    --sp-3: 1rem;
    --sp-4: 1.25rem;
    --sp-5: 1.75rem;
    --sp-6: 2rem;
    --r-card:  20px;
    --r-btn:   36px;
    --r-input: 36px;
  }

  body {
    font-size: 15px;
    line-height: 1.55;
  }
}

/* ---------- 22.2 Page padding & container width ---------- */
@media (max-width: 640px) {
  .page-wrapper {
    padding: calc(56px + env(safe-area-inset-top, 0px)) 0.9rem 0;
  }

  .section-container {
    padding: 2rem 0.9rem;
  }

  .form-main-container,
  .host-main-container,
  .waiting-room-container,
  .waiting-container,
  .student-quiz-container,
  .practice-container,
  .legal-container,
  .results-container,
  .join-container {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
    padding-bottom: 2rem;
  }
}

/* ---------- 22.3 Typography scale-down ---------- */
@media (max-width: 640px) {
  .hero-title,
  .neon-title,
  .main-title,
  .doc-title,
  .results-title {
    font-size: clamp(1.75rem, 8vw, 2.2rem) !important;
    line-height: 1.15 !important;
  }

  .section-title {
    font-size: clamp(1.55rem, 6.5vw, 2rem) !important;
    line-height: 1.15 !important;
  }

  .hero-subtitle,
  .hero-sub,
  .section-subtitle,
  .subtitle,
  .completion-message {
    font-size: 0.9rem !important;
    line-height: 1.6 !important;
    max-width: 100% !important;
  }

  h1 { font-size: 1.7rem; }
  h2 { font-size: 1.35rem; }
  h3 { font-size: 1.1rem; }
  h4 { font-size: 1rem; }

  .section-label {
    font-size: 0.7rem;
    padding: 0.35rem 1rem;
  }

  .section-header { margin-bottom: 1.5rem; }
}

/* ---------- 22.4 Navbar — compact ---------- */
@media (max-width: 860px) {
  .nav-links { display: none; }
}

@media (max-width: 640px) {
  .fixed-navbar-wrapper {
    padding: 0.5rem 0.75rem;
    min-height: 56px;
  }

  .navbar-inner { padding: 0.15rem 0; }

  .logo {
    font-size: 1.1rem;
    gap: 0.5rem;
  }

  .logo-icon {
    width: 32px;
    height: 32px;
  }

  .btn-nav-primary {
    padding: 0.5rem 0.9rem;
    font-size: 0.75rem;
    border-radius: 40px;
  }
}

/* ---------- 22.5 Cards & form sections ---------- */
@media (max-width: 640px) {
  .card,
  .form-card,
  .form-section,
  .waiting-room-card,
  .participants-card,
  .waiting-status-card,
  .verification-container,
  .code-hero-card,
  .stats-bar,
  .faq-panel,
  .cta-banner {
    padding: 1.1rem 1rem !important;
    border-radius: 18px !important;
    margin-bottom: 0.9rem !important;
  }

  .card:hover,
  .form-card:hover,
  .form-section:hover {
    transform: none !important;
  }

  .card-icon {
    width: 50px;
    height: 50px;
    font-size: 1.4rem;
    border-radius: 16px;
    margin-bottom: 0.75rem;
  }

  .card h3 {
    font-size: 1.15rem;
    margin-bottom: 0.35rem;
  }

  .card p {
    font-size: 0.85rem;
    line-height: 1.5;
  }
}

/* ---------- 22.6 Touch targets ---------- */
@media (max-width: 640px) {
  .btn,
  .btn-primary,
  .btn-nav-primary,
  .btn-manage,
  .btn-half,
  #start-btn,
  #next-btn,
  .verification-btn,
  .action-btn,
  .action-icon-btn {
    min-height: 44px;
    padding: 0.85rem 1.2rem !important;
    font-size: 0.92rem !important;
  }

  .btn-nav-primary { min-height: 36px; }

  .hero-actions {
    flex-direction: column;
    gap: 0.6rem;
    width: 100%;
  }

  .hero-actions .btn,
  .btn {
    width: 100% !important;
    justify-content: center !important;
  }
}

/* ---------- 22.7 Inputs — bigger tap targets ---------- */
@media (max-width: 640px) {
  .neon-input,
  .code-input,
  input[type="text"],
  input[type="number"],
  input[type="email"],
  textarea,
  select {
    font-size: 16px !important; /* prevents Android auto-zoom */
    min-height: 48px;
    padding: 0.85rem 1rem !important;
    border-radius: 20px !important;
  }

  textarea { min-height: 90px; }
}

/* ---------- 22.8 Grids — single column ---------- */
@media (max-width: 640px) {
  .grid-layout,
  .categories-grid,
  .how-grid,
  .audience-grid,
  .content-grid,
  .stats-row,
  .quiz-form-grid,
  .doc-layout,
  .quiz-host-layout,
  .results-metrics-grid {
    grid-template-columns: 1fr !important;
    gap: 0.7rem !important;
  }

  .quiz-form-grid > [class*="col-span"] {
    grid-column: 1 / -1 !important;
  }

  .options-grid,
  .grid-3,
  .form-grid-2 {
    grid-template-columns: 1fr !important;
    gap: 0.6rem !important;
  }

  .answers-grid,
  .arena-answers-grid {
    grid-template-columns: 1fr !important;
    gap: 0.55rem !important;
  }
}

/* ---------- 22.9 Small tile grids — 2 columns ---------- */
@media (max-width: 520px) {
  .subject-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.5rem !important;
  }

  .subject-card {
    padding: 0.7rem 0.5rem !important;
    font-size: 0.8rem !important;
    border-radius: 14px !important;
  }

  .subject-card i {
    font-size: 1.3rem !important;
    margin-bottom: 0.3rem !important;
  }

  .participant-grid,
  .players-lobby-grid,
  .avatar-selection-grid,
  .avatar-selection {
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)) !important;
    gap: 0.5rem !important;
  }

  .avatar-option,
  .avatar-option-item { padding: 2px !important; }

  .avatar-option.selected::after,
  .selected-badge {
    width: 15px !important;
    height: 15px !important;
    font-size: 0.55rem !important;
  }
}

/* ---------- 22.10 Stats bars / stat cards ---------- */
@media (max-width: 640px) {
  .stats-bar,
  .stats-row {
    flex-direction: column;
    border-radius: 20px;
  }

  .stat-item {
    padding: 1rem 0.75rem;
    border-top: 1px solid var(--border);
    min-width: 0;
  }

  .stat-item:first-child { border-top: none; }
  .stat-item + .stat-item::before { display: none; }

  .stat-number { font-size: 2rem; }

  .stat-label {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
  }

  .stat-card {
    padding: 0.9rem 1rem;
    gap: 0.8rem;
    border-radius: 18px;
  }

  .stat-icon {
    width: 42px;
    height: 42px;
    font-size: 1.15rem;
    border-radius: 12px;
  }

  .stat-value { font-size: 1.35rem; }
}

/* ---------- 22.11 Hero — less vertical height ---------- */
@media (max-width: 640px) {
  .hero-section {
    min-height: auto !important;
    padding: 1.5rem 0.5rem 2rem !important;
  }

  .hero-badge {
    font-size: 0.72rem;
    padding: 0.4rem 0.9rem;
    margin-bottom: 0.75rem;
  }

  .hero-title { margin-bottom: 0.6rem; }
  .hero-title br { display: none; }
  .hero-subtitle { margin: 0.75rem 0 1.25rem; }
}

/* ---------- 22.12 Modals — bottom sheet ---------- */
@media (max-width: 640px) {
  .modal {
    padding: 0;
    align-items: flex-end;
  }

  .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 88vh;
    overflow-y: auto;
    padding: 1.4rem 1.2rem 1.5rem !important;
    border-radius: 24px 24px 0 0 !important;
    margin: 0 !important;
  }

  .modal-content h3,
  .modal h2 { font-size: 1.35rem !important; }

  .modal-actions {
    flex-direction: column-reverse;
    gap: 0.5rem;
  }

  .modal-actions .btn,
  .modal-actions .btn-primary {
    width: 100% !important;
    min-height: 44px;
  }
}

/* ---------- 22.13 Tables — horizontal scroll ---------- */
@media (max-width: 640px) {
  .cookie-table,
  .data-table,
  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 0.78rem !important;
    white-space: nowrap;
  }

  .cookie-table th,
  .cookie-table td,
  .data-table th,
  .data-table td {
    padding: 0.5rem 0.7rem !important;
    white-space: normal;
    min-width: 80px;
  }
}

/* ---------- 22.14 TOC sidebar (legal/cookie) ---------- */
@media (max-width: 900px) {
  .toc {
    position: static !important;
    max-height: none !important;
    margin-bottom: 1rem;
  }

  .toc ul {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
  }

  .toc h4 { margin-bottom: 0.6rem; }
}

/* ---------- 22.15 Floating elements — no overlap ---------- */
@media (max-width: 640px) {
  /* Cookie manage button */
  #manageFloating {
    bottom: 0.9rem !important;
    left: 0.9rem !important;
    padding: 0.45rem 0.8rem !important;
    font-size: 0.72rem !important;
  }

  /* Donate FAB sits above the cookie button */
  #d-fab {
    bottom: 5.5rem !important;
    left: 0.9rem !important;
    padding: 0.45rem 0.85rem !important;
    font-size: 0.68rem !important;
    animation: none !important;
  }

  #d-fab .d-fab-badge { display: none !important; }
  #d-fab .d-fab-label {
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Toasts */
  #d-toast,
  .toast-notification,
  .error-toast {
    left: 0.9rem !important;
    right: 0.9rem !important;
    bottom: 0.9rem !important;
    max-width: none !important;
    transform: none !important;
    font-size: 0.82rem !important;
    padding: 0.7rem 1rem !important;
  }

  .connection-status {
    bottom: 1rem;
    left: 0.9rem;
    right: 0.9rem;
    transform: translateY(150%);
    max-width: none;
    font-size: 0.8rem;
  }

  .connection-status.show { transform: translateY(0); }
}

/* ---------- 22.16 Quiz room — HUD & arena ---------- */
@media (max-width: 640px) {
  .student-hud-card {
    padding: 0.7rem 0.9rem;
    gap: 0.6rem;
    border-radius: 18px;
    margin-bottom: 0.9rem;
  }

  .hud-player-profile { gap: 0.5rem; }
  .hud-avatar-wrapper { width: 40px; height: 40px; }
  .hud-player-name    { font-size: 0.9rem; }
  .hud-player-status  { font-size: 0.72rem; }

  .hud-stats-group {
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  .hud-stat-pill {
    padding: 0.35rem 0.6rem;
    gap: 0.35rem;
    border-radius: 10px;
  }

  .hud-stat-pill i            { font-size: 0.85rem; }
  .hud-stat-pill .stat-label  { font-size: 0.58rem; }
  .hud-stat-pill .stat-value  { font-size: 0.78rem; }

  .hud-timer-container {
    width: 42px;
    height: 42px;
    margin-left: auto;
  }

  .active-quiz-card,
  .waiting-stage-card,
  .quiz-results-card {
    padding: 1.1rem 1rem !important;
  }

  .question-order-pill { font-size: 0.72rem; }

  .arena-question-text {
    font-size: 1.1rem;
    margin-bottom: 1.1rem;
  }

  .arena-answer-button,
  .answer-card-option {
    padding: 0.8rem 0.9rem;
    font-size: 0.88rem;
    border-radius: 14px;
    gap: 0.6rem;
  }

  .answer-key-badge,
  .option-prefix {
    width: 26px;
    height: 26px;
    font-size: 0.75rem;
  }

  .waiting-stage-title,
  .results-title { font-size: 1.4rem; }

  .waiting-stage-subtitle,
  .results-subtitle { font-size: 0.85rem; }

  .trophy-award-orb,
  .waiting-pulse-orb {
    width: 60px;
    height: 60px;
    font-size: 1.6rem;
    margin-bottom: 0.9rem;
  }
}

/* ---------- 22.17 Teacher host layout ---------- */
@media (max-width: 992px) {
  .quiz-host-layout {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }

  .host-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
    margin-bottom: 1rem;
  }

  .host-header h1 { font-size: 1.6rem; }

  .host-header .session-meta {
    font-size: 0.8rem;
    gap: 0.5rem;
  }

  .host-header .session-meta strong { font-size: 1.05rem; }

  .host-question-toolbar {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-bottom: 0.75rem;
    margin-bottom: 0.9rem;
  }

  .question-progress-pill { font-size: 0.78rem; }

  .difficulty-badge {
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
  }

  .timer-ring-wrap {
    width: 60px;
    height: 60px;
  }

  .timer-ring-value { font-size: 1.3rem; }

  .question-prompt {
    font-size: 1.05rem;
    line-height: 1.4;
    margin-bottom: 1rem;
  }

  .leaderboard-list { max-height: 340px; }

  .participant-rank-card {
    padding: 0.55rem 0.7rem;
    gap: 0.6rem;
    border-radius: 12px;
  }

  .rank-number {
    width: 24px;
    height: 24px;
    font-size: 0.72rem;
  }

  .participant-rank-card .participant-avatar {
    width: 34px;
    height: 34px;
  }

  .participant-rank-card .participant-name  { font-size: 0.85rem; }
  .participant-rank-card .participant-stats { font-size: 0.7rem; gap: 0.5rem; }

  .rank-tag { font-size: 0.82rem; }
}

/* ---------- 22.18 Waiting rooms ---------- */
@media (max-width: 640px) {
  .code-display-wrap {
    gap: 0.6rem;
    margin-bottom: 1rem;
  }

  .session-code {
    font-size: 2rem !important;
    letter-spacing: 0.15rem !important;
  }

  .action-icon-btn {
    width: 40px;
    height: 40px;
    font-size: 0.95rem;
  }

  .code-actions-grid {
    flex-direction: column;
    gap: 0.5rem;
  }

  .code-actions-grid .btn {
    width: 100%;
    padding: 0.75rem 1rem !important;
    font-size: 0.88rem !important;
  }

  .player-profile-badge {
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 0.9rem;
    border-radius: 14px;
  }

  .player-avatar-ring {
    width: 52px;
    height: 52px;
  }

  .player-name { font-size: 1.05rem; }
  .pin-pill-tag { font-size: 0.72rem; }
  .pin-pill-tag strong { font-size: 0.9rem; }

  .ready-indicator {
    font-size: 0.72rem;
    padding: 0.3rem 0.7rem;
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .player-card-chip {
    padding: 0.4rem 0.6rem;
    gap: 0.4rem;
  }

  .chip-avatar-wrapper {
    width: 28px;
    height: 28px;
  }

  .chip-name { font-size: 0.78rem; }

  .waiting-status-card {
    padding: 0.8rem 0.9rem;
    font-size: 0.85rem;
    gap: 0.5rem;
  }
}

/* ---------- 22.19 Truth Gate — smaller ---------- */
@media (max-width: 640px) {
  .verification-container { padding: 1.4rem 1rem !important; }
  .verification-title     { font-size: 1.4rem !important; }
  .verification-subtitle  { font-size: 0.85rem !important; margin-bottom: 1rem !important; }
  .truth-gate             { margin: 0.9rem 0 !important; }

  .gate-circle {
    width: 80px !important;
    height: 80px !important;
  }

  .gate-symbol {
    width: 40px !important;
    height: 40px !important;
  }

  .ritual-text {
    font-size: 0.85rem !important;
    margin: 0.75rem 0 1rem !important;
  }

  .verification-controls {
    flex-direction: column;
    gap: 0.5rem;
  }

  .verification-controls .verification-btn {
    width: 100%;
    justify-content: center;
  }

  .verification-success,
  .verification-error {
    font-size: 0.82rem;
    padding: 0.65rem 0.9rem;
  }
}

/* ---------- 22.20 Canvas — subtle on mobile ---------- */
@media (max-width: 640px) {
  #bgCanvas       { opacity: 0.35 !important; }
  #particleCanvas { opacity: 0.25 !important; }
}

/* ---------- 22.21 Self-practice results ---------- */
@media (max-width: 640px) {
  .score-circle {
    width: 120px !important;
    height: 120px !important;
  }

  .score-pct { font-size: 2.1rem !important; }
  .score-lbl { font-size: 0.65rem !important; }

  .stat-chips { gap: 0.45rem !important; }

  .chip {
    padding: 0.65rem 0.5rem !important;
    border-radius: 14px !important;
  }

  .chip-val { font-size: 1.15rem !important; }
  .chip-lbl { font-size: 0.62rem !important; }

  .share-section {
    padding: 1rem 0.9rem !important;
    border-radius: 18px !important;
  }

  .share-title    { font-size: 1rem !important; }
  .share-subtitle { font-size: 0.75rem !important; }

  .share-buttons {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 0.4rem !important;
  }

  .share-btn {
    aspect-ratio: 1;
    border-radius: 12px;
    font-size: 0.95rem;
  }

  .btn-row {
    flex-direction: column;
    gap: 0.5rem;
  }

  .btn-half {
    width: 100%;
    padding: 0.75rem !important;
    font-size: 0.86rem !important;
  }

  .review-item {
    padding: 0.7rem 0.8rem;
    gap: 0.6rem;
  }

  .ri-body          { font-size: 0.78rem; }
  .ri-body strong   { font-size: 0.85rem; }
}

/* ---------- 22.22 Sliders on mobile ---------- */
@media (max-width: 640px) {
  .count-wrap { gap: 0.6rem !important; }

  .count-val {
    font-size: 1.6rem !important;
    min-width: 40px;
  }

  .slider-bound { font-size: 0.7rem !important; }
  .count-hint   { font-size: 0.7rem !important; }

  .count-slider::-webkit-slider-thumb {
    width: 26px;
    height: 26px;
  }
}

/* ---------- 22.23 CTA inline buttons on mobile ---------- */
@media (max-width: 640px) {
  .cta-banner .hero-actions {
    flex-direction: row !important;
    flex-wrap: wrap !important;
  }
  .cta-banner .hero-actions .btn {
    width: auto !important;
    min-width: 140px;
  }
}

/* ---------- 22.24 Legacy small-screen media queries ---------- */
@media (max-width: 768px) {
  .hero-title { font-size: 2.6rem; }

  .hero-actions {
    flex-direction: column;
    width: 100%;
    padding: 0 var(--sp-2);
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .grid-layout { grid-template-columns: 1fr; }
}

@media (max-width: 580px) {
  .card { padding: 1.4rem 1.2rem; }
  .rights-grid { grid-template-columns: 1fr; }
  .cookie-table { font-size: 0.78rem; }
  .cookie-table th,
  .cookie-table td { padding: 0.5rem 0.7rem; }
}

@media (max-width: 768px) {
  .form-grid-2,
  .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .stats-row { grid-template-columns: 1fr; }
  .session-code { font-size: 2.8rem; }
  .code-actions-grid { flex-direction: column; }
}
.name-error {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--red);
}
.name-error::before {
  content: "\f071";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 0.75rem;
  line-height: 1;
}

/* ============================================================================
   END OF FILE
   ============================================================================ */