/* ==========================================================================
   Study Companion — design system
   Dark, calm, high-contrast UI with mint accents and amber XP.
   No external dependencies; system font stack only.
   ========================================================================== */

:root {
  --bg: #070b10;
  --bg-soft: #0b1118;
  --surface: rgba(20, 30, 41, 0.72);
  --surface-solid: #121b25;
  --surface-raised: #17222e;
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.28);

  --text: #e8eef6;
  --text-soft: #b3c0cf;
  --muted: #8a99ab;

  --mint: #5eead4;
  --mint-strong: #2dd4bf;
  --mint-dim: rgba(94, 234, 212, 0.12);
  --amber: #fbbf24;
  --amber-dim: rgba(251, 191, 36, 0.13);
  --violet: #a78bfa;
  --violet-dim: rgba(167, 139, 250, 0.14);
  --sky: #38bdf8;
  --sky-dim: rgba(56, 189, 248, 0.13);
  --rose: #fb7185;
  --rose-dim: rgba(251, 113, 133, 0.13);
  --slate: #94a3b8;
  --slate-dim: rgba(148, 163, 184, 0.13);

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

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, 0.8);

  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, Consolas, "Liberation Mono", monospace;

  --sidebar-w: 258px;
  --unit: 4px;
}

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

/* Component display rules must never defeat the hidden attribute. */
[hidden] {
  display: none !important;
}

/* Visually hidden, still focusable and announced. */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-btn:focus-within {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 620px at 8% -8%, rgba(45, 212, 191, 0.1), transparent 60%),
    radial-gradient(900px 520px at 92% 0%, rgba(56, 189, 248, 0.08), transparent 55%),
    radial-gradient(800px 600px at 60% 100%, rgba(167, 139, 250, 0.07), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

h1 { font-size: 1.35rem; }
h2 { font-size: 1.06rem; }
h3 { font-size: 0.98rem; }

p { margin: 0; }

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

a:hover { text-decoration: underline; }

code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
}

::selection {
  background: rgba(94, 234, 212, 0.28);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   Layout shell
   -------------------------------------------------------------------------- */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 26px 18px;
  background: linear-gradient(180deg, rgba(13, 20, 28, 0.96), rgba(9, 14, 20, 0.9));
  border-right: 1px solid var(--border);
  backdrop-filter: blur(18px);
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px;
  color: var(--text);
  text-decoration: none;
}

.brand:hover { text-decoration: none; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: #04201c;
  background: linear-gradient(140deg, var(--mint) 0%, var(--mint-strong) 100%);
  box-shadow: 0 6px 18px -6px rgba(45, 212, 191, 0.65);
  flex: none;
}

.brand-mark svg { width: 24px; height: 24px; }

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.brand-text strong {
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.brand-text small {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-soft);
  font-size: 0.9rem;
  font-weight: 520;
  border: 1px solid transparent;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.nav-link svg {
  width: 19px;
  height: 19px;
  color: var(--muted);
  flex: none;
  transition: color 0.16s ease;
}

.nav-link:hover {
  background: rgba(148, 163, 184, 0.08);
  color: var(--text);
  text-decoration: none;
}

.nav-link:hover svg { color: var(--text-soft); }

.nav-link.is-active {
  background: var(--mint-dim);
  border-color: rgba(94, 234, 212, 0.22);
  color: var(--mint);
}

.nav-link.is-active svg { color: var(--mint); }

.sidebar-footer { margin-top: auto; }

.status-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.06);
  color: var(--muted);
  font-size: 0.78rem;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}

.dot-live {
  background: var(--mint);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.16);
}

.dot-demo {
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.16);
}

.main-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 32px;
  background: rgba(7, 11, 16, 0.78);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

.topbar-title { min-width: 0; flex: 1; }

.topbar-title h1 {
  font-size: 1.18rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-title p {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 5px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.05);
}

.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(140deg, rgba(94, 234, 212, 0.24), rgba(56, 189, 248, 0.24));
  border: 1px solid rgba(94, 234, 212, 0.3);
  color: var(--mint);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex: none;
}

.avatar-sm { width: 26px; height: 26px; font-size: 0.62rem; }

.avatar-student { background: linear-gradient(140deg, rgba(94,234,212,.24), rgba(45,212,191,.2)); }
.avatar-teacher { background: linear-gradient(140deg, rgba(56,189,248,.24), rgba(167,139,250,.2)); border-color: rgba(56,189,248,.3); color: var(--sky); }
.avatar-admin   { background: linear-gradient(140deg, rgba(251,191,36,.24), rgba(251,113,133,.2)); border-color: rgba(251,191,36,.3); color: var(--amber); }

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-meta strong { font-size: 0.8rem; font-weight: 600; }
.user-meta small { color: var(--muted); font-size: 0.68rem; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.05);
  color: var(--text-soft);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.icon-btn svg { width: 18px; height: 18px; }

.icon-btn:hover {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text);
  border-color: var(--border-strong);
}

form { margin: 0; }

.menu-btn { display: none; }

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px 32px 8px;
  max-width: 1420px;
  width: 100%;
  margin: 0 auto;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding: 20px 32px 26px;
  max-width: 1420px;
  width: 100%;
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.74rem;
}

.footer-note { color: var(--muted); }

.sidebar-scrim {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 10, 0.65);
  backdrop-filter: blur(2px);
  z-index: 35;
}

/* --------------------------------------------------------------------------
   Cards, grids, typography helpers
   -------------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.card-head h2 { margin-bottom: 2px; }

.muted { color: var(--muted); font-size: 0.85rem; }

.eyebrow {
  color: var(--mint);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.grid {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.empty-state {
  color: var(--muted);
  font-size: 0.86rem;
  padding: 14px 0;
}

.hint-text {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
  margin-top: 10px;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  font-size: 0.83rem;
  font-weight: 550;
  color: var(--mint);
}

.text-link svg { width: 15px; height: 15px; }
.text-link:hover { text-decoration: none; gap: 10px; }
.text-link { transition: gap 0.16s ease; }

/* Pills, tags, statuses */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.07);
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.pill svg { width: 13px; height: 13px; }
.pill-mint { background: var(--mint-dim); border-color: rgba(94,234,212,.28); color: var(--mint); }
.pill-amber { background: var(--amber-dim); border-color: rgba(251,191,36,.3); color: var(--amber); }

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  border: 1px solid transparent;
}

.tag-mint   { background: var(--mint-dim);   color: var(--mint);   border-color: rgba(94,234,212,.22); }
.tag-violet { background: var(--violet-dim); color: var(--violet); border-color: rgba(167,139,250,.24); }
.tag-sky    { background: var(--sky-dim);    color: var(--sky);    border-color: rgba(56,189,248,.24); }
.tag-amber  { background: var(--amber-dim);  color: var(--amber);  border-color: rgba(251,191,36,.24); }
.tag-rose   { background: var(--rose-dim);   color: var(--rose);   border-color: rgba(251,113,133,.24); }
.tag-slate  { background: var(--slate-dim);  color: var(--slate);  border-color: rgba(148,163,184,.24); }

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: capitalize;
  border: 1px solid transparent;
}

.status::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.status-verified   { background: var(--mint-dim);   color: var(--mint);   border-color: rgba(94,234,212,.24); }
.status-unverified { background: var(--amber-dim);  color: var(--amber);  border-color: rgba(251,191,36,.24); }
.status-abstained  { background: var(--rose-dim);   color: var(--rose);   border-color: rgba(251,113,133,.24); }
.status-corrected  { background: var(--violet-dim); color: var(--violet); border-color: rgba(167,139,250,.24); }

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.87rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.btn svg { width: 16px; height: 16px; flex: none; }
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: linear-gradient(135deg, var(--mint) 0%, var(--mint-strong) 100%);
  color: #04211d;
  box-shadow: 0 10px 24px -12px rgba(45, 212, 191, 0.7);
}

.btn-primary:hover { box-shadow: 0 14px 30px -12px rgba(45, 212, 191, 0.9); }

.btn-ghost {
  background: rgba(148, 163, 184, 0.06);
  border-color: var(--border-strong);
  color: var(--text-soft);
}

.btn-ghost:hover { background: rgba(148, 163, 184, 0.12); color: var(--text); }

.btn-sm { padding: 7px 13px; font-size: 0.8rem; border-radius: 9px; }
.btn-block { width: 100%; }

.file-btn { position: relative; overflow: hidden; }

/* Forms */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > span {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: 0.01em;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 10px 13px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: rgba(7, 11, 16, 0.6);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.5;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

textarea { resize: vertical; min-height: 66px; }

input::placeholder,
textarea::placeholder { color: #8a99ab; }

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
  border-color: rgba(94, 234, 212, 0.55);
}

input:focus:not(:focus-visible),
textarea:focus:not(:focus-visible),
select:focus:not(:focus-visible) {
  outline: none;
  border-color: rgba(94, 234, 212, 0.4);
}

input,
textarea,
select {
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input:focus,
textarea:focus,
select:focus {
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.1);
}

/* Alerts */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 15px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 0.83rem;
  line-height: 1.5;
}

.alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert strong { font-weight: 650; }

.alert-error {
  background: rgba(251, 113, 133, 0.09);
  border-color: rgba(251, 113, 133, 0.3);
  color: #ffc9d0;
}

.alert-info {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.26);
  color: #cfe8fb;
}

/* --------------------------------------------------------------------------
   Dashboard
   -------------------------------------------------------------------------- */

.hero-band {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  padding: 26px 28px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background:
    radial-gradient(600px 240px at 100% 0%, rgba(94, 234, 212, 0.12), transparent 70%),
    linear-gradient(135deg, rgba(20, 30, 41, 0.92), rgba(11, 17, 24, 0.86));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-copy h2 {
  font-size: 1.6rem;
  margin-bottom: 8px;
  letter-spacing: -0.025em;
}

.hero-copy .muted { max-width: 46ch; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hero-visual {
  display: flex;
  align-items: center;
  gap: 20px;
  justify-content: flex-end;
}

.xp-ring {
  --pct: 0%;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: conic-gradient(var(--amber) var(--pct), rgba(148, 163, 184, 0.14) 0);
  display: grid;
  place-items: center;
  flex: none;
  position: relative;
}

.xp-ring::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 24px rgba(251, 191, 36, 0.18);
}

.xp-ring-inner {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: #0c1319;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px solid var(--border);
}

.xp-ring-inner strong { font-size: 1.15rem; }
.xp-ring-inner span { color: var(--muted); font-size: 0.68rem; }

.mini-stats {
  display: grid;
  gap: 10px;
}

.mini-stat {
  display: flex;
  flex-direction: column;
  padding: 9px 14px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: rgba(7, 11, 16, 0.45);
  min-width: 118px;
}

.mini-value { font-size: 1.05rem; font-weight: 650; color: var(--mint); }
.mini-label { color: var(--muted); font-size: 0.7rem; }

/* Bar chart */

.bar-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  height: 178px;
  padding-top: 8px;
}

.bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  height: 100%;
}

.bar-track {
  width: 100%;
  max-width: 46px;
  flex: 1;
  display: flex;
  align-items: flex-end;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.06);
  overflow: hidden;
}

.bar-fill {
  width: 100%;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--mint) 0%, rgba(45, 212, 191, 0.55) 100%);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 4px;
  min-height: 10px;
  transition: height 0.4s ease;
}

.bar-value {
  font-size: 0.62rem;
  font-weight: 700;
  color: #052a24;
}

.bar-label { color: var(--muted); font-size: 0.68rem; }

/* Check list */

.check-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.check-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.84rem;
  color: var(--text-soft);
}

.check-list svg {
  width: 16px;
  height: 16px;
  color: var(--mint);
  flex: none;
  margin-top: 2px;
}

/* Missions */

.mission-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mission {
  padding: 15px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(7, 11, 16, 0.4);
  transition: border-color 0.16s ease, background 0.16s ease;
}

.mission:hover { border-color: var(--border-strong); }

.mission.is-done {
  border-color: rgba(94, 234, 212, 0.26);
  background: rgba(94, 234, 212, 0.05);
}

.mission-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.mission-top h3 { margin: 7px 0 3px; }

.xp-badge {
  flex: none;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--amber-dim);
  border: 1px solid rgba(251, 191, 36, 0.26);
  color: var(--amber);
  font-size: 0.71rem;
  font-weight: 700;
  white-space: nowrap;
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 13px;
}

.progress {
  flex: 1;
  height: 7px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--mint-strong), var(--mint));
  transition: width 0.5s ease;
}

.progress-label {
  color: var(--muted);
  font-size: 0.73rem;
  white-space: nowrap;
  min-width: 56px;
  text-align: right;
}

.mission.is-done .progress > span {
  background: linear-gradient(90deg, var(--mint), #a7f3d0);
}

/* Chips */

.chip-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(148, 163, 184, 0.06);
  color: var(--text-soft);
  font-size: 0.79rem;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.chip:hover {
  background: var(--mint-dim);
  border-color: rgba(94, 234, 212, 0.3);
  color: var(--mint);
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  margin: 0 -6px;
  padding: 0 6px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
  min-width: 640px;
}

.data-table th {
  text-align: left;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  vertical-align: middle;
}

.data-table tbody tr:hover { background: rgba(148, 163, 184, 0.04); }
.data-table tbody tr:last-child td { border-bottom: none; }

.cell-question {
  display: block;
  max-width: 34ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.student-cell {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
}

.empty-panel {
  padding: 22px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  text-align: center;
  color: var(--muted);
  font-size: 0.86rem;
}

/* --------------------------------------------------------------------------
   Demo console
   -------------------------------------------------------------------------- */

.demo-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 20px;
  align-items: start;
}

.demo-console { display: flex; flex-direction: column; }

.recorder {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0 18px;
  position: relative;
}

.record-btn {
  position: relative;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  user-select: none;
}

.record-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(94, 234, 212, 0.28);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.record-face {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: linear-gradient(140deg, rgba(94, 234, 212, 0.18), rgba(45, 212, 191, 0.1));
  border: 1px solid rgba(94, 234, 212, 0.35);
  color: var(--mint);
  transition: transform 0.16s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.record-face svg { width: 36px; height: 36px; }

.record-btn:hover .record-face {
  background: linear-gradient(140deg, rgba(94, 234, 212, 0.26), rgba(45, 212, 191, 0.14));
}

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

.record-btn.is-recording .record-ring {
  border-color: rgba(251, 113, 133, 0.6);
  box-shadow: 0 0 0 10px rgba(251, 113, 133, 0.08), 0 0 40px rgba(251, 113, 133, 0.25);
  animation: pulse 1.6s ease-out infinite;
}

.record-btn.is-recording .record-face {
  background: linear-gradient(140deg, rgba(251, 113, 133, 0.3), rgba(251, 113, 133, 0.16));
  border-color: rgba(251, 113, 133, 0.55);
  color: #ffe3e7;
}

.record-btn.is-busy { opacity: 0.55; cursor: progress; }

@keyframes pulse {
  0% { transform: scale(1); }
  70% { transform: scale(1.12); opacity: 0.4; }
  100% { transform: scale(1.2); opacity: 0; }
}

.record-hint {
  margin-top: 14px;
  color: var(--text-soft);
  font-size: 0.83rem;
  font-weight: 550;
}

.waveform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 34px;
  width: 100%;
  margin: 10px 0 4px;
}

.wave-bar {
  width: 3px;
  border-radius: 3px;
  background: rgba(94, 234, 212, 0.42);
  height: 4px;
  transition: height 0.08s ease;
}

.wave-bar.idle {
  background: rgba(148, 163, 184, 0.22);
}

.wave-bar.hot { background: var(--rose); }

.record-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.dot-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--border-strong);
}

/* Pipeline stages */

.pipeline {
  list-style: none;
  margin: 4px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stage {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 0.8rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.stage strong { font-weight: 600; display: block; font-size: 0.83rem; }
.stage small { font-size: 0.72rem; opacity: 0.8; }

.stage-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  flex: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.stage.is-active {
  background: rgba(94, 234, 212, 0.06);
  color: var(--text-soft);
}

.stage.is-active .stage-dot {
  border-color: var(--mint);
  background: var(--mint);
  box-shadow: 0 0 0 4px rgba(94, 234, 212, 0.14);
  animation: blink 1.1s ease-in-out infinite;
}

.stage.is-done { color: var(--text-soft); }
.stage.is-done .stage-dot {
  border-color: var(--mint);
  background: var(--mint);
}

.stage.is-error .stage-dot {
  border-color: var(--rose);
  background: var(--rose);
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.fallback-panel {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.fallback-panel summary {
  cursor: pointer;
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 550;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.fallback-panel summary::-webkit-details-marker { display: none; }

.fallback-panel summary::before {
  content: "+";
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1;
}

.fallback-panel[open] summary::before { content: "−"; }

.fallback-panel[open] summary { margin-bottom: 14px; }

/* Answer panel */

.answer-panel { min-height: 430px; display: flex; flex-direction: column; }

.answer-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 30px 20px;
}

.ghost-hud {
  width: 126px;
  height: 126px;
  border-radius: 14px;
  border: 1px dashed var(--border-strong);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: rgba(203, 213, 225, 0.7);
  font-size: 0.66rem;
  background: rgba(7, 11, 16, 0.5);
}

.answer-body { display: flex; flex-direction: column; gap: 18px; }

.transcript-row {
  padding: 11px 14px;
  border-radius: var(--radius);
  background: rgba(148, 163, 184, 0.06);
  border: 1px solid var(--border);
}

.transcript-label,
.block-label {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.transcript { font-size: 0.88rem; color: var(--text-soft); }

.answer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
}

.hint-block p {
  font-size: 1rem;
  font-weight: 550;
  color: var(--mint);
  line-height: 1.45;
}

/* HUD preview */

.hud-wrap { flex: none; }

.hud-frame {
  width: 150px;
  height: 150px;
  border-radius: 18px;
  padding: 12px;
  background: linear-gradient(150deg, rgba(148, 163, 184, 0.18), rgba(30, 41, 59, 0.4));
  border: 1px solid var(--border-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.hud-screen {
  width: 126px;
  height: 126px;
  border-radius: 10px;
  background: #04070a;
  border: 1px solid rgba(94, 234, 212, 0.16);
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 28px rgba(94, 234, 212, 0.06);
}

.hud-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.024) 0 1px,
    transparent 1px 3px
  );
  pointer-events: none;
}

.hud-status {
  display: flex;
  align-items: center;
  gap: 5px;
  color: rgba(94, 234, 212, 0.75);
  font-size: 0.55rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-weight: 650;
  margin-bottom: 8px;
  flex: none;
}

.hud-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 6px rgba(94, 234, 212, 0.8);
}

.hud-line {
  font-family: var(--mono);
  font-size: 0.66rem;
  line-height: 1.45;
  color: #e9fff9;
  word-break: break-word;
  letter-spacing: -0.01em;
}

.hud-line + .hud-line { margin-top: 2px; }

.hud-foot {
  margin-top: auto;
  color: rgba(203, 213, 225, 0.78);
  font-size: 0.52rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  flex: none;
}

.explain-block p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-soft);
}

.audio-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.meta-line {
  color: var(--muted);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
}

/* Flow list */

.flow {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
  counter-reset: flow;
}

.flow li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.flow li p { color: var(--muted); font-size: 0.82rem; margin-top: 2px; }

.flow-num {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 8px;
  background: var(--mint-dim);
  border: 1px solid rgba(94, 234, 212, 0.24);
  color: var(--mint);
  font-size: 0.72rem;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Stats page
   -------------------------------------------------------------------------- */

.stat-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  min-width: 0;
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  flex: none;
}

.stat-icon svg { width: 19px; height: 19px; }
.stat-icon.mint   { background: var(--mint-dim);   color: var(--mint); }
.stat-icon.sky    { background: var(--sky-dim);    color: var(--sky); }
.stat-icon.amber  { background: var(--amber-dim);  color: var(--amber); }
.stat-icon.violet { background: var(--violet-dim); color: var(--violet); }

.stat-card > div { min-width: 0; }

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.stat-value {
  display: block;
  font-size: 1.55rem;
  font-weight: 680;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 2px 0;
  font-variant-numeric: tabular-nums;
}

.stat-note { color: var(--muted); font-size: 0.72rem; }

.line-chart { overflow-x: auto; }
.line-chart svg { width: 100%; min-width: 420px; height: auto; display: block; }

.grid-line { stroke: rgba(148, 163, 184, 0.1); stroke-width: 1; }
.axis-text { fill: var(--muted); font-size: 10px; font-family: var(--font); }

.chart-line {
  fill: none;
  stroke: var(--mint);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-point {
  fill: #071016;
  stroke: var(--mint);
  stroke-width: 2.2;
}

.donut-row {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.donut {
  width: 116px;
  height: 116px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  position: relative;
}

.donut-hole {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: #0c1319;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}

.donut-hole strong { font-size: 1.1rem; }
.donut-hole span { color: var(--muted); font-size: 0.62rem; }

.legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.79rem;
  color: var(--text-soft);
}

.legend li { display: flex; align-items: center; gap: 8px; }
.legend b { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; }

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  flex: none;
}

.topic-bars {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.topic-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  font-size: 0.79rem;
}

.leaderboard {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  counter-reset: lb;
}

.leaderboard li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 6px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  font-size: 0.84rem;
}

.leaderboard li:last-child { border-bottom: none; }

.rank {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.1);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  flex: none;
}

.leaderboard li:first-child .rank {
  background: var(--amber-dim);
  color: var(--amber);
}

.lb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-count { color: var(--mint); font-weight: 650; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   About / system page
   -------------------------------------------------------------------------- */

.kv {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.kv > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 2px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  font-size: 0.84rem;
}

.kv > div:last-child { border-bottom: none; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; color: var(--text-soft); }

.endpoint-list {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.endpoint-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
}

.method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.method.get  { background: var(--sky-dim);  color: var(--sky); }
.method.post { background: var(--mint-dim); color: var(--mint); }

.hw-grid { display: flex; flex-direction: column; }

.hw-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 16px;
  padding: 10px 2px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  font-size: 0.83rem;
}

.hw-row:last-child { border-bottom: none; }
.hw-label { color: var(--muted); font-weight: 600; font-size: 0.78rem; }
.hw-value { color: var(--text-soft); }

.hw-absent .hw-value { color: var(--rose); }

.alert + .alert { margin-top: 12px; }
.hw-grid + .alert { margin-top: 16px; }

/* --------------------------------------------------------------------------
   Login page
   -------------------------------------------------------------------------- */

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 24px;
  overflow-x: hidden;
}

.auth-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
}

.orb-a {
  width: 480px;
  height: 480px;
  background: rgba(45, 212, 191, 0.22);
  top: -140px;
  left: -100px;
}

.orb-b {
  width: 420px;
  height: 420px;
  background: rgba(56, 189, 248, 0.16);
  bottom: -120px;
  right: -80px;
}

.orb-c {
  width: 340px;
  height: 340px;
  background: rgba(167, 139, 250, 0.14);
  top: 40%;
  left: 46%;
}

.auth-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 56px;
  align-items: center;
  max-width: 1120px;
  width: 100%;
}

.auth-story { max-width: 520px; }

.brand-lg { padding: 0; margin-bottom: 30px; }
.brand-lg .brand-mark { width: 46px; height: 46px; border-radius: 14px; }
.brand-lg .brand-mark svg { width: 27px; height: 27px; }
.brand-lg .brand-text strong { font-size: 1.02rem; }

.auth-story h1 {
  font-size: clamp(1.7rem, 3.2vw, 2.35rem);
  line-height: 1.18;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
}

.grad-text {
  background: linear-gradient(100deg, var(--mint) 10%, var(--sky) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.auth-story .lead {
  color: var(--text-soft);
  font-size: 0.94rem;
  line-height: 1.62;
  margin-bottom: 26px;
}

.feature-list {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.feature-list li {
  display: flex;
  gap: 13px;
  align-items: flex-start;
}

.feature-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex: none;
  border: 1px solid var(--border);
}

.feature-icon svg { width: 18px; height: 18px; }
.feature-icon.mint  { background: var(--mint-dim);  color: var(--mint); }
.feature-icon.amber { background: var(--amber-dim); color: var(--amber); }
.feature-icon.sky   { background: var(--sky-dim);   color: var(--sky); }

.feature-list strong {
  display: block;
  font-size: 0.87rem;
  font-weight: 600;
  margin-bottom: 1px;
}

.feature-list span:not(.feature-icon) {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.auth-note {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 13px 15px;
  border-radius: var(--radius);
  border: 1px solid rgba(94, 234, 212, 0.16);
  background: rgba(94, 234, 212, 0.04);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.auth-note svg { width: 18px; height: 18px; color: var(--mint); flex: none; margin-top: 1px; }

.auth-card { padding: 28px; }

.auth-card h2 { font-size: 1.3rem; margin-bottom: 4px; }
.auth-card > .muted { margin-bottom: 20px; }

.auth-card .alert { margin-bottom: 16px; }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 16px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.demo-accounts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.demo-account {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.04);
  color: var(--text);
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.12s ease;
}

.demo-account:hover {
  background: rgba(148, 163, 184, 0.09);
  border-color: var(--border-strong);
  text-decoration: none;
  transform: translateX(2px);
}

.demo-account > svg {
  width: 15px;
  height: 15px;
  color: var(--muted);
  margin-left: auto;
  flex: none;
}

.demo-meta { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.demo-meta strong { font-size: 0.83rem; font-weight: 620; }
.demo-meta small {
  color: var(--muted);
  font-size: 0.72rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1240px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-band { grid-template-columns: minmax(0, 1fr); }
  .hero-visual { justify-content: flex-start; }
  /* Sidebar takes ~258 px; two demo columns get too narrow for the HUD block. */
  .demo-layout { grid-template-columns: minmax(0, 1fr); }
  .answer-panel { min-height: 0; }
}

@media (max-width: 1024px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(84vw, var(--sidebar-w));
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateX(-102%);
    visibility: hidden;
    transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.24s;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.is-open { transform: translateX(0); visibility: visible; }
  .menu-btn { display: grid; }

  .content { padding: 22px 20px 8px; }
  .topbar { padding: 14px 20px; }
  .site-footer { padding: 18px 20px 24px; }

  .demo-layout { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }

  .auth-grid { grid-template-columns: minmax(0, 1fr); gap: 34px; }
  .auth-story { max-width: none; }
}

@media (max-width: 720px) {
  body { font-size: 14px; }

  .topbar { gap: 10px; padding: 12px 14px; }
  .topbar-title p { display: none; }
  .topbar-title h1 { font-size: 1.02rem; }
  .topbar-actions { gap: 6px; }
  .topbar-actions > .pill { display: none; }
  .topbar-actions .btn-sm { padding: 7px 10px; }
  .user-meta { display: none; }
  .user-chip { padding: 4px; border-radius: 50%; }
  .topbar-actions .btn-sm span { display: none; }

  .content { padding: 18px 14px 8px; gap: 14px; }
  .card { padding: 17px; border-radius: var(--radius); }
  .hero-band { padding: 20px; border-radius: var(--radius-lg); }
  .hero-copy h2 { font-size: 1.28rem; }
  .hero-visual { flex-wrap: wrap; gap: 16px; }
  .xp-ring { width: 108px; height: 108px; }
  .xp-ring-inner { width: 84px; height: 84px; }

  .grid-4, .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }

  .answer-grid { grid-template-columns: minmax(0, 1fr); }
  .hud-wrap { justify-self: start; }

  .auth-body { padding: 22px 14px; }
  .auth-card { padding: 22px 18px; }
  .brand-lg { margin-bottom: 22px; }
  .auth-story .lead { font-size: 0.88rem; }

  .data-table { min-width: 0; }
  .data-table thead { display: none; }
  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td { display: block; width: 100%; }

  .data-table tr {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
  }

  .data-table td {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 5px 2px;
    border: none;
    text-align: right;
  }

  .data-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 650;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-align: left;
    flex: none;
    padding-top: 2px;
  }

  .cell-question { max-width: 22ch; }

  .hw-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .stat-value { font-size: 1.35rem; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   API reference page
   -------------------------------------------------------------------------- */

.endpoint-block h3 { margin-bottom: 8px; }

.endpoint-block .code-block { margin-top: 12px; }

.code-block {
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--text-soft);
  background: rgba(4, 7, 10, 0.72);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 15px;
  overflow-x: auto;
  white-space: pre;
  margin: 0;
}

.endpoint-list-wide {
  display: flex;
  flex-direction: column;
}

.endpoint-row {
  display: grid;
  grid-template-columns: 52px minmax(150px, 230px) minmax(0, 1fr);
  gap: 14px;
  align-items: baseline;
  padding: 10px 2px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  font-size: 0.83rem;
}

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

.endpoint-row code {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--mint);
}

.endpoint-desc { color: var(--muted); }

@media (max-width: 720px) {
  .endpoint-row {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 8px 10px;
  }
  .endpoint-desc { grid-column: 1 / -1; }
}

/* --------------------------------------------------------------------------
   Glasses feed
   -------------------------------------------------------------------------- */

.feed-intro {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
}

.feed-intro-main { flex: 1 1 380px; min-width: 0; }
.feed-intro-main h2 { margin-bottom: 6px; }

.kv-inline {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  margin: 0;
  flex: none;
}

.kv-inline > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0;
  border: none;
}

.kv-inline dt {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.kv-inline dd {
  margin: 0;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
}

.feed-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.feed-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "head  hud"
    "q     hud"
    "hint  hud";
  gap: 8px 20px;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  animation: feedIn 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

.feed-item-new {
  border-color: rgba(94, 234, 212, 0.34);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.08), var(--shadow);
}

.feed-item-head {
  grid-area: head;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.feed-item-meta {
  color: var(--muted);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
}

.feed-question {
  grid-area: q;
  font-size: 1.02rem;
  font-weight: 550;
  line-height: 1.45;
  color: var(--text);
}

.feed-hint-row { grid-area: hint; }

.feed-hint {
  font-size: 0.9rem;
  color: var(--mint);
  font-weight: 520;
  line-height: 1.45;
}

.feed-item > .hud-frame {
  grid-area: hud;
  align-self: start;
}

.hud-frame-sm {
  width: 138px;
  height: 138px;
  padding: 6px;
  border-radius: 14px;
}

.hud-frame-sm .hud-screen {
  width: 126px;
  height: 126px;
}

@media (max-width: 720px) {
  .feed-item {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "head"
      "q"
      "hint"
      "hud";
  }
  .feed-item > .hud-frame { justify-self: start; margin-top: 6px; }
  .kv-inline { gap: 16px; }
}
