:root, [data-theme="dark"] {
  --bg: #0c1018;
  --card: rgba(22, 28, 40, 0.92);
  --border: rgba(180, 150, 90, 0.22);
  --text: #eef1f6;
  --muted: #8b95a8;
  --accent: #c4a35a;
  --good: #5dbe8a;
  --danger: #e06c75;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Outfit", var(--font);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: var(--font); background: var(--bg); color: var(--text); }
body {
  min-height: 100dvh;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(196,163,90,0.12), transparent),
    var(--bg);
}
/* Subtle Saraswati-themed wash inside the app (after login) */
.app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(12, 16, 24, 0.88) 0%, rgba(12, 16, 24, 0.94) 55%, rgba(12, 16, 24, 0.98) 100%),
    url("/assets/app-backdrop.jpg?v=swati1") center top / cover no-repeat;
  opacity: 1;
}
.hidden { display: none !important; }
.btn {
  appearance: none; border: 1px solid var(--border); background: var(--card);
  color: var(--text); font: inherit; font-weight: 600; padding: 10px 16px;
  border-radius: 12px; cursor: pointer;
}
.btn-primary { background: linear-gradient(180deg, rgba(196,163,90,0.35), rgba(196,163,90,0.15)); border-color: rgba(196,163,90,0.45); color: #f0e2b8; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 10px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.login-screen {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 22px 16px 16px;
  overflow-x: hidden;
}
.login-backdrop {
  position: absolute; inset: 0; z-index: 0;
  background:
    url("/assets/login-backdrop.jpg?v=swati1") center / cover no-repeat;
  transform: scale(1.02);
}
.login-overlay {
  position: absolute; inset: 0; z-index: 1;
  background:
    linear-gradient(165deg, rgba(8, 12, 22, 0.62) 0%, rgba(12, 16, 28, 0.72) 40%, rgba(10, 12, 20, 0.88) 100%),
    radial-gradient(ellipse 70% 55% at 50% 15%, rgba(196, 163, 90, 0.16), transparent 70%),
    radial-gradient(ellipse 40% 40% at 80% 70%, rgba(155, 120, 200, 0.08), transparent 60%);
}
.login-board {
  position: relative; z-index: 2;
  width: min(1080px, 100%);
  background: rgba(22, 28, 40, 0.9);
  border: 1px solid rgba(196,163,90,0.26);
  border-radius: 22px;
  box-shadow: 0 28px 70px rgba(0,0,0,0.48);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow: hidden;
}
.login-board-head {
  display: grid;
  grid-template-columns: minmax(200px, 0.9fr) minmax(0, 1.4fr);
  gap: 18px 28px;
  align-items: center;
  padding: 20px 24px 18px;
  border-bottom: 1px solid rgba(196,163,90,0.16);
  background:
    linear-gradient(180deg, rgba(196,163,90,0.08), transparent);
}
.login-board-head-copy { min-width: 0; }
.mission-kicker {
  margin: 4px 0 0;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #d4c09a;
}
.mission-slogan {
  font-family: var(--display);
  font-size: clamp(1.15rem, 2.2vw, 1.55rem);
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.02em;
  color: #f4ead0;
  margin: 0 0 6px;
}
.login-board-body {
  display: grid;
  grid-template-columns: minmax(300px, 0.92fr) minmax(0, 1.25fr);
  align-items: stretch;
  min-height: 0;
}
.login-card {
  width: 100%;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 22px 24px 24px;
  box-shadow: none;
  border-right: 1px solid rgba(196,163,90,0.14);
}
@media (max-width: 860px) {
  .login-screen { justify-content: flex-start; padding-top: 16px; }
  .login-board-head,
  .login-board-body { grid-template-columns: 1fr; }
  .login-board-head { padding: 16px 16px 14px; }
  .login-card {
    order: -1;
    border-right: 0;
    border-bottom: 1px solid rgba(196,163,90,0.14);
    padding: 16px 16px 18px;
  }
  .mission-panel { padding: 16px; }
  .mission-slogan { font-size: 1.2rem; }
}
.brand-row {
  display: flex; align-items: center; gap: 14px; margin-bottom: 0;
}
.brand-logo {
  width: 56px; height: 56px; border-radius: 14px;
  object-fit: cover; flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35), 0 0 0 1px rgba(196,163,90,0.25);
  border: 1px solid rgba(196,163,90,0.4);
}
.brand {
  font-family: var(--display); font-size: 1.55rem; font-weight: 700;
  margin-bottom: 2px; line-height: 1.15;
  letter-spacing: 0.01em;
}
.brand span { color: var(--accent); }
.tagline { color: var(--muted); font-size: 0.8rem; margin-bottom: 0; line-height: 1.4; }

.login-portrait-wrap {
  margin: 0 0 16px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(196,163,90,0.3);
  background: rgba(0,0,0,0.25);
  box-shadow: 0 10px 28px rgba(0,0,0,0.3);
}
.login-portrait {
  display: block;
  width: 100%;
  height: auto;
  max-height: 148px;
  object-fit: cover;
  object-position: center 18%;
}
.login-portrait-cap {
  padding: 7px 12px 9px;
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-align: center;
  border-top: 1px solid rgba(196,163,90,0.15);
}

/* Mission panel — how Saraswati is not a vanilla LMS */
.mission-panel {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 20px 22px 18px;
  box-shadow: none;
  line-height: 1.5;
  font-size: 0.9rem;
  color: var(--text);
}
.mission-lead {
  margin: 0 0 14px;
  color: #d8deea;
  font-size: 0.88rem;
}
.mission-jobs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 12px;
}
@media (max-width: 520px) {
  .mission-jobs { grid-template-columns: 1fr; }
}
.mission-job {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(196,163,90,0.18);
  border-radius: 12px;
  padding: 11px 12px 12px;
}
.mission-job-kicker {
  margin: 0 0 4px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.mission-job h2 {
  font-family: var(--display);
  font-size: 0.98rem;
  font-weight: 700;
  color: #f0e2b8;
  margin: 0 0 6px;
  line-height: 1.25;
}
.mission-job p {
  margin: 0;
  font-size: 0.78rem;
  color: #c5cddc;
  line-height: 1.4;
}
.contrast-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 12px;
}
@media (max-width: 520px) {
  .contrast-list { grid-template-columns: 1fr; }
}
.contrast-list > div {
  display: grid;
  gap: 2px;
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(0,0,0,0.18);
  border-left: 3px solid rgba(196,163,90,0.45);
}
.contrast-list dt {
  font-size: 0.78rem;
  font-weight: 600;
  color: #9aa3b5;
  line-height: 1.35;
}
.contrast-was {
  display: inline-block;
  margin-right: 6px;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7d8798;
  vertical-align: 1px;
}
.contrast-list dd {
  margin: 0;
  font-size: 0.86rem;
  color: #e8edf6;
  font-weight: 550;
}
.edu-panel {
  background: rgba(22, 28, 40, 0.82);
  border: 1px solid rgba(196,163,90,0.22);
  border-radius: 18px;
  padding: 22px 20px;
}
.edu-list {
  margin: 0 0 14px 1.1em; color: #d5dbe6;
}
.edu-list li { margin-bottom: 8px; }
.edu-audience, .edu-safety {
  font-size: 0.76rem; color: var(--muted); margin: 0; line-height: 1.4;
}
.edu-audience:last-child, .edu-safety:last-child { margin-bottom: 0; }
.login-footer {
  position: relative; z-index: 2;
  margin-top: 18px; text-align: center;
  font-size: 0.75rem; color: var(--muted);
}
.login-footer a { color: #c4b08a; text-decoration: none; }
.login-footer a:hover { text-decoration: underline; color: var(--accent); }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; background: rgba(0,0,0,0.25); padding: 4px; border-radius: 12px; }
.tab { flex: 1; border: 0; background: transparent; color: var(--muted); font-weight: 650; padding: 10px; border-radius: 9px; cursor: pointer; }
.tab.active { background: var(--card); color: var(--text); }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 0.75rem; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.field input, .field select {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: rgba(0,0,0,0.25); color: var(--text); font: inherit; font-size: 16px;
}
.opt { font-weight: 400; opacity: 0.7; }
.linkish {
  appearance: none; border: 0; background: none; padding: 0; color: #c4b08a;
  font: inherit; font-size: 0.8rem; font-weight: 650; cursor: pointer; text-decoration: none;
}
.linkish:hover { text-decoration: underline; color: var(--accent); }
.forgot-row { margin: 6px 0 0; text-align: right; }
.forgot-back { margin: 10px 0 0; text-align: center; }
.frac-entry {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 12px;
}
.frac-modes { display: flex; gap: 6px; }
.frac-modes button {
  appearance: none; border: 1px solid var(--border); background: rgba(0,0,0,0.2);
  color: var(--muted); font: inherit; font-size: 0.78rem; font-weight: 650;
  padding: 6px 10px; border-radius: 999px; cursor: pointer;
}
.frac-modes button.active { color: #f0e2b8; border-color: rgba(196,163,90,0.5); background: rgba(196,163,90,0.16); }
.frac-stack {
  display: inline-flex; flex-direction: column; align-items: center; gap: 4px;
  min-width: 88px;
}
.frac-stack input {
  width: 88px; text-align: center; padding: 8px 6px; border-radius: 8px;
  border: 1px solid var(--border); background: rgba(0,0,0,0.25); color: var(--text);
  font: inherit; font-size: 16px;
}
.frac-bar {
  display: block; width: 88px; height: 2px; background: var(--text); border-radius: 2px;
}
.frac-whole {
  width: 64px; text-align: center; padding: 10px 6px; border-radius: 8px;
  border: 1px solid var(--border); background: rgba(0,0,0,0.25); color: var(--text);
  font: inherit; font-size: 16px;
}
.frac-plus { color: var(--muted); font-size: 1.1rem; }
.child-pass-row { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.child-pass-row input {
  flex: 1; min-width: 160px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: rgba(0,0,0,0.25); color: var(--text);
  font: inherit; font-size: 15px;
}
.hint { font-size: 0.78rem; color: var(--muted); margin: 0 0 12px; line-height: 1.4; }
.field-help { font-size: 0.72rem; color: var(--muted); margin: 4px 0 0; line-height: 1.35; }
.error { display: none; background: rgba(224,108,117,0.12); border: 1px solid rgba(224,108,117,0.35); color: var(--danger); padding: 10px; border-radius: 10px; margin-bottom: 12px; font-size: 0.88rem; }
.error.show { display: block; }

.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  isolation: isolate;
}
.header {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: rgba(12,16,24,0.82); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 5;
}
.header-brand {
  font-family: var(--display); font-weight: 700; font-size: 1.15rem;
  display: flex; align-items: center; gap: 8px;
}
.header-wordmark span,
.header-brand span { color: var(--accent); }
.header-logo {
  width: 34px; height: 34px; border-radius: 9px; object-fit: cover;
  border: 1px solid rgba(196,163,90,0.4);
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
}
.nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1 1 auto; }
.header-search-wrap { position: relative; flex: 0 1 220px; min-width: 140px; }
.header-search input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.28);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
}
.header-search input:focus { outline: none; border-color: var(--accent); }
.search-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  min-width: 260px;
  max-height: 320px;
  overflow: auto;
  z-index: 20;
  background: var(--card);
  border: 1px solid var(--border-strong, var(--border));
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.4);
  padding: 6px;
}
.search-hit {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.search-hit:hover, .search-hit:focus { background: rgba(196,163,90,0.12); outline: none; }
.search-hit strong { display: block; font-size: 0.88rem; }
.search-hit span { display: block; font-size: 0.75rem; color: var(--muted); }
.app-shell.is-topic .main { width: min(1100px, 100%); }
.app-shell.is-admin .main { width: min(1180px, 100%); }
.nav-btn {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 650;
  padding: 8px 12px; border-radius: 10px; cursor: pointer;
}
.nav-btn.active { background: rgba(196,163,90,0.15); color: var(--accent); }
.header-user { display: none; }
@media (min-width: 721px) {
  #searchToggle { display: none; }
}
.header-icon-btn {
  appearance: none; border: 1px solid var(--border); background: var(--card);
  color: var(--text); width: 38px; height: 38px; border-radius: 11px;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  flex-shrink: 0;
}
.header-icon-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.header-more { position: relative; flex-shrink: 0; }
.header-more-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 30;
  min-width: 180px; padding: 10px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.4);
}
.header-more-name { font-size: 0.82rem; color: var(--muted); margin: 0 0 8px; word-break: break-word; }
.bottom-nav { display: none; }
.app-toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
  z-index: 80; max-width: min(420px, calc(100vw - 24px));
  padding: 10px 14px; border-radius: 12px; font-size: 0.88rem; font-weight: 650;
  background: var(--card); border: 1px solid var(--border); box-shadow: 0 12px 32px rgba(0,0,0,0.35);
}
.app-toast.is-bad { border-color: rgba(224,108,117,0.45); }
.app-toast.is-ok { border-color: rgba(93,190,138,0.4); }
.progress-details > summary {
  cursor: pointer; font-weight: 700; color: var(--accent); margin-bottom: 8px;
}
.progress-details { margin-top: 18px; }
.drill-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.topic-code {
  display: inline-block; margin-left: 6px; font-size: 0.7rem; font-weight: 700;
  color: var(--muted); letter-spacing: 0.02em;
}
.main { width: min(900px, 100%); margin: 0 auto; padding: 20px 16px 48px; flex: 1; }
.main:has(#view-topic:not(.hidden)) { width: min(1140px, 100%); }
.view h2 { font-family: var(--display); margin-bottom: 8px; }
.muted { color: var(--muted); font-size: 0.9rem; margin-bottom: 16px; }

.grade-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 1.25rem;
}
.grade-chip {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: var(--text, #eef1f6);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, opacity 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.grade-chip:hover { border-color: rgba(196,163,90,0.45); }
.grade-chip.active {
  background: rgba(196,163,90,0.18);
  border-color: rgba(196,163,90,0.55);
  color: #f3e6c0;
}
.grade-chip.not-live {
  opacity: 0.78;
  border-style: dashed;
}
.grade-chip.not-live.active {
  opacity: 1;
  border-style: dashed;
}
.grade-chip-badge {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.12rem 0.38rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.28);
  line-height: 1.2;
}
.grade-chip.active .grade-chip-badge {
  background: rgba(196, 163, 90, 0.2);
  border-color: rgba(196, 163, 90, 0.4);
  color: #e8d5a3;
}
.grade-chip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.grade-roadmap-banner {
  grid-column: 1 / -1;
  border: 1px dashed rgba(148, 163, 184, 0.35);
  background: rgba(148, 163, 184, 0.08);
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.35rem;
}
.grade-roadmap-banner p {
  margin: 0.25rem 0;
}
.grade-roadmap-banner p:first-child {
  margin-top: 0;
}
.grade-roadmap-banner p:last-child {
  margin-bottom: 0;
}
.card-panel {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  background: rgba(0,0,0,0.18);
  margin: 0.75rem 0 1.25rem;
}
.req-subjects {
  display: grid;
  gap: 0.35rem;
  margin: 0.75rem 0;
}
.req-subjects label {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  font-size: 0.92rem;
  cursor: pointer;
}
.field-row.wrap { flex-wrap: wrap; gap: 0.5rem; }
.field-row.wrap select, .field-row.wrap input {
  min-width: 10rem;
  flex: 1;
}
.admin-requests { display: grid; gap: 0.75rem; margin-bottom: 1.25rem; }
.admin-req-card {
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  background: rgba(255,255,255,0.03);
}
.admin-req-card h4 { margin: 0 0 0.35rem; font-size: 1rem; }
.admin-req-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.65rem; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* Courses grouped by subject family */
.course-families { display: flex; flex-direction: column; gap: 1.35rem; }
.family-block { display: flex; flex-direction: column; gap: 10px; }
.family-heading {
  font-family: var(--display);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
.add-course-panel .progress-subh { margin-top: 0; }
.add-course-family { margin-bottom: 0.75rem; }
.add-course-family-title {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.35rem;
}
.req-subjects label.is-enrolled { opacity: 0.7; }

/* Subjects grid — stylish course tiles */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.subject-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 220px;
  padding: 18px 18px 14px;
  border-radius: 18px;
  border: 1px solid rgba(180, 150, 90, 0.22);
  background:
    linear-gradient(165deg, rgba(30, 38, 54, 0.98), rgba(16, 20, 30, 0.96));
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.subject-card::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--subject-accent, var(--accent));
  opacity: 0.9;
}
.subject-card::after {
  content: "";
  position: absolute; right: -40px; top: -40px;
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, var(--subject-glow, rgba(196,163,90,0.16)), transparent 70%);
  pointer-events: none;
}
.subject-card:hover, .subject-card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--subject-accent, var(--accent));
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.38);
  outline: none;
}
.subject-card.soon {
  cursor: default;
  opacity: 0.88;
}
.subject-card.soon:hover { transform: none; }
.subject-card.ready { border-color: rgba(93, 190, 138, 0.28); }

.subject-card.accent-gold { --subject-accent: #c4a35a; --subject-glow: rgba(196,163,90,0.2); }
.subject-card.accent-teal { --subject-accent: #5dbe8a; --subject-glow: rgba(93,190,138,0.18); }
.subject-card.accent-violet { --subject-accent: #9b8cff; --subject-glow: rgba(155,140,255,0.18); }
.subject-card.accent-rose { --subject-accent: #e06c75; --subject-glow: rgba(224,108,117,0.16); }
.subject-card.accent-amber { --subject-accent: #e0a458; --subject-glow: rgba(224,164,88,0.18); }
.subject-card.accent-slate { --subject-accent: #6a7588; --subject-glow: rgba(106,117,136,0.16); }

.subject-card-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  position: relative; z-index: 1;
}
.subject-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  font-size: 1.25rem; font-weight: 700;
  background: rgba(0,0,0,0.28);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--subject-accent, var(--accent));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}
.subject-badges { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.subject-grade, .subject-status {
  font-size: 0.65rem; font-weight: 750; letter-spacing: 0.05em;
  text-transform: uppercase; padding: 4px 8px; border-radius: 999px;
}
.subject-grade {
  color: var(--muted); background: rgba(0,0,0,0.28); border: 1px solid var(--border);
}
.subject-status.is-live {
  color: #9de0b8; background: rgba(93,190,138,0.15); border: 1px solid rgba(93,190,138,0.35);
}
.subject-status.is-soon {
  color: var(--muted); background: rgba(0,0,0,0.22); border: 1px solid var(--border);
}
.subject-title {
  position: relative; z-index: 1;
  font-family: var(--display); font-size: 1.2rem; font-weight: 700;
  margin: 2px 0 0; line-height: 1.2;
}
.subject-sub {
  position: relative; z-index: 1;
  font-size: 0.8rem; color: var(--subject-accent, var(--accent)); font-weight: 600;
  margin: 0;
}
.subject-blurb {
  position: relative; z-index: 1;
  font-size: 0.82rem; color: var(--muted); line-height: 1.4; margin: 0;
  flex: 1;
}

/* CA standards chip on each tile */
.subject-std {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  margin-top: 4px; padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none !important;
  color: inherit;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(196, 163, 90, 0.28);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.subject-std:hover {
  background: rgba(196, 163, 90, 0.12);
  border-color: rgba(196, 163, 90, 0.55);
}
.subject-std-ico {
  flex-shrink: 0;
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 0.9rem;
  color: #f0e2b8;
  background: rgba(196, 163, 90, 0.2);
  border: 1px solid rgba(196, 163, 90, 0.35);
}
.subject-std-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.subject-std-kicker {
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--muted);
}
.subject-std-name {
  font-size: 0.78rem; font-weight: 650; color: #e8ecf4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.subject-std-go {
  flex-shrink: 0; color: var(--accent); font-weight: 700; font-size: 0.95rem;
}
.subject-card-foot {
  position: relative; z-index: 1;
  display: flex; justify-content: flex-end; margin-top: 2px;
}
.subject-cta {
  font-size: 0.78rem; font-weight: 700;
  color: var(--subject-accent, var(--accent));
}
.subject-card.soon .subject-cta { color: var(--muted); font-weight: 600; }

@media (max-width: 640px) {
  .card-grid { grid-template-columns: 1fr; }
}

/* Dedicated course page (units/topics) — separate from subject tiles */
.course-nav { margin-bottom: 12px; }
.course-header {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
  gap: 14px; margin-bottom: 20px;
  padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.course-kicker {
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 6px;
}
.course-header h2 { margin-bottom: 6px; }
.course-header .muted { margin-bottom: 0; max-width: 36rem; }
.course-std-link {
  display: flex; flex-direction: column; gap: 2px;
  text-decoration: none !important; color: inherit;
  padding: 10px 14px; border-radius: 12px;
  background: rgba(196,163,90,0.1); border: 1px solid rgba(196,163,90,0.35);
  min-width: 160px;
}
.course-std-link:hover { background: rgba(196,163,90,0.18); border-color: var(--accent); }
.course-std-kicker {
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted);
}
.course-std-link #courseStandardsLabel,
.course-std-link span:last-child {
  font-size: 0.84rem; font-weight: 700; color: #f0e2b8;
}

.pack-tree { margin-top: 4px; }
.unit-block {
  margin-bottom: 20px;
  padding: 14px 14px 10px;
  border-radius: 16px;
  background: rgba(0,0,0,0.18);
  border: 1px solid var(--border);
}
.unit-block h3 {
  font-size: 1rem; color: var(--accent); margin-bottom: 10px;
  display: flex; align-items: center; gap: 10px;
}
.unit-num {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0;
  font-size: 0.75rem; font-weight: 800;
  background: rgba(196,163,90,0.18); color: #f0e2b8;
  border: 1px solid rgba(196,163,90,0.35);
}
.topic-list { display: flex; flex-direction: column; gap: 8px; }
.topic-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 12px 14px; background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}
.topic-row:hover, .topic-row:focus-visible {
  border-color: var(--accent); background: rgba(196,163,90,0.08); outline: none;
  transform: translateX(2px);
}
.topic-row-title { font-weight: 650; font-size: 0.95rem; }
.topic-row-meta { font-size: 0.78rem; color: var(--muted); white-space: nowrap; font-weight: 600; }

.lesson {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 20px 18px 24px; margin: 12px 0 16px; line-height: 1.6; font-size: 0.95rem;
  max-width: 100%; overflow-x: auto;
}
.lesson h1 {
  font-family: var(--display); font-size: 1.35rem; margin: 0 0 14px;
  color: var(--accent); letter-spacing: -0.02em; line-height: 1.25;
}
.lesson h2 {
  font-family: var(--display); font-size: 1.08rem; margin: 22px 0 10px;
  padding-top: 8px; border-top: 1px solid var(--border); color: var(--text);
}
.lesson h3 { font-size: 0.98rem; margin: 16px 0 8px; color: #d4c09a; }
.lesson ul, .lesson ol { margin: 8px 0 12px 1.25em; }
.lesson li { margin-bottom: 6px; }
.lesson p { margin-bottom: 10px; }
.lesson a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.lesson code {
  font-size: 0.88em; background: rgba(0,0,0,0.35); padding: 1px 6px; border-radius: 6px;
}
.lesson strong { color: #f0e6c8; }
.lesson .callout, .lesson blockquote.callout {
  margin: 12px 0; padding: 12px 14px; border-radius: 12px;
  border-left: 3px solid var(--accent);
  background: rgba(196,163,90,0.1); color: var(--text); font-style: normal;
}
.geo-fig {
  margin: 16px auto; padding: 12px; border-radius: 14px;
  background: rgba(0,0,0,0.28); border: 1px solid var(--border);
  text-align: center; max-width: 420px;
}
.geo-svg { width: 100%; max-width: 380px; height: auto; display: block; margin: 0 auto; }
.geo-fig figcaption {
  margin-top: 8px; font-size: 0.8rem; color: var(--muted); line-height: 1.35;
}
.table-wrap { overflow-x: auto; margin: 12px 0 16px; }
.lesson-table {
  width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 260px;
}
.lesson-table th, .lesson-table td {
  border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top;
}
.lesson-table th {
  background: rgba(196,163,90,0.12); color: var(--accent); font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.lesson-table tr:nth-child(even) td { background: rgba(0,0,0,0.15); }

/* CA standard + Khan learn-first banner */
.std-banner {
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(106, 168, 200, 0.4);
  background: linear-gradient(135deg, rgba(106,168,200,0.14), rgba(196,163,90,0.08));
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
}
.std-row {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px;
  margin-bottom: 8px; font-size: 0.92rem; line-height: 1.4;
}
.std-row:last-of-type { margin-bottom: 6px; }
.std-label {
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
  min-width: 5.5rem;
}
.std-banner strong { color: #9fd0e8; font-weight: 750; }

/* Speakable sentence + browser TTS (explicit [[say:lang|…]] markers) */
.say {
  display: inline;
  white-space: normal;
}
.say-text {
  font-style: italic;
  color: #e8eef8;
}
.say-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  margin: 0 0 0 6px;
  padding: 0;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  border: 1px solid rgba(196, 163, 90, 0.45);
  background: rgba(196, 163, 90, 0.16);
  color: #f0e2b8;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.say-btn:hover, .say-btn:focus-visible {
  background: rgba(196, 163, 90, 0.32);
  border-color: var(--accent);
  outline: none;
  transform: scale(1.06);
}
.say-btn.say-playing {
  background: rgba(93, 190, 138, 0.22);
  border-color: rgba(93, 190, 138, 0.55);
  color: #b8f0d0;
  animation: sayPulse 1.1s ease-in-out infinite;
}
.say-btn.say-unsupported {
  opacity: 0.45;
  cursor: not-allowed;
}
.say-ico { pointer-events: none; }
@keyframes sayPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(93, 190, 138, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(93, 190, 138, 0); }
}

.khan-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: #f0e2b8 !important; font-weight: 700; text-decoration: none !important;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(196,163,90,0.22); border: 1px solid rgba(196,163,90,0.45);
}
.khan-link:hover { background: rgba(196,163,90,0.35); border-color: var(--accent); }
.std-hint {
  margin: 4px 0 0; font-size: 0.8rem; color: var(--muted); line-height: 1.35;
}
.std-locate {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #d5dbe6;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(106, 168, 200, 0.28);
}
.std-locate-label {
  display: inline-block;
  margin-right: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #9fd0e8;
  background: rgba(106, 168, 200, 0.18);
  border: 1px solid rgba(106, 168, 200, 0.35);
  vertical-align: baseline;
}
.lesson-svg {
  width: 100%; max-width: 420px; height: auto; display: block;
  margin: 12px auto; border-radius: 12px;
  background: rgba(0,0,0,0.2);
}
.callout {
  border-left: 3px solid var(--accent); padding: 10px 14px; margin: 12px 0;
  background: rgba(196,163,90,0.08); border-radius: 0 10px 10px 0;
  color: var(--text);
}

/* Interactive “Try it” panels */
.ix-host { margin: 16px 0 18px; }
.ix-panel {
  border: 1px solid rgba(196,163,90,0.35);
  border-radius: 16px;
  background: linear-gradient(165deg, rgba(196,163,90,0.1), rgba(0,0,0,0.25));
  padding: 14px 14px 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.25);
}
.ix-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ix-badge {
  font-size: 0.65rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 999px; background: rgba(93,190,138,0.2);
  color: var(--good); border: 1px solid rgba(93,190,138,0.35);
}
.ix-title { font-family: var(--display); font-weight: 700; font-size: 0.98rem; }
.ix-sub { font-size: 0.85rem; color: var(--muted); margin: 0 0 10px; line-height: 1.4; }
.ix-svg { width: 100%; max-width: 400px; height: auto; display: block; margin: 0 auto 8px; }
.ix-controls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 8px; }
.ix-controls-wrap { max-width: 420px; margin-left: auto; margin-right: auto; }
.ix-btn {
  appearance: none; border: 1px solid var(--border); background: rgba(0,0,0,0.3);
  color: var(--text); font: inherit; font-size: 0.82rem; font-weight: 650;
  padding: 8px 12px; border-radius: 999px; cursor: pointer;
}
.ix-btn:hover { border-color: var(--accent); }
.ix-btn.active {
  background: rgba(196,163,90,0.22); border-color: rgba(196,163,90,0.5); color: #f0e2b8;
}
.ix-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ix-tip {
  margin: 10px 0 0; font-size: 0.82rem; color: var(--muted); line-height: 1.4; text-align: center;
}
.ix-match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 8px 0; }
.ix-col { display: flex; flex-direction: column; gap: 8px; }
.ix-chip {
  appearance: none; border: 1px solid var(--border); background: rgba(0,0,0,0.28);
  color: var(--text); font: inherit; font-weight: 600; padding: 10px 12px;
  border-radius: 12px; cursor: pointer; text-align: left;
}
.ix-chip.picked { border-color: var(--accent); background: rgba(196,163,90,0.15); }
.ix-chip.done { border-color: var(--good); background: rgba(93,190,138,0.15); color: var(--good); pointer-events: none; }
.ix-chip.shake { animation: ix-shake 0.35s ease; }
@keyframes ix-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.topic-learn-label { margin-bottom: 8px !important; }

.drill-panel { margin-top: 12px; }
.drill-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 20px;
}
.drill-stem {
  font-size: 1.05rem; line-height: 1.5; margin-bottom: 16px;
  white-space: pre-wrap;
}
.choices { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.choice {
  text-align: left; width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: rgba(0,0,0,0.2); color: var(--text);
  font: inherit; cursor: pointer;
}
.choice:hover, .choice.selected { border-color: var(--accent); background: rgba(196,163,90,0.1); }
.choice.correct { border-color: var(--good); background: rgba(93,190,138,0.12); }
.choice.wrong { border-color: var(--danger); background: rgba(224,108,117,0.12); }
.drill-input {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: rgba(0,0,0,0.25); color: var(--text); font: inherit; font-size: 16px; margin-bottom: 12px;
}
.feedback { margin-top: 12px; padding: 12px; border-radius: 12px; font-size: 0.9rem; line-height: 1.45; }
.feedback.ok { background: rgba(93,190,138,0.12); border: 1px solid rgba(93,190,138,0.35); }
.feedback.bad { background: rgba(224,108,117,0.12); border: 1px solid rgba(224,108,117,0.35); }
.feedback.teach-wrap {
  background: linear-gradient(165deg, rgba(106,168,200,0.12), rgba(224,108,117,0.08));
  border: 1px solid rgba(106,168,200,0.4);
  padding: 0;
  overflow: hidden;
}
.teach-panel { padding: 14px 16px 16px; }
.teach-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.teach-head strong { font-size: 1rem; color: #eef1f6; }
.teach-badge {
  font-size: 0.65rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 999px;
  background: rgba(106,168,200,0.22); color: #9fd0e8;
  border: 1px solid rgba(106,168,200,0.45);
}
.teach-missed { margin: 0 0 12px; font-size: 0.9rem; }
.teach-body {
  font-size: 0.9rem; line-height: 1.5;
  background: rgba(0,0,0,0.22); border-radius: 12px; padding: 12px 14px;
  margin-bottom: 10px;
}
.teach-body h3, .teach-body h4 { margin: 0.4em 0 0.35em; font-size: 0.95rem; color: var(--accent); }
.teach-body p { margin: 0.4em 0; }
.teach-body ul { margin: 0.4em 0 0.4em 1.1em; }
.teach-steps { margin: 0 0 12px 1.1em; font-size: 0.88rem; color: var(--text); }
.teach-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.teach-hint { margin: 10px 0 0; font-size: 0.8rem; }
.retry-badge {
  display: inline-block; margin-left: 6px; font-size: 0.68rem; font-weight: 750;
  letter-spacing: 0.03em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px;
  background: rgba(224,164,88,0.2); color: #e0a458;
  border: 1px solid rgba(224,164,88,0.4); vertical-align: middle;
}
.drill-meta { font-size: 0.8rem; color: var(--muted); margin-bottom: 10px; }
.drill-input-hint { font-size: 0.78rem; margin: 6px 0 0; }
.drill-input-hint code { font-size: 0.85em; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.stat .l { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat .v { font-family: var(--display); font-size: 1.4rem; font-weight: 700; margin-top: 4px; }
.progress-lead { margin: -4px 0 14px; font-size: 0.92rem; }
.progress-subh { margin: 18px 0 10px; font-size: 1rem; font-weight: 600; color: var(--text); }
.topic-bars { display: flex; flex-direction: column; gap: 10px; }
.tbar { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.tbar-top { display: flex; justify-content: space-between; font-size: 0.88rem; margin-bottom: 6px; gap: 10px; }
.tbar-sub { font-style: normal; color: var(--muted); font-size: 0.75rem; margin-left: 6px; text-transform: capitalize; }
.tbar-track { height: 8px; border-radius: 999px; background: rgba(0,0,0,0.3); overflow: hidden; }
.tbar-fill { height: 100%; background: var(--accent); border-radius: 999px; }
.tbar.heat-hot { border-color: rgba(196,163,90,0.55); }
.tbar.heat-warm { border-color: rgba(93,190,138,0.35); }
.tbar.heat-cold { opacity: 0.92; }
.unit-heat { display: flex; flex-direction: column; gap: 16px; margin-bottom: 8px; }
.unit-group-title { font-size: 0.85rem; color: var(--accent); margin: 0 0 8px; letter-spacing: 0.02em; }
.unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.unit-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 14px;
}
.unit-card.heat-hot { box-shadow: 0 0 0 1px rgba(196,163,90,0.25); border-color: rgba(196,163,90,0.5); }
.unit-card.heat-warm { border-color: rgba(93,190,138,0.4); }
.unit-card-top { display: flex; justify-content: space-between; gap: 8px; font-size: 0.86rem; margin-bottom: 8px; }
.unit-card-top strong { font-weight: 600; }
.heat-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.heat-chip {
  font-size: 0.7rem; padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); background: rgba(0,0,0,0.2);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.heat-chip.heat-hot { background: rgba(196,163,90,0.18); color: #e8d5a3; border-color: rgba(196,163,90,0.45); }
.heat-chip.heat-warm { background: rgba(93,190,138,0.12); color: #9fd9b8; border-color: rgba(93,190,138,0.35); }
.heat-chip.heat-cold { opacity: 0.75; }
.teach-panel .teach-body { font-size: 0.92rem; line-height: 1.55; max-height: 320px; overflow: auto; }
.teach-panel .teach-body h3, .teach-panel .teach-body h4 { margin: 0.6em 0 0.35em; font-size: 0.95rem; color: var(--accent); }
.teach-panel .teach-steps { margin: 10px 0 0; padding-left: 1.1rem; color: var(--text); }
.teach-panel .teach-steps li { margin-bottom: 6px; }

.admin-out {
  margin-top: 12px; padding: 12px; background: rgba(0,0,0,0.3); border-radius: 10px;
  font-size: 0.8rem; overflow: auto; white-space: pre-wrap; color: var(--muted);
}
.admin-layout {
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.admin-nav {
  position: sticky;
  top: 76px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0,0,0,0.18);
}
.admin-nav-kicker {
  margin: 2px 8px 8px;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.admin-nav-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 650;
  text-align: left;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.admin-nav-btn:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.admin-nav-btn.active { background: rgba(196,163,90,0.15); color: var(--accent); }
.admin-nav-count {
  min-width: 1.4em;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 750;
  color: inherit;
  opacity: 0.85;
}
.admin-nav-count:empty { display: none; }
.admin-pane { animation: none; }
.admin-pane-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.admin-pane-head .muted { margin-bottom: 0; }
.admin-back { margin: 0 0 12px; }
.admin-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.family-onboard { margin: 8px 0 16px; }
#addStudentBtn { margin: 0 0 12px; }
.course-picker {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}
.course-pick {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.86rem;
  line-height: 1.35;
}
.course-pick input { margin-top: 3px; }
.fam-st-courses { width: 100%; margin-top: 8px; }
.family-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px 12px;
  margin: 0 0 10px;
  background: rgba(0,0,0,0.18);
}
.family-block legend {
  padding: 0 6px;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--accent);
}
.family-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 8px;
}
.family-share-text {
  width: 100%;
  box-sizing: border-box;
  min-height: 16rem;
  margin-top: 8px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.35);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.45;
  resize: vertical;
  white-space: pre-wrap;
}
.family-list { display: grid; gap: 8px; margin: 12px 0 18px; }
.family-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  display: grid;
  gap: 10px;
}
.family-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 12px;
}
.family-card h3 { margin: 0 0 4px; font-size: 1.02rem; }
.family-card p { margin: 0; font-size: 0.88rem; }
.family-card .muted { font-size: 0.8rem; margin: 0; }
.family-members { display: grid; gap: 6px; }
.family-member {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 8px 10px;
  align-items: center;
  font-size: 0.84rem;
}
.family-member-slot { color: var(--muted); font-weight: 650; font-size: 0.75rem; }
.family-member-who { min-width: 0; }
.family-member-who strong { display: block; font-size: 0.86rem; }
.family-member-who span { display: block; color: var(--muted); font-size: 0.76rem; word-break: break-all; }
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.status-pill.is-pending { background: rgba(224,164,88,0.14); color: #e0a458; border-color: rgba(224,164,88,0.35); }
.status-pill.is-partial { background: rgba(106,168,200,0.14); color: #8ec4dd; border-color: rgba(106,168,200,0.35); }
.status-pill.is-registered { background: rgba(93,190,138,0.14); color: #8fd4ae; border-color: rgba(93,190,138,0.35); }
.field-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.field-row input, .field-row select {
  flex: 1; min-width: 120px; padding: 10px; border-radius: 10px; border: 1px solid var(--border);
  background: rgba(0,0,0,0.25); color: var(--text); font: inherit;
}
.child-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; margin-bottom: 12px; }
.child-card h3 { margin-bottom: 8px; }

.today-plan { margin: 4px 0 14px; }
.today-plan-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 16px 14px;
}
.today-plan-sentence {
  margin: 0 0 12px;
  font-size: 1.02rem;
  font-weight: 650;
  line-height: 1.4;
}
.today-plan-rows {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-bottom: 14px;
}
.today-plan-pill {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  min-width: 88px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.22);
}
.today-plan-pill em {
  font-style: normal;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.today-plan-pill strong { font-size: 1.05rem; }
.today-plan-courses { margin: 0 0 14px; font-size: 0.86rem; color: var(--muted); }
.drill-recap h3 { margin: 0 0 8px; font-family: var(--display); }
.drill-recap .recap-score {
  font-family: var(--display);
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 0 6px;
}
.drill-recap .recap-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.progress-sentence {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(196, 163, 90, 0.35);
  background: rgba(196, 163, 90, 0.08);
  font-weight: 600;
  line-height: 1.45;
}
.course-ready { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-bottom: 18px; }
.course-ready-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  cursor: pointer;
}
.course-ready-card:hover { border-color: var(--accent); }
.course-ready-card.ready-exam_ready { border-color: rgba(196, 163, 90, 0.55); }
.course-ready-card.ready-secure { border-color: rgba(93, 190, 138, 0.4); }
.course-ready-kicker {
  font-size: 0.68rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--accent);
  margin: 0 0 6px;
}
.course-ready-card p { margin: 0; font-size: 0.88rem; line-height: 1.4; color: var(--text); }
.ready-pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.ready-pill.exam_ready { color: #e8d5a3; border-color: rgba(196,163,90,0.45); background: rgba(196,163,90,0.16); }
.ready-pill.secure { color: #9fd9b8; border-color: rgba(93,190,138,0.4); background: rgba(93,190,138,0.12); }
.ready-pill.building { color: #e0a458; border-color: rgba(224,164,88,0.4); background: rgba(224,164,88,0.12); }
.tbar.is-click { cursor: pointer; }
.tbar.is-click:hover { border-color: var(--accent); }
.topic-row.heat-hot { border-color: rgba(196,163,90,0.45); }
.topic-row.heat-warm { border-color: rgba(93,190,138,0.32); }
.topic-row-ready { margin-left: 8px; }

.ready-ring { display: block; flex-shrink: 0; }
.ready-ring .rr-track { fill: none; stroke: rgba(255,255,255,0.08); stroke-width: 6; }
.ready-ring .rr-prog {
  fill: none; stroke: var(--accent); stroke-width: 6;
  stroke-linecap: round; transform: rotate(-90deg); transform-origin: 32px 32px;
}
.ready-ring.building .rr-prog { stroke: #e0a458; }
.ready-ring.secure .rr-prog { stroke: #5dbe8a; }
.ready-ring.exam_ready .rr-prog { stroke: #c4a35a; }
.ready-ring.not_started .rr-prog { stroke: rgba(255,255,255,0.2); }
.ready-ring text { fill: var(--text); font-size: 12px; font-weight: 750; font-family: var(--display); }
.course-ready-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px 14px;
  align-items: start;
}
.course-ready-body { min-width: 0; }
.course-concern {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(224,164,88,0.12);
  border: 1px solid rgba(224,164,88,0.35);
  font-size: 0.84rem;
  line-height: 1.4;
}
.course-exam-line { margin: 6px 0 0; font-size: 0.82rem; color: var(--muted); }
.exam-set {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; align-items: center;
}
.exam-set input[type="date"], .exam-set input[type="text"] {
  background: rgba(0,0,0,0.28); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 0.8rem;
}
.exam-set input[type="text"] { min-width: 120px; flex: 1; }
.weak-chip {
  appearance: none; border: 1px solid var(--border); background: rgba(0,0,0,0.22);
  color: var(--text); font: inherit; font-size: 0.72rem; font-weight: 650;
  padding: 3px 8px; border-radius: 999px; cursor: pointer;
}
.weak-chip:hover { border-color: var(--accent); color: var(--accent); }
.ing-row {
  display: grid; grid-template-columns: 72px 1fr 36px; gap: 6px; align-items: center;
  font-size: 0.72rem; color: var(--muted); margin-top: 4px;
}
.ing-bar { height: 5px; border-radius: 99px; background: rgba(255,255,255,0.08); overflow: hidden; }
.ing-bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.ing-row.is-hard .ing-bar > i { background: #6aa8c8; }
.ing-row.is-ret .ing-bar > i { background: #5dbe8a; }
.child-card-meta { font-size: 0.82rem; color: var(--muted); margin: 0 0 12px; }
.parent-course { margin-top: 12px; }
.parent-more { margin-top: 22px; }
.parent-more > summary {
  cursor: pointer; font-weight: 700; color: var(--accent); margin-bottom: 10px;
}
.topic-preview-banner {
  font-size: 0.82rem; color: var(--muted); margin: 0 0 10px;
  padding: 8px 10px; border-radius: 10px; background: rgba(196,163,90,0.08);
}

.recents-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.recents-inline { margin: 0 0 0 auto; }
.recent-chip {
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.22);
  color: var(--muted);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 650;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
}
.recent-chip:hover { color: var(--accent); border-color: var(--accent); }

.topic-head { margin-bottom: 16px; }
.topic-kicker {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--accent);
  margin: 0 0 4px;
}
.topic-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.topic-nav {
  position: sticky;
  top: 72px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 12px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.18);
}
.topic-nav-kicker {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 6px 4px;
}
.topic-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 10px 12px;
  border-radius: 14px;
  text-decoration: none;
  color: var(--text);
  border: 1px solid transparent;
  background: rgba(0,0,0,0.18);
}
.topic-nav-item:hover {
  border-color: rgba(196,163,90,0.35);
  background: rgba(196,163,90,0.08);
}
.topic-nav-item.is-active {
  border-color: rgba(196,163,90,0.5);
  background: rgba(196,163,90,0.16);
}
.topic-nav-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.topic-nav-num {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.05rem;
  color: #f0e2b8;
  background: rgba(196,163,90,0.2);
  border: 1px solid rgba(196,163,90,0.35);
}
.topic-nav-item.is-active .topic-nav-num {
  background: rgba(196,163,90,0.42);
  border-color: rgba(196,163,90,0.6);
}
.topic-nav-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.topic-nav-copy strong {
  font-size: 0.98rem;
  font-weight: 750;
  line-height: 1.2;
}
.topic-nav-copy em {
  font-style: normal;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 550;
  line-height: 1.3;
}
.topic-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px 20px 22px;
  margin-bottom: 16px;
  scroll-margin-top: 88px;
}
.topic-panel-head { margin-bottom: 14px; }
.topic-panel-kicker {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 4px;
}
.topic-panel-head h3 {
  font-family: var(--display);
  font-size: 1.28rem;
  margin: 0 0 4px;
}
.topic-panel-head .muted { margin: 0; }
.topic-brief {
  background: rgba(196,163,90,0.08);
  border: 1px solid rgba(196,163,90,0.32);
  border-radius: 16px;
  padding: 16px 16px 14px;
  margin-bottom: 16px;
}
.topic-brief h3 { font-family: var(--display); font-size: 1rem; margin: 0 0 8px; }
.topic-brief ol { margin: 0 0 10px 1.15em; }
.topic-brief li { margin-bottom: 4px; font-size: 0.92rem; line-height: 1.45; }
.topic-brief .ix-host { margin-top: 8px; }
.topic-jump {
  appearance: none;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
}
.topic-jump:hover { text-decoration: underline; }
.topic-shelf, .topic-refs { margin: 0; }
.topic-shelf-lead { font-size: 0.88rem; color: var(--muted); margin: 0 0 12px; }
.shelf-list { display: flex; flex-direction: column; gap: 10px; }
.shelf-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0,0,0,0.16);
}
.shelf-item a { color: var(--accent); font-weight: 650; text-decoration: none; }
.shelf-item a:hover { text-decoration: underline; }
.shelf-meta { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 3px; line-height: 1.35; }
.shelf-done {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.shelf-done input { accent-color: var(--accent); }
.topic-ref-std {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(106,168,200,0.35);
  background: linear-gradient(135deg, rgba(106,168,200,0.12), rgba(196,163,90,0.06));
  margin-bottom: 12px;
}
.topic-ref-std p {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  color: #d7ecf6;
}
#topicLesson.lesson {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin: 0;
}
#topicLesson .std-banner { display: none; }
#topicLesson.lesson > h1:first-child { display: none; }
#topicLesson.lesson h2:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.topic-prove { margin-bottom: 28px; }
.topic-prove > .btn-primary {
  width: 100%;
  max-width: 340px;
  padding: 14px 18px;
  font-size: 1.02rem;
}
.topic-prove-head h3 { font-family: var(--display); margin: 0 0 4px; }
.topic-prove-head .muted { margin-bottom: 12px; }
.topic-prove-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.course-go-btn { margin-top: 10px; }
.unit-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 8px;
}
.unit-head h3 { margin: 0; display: flex; align-items: center; gap: 8px; }
.unit-check-btn { flex-shrink: 0; }
.drill-timer {
  float: right;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  color: var(--accent);
}
.drill-timer.is-low { color: var(--danger); }
.teach-jump { margin-top: 8px; }
.recap-ready { margin: 10px 0 0; }
.lesson-fig { margin: 12px 0; }
.lesson-fig img { max-width: 100%; border-radius: 10px; border: 1px solid var(--border); }
.lesson-fig figcaption { font-size: 0.78rem; color: var(--muted); margin-top: 6px; }

@media (max-width: 860px) {
  .topic-shell { grid-template-columns: 1fr; gap: 12px; }
  .topic-nav {
    position: sticky;
    top: 62px;
    z-index: 6;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 8px;
  }
  .topic-nav-kicker { display: none; }
  .topic-nav-item {
    min-width: 0;
    min-height: 58px;
    padding: 10px 10px;
  }
  .topic-nav-copy em { display: none; }
  .topic-panel { scroll-margin-top: 196px; }
}

@media (max-width: 720px) {
  .admin-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .admin-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    padding: 6px;
  }
  .admin-nav-kicker { display: none; }
  .admin-nav-btn { flex: 0 0 auto; white-space: nowrap; }
  .family-member { grid-template-columns: 64px minmax(0, 1fr); }
  .family-member .status-pill { grid-column: 2; justify-self: start; }
  .header { padding: 10px 12px; }
  .nav-desktop .nav-btn[data-view="today"],
  .nav-desktop .nav-btn[data-view="subjects"],
  .nav-desktop .nav-btn[data-view="progress"] { display: none; }
  .header-search-wrap {
    display: none;
    position: absolute;
    left: 12px; right: 12px; top: calc(100% + 6px);
    flex: none; min-width: 0; z-index: 25;
  }
  .header-search-wrap.is-open { display: block; }
  .header { position: sticky; }
  .bottom-nav {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 40;
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom, 0px));
    background: rgba(12,16,24,0.94);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(12px);
    justify-content: space-around;
    gap: 4px;
  }
  .bottom-nav-btn {
    flex: 1; border: 0; background: transparent; color: var(--muted);
    font: inherit; font-weight: 750; font-size: 0.78rem;
    padding: 10px 6px; border-radius: 10px; cursor: pointer;
  }
  .bottom-nav-btn.active { color: var(--accent); background: rgba(196,163,90,0.14); }
  .app-shell { padding-bottom: 72px; }
  .app-toast { bottom: 88px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .topic-nav { top: 56px; }
  .topic-panel { padding: 16px 14px 18px; }
  .recents-inline { margin: 8px 0 0; width: 100%; }
}

@media print {
  .header, .login-screen, .boot-splash, .nav, .header-search-wrap,
  .header-user, .course-nav, .topic-prove, .topic-shelf,
  #todayPlan, #todayDrill, #startTopicDrill { display: none !important; }
  .app-shell::before { display: none; }
  body { background: #fff; color: #111; }
  .main { width: 100%; max-width: none; }
  .topic-shell { display: block; }
  .topic-nav { display: none !important; }
  .topic-panel { background: #fff; border-color: #ccc; color: #111; }
  .lesson { background: #fff; border: 0; color: #111; }
}
