@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --purple: #321d5a;
  --purple-dark: #1a0d38;
  --purple-light: #4a2c7a;
  --gold: #f59e0b;
  --pink: #b4488a;
  --yellow: #f59e0b;
  --teal: #059669;
  --blue: #2563eb;
  --danger: #dc2626;
  --bg: #f8f8fa;
  --panel: #ffffff;
  --text: #14121a;
  --muted: #6b6b76;
  --border: #e8e7ec;
  --radius: 12px;
  --radius-sm: 8px;
  --shell-max: 480px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --shadow-sm: 0 1px 2px rgba(20,18,26,0.05);
  --shadow-md: 0 2px 4px rgba(20,18,26,0.04), 0 8px 16px rgba(20,18,26,0.06);
  --shadow-lg: 0 4px 8px rgba(20,18,26,0.05), 0 16px 32px rgba(20,18,26,0.09);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 600; margin: 0 0 8px; letter-spacing: -0.01em; }

a { color: inherit; }

/* ---------- Logo lockup ---------- */
.logo-lockup { display: inline-flex; align-items: center; gap: 10px; }
.logo-mark { flex-shrink: 0; display: block; border-radius: 11px; box-shadow: var(--shadow-sm); }
.logo-word { display: flex; flex-direction: column; line-height: 1.05; font-family: 'Space Grotesk', sans-serif; }
.logo-word-main { font-weight: 700; font-size: 1rem; letter-spacing: 0.01em; }
.logo-word-sub { font-weight: 500; font-size: 0.62rem; letter-spacing: 0.14em; color: var(--gold); }

/* ---------- App shell ---------- */
.app {
  max-width: var(--shell-max);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
}
.app.no-nav { padding-bottom: 24px; }

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(14px + var(--safe-t)) 18px 14px;
  background: linear-gradient(120deg, var(--purple), var(--purple-dark));
  overflow: hidden;
}
.appbar::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.09) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.6;
  pointer-events: none;
}
.appbar h1 { position: relative; font-size: 1.1rem; margin: 0; flex: 1; color: #fff; }
.appbar .back { position: relative; font-size: 1.4rem; line-height: 1; text-decoration: none; color: rgba(255,255,255,0.85); font-weight: 800; }
.appbar .back:hover { color: #fff; }
.appbar-breadcrumb { position: relative; font-size: 0.76rem; color: rgba(255,255,255,0.65); margin-top: 2px; }
.appbar-breadcrumb a { color: rgba(255,255,255,0.85); text-decoration: none; }
.appbar-breadcrumb a:hover { color: #fff; }

/* ---------- Dashboard top strip (search + notifications + user menu) ---------- */
.appbar-top {
  position: relative;
  display: none;
  align-items: center;
  gap: 16px;
  width: 100%;
  margin-bottom: 18px;
}
.appbar-search {
  flex: 1;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 999px;
  padding: 9px 16px;
  color: rgba(255,255,255,0.9);
}
.appbar-search svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.85; }
.appbar-search input {
  all: unset;
  flex: 1;
  color: #fff;
  font-size: 0.85rem;
  width: 100%;
}
.appbar-search input::placeholder { color: rgba(255,255,255,0.6); }
.appbar-icons { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.appbar-icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.1);
  text-decoration: none;
}
.appbar-icon-btn svg { width: 17px; height: 17px; }
.appbar-icon-btn:hover { background: rgba(255,255,255,0.2); color: #fff; }
.appbar-icon-btn .dot { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); border: 1.5px solid var(--purple); }
.appbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
}
.appbar-user:hover { background: rgba(255,255,255,0.2); }
.appbar-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--purple-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.appbar-user-name { font-size: 0.82rem; font-weight: 600; white-space: nowrap; }

@media (min-width: 900px) {
  .appbar-top { display: flex; }
  .appbar { flex-wrap: wrap; padding: 20px 32px 22px; }
  .appbar h1 { flex: none; width: 100%; font-size: 1.35rem; }
}

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: var(--shell-max);
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--panel);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 30;
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 600;
  padding: 0 2px;
}
.bottom-nav a .icon { display: inline-flex; }
.bottom-nav a .nav-icon { width: 20px; height: 20px; }
.sidebar-logo { display: none; }
.sidebar-more { display: none; }
.bottom-nav a.active { color: var(--purple); }

.content { padding: 18px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--purple);
  color: #fff;
  border: none;
  padding: 13px 24px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(17,24,39,0.06);
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
  touch-action: manipulation;
}
.btn:hover { background: var(--purple-dark); box-shadow: 0 4px 12px rgba(50,29,90,0.3); }
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.btn-ghost { background: var(--panel); color: var(--text); border: 1px solid var(--border); box-shadow: none; }
.btn-ghost:hover { background: var(--bg); border-color: #d1d5db; }
.btn-ghost:active { transform: none; }
.btn-pink { background: var(--pink); }
.btn-pink:hover { background: #be185d; }
.btn-teal { background: var(--teal); }
.btn-teal:hover { background: #047857; }
.btn-small { padding: 8px 16px; font-size: 0.85rem; border-radius: 999px; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-gold { background: var(--gold); color: var(--purple-dark); font-weight: 700; }
.btn-gold:hover { background: #d97706; }
.fab {
  position: fixed;
  right: max(18px, calc(50vw - var(--shell-max) / 2 + 18px));
  bottom: calc(var(--nav-h) + var(--safe-b) + 18px);
  width: 58px; height: 58px;
  border-radius: 50%;
  background: var(--pink);
  color: #fff;
  font-size: 1.8rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px rgba(255,92,147,0.5);
  text-decoration: none;
  z-index: 25;
}

/* ---------- Cards & panels ---------- */
.panel {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; }
.section-title { font-size: 1rem; font-weight: 700; margin: 22px 0 12px; }

.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.course-card {
  border-radius: var(--radius);
  padding: 16px;
  color: #fff;
  text-decoration: none;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.course-card:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(50,29,90,0.28); }
.course-card .cc-title { font-family: 'Space Grotesk', sans-serif; font-size: 1.05rem; }
.course-card .cc-meta { font-size: 0.75rem; opacity: 0.9; font-weight: 500; }

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  border: 1px solid transparent;
}
.list-row:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(50,29,90,0.12); border-color: var(--border); }
.list-row .emoji { font-size: 1.5rem; flex-shrink: 0; }
.list-row .lr-title { font-weight: 700; }
.list-row .lr-sub { font-size: 0.78rem; color: var(--muted); }
.list-row .lr-arrow { margin-left: auto; color: var(--muted); transition: transform 0.2s ease; }
.list-row:hover .lr-arrow { transform: translateX(3px); color: var(--purple); }

.chip { display: inline-block; background: var(--border); color: var(--purple); padding: 4px 12px; border-radius: 999px; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.chip-teal { background: var(--teal); color: #fff; }
.chip-gold { background: var(--gold); color: #fff; }
.chip-danger { background: var(--danger); color: #fff; }
.chip-pink { background: var(--pink); color: #fff; }

/* ---------- Dashboard hero banner ---------- */
.dash-hero {
  position: relative;
  background: linear-gradient(135deg, var(--purple), var(--purple-dark));
  color: #fff;
  border-radius: var(--radius);
  padding: 24px 22px;
  margin-bottom: 22px;
  overflow: hidden;
}
.dash-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.1) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.5;
  pointer-events: none;
}
.dash-hero-inner { position: relative; z-index: 1; }
.dash-hero h2 { font-size: 1.3rem; margin-bottom: 4px; }
.dash-hero p { opacity: 0.85; font-size: 0.85rem; margin-bottom: 16px; }
.dash-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.dash-stat {
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  padding: 10px 16px;
  min-width: 84px;
}
.dash-stat .num { font-family: 'Space Grotesk', sans-serif; font-weight: 800; font-size: 1.3rem; line-height: 1.1; }
.dash-stat .label { font-size: 0.68rem; opacity: 0.85; margin-top: 2px; }

/* ---------- Forms ---------- */
label { display: block; margin-bottom: 14px; font-size: 0.85rem; color: var(--muted); font-weight: 600; }
input, textarea, select {
  width: 100%;
  padding: 13px 14px;
  margin-top: 6px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--purple); }
.error { color: var(--danger); font-weight: 600; background: rgba(255,92,92,0.1); padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; }
.muted { color: var(--muted); }

/* ---------- Auth / landing ---------- */
.auth-card {
  max-width: var(--shell-max);
  margin: 0 auto;
  min-height: 100vh;
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-card .logo { margin-bottom: 18px; }
.auth-card .logo .logo-word-main { color: var(--text); font-size: 1.1rem; }
.auth-card h1 { font-size: 1.5rem; }

/* ---------- Landing page ---------- */
.landing-page { overflow-x: hidden; }

.edu-nav {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.edu-nav-inner { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; max-width: 1600px; margin: 0 auto; }
.edu-nav-links { display: flex; align-items: center; gap: 16px; }
.nav-link { color: var(--text); text-decoration: none; font-weight: 500; font-size: 0.9rem; opacity: 0.75; transition: opacity 0.2s; }
.nav-link:hover { opacity: 1; }

.edu-hero { background: var(--bg); padding: 20px 24px 56px; overflow: hidden; }
.edu-hero-inner { max-width: 1600px; margin: 0 auto; }
.edu-hero-text { max-width: 520px; }

.hero-badge {
  display: inline-block;
  background: rgba(50,29,90,0.08);
  border: 1px solid rgba(50,29,90,0.16);
  color: var(--purple);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin-bottom: 18px;
}
.edu-hero-text h1 { font-size: 2.4rem; margin: 0 0 14px; line-height: 1.12; color: var(--text); }
.edu-hero-text h1 .accent {
  background: linear-gradient(90deg, var(--purple), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.edu-hero-text .tagline { color: var(--muted); font-size: 1.05rem; margin-bottom: 28px; line-height: 1.6; max-width: 440px; }
.edu-hero-text .cta-group { display: flex; flex-direction: column; gap: 10px; max-width: 340px; margin-bottom: 30px; }
.edu-hero-text .cta-group .btn { box-shadow: 0 4px 16px rgba(50,29,90,0.2); }
.edu-hero-text .cta-group .btn-ghost { box-shadow: none; }

.edu-trust { display: flex; align-items: center; gap: 10px; font-size: 0.78rem; }
.edu-trust-label { color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; font-size: 0.66rem; }
.edu-trust-item { color: var(--text); font-weight: 600; }

.edu-hero-visual {
  display: block;
  position: relative;
  z-index: 1;
  --px: 0px; --py: 0px;
  transform: translate(var(--px), var(--py));
  transition: transform 0.15s ease-out;
  padding-top: 20px;
}

.edu-shape { position: absolute; border-radius: 50%; opacity: 0.5; animation: blobFloat 8s ease-in-out infinite; will-change: transform; }
.edu-shape-1 { width: 60px; height: 60px; border: 3px solid var(--gold); top: 0; right: 10%; }
.edu-shape-2 { width: 22px; height: 22px; background: var(--purple); opacity: 0.15; bottom: 10%; left: 0; animation-delay: -3s; }

.edu-float-badge {
  position: absolute;
  right: -6px;
  bottom: -14px;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 2;
}
.edu-float-badge-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: rgba(245,158,11,0.14);
  color: #b45309;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.edu-float-badge-num { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1.1rem; line-height: 1.1; }
.edu-float-badge-label { font-size: 0.68rem; color: var(--muted); font-weight: 600; }

@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(12px, -18px) scale(1.06); }
}

.mock-quiz { max-width: 420px; margin: 0 auto; }
.mock-card {
  background: linear-gradient(160deg, #ffffff, #f6f3ff);
  color: var(--text);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(20,10,50,0.35), 0 0 0 1px rgba(255,255,255,0.4) inset;
  padding: 18px;
}
.mock-quiz-tag { font-size: 0.68rem; font-weight: 800; color: var(--pink); letter-spacing: 0.05em; margin-bottom: 8px; }
.mock-quiz-q { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1.05rem; margin-bottom: 12px; }
.mock-quiz-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mock-opt { border-radius: 10px; padding: 10px; font-size: 0.72rem; font-weight: 700; color: #fff; }
.mock-opt-a { background: var(--purple); }
.mock-opt-b { background: var(--pink); }
.mock-opt-c { background: var(--blue); }
.mock-opt-d { background: #ff9f43; }

.mock-leader { margin-top: 16px; max-width: 260px; }
.mock-leader-title { font-weight: 800; font-family: 'Space Grotesk', sans-serif; margin-bottom: 10px; font-size: 0.95rem; }
.mock-leader-row { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 600; padding: 6px 0; color: var(--text); }
.mock-leader-row span:nth-child(2) { flex: 1; }
.mock-rank { width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 0.65rem; font-weight: 700; color: #fff; flex-shrink: 0; }
.mock-rank-1 { background: var(--gold); }
.mock-rank-2 { background: #9ca3af; }
.mock-rank-3 { background: #b45309; }

.floaty { animation: floatY 5s ease-in-out infinite; will-change: transform; }
.floaty-delay { animation: floatY 5s ease-in-out infinite; animation-delay: -2.5s; will-change: transform; }
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.landing-stats {
  background: var(--panel);
  padding: 32px 24px;
  border-bottom: 1px solid var(--border);
}
.landing-stats-inner {
  max-width: 1600px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  text-align: center;
}
.stat-number { font-family: 'Space Grotesk', sans-serif; font-weight: 800; font-size: 1.8rem; color: var(--purple); }
.stat-label { font-size: 0.75rem; color: var(--muted); margin-top: 4px; font-weight: 600; }

.landing-how {
  padding: 56px 24px;
  background: var(--bg);
  text-align: center;
}
.landing-how h2 { font-size: 1.3rem; margin-bottom: 32px; }
.how-steps {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 480px;
  margin: 0 auto;
}
.how-connector { display: none; }
.how-step {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: 0 4px 16px rgba(60,40,120,0.06);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.how-step:hover { transform: translateY(-4px); box-shadow: 0 12px 28px rgba(50,29,90,0.12); }
.how-num {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--purple-dark));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  margin: 0 auto 12px;
}
.how-title { font-weight: 700; margin-bottom: 6px; }
.how-desc { font-size: 0.85rem; color: var(--muted); line-height: 1.5; }

.landing-features {
  padding: 48px 24px;
  background: var(--bg);
  position: relative;
}
.landing-features h2 {
  font-size: 1.3rem;
  text-align: center;
  margin-bottom: 24px;
}
.feature-grid { display: flex; flex-direction: column; gap: 14px; max-width: 480px; margin: 0 auto; }
.feature-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--panel);
  border-radius: var(--radius-sm);
  padding: 16px;
  box-shadow: 0 4px 16px rgba(60,40,120,0.06);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.feature-item .fi-emoji {
  width: 46px; height: 46px;
  flex-shrink: 0;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.feature-item .fi-emoji svg { width: 22px; height: 22px; }
.feature-item:nth-child(1) .fi-emoji { background: rgba(50,29,90,0.08); color: var(--purple); }
.feature-item:nth-child(2) .fi-emoji { background: rgba(245,158,11,0.14); color: #b45309; }
.feature-item:nth-child(3) .fi-emoji { background: rgba(5,150,105,0.1); color: #047857; }
.feature-item .fi-title { font-weight: 700; }
.feature-item .fi-desc { font-size: 0.8rem; color: var(--muted); }

.landing-footer {
  text-align: center;
  padding: 56px 24px 64px;
  background: linear-gradient(180deg, rgba(50,29,90,0.04), rgba(50,29,90,0.08));
  color: var(--text);
  position: relative;
  overflow: hidden;
  border-top: 1px solid var(--border);
}
.landing-footer::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(50,29,90,0.06) 1px, transparent 1px);
  background-size: 26px 26px;
  opacity: 0.6;
}
.landing-footer h2, .landing-footer .btn, .landing-footer .muted { position: relative; z-index: 1; }
.landing-footer h2 { font-size: 1.4rem; margin-bottom: 18px; color: var(--text); }
.landing-footer .btn {
  background: var(--purple);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(50,29,90,0.25);
}
.landing-footer .btn:hover { background: var(--purple-dark); }
.landing-footer .muted { margin-top: 18px; font-size: 0.8rem; color: var(--muted); }

/* Scroll-reveal animation */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.in-view { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .floaty, .floaty-delay, .edu-shape { animation: none; }
}

.qb-add-row { display: flex; gap: 10px; flex-wrap: wrap; }
.qb-add-row .btn { flex: 1; min-width: 140px; }

/* ---------- Master table (data-grid style CRUD) ---------- */
.mt-card {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  margin-bottom: 24px;
}
.mt-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.mt-toolbar-count { font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.mt-add-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--purple);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.mt-add-toggle::-webkit-details-marker { display: none; }
.mt-add-toggle svg { width: 15px; height: 15px; }
details[open] > .mt-add-toggle { background: var(--purple-dark); }
.mt-add-panel { padding: 18px 20px; border-bottom: 1px solid var(--border); background: var(--bg); }
.mt-add-panel form { display: grid; grid-template-columns: 1fr; gap: 12px; max-width: 640px; }
.mt-add-panel label { margin-bottom: 0; }

.mt-filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-wrap: wrap;
}
.mt-filter-bar label { display: flex; flex-direction: column; gap: 4px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); margin-bottom: 0; }
.mt-filter-bar select { min-width: 220px; }
.mt-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--purple);
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.mt-group-title:first-child { border-top: none; }
.mt-group-count { font-size: 0.68rem; font-weight: 600; color: var(--muted); background: var(--border); padding: 2px 8px; border-radius: 999px; }
.mt-subgroup-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px 8px 32px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--bg);
}

.mt-table-wrap { overflow-x: auto; }
.mt-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.mt-table thead th {
  text-align: left;
  padding: 11px 20px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.mt-table tbody td { padding: 13px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.mt-table tbody tr:last-child td { border-bottom: none; }
.mt-table tbody tr:hover { background: var(--bg); }
.mt-table td svg { width: 16px; height: 16px; }
.mt-check-yes { color: var(--teal); }
.mt-check-no { color: var(--border); }
.mt-actions-cell { text-align: right; }
.mt-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.mt-icon-btn svg { width: 16px; height: 16px; }
.mt-icon-btn:hover { background: rgba(220,38,38,0.1); color: var(--danger); }
.mt-icon-btn-edit { text-decoration: none; }
.mt-icon-btn-edit:hover { background: rgba(50,29,90,0.1); color: var(--purple); }
.mt-empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 0.85rem; }

.mt-add-panel form { align-items: end; }
.mt-add-panel form > button, .mt-add-panel form > a.btn { display: inline-flex; width: fit-content; }
@media (min-width: 600px) {
  .mt-add-panel form { grid-template-columns: 1fr 1fr; }
  .mt-add-panel form > label[data-full], .mt-add-panel form > button, .mt-add-panel form > a.btn { grid-column: 1 / -1; }
}

/* ---------- Dashboard tile grid (grouped quick actions) ---------- */
.dash-group-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 20px 0 10px;
}
.dash-group-title:first-of-type { margin-top: 0; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 10px; }
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 14px 6px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: transparent; }
.tile-active { background: var(--purple); border-color: var(--purple); color: #fff; }
.tile-active .tile-icon { background: rgba(255,255,255,0.18); }
.tile-active:hover { transform: none; }
.tile-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: var(--bg);
  color: var(--purple);
  flex-shrink: 0;
}
.tile-svg { width: 20px; height: 20px; }
.tile-active .tile-svg { color: #fff; }
.tile-label { font-size: 0.7rem; font-weight: 600; text-align: center; line-height: 1.25; }

@media (min-width: 900px) {
  .tile-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 14px; }
  .tile { padding: 18px 8px; }
  .tile-icon { width: 46px; height: 46px; font-size: 1.4rem; }
  .tile-label { font-size: 0.75rem; }
}
/* ---------- Quiz builder shell ---------- */
.mt-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.mt-card-head svg { width: 20px; height: 20px; color: var(--purple); flex-shrink: 0; margin-top: 2px; }
.mt-card-title { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1rem; letter-spacing: -0.01em; }
.mt-card-sub { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.mt-card-body { padding: 18px 20px; }
.mt-card-body label { margin-bottom: 12px; }
.mt-card-body input[type="text"], .mt-card-body input[type="url"] { max-width: 480px; }
.mt-card-body textarea { max-width: 760px; }

.qb-shell { width: 100%; display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 16px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: 1 / -1; }
@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2, .form-grid .span-3 { grid-column: 1 / -1; }
}
.field { display: flex; flex-direction: column; margin-bottom: 0; }
.field-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 6px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.field-label em { font-style: normal; font-weight: 500; text-transform: none; letter-spacing: normal; color: #b0aeb8; font-size: 0.68rem; }
.field input, .field textarea, .field select { margin-top: 0; }

.qb-toolbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.qb-toolbar-actions .btn svg { width: 15px; height: 15px; vertical-align: -2px; margin-right: 4px; }
.qb-questions { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.qb-questions:empty { padding: 0; }
.qb-empty { display: none; padding: 40px 20px; text-align: center; color: var(--muted); font-size: 0.85rem; }
.qb-questions:empty + .qb-empty { display: block; }

.qb-actionbar {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 0;
  margin-top: 4px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.qb-bulk-panel {
  padding: 16px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.qb-bulk-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.qb-bulk-panel textarea { font-family: 'ui-monospace', 'Consolas', monospace; font-size: 0.82rem; }
.qb-bulk-panel code {
  background: rgba(50,29,90,0.06);
  color: var(--purple);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.78rem;
}

.question-block {
  background: var(--panel);
  border-radius: var(--radius-sm);
  padding: 16px;
  border: 1px solid var(--border);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.question-block:focus-within { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(50,29,90,0.08); }
.question-block-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.q-badge {
  width: 24px; height: 24px;
  border-radius: 7px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--purple);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}
.q-type-label { font-size: 0.65rem; letter-spacing: 0.02em; padding: 3px 10px; }
.question-block-header .remove-question { margin-left: auto; }
.question-block .q-hint {
  background: rgba(50,29,90,0.05);
  border-left: 3px solid var(--purple);
  padding: 7px 10px;
  border-radius: 0 6px 6px 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}
.q-row { display: flex; gap: 12px; flex-wrap: wrap; }
.q-row .field { flex: 1; min-width: 140px; }
.option-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.option-row:last-child { margin-bottom: 0; }
.option-row .opt-text, .option-row .blank-text, .option-row .match-term, .option-row .match-def { flex: 1; margin-top: 0; padding: 10px 12px; }
.option-row .opt-correct { width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--purple); }
.option-row .btn-danger { padding: 8px 10px; flex-shrink: 0; }
.q-block-options, .q-block-blank, .q-block-match { margin-top: 4px; }

/* ---------- Question type picker (tile grid) ---------- */
.qt-picker { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.qt-group-label { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 6px; }
.qt-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.qt-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  background: var(--panel);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.qt-tile:hover { border-color: var(--purple-light); transform: translateY(-1px); }
.qt-tile.selected { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(50,29,90,0.1); }
.qt-icon {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.qt-icon svg { width: 18px; height: 18px; }
.qt-tile[data-color="purple"] .qt-icon { background: var(--purple); }
.qt-tile[data-color="teal"] .qt-icon { background: var(--teal); }
.qt-tile[data-color="blue"] .qt-icon { background: var(--blue); }
.qt-tile[data-color="gold"] .qt-icon { background: var(--gold); }
.qt-tile[data-color="pink"] .qt-icon { background: var(--pink); }
.qt-tile[data-color="green"] .qt-icon { background: #16a34a; }
.qt-tile[data-color="indigo"] .qt-icon { background: #6366f1; }
.qt-tile[data-color="orange"] .qt-icon { background: #ea580c; }
.qt-tile[data-color="red"] .qt-icon { background: var(--danger); }

.qt-picker-wrap { padding: 4px 0 6px; }
.qt-picker-wrap > .field-label { margin-bottom: 10px; }

.q-change-type {
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.q-change-type::after { content: ''; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); margin-left: 2px; opacity: 0.8; }
.q-change-type:hover { filter: brightness(0.92); }

.q-editor { padding-top: 2px; }
.q-toolbar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; max-width: 320px; }
.q-toolbar-field { flex: 1; min-width: 120px; }

.q-canvas {
  background: linear-gradient(150deg, var(--purple), var(--purple-dark));
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 14px;
}
.q-canvas .q-text {
  width: 100%;
  min-height: 64px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  resize: vertical;
  padding: 0;
  margin: 0;
}
.q-canvas .q-text::placeholder { color: rgba(255,255,255,0.55); }
.q-canvas .q-text:focus { outline: none; }
.q-canvas .q-media-field { margin-top: 14px; margin-bottom: 0; }
.q-canvas .q-media-field .field-label { color: rgba(255,255,255,0.75); }
.q-canvas .q-media-field input { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.25); color: #fff; }
.q-canvas .q-media-field input::placeholder { color: rgba(255,255,255,0.5); }

.qt-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 10px; }
.qt-card {
  position: relative;
  min-height: 110px;
  border-radius: var(--radius-sm);
  padding: 16px 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.qt-cards .qt-card:nth-child(4n+1) { background: var(--blue); }
.qt-cards .qt-card:nth-child(4n+2) { background: var(--teal); }
.qt-cards .qt-card:nth-child(4n+3) { background: var(--gold); }
.qt-cards .qt-card:nth-child(4n+4) { background: var(--pink); }
.qt-card .opt-text {
  width: 100%;
  background: transparent;
  border: none;
  color: #fff;
  font-weight: 600;
  text-align: center;
  resize: none;
  min-height: 44px;
  padding: 0;
  margin: 0;
}
.qt-card .opt-text::placeholder { color: rgba(255,255,255,0.7); }
.qt-card .opt-text:focus { outline: none; }
.qt-card-remove {
  position: absolute;
  top: 8px; left: 8px;
  width: 24px; height: 24px;
  border: none;
  border-radius: 6px;
  background: rgba(0,0,0,0.18);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.qt-card-remove:hover { background: rgba(0,0,0,0.32); }
.qt-card-remove svg { width: 13px; height: 13px; }
.qt-card-check {
  position: absolute;
  top: 8px; right: 8px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,0.18);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.qt-card-check input { position: absolute; opacity: 0; width: 24px; height: 24px; margin: 0; cursor: pointer; }
.qt-card-check::after {
  content: '';
  width: 10px; height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
  opacity: 0.55;
}
.qt-card-check:has(input:checked) { background: rgba(255,255,255,0.95); }
.qt-card-check:has(input:checked)::after { opacity: 1; border-color: var(--purple); }

/* ---------- Quiz save screen: name/subject/class/language/visibility/cover ---------- */
#screen-meta .field { position: relative; }
.meta-counter { position: absolute; right: 2px; top: 0; font-size: 0.68rem; color: var(--muted); font-weight: 600; }

.visibility-options { display: flex; flex-direction: column; gap: 10px; }
.visibility-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 0;
  font-weight: 400;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.visibility-option:has(input:checked) { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(50,29,90,0.08); }
.visibility-option input { width: auto; margin: 3px 0 0; accent-color: var(--purple); flex-shrink: 0; }
.visibility-option-title { display: block; font-weight: 700; font-size: 0.88rem; color: var(--text); }
.visibility-option-sub { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

.cover-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  width: 100%;
  max-width: 320px;
  height: 140px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  overflow: hidden;
}
.cover-upload:hover { border-color: var(--purple-light); }
.cover-upload-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.cover-upload-empty svg { width: 22px; height: 22px; }
.cover-upload img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Live quiz: lobby / host / play ---------- */
.lobby { text-align: center; }
.room-code {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  background: linear-gradient(90deg, var(--purple), var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 10px 0;
}
.player-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 16px 0; }
.chip-player { background: var(--bg); padding: 8px 16px; border-radius: 999px; font-size: 0.85rem; font-weight: 600; }

.join-panel {
  display: flex;
  align-items: stretch;
  gap: 16px;
  background: linear-gradient(135deg, var(--purple), var(--purple-dark));
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  text-align: left;
  flex-wrap: wrap;
}
.join-panel-steps { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.join-step { display: flex; align-items: center; gap: 12px; }
.join-step-num {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.join-step-body { flex: 1; min-width: 0; }
.join-step-label { font-size: 0.68rem; color: rgba(255,255,255,0.65); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.join-step-value {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.join-link-value { font-size: 0.95rem; }
.join-code-value { font-size: 1.5rem; letter-spacing: 0.1em; }
.join-copy-btn {
  width: 32px; height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.join-copy-btn:hover { background: rgba(255,255,255,0.22); }
.join-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 10px;
}
.join-qr img { display: block; border-radius: 4px; }
.join-qr p { font-size: 0.7rem; color: var(--muted); margin: 0; }
@media (max-width: 480px) {
  .join-panel { flex-direction: column; align-items: center; }
  .join-panel-steps { width: 100%; }
}

.host-question, .student-question, .student-review, .student-waiting { text-align: center; }

@keyframes questionPop {
  from { opacity: 0; transform: scale(0.93) translateY(14px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes tilePop {
  from { opacity: 0; transform: translateY(10px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes bgDrift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.student-question, .host-question, .student-waiting[class*="q-bg-"] {
  border-radius: var(--radius);
  padding: 28px 20px;
  margin: -18px -18px 18px;
  color: #fff;
  animation: questionPop 0.4s ease both, bgDrift 12s ease infinite;
  background-size: 200% 200%;
}
.student-question .muted, .host-question .muted, .student-waiting[class*="q-bg-"] .muted { color: rgba(255,255,255,0.8); }
.student-question h2, .host-question h2, .student-waiting[class*="q-bg-"] h2 { color: #fff; white-space: pre-wrap; }
/* Multi-line questions (ASCII grids: sudoku, word search) need a monospace face + no line-wrapping (wrapping
   breaks the grid alignment), so wide grids scroll horizontally inside their own box instead of reflowing. */
.student-question h2.pre-question, .host-question h2.pre-question, .phone-frame-screen .student-question h2.pre-question {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem !important;
  line-height: 1.5;
  text-align: left;
  white-space: pre !important;
  display: block;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 4px;
}
/* A real bordered Sudoku grid (white cells, black grid lines) instead of a wall of monospace text. */
.qgrid-wrap { overflow-x: auto; max-width: 100%; padding-bottom: 4px; }
.qgrid { display: inline-grid; gap: 1px; background: #999; border: 2px solid #333; border-radius: 4px; margin: 10px auto; }
.qgrid-cell { display: flex; align-items: center; justify-content: center; background: #fff; color: #111; font-weight: 800; }
.qgrid-cell.blank { background: #f4f4f6; }
.qgrid-cell.ask { background: var(--gold); color: #1a0d38; }
.qgrid-title { color: rgba(255,255,255,0.85); margin: 0 0 4px; font-size: 0.85rem; }

.puzzle-block { text-align: left; max-width: 520px; margin: 0 auto; }
.puzzle-badge {
  display: inline-block;
  background: var(--gold);
  color: #1a0d38;
  font-weight: 800;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 11px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.puzzle-line { color: rgba(255,255,255,0.92); margin: 5px 0; font-size: 0.95rem; line-height: 1.4; }
.puzzle-clues { margin: 4px 0 6px 20px; padding: 0; color: rgba(255,255,255,0.92); font-size: 0.92rem; }
.puzzle-clues li { margin: 3px 0; line-height: 1.4; }

/* ---------- Join a quiz ---------- */
.join-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: #fff;
  border-radius: var(--radius);
  padding: clamp(24px, 6vw, 34px) 20px;
  margin-bottom: 18px;
  text-align: center;
}
.join-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.12) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.6;
}
.join-hero-icon {
  position: relative;
  z-index: 1;
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}
.join-hero-icon svg { width: 28px; height: 28px; stroke: #fff; }
.join-hero h2 { position: relative; z-index: 1; font-size: clamp(1.15rem, 4vw, 1.5rem); margin: 0 0 6px; }
.join-hero p { position: relative; z-index: 1; opacity: 0.9; font-size: 0.88rem; margin: 0; max-width: 340px; margin-inline: auto; }

.join-card {
  max-width: 440px;
  width: 100%;
  margin: 0 auto;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 22px 20px;
  box-sizing: border-box;
}
.join-card .btn { margin-top: 4px; }

.join-code-pill {
  text-align: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 18px;
}
.join-code-pill span { display: block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 4px; }
.join-code-pill strong { font-family: 'Space Grotesk', sans-serif; font-size: clamp(1.6rem, 8vw, 2rem); font-weight: 800; letter-spacing: 0.08em; color: var(--purple); word-break: break-all; }

.join-code-input {
  font-size: clamp(1.2rem, 6vw, 1.5rem) !important;
  text-align: center;
  letter-spacing: 0.15em;
  font-weight: 700;
  font-family: 'Space Grotesk', sans-serif;
}

.join-resume-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border-left: 4px solid var(--gold);
  margin-bottom: 14px;
}
.join-resume-badge {
  display: inline-block;
  background: rgba(245,158,11,0.15);
  color: var(--gold);
  font-weight: 700;
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.join-resume-title { font-weight: 700; font-size: 1.05rem; }

@media (max-width: 380px) {
  .join-card { padding: 18px 14px; }
}

/* ---------- Live quiz result screen ---------- */
/* Self-contained dark gradient panel for the post-quiz screens (results / feedback / wait-game).
   These render outside the fullscreen question view (body.quiz-fullscreen is only toggled on for
   status==='question'), so they'd otherwise sit on the plain light page background with white text
   from the older fullscreen-only styling — invisible. This makes them look right regardless of
   theme or fullscreen state. */
.postquiz-panel {
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: #fff;
  border-radius: var(--radius);
  padding: clamp(20px, 5vw, 30px) 18px;
  box-shadow: var(--shadow-md);
}
.postquiz-panel .muted { color: rgba(255,255,255,0.82); }
.result-card {
  max-width: 360px;
  margin: 0 auto;
  text-align: center;
}
.result-badge { font-size: 2.4rem; line-height: 1; margin-bottom: 6px; }
.result-ring {
  width: clamp(140px, 45vw, 170px);
  height: clamp(140px, 45vw, 170px);
  margin: 14px auto;
  border-radius: 50%;
  background: conic-gradient(var(--teal) calc(var(--pct) * 1%), rgba(255,255,255,0.18) 0);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  box-sizing: border-box;
}
.result-ring-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--purple-dark, #241344);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.result-score { font-family: 'Space Grotesk', sans-serif; font-size: clamp(1.6rem, 8vw, 2.1rem); font-weight: 800; line-height: 1.1; }
.result-score-label { font-size: 0.72rem; opacity: 0.75; margin-top: 2px; text-transform: uppercase; letter-spacing: 0.06em; }
.result-correct { font-weight: 700; margin: 4px 0 0; }
.result-message { opacity: 0.9; margin-top: 8px; font-size: 0.92rem; }
.result-badge-label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.85; margin: 0; }

.result-categories { margin-top: 18px; text-align: left; }
.result-categories-title { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.7; margin: 0 0 8px; text-align: center; }
.result-cat-row { display: grid; grid-template-columns: minmax(70px, 1fr) minmax(60px, 1.6fr) auto; align-items: center; gap: 8px; margin-bottom: 6px; }
.result-cat-name { font-size: 0.8rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-cat-track { height: 7px; border-radius: 999px; background: rgba(255,255,255,0.18); overflow: hidden; }
.result-cat-fill { height: 100%; background: var(--gold); border-radius: 999px; }
.result-cat-count { font-size: 0.72rem; opacity: 0.85; white-space: nowrap; }

.wait-game { margin: 14px auto 0; display: flex; flex-direction: column; align-items: center; width: 100%; }
.wait-game canvas {
  display: block;
  max-width: 100%;
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.3);
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  touch-action: none;
  cursor: pointer;
}

/* ---------- End-of-quiz feedback ---------- */
.feedback-card {
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
  text-align: left;
}
.feedback-card h2, .feedback-card > p { text-align: center; }
.fb-field { margin: 16px 0; }
.fb-field label { display: block; font-weight: 700; font-size: 0.85rem; margin-bottom: 8px; opacity: 0.95; }
.fb-emoji-row {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}
.fb-emoji-btn {
  flex: 1;
  font-size: 1.5rem;
  line-height: 1;
  padding: 10px 4px;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.08);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.fb-emoji-btn:hover { transform: translateY(-2px); }
.fb-emoji-btn.active {
  border-color: var(--gold);
  background: rgba(245,158,11,0.22);
  transform: translateY(-2px) scale(1.06);
}
.fb-chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.fb-chip-btn {
  flex: 1;
  min-width: 90px;
  padding: 9px 10px;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.08);
  color: inherit;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.fb-chip-btn.active { border-color: var(--teal); background: rgba(5,150,105,0.28); }
.feedback-card textarea {
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(255,255,255,0.25);
  color: inherit;
}
.feedback-card textarea::placeholder { color: rgba(255,255,255,0.55); }

@media (max-width: 380px) {
  .fb-emoji-btn { font-size: 1.25rem; padding: 8px 2px; }
  .fb-chip-btn { min-width: 78px; font-size: 0.76rem; padding: 8px; }
}

.fb-setting-row { margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.fb-setting-row:last-of-type { border-bottom: none; }

.student-question.q-bg-0, .host-question.q-bg-0, .student-waiting.q-bg-0 { background-image: linear-gradient(120deg, #6c5ce7, #a855f7); }
.student-question.q-bg-1, .host-question.q-bg-1, .student-waiting.q-bg-1 { background-image: linear-gradient(120deg, #ff5c93, #ff8a5c); }
.student-question.q-bg-2, .host-question.q-bg-2, .student-waiting.q-bg-2 { background-image: linear-gradient(120deg, #3fa7ff, #00d2a0); }
.student-question.q-bg-3, .host-question.q-bg-3, .student-waiting.q-bg-3 { background-image: linear-gradient(120deg, #ffd93d, #ff8a5c); }
.student-question.q-bg-4, .host-question.q-bg-4, .student-waiting.q-bg-4 { background-image: linear-gradient(120deg, #00d2a0, #3fa7ff); }
.student-question.q-bg-5, .host-question.q-bg-5, .student-waiting.q-bg-5 { background-image: linear-gradient(120deg, #a855f7, #ff5c93); }

.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0; }
.option-tile {
  background: rgba(255,255,255,0.14);
  border: 3px solid rgba(255,255,255,0.3);
  border-radius: var(--radius-sm);
  padding: 18px 12px;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  color: #fff;
  cursor: pointer;
  min-height: 64px;
  display: flex; align-items: center; justify-content: center;
  animation: tilePop 0.35s ease both;
  transition: transform 0.12s ease, background 0.15s ease;
}
.option-tile:nth-child(1) { animation-delay: 0.05s; }
.option-tile:nth-child(2) { animation-delay: 0.1s; }
.option-tile:nth-child(3) { animation-delay: 0.15s; }
.option-tile:nth-child(4) { animation-delay: 0.2s; }
.option-tile:nth-child(5) { animation-delay: 0.25s; }
.option-tile:nth-child(6) { animation-delay: 0.3s; }
.option-tile:hover { background: rgba(255,255,255,0.24); }
.option-btn:active { transform: scale(0.97); background: rgba(255,255,255,0.35); }
.option-tile.correct { border-color: var(--teal); background: rgba(0,210,160,0.35); }
.option-tile.incorrect { border-color: var(--danger); opacity: 0.6; }
.option-tile.selected { border-color: #fff; box-shadow: 0 0 0 2px #fff inset; background: rgba(255,255,255,0.3); }

/* Shown while student_play.js's poll can't reach the server; whatever question/result/game is already
   on screen stays put, this just floats on top so the student knows a retry is happening automatically. */
.offline-banner {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #1f2430;
  color: #fff;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  z-index: 9999;
  animation: offlinePulse 1.6s ease-in-out infinite;
}
@keyframes offlinePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Full-screen question mode — the whole viewport becomes the colored question card while a question is live. */
body.quiz-fullscreen #play-app,
body.quiz-fullscreen #play-app .content,
body.quiz-fullscreen #play-content {
  max-width: none;
  padding: 0;
  margin: 0;
}
body.quiz-fullscreen #play-content {
  border-radius: 0;
  box-shadow: none;
  min-height: 100vh;
}
body.quiz-fullscreen .student-question,
body.quiz-fullscreen .student-waiting {
  min-height: 100vh;
  margin: 0;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 24px;
  animation: questionPop 0.45s ease both, bgDrift 12s ease infinite;
}
body.quiz-fullscreen .student-question h2 { font-size: 2.1rem; line-height: 1.3; }
body.quiz-fullscreen .student-question > .muted:first-child { font-size: 1rem; }
body.quiz-fullscreen .options-grid { max-width: 680px; width: 100%; margin: 28px auto 0; gap: 14px; }
body.quiz-fullscreen .option-tile { font-size: 1.15rem; padding: 26px 18px; min-height: 88px; }
@media (max-width: 480px) {
  body.quiz-fullscreen .options-grid { grid-template-columns: 1fr; }
  body.quiz-fullscreen .student-question h2 { font-size: 1.6rem; }
}

.host-preview { margin-top: 24px; }
.host-preview-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 10px;
}
.phone-frame {
  width: 230px;
  margin: 0 auto;
  border-radius: 30px;
  background: #111;
  padding: 8px;
  box-shadow: var(--shadow-lg);
}
.phone-frame-notch {
  width: 60px; height: 5px;
  background: #333;
  border-radius: 4px;
  margin: 4px auto 6px;
}
.phone-frame-screen {
  border-radius: 22px;
  overflow: hidden;
  background: var(--bg);
  min-height: 380px;
  display: flex;
  flex-direction: column;
}
.phone-frame-screen .student-question {
  flex: 1;
  margin: 0;
  border-radius: 0;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: none;
}
.phone-frame-screen .student-question h2 { font-size: 1rem; }
.phone-frame-screen .student-question .muted { font-size: 0.62rem; }
.phone-frame-screen .options-grid { margin: 12px 0 0; gap: 6px; }
.phone-frame-screen .option-tile { font-size: 0.68rem; padding: 10px 6px; min-height: 42px; animation: none; }

.leaderboard ol { list-style: none; padding: 0; counter-reset: rank; }
.leaderboard li {
  counter-increment: rank;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-weight: 700;
}
.leaderboard li::before {
  content: counter(rank);
  background: var(--purple);
  color: #fff;
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  margin-right: 10px;
}
.leaderboard li:nth-child(1)::before { background: var(--yellow); color: #7a5a00; }
.leaderboard li:nth-child(2)::before { background: #c9c9d6; color: #4a4a55; }
.leaderboard li:nth-child(3)::before { background: #e0ac7c; color: #5c3a1a; }

/* ---------- Host: live per-player progress (each student paces themselves) ---------- */
.host-progress { max-width: 640px; margin: 0 auto; }
.progress-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.progress-row {
  display: grid;
  grid-template-columns: minmax(70px, 1fr) minmax(70px, 2fr) auto auto;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.progress-row.is-finished { border-color: var(--teal); background: rgba(5,150,105,0.06); }
.progress-name { font-weight: 700; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-bar-track { height: 8px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--purple), var(--pink)); border-radius: 999px; transition: width 0.3s ease; }
.progress-row.is-finished .progress-bar-fill { background: var(--teal); }
.progress-count { font-size: 0.78rem; color: var(--muted); white-space: nowrap; }
.progress-score { font-family: 'Space Grotesk', sans-serif; font-weight: 800; min-width: 50px; text-align: right; }

@media (max-width: 480px) {
  .progress-row { grid-template-columns: minmax(50px, 1fr) minmax(50px, 1.4fr) auto auto; gap: 6px; padding: 9px 10px; }
  .progress-name { font-size: 0.8rem; }
  .progress-count { font-size: 0.7rem; }
}

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }

/* ---------- Module / lesson content ---------- */
.module-content { white-space: pre-wrap; line-height: 1.6; font-size: 0.95rem; }

/* ---------- Matching game ---------- */
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0; }
.match-tile {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  min-height: 56px;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.match-tile.selected { border-color: var(--purple); background: rgba(50,29,90,0.06); transform: scale(0.98); }
.match-tile.matched { border-color: var(--teal); background: rgba(5,150,105,0.1); color: #047857; cursor: default; opacity: 0.7; }
.match-tile.wrong { border-color: var(--danger); background: rgba(220,38,38,0.08); }

/* ---------- Word scramble ---------- */
.scramble-letters { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 20px 0; }
.scramble-letter {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--purple);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
  text-transform: uppercase;
}

/* ---------- Attendance ---------- */
.att-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.att-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}
.att-name { font-weight: 600; font-size: 0.9rem; }
.att-choices { display: flex; gap: 6px; }
.att-choice {
  display: flex; align-items: center; gap: 4px;
  font-size: 0.72rem; font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border);
  cursor: pointer;
  margin: 0;
}
.att-choice input { margin: 0; width: auto; }
.att-choice:has(input:checked).att-present { background: rgba(5,150,105,0.14); border-color: #059669; color: #047857; }
.att-choice:has(input:checked).att-late { background: rgba(245,158,11,0.14); border-color: var(--gold); color: #b45309; }
.att-choice:has(input:checked).att-absent { background: rgba(220,38,38,0.1); border-color: var(--danger); color: #b91c1c; }

.att-summary { display: flex; align-items: center; gap: 14px; }
.att-percent {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.95rem;
  background: rgba(50,29,90,0.08);
  color: var(--purple);
  flex-shrink: 0;
}

/* ---------- Gradebook ---------- */
.gb-table { min-width: 560px; }
.gb-table th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.gb-table td { font-size: 0.88rem; }
.gb-grade-ap { background: rgba(5,150,105,0.16); color: #047857; }
.gb-grade-a { background: rgba(5,150,105,0.12); color: #047857; }
.gb-grade-b { background: rgba(37,99,235,0.12); color: #1d4ed8; }
.gb-grade-c { background: rgba(245,158,11,0.14); color: #b45309; }
.gb-grade-d { background: rgba(245,158,11,0.18); color: #92400e; }
.gb-grade-f { background: rgba(220,38,38,0.12); color: #b91c1c; }

.results-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.results-row:last-child { border-bottom: none; }

/* ---------- Discussion forum ---------- */
.forum-post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.forum-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--purple);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.forum-avatar-sm { width: 30px; height: 30px; font-size: 0.78rem; background: var(--gold); color: var(--purple-dark); }

/* ---------- Gamification ---------- */
.badge-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.badge-tile {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 18px 12px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.badge-tile.badge-locked { opacity: 0.4; filter: grayscale(1); }
.badge-icon { font-size: 2rem; margin-bottom: 8px; }
.badge-name { font-weight: 700; font-size: 0.85rem; }
.badge-desc { font-size: 0.72rem; color: var(--muted); margin-top: 4px; }

@media (min-width: 500px) and (max-width: 899px) {
  .app { box-shadow: 0 0 40px rgba(0,0,0,0.06); }
}

/* =========================================================
   Desktop layout (>= 900px): a real dashboard shell — fixed left
   sidebar nav + wide main content area, not a stretched phone screen.
========================================================= */
@media (min-width: 900px) {
  body { background: var(--bg); min-height: 100vh; }

  /* Pages with the bottom-nav (dashboards, profile) get the sidebar layout */
  .app:not(.no-nav) {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    width: 100%;
    max-width: none;
    min-height: 100vh;
    padding-bottom: 0;
  }

  .bottom-nav {
    position: sticky;
    left: auto; right: auto; bottom: auto; top: 0;
    transform: none;
    grid-column: 1;
    grid-row: 1 / -1;
    width: auto; max-width: none;
    height: 100vh;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 4px;
    padding: 28px 16px;
    border-top: none;
    border-right: 1px solid var(--border);
    border-bottom: none;
    z-index: 5;
    overflow-y: auto;
  }
  .sidebar-logo { display: block; margin: 6px 10px 28px; }
  .bottom-nav a {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    font-size: 0.92rem;
    font-weight: 500;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
  }
  .bottom-nav a.active { background: rgba(50,29,90,0.08); color: var(--purple); font-weight: 600; position: relative; }
  .bottom-nav a.active::before { content: ''; position: absolute; left: -16px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--purple); }
  .bottom-nav a:hover:not(.active) { background: var(--bg); }
  .bottom-nav a .icon { display: inline-flex; }
  .bottom-nav a .nav-icon { width: 19px; height: 19px; }

  .sidebar-more {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
  }
  .sidebar-more a {
    text-decoration: none;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 500;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
  }
  .sidebar-more a:hover { background: var(--bg); color: var(--text); }
  .sidebar-more a { display: flex; align-items: center; gap: 10px; }
  .sidebar-more a svg { width: 16px; height: 16px; flex-shrink: 0; }
  .sidebar-more-group {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    opacity: 0.7;
    padding: 10px 14px 2px;
  }
  .sidebar-more-group:first-child { padding-top: 0; }

  .sidebar-submenu { margin: 0; }
  .sidebar-submenu summary {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 500;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    list-style: none;
  }
  .sidebar-submenu summary::-webkit-details-marker { display: none; }
  .sidebar-submenu summary:hover { background: var(--bg); color: var(--text); }
  .sidebar-submenu summary::after {
    content: '';
    margin-left: auto;
    width: 7px;
    height: 7px;
    border-right: 1.6px solid currentColor;
    border-bottom: 1.6px solid currentColor;
    transform: rotate(45deg);
    opacity: 0.6;
    transition: transform 0.15s ease;
  }
  .sidebar-submenu[open] summary::after { transform: rotate(-135deg); }
  .sidebar-submenu[open] summary { color: var(--purple); font-weight: 600; }
  .sidebar-submenu-group {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    opacity: 0.6;
    padding: 8px 14px 2px 42px;
  }
  .sidebar-submenu-items a {
    display: block;
    text-decoration: none;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 7px 14px 7px 42px;
    border-radius: var(--radius-sm);
  }
  .sidebar-submenu-items a:hover { background: var(--bg); color: var(--text); }
  .sidebar-submenu-items a.active { color: var(--purple); font-weight: 700; background: rgba(50,29,90,0.06); }

  .app:not(.no-nav) .appbar {
    grid-column: 2;
    position: sticky;
    top: 0;
    border-radius: 0;
  }
  .app:not(.no-nav) .content {
    grid-column: 2;
    max-width: 100%;
    padding: 32px 40px;
  }

  /* Live quiz host/play screens: full-width focus-mode, no sidebar (distraction-free, like a projector screen) */
  .app.no-nav {
    width: 100%;
    max-width: none;
    padding: 0 24px;
  }
  .app.no-nav .appbar { max-width: none; }
  .app.no-nav .content { max-width: 1100px; margin: 0 auto; }

  .card-grid { grid-template-columns: repeat(3, 1fr); gap: 20px; }
  .panel { padding: 28px; }
  .list-row { padding: 16px 20px; }


  .auth-card {
    max-width: 440px;
    min-height: auto;
    margin: 70px auto;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    background: var(--panel);
    padding: 40px;
  }

  .options-grid { max-width: 640px; margin-left: auto; margin-right: auto; }
  .room-code { font-size: 3.4rem; }

  /* Landing page: Eduall-style two-column hero, visible nav, animated mockup, full-bleed sections */
  .edu-nav-inner { padding: 22px 48px; }
  .edu-hero { padding: 30px 48px 90px; }
  .edu-hero-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 56px;
  }
  .edu-hero-text { max-width: none; }
  .edu-hero-text h1 { font-size: 3.4rem; }
  .edu-hero-text .tagline { font-size: 1.1rem; }
  .edu-hero-text .cta-group { flex-direction: row; max-width: none; }

  .edu-shape-1 { right: 5%; }
  .edu-float-badge { right: 10%; bottom: -20px; }

  .landing-stats-inner { grid-template-columns: repeat(4, 1fr); padding: 8px 48px; }
  .stat-number { font-size: 2.4rem; }
  .stat-label { font-size: 0.85rem; }

  .landing-how { padding: 90px 48px; }
  .landing-how h2 { font-size: 2rem; }
  .how-steps { flex-direction: row; max-width: 1100px; align-items: flex-start; }
  .how-step { flex: 1; }
  .how-connector {
    display: block;
    flex: 0 0 60px;
    height: 2px;
    background: linear-gradient(90deg, var(--border), var(--purple), var(--border));
    margin-top: 44px;
    opacity: 0.5;
  }

  .landing-features { padding: 90px 48px; }
  .landing-features h2 { font-size: 2rem; margin-bottom: 40px; }
  .feature-grid { flex-direction: row; max-width: 1100px; gap: 24px; }
  .feature-item { flex: 1; flex-direction: column; text-align: center; align-items: center; padding: 28px 22px; }
  .feature-item:hover { transform: translateY(-6px); box-shadow: 0 16px 32px rgba(60,40,120,0.12); }
  .feature-item .fi-emoji { width: 56px; height: 56px; }
  .feature-item .fi-emoji svg { width: 26px; height: 26px; }

  .landing-footer { padding: 90px 24px; }
  .landing-footer h2 { font-size: 1.8rem; }
}

@media (min-width: 1300px) {
  .card-grid { grid-template-columns: repeat(4, 1fr); }
  .app:not(.no-nav) { grid-template-columns: 260px minmax(0, 1fr); }
}

@media (min-width: 1600px) {
  .landing-stats-inner { max-width: 1600px; }
  .edu-hero-text h1 { font-size: 3.4rem; }
  .landing-how h2, .landing-features h2 { font-size: 2.3rem; }
  .how-steps, .feature-grid { max-width: 1300px; }
}

/* ---------- Quiz bank toolbar / filter ---------- */
.qb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.qb-select-all {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: 0;
}
.qb-select-all input, .row-check {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--purple);
  cursor: pointer;
  flex-shrink: 0;
}
.list-row .row-check { margin-right: 4px; }
.qb-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.qb-filter label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  margin-bottom: 0;
  white-space: nowrap;
}
.qb-filter select {
  min-width: 180px;
  padding: 8px 12px;
  margin-top: 0;
  font-size: 0.82rem;
}
