/* Student workspace styles (pages/student.html).
   Every colour comes from the theme tokens below, so a student's saved theme and accent
   (My profile → Theme and accent) apply to navigation, cards, forms, dialogs and charts alike.
   Themes are set on <html>: data-theme="default | light | dark" and data-accent="default | blue |
   purple | green | orange" (scripts/student/appearance.js). The teacher dashboard never sets them. */

/* Theme tokens (colours for the default, light and calm dark themes and the accents) are in
   styles/theme.css. Shared with the teacher dashboard: Home components in styles/home.css, and
   the account menu and My profile page in styles/account.css. */

/* =====================================================================
   Workspace layout and existing tools
   ===================================================================== */
/* Hidden until auth-guard.js confirms a signed-in student */
.auth-check-pending body { visibility: hidden; }

* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
html { background: var(--bg); }
body { background: var(--bg); color: var(--text-main); display: flex; height: 100vh; overflow: hidden; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Page headings receive focus when a view opens (student-ui.js) so screen readers start there;
   they aren't controls, so they don't get a focus ring. */
.view h1[tabindex="-1"]:focus { outline: none; }
.icon { width: 17px; height: 17px; flex: none; }

/* ---------- Sidebar ---------- */
aside {
  width: 248px; flex-shrink: 0; background: var(--sidebar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; justify-content: space-between; padding: 16px 12px; overflow-y: auto;
}
.brand-box { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; border-bottom: 1px solid var(--border); }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; color: #fff;
  /* The logo stays black and white in every theme and accent, with a soft white glow */
  background: radial-gradient(circle at 30% 22%, #202024, #050506 72%); border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), 0 0 20px rgba(255, 255, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.brand-mark svg { width: 20px; height: 20px; overflow: visible; filter: drop-shadow(0 0 1.5px rgba(255, 255, 255, 0.95)) drop-shadow(0 0 5px rgba(255, 255, 255, 0.55)); animation: brand-glow 4.5s ease-in-out infinite; }
@keyframes brand-glow { 50% { filter: drop-shadow(0 0 2px rgba(255, 255, 255, 1)) drop-shadow(0 0 9px rgba(255, 255, 255, 0.75)); } }
@media (prefers-reduced-motion: reduce) { .brand-mark svg { animation: none; } }
.brand-text b { display: block; font-size: 14px; font-weight: 650; letter-spacing: -0.2px; }
.brand-text small { font-size: 11.5px; color: var(--text-muted); }
.nav-group { margin-top: 18px; display: flex; flex-direction: column; gap: 2px; }
.nav-label { display: flex; align-items: center; justify-content: space-between; font-size: 11px; text-transform: uppercase; color: var(--text-muted); font-weight: 600; padding: 0 10px 6px; letter-spacing: 0.6px; }
.nav-add {
  width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border-strong); background: transparent;
  color: var(--text-soft); display: grid; place-items: center; cursor: pointer; font-size: 15px; line-height: 1;
}
.nav-add:hover { background: var(--surface-hover); color: var(--text-main); }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 8px 10px; border-radius: 8px; border: 0; background: none;
  font-size: 13.5px; font-weight: 500; color: var(--text-muted); text-decoration: none; text-align: left; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item:hover { background: var(--surface-raised); color: var(--text-main); }
.nav-item[aria-current] { background: var(--surface-hover); color: var(--text-main); box-shadow: inset 2px 0 0 var(--accent); }
.nav-item[aria-current] .icon { color: var(--accent); }
.sidebar-classes { display: flex; flex-direction: column; gap: 2px; }
.sidebar-classes .nav-item span.name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.class-initial {
  width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; flex: none; font-size: 11px; font-weight: 700;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.sidebar-empty { font-size: 12.5px; color: var(--text-muted); padding: 2px 10px 6px; }
.user-card {
  display: flex; align-items: center; gap: 10px; padding: 10px; margin-top: 16px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--surface-2);
}
.user-card b { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card small { font-size: 11.5px; color: var(--text-muted); }
.user-card > div { min-width: 0; }

/* ---------- Main + header ---------- */
main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-y: auto; background: var(--bg); scroll-behavior: smooth; }
header {
  height: 60px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 28px;
  position: sticky; top: 0; z-index: 20; background: var(--header-bg); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border);
}
.breadcrumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); font-weight: 500; white-space: nowrap; min-width: 0; }
.breadcrumbs b { color: var(--text-main); font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: 8px; }

.btn-action {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: var(--surface-raised); color: var(--text-main);
  border: 1px solid var(--border-strong); border-radius: 8px; font-size: 12.5px; font-weight: 500; padding: 7px 12px;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-action:hover { background: var(--surface-hover); border-color: var(--border-hover); }
.btn-action:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-action .icon { width: 15px; height: 15px; }
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--primary-bg); color: var(--primary-text); border: 0;
  border-radius: 9px; padding: 10px 16px; font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 8px 22px color-mix(in srgb, var(--accent) 10%, transparent); transition: background 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 0 0 1px rgba(255,255,255,0.18), 0 10px 26px color-mix(in srgb, var(--accent) 18%, transparent); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary .icon { width: 16px; height: 16px; }
.btn-ghost { background: var(--surface-glass); border: 1px solid var(--border-strong); color: var(--text-main); }
.btn-join {
  display: inline-flex; align-items: center; gap: 8px; background: var(--green); color: #052e16; border: 0; border-radius: 9px;
  padding: 10px 16px; font-size: 13.5px; font-weight: 700; cursor: pointer; box-shadow: 0 8px 22px rgba(34, 197, 94, 0.22);
}
.btn-join:hover { filter: brightness(1.08); }

.portal-main { padding: 28px; max-width: 1440px; margin: 0 auto; width: 100%; }
.view { display: flex; flex-direction: column; gap: 20px; animation: view-in 0.25s ease; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.portal-main section[id] { scroll-margin-top: 76px; }

/* Page heading */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-kicker { font-size: 12px; color: var(--text-muted); font-weight: 600; letter-spacing: 0.4px; }
.welcome-title, .page-title { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; margin-top: 2px; }
.page-sub { font-size: 14px; color: var(--text-muted); margin-top: 4px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.panel-card {
  background: linear-gradient(180deg, var(--surface), var(--surface-2)); border: 1px solid var(--border); border-radius: 16px;
  padding: 22px; display: flex; flex-direction: column; min-width: 0;
}
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.panel-title { display: flex; align-items: center; gap: 10px; font-size: 15.5px; font-weight: 650; letter-spacing: -0.2px; }
.panel-title .chip-icon { width: 30px; height: 30px; }
.panel-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; line-height: 1.5; }
.panel-sub[data-state="error"], .form-message[data-state="error"] { color: var(--danger-text); }
.chip-icon {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
}
.chip-icon svg { width: 17px; height: 17px; }
.chip-icon.green { color: var(--green); background: rgba(34, 197, 94, 0.08); border-color: rgba(34, 197, 94, 0.22); }
.chip-icon.amber { color: var(--amber); background: rgba(245, 183, 72, 0.08); border-color: rgba(245, 183, 72, 0.22); }
.chip-icon.red { color: var(--danger-text); background: rgba(239, 68, 68, 0.08); border-color: rgba(239, 68, 68, 0.22); }
.field-select {
  background: var(--surface-sunken); color: var(--text-main); border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 7px 10px; font-size: 12.5px;
}
.field-input {
  width: 100%; background: var(--surface-sunken); border: 1px solid var(--border-strong); border-radius: 9px;
  padding: 10px 12px; color: var(--text-main); font-size: 13.5px; outline: none; transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field-input:focus { border-color: color-mix(in srgb, var(--accent) 45%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 8%, transparent); }
.field-input:disabled { opacity: 0.55; }
textarea.field-input { resize: vertical; min-height: 120px; line-height: 1.55; }
.empty-state {
  list-style: none; font-size: 13px; color: var(--text-muted); background: var(--surface-sunken); border: 1px dashed var(--border-strong);
  border-radius: 12px; padding: 18px; text-align: center; line-height: 1.5;
}

/* Class banner (student-classes.js): the card beside the Focus session heading, styled like Home's
   main-action card (styles/home.css .next-card) */
.class-banner {
  position: relative; padding: 20px; border-radius: 18px; min-width: 0;
  background: var(--surface-glass); border: 1px solid var(--border-strong); backdrop-filter: blur(12px);
  box-shadow: 0 16px 40px color-mix(in srgb, var(--shadow-color) 60%, transparent);
}
.class-banner[data-state="live"] { border-color: color-mix(in srgb, var(--red) 45%, var(--border-strong)); background: linear-gradient(140deg, color-mix(in srgb, var(--red) 12%, var(--surface)), var(--surface)); }
.class-banner[data-state="sharing"] { border-color: color-mix(in srgb, var(--green) 45%, var(--border-strong)); background: linear-gradient(140deg, color-mix(in srgb, var(--green) 12%, var(--surface)), var(--surface)); }
.class-banner[data-state="error"] { border-color: color-mix(in srgb, var(--amber) 45%, var(--border-strong)); }
.class-banner-kicker { display: flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.7px; color: var(--text-muted); }
.class-banner[data-state="live"] .class-banner-kicker { color: var(--danger-text); }
.class-banner[data-state="sharing"] .class-banner-kicker { color: var(--success-text); }
.class-banner[data-state="error"] .class-banner-kicker { color: var(--warning-text); }
.class-banner[data-state="live"] .next-icon { color: var(--danger-text); background: color-mix(in srgb, var(--red) 10%, transparent); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.class-banner[data-state="sharing"] .next-icon { color: var(--success-text); background: color-mix(in srgb, var(--green) 10%, transparent); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.class-banner-title { font-size: 19px; font-weight: 700; letter-spacing: -0.3px; line-height: 1.3; margin-top: 6px; overflow-wrap: anywhere; }
.class-banner-sub { font-size: 13.5px; color: var(--text-soft); margin-top: 6px; line-height: 1.5; }
.class-banner-sub:empty { display: none; }
.class-banner-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; clear: both; }
.class-banner-actions:empty { display: none; }

/* KPI cards */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card {
  background: linear-gradient(180deg, var(--surface), var(--surface-2)); border: 1px solid var(--border); border-radius: 16px; padding: 18px 20px;
  display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto auto; column-gap: 12px;
}
.stat-label { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.stat-card .chip-icon { grid-column: 2; grid-row: 1 / span 2; }
.stat-card strong { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-card small { grid-column: 1 / -1; font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-card small[data-state="Focused"] { color: var(--green); }
.stat-card small[data-state="Distracted"] { color: var(--danger-text); }
.stat-card small[data-state="Away"] { color: var(--amber); }

/* Attention tracker (eye-analyzer.js) */
.video-viewport {
  width: 100%; aspect-ratio: 16 / 10; background: radial-gradient(ellipse at 50% 40%, var(--surface-2), var(--bg));
  border: 1px solid var(--border); border-radius: 14px; position: relative; overflow: hidden; margin-bottom: 14px;
}
#analyzerVideo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.video-placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 20px; text-align: center; color: var(--text-muted); font-size: 13.5px; line-height: 1.5;
  background: radial-gradient(ellipse 50% 55% at 50% 45%, var(--glow-soft), transparent 70%);
}
.placeholder-rings {
  display: grid; place-items: center; width: 96px; height: 96px; border-radius: 50%; margin-bottom: 6px;
  border: 1px dashed color-mix(in srgb, var(--accent) 30%, var(--border)); box-shadow: 0 0 0 14px color-mix(in srgb, var(--accent) 4%, transparent);
}
.video-placeholder .chip-icon { width: 54px; height: 54px; border-radius: 50%; }
.video-placeholder .chip-icon svg { width: 24px; height: 24px; }
.video-placeholder b { color: var(--text-main); font-size: 15.5px; }
.status-chip, .live-kpi-chip, .privacy-chip {
  position: absolute; z-index: 1; display: flex; align-items: center; gap: 7px; max-width: calc(100% - 24px);
  background: var(--overlay-chip); backdrop-filter: blur(8px); border: 1px solid var(--border-strong); border-radius: 999px;
}
.status-chip { top: 12px; left: 12px; padding: 6px 12px; font-size: 12px; font-weight: 600; color: var(--text-soft); max-width: calc(100% - 120px); }
.status-chip #gazeStatus { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--text-faint); }
.tracker-card[data-tracking="true"] .status-dot { background: var(--green); box-shadow: 0 0 8px color-mix(in srgb, var(--green) 70%, transparent); animation: status-pulse 2s ease-in-out infinite; }
@keyframes status-pulse { 50% { box-shadow: 0 0 2px color-mix(in srgb, var(--green) 40%, transparent); } }
.live-kpi-chip { top: 12px; right: 12px; padding: 6px 12px; font-size: 12px; font-weight: 600; color: var(--green); font-variant-numeric: tabular-nums; }
.live-kpi-chip span { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px rgba(34, 197, 94, 0.7); }
.tracker-card:not([data-tracking="true"]) .live-kpi-chip { display: none; }
.privacy-chip { left: 12px; bottom: 12px; gap: 6px; font-size: 11.5px; color: var(--text-soft); border-color: var(--border); padding: 5px 10px; }
.privacy-chip svg { width: 13px; height: 13px; color: var(--green); }
.camera-actions { display: flex; gap: 10px; }
.btn-camera, .btn-stop { flex: 1; padding: 12px 16px; border-radius: 11px; font-size: 14px; font-weight: 650; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-camera { background: var(--primary-bg); color: var(--primary-text); border: 0; box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 12%, transparent); }
.btn-camera:hover { background: var(--primary-hover); }
.btn-camera:disabled { opacity: 0.6; cursor: progress; }
.btn-stop { background: rgba(239, 68, 68, 0.08); color: var(--danger-text); border: 1px solid rgba(239, 68, 68, 0.35); }
.btn-stop:hover { background: rgba(239, 68, 68, 0.14); }

/* Switch toggles (real checkboxes keep their ids) */
.switch { display: inline-flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-soft); cursor: pointer; user-select: none; }
.switch input {
  appearance: none; -webkit-appearance: none; width: 34px; height: 20px; border-radius: 999px; background: var(--track); position: relative;
  cursor: pointer; flex: none; transition: background 0.2s ease; border: 1px solid var(--border-hover);
}
.switch input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--switch-knob);
  transition: transform 0.2s ease, background 0.2s ease;
}
.switch input:checked { background: color-mix(in srgb, var(--accent) 35%, transparent); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.switch input:checked::after { transform: translateX(14px); background: var(--switch-knob-on); }
.share-status { margin-top: 12px; font-size: 12.5px; color: var(--text-muted); line-height: 1.45; display: flex; gap: 8px; align-items: baseline; }
.share-status::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--border-hover); transform: translateY(-1px); }
.share-status[data-state="live"] { color: var(--success-text); }
.share-status[data-state="live"]::before { background: var(--green); box-shadow: 0 0 6px rgba(34, 197, 94, 0.6); }

/* Focus timer */
.timer-body { display: flex; justify-content: center; padding: 2px 0 10px; }
.timer-ring { position: relative; width: 196px; height: 196px; }
.timer-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); filter: drop-shadow(0 0 14px color-mix(in srgb, var(--accent) 25%, transparent)); }
.timer-ring circle { fill: none; stroke-width: 7; }
.ring-track { stroke: var(--track); }
#timerRing { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 326.73; transition: stroke-dashoffset 0.9s linear; }
[data-phase="break"] #timerRing { stroke: var(--green); }
[data-phase="break"] .timer-ring svg { filter: drop-shadow(0 0 14px rgba(34, 197, 94, 0.25)); }
.timer-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
#timerDisplay { font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -1px; }
#timerPhase { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; font-weight: 650; }
[data-phase="break"] #timerPhase { color: var(--green); }
.timer-meta { font-size: 12.5px; color: var(--text-muted); text-align: center; margin-bottom: 14px; }
.timer-actions { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px; }

/* Timeline */
.chart-box { position: relative; height: 240px; }
.chart-empty {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 16px;
  color: var(--text-muted); font-size: 13px; background: var(--surface-sunken); border: 1px dashed var(--border-strong); border-radius: 12px;
}

/* ---------- Page headers: Focus session, NeuroBuddy, Class notes, My progress ----------
   Home's welcome area (styles/home.css .home-hero) with each page's own line art. Below it come the
   "at a glance" tiles and cards from Home, so every page looks like the same product. */
.focus-hero .page-hero-actions { margin-top: 18px; }

/* ---------- Focus session (pages/student.html #view-focus) ---------- */
/* Session state pill (student-focus.js) */
.focus-hero[data-state="idle"] .eyebrow-pill .tag { color: var(--text-soft); background: var(--track); }
.focus-hero[data-state="timer"] .eyebrow-pill .tag { color: var(--primary-text); background: var(--accent); }
.focus-hero[data-state="break"] .eyebrow-pill .tag { color: #052e16; background: color-mix(in srgb, var(--green) 70%, #fff); }
.focus-hero[data-state="tracking"] .home-hero-art { opacity: 0.8; }

/* At a glance: plain cards (Home frosts them over its live background) */
.live-tile-focus[data-state="Focused"] { border-color: color-mix(in srgb, var(--green) 40%, var(--border)); }
.live-tile-focus[data-state="Focused"] .glance-meter span { background: linear-gradient(90deg, color-mix(in srgb, var(--green) 60%, var(--accent)), var(--green)); }
/* Looking away is an estimate, not proof of distraction: amber, not red. Unavailable and break
   readings have no score, so they look neutral. */
.live-tile-focus[data-state="Distracted"] { border-color: color-mix(in srgb, var(--amber) 45%, var(--border)); }
.live-tile-focus[data-state="Distracted"] .glance-meter span { background: var(--amber); }
.live-tile-focus[data-state="Unavailable"] { border-style: dashed; border-color: var(--border-hover); }
.live-tile-focus[data-state="Break"] { border-color: color-mix(in srgb, var(--green) 30%, var(--border)); }
.glance-note[data-state="Focused"] { color: var(--success-text); }
.glance-note[data-state="Distracted"] { color: var(--warning-text); }
.glance-note[data-state="Unavailable"] { color: var(--text-muted); }
.glance-note[data-state="Break"] { color: var(--success-text); }

/* Tracker on the left; timer and micro-goals on the right. Both columns end on the same line. */
.focus-stage { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); gap: 20px; align-items: stretch; }
.focus-side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.focus-side #micro-goals { flex: 1; }
.tracker-card[data-tracking="true"] { border-color: color-mix(in srgb, var(--green) 35%, var(--border)); }
/* The camera area grows to fill the card when the right column is taller (e.g. a long list of steps) */
.tracker-card .video-viewport { flex: 1 0 auto; min-height: 240px; }
.tracker-settings { padding-top: 16px; }
.timeline-card .chart-box { height: 220px; }

/* Timer length: segmented buttons that set the hidden #timerPreset list */
.segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; padding: 3px; margin: -4px 0 14px; background: var(--surface-sunken); border: 1px solid var(--border); border-radius: 11px; }
.segmented button {
  border: 0; border-radius: 8px; background: transparent; padding: 7px 4px; font-size: 13.5px; font-weight: 650; color: var(--text-muted);
  cursor: pointer; font-variant-numeric: tabular-nums; transition: background 0.15s ease, color 0.15s ease;
}
.segmented button small { font-size: 11.5px; font-weight: 500; opacity: 0.75; }
.segmented button:hover { color: var(--text-main); }
.segmented button[aria-checked="true"] { background: var(--surface-hover); color: var(--text-main); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, var(--border-strong)); }

/* Settings: a switch with a line saying what it does */
.setting-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.setting-tile {
  display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 12px; cursor: pointer;
  background: var(--surface-sunken); border: 1px solid var(--border); transition: border-color 0.15s ease;
}
.setting-tile:hover { border-color: var(--border-hover); }
.setting-tile:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.setting-tile:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.setting-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.setting-tile b, .setting b { font-size: 13px; font-weight: 600; line-height: 1.35; }
.setting-tile small, .setting small { display: block; font-size: 12px; color: var(--text-muted); line-height: 1.45; }
.tracker-settings .share-status { margin-top: 12px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 14px; cursor: pointer; }
.setting b { display: block; }
.timer-setting { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }

/* Micro-goals */
.inline-form { display: flex; gap: 8px; }
.progress { height: 6px; background: var(--track); border-radius: 4px; overflow: hidden; margin-top: 14px; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-strong), var(--green)); transition: width 0.3s ease; }
.goal-summary { font-size: 12.5px; color: var(--text-muted); margin: 8px 0 10px; }
.goal-list { list-style: none; display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.goal-item { display: flex; align-items: center; gap: 8px; padding: 9px 11px; background: var(--surface-sunken); border: 1px solid var(--border); border-radius: 10px; font-size: 13.5px; }
.goal-item label { flex: 1; display: flex; gap: 10px; align-items: center; cursor: pointer; min-width: 0; }
.goal-item label span { overflow-wrap: anywhere; }
.goal-item input[type="checkbox"] { accent-color: var(--green); width: 16px; height: 16px; flex: none; cursor: pointer; }
.goal-item[data-done="true"] label span { text-decoration: line-through; color: var(--text-muted); }
.goal-delete { background: none; border: 0; color: var(--text-muted); cursor: pointer; font-size: 17px; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.goal-delete:hover { color: var(--danger-text); background: var(--surface-hover); }
.card-foot { display: flex; justify-content: flex-end; margin-top: 12px; }

/* NeuroBuddy chat bubbles (learning-assistant.js) */
.panel-tools { display: flex; gap: 6px; align-items: center; flex: none; }
.prompt-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; background: var(--surface-sunken); border: 1px solid var(--border-strong); color: var(--text-soft);
  border-radius: 999px; padding: 6px 12px; font-size: 12.5px; cursor: pointer; transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.chip:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--text-main); transform: translateY(-1px); }
.chip svg { width: 14px; height: 14px; color: var(--accent); }
.chat-box {
  height: max(320px, calc(100vh - 500px)); border: 1px solid var(--border); border-radius: 14px;
  background: radial-gradient(ellipse 70% 45% at 50% 0%, var(--glow-soft), transparent 70%), var(--surface-sunken);
  padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px;
}
.chat-bubble { padding: 11px 15px; border-radius: 16px; font-size: 13.5px; max-width: 80%; line-height: 1.55; white-space: pre-wrap; animation: bubble-in 0.32s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
@keyframes bubble-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.assistant-bubble { position: relative; background: var(--surface-raised); border: 1px solid var(--border); align-self: flex-start; border-bottom-left-radius: 4px; transform-origin: bottom left; }
.student-bubble { background: linear-gradient(135deg, var(--bubble-from), var(--bubble-to)); align-self: flex-end; color: var(--bubble-text); border-bottom-right-radius: 4px; transform-origin: bottom right; }
.assistant-error-bubble { color: var(--danger-text); border-color: rgba(239, 68, 68, 0.3); }
/* NeuroBuddy's face beside each of its messages */
.chat-box .assistant-bubble { margin-left: 38px; max-width: calc(80% + 38px); }
.chat-box .assistant-bubble::before {
  content: ""; position: absolute; left: -38px; bottom: 0; width: 28px; height: 28px; border-radius: 9px;
  /* NeuroBuddy's face (the mascot's head, scripts/student/buddy-mascot.js) */
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 28'%3E%3Cpath d='M14 7.5V5' stroke='white' stroke-width='1.6' stroke-linecap='round'/%3E%3Ccircle cx='14' cy='4.2' r='1.5' fill='white'/%3E%3Crect x='4.5' y='7.5' width='19' height='15.5' rx='7.75' fill='white'/%3E%3Crect x='7.6' y='11' width='12.8' height='7.6' rx='3.8' fill='%230d1424'/%3E%3Crect x='10.4' y='12.9' width='2.2' height='3.6' rx='1.1' fill='%2367e8f9'/%3E%3Crect x='15.4' y='12.9' width='2.2' height='3.6' rx='1.1' fill='%2367e8f9'/%3E%3C/svg%3E") center / 24px no-repeat,
    linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 45%, var(--green)));
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 25%, transparent);
}
/* While NeuroBuddy is thinking, its face bobs */
.chat-box .chat-bubble.is-pending::before { animation: buddy-bob 0.9s ease-in-out infinite; }
@keyframes buddy-bob { 50% { transform: translateY(-4px) rotate(-6deg); } }
/* "Thinking…" shows as typing dots (screen readers still hear the text) */
.chat-box .chat-bubble.is-pending { font-size: 0; padding: 15px 16px; }
.chat-box .chat-bubble.is-pending::after {
  content: ""; display: block; width: 34px; height: 8px; color: var(--text-muted);
  background: radial-gradient(circle closest-side, currentColor 90%, transparent) 0 / calc(100% / 3) 100% space;
  clip-path: inset(0 100% 0 0); animation: typing-dots 1.1s steps(4) infinite;
}
@keyframes typing-dots { to { clip-path: inset(0 -34% 0 0); } }

/* Formatted text: notes editor + NeuroBuddy replies (markdown.js) */
.rich { line-height: 1.6; overflow-wrap: anywhere; }
.rich > :first-child { margin-top: 0; }
.rich > :last-child { margin-bottom: 0; }
.rich h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; line-height: 1.3; margin: 20px 0 8px; color: var(--text-main); }
.rich h3 { font-size: 15px; font-weight: 650; line-height: 1.35; margin: 16px 0 6px; color: var(--text-main); }
.rich p { margin: 0 0 8px; }
.rich ul, .rich ol { margin: 0 0 10px; padding-left: 22px; }
.rich li { margin: 3px 0; padding-left: 2px; }
.rich li > ul, .rich li > ol { margin: 4px 0 4px; }
.rich li::marker { color: var(--accent); }
.rich ol > li::marker { font-weight: 650; font-size: 0.92em; }
.rich strong, .rich b { color: var(--text-strong); font-weight: 650; }
.rich code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; background: var(--surface-hover); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; }
.rich pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: var(--surface-sunken); border: 1px solid var(--border); border-radius: 10px; padding: 12px; overflow-x: auto; margin: 0 0 10px; white-space: pre; }
.rich blockquote { margin: 0 0 10px; padding: 6px 12px; border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 4%, transparent); border-radius: 0 8px 8px 0; color: var(--text-soft); }
.rich blockquote p { margin: 2px 0; }
.rich hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.chat-bubble.rich { white-space: normal; }
.chat-bubble.rich h2 { font-size: 15px; margin: 12px 0 4px; }
.chat-bubble.rich h3 { font-size: 14px; margin: 10px 0 4px; }
.chat-bubble.is-pending { color: var(--text-muted); }

/* Notes (student-notes.js): the list on the left, the open note on the right */
.notes-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; align-items: start; }
.notes-sidebar { position: sticky; top: 80px; padding: 14px; gap: 12px; }
.note-list { list-style: none; display: flex; flex-direction: column; gap: 6px; max-height: calc(100vh - 340px); min-height: 120px; overflow-y: auto; margin: 2px -6px 0; padding: 0 6px 2px; }
.note-item {
  position: relative; width: 100%; display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 11px 12px 11px 16px;
  border: 1px solid transparent; border-radius: 12px; background: none; cursor: pointer; overflow: hidden;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
/* The class's colour, the same as on Home's class cards */
.note-item::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--class-color, var(--text-faint)); opacity: 0.75; }
.note-item:hover { background: var(--surface-raised); border-color: var(--border); }
.note-item[aria-current="true"] { background: var(--surface-hover); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.note-item[aria-current="true"]::before { opacity: 1; }
.note-item b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-snippet { font-size: 12.5px; color: var(--text-muted); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.note-item-meta { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-faint); margin-top: 2px; min-width: 0; }
.note-item-meta .class-tag { font-size: 11px; padding: 0 7px; max-width: 150px; }

.note-panel { min-height: 560px; }
.note-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 48px 20px; color: var(--text-muted); font-size: 13.5px; }
.note-empty .placeholder-rings { margin-bottom: 8px; }
.note-empty .chip-icon { width: 54px; height: 54px; border-radius: 50%; }
.note-empty .chip-icon svg { width: 24px; height: 24px; }
.note-empty b { color: var(--text-main); font-size: 16px; }
.note-empty p { max-width: 420px; line-height: 1.55; }
.note-empty strong { color: var(--text-soft); }
.note-empty-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.quiz-action { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--border-strong)); }
.quiz-action:hover { background: color-mix(in srgb, var(--accent) 9%, var(--surface-raised)); }
.note-editor-wrap { display: flex; flex-direction: column; min-width: 0; }
.note-head { display: flex; align-items: center; gap: 12px; }
.note-title { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 24px; font-weight: 700; letter-spacing: -0.03em; padding: 2px 0; }
.note-title::placeholder { color: var(--text-faint); }
.note-title:disabled { color: var(--text-soft); }
.notes-state { font-size: 12px; color: var(--text-muted); white-space: nowrap; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; }
.notes-state[data-state="error"] { color: var(--danger-text); border-color: rgba(239, 68, 68, 0.35); }
.note-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin: 10px 0 14px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.note-class { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-sunken); color: var(--text-muted); }
.note-class .icon { width: 14px; height: 14px; }
.note-class select { background: transparent; border: 0; color: var(--text-main); font-size: 12.5px; padding: 2px 4px; outline: none; max-width: 200px; cursor: pointer; }
.note-class select option { background: var(--surface); }
.note-info { font-size: 12.5px; color: var(--text-muted); }
.note-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.icon-btn {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface-raised); color: var(--text-soft); cursor: pointer; transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text-main); }
.icon-btn.danger:hover { color: var(--danger-text); border-color: rgba(239, 68, 68, 0.4); background: rgba(239, 68, 68, 0.08); }
.icon-btn .icon { width: 15px; height: 15px; }
.icon-btn:disabled, .note-toolbar button:disabled { opacity: 0.45; cursor: not-allowed; }
.note-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; padding: 4px; margin-bottom: 14px; background: var(--surface-sunken); border: 1px solid var(--border); border-radius: 10px; }
.note-toolbar button {
  min-width: 32px; height: 30px; padding: 0 8px; display: grid; place-items: center; border: 0; border-radius: 7px; background: none;
  color: var(--text-soft); font-size: 13px; font-weight: 650; cursor: pointer; transition: background 0.15s ease, color 0.15s ease;
}
.note-toolbar button:hover { background: var(--surface-hover); color: var(--text-main); }
.note-toolbar button[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.note-toolbar .icon { width: 16px; height: 16px; }
.toolbar-sep { width: 1px; height: 18px; background: var(--border-strong); margin: 0 4px; }
.toolbar-tip { margin-left: auto; padding: 0 8px; font-size: 12px; color: var(--text-faint); }
.note-writing { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--accent); margin-bottom: 12px; }
.writing-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 70%, transparent); animation: writing-pulse 1.2s ease-in-out infinite; }
@keyframes writing-pulse { 50% { opacity: 0.3; transform: scale(0.75); } }
.note-editor { position: relative; min-height: 360px; outline: none; font-size: 15px; color: var(--text-main); padding: 2px 2px 24px; caret-color: var(--accent); }
.note-editor.is-empty::before { content: attr(data-placeholder); position: absolute; top: 2px; left: 2px; color: var(--text-faint); pointer-events: none; }
.note-editor[contenteditable="false"] { cursor: default; }
.notes-message:empty { display: none; }
.notes-message { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }

/* Organize + quiz dialogs */
.nf-dialog-wide { width: min(600px, calc(100vw - 32px)); }
.organize-input { resize: vertical; min-height: 180px; line-height: 1.55; font-family: inherit; }
.organize-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.organize-row .nf-dialog-label { flex: 1; max-width: 300px; }
.char-count { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; padding-bottom: 9px; }
.quiz-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.quiz-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.quiz-head h2 { overflow-wrap: anywhere; }
.nf-dialog p.quiz-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.quiz-progress { height: 6px; background: var(--track); border-radius: 4px; overflow: hidden; }
.quiz-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-strong), var(--green)); border-radius: 4px; transition: width 0.3s ease; }
.quiz-card { min-height: 190px; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 22px; border-radius: 14px; background: var(--surface-sunken); border: 1px solid var(--border); }
.quiz-label { font-size: 11px; font-weight: 700; letter-spacing: 0.7px; text-transform: uppercase; color: var(--accent); }
.nf-dialog p.quiz-q { font-size: 18px; font-weight: 650; line-height: 1.4; color: var(--text-main); letter-spacing: -0.2px; }
.quiz-answer { padding-top: 14px; border-top: 1px dashed var(--border-strong); display: flex; flex-direction: column; gap: 6px; }
.quiz-answer .quiz-label { color: var(--green); }
.nf-dialog .quiz-answer p { font-size: 15px; color: var(--text-main); }
.quiz-loading { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; color: var(--text-muted); font-size: 13.5px; }
.quiz-score { font-size: 40px; font-weight: 750; letter-spacing: -0.04em; line-height: 1; text-align: center; }
.quiz-score small { display: block; font-size: 13px; font-weight: 500; color: var(--text-muted); letter-spacing: 0; margin-top: 8px; }
.quiz-review { list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.quiz-review li { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.quiz-review b { display: block; color: var(--text-main); font-weight: 600; margin-bottom: 2px; }
.quiz-review span { color: var(--text-soft); }
.quiz-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.quiz-actions .btn-join, .quiz-actions .btn-primary { min-width: 140px; justify-content: center; }

/* History (student-history.js) */
:is(.stat-card small, .glance-note) .delta { font-weight: 600; }
:is(.stat-card small, .glance-note) .delta.up { color: var(--success-text); }
:is(.stat-card small, .glance-note) .delta.down { color: var(--danger-text); }
.history-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 20px; align-items: stretch; }

/* Summary: one big number, the days you focused, three small numbers */
.progress-summary { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.3fr) minmax(0, 1fr); gap: 28px; align-items: center; padding: 26px 28px; }
.ps-kicker { font-size: 12px; font-weight: 650; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }
.ps-big { display: flex; align-items: baseline; gap: 10px; }
.ps-big b { font-size: clamp(34px, 3.6vw, 46px); font-weight: 750; letter-spacing: -0.04em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.ps-big span { font-size: 15px; color: var(--text-soft); }
.ps-compare { margin-top: 8px; font-size: 13.5px; color: var(--text-soft); }
.ps-compare[data-trend="up"] { color: var(--success-text); }
.ps-compare[data-trend="up"]::before { content: "▲ "; font-size: 11px; }
.ps-compare[data-trend="down"]::before { content: "▼ "; font-size: 11px; color: var(--text-muted); }
.ps-days { padding: 0 24px; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
.ps-dots { display: flex; gap: 8px; }
.ps-dot {
  flex: 1; max-width: 38px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 700;
  color: var(--text-faint); background: var(--surface-sunken); border: 1px solid var(--border);
}
.ps-dot[data-on="true"] { color: #052e16; background: linear-gradient(135deg, #5eead4, var(--green)); border-color: transparent; }
.ps-dot[data-today="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--accent); }
.ps-dots[data-size="small"] { flex-wrap: wrap; gap: 4px; }
.ps-dots[data-size="small"] .ps-dot { flex: 0 0 auto; width: 13px; height: 13px; max-width: none; border-radius: 4px; }
.ps-note { margin-top: 8px; font-size: 12.5px; color: var(--text-muted); }
.ps-stats { display: grid; gap: 12px; margin: 0; }
.ps-stats > div { display: grid; grid-template-columns: 1fr auto; align-items: baseline; column-gap: 12px; }
.ps-stats dt { font-size: 13px; color: var(--text-muted); }
.ps-stats dd { margin: 0; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.ps-stats small { grid-column: 1 / -1; font-size: 11.5px; color: var(--text-muted); text-align: right; margin-top: -2px; }

.history-grid .chart-box { flex: 1; min-height: 240px; }
/* Focus coach on My progress (the same tips as Home) */
.progress-coach { gap: 12px; }
.progress-coach .panel-head { margin-bottom: 4px; }
.pc-win { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--success-text); background: color-mix(in srgb, var(--green) 8%, transparent); border: 1px solid color-mix(in srgb, var(--green) 25%, var(--border)); }
.pc-win .icon { width: 16px; height: 16px; }
.pc-tips { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.pc-tip { display: flex; gap: 12px; align-items: flex-start; padding: 14px; background: var(--surface-sunken); border: 1px solid var(--border); border-radius: 12px; }
.pc-tip .chip-icon { width: 32px; height: 32px; border-radius: 9px; }
.pc-tip .chip-icon svg { width: 16px; height: 16px; }
.pc-body { min-width: 0; }
.pc-body b { display: block; font-size: 14px; font-weight: 650; line-height: 1.4; }
.pc-body p { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin-top: 3px; }
.pc-action { margin-top: 10px; padding: 7px 12px; font-size: 12.5px; }
.pc-foot { margin-top: auto; font-size: 11.5px; color: var(--text-muted); }
@media (max-width: 1100px) {
  .progress-summary { grid-template-columns: 1fr 1fr; }
  .ps-days { border-right: 0; padding-right: 0; }
  .ps-stats { grid-column: 1 / -1; grid-template-columns: repeat(3, 1fr); padding-top: 18px; border-top: 1px solid var(--border); }
  .ps-stats > div { grid-template-columns: 1fr; }
  .ps-stats dd, .ps-stats small { text-align: left; }
}
@media (max-width: 640px) {
  .progress-summary { grid-template-columns: 1fr; gap: 20px; padding: 22px 18px; }
  .ps-days { border-left: 0; padding: 18px 0 0; border-top: 1px solid var(--border); }
}

.session-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 12px; color: var(--text-muted); margin: -6px 0 14px; }
.session-legend span { display: inline-flex; align-items: center; gap: 6px; }
.session-legend i { width: 10px; height: 10px; border-radius: 3px; }
.session-legend .legend-tip { margin-left: auto; }
#focus-history .panel-head { flex-wrap: wrap; }
.panel-head .session-legend { margin: 4px 0 0; justify-content: flex-end; }
.focused { background: var(--green); }
.distracted { background: var(--amber); }
.away { background: repeating-linear-gradient(135deg, var(--track) 0 3px, transparent 3px 6px); box-shadow: inset 0 0 0 1px var(--border-strong); }
.on-break { background: color-mix(in srgb, var(--green) 25%, transparent); }
.no-data { background: transparent; outline: 1px dashed var(--border-strong); outline-offset: -1px; }
.older-note { color: var(--text-muted); }
.history-days { display: flex; flex-direction: column; gap: 18px; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 0 4px 8px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.day-head b { font-size: 13.5px; font-weight: 650; }
.day-head span { font-size: 12.5px; color: var(--text-muted); }
.session-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.session-item { border: 1px solid transparent; border-radius: 12px; transition: background 0.15s ease, border-color 0.15s ease; }
.session-item:hover, .session-item[data-open="true"] { background: var(--surface-2); border-color: var(--border); }
.session-row {
  width: 100%; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto 18px; align-items: center; gap: 14px;
  padding: 10px 12px; background: none; border: 0; border-radius: 12px; text-align: left; cursor: pointer;
}
.focus-ring { position: relative; width: 44px; height: 44px; }
.focus-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.focus-ring circle { fill: none; stroke-width: 4; }
.focus-ring .track { stroke: var(--track); }
.focus-ring .fill { stroke-linecap: round; }
.focus-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; }
.session-main { min-width: 0; }
.session-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; font-weight: 600; }
.class-tag { font-size: 11.5px; font-weight: 600; color: var(--text-soft); background: var(--surface-raised); border: 1px solid var(--border-strong); border-radius: 999px; padding: 1px 8px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-main > span { display: block; }
.session-main > .session-title { display: flex; }
.session-meta { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.class-tag.unfinished-tag { color: var(--warning-text); border-color: color-mix(in srgb, var(--amber) 40%, var(--border-strong)); background: color-mix(in srgb, var(--amber) 8%, transparent); }
.unfinished-note { flex-basis: 100%; color: var(--warning-text); }
.history-days .empty-state a { color: var(--accent); }
.verdict { font-size: 11.5px; font-weight: 650; border-radius: 999px; padding: 3px 10px; border: 1px solid; white-space: nowrap; }
.verdict[data-level="great"] { color: var(--success-text); border-color: rgba(34, 197, 94, 0.3); background: rgba(34, 197, 94, 0.08); }
.verdict[data-level="good"] { color: var(--info-text); border-color: color-mix(in srgb, var(--info) 30%, transparent); background: color-mix(in srgb, var(--info) 7%, transparent); }
.verdict[data-level="mixed"] { color: var(--warning-text); border-color: rgba(245, 183, 72, 0.3); background: rgba(245, 183, 72, 0.08); }
.verdict[data-level="tough"] { color: var(--danger-text); border-color: rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.08); }
.chevron { width: 16px; height: 16px; color: var(--text-muted); transition: transform 0.2s ease; }
.session-item[data-open="true"] .chevron { transform: rotate(90deg); }
.session-detail { padding: 4px 14px 16px 70px; display: flex; flex-direction: column; gap: 10px; }
/* Opened session: three numbers, then a three-colour timeline with its key right underneath */
.session-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 4px; }
.session-tile { padding: 10px 12px; border-radius: 10px; background: var(--surface-sunken); border: 1px solid var(--border); }
.session-tile b { display: block; font-size: 16px; font-weight: 700; letter-spacing: -0.2px; font-variant-numeric: tabular-nums; }
.session-tile small { font-size: 11.5px; color: var(--text-muted); }
.focus-strip .paused { background: var(--track); }
.strip-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--text-muted); }
.strip-legend span { display: inline-flex; align-items: center; gap: 6px; }
.strip-legend i { width: 10px; height: 10px; border-radius: 3px; }
.strip-legend i.paused { background: var(--track); border: 1px solid var(--border-strong); }
.session-title b { font-size: 14px; font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-time { font-size: 12.5px; font-weight: 500; color: var(--text-muted); }
.session-facts { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 12.5px; color: var(--text-soft); }
.session-facts b { color: var(--text-main); font-weight: 600; }
.focus-strip { display: flex; height: 14px; gap: 2px; border-radius: 4px; overflow: hidden; }
.focus-strip span { min-width: 2px; border-radius: 2px; }
.strip-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.strip-note { font-size: 12.5px; color: var(--text-muted); }
.history-more { align-self: center; margin-top: 16px; }

/* Classes (student-classes.js) */
.my-class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.my-class-card {
  background: var(--surface-sunken); border: 1px solid var(--border); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 10px;
  transition: border-color 0.15s ease;
}
.my-class-card:hover { border-color: var(--border-hover); }
.my-class-card[aria-current="true"] { border-color: color-mix(in srgb, var(--accent) 45%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent), 0 10px 30px color-mix(in srgb, var(--accent) 6%, transparent); }
.my-class-card h3 { font-size: 16px; font-weight: 650; overflow-wrap: anywhere; }
.my-class-teacher { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-soft); margin-top: -2px; }
.my-class-teacher .nf-avatar { --size: 24px; }
/* Home class cards: the class's teacher under the class name */
.class-teacher { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--surface-sunken); border: 1px solid var(--border); }
.class-teacher-name { min-width: 0; line-height: 1.25; }
.class-teacher-name b { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.class-teacher-name small { font-size: 11.5px; color: var(--text-muted); }
.my-class-card .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: var(--accent); }
.my-class-status { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-muted); }
.my-class-status[data-live="true"] { color: var(--danger-text); }
.my-class-attendance { font-size: 12px; color: var(--text-muted); }
.my-class-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.my-class-actions .btn-action, .my-class-actions .btn-join { padding: 7px 11px; font-size: 12.5px; }
.btn-leave { background: transparent; color: var(--danger-text); border: 1px solid rgba(239, 68, 68, 0.3); border-radius: 8px; padding: 7px 11px; font-size: 12.5px; cursor: pointer; margin-left: auto; }
.btn-leave:hover { background: rgba(239, 68, 68, 0.1); }

/* Nudge / timer toast (student-focus.js) */
.focus-toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 50; width: min(380px, calc(100vw - 32px));
  background: var(--toast-bg); backdrop-filter: blur(12px); border: 1px solid var(--border-strong); border-left: 3px solid var(--accent);
  border-radius: 14px; padding: 16px; display: flex; gap: 12px; box-shadow: 0 18px 44px var(--shadow-color); animation: toast-in 0.25s ease;
}
.focus-toast[data-kind="nudge"] { border-left-color: var(--amber); }
.focus-toast[data-kind="praise"] { border-left-color: var(--green); }
.toast-icon { font-size: 22px; line-height: 1.2; }
.toast-body strong { display: block; font-size: 14px; margin-bottom: 4px; }
.toast-body p { font-size: 13px; color: var(--text-soft); line-height: 1.5; }
.toast-actions { display: flex; gap: 8px; margin-top: 12px; }
.toast-actions:empty { display: none; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  main { scroll-behavior: auto; }
  .view, .focus-toast { animation: none; }
  #timerRing, .progress span, .switch input::after, .quiz-progress span, .glance-meter span { transition: none; }
  .tracker-card[data-tracking="true"] .status-dot { animation: none; }
  .writing-dot { animation: none; }
}

@media (max-width: 1280px) {
  .focus-stage { grid-template-columns: minmax(0, 1fr) 320px; }
}
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .focus-stage, .buddy-grid, .history-grid, .notes-layout { grid-template-columns: 1fr; }
  .focus-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
  .notes-sidebar { position: static; }
  .note-list { max-height: 260px; }
}
@media (max-width: 760px) {
  .focus-side, .setting-tiles { grid-template-columns: 1fr; }
  .toolbar-tip { display: none; }
  .note-title { font-size: 20px; }
  .note-actions { margin-left: 0; width: 100%; }
  .note-actions .btn-action { flex: 1; }
  .note-editor { min-height: 260px; }
  .portal-main { padding: 20px 16px 32px; }
  .welcome-title, .page-title { font-size: 24px; }
}
@media (max-width: 520px) {
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; grid-template-columns: 1fr; }
  .stat-card strong { font-size: 24px; }
  .stat-card .chip-icon { display: none; }
  .timer-actions { grid-template-columns: 1fr 1fr; }
  .timer-actions .btn-primary { grid-column: 1 / -1; }
  .video-viewport { aspect-ratio: 4 / 3; }
  .page-actions { width: 100%; }
  .page-actions > * { flex: 1; }
  .chat-bubble { max-width: 92%; }
  .session-row { grid-template-columns: 40px minmax(0, 1fr) 16px; gap: 12px; padding: 10px 8px; }
  .session-row .verdict { display: none; }
  .focus-ring { width: 40px; height: 40px; }
  .session-detail { padding: 2px 10px 12px; }
  .session-legend .legend-tip { display: none; }
}

/* =====================================================================
   Header: focus status + account menu
   ===================================================================== */
.focus-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 10px; border-radius: 999px; text-decoration: none; white-space: nowrap;
  font-size: 12.5px; font-weight: 600; color: var(--text-soft); background: var(--surface-raised); border: 1px solid var(--border-strong);
  font-variant-numeric: tabular-nums; transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.focus-pill:hover { color: var(--text-main); border-color: var(--border-hover); }
.focus-pill .icon { width: 15px; height: 15px; color: var(--accent); }
.focus-pill-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); flex: none; }
.focus-pill[data-state="timer"] { color: var(--text-main); border-color: color-mix(in srgb, var(--accent) 40%, var(--border-strong)); }
.focus-pill[data-state="timer"] .focus-pill-dot { background: var(--accent); }
.focus-pill[data-state="break"] .focus-pill-dot { background: var(--green); }
.focus-pill[data-state="tracking"] { color: var(--success-text); border-color: color-mix(in srgb, var(--green) 40%, var(--border-strong)); }
.focus-pill[data-state="tracking"] .focus-pill-dot { background: var(--green); box-shadow: 0 0 6px color-mix(in srgb, var(--green) 70%, transparent); }

/* Today's plan */
.plan-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.plan-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; min-width: 0;
  background: var(--surface-sunken); border: 1px solid var(--border);
}
.plan-item[data-kind="live"] { border-color: color-mix(in srgb, var(--red) 35%, var(--border)); background: color-mix(in srgb, var(--red) 6%, var(--surface-sunken)); }
.plan-item[data-kind="in-session"] { border-color: color-mix(in srgb, var(--green) 35%, var(--border)); }
.plan-when { flex: none; min-width: 58px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.plan-item[data-kind="live"] .plan-when { color: var(--danger-text); }
.plan-item[data-kind="in-session"] .plan-when { color: var(--success-text); }
.plan-body { flex: 1; min-width: 0; }
.plan-body b { display: block; font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.plan-body small { display: block; font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.plan-item .btn-join, .plan-item .btn-action { padding: 7px 12px; font-size: 12.5px; flex: none; }
.plan-step label { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; cursor: pointer; font-size: 13.5px; }
.plan-step input[type="checkbox"] { accent-color: var(--green); width: 17px; height: 17px; flex: none; cursor: pointer; }
.plan-step span { overflow-wrap: anywhere; }
.plan-step[data-done="true"] span { text-decoration: line-through; color: var(--text-muted); }
.plan-heading { font-size: 11.5px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--text-muted); margin: 8px 2px 0; display: flex; justify-content: space-between; gap: 8px; }
.plan-heading:first-child { margin-top: 0; }
.plan-heading a { text-transform: none; letter-spacing: 0; font-weight: 600; }
.plan-shortcuts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; list-style: none; }
.plan-shortcut {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 12px; cursor: pointer; text-align: left;
  background: var(--surface-sunken); border: 1px solid var(--border); color: var(--text-main); font-size: 13px; text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.plan-shortcut:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); transform: translateY(-1px); }
.plan-shortcut .chip-icon { width: 30px; height: 30px; border-radius: 9px; }
.plan-shortcut .chip-icon svg { width: 15px; height: 15px; }
.plan-shortcut small { display: block; color: var(--text-muted); font-size: 11.5px; }
.plan-note { font-size: 12px; color: var(--text-muted); margin-top: 12px; line-height: 1.5; }
.plan-add { margin-top: 12px; }
.plan-add .btn-action { padding: 9px 14px; }

/* Your classes */
.home-class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.home-class-card {
  position: relative; display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 16px; min-width: 0; overflow: hidden;
  background: linear-gradient(180deg, var(--surface-raised), var(--surface-sunken)); border: 1px solid var(--border);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.home-class-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--class-color, var(--accent)), transparent);
}
.home-class-card:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: 0 12px 28px color-mix(in srgb, var(--shadow-color) 55%, transparent); }
.home-class-card:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.home-class-card[data-live="true"] { border-color: color-mix(in srgb, var(--red) 40%, var(--border)); }
.home-class-card[aria-current="true"] { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
.class-card-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.class-tile {
  width: 42px; height: 42px; border-radius: 12px; flex: none; display: grid; place-items: center; font-size: 16px; font-weight: 750; color: #fff;
  background: linear-gradient(135deg, color-mix(in srgb, var(--class-color, var(--accent)) 72%, #000), color-mix(in srgb, var(--class-color, var(--accent)) 42%, #000));
}
.class-card-name { min-width: 0; }
.class-card-name h3 { font-size: 15px; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.class-card-name small { display: block; font-size: 12.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.class-chip {
  display: inline-flex; align-items: center; gap: 7px; width: fit-content; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  color: var(--text-muted); background: var(--surface-sunken); border: 1px solid var(--border);
}
.class-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); }
.class-chip[data-state="live"] { color: var(--danger-text); border-color: color-mix(in srgb, var(--red) 35%, var(--border)); background: color-mix(in srgb, var(--red) 8%, transparent); }
.class-chip[data-state="live"]::before { background: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 22%, transparent); }
.class-chip[data-state="in-session"] { color: var(--success-text); border-color: color-mix(in srgb, var(--green) 35%, var(--border)); }
.class-chip[data-state="in-session"]::before, .class-chip[data-state="online"]::before { background: var(--green); }
.class-chip[data-state="removed"] { color: var(--warning-text); }
.class-chip[data-state="removed"]::before { background: var(--amber); }
.class-card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.class-card-actions .btn-action, .class-card-actions .btn-join { padding: 7px 11px; font-size: 12.5px; }
.current-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--accent); padding: 7px 4px; }

/* NeuroBuddy entry */
.buddy-entry { background: radial-gradient(ellipse 80% 70% at 100% 0%, var(--glow-soft), transparent 70%), linear-gradient(180deg, var(--surface), var(--surface-2)); }
.buddy-entry-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.buddy-face {
  width: 44px; height: 44px; border-radius: 14px; flex: none; display: grid; place-items: center; color: var(--accent);
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 18%, var(--surface)), var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
}
.buddy-face svg { width: 21px; height: 21px; }
.buddy-entry-title { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; line-height: 1.3; }
.buddy-entry .tutor-form-row { margin-bottom: 12px; }
.buddy-entry .prompt-chips { margin-bottom: 0; }

/* Focus tools */
.tool-rows { display: flex; flex-direction: column; gap: 6px; }
.tool-row {
  display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; text-decoration: none; color: inherit;
  border: 1px solid var(--border); background: var(--surface-sunken); transition: border-color 0.15s ease;
}
.tool-row:hover { border-color: var(--border-hover); }
.tool-row > span:nth-child(2) { flex: 1; min-width: 0; }
.tool-row b { display: block; font-size: 13.5px; font-weight: 600; }
.tool-row small { display: block; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tool-row small[data-state="on"] { color: var(--success-text); }
.tool-row .chip-icon { width: 32px; height: 32px; }

/* Focus session */
.tracker-progress-link { margin-top: 10px; font-size: 12.5px; color: var(--text-muted); }

/* ---------- Motion and small screens ---------- */
/* Lists settle in one after another when NeuroBuddy, Class notes or My progress opens, and the
   session list again when My progress switches range (student-history.js adds .is-refreshing).
   Only on those moments, never while typing or as numbers update. */
.view.is-entering :is(.note-list > li, .history-day, .insight, .tips-card li, .style-options button),
.progress-view.is-refreshing :is(.history-day, .insight) {
  animation: list-in 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: calc(var(--i, 0) * 45ms + 160ms);
}
:is(.note-list, .history-days, .insight-list, .tips-card ul, .style-options) > :nth-child(2) { --i: 1; }
:is(.note-list, .history-days, .insight-list, .tips-card ul, .style-options) > :nth-child(3) { --i: 2; }
:is(.note-list, .history-days, .insight-list, .tips-card ul, .style-options) > :nth-child(4) { --i: 3; }
:is(.note-list, .history-days, .insight-list, .tips-card ul, .style-options) > :nth-child(5) { --i: 4; }
:is(.note-list, .history-days, .insight-list, .tips-card ul, .style-options) > :nth-child(6) { --i: 5; }
:is(.note-list, .history-days, .insight-list, .tips-card ul, .style-options) > :nth-child(n+7) { --i: 6; }
.progress-view.is-refreshing .glance-value { animation: value-in 0.4s ease both; }
@keyframes value-in { from { opacity: 0.2; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.session-item { transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease; }
.session-item:hover { transform: translateX(2px); }

@media (prefers-reduced-motion: reduce) {
  .home-class-card, .home-class-card:hover, .plan-shortcut:hover { transition: none; transform: none; }
  .view.is-entering :is(.note-list > li, .history-day, .insight, .tips-card li, .style-options button),
  .progress-view.is-refreshing :is(.history-day, .insight, .glance-value), .chat-bubble { animation: none; }
  .chat-box .chat-bubble.is-pending::after { animation: none; clip-path: none; }
  .chip:hover, .session-item:hover, .send-button:hover .icon { transform: none; }
}
@media (max-width: 1100px) {
  .buddy-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
@media (max-width: 760px) {
  .buddy-side { grid-template-columns: 1fr; }
  .chat-box { height: max(300px, calc(100vh - 440px)); padding: 14px; }
  .chat-bubble { max-width: 88%; }
  .chat-box .assistant-bubble { max-width: calc(88% + 38px); }
  .composer .prompt-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -2px 10px; padding: 2px; }
  .composer .chip { flex: none; }
  .send-button span { display: none; }
  .panel-head .session-legend { justify-content: flex-start; }
}

@media (max-width: 1100px) {
  .home-grid { grid-template-columns: 1fr; }
}
/* Very small phones: the focus pill keeps its dot and icon (its full status is in its label for
   screen readers), and Export keeps just its icon, so the header never overlaps. */
@media (max-width: 420px) {
  #focusPillText { display: none; }
  .focus-pill { padding: 6px 9px; }
  .header-actions { gap: 4px; }
}
@media (max-width: 360px) {
  .header-actions .label-short { display: none; }
}

/* =====================================================================
   Solo focus and the class page (student-classes.js)
   Solo focus is personal; a class's Live focus is the only place anything is shared.
   ===================================================================== */
.personal-card[data-state="personal"] { border-color: color-mix(in srgb, var(--green) 30%, var(--border-strong)); }
.personal-card[data-state="personal"] .next-icon { color: var(--success-text); background: color-mix(in srgb, var(--green) 10%, transparent); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.solo-class-notice { margin-top: 12px; padding: 9px 11px; border-radius: 10px; font-size: 13px; color: var(--warning-text); background: color-mix(in srgb, var(--amber) 8%, transparent); border: 1px solid color-mix(in srgb, var(--amber) 30%, var(--border)); }
/* The tracker card's slots: Solo focus, or a class's Live focus */
.tracker-slot { display: flex; flex-direction: column; min-width: 0; }
.tracker-slot > .tracker-card { flex: 1; }
.tracker-slot-note { flex: 1; align-items: center; justify-content: center; text-align: center; gap: 8px; min-height: 260px; color: var(--text-muted); font-size: 13.5px; line-height: 1.5; }
.tracker-slot-note b { color: var(--text-main); font-size: 15.5px; }
.tracker-slot-note .placeholder-rings { margin-bottom: 6px; }
.tracker-slot-note .chip-icon { width: 54px; height: 54px; border-radius: 50%; }
.tracker-slot-note .chip-icon svg { width: 24px; height: 24px; }
.tracker-slot-note .btn-action { margin-top: 6px; }
.tracker-slot:has(> .tracker-card) > .tracker-slot-note { display: none; }
/* The live numbers and the timeline move with the tracker card; an empty slot takes no space */
.stats-slot:empty { display: none; }

/* Class page */
.class-page-tile { color: #fff; font-size: 26px; font-weight: 750; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 72%, #000), color-mix(in srgb, var(--accent) 40%, #000)); }
.class-hub-tabs { display: flex; gap: 4px; padding: 4px; width: fit-content; max-width: 100%; overflow-x: auto; background: var(--surface-sunken); border: 1px solid var(--border); border-radius: 12px; }
.class-hub-tabs [role="tab"] {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 0; border-radius: 9px; background: transparent; white-space: nowrap;
  font-size: 13.5px; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: background 0.15s ease, color 0.15s ease;
}
.class-hub-tabs [role="tab"]:hover { color: var(--text-main); }
.class-hub-tabs [role="tab"][aria-selected="true"] { background: var(--surface-hover); color: var(--text-main); box-shadow: inset 0 0 0 1px var(--border-strong); }
.class-hub-tabs [role="tab"] .icon { width: 16px; height: 16px; }
.class-hub-panel { display: flex; flex-direction: column; gap: 20px; }
.class-live-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 20px; align-items: stretch; }
.sharing-card { gap: 12px; }
.sharing-card .panel-title { margin-bottom: 2px; }
.class-tag.personal-tag { color: var(--success-text); border-color: color-mix(in srgb, var(--green) 35%, var(--border-strong)); background: color-mix(in srgb, var(--green) 8%, transparent); }
@media (max-width: 1100px) {
  .class-live-grid { grid-template-columns: 1fr; }
}

/* =====================================================================
   Simpler navigation: meeting links, live dot on a tab
   ===================================================================== */
.meeting-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 12px; font-size: 13px; color: var(--text-muted); }
.meeting-links .text-link { border: 0; background: none; padding: 0; cursor: pointer; font: inherit; font-weight: 600; }
.buddy-privacy { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12.5px; color: var(--text-muted); }
.buddy-privacy .icon { width: 14px; height: 14px; }
.tab-live { display: inline-flex; margin-left: 6px; }
.class-hub-tabs { position: relative; } /* keeps the hidden ", live now" text inside the scrolling strip */

/* =====================================================================
   NeuroBuddy as a chat app (learning-assistant.js): chats on the left, the open chat on the right
   ===================================================================== */
.buddy-app { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; height: calc(100dvh - 60px - 56px); min-height: 520px; }
.buddy-chats { display: flex; flex-direction: column; gap: 10px; padding: 14px; min-height: 0; }
.buddy-chats-head { display: flex; align-items: center; gap: 10px; }
.buddy-chats-head .buddy-face { width: 34px; height: 34px; border-radius: 11px; }
.buddy-brand { flex: 1; font-size: 17px; font-weight: 700; letter-spacing: -0.3px; }
.buddy-chats-close, .buddy-chats-open { display: none; }
.buddy-new { justify-content: center; width: 100%; }
.buddy-search { position: relative; }
.buddy-search .icon { position: absolute; left: 11px; top: 50%; width: 15px; height: 15px; margin-top: -7.5px; color: var(--text-muted); pointer-events: none; }
.buddy-search .field-input { padding: 8px 10px 8px 32px; font-size: 13px; }
.buddy-chat-nav { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.buddy-chat-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.buddy-list-group { padding: 12px 8px 4px; font-size: 11px; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.buddy-list-group:first-child { padding-top: 4px; }
.buddy-list-empty { padding: 14px 8px; font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.buddy-chat-item { position: relative; display: flex; align-items: center; border-radius: 10px; }
.buddy-chat-item:hover, .buddy-chat-item:focus-within { background: var(--surface-hover); }
.buddy-chat-open { flex: 1; min-width: 0; display: flex; padding: 9px 10px; border: 0; border-radius: 10px; background: none; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.buddy-chat-open[aria-current] { background: color-mix(in srgb, var(--accent) 10%, var(--surface-hover)); box-shadow: inset 2px 0 0 var(--accent); }
.buddy-chat-open:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.buddy-chat-text { min-width: 0; display: flex; flex-direction: column; }
.buddy-chat-text b { font-size: 13px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.buddy-chat-text small { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.buddy-chat-tools { display: flex; gap: 2px; padding-right: 4px; opacity: 0; transition: opacity 0.15s ease; }
.buddy-chat-item:hover .buddy-chat-tools, .buddy-chat-item:focus-within .buddy-chat-tools { opacity: 1; }
@media (hover: none) { .buddy-chat-tools { opacity: 1; } }
.buddy-chat-tools .icon-btn, .buddy-shelf .icon-btn, .buddy-pending .icon-btn, .bubble-tool {
  width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; border: 0; background: none; color: var(--text-muted); cursor: pointer;
}
.buddy-chat-tools .icon-btn:hover, .buddy-shelf .icon-btn:hover, .buddy-pending .icon-btn:hover, .bubble-tool:hover { background: var(--surface-raised); color: var(--text-main); }
.buddy-chat-tools .icon-btn.danger:hover { color: var(--danger-text); }
.buddy-chat-tools .icon, .buddy-shelf .icon-btn .icon, .buddy-pending .icon-btn .icon, .bubble-tool .icon { width: 14px; height: 14px; }
.buddy-rename { flex: 1; padding: 3px; }
.buddy-rename .field-input { padding: 7px 9px; font-size: 13px; }
.buddy-store-note { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-muted); }
.buddy-store-note .icon { width: 13px; height: 13px; }

.buddy-main { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; min-height: 0; min-width: 0; }
.buddy-main.is-dropping { outline: 2px dashed color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: -6px; }
.buddy-main-head { display: flex; align-items: center; gap: 10px; }
.buddy-main-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.buddy-main-title h2 { font-size: 16px; font-weight: 650; letter-spacing: -0.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.buddy-class-pick { display: inline-flex; align-items: center; gap: 6px; padding: 0 4px 0 9px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface-sunken); color: var(--text-soft); }
.buddy-class-pick .icon { width: 14px; height: 14px; color: var(--accent); }
.buddy-class-pick .field-select { border: 0; background-color: transparent; padding: 5px 26px 5px 2px; font-size: 12.5px; min-height: 0; width: auto; max-width: 220px; }
.buddy-shelf { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; flex: none; }
.buddy-shelf > * { flex: none; }
.buddy-shelf-label { font-size: 11.5px; font-weight: 600; color: var(--text-muted); margin-right: 2px; }
.buddy-file-chip, .buddy-deck-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 3px 4px 3px 9px; border-radius: 999px; font-size: 12.5px; border: 1px solid var(--border-strong); background: var(--surface-sunken); color: var(--text-soft); }
.buddy-file-chip > span, .buddy-deck-open > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.buddy-file-chip > .icon, .buddy-deck-open .icon { width: 14px; height: 14px; color: var(--accent); flex: none; }
.buddy-file-chip small { font-size: 11px; color: var(--text-muted); }
.buddy-file-chip[data-state="reading"] { border-style: dashed; }
.buddy-deck-chip { border-color: color-mix(in srgb, var(--green) 35%, var(--border-strong)); background: color-mix(in srgb, var(--green) 6%, var(--surface-sunken)); }
.buddy-deck-open { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--text-main); font: inherit; font-weight: 550; cursor: pointer; padding: 0; }
.buddy-deck-open .icon { color: var(--success-text); }

.buddy-thread.chat-box { flex: 1; height: auto; min-height: 0; }
.buddy-empty { margin: auto; max-width: 520px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 20px 8px; }
.buddy-empty .buddy-face { width: 52px; height: 52px; border-radius: 16px; }
.buddy-empty .buddy-face svg { width: 26px; height: 26px; }
.buddy-empty h3 { font-size: 20px; font-weight: 700; letter-spacing: -0.4px; }
.buddy-empty p { font-size: 13.5px; color: var(--text-muted); line-height: 1.5; }
.buddy-starters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px; }
.chat-bubble.student-bubble p { margin: 0; white-space: pre-wrap; }
.bubble-files { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.bubble-file { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; background: color-mix(in srgb, #000 18%, transparent); }
.bubble-file .icon { width: 12px; height: 12px; }
.assistant-bubble .bubble-tools { display: flex; justify-content: flex-end; margin: 4px -6px -6px 0; opacity: 0; transition: opacity 0.15s ease; }
.assistant-bubble:hover .bubble-tools, .assistant-bubble:focus-within .bubble-tools { opacity: 1; }
@media (hover: none) { .assistant-bubble .bubble-tools { opacity: 1; } }
.buddy-note { align-self: center; max-width: 90%; padding: 8px 12px; border-radius: 10px; font-size: 12.5px; color: var(--warning-text); background: color-mix(in srgb, var(--amber) 8%, transparent); border: 1px solid color-mix(in srgb, var(--amber) 30%, var(--border)); }

.buddy-composer { display: flex; flex-direction: column; gap: 8px; padding: 10px 10px 8px 14px; border-radius: 18px; border: 1px solid var(--border-strong); background: var(--surface-sunken); transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.buddy-composer:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, var(--border-strong)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent); }
.buddy-pending { display: flex; flex-wrap: wrap; gap: 6px; }
.buddy-composer textarea { width: 100%; min-height: 24px; max-height: 200px; resize: none; border: 0; outline: none; background: none; color: var(--text-main); font: inherit; font-size: 14px; line-height: 1.5; padding: 4px 0; }
.buddy-composer textarea::placeholder { color: var(--text-muted); }
.buddy-composer-bar { display: flex; align-items: center; gap: 6px; }
.buddy-composer-bar > .icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface-raised); color: var(--text-soft); cursor: pointer; }
.buddy-composer-bar > .icon-btn:hover { color: var(--text-main); border-color: var(--border-hover); }
.buddy-hint { flex: 1; text-align: right; font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.buddy-send { width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: 12px; flex: none; }
.buddy-send.is-stop { background: var(--surface-raised); color: var(--text-main); border: 1px solid var(--border-strong); }
.buddy-style { position: relative; }
.buddy-style-button { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface-raised); color: var(--text-soft); font: inherit; font-size: 12.5px; font-weight: 550; cursor: pointer; white-space: nowrap; }
.buddy-style-button:hover, .buddy-style-button[aria-expanded="true"] { color: var(--text-main); border-color: var(--border-hover); }
.buddy-style-button .icon { width: 14px; height: 14px; color: var(--accent); }
.buddy-style-button .chevron { color: var(--text-muted); width: 13px; height: 13px; }
.buddy-style-menu {
  position: absolute; bottom: calc(100% + 8px); left: 0; z-index: 30; width: 250px; list-style: none; padding: 6px; border-radius: 14px;
  background: var(--surface-raised); border: 1px solid var(--border-strong); box-shadow: 0 16px 40px var(--shadow-color); outline: none;
}
.buddy-style-menu [role="option"] { position: relative; display: flex; flex-direction: column; gap: 1px; padding: 8px 10px 8px 32px; border-radius: 9px; cursor: pointer; }
.buddy-style-menu [role="option"] b { font-size: 13px; font-weight: 600; }
.buddy-style-menu [role="option"] small { font-size: 11.5px; color: var(--text-muted); }
.buddy-style-menu [role="option"].is-active { background: var(--surface-hover); }
.buddy-style-menu [role="option"][aria-selected="true"]::before { content: "✓"; position: absolute; left: 11px; top: 9px; color: var(--accent); font-weight: 700; font-size: 13px; }
.buddy-style-menu:focus-visible [role="option"].is-active { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 50%, transparent); }
.buddy-main .buddy-privacy { margin-top: 0; flex-wrap: wrap; }

/* Flashcards (buddy-flashcards.js) */
.flash-dialog { width: min(620px, calc(100vw - 32px)); }
.flash-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.flash-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.flash-head h2 { overflow-wrap: anywhere; }
.nf-dialog p.flash-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.flash-maker { display: flex; flex-direction: column; gap: 14px; padding: 0 !important; }
.flash-sources { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; border: 0; }
.flash-sources legend, .flash-count legend { margin-bottom: 8px; }
.flash-source { display: flex; align-items: flex-start; gap: 9px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-sunken); cursor: pointer; }
.flash-source:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); background: color-mix(in srgb, var(--accent) 7%, var(--surface-sunken)); }
.flash-source input { margin-top: 3px; accent-color: var(--accent); }
.flash-source span { min-width: 0; display: flex; flex-direction: column; }
.flash-source b { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.flash-source small { font-size: 11.5px; color: var(--text-muted); }
.flash-topic { display: flex; flex-direction: column; gap: 6px; }
.flash-count { border: 0; }
.flash-count .range-switch button[aria-checked="true"] { background: var(--surface-hover); color: var(--text-main); box-shadow: inset 0 0 0 1px var(--border-strong); }
.flash-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.flash-loading { display: flex; align-items: center; gap: 10px; padding: 26px 4px; font-size: 13.5px; color: var(--text-soft); }
.flash-practice { display: flex; flex-direction: column; gap: 12px; }
.flash-card { position: relative; width: 100%; min-height: 220px; padding: 0; border: 0; background: none; cursor: pointer; perspective: 1200px; font: inherit; color: inherit; }
.flash-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 18px; }
.flash-card-inner { position: absolute; inset: 0; display: block; transform-style: preserve-3d; transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1); }
.flash-card[data-flipped="true"] .flash-card-inner { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; text-align: center;
  border-radius: 18px; border: 1px solid var(--border-strong); background: linear-gradient(160deg, var(--surface-raised), var(--surface-sunken)); backface-visibility: hidden;
}
.flash-face small { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.flash-face b { font-size: 18px; font-weight: 650; line-height: 1.45; overflow-wrap: anywhere; }
.flash-back { transform: rotateY(180deg); border-color: color-mix(in srgb, var(--green) 40%, var(--border-strong)); }
.flash-back small { color: var(--success-text); }
.flash-back b { font-weight: 550; font-size: 16.5px; }
.flash-controls { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.flash-tools { display: flex; justify-content: center; }
.flash-tools .text-link { border: 0; background: none; cursor: pointer; font: inherit; font-size: 13px; }
.flash-done { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px 0 6px; text-align: center; }
.flash-score { font-size: 34px; font-weight: 800; color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .flash-card-inner { transition: none; } .buddy-chat-tools, .assistant-bubble .bubble-tools { transition: none; } }

/* Narrow screens: the chat list slides in as a drawer */
@media (max-width: 900px) {
  .buddy-app { grid-template-columns: 1fr; height: calc(100dvh - 60px - 40px); }
  .buddy-chats { position: fixed; z-index: 60; top: 60px; bottom: 0; left: 0; width: min(320px, 86vw); border-radius: 0 16px 16px 0; transform: translateX(-105%); transition: transform 0.25s ease; box-shadow: 0 20px 60px var(--shadow-color); visibility: hidden; }
  .buddy-chats.is-open { transform: none; visibility: visible; }
  .buddy-chats-close, .buddy-chats-open { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface-raised); color: var(--text-soft); cursor: pointer; flex: none; }
  .buddy-hint { display: none; }
  .buddy-composer-bar .buddy-send { margin-left: auto; }
}
@media (max-width: 520px) {
  .buddy-main { padding: 10px; }
  .buddy-main-head #buddyFlashcards span { display: none; }
  .buddy-class-pick .field-select { max-width: 150px; }
  .flash-face b { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { .buddy-chats { transition: none; } }

/* =====================================================================
   NeuroBuddy's mascot and welcome screen (buddy-mascot.js, learning-assistant.js)
   ===================================================================== */
.buddy-face svg { color: var(--accent); }
.buddy-home { margin: auto; width: 100%; max-width: 760px; display: flex; flex-direction: column; gap: 22px; padding: 12px 4px; }
.buddy-hero { position: relative; display: flex; align-items: center; gap: 22px; }
.buddy-hero::before {
  content: ""; position: absolute; z-index: 0; left: -10px; top: 50%; width: 220px; height: 220px; margin-top: -110px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent), transparent 68%); filter: blur(6px); animation: buddy-aura 5s ease-in-out infinite;
}
@keyframes buddy-aura { 50% { transform: scale(1.12); opacity: 0.75; } }
.buddy-mascot { position: relative; z-index: 1; flex: none; width: 168px; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 24px; }
.buddy-mascot:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.buddy-hello { position: relative; z-index: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; animation: buddy-rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.buddy-kicker { font-size: 12px; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); }
.buddy-greeting { font-size: clamp(24px, 3.4vw, 34px); font-weight: 800; letter-spacing: -0.8px; line-height: 1.1; }
.buddy-name { background: linear-gradient(100deg, var(--accent), color-mix(in srgb, var(--accent) 40%, var(--green)), var(--accent)); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: buddy-shimmer 6s linear infinite; }
@keyframes buddy-shimmer { to { background-position: -200% 0; } }
.buddy-cando { font-size: 15px; color: var(--text-soft); min-height: 1.5em; }
.buddy-cando-text { display: inline-block; color: var(--text-main); font-weight: 600; transition: opacity 0.28s ease, transform 0.28s ease; }
.buddy-cando-text.is-leaving { opacity: 0; transform: translateY(-6px); }
.buddy-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.buddy-action {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 14px; text-align: left; cursor: pointer; font: inherit; color: inherit;
  background: color-mix(in srgb, var(--surface-raised) 85%, transparent); border: 1px solid var(--border);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  animation: buddy-rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: calc(120ms + var(--i, 0) * 70ms);
}
.buddy-action:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: 0 12px 28px color-mix(in srgb, var(--accent) 12%, transparent); }
.buddy-action:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.buddy-action-icon { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 11px; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); transition: transform 0.25s ease; }
.buddy-action:hover .buddy-action-icon { transform: rotate(-8deg) scale(1.08); }
.buddy-action-icon .icon { width: 18px; height: 18px; }
.buddy-action-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.buddy-action-text b { font-size: 13.5px; font-weight: 650; }
.buddy-action-text small { font-size: 12px; color: var(--text-muted); line-height: 1.35; }
.buddy-recent { display: flex; flex-direction: column; gap: 8px; }
.buddy-recent-label { font-size: 11.5px; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.buddy-recent-row { display: flex; flex-wrap: wrap; gap: 8px; }
.buddy-recent-card {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 8px 12px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13px; color: var(--text-soft);
  background: var(--surface-sunken); border: 1px solid var(--border-strong); transition: border-color 0.15s ease, color 0.15s ease;
  animation: buddy-rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: calc(120ms + var(--i, 0) * 70ms);
}
.buddy-recent-card span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.buddy-recent-card .icon { width: 14px; height: 14px; color: var(--accent); flex: none; }
.buddy-recent-card:hover { color: var(--text-main); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
@keyframes buddy-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* The robot: themed colours, then its moves */
.bot { display: block; width: 100%; height: auto; overflow: visible;
  --bot-body: #eef2f8; --bot-hi: #ffffff; --bot-line: color-mix(in srgb, var(--accent) 22%, #8f9bb3); --bot-visor: #0d1424; }
.bot-part { stroke: var(--bot-line); stroke-width: 2.5; } /* fill: its own gradient (buddy-mascot.js) */
.bot-line { stroke: var(--bot-line); stroke-width: 4; stroke-linecap: round; fill: none; }
.bot-visor { fill: var(--bot-visor); stroke: color-mix(in srgb, var(--accent) 35%, transparent); stroke-width: 1.5; }
.bot-eye { fill: var(--accent); filter: drop-shadow(0 0 5px var(--accent)); }
.bot-happy { fill: none; stroke: var(--accent); stroke-width: 4.5; stroke-linecap: round; opacity: 0; filter: drop-shadow(0 0 5px var(--accent)); }
.bot-cheek { fill: #ff8fab; opacity: 0.35; }
.bot-antenna { fill: var(--accent); filter: drop-shadow(0 0 6px var(--accent)); animation: bot-antenna 2.4s ease-in-out infinite; }
.bot-badge { fill: color-mix(in srgb, var(--accent) 14%, #ffffff); stroke: color-mix(in srgb, var(--accent) 45%, transparent); stroke-width: 2; }
.bot-spark { fill: var(--accent); transform-box: fill-box; transform-origin: center; animation: bot-spark 3.2s ease-in-out infinite; }
.bot-shadow { fill: var(--accent); opacity: 0.2; transform-box: fill-box; transform-origin: center; animation: bot-shadow 4s ease-in-out infinite; }
.bot-float { animation: bot-float 4s ease-in-out infinite; }
.bot-wave { transform-box: view-box; transform-origin: 146px 132px; animation: bot-wave 3.2s ease-in-out infinite; }
.bot-eyes { transform-box: view-box; transform-origin: 100px 77px; translate: var(--look-x, 0px) var(--look-y, 0px); transition: translate 0.18s ease-out; animation: bot-blink 5.5s infinite; }
.buddy-mascot.is-happy .bot-eye { opacity: 0; }
.buddy-mascot.is-happy .bot-happy { opacity: 1; }
.buddy-mascot.is-happy .bot-wave { animation: bot-wave-fast 0.5s ease-in-out 3; }
.buddy-mascot.is-happy .bot-cheek { opacity: 0.7; }
.buddy-mascot:hover .bot-float { animation-duration: 2.4s; }
@keyframes bot-float { 50% { transform: translateY(-9px); } }
@keyframes bot-shadow { 50% { transform: scale(0.8); opacity: 0.12; } }
@keyframes bot-wave { 0%, 55%, 100% { rotate: 0deg; } 10% { rotate: -18deg; } 20% { rotate: 8deg; } 30% { rotate: -18deg; } 40% { rotate: 8deg; } }
@keyframes bot-wave-fast { 50% { rotate: -22deg; } }
@keyframes bot-blink { 0%, 90%, 100% { scale: 1 1; } 93% { scale: 1 0.12; } 96% { scale: 1 1; } }
@keyframes bot-antenna { 50% { opacity: 0.55; } }
@keyframes bot-spark { 50% { transform: scale(1.25) rotate(45deg); } }

@media (max-width: 640px) {
  .buddy-hero { flex-direction: column; text-align: center; gap: 10px; }
  .buddy-hero::before { left: 50%; margin-left: -110px; top: 90px; }
  .buddy-mascot { width: 120px; }
  .buddy-actions { grid-template-columns: 1fr 1fr; }
  .buddy-action { flex-direction: column; align-items: flex-start; gap: 8px; }
  .buddy-recent-row { justify-content: center; }
}
@media (max-width: 380px) { .buddy-actions { grid-template-columns: 1fr; } .buddy-action { flex-direction: row; } }
@media (prefers-reduced-motion: reduce) {
  .bot-float, .bot-shadow, .bot-wave, .bot-eyes, .bot-antenna, .bot-spark, .buddy-hero::before, .buddy-name, .buddy-mascot.is-happy .bot-wave { animation: none; }
  .buddy-hello, .buddy-action, .buddy-recent-card { animation: none; }
  .bot-eyes, .buddy-cando-text, .buddy-action, .buddy-action-icon { transition: none; }
  .buddy-action:hover { transform: none; }
  .chat-box .chat-bubble.is-pending::before { animation: none; }
}

/* Renaming chats: a pencil beside the open chat's title (and the title itself), plus the list's pencil */
.buddy-title-wrap { display: flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; }
.buddy-title-wrap h2 { cursor: text; border-radius: 6px; padding: 1px 4px; margin-left: -4px; transition: background 0.15s ease; }
.buddy-title-wrap h2:hover { background: var(--surface-hover); }
.buddy-rename-btn { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 8px; border: 0; background: none; color: var(--text-muted); cursor: pointer; }
.buddy-rename-btn:hover { background: var(--surface-hover); color: var(--text-main); }
.buddy-rename-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.buddy-rename-btn .icon { width: 15px; height: 15px; }
.buddy-title-wrap .buddy-rename { padding: 0; min-width: min(320px, 60vw); }
.buddy-title-wrap .buddy-rename .field-input { padding: 6px 10px; font-size: 15px; font-weight: 600; }
.buddy-chat-item:has(.buddy-chat-open[aria-current]) .buddy-chat-tools { opacity: 1; }

/* Flashcard practice (buddy-flashcards.js): a clean card, a slim progress bar, Again / Got it */
.flash-head-tools { display: flex; gap: 6px; flex: none; }
.flash-progress { display: flex; align-items: center; gap: 12px; }
.flash-bar { flex: 1; height: 6px; border-radius: 999px; background: var(--track, var(--surface-sunken)); overflow: hidden; }
.flash-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--green)); transition: width 0.35s ease; }
.flash-tally { font-size: 12.5px; font-weight: 650; color: var(--text-soft); font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }
.flash-practice .flash-card { min-height: 240px; }
.flash-practice .flash-face { gap: 12px; padding: 28px; }
.flash-practice .flash-front b { font-size: 19px; font-weight: 650; }
.flash-practice .flash-back b { font-size: 17px; font-weight: 500; color: var(--text-main); }
.flash-tag { position: absolute; top: 14px; left: 14px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 650; color: var(--warning-text); background: color-mix(in srgb, var(--amber) 12%, transparent); border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent); }
.flash-card.is-known { animation: flash-known 0.4s ease; }
.flash-card.is-again { animation: flash-again 0.4s ease; }
@keyframes flash-known { 40% { transform: translateX(12px); opacity: 0.55; } }
@keyframes flash-again { 25% { transform: translateX(-7px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-2px); } }
.flash-practice .flash-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.flash-practice .flash-show { grid-column: 1 / -1; justify-content: center; padding: 12px; font-size: 14px; }
.flash-choice {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; border-radius: 12px; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 650; border: 1px solid transparent; transition: background 0.15s ease, transform 0.15s ease;
}
.flash-choice .icon { width: 17px; height: 17px; }
.flash-choice:active { transform: scale(0.98); }
.flash-choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.flash-again { color: var(--warning-text); background: color-mix(in srgb, var(--amber) 10%, var(--surface-raised)); border-color: color-mix(in srgb, var(--amber) 35%, var(--border-strong)); }
.flash-again:hover { background: color-mix(in srgb, var(--amber) 16%, var(--surface-raised)); }
.flash-known { color: #052e16; background: var(--green); }
.flash-known:hover { background: color-mix(in srgb, var(--green) 85%, #fff); }
.flash-done { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0 4px; text-align: center; }
.flash-done h3 { font-size: 18px; font-weight: 700; margin-top: 6px; }
.flash-ring { --score: 0; width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--green) calc(var(--score) * 360deg), var(--surface-sunken) 0); }
.flash-ring b { width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-raised); font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.flash-actions-center { justify-content: center; }
.flash-tricky { list-style: none; display: flex; flex-direction: column; gap: 6px; width: 100%; max-height: 220px; overflow-y: auto; margin-top: 10px; text-align: left; }
.flash-tricky li { display: flex; flex-direction: column; gap: 2px; padding: 9px 12px; border-radius: 10px; background: var(--surface-sunken); border: 1px solid var(--border); }
.flash-tricky b { font-size: 13px; font-weight: 600; }
.flash-tricky span { font-size: 12.5px; color: var(--text-soft); }
@media (prefers-reduced-motion: reduce) { .flash-card.is-known, .flash-card.is-again { animation: none; } .flash-bar span { transition: none; } }
.flash-done + .flash-actions { margin-top: 16px; }

/* =====================================================================
   Classes page (student-classes.js): live strip, toolbar and class cards
   ===================================================================== */
.classes-view { display: flex; flex-direction: column; gap: 18px; }
.classes-live { display: flex; flex-direction: column; gap: 10px; }
.classes-live-row {
  position: relative; display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-radius: 16px; overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--red) 40%, var(--border-strong));
  background: linear-gradient(120deg, color-mix(in srgb, var(--red) 12%, var(--surface)), var(--surface) 60%);
  animation: live-glow 2.8s ease-in-out infinite;
}
.classes-live-row.is-new { animation: classes-rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both, live-glow 2.8s ease-in-out infinite; }
.classes-live-row[data-in="true"] { border-color: color-mix(in srgb, var(--green) 40%, var(--border-strong)); background: linear-gradient(120deg, color-mix(in srgb, var(--green) 12%, var(--surface)), var(--surface) 60%); animation: none; }
.classes-live-row[data-in="true"].is-new { animation: classes-rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.classes-live-row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--class-color); }
.classes-live-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.classes-live-kicker { display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--danger-text); }
.classes-live-row[data-in="true"] .classes-live-kicker { color: var(--success-text); }
.classes-live-text b { font-size: 17px; font-weight: 700; overflow-wrap: anywhere; }
.classes-live-text small { font-size: 12.5px; color: var(--text-soft); }
@keyframes live-glow { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 10%, transparent); } }

.classes-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.classes-search { position: relative; flex: 1 1 260px; max-width: 420px; }
.classes-search .icon { position: absolute; left: 12px; top: 50%; width: 15px; height: 15px; margin-top: -7.5px; color: var(--text-muted); pointer-events: none; }
.classes-search .field-input { padding-left: 34px; }
.classes-filter { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-sunken); border: 1px solid var(--border); }
.classes-filter button { border: 0; background: none; color: var(--text-muted); font: inherit; font-size: 13px; font-weight: 550; padding: 6px 12px; border-radius: 9px; cursor: pointer; }
.classes-filter button[aria-pressed="true"] { background: var(--surface-hover); color: var(--text-main); box-shadow: inset 0 0 0 1px var(--border-strong); }

.class-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.class-card-v2 {
  --class-color: var(--accent);
  position: relative; display: flex; flex-direction: column; border-radius: 18px; overflow: hidden; background: var(--surface); border: 1px solid var(--border);
  transition: transform 0.22s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.22s ease, border-color 0.22s ease;
}
.class-card-grid:not([data-settled]) .class-card-v2 { animation: classes-rise 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: calc(var(--i, 0) * 70ms); }
.class-card-v2:hover, .class-card-v2:focus-within { transform: translateY(-4px); border-color: color-mix(in srgb, var(--class-color) 45%, var(--border)); box-shadow: 0 18px 40px color-mix(in srgb, var(--class-color) 14%, transparent); }
.class-card-v2[data-live="true"] { border-color: color-mix(in srgb, var(--red) 40%, var(--border)); }
.class-card-v2[data-in-session="true"] { border-color: color-mix(in srgb, var(--green) 45%, var(--border)); }
.class-band {
  position: relative; height: 84px; display: flex; align-items: flex-end; justify-content: space-between; padding: 0 16px 0 16px;
  background:
    radial-gradient(120px 80px at 85% 10%, color-mix(in srgb, #fff 18%, transparent), transparent 70%),
    linear-gradient(135deg, color-mix(in srgb, var(--class-color) 70%, #0b1220), color-mix(in srgb, var(--class-color) 30%, #0b1220));
  background-size: 140% 140%; background-position: 0% 0%; transition: background-position 0.6s ease;
}
.class-card-v2:hover .class-band { background-position: 100% 100%; }
.class-band::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(color-mix(in srgb, #fff 14%, transparent) 1px, transparent 1.4px); background-size: 14px 14px; mask-image: linear-gradient(90deg, transparent, #000 60%); opacity: 0.6; pointer-events: none; }
.class-band-initial {
  position: relative; z-index: 1; width: 52px; height: 52px; margin-bottom: -22px; border-radius: 15px; display: grid; place-items: center;
  font-size: 22px; font-weight: 800; color: #fff; background: color-mix(in srgb, var(--class-color) 85%, #000); border: 3px solid var(--surface);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--class-color) 35%, transparent);
}
.class-badge { position: relative; z-index: 1; align-self: flex-start; margin-top: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; color: #fff; background: rgba(9, 9, 11, 0.45); backdrop-filter: blur(6px); }
.class-badge[data-state="live"] { background: color-mix(in srgb, var(--red) 80%, #000); }
.class-badge[data-state="in"] { background: color-mix(in srgb, var(--green) 70%, #000); }
.class-badge .live-dot { background: #fff; }
.class-body { display: flex; flex-direction: column; gap: 8px; padding: 30px 16px 12px; }
.class-name { font-size: 17px; font-weight: 700; letter-spacing: -0.2px; line-height: 1.25; overflow-wrap: anywhere; }
.class-open-link { color: inherit; text-decoration: none; }
.class-open-link::after { content: ""; position: absolute; inset: 0; z-index: 0; } /* the whole card opens the class */
.class-open-link:focus-visible { outline: none; }
.class-card-v2:has(.class-open-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.class-teacher-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-soft); }
.class-teacher-row .nf-avatar { --size: 24px; }
.class-teacher-unknown { color: var(--text-muted); }
.class-since { margin-left: auto; font-size: 11.5px; color: var(--danger-text); }
.class-attendance { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-muted); }
.class-attendance b { font-size: 12.5px; color: var(--text-main); font-variant-numeric: tabular-nums; }
.class-meter { flex: 1; height: 6px; border-radius: 999px; background: var(--surface-sunken); overflow: hidden; }
.class-meter span { display: block; height: 100%; width: var(--rate); border-radius: inherit; background: linear-gradient(90deg, var(--class-color), color-mix(in srgb, var(--class-color) 50%, var(--green))); }
.class-card-grid:not([data-settled]) .class-meter span { animation: meter-fill 1s cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: calc(250ms + var(--i, 0) * 70ms); }
@keyframes meter-fill { from { width: 0; } }
.class-shortcuts { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0 12px 12px; }
.class-shortcut {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 4px; border-radius: 11px; text-decoration: none; font-size: 11.5px; font-weight: 600; color: var(--text-soft);
  background: var(--surface-sunken); border: 1px solid var(--border); transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}
.class-shortcut .icon { width: 17px; height: 17px; color: var(--class-color); transition: transform 0.2s ease; }
.class-shortcut:hover { color: var(--text-main); border-color: color-mix(in srgb, var(--class-color) 45%, var(--border)); background: color-mix(in srgb, var(--class-color) 8%, var(--surface-sunken)); }
.class-shortcut:hover .icon { transform: translateY(-2px); }
.class-shortcut:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.class-shortcut[data-live="true"] { color: var(--danger-text); border-color: color-mix(in srgb, var(--red) 40%, var(--border)); }
.class-shortcut[data-live="true"] .icon { color: var(--danger-text); }
.class-foot { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 12px; margin-top: auto; border-top: 1px solid var(--border); }
.class-main { flex: 1; justify-content: center; padding: 9px 12px; font-size: 13px; text-decoration: none; }
.class-main .icon { width: 15px; height: 15px; }
.class-menu { position: relative; }
.class-menu-button { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface-raised); color: var(--text-soft); font-size: 18px; line-height: 1; cursor: pointer; }
.class-menu-button:hover, .class-menu-button[aria-expanded="true"] { color: var(--text-main); border-color: var(--border-hover); }
.class-menu-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.class-menu-list { position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 20; min-width: 230px; padding: 6px; border-radius: 12px; background: var(--surface-raised); border: 1px solid var(--border-strong); box-shadow: 0 16px 40px var(--shadow-color); animation: classes-pop 0.16s ease both; }
.class-menu-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 8px; background: none; color: var(--text-soft); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.class-menu-item .icon { width: 15px; height: 15px; flex: none; }
.class-menu-item:hover, .class-menu-item:focus-visible { background: var(--surface-hover); color: var(--text-main); outline: none; }
.class-menu-item.danger { color: var(--danger-text); }
.classes-empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 30px 16px 40px; text-align: center; }
.classes-empty .buddy-mascot { width: 130px; }
.classes-empty h2 { font-size: 20px; font-weight: 700; }
.classes-empty p { max-width: 440px; font-size: 13.5px; color: var(--text-muted); line-height: 1.55; }
@keyframes classes-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes classes-pop { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
@media (max-width: 640px) {
  .classes-live-row { flex-direction: column; align-items: stretch; }
  .classes-live-row .btn-join, .classes-live-row .btn-action { justify-content: center; }
  .class-card-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .classes-live-row, .class-card-grid .class-card-v2, .class-meter span, .class-menu-list { animation: none !important; }
  .class-card-v2, .class-band, .class-shortcut, .class-shortcut .icon { transition: none; }
  .class-card-v2:hover, .class-card-v2:focus-within { transform: none; }
}

/* =====================================================================
   Student Home, minimal (student-dashboard.js): three stats, Today, Jump back in, one coach tip
   ===================================================================== */
.glance.home-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.home-stats .glance-tile { gap: 10px; }
.home-stats .stat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.home-stats .stat-trend { font-size: 11.5px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.home-stats .stat-trend[data-trend="up"] { color: var(--success-text); }
.home-stats .stat-trend[data-trend="down"] { color: var(--warning-text); }
.home-stats .glance-value { font-size: 30px; line-height: 1; }
/* Focus this week: a bar per day with its initial underneath, today highlighted */
.week-chart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 76px; margin-top: auto; }
.week-col { display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.week-bar { width: 100%; max-width: 22px; height: var(--h, 0%); min-height: 4px; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 45%, transparent)); transform-origin: bottom; animation: week-grow 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: calc(var(--i, 0) * 50ms); }
.week-bar[data-empty="true"] { background: var(--track, var(--surface-sunken)); height: 4px; }
.week-col small { font-size: 10.5px; font-weight: 600; color: var(--text-muted); }
.week-col[data-today="true"] small { color: var(--text-main); }
.week-col[data-today="true"] .week-bar:not([data-empty="true"]) { box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 45%, transparent); }
@keyframes week-grow { from { transform: scaleY(0); } }
.streak-tile .glance-days { margin-top: auto; justify-content: space-between; }

/* Today: a calm checklist */
.today-card { display: flex; flex-direction: column; gap: 12px; }
.today-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.today-head .panel-title { margin: 0; }
.today-count { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.today-meter { height: 5px; border-radius: 999px; background: var(--track, var(--surface-sunken)); overflow: hidden; }
.today-meter span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--green)); transition: width 0.4s ease; }
.today-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.today-live { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--red) 8%, var(--surface-sunken)); border: 1px solid color-mix(in srgb, var(--red) 30%, var(--border)); }
.today-live[data-in="true"] { background: color-mix(in srgb, var(--green) 8%, var(--surface-sunken)); border-color: color-mix(in srgb, var(--green) 30%, var(--border)); }
.today-live-text { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-soft); min-width: 0; }
.today-live-text b { color: var(--text-main); }
.today-live-action { padding: 6px 14px; font-size: 12.5px; }
.today-step { display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 8px; border-radius: 10px; transition: background 0.15s ease; }
.today-step:hover { background: var(--surface-hover); }
.today-step label { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 0; cursor: pointer; font-size: 14px; }
.today-step input { width: 18px; height: 18px; flex: none; accent-color: var(--green); cursor: pointer; }
.today-step span { overflow-wrap: anywhere; transition: color 0.2s ease; }
.today-step[data-done="true"] span { color: var(--text-muted); text-decoration: line-through; }
.today-remove { width: 28px; height: 28px; flex: none; border: 0; border-radius: 8px; background: none; color: var(--text-muted); font-size: 18px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity 0.15s ease; }
.today-step:hover .today-remove, .today-remove:focus-visible { opacity: 1; }
@media (hover: none) { .today-remove { opacity: 1; } }
.today-remove:hover { color: var(--danger-text); background: var(--surface-raised); }
.today-empty { padding: 10px 2px; font-size: 13.5px; color: var(--text-muted); }
.today-add { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 10px 12px; border-radius: 12px; border: 1px dashed var(--border-strong); color: var(--text-muted); transition: border-color 0.15s ease; }
.today-add:focus-within { border-style: solid; border-color: color-mix(in srgb, var(--accent) 45%, var(--border-strong)); }
.today-add .icon { width: 16px; height: 16px; flex: none; }
.today-add input { flex: 1; min-width: 0; border: 0; outline: none; background: none; color: var(--text-main); font: inherit; font-size: 14px; }
.today-add input::placeholder { color: var(--text-muted); }

/* Jump back in: up to three simple tiles */
#continue-card { display: flex; flex-direction: column; gap: 12px; }
#continue-card .panel-title { margin: 0; }
.jump-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.jump-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-sunken); color: inherit; text-decoration: none; text-align: left; font: inherit; cursor: pointer; transition: border-color 0.15s ease, transform 0.15s ease; }
.jump-item:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); transform: translateX(2px); }
.jump-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.jump-item .chip-icon { width: 36px; height: 36px; flex: none; }
.jump-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.jump-kind { font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.jump-text b { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jump-meta { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jump-item .chevron { width: 16px; height: 16px; color: var(--text-muted); flex: none; }

/* Focus coach: one tip */
.coach-mini { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; }
.coach-mini-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent); }
.coach-mini-icon[data-tone="amber"] { color: var(--warning-text); background: color-mix(in srgb, var(--amber) 12%, transparent); border-color: color-mix(in srgb, var(--amber) 30%, transparent); }
.coach-mini-icon svg { width: 22px; height: 22px; }
.coach-mini-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.coach-mini-kicker { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.coach-mini-title { font-size: 16px; font-weight: 650; }
.coach-mini-text { font-size: 13.5px; color: var(--text-soft); line-height: 1.5; }
.coach-mini .coach-progress { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; max-width: 420px; }
.coach-mini .coach-progress small { font-size: 12px; color: var(--text-muted); }
.coach-mini-win { margin-top: 4px; font-size: 12.5px; color: var(--success-text); }
.coach-mini-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.coach-mini-actions .text-link { font-size: 12.5px; }

@media (max-width: 900px) {
  .glance.home-stats { grid-template-columns: 1fr 1fr; }
  .glance.home-stats .score-tile { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .glance.home-stats { grid-template-columns: 1fr; }
  .coach-mini { grid-template-columns: auto minmax(0, 1fr); }
  .coach-mini-actions { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) { .week-bar { animation: none; } .today-meter span, .jump-item, .today-step span { transition: none; } .jump-item:hover { transform: none; } }
.coach-mini-basis { display: inline-flex; width: fit-content; margin-top: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; color: var(--text-muted); background: var(--surface-sunken); border: 1px solid var(--border); }
.coach-mini-actions .coach-next { padding: 7px 12px; font-size: 12.5px; }
