/* ============================================================
   StudyBuddy — Front-end Stylesheet
   Theme: Dark navy + sky blue + sun yellow on warm paper
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  /* Brand palette */
  --navy: #0a1f44;
  --navy-deep: #061533;
  --navy-soft: #1e3a8a;
  --blue: #2563eb;
  --blue-bright: #3b82f6;
  --sky: #38bdf8;
  --sky-soft: #e0f2fe;
  --sky-mist: #f0f9ff;
  --yellow: #facc15;
  --yellow-deep: #eab308;
  --yellow-soft: #fef3c7;
  --yellow-cream: #fffbeb;

  /* Neutrals */
  --paper: #fdfcf7;
  --paper-line: #ecebe2;
  --ink: #0f172a;
  --ink-mid: #334155;
  --ink-light: #64748b;
  --ink-faint: #94a3b8;
  --line: #e2e8f0;
  --line-soft: #f1f5f9;

  /* Accents */
  --green: #10b981;
  --red: #ef4444;
  --orange: #f97316;

  /* Effects */
  --shadow-sm: 0 1px 2px rgba(10, 31, 68, 0.06), 0 1px 1px rgba(10, 31, 68, 0.04);
  --shadow-md: 0 4px 12px rgba(10, 31, 68, 0.08), 0 2px 4px rgba(10, 31, 68, 0.04);
  --shadow-lg: 0 12px 28px rgba(10, 31, 68, 0.12), 0 4px 10px rgba(10, 31, 68, 0.06);
  --shadow-xl: 0 24px 48px rgba(10, 31, 68, 0.18);
  --shadow-yellow: 0 8px 20px rgba(234, 179, 8, 0.35);
  --shadow-blue: 0 8px 20px rgba(37, 99, 235, 0.3);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-pill: 999px;

  --font-display: "Bricolage Grotesque", "Plus Jakarta Sans", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, sans-serif;

  --header-h: 78px;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { 
  scroll-behavior: smooth; 
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(56, 189, 248, 0.08) 0, transparent 38%),
    radial-gradient(circle at 92% 4%, rgba(250, 204, 21, 0.1) 0, transparent 40%),
    radial-gradient(circle at 50% 110%, rgba(37, 99, 235, 0.06) 0, transparent 45%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; border: none; background: none; }

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

img { display: block; max-width: 100%; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 0.5em;
}

h1 { font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1em; line-height: 1.6; color: var(--ink-mid); }

/* ---------- Header / Navigation ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-soft) 60%, var(--blue) 100%);
  border-bottom: 3px solid var(--yellow);
  box-shadow: var(--shadow-md);
}

.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 18% 50%, rgba(250, 204, 21, 0.18), transparent 24%),
    radial-gradient(circle at 88% 60%, rgba(56, 189, 248, 0.22), transparent 28%);
  pointer-events: none;
}

.header-inner {
  position: relative;
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 28px;
  height: var(--header-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.brand img { width: 56px; height: 56px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.3)); }

.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
  display: flex;
}
.brand-name .study { color: #fff; }
.brand-name .buddy { color: var(--sky); }

.main-nav { display: flex; gap: 6px; margin-left: 8px; }

.nav-btn {
  display: flex;
  align-items: center;
  text-align: center;
  padding: 10px 22px;
  border-radius: var(--radius-pill);
  color: rgba(255,255,255,0.85);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  background: transparent;
}

.nav-btn:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
  text-decoration: none;
}

.nav-btn:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: -2px;
}

.nav-btn.active {
  background: var(--yellow);
  color: var(--navy);
  box-shadow: 0 2px 0 rgba(0,0,0,0.15);
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  color: #fff;
  display: grid;
  place-items: center;
  transition: background 0.2s ease;
}
.icon-btn:hover { background: rgba(255,255,255,0.22); }
.icon-btn svg { width: 22px; height: 22px; }

.avatar-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-weight: 600;
  transition: background 0.2s ease;
}
.avatar-btn:hover { background: rgba(255,255,255,0.22); }
.avatar-btn .avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--navy);
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 0.9rem;
}

.login-btn {
  padding: 10px 22px;
  border-radius: var(--radius-pill);
  background: var(--yellow);
  color: var(--navy);
  font-weight: 700;
  font-size: 0.95rem;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 0 rgba(0,0,0,0.15);
  cursor: pointer;
  border: none;
}
.login-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 0 rgba(0,0,0,0.15); }
.login-btn:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .login-btn:hover { transform: none; }
}

/* ---------- Page shell ---------- */
.page-shell {
  position: relative;
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 32px 96px 70px;
}

/* Notebook spiral binding decoration on left */
.page-shell::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 32px;
  bottom: 32px;
  width: 30px;
  background-image: radial-gradient(circle, var(--ink-faint) 0 6px, transparent 7px);
  background-size: 30px 38px;
  background-repeat: repeat-y;
  opacity: 0.45;
}

.page-shell::after {
  content: "";
  position: absolute;
  left: 48px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: repeating-linear-gradient(180deg, var(--paper-line) 0 8px, transparent 8px 12px);
  opacity: 0.6;
}

.view { animation: fadeUp 0.4s ease both; }

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

@media (prefers-reduced-motion: reduce) {
  .view { animation: none; opacity: 1; transform: none; }
}

/* ---------- Reusable bits ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--yellow-soft);
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--line-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 0.95rem;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
  cursor: pointer;
  border: none;
  text-decoration: none;
}
/* Anchor-as-button links must never show the global a:hover underline
   (same specificity as a:hover, so it has to be matched explicitly). */
.btn:hover, .btn:focus, .btn:active {
  text-decoration: none;
}
.btn:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 2px;
}
.btn-primary {
  background: var(--yellow);
  color: var(--navy);
  box-shadow: var(--shadow-yellow);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(234, 179, 8, 0.4); }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  background: var(--navy);
  color: #fff;
}
.btn-secondary:hover { transform: translateY(-2px); background: var(--navy-deep); }
.btn-secondary:active { transform: scale(0.98); }

.btn-ghost {
  background: transparent;
  color: var(--navy);
  border: 2px solid var(--navy);
}
.btn-ghost:hover { background: var(--navy); color: #fff; }
.btn-ghost:active { transform: scale(0.98); }

@media (prefers-reduced-motion: reduce) {
  .btn:hover, .btn-primary:hover, .btn-secondary:hover { transform: none; }
  .btn:active, .btn-primary:active, .btn-secondary:active { transform: none; }
}

.btn-block { width: 100%; }

/* ---------- Page Loader ---------- */
#pageLoader {
  position: fixed;
  inset: 0;
  background: var(--paper);
  z-index: 9999;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

#pageLoader.visible {
  opacity: 1;
  pointer-events: all;
}

.loader-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--line-soft);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ---------- HOME / LANDING ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 48px;
  align-items: center;
  margin-bottom: 64px;
}

.hero h1 {
  font-size: clamp(2.4rem, 4.5vw, 3.8rem);
  margin-bottom: 16px;
}
.hero h1 .accent { color: var(--blue); position: relative; }
.hero h1 .accent::after {
  content: "";
  position: absolute;
  left: 2%; right: 2%; bottom: 0.05em;
  height: 0.22em;
  background: var(--yellow);
  z-index: -1;
  border-radius: 4px;
}
.hero p { font-size: 1.12rem; max-width: 52ch; color: var(--ink-mid); }

.hero-actions { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }

.hero-visual {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 30% 20%, rgba(250, 204, 21, 0.45), transparent 55%),
    linear-gradient(135deg, var(--sky-soft), #fff 70%);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-lg);
  /* IMPORTANT: no overflow:hidden — the floating stat pills are meant to
     extend outside this card for a proper, polished website feel. The grid
     pattern that lives in ::before is clipped to the rounded corners on its
     own (see below). */
}
.hero-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
  background-image:
    repeating-linear-gradient(90deg, rgba(10,31,68,0.04) 0 1px, transparent 1px 36px),
    repeating-linear-gradient(0deg, rgba(10,31,68,0.04) 0 1px, transparent 1px 36px);
  pointer-events: none;
}
.hero-visual img {
  width: 80%;
  height: auto;
  filter: drop-shadow(0 14px 32px rgba(10,31,68,0.28));
  /* Gentle floating animation so the mascot feels alive */
  animation: heroBob 6s ease-in-out infinite;
}
@keyframes heroBob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

.hero-stats {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: #fff;
  border-radius: var(--radius-pill);
  box-shadow: 0 14px 32px -10px rgba(10, 31, 68, 0.28), 0 4px 12px rgba(10, 31, 68, 0.08);
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
  z-index: 2;
}
.hero-stats .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); animation: pulse 1.6s ease-in-out infinite; flex-shrink: 0; }
/* Push the pills properly outside the card edges. -48 / -32 reads as
   "intentional design element" rather than an accidental clipped corner. */
.hero-stats.tl {
  top: 32px;
  left: -48px;
  color: var(--navy);
  transform: rotate(-2deg);
}
.hero-stats.br {
  bottom: 32px;
  right: -32px;
  color: var(--navy);
  transform: rotate(2deg);
}
.hero-stats.br .dot { background: var(--yellow); }

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-stats .dot { animation: none; opacity: 1; transform: scale(1); }
  .hero-visual img { animation: none; }
}

/* Discover row */
.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}
.section-header h2 { margin: 0; }
.section-header .muted { color: var(--ink-light); font-size: 0.95rem; }

.discover-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 48px;
  scrollbar-width: thin;
}
.discover-pill {
  flex: 0 0 auto;
  padding: 14px 26px;
  border-radius: var(--radius-pill);
  background: #fff;
  border: 2px solid var(--line);
  font-weight: 600;
  color: var(--navy);
  transition: all 0.18s ease;
  white-space: nowrap;
  cursor: pointer;
}
.discover-pill:hover { border-color: var(--sky); color: var(--blue); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.discover-pill:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }
.discover-pill.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.discover-pill .emoji { margin-right: 8px; }

@media (prefers-reduced-motion: reduce) {
  .discover-pill:hover { transform: none; }
}

/* Learning modules grid */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.module-card {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  background: var(--navy);
  box-shadow: var(--shadow-md);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  border: 1px solid var(--line);
  isolation: isolate;
}
.module-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.module-card:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .module-card:hover { transform: none; }
}

.module-card .module-art {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(3rem, 8vw, 5rem);
  background: var(--bg, linear-gradient(135deg, var(--blue), var(--sky)));
}

.module-card .module-info {
  position: absolute;
  inset: auto 0 0 0;
  padding: 16px 18px;
  background: linear-gradient(0deg, rgba(10,31,68,0.95) 0%, rgba(10,31,68,0.7) 60%, transparent 100%);
  color: #fff;
}
.module-card .module-info h3 { color: #fff; margin: 0 0 4px; font-size: 1.05rem; }
.module-card .module-info .meta { font-size: 0.82rem; opacity: 0.8; }

.module-card .lock-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(10,31,68,0.55);
  font-weight: 700;
  text-align: center;
  padding: 16px;
  backdrop-filter: blur(2px);
  z-index: 2;
}
.module-card .lock-overlay svg { width: 30px; height: 30px; margin-bottom: 8px; }

/* ---------- AUTH PAGES ---------- */
.auth-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
  max-width: 1100px;
  margin: 24px auto 0;
}

.auth-card {
  background: #fff;
  padding: 40px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line-soft);
}

.auth-card h1 { font-size: 2rem; margin-bottom: 6px; }
.auth-card .sub { color: var(--ink-light); margin-bottom: 28px; }

.field {
  display: block;
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}
.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrap input {
  flex: 1;
  padding-right: 48px;
}

.pwd-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-mid);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: color 0.2s ease, background 0.2s ease;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
}

.pwd-toggle:hover {
  background: rgba(10, 31, 68, 0.06);
}

.pwd-toggle:hover {
  color: var(--blue);
  background: rgba(10, 31, 68, 0.08);
}

.pwd-toggle:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: -2px;
}

.pwd-toggle svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

.field input, .field select {
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  border: 2px solid var(--line);
  background: var(--paper);
  font-size: 0.98rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  color: var(--ink);
}
.field input::placeholder, .field select::placeholder {
  color: var(--ink-tertiary);
  opacity: 1;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.5);
}
@media (prefers-reduced-motion: reduce) {
  .field input:focus, .field select:focus {
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.5);
  }
}

.role-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 6px;
  background: var(--sky-mist);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}
.role-toggle button {
  padding: 12px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  color: var(--ink-mid);
  transition: all 0.2s ease;
}
.role-toggle button.active {
  background: #fff;
  color: var(--navy);
  box-shadow: var(--shadow-sm);
}

.auth-error {
  background: #fef2f2;
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 14px;
  border: 1px solid #fecaca;
  display: none;
}
.auth-error.show { display: block; }

.auth-switch {
  text-align: center;
  margin-top: 18px;
  color: var(--ink-light);
  font-size: 0.92rem;
}
.auth-switch a { font-weight: 700; cursor: pointer; }

.auth-side {
  position: relative;
  padding: 40px;
  border-radius: var(--radius-xl);
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-soft) 60%, var(--blue) 100%);
  color: #fff;
  min-height: 480px;
  overflow: hidden;
}
.auth-side::before {
  content: "";
  position: absolute;
  width: 320px; height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(250,204,21,0.4), transparent 70%);
  top: -60px; right: -60px;
}
.auth-side::after {
  content: "";
  position: absolute;
  width: 240px; height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56,189,248,0.45), transparent 70%);
  bottom: -40px; left: -40px;
}
.auth-side h2 { color: #fff; font-size: 2rem; position: relative; z-index: 1; }
.auth-side p { color: rgba(255,255,255,0.85); position: relative; z-index: 1; }
.auth-side ul {
  list-style: none;
  padding: 0;
  margin-top: 24px;
  position: relative;
  z-index: 1;
}
.auth-side li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  font-weight: 500;
}
.auth-side li::before {
  content: "✓";
  width: 24px; height: 24px;
  background: var(--yellow);
  color: var(--navy);
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* ---------- DASHBOARD ---------- */
.dash-greeting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.dash-greeting h1 { margin-bottom: 4px; }
.dash-greeting p { margin: 0; color: var(--ink-light); }

.dash-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: #fff;
  padding: 20px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line-soft);
  position: relative;
  overflow: hidden;
}
.stat-card .stat-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  margin-bottom: 12px;
  font-size: 1.4rem;
}
.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card .stat-label {
  font-size: 0.85rem;
  color: var(--ink-light);
  font-weight: 600;
}
.stat-card .stat-delta {
  position: absolute;
  top: 18px; right: 18px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: #ecfdf5;
  color: var(--green);
}
.stat-card.s1 .stat-icon { background: var(--yellow-soft); color: var(--yellow-deep); }
.stat-card.s2 .stat-icon { background: var(--sky-soft); color: var(--blue); }
.stat-card.s3 .stat-icon { background: #fce7f3; color: #db2777; }
.stat-card.s4 .stat-icon { background: #dcfce7; color: var(--green); }

.progress-chart {
  background: #fff;
  padding: 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--line-soft);
}

.chart-canvas {
  width: 100%;
  height: 260px;
  display: block;
  margin-top: 12px;
}

.subject-progress {
  background: #fff;
  padding: 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--line-soft);
}

.progress-item { margin-bottom: 18px; }
.progress-item:last-child { margin-bottom: 0; }
.progress-item .label-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
}
.progress-item .label-row .name { font-weight: 600; color: var(--navy); }
.progress-item .label-row .pct { font-weight: 700; color: var(--blue); font-variant-numeric: tabular-nums; }

.progress-bar {
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--line-soft);
  overflow: hidden;
  position: relative;
}
.progress-bar .fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--blue), var(--sky));
  transition: width 0.8s ease;
}
.progress-item.gold .progress-bar .fill { background: linear-gradient(90deg, var(--yellow-deep), var(--yellow)); }

@media (prefers-reduced-motion: reduce) {
  .progress-bar .fill { transition: width 0.01ms ease; }
}

/* Recent activity / quiz */
.activity-list { list-style: none; padding: 0; margin: 0; }
.activity-list li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}
.activity-list li:last-child { border-bottom: none; }
.activity-list .ai {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--sky-soft);
  color: var(--blue);
  display: grid; place-items: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.activity-list .ai.gold { background: var(--yellow-soft); color: var(--yellow-deep); }
.activity-list .ai.green { background: #dcfce7; color: var(--green); }
.activity-list .text strong { color: var(--navy); display: block; }
.activity-list .text small { color: var(--ink-light); font-size: 0.82rem; }
.activity-list .score {
  margin-left: auto;
  font-weight: 800;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

/* Lecturer-specific: class list */
.class-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.class-table th, .class-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.class-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-light);
  font-weight: 700;
  background: var(--paper);
}
.class-table tr:hover { background: var(--sky-mist); }
.class-table .stu-name { font-weight: 600; color: var(--navy); display: flex; align-items: center; gap: 10px; }
.stu-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  display: grid; place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  line-height: 1;
}
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
}
.tag.up { background: #dcfce7; color: var(--green); }
.tag.down { background: #fee2e2; color: var(--red); }
.tag.steady { background: var(--sky-soft); color: var(--blue); }

/* ---------- QUIZZES ---------- */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.filter-chip {
  padding: 8px 16px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: var(--radius-pill);
  font-weight: 600;
  color: var(--ink-mid);
  font-size: 0.88rem;
  transition: all 0.18s ease;
}
.filter-chip:hover { border-color: var(--sky); }
.filter-chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }

.quiz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.quiz-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}
.quiz-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.quiz-card .quiz-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.quiz-card .subj-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--yellow-soft);
  color: var(--navy);
}
.quiz-card h3 { margin: 0; font-size: 1.15rem; }
.quiz-card .quiz-desc { color: var(--ink-light); font-size: 0.88rem; margin: 0; line-height: 1.5; }
.quiz-meta {
  display: flex;
  gap: 14px;
  font-size: 0.82rem;
  color: var(--ink-light);
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}
.quiz-meta span { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.quiz-card .quiz-meta .diff-pill { margin-left: auto; }
.diff-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
}
.diff-easy { background: #dcfce7; color: var(--green); }
.diff-med { background: var(--yellow-soft); color: var(--yellow-deep); }
.diff-hard { background: #fee2e2; color: var(--red); }

/* Quiz taking interface */
.quiz-runner {
  max-width: 760px;
  margin: 0 auto;
}
.quiz-runner .qr-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.qr-progress-bar {
  height: 6px;
  background: var(--line-soft);
  border-radius: var(--radius-pill);
  margin-bottom: 30px;
  overflow: hidden;
}
.qr-progress-bar .fill { height: 100%; background: var(--yellow); transition: width 0.4s ease; }

.question-card {
  background: #fff;
  padding: 36px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line-soft);
}
.question-card .q-num {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.question-card h2 {
  font-size: 1.5rem;
  margin-bottom: 28px;
  line-height: 1.4;
}
.option {
  display: block;
  width: 100%;
  padding: 16px 20px;
  margin-bottom: 12px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  text-align: left;
  font-weight: 500;
  color: var(--navy);
  font-size: 1rem;
  transition: all 0.18s ease;
  display: flex;
  align-items: center;
  gap: 14px;
}
.option:hover {
  border-color: var(--blue);
  background: var(--sky-mist);
  transform: translateX(4px);
}
.option .letter {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--paper);
  display: grid; place-items: center;
  font-weight: 800;
  color: var(--navy);
  font-family: var(--font-display);
  flex-shrink: 0;
  transition: all 0.18s ease;
}
.option:hover .letter { background: var(--blue); color: #fff; }
.option.selected {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
}
.option.selected .letter { background: var(--yellow); color: var(--navy); }
.option.correct {
  border-color: var(--green);
  background: #f0fdf4;
  color: var(--green);
}
.option.correct .letter { background: var(--green); color: #fff; }
.option.wrong {
  border-color: var(--red);
  background: #fef2f2;
  color: var(--red);
}
.option.wrong .letter { background: var(--red); color: #fff; }

.qr-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 28px;
}

.quiz-result {
  text-align: center;
  padding: 48px;
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-width: 600px;
  margin: 24px auto 0;
}
.quiz-result .big-score {
  font-family: var(--font-display);
  font-size: 5rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
  margin: 16px 0;
}
.quiz-result .big-score .total { color: var(--ink-faint); font-size: 0.5em; }
.quiz-result .result-emoji { font-size: 4rem; }

/* ---------- LEADERBOARD ---------- */
.podium {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 16px;
  align-items: end;
  margin-bottom: 32px;
}
.podium-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 24px 18px;
  text-align: center;
  border: 1px solid var(--line-soft);
  position: relative;
  box-shadow: var(--shadow-md);
}
.podium-card.rank-1 {
  background: linear-gradient(160deg, var(--yellow), var(--yellow-deep));
  color: var(--navy);
  padding: 36px 18px;
  transform: translateY(-12px);
  box-shadow: var(--shadow-yellow);
}
.podium-card.rank-2 { background: linear-gradient(160deg, #f1f5f9, #cbd5e1); color: var(--navy); }
.podium-card.rank-3 { background: linear-gradient(160deg, #fed7aa, #fb923c); color: var(--navy); }
.podium-card .crown { font-size: 2rem; margin-bottom: 8px; }
.podium-card .pname { font-weight: 800; font-size: 1.05rem; }
.podium-card .pscore {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  margin-top: 8px;
}
.podium-card .pavatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(10,31,68,0.15);
  margin: 0 auto 12px;
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--navy);
  border: 3px solid rgba(255,255,255,0.6);
}

.leaderboard-table {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  border: 1px solid var(--line-soft);
}
.leaderboard-table .lb-row {
  display: grid;
  grid-template-columns: 60px 1fr 120px 100px;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.18s ease;
}
.leaderboard-table .lb-row:last-child { border-bottom: none; }
.leaderboard-table .lb-row:hover { background: var(--sky-mist); }
.leaderboard-table .lb-row.me { background: var(--yellow-soft); }
.leaderboard-table .lb-row.me:hover { background: var(--yellow-soft); }
.lb-row .lb-rank {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--navy);
}
.lb-row .lb-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  color: var(--navy);
}
.lb-row .lb-user .stu-avatar {
  background: rgba(10,31,68,0.15);
  color: var(--navy);
  border: 2px solid rgba(255,255,255,0.6);
}
.lb-row .lb-user .you {
  font-size: 0.7rem;
  background: var(--yellow);
  color: var(--navy);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-weight: 800;
  margin-left: 6px;
}
.lb-row .lb-quizzes { color: var(--ink-light); font-size: 0.9rem; }
.lb-row .lb-points {
  font-weight: 800;
  font-family: var(--font-display);
  color: var(--blue);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------- PROFILE ---------- */
.profile-hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
  border-radius: var(--radius-xl);
  padding: 40px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 32px;
  align-items: center;
  color: #fff;
  position: relative;
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: var(--shadow-lg);
}
.profile-hero::before {
  content: "";
  position: absolute;
  width: 360px; height: 360px;
  background: radial-gradient(circle, rgba(250,204,21,0.35), transparent 70%);
  top: -120px; right: -80px;
  pointer-events: none;
}

.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--navy);
  display: grid;
  place-items: center;
  font-size: 3rem;
  font-weight: 800;
  font-family: var(--font-display);
  border: 5px solid rgba(255,255,255,0.2);
  position: relative;
  z-index: 1;
}

.profile-info { position: relative; z-index: 1; }
.profile-info h1 { color: #fff; margin: 0 0 6px; }
.profile-info .role-pill {
  display: inline-block;
  background: var(--yellow);
  color: var(--navy);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.profile-info .meta { color: rgba(255,255,255,0.85); font-size: 0.95rem; }

.profile-actions { position: relative; z-index: 1; display: flex; gap: 10px; }

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.info-card {
  background: #fff;
  padding: 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line-soft);
}
.info-card h3 { margin-bottom: 16px; }
.info-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.95rem;
}
.info-row:last-child { border-bottom: none; }
.info-row .key { color: var(--ink-light); }
.info-row .val { font-weight: 600; color: var(--navy); }

.badges-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.badge {
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 12px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--navy);
  background: var(--paper);
  border: 2px solid var(--line);
  position: relative;
}
.badge.earned { background: var(--yellow-soft); border-color: var(--yellow); }
.badge.earned::after {
  content: "★";
  position: absolute;
  top: 6px; right: 8px;
  font-size: 0.9rem;
  color: var(--yellow-deep);
}
.badge .b-icon { font-size: 2.2rem; display: block; margin-bottom: 4px; }
.badge.locked { opacity: 0.4; filter: grayscale(1); }

/* ---------- Quick FAB ---------- */
.fab-wrap {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 60;
}
.fab-main {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--navy);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-yellow);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  position: relative;
  z-index: 2;
}
.fab-main:hover { transform: scale(1.06); box-shadow: 0 14px 30px rgba(234, 179, 8, 0.5); }
.fab-main svg { width: 26px; height: 26px; transition: transform 0.3s ease; }
.fab-wrap.open .fab-main svg { transform: rotate(135deg); }

.fab-menu {
  position: absolute;
  bottom: 72px;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.95);
  transform-origin: bottom right;
  transition: all 0.25s ease;
}
.fab-wrap.open .fab-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}
.fab-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 10px 14px;
  background: #fff;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-md);
  font-weight: 700;
  color: var(--navy);
  white-space: nowrap;
  transition: transform 0.15s ease;
}
.fab-item:hover { transform: translateX(-4px); }
.fab-item .ficon {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--sky-soft);
  color: var(--blue);
}

/* ---------- Visitor banner ---------- */
.visitor-banner {
  background: linear-gradient(135deg, var(--navy), var(--blue));
  color: #fff;
  padding: 16px 24px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-md);
}
.visitor-banner .vb-icon {
  width: 44px; height: 44px;
  background: var(--yellow);
  color: var(--navy);
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.visitor-banner p { margin: 0; color: rgba(255,255,255,0.9); }
.visitor-banner strong { color: #fff; }
.visitor-banner .vb-actions { margin-left: auto; display: flex; gap: 10px; }
.visitor-banner .btn-ghost { color: #fff; border-color: rgba(255,255,255,0.5); }
.visitor-banner .btn-ghost:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* Locked page overlay */
.locked-page {
  text-align: center;
  padding: 80px 24px;
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  border: 2px dashed var(--line);
}
.locked-page .lp-icon {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--yellow-soft);
  color: var(--yellow-deep);
  display: grid; place-items: center;
  margin: 0 auto 20px;
  font-size: 2.4rem;
}
.locked-page h2 { margin-bottom: 8px; }
.locked-page p { max-width: 460px; margin: 0 auto 24px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 96px;
  right: 24px;
  background: var(--navy);
  color: #fff;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-weight: 600;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateX(120%);
  transition: transform 0.35s cubic-bezier(.34,1.56,.64,1);
}
.toast.show { transform: translateX(0); }
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .hero { grid-template-columns: 1fr; }
  .hero-visual { max-width: 480px; margin: 0 auto; }
  .hero-stats.tl { left: -28px; top: 18px; }
  .hero-stats.br { right: -18px; bottom: 18px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { min-height: auto; padding: 32px; }
  .dash-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .profile-grid { grid-template-columns: 1fr; }
  .modules-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .page-shell { padding: 24px 20px 96px; }
  .page-shell::before, .page-shell::after { display: none; }
  .stats-row { grid-template-columns: 1fr 1fr; gap: 12px; }
  .modules-grid { grid-template-columns: 1fr; }
  .podium { grid-template-columns: 1fr; gap: 12px; }
  .podium-card.rank-1 { transform: none; order: -1; }
  .profile-hero { grid-template-columns: 1fr; text-align: center; padding: 28px; }
  .profile-avatar { margin: 0 auto; }
  .lb-row { grid-template-columns: 40px 1fr 80px; }
  .lb-row .lb-quizzes { display: none; }
  .visitor-banner .vb-actions { margin: 0; width: 100%; }
  .fab-wrap { bottom: 18px; right: 18px; }
}

/* Mobile nav drawer */
.mobile-nav-toggle {
  display: none;
  width: 44px; height: 44px;
  background: transparent;
  color: #fff;
  place-items: center;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s ease, transform 0.12s ease;
}
.mobile-nav-toggle:hover { opacity: 0.7; }
.mobile-nav-toggle:active { transform: scale(0.9); }
.mobile-nav-toggle:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; border-radius: 8px; }
/* Collapse to the mobile header (hamburger · centered logo · compact actions)
   below the width the full desktop nav needs to fit — this covers landscape
   phones, not just portrait, so a rotated phone doesn't get the cramped nav. */
@media (max-width: 960px) {
  .header-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 10px 14px;
    gap: 8px;
  }
  .main-nav { display: none; }
  .mobile-nav-toggle { display: grid; justify-self: start; }
  .brand { justify-self: center; }
  .brand-name { display: none; }
  .brand img { width: 50px; height: 50px; }
  .header-right { justify-self: end; margin-left: 0; gap: 8px; }
  .header-right .login-btn span { display: none; }
  /* Icon-only right cluster so the avatar/name never overflows the edge */
  #langLabel, .lang-switcher .chev { display: none; }
  .lang-switcher .lang-btn { padding: 10px; }
  #headerNameLabel { display: none; }
  .avatar-btn { gap: 0; padding: 5px; }
}

.mobile-drawer {
  position: fixed;
  inset: 0;
  background: rgba(10,31,68,0.85);
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.mobile-drawer.open { opacity: 1; pointer-events: auto; }
@media (prefers-reduced-motion: reduce) {
  .mobile-drawer {
    transition: none;
  }
}
.mobile-drawer-panel {
  position: absolute;
  top: 0; right: 0;
  height: 100%;
  width: min(85vw, 360px);
  background: #fff;
  padding: 24px;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mobile-drawer.open .mobile-drawer-panel { transform: translateX(0); }

@media (prefers-reduced-motion: reduce) {
  .mobile-drawer-panel { transition: none; transform: translateX(0); }
  .mobile-drawer:not(.open) .mobile-drawer-panel { display: none; }
}
.mobile-drawer .nav-btn {
  color: var(--navy);
  text-align: left;
  padding: 14px 18px;
}
.mobile-drawer .nav-btn.active { background: var(--navy); color: #fff; }

/* ===================================================================
   ADDITIONS — v2: Learn page, Flashcards, Language switcher,
                  Chatbot, Footer, Create-Quiz form
   =================================================================== */

/* ---------- Language switcher ---------- */
.lang-switcher { position: relative; }
.lang-switcher .lang-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.2s ease;
}
.lang-switcher .lang-btn:hover { background: rgba(255,255,255,0.22); }
.lang-switcher .lang-btn svg { width: 18px; height: 18px; }
.lang-switcher .chev { transition: transform 0.2s ease; }
.lang-switcher.open .chev { transform: rotate(180deg); }

.lang-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 180px;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 60;
}
.lang-switcher.open .lang-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.lang-menu button {
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  color: var(--navy);
  transition: background 0.15s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}
.lang-menu button:hover { background: var(--sky-mist); }
.lang-menu button.current { background: var(--yellow-soft); color: var(--navy); }
.lang-menu .flag { font-size: 1.15rem; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--navy);
  background-image:
    radial-gradient(circle at 10% 20%, rgba(56, 189, 248, 0.12), transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(250, 204, 21, 0.1), transparent 40%);
  color: #fff;
  padding: 80px 24px 40px;
  margin-top: 80px;
  position: relative;
  overflow: hidden;
}
.site-footer::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--yellow), var(--sky), var(--yellow));
}
.footer-inner { max-width: 1200px; margin: 0 auto; text-align: center; }
.footer-inner h2 {
  color: #fff;
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: 12px;
}
.footer-inner > p {
  color: rgba(255,255,255,0.75);
  max-width: 56ch;
  margin: 0 auto 36px;
  font-size: 1.05rem;
}
.footer-subjects {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  max-width: 1000px;
  margin: 0 auto 40px;
}
.footer-subject-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.92);
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  cursor: pointer;
}
.footer-subject-pill:hover {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.3);
  transform: translateY(-2px);
  text-decoration: none;
}
.footer-subject-pill .emoji { font-size: 1.1rem; }

.footer-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 18px 38px;
  background: var(--yellow);
  color: var(--navy);
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: 1.1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 8px 24px rgba(250, 204, 21, 0.35);
}
.footer-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(250, 204, 21, 0.45);
  text-decoration: none;
}

.footer-bottom {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.55);
}
.footer-bottom a { color: rgba(255,255,255,0.7); }

@media (max-width: 720px) {
  .site-footer { padding: 56px 18px 30px; margin-top: 48px; }
  .footer-subject-pill { padding: 10px 16px; font-size: 0.88rem; }
}

/* ---------- Learn page layout ---------- */
.learn-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  align-items: flex-start;
}

.subject-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 14px;
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-sm);
  max-height: calc(100vh - var(--header-h) - 48px);
  overflow-y: auto;
}
.subject-sidebar h4 {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-light);
  margin: 8px 12px 10px;
  font-weight: 700;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--radius-md);
  text-align: left;
  font-weight: 600;
  color: var(--navy);
  font-size: 0.92rem;
  margin-bottom: 2px;
  transition: all 0.18s ease;
}
.sidebar-item:hover { background: var(--sky-mist); }
.sidebar-item.active {
  background: var(--navy);
  color: #fff;
}
.sidebar-item.active .sidebar-count { background: var(--yellow); color: var(--navy); }
.sidebar-item .sidebar-emoji {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--paper);
  display: grid; place-items: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}
.sidebar-item.active .sidebar-emoji { background: rgba(255,255,255,0.15); }
.sidebar-item .sidebar-count {
  margin-left: auto;
  background: var(--line-soft);
  color: var(--ink-light);
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-weight: 700;
}
.sidebar-category-header {
    display: flex;
    align-items: center;
    cursor: pointer;
}
.sidebar-chevron {
    margin-left: auto;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M9 18l6-6-6-6'/%3E%3C/svg%3E") center/contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M9 18l6-6-6-6'/%3E%3C/svg%3E") center/contain no-repeat;
    transition: transform 0.2s ease;
}
.sidebar-category.open .sidebar-chevron {
    transform: rotate(90deg);
}
/* Group the chevron with the count so it lands in the same spot on every row
   instead of floating mid-row (both had margin-left:auto, splitting the gap). */
.sidebar-chevron + .sidebar-count { margin-left: 8px; }
.sidebar-subjects {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.25s ease;
}
.sidebar-category.open .sidebar-subjects {
    max-height: 600px;
}
.sidebar-subitem {
    padding-left: 16px; /* indent under category */
}
/* Category selected state (when one of its subjects is active) */
.sidebar-category-header.category-active {
  background: var(--navy);
  color: #fff;
}
.sidebar-category-header.category-active .sidebar-chevron {
  background: rgba(255, 255, 255, 0.85);
}
.sidebar-category-header.category-active .sidebar-count {
  background: var(--yellow);
  color: var(--navy);
}

/* Subject selected state — blue instead of navy to differ from category */
.sidebar-subitem.active {
  background: var(--blue);
  color: #fff;
}
.sidebar-subitem.active .sidebar-count {
  background: var(--yellow);
  color: var(--navy);
}
.sidebar-subitem.active .sidebar-emoji {
  background: rgba(255, 255, 255, 0.18);
}

/* Tab bar */
.tab-bar {
  display: inline-flex;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-pill);
  padding: 5px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}
.tab-bar button {
  padding: 9px 22px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  color: var(--ink-mid);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}
.tab-bar button.active {
  background: var(--navy);
  color: #fff;
}


/* Subject hero */
.subject-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}
.subject-hero .badge {
  width: 64px; height: 64px;
  border-radius: var(--radius-lg);
  display: grid; place-items: center;
  font-size: 2rem;
  background: var(--yellow-soft);
}
.subject-hero h1 { margin: 0 0 4px; font-size: 1.9rem; }
.subject-hero p { margin: 0; color: var(--ink-light); }

/* Form 1-5 sections */
.form-section { margin-bottom: 32px; }
.form-section-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.form-section-header .form-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}
.form-section-header .form-label.f1 { background: #ecfdf5; color: var(--green); }
.form-section-header .form-label.f2 { background: var(--sky-soft); color: var(--blue); }
.form-section-header .form-label.f3 { background: var(--yellow-soft); color: var(--yellow-deep); }
.form-section-header .form-label.f4 { background: #ffedd5; color: var(--orange); }
.form-section-header .form-label.f5 { background: #fee2e2; color: var(--red); }
.form-section-header .form-rule {
  flex: 1;
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--line) 0 4px, transparent 4px 8px);
}
.form-section-header .form-meta { color: var(--ink-light); font-size: 0.85rem; }

.subject-empty {
  text-align: center;
  padding: 60px 20px;
  background: #fff;
  border-radius: var(--radius-lg);
  border: 2px dashed var(--line);
  color: var(--ink-light);
  overflow-wrap: break-word;
  word-break: break-all;
}
.subject-empty .emoji { font-size: 3rem; display: block; margin-bottom: 10px; }

/* ---------- Flashcards ---------- */
.fc-stats {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-bottom: 28px;
}
.fc-stat-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  background: #fff;
  border: 2px solid transparent;
  font-weight: 600;
  font-size: 0.92rem;
}
.fc-stat-pill .num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
}
.fc-stat-pill.new   { border-color: var(--blue); color: var(--blue); }
.fc-stat-pill.learn { border-color: var(--yellow-deep); color: var(--yellow-deep); }
.fc-stat-pill.master{ border-color: var(--green); color: var(--green); }

.flashcard-stage {
  perspective: 1400px;
  width: 100%;
  max-width: 640px;
  margin: 0 auto 12px;
}
.flashcard {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(.25,.9,.3,1.1);
  cursor: pointer;
}
.flashcard.flipped { transform: rotateY(180deg); }
.flashcard .face {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  display: grid;
  place-items: center;
  padding: 40px;
  text-align: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.flashcard .face.front {
  background: linear-gradient(160deg, #fff 0%, var(--sky-mist) 100%);
}
.flashcard .face.back {
  background: linear-gradient(160deg, var(--navy) 0%, var(--blue) 100%);
  color: #fff;
  transform: rotateY(180deg);
}
.flashcard .face.back .fc-label { color: rgba(255,255,255,0.7); }
.flashcard .face .fc-label {
  position: absolute;
  top: 18px; left: 22px;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.flashcard .face .fc-flip-hint {
  position: absolute;
  bottom: 18px; right: 22px;
  font-size: 0.78rem;
  color: var(--ink-faint);
  opacity: 0.7;
}
.flashcard .face.back .fc-flip-hint { color: rgba(255,255,255,0.6); }
.flashcard .fc-content {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 2.1rem);
  font-weight: 700;
  line-height: 1.3;
  color: inherit;
  letter-spacing: -0.01em;
}
.fc-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin: 18px 0 24px;
}
.fc-nav-btn {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--navy);
  display: grid; place-items: center;
  transition: all 0.18s ease;
}
.fc-nav-btn:hover:not(:disabled) { background: var(--navy); color: #fff; border-color: var(--navy); transform: scale(1.05); }
.fc-nav-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.fc-nav-btn svg { width: 20px; height: 20px; }
.fc-counter {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

.fc-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 36px;
  flex-wrap: wrap;
}

.fc-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 40px 0 20px;
}
.fc-divider .line {
  flex: 1;
  height: 1px;
  background: var(--line);
}
.fc-divider .label {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--blue);
  font-size: 1.2rem;
}
.fc-divider .count {
  background: var(--sky-soft);
  color: var(--blue);
  padding: 3px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 700;
}

.fc-list-row {
  display: grid;
  grid-template-columns: 30px 1fr 1fr 80px;
  gap: 16px;
  padding: 18px 22px;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  align-items: center;
  transition: box-shadow 0.18s ease;
}
.fc-list-row:hover { box-shadow: var(--shadow-md); }
.fc-list-row .status-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
}
.fc-list-row .status-dot.new    { background: var(--blue); }
.fc-list-row .status-dot.learn  { background: var(--yellow-deep); }
.fc-list-row .status-dot.master { background: var(--green); }
.fc-list-row .fc-front-text {
  font-weight: 600;
  color: var(--navy);
}
.fc-list-row .fc-back-text {
  color: var(--ink-mid);
  border-left: 1px solid var(--line);
  padding-left: 16px;
  font-size: 0.95rem;
}
.fc-list-row.active-row {
  border-color: var(--blue);
  background: var(--blue-soft, #eef4ff);
  box-shadow: var(--shadow-md);
}

/* ---------- Chatbot ---------- */
.chatbot-launcher {
  position: fixed;
  left: 24px;
  bottom: 28px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px 12px 14px;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  color: #fff;
  border-radius: var(--radius-pill);
  font-weight: 700;
  box-shadow: var(--shadow-blue);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.chatbot-launcher:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(37, 99, 235, 0.45); }
.chatbot-launcher .cb-icon {
  position: relative;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--navy);
  display: grid; place-items: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.chatbot-launcher .cb-icon::after {
  content: "";
  position: absolute;
  top: -1px; right: -1px;
  width: 11px; height: 11px;
  background: var(--green);
  border-radius: 50%;
  border: 2px solid var(--navy);
  animation: pulse 2s ease-in-out infinite;
}

.chatbot-panel {
  position: fixed;
  left: 24px;
  bottom: 24px;
  width: min(440px, calc(100vw - 48px));
  height: min(620px, calc(100vh - 120px));
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  z-index: 70;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(.34,1.56,.64,1);
  border: 1px solid var(--line-soft);
}
.chatbot-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}
.chatbot-header {
  padding: 18px 22px;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
}
.chatbot-header .ai-avatar {
  width: 42px; height: 42px;
  background: var(--yellow);
  color: var(--navy);
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 1.3rem;
  font-weight: 800;
  flex-shrink: 0;
}
.chatbot-header .ai-info { flex: 1; }
.chatbot-header .ai-info h4 { color: #fff; margin: 0; font-size: 1.05rem; }
.chatbot-header .ai-info .status {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.8);
  display: flex; align-items: center; gap: 6px;
}
.chatbot-header .ai-info .status::before {
  content: "";
  width: 8px; height: 8px;
  background: #34d399;
  border-radius: 50%;
}
.chatbot-header .close-cb {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  color: #fff;
  display: grid; place-items: center;
}
.chatbot-header .close-cb:hover { background: rgba(255,255,255,0.2); }

.chatbot-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--paper);
}

.chat-msg {
  display: flex;
  gap: 10px;
  max-width: 88%;
  animation: msgIn 0.3s ease both;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-msg.bot { align-self: flex-start; }
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg .msg-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--navy);
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.chat-msg.user .msg-avatar { background: var(--navy); color: #fff; }
.chat-msg .msg-bubble {
  background: #fff;
  border: 1px solid var(--line-soft);
  padding: 11px 15px;
  border-radius: 16px;
  border-top-left-radius: 4px;
  font-size: 0.93rem;
  line-height: 1.45;
  color: var(--ink);
}
.chat-msg.user .msg-bubble {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
  border-top-left-radius: 16px;
  border-top-right-radius: 4px;
}
.chat-msg .msg-bubble strong { color: var(--blue); }
.chat-msg.user .msg-bubble strong { color: var(--yellow); }

.chat-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.chat-option {
  padding: 7px 14px;
  background: #fff;
  border: 1.5px solid var(--blue);
  color: var(--blue);
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.18s ease;
}
.chat-option:hover { background: var(--blue); color: #fff; }

.chat-typing {
  display: flex; gap: 4px;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  border-top-left-radius: 4px;
  width: fit-content;
}
.chat-typing span {
  width: 7px; height: 7px;
  background: var(--ink-faint);
  border-radius: 50%;
  animation: typing 1.2s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.chatbot-input {
  padding: 14px 16px;
  background: #fff;
  border-top: 1px solid var(--line-soft);
  display: flex;
  gap: 8px;
  align-items: center;
}
.chatbot-input input {
  flex: 1;
  padding: 11px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--paper);
  font-size: 0.92rem;
}
.chatbot-input input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.chatbot-input .send-btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  display: grid; place-items: center;
  flex-shrink: 0;
  transition: background 0.18s ease;
}
.chatbot-input .send-btn:hover { background: var(--blue); }
.chatbot-input .send-btn svg { width: 18px; height: 18px; }

/* ---------- Create Quiz form (lecturer) ---------- */
.cq-wrap { max-width: 800px; }
.cq-step-card {
  background: #fff;
  padding: 28px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--line-soft);
  margin-bottom: 18px;
}
.cq-step-card h3 { margin-bottom: 6px; }
.cq-step-card .sub { color: var(--ink-light); font-size: 0.92rem; margin-bottom: 18px; }

.qtype-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 6px;
}
.qtype-card {
  padding: 22px 18px;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-align: left;
  transition: all 0.18s ease;
}
.qtype-card:hover { border-color: var(--blue); transform: translateY(-2px); }
.qtype-card.selected {
  border-color: var(--blue);
  background: var(--sky-mist);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}
.qtype-card .qt-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--sky-soft);
  color: var(--blue);
  display: grid; place-items: center;
  margin-bottom: 12px;
  font-size: 1.1rem;
}
.qtype-card.selected .qt-icon { background: var(--blue); color: #fff; }
.qtype-card h4 { margin: 0 0 4px; font-size: 1.02rem; color: var(--navy); }
.qtype-card p { margin: 0; font-size: 0.82rem; color: var(--ink-light); line-height: 1.4; }

.question-builder {
  background: var(--paper);
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 14px;
  position: relative;
}
.question-builder .qb-num {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 3px 11px;
  border-radius: var(--radius-pill);
  margin-bottom: 10px;
}
.question-builder textarea,
.question-builder input[type="text"] {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
}
.question-builder textarea:focus,
.question-builder input[type="text"]:focus {
  outline: none;
  border-color: var(--blue);
}
.question-builder .qb-options { margin-top: 10px; }
.question-builder .qb-option-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}
.question-builder .qb-option-row input[type="radio"] {
  width: 18px; height: 18px;
  accent-color: var(--green);
  flex-shrink: 0;
}
.question-builder .qb-option-row input[type="text"] { flex: 1; }
.question-builder .qb-option-row .letter {
  width: 26px; height: 26px;
  background: var(--paper);
  border-radius: 6px;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--navy);
  flex-shrink: 0;
}
.question-builder .remove-q {
  position: absolute;
  top: 14px; right: 14px;
  width: 28px; height: 28px;
  border-radius: 50%;
  color: var(--ink-light);
  display: grid; place-items: center;
}
.question-builder .remove-q:hover { background: #fef2f2; color: var(--red); }

.add-question-btn {
  width: 100%;
  padding: 14px;
  border: 2px dashed var(--blue);
  border-radius: var(--radius-md);
  background: rgba(37, 99, 235, 0.04);
  color: var(--blue);
  font-weight: 700;
  font-size: 0.92rem;
  transition: all 0.18s ease;
}
.add-question-btn:hover {
  background: rgba(37, 99, 235, 0.1);
  border-style: solid;
}

/* Quiz runner extensions for fill/short */
.qr-text-input {
  width: 100%;
  padding: 16px 20px;
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  background: var(--paper);
  transition: all 0.18s ease;
}
.qr-text-input:focus {
  outline: none;
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37,99,235,0.1);
}
.qr-text-input.is-correct { border-color: var(--green); background: #f0fdf4; color: var(--green); }
.qr-text-input.is-wrong { border-color: var(--red); background: #fef2f2; color: var(--red); }
textarea.qr-text-input { min-height: 110px; resize: vertical; }
.short-answer-note {
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--ink-light);
  font-style: italic;
}

/* Form 1-5 difficulty legend */
.difficulty-legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  font-size: 0.8rem;
}
.difficulty-legend .leg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-light);
}
.difficulty-legend .swatch {
  width: 10px; height: 10px;
  border-radius: 50%;
}

/* Responsive learn layout */
@media (max-width: 920px) {
  .learn-layout { grid-template-columns: 1fr; }
  .subject-sidebar {
    position: static;
    max-height: none;
    margin-bottom: 16px;
  }
  .subject-sidebar h4 { display: none; }
  .subject-sidebar > div {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 6px;
  }
  .sidebar-item { flex-shrink: 0; margin-bottom: 0; }
  .qtype-grid { grid-template-columns: 1fr; }
  .fc-list-row { grid-template-columns: 20px 1fr 60px; }
  .fc-list-row .fc-back-text { display: none; }
  /* Match the FAB (64px circle, 18px from the bottom) so the two float buttons pair up */
  .chatbot-launcher {
    left: 18px; bottom: 18px;
    width: 64px; height: 64px;
    padding: 0; gap: 0;
    justify-content: center;
  }
  .chatbot-launcher span:not(.cb-icon) { display: none; }
  .chatbot-launcher .cb-icon { width: 40px; height: 40px; font-size: 1.4rem; }
  /* accordion overrides for mobile */
  .subject-sidebar > div {
    flex-direction: column; /* stack categories vertically, not horizontal */
    overflow-x: visible;
  }
  .sidebar-category {
    flex-shrink: 0;
    width: 100%;
  }
  .sidebar-subjects {
    max-height: 0;
  }
  .sidebar-category.open .sidebar-subjects {
    max-height: 600px;
  }
}

/* ===================================================================
   NEW FEATURES (migrated from SPA): favourites, builders, classes,
   admin, live quiz, forgot password, profile editor, search.
   =================================================================== */

/* Bookmark button on quiz/lesson cards */
.quiz-card { position: relative; }
.card-bookmark {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--ink-faint);
  transition: all 0.18s ease;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(10, 31, 68, 0.08);
}
.card-bookmark svg { width: 16px; height: 16px; }
.card-bookmark:hover { color: var(--blue); transform: scale(1.1); }
.card-bookmark.active { color: var(--yellow-deep); background: #fff; }

.author-tag {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.7em;
  color: var(--blue);
  background: var(--sky-soft);
  padding: 2px 6px;
  border-radius: 4px;
  vertical-align: middle;
  font-weight: 600;
}

/* Search input on Learn page */
.learn-search {
  position: relative;
  margin: 16px 0 18px;
  display: flex;
  align-items: center;
}

/* Inline search results — grouped by subject in the main area */
.search-subject-group { margin-bottom: 26px; }
.search-subject-group .search-group-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 14px;
}
.search-subject-group .search-group-emoji {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  background: var(--sky-soft);
  flex: 0 0 auto;
}
.search-subject-group .search-group-head h2 { margin: 0; font-size: 1.25rem; }
.search-subject-group .search-group-head p { margin: 0; color: var(--ink-light); font-size: 0.85rem; }
.learn-search input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 44px 12px 44px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--navy);
  outline: none;
  min-width: 0;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.learn-search input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}
.learn-search .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--ink-faint);
  pointer-events: none;
  z-index: 1;
}
.learn-search button {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--line-soft);
  color: var(--ink-mid);
  font-size: 1.2rem;
  cursor: pointer;
  place-items: center;
  line-height: 1;
}
.learn-search button:hover { background: var(--line); }

/* Search row: search box + filter button side-by-side */
.learn-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 18px;
}
.learn-search-row .learn-search {
  flex: 1;
  margin: 0;
}
.learn-filter-wrap {
  position: relative;
  flex: 0 0 auto;
}
.learn-filter-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  height: 44px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--ink-mid);
  font-size: 0.9rem;
  font-family: var(--font-body);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.18s, background 0.18s, color 0.18s;
}
.learn-filter-btn:hover { border-color: var(--blue); color: var(--blue); }
.learn-filter-btn.active { border-color: var(--blue); color: var(--blue); background: var(--sky-soft); }
.learn-filter-btn.filtered { border-color: var(--navy); color: var(--navy); background: var(--sky-soft); font-weight: 600; }
.learn-filter-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 140px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.10);
  z-index: 200;
  overflow: hidden;
}
.learn-filter-option {
  display: block;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  border: none;
  background: none;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s;
}
.learn-filter-option:hover { background: var(--sky-soft); }
.learn-filter-option.active { color: var(--blue); font-weight: 600; background: var(--sky-soft); }

/* ---------- Nice select: progressive-enhancement popover over a plain
   <select> (see nice-select.js). Same visual language as the Form filter
   dropdown above (.learn-filter-*), adapted to sit inline in a form as a
   full-width field instead of a compact icon button. ---------- */
.nice-select-wrap { position: relative; }
.nice-select-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.nice-select-chev {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--ink-light);
  transition: transform 0.15s ease;
}
.nice-select-btn[aria-expanded="true"] .nice-select-chev { transform: rotate(180deg); }
.nice-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.10);
  z-index: 200;
}
.nice-select-option {
  display: block;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  border: none;
  background: none;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s;
}
.nice-select-option:hover { background: var(--sky-soft); }
.nice-select-option.active { color: var(--blue); font-weight: 600; background: var(--sky-soft); }

.field .nice-select-btn {
  padding: 13px 16px;
  border-radius: var(--radius-md);
  border: 2px solid var(--line);
  background: var(--paper);
  font-size: 0.98rem;
  color: var(--ink);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.field .nice-select-btn[aria-expanded="true"] {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.5);
}
.builder-input.nice-select-btn[aria-expanded="true"] {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

/* Small spinner shown just below the tab bar (Quizzes/Flashcards/Classroom)
   while a server-side search request is in flight (see
   thApplySearch/shApplySearch/applyLearnSearch). One per subject panel, so
   it stays visible no matter which of the three tabs is currently active. */
.tab-spinner {
  width: 18px;
  height: 18px;
  margin: 2px auto 14px;
  border: 2px solid var(--line-soft);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

/* Quiz Builder */
.builder-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.builder-label {
  display: block;
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--navy);
  margin-bottom: 6px;
  margin-top: 4px;
}
.builder-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--navy);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.builder-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}
.builder-q {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-top: 12px;
  box-shadow: var(--shadow-sm);
}
.builder-q-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.builder-q-num {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--blue);
  background: var(--sky-soft);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.84rem;
}
.builder-options {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.builder-option {
  display: grid;
  grid-template-columns: 28px 1fr 70px;
  align-items: center;
  gap: 10px;
}
.builder-option input[type="radio"] {
  width: 20px;
  height: 20px;
  accent-color: var(--green);
  cursor: pointer;
}
.builder-option .builder-correct-tag {
  font-size: 0.78rem;
  color: var(--ink-faint);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.builder-option input[type="radio"]:checked ~ .builder-correct-tag,
.builder-option:has(input[type="radio"]:checked) .builder-correct-tag {
  color: var(--green);
}

/* Mini button variant */
.btn-mini {
  padding: 6px 12px !important;
  font-size: 0.82rem !important;
}
.btn-icon-trash {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  color: var(--red);
  font-size: 0.95rem;
}
.btn-icon-trash:hover { background: #fef2f2; }

/* Classes */
.classes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 18px;
}
.class-card { padding: 20px 24px; }
.class-card[data-class-open] { cursor: pointer; transition: transform 0.2s ease, box-shadow 0.2s ease; }
.class-card[data-class-open]:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.class-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.class-code-display {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius-md);
}
.class-code-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  flex-shrink: 0;
}
.class-code-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: 0.12em;
  color: var(--yellow);
  margin-left: auto;
  white-space: nowrap;
}
.class-form-row {
  display: grid;
  grid-template-columns: 2fr 1fr auto;
  gap: 8px;
  margin-top: 14px;
  align-items: end;
}

/* Pagination controls shown under a paginated grid (see app-pagination.js) */
.pagination-loader {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 36px;
  margin: 6px 0 2px;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.pagination-loader.visible { opacity: 1; }
.pagination-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--line-soft);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.pagination-showmore {
  display: flex;
  justify-content: center;
  margin: 6px 0 2px;
}

/* Create-class modal (TeacherHome) */
.tc-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10,31,68,0.55);
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.tc-modal-backdrop.open { opacity: 1; pointer-events: auto; }
.tc-modal {
  width: min(640px, 100%);
  padding: 32px;
  transform: translateY(12px);
  transition: transform 0.2s ease;
}
.tc-modal-backdrop.open .tc-modal { transform: translateY(0); }
.tc-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0;
}
.tc-modal-head h3 { margin-bottom: 0; }
.tc-modal-close {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-light);
  padding: 0 4px;
}
.tc-modal-close:hover { color: var(--ink); }
.tc-modal-fields {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
  margin-top: 18px;
}
.tc-modal-actions {
  margin-top: 18px;
}
@media (max-width: 480px) {
  .tc-modal-fields { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .tc-modal-backdrop, .tc-modal { transition: none; }
}

/* Admin */
.admin-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--sky-mist);
  margin-top: 8px;
  gap: 12px;
  flex-wrap: wrap;
}
.admin-name { font-weight: 700; color: var(--navy); margin-bottom: 2px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.admin-meta { color: var(--ink-light); font-size: 0.86rem; }
.role-tag {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-weight: 700;
}
.role-tag.role-student  { background: #dbeafe; color: var(--blue); }
.role-tag.role-lecturer,
.role-tag.role-teacher  { background: #fef3c7; color: var(--yellow-deep); }
.role-tag.role-admin    { background: #fce7f3; color: #be185d; }

/* Live quiz */
.live-code-display {
  text-align: center;
  padding: 40px 20px;
  background: linear-gradient(135deg, var(--navy), #1e3a8a);
  border-radius: var(--radius-lg);
  color: #fff;
  margin-top: 24px;
}
.live-code-label {
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 14px;
}
.live-code-big {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 4rem;
  letter-spacing: 0.2em;
  color: var(--yellow);
}
.live-joiners {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.live-joiner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  background: var(--sky-soft);
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 600;
  animation: liveJoin 0.4s ease-out;
  color: var(--navy);
}
.live-joiner::before {
  content: "";
  display: inline-block;
  background: var(--blue);
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 0.82rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}
@keyframes liveJoin {
  from { opacity: 0; transform: translateY(-4px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Forgot password — uses .auth-form / .auth-wrap */
.auth-form {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--line-soft);
}
.auth-form h2 { margin: 0 0 6px; color: var(--navy); }
.auth-form .sub { color: var(--ink-light); margin-bottom: 18px; }
.auth-form label { display: block; font-weight: 700; margin-bottom: 6px; color: var(--navy); font-size: 0.9rem; }
.auth-form input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
}
.auth-form input:focus { border-color: var(--blue); }

/* Quiz countdown timer chip in the runner header */
.qr-timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  padding: 7px 14px;
  background: var(--sky-soft);
  color: var(--blue);
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--blue);
  letter-spacing: 0.04em;
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}
.qr-timer #qrTimerText { font-variant-numeric: tabular-nums; }
.qr-timer.low {
  background: #fee2e2;
  color: var(--red);
  border-color: var(--red);
  animation: timerPulse 1s ease-in-out infinite;
}
@keyframes timerPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.04); }
}

/* "Private" indicator on user-authored cards in the Learn page */
.visibility-tag {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.7em;
  color: var(--ink-mid);
  background: var(--line-soft);
  padding: 2px 8px;
  border-radius: 4px;
  vertical-align: middle;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Profile avatar as emoji (chosen via the editor) */
.profile-avatar.has-emoji {
  font-size: 2.4rem;
  background: rgba(255, 255, 255, 0.18);
  line-height: 1;
}

/* Avatar picker grid in the profile editor */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 10px;
}
.avatar-option {
  width: 56px;
  height: 56px;
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  font-size: 1.8rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.16s, border-color 0.16s, box-shadow 0.16s;
}
.avatar-option:hover { transform: scale(1.06); border-color: var(--blue); }
.avatar-option.selected {
  border-color: var(--blue);
  background: var(--sky-soft);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
}

/* Inline action cluster on Learn-page quiz cards (Edit / Delete) */
.card-actions {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 6px;
  z-index: 2;
}
.card-action-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 0.94rem;
  color: var(--ink-mid);
  transition: all 0.18s ease;
  box-shadow: 0 2px 6px rgba(10, 31, 68, 0.08);
}
.card-action-btn:hover { color: var(--blue); transform: scale(1.1); }
.card-action-btn.danger:hover { color: var(--red); background: #fef2f2; }

/* Code-entry input on the live Join page */
.live-code-input {
  font-family: var(--font-display);
  font-size: 1.8rem;
  text-align: center;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-weight: 800;
}

/* "Waiting for the host…" spinner on the participant's view */
.live-waiting-spinner {
  width: 60px;
  height: 60px;
  border: 5px solid var(--line-soft);
  border-top-color: var(--blue);
  border-radius: 50%;
  margin: 0 auto;
  animation: liveSpin 0.9s linear infinite;
}
@keyframes liveSpin { to { transform: rotate(360deg); } }

/* Feedback box shown to a participant after they submit an answer */
.live-answer-feedback {
  margin-top: 20px;
  padding: 18px;
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
}
.live-answer-feedback.correct {
  background: #ecfdf5;
  color: var(--green);
  border: 2px solid var(--green);
}
.live-answer-feedback.incorrect {
  background: #fef2f2;
  color: var(--red);
  border: 2px solid var(--red);
}

/* Highlight the participant's own row on the final leaderboard */
.lb-row.is-me {
  background: var(--sky-soft);
  border-color: var(--blue);
}

/* Host's question-preview options shown statically (no hover) */
.option.correct-highlight {
  background: #ecfdf5;
  border-color: var(--green);
}
.option.wrong-highlight {
  background: #fef2f2;
  border-color: var(--red);
}

/* Streak fire badge on the live-play answer feedback */
.live-streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: #fff7ed;
  color: #ea580c;
  font-weight: 800;
  font-size: 0.9rem;
}

/* New-feature responsive tweaks */
@media (max-width: 720px) {
  .builder-grid { grid-template-columns: 1fr; }
  .class-form-row { grid-template-columns: 1fr; }
  .builder-option { grid-template-columns: 28px 1fr; }
  .builder-option .builder-correct-tag { display: none; }
  .live-code-big { font-size: 2.4rem; }
}
@media (max-width: 480px) {
  .card-action-btn { width: 26px; height: 26px; font-size: 0.84rem; }
}
