:root {
  color-scheme: light;
  --ink: #0F172A;
  --muted: #475569;
  --line: #E2E8F0;
  --paper: #F8FAFC;
  --white: #ffffff;
  --card: #ffffff;
  --surface: #F8FAFC;
  --surface-strong: #ffffff;
  --topbar-bg: rgba(255,255,255,0.94);
  --hero-copy: #243246;
  --teal: #16A34A;
  --teal-dark: #15803D;
  --teal-soft: #DCFCE7;
  --gold: #f2b84b;
  --red: #c94b4b;
  --green: #16A34A;
  --blue: #2454a6;
  --shadow: 0 18px 48px rgba(17, 24, 39, 0.12);
  --soft-shadow: 0 10px 28px rgba(17, 24, 39, 0.07);
  --hero-overlay:
    linear-gradient(90deg, rgba(255,255,255,0.98) 0%, rgba(255,255,255,0.9) 39%, rgba(255,255,255,0.18) 76%),
    linear-gradient(180deg, transparent 68%, rgba(248,250,252,0.96) 100%);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #F8FAFC;
  --muted: #CBD5E1;
  --line: #334155;
  --paper: #0B1120;
  --white: #1E293B;
  --card: #1E293B;
  --surface: #111827;
  --surface-strong: #1E293B;
  --topbar-bg: rgba(17,24,39,0.92);
  --hero-copy: #E2E8F0;
  --teal: #22C55E;
  --teal-dark: #16A34A;
  --teal-soft: rgba(34, 197, 94, 0.14);
  --green: #22C55E;
  --blue: #60A5FA;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
  --soft-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
  --hero-overlay:
    linear-gradient(90deg, rgba(11,17,32,0.96) 0%, rgba(11,17,32,0.86) 43%, rgba(11,17,32,0.24) 78%),
    linear-gradient(180deg, transparent 62%, rgba(11,17,32,0.98) 100%);
}

* { box-sizing: border-box; }
html {
  background: var(--paper);
}
body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(22, 163, 74, 0.08), transparent 34rem),
    linear-gradient(180deg, var(--surface-strong) 0%, var(--paper) 44%, var(--surface) 100%);
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
body,
.topbar,
.page,
.strip,
.feature-card,
.subject-card,
.price-card,
.auth-card,
.panel,
.metric-card,
.sidebar,
.workspace,
input,
textarea,
select,
button,
a,
table,
.hero-overlay {
  transition: background-color 300ms ease, color 300ms ease, border-color 300ms ease, box-shadow 300ms ease;
}
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid rgba(242, 184, 75, 0.55);
  outline-offset: 2px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 32px;
  border-bottom: 1px solid rgba(217, 225, 232, 0.85);
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.04);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: white;
  background: linear-gradient(135deg, #c8102e, #e31b3f);
  border-radius: 8px;
  box-shadow: inset 0 -8px 18px rgba(0,0,0,0.12);
}
.public-nav {
  display: flex;
  gap: 18px;
  margin-left: auto;
}
.public-nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  padding: 9px 10px;
  border-radius: 8px;
}
.public-nav a:hover, .public-nav a.active { color: var(--teal); background: var(--teal-soft); }
.top-actions { display: flex; gap: 10px; }
.menu-btn { display: none; }
.theme-toggle {
  position: relative;
  width: 46px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  overflow: hidden;
  box-shadow: var(--soft-shadow);
}
.theme-icon {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  line-height: 1;
  transition: transform 260ms ease, opacity 260ms ease;
}
.theme-icon.moon {
  opacity: 0;
  transform: translateY(18px) rotate(-45deg);
}
:root[data-theme="dark"] .theme-icon.sun {
  opacity: 0;
  transform: translateY(-18px) rotate(45deg);
}
:root[data-theme="dark"] .theme-icon.moon {
  opacity: 1;
  transform: translateY(0) rotate(0);
}
.theme-toggle:hover {
  border-color: rgba(34, 197, 94, 0.42);
  background: var(--teal-soft);
}
.hero-logo {
  width: 100%;
  max-width: 320px;
  height: auto;
  margin-bottom: 26px;
  object-fit: contain;
}
.hero-logo .brand-mark {
  width: 58px;
  height: 58px;
  border-radius: 12px;
  font-size: 2rem;
}
.hero-logo span:not(.brand-mark) {
  font-size: clamp(3rem, 7vw, 5.2rem);
  line-height: 0.92;
}

.primary-btn, .ghost-btn, .light-btn {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 800;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.primary-btn { color: white; background: linear-gradient(135deg, var(--teal), var(--teal-dark)); box-shadow: 0 10px 22px rgba(22, 163, 74, 0.2); }
.primary-btn:hover { background: linear-gradient(135deg, var(--teal-dark), var(--teal)); transform: translateY(-1px); }
.ghost-btn { color: var(--teal); background: var(--teal-soft); }
.ghost-btn:hover { background: rgba(34, 197, 94, 0.18); transform: translateY(-1px); }
.light-btn { color: var(--ink); background: color-mix(in srgb, var(--card) 88%, transparent); border: 1px solid var(--line); }
.light-btn:hover { background: var(--card); transform: translateY(-1px); }

.page { display: none; }
.page.active { display: block; }
.hero {
  position: relative;
  min-height: min(820px, calc(100vh - 72px));
  overflow: hidden;
  display: flex;
  align-items: center;
}
.hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: var(--hero-overlay);
}
.hero-content {
  position: relative;
  width: min(680px, 92vw);
  display: grid;
  justify-items: start;
  padding-left: clamp(24px, 7vw, 96px);
  padding-top: clamp(72px, 9vh, 112px);
  padding-bottom: clamp(72px, 10vh, 120px);
}
.eyebrow {
  margin: 0 0 12px;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 0.8rem;
  font-weight: 800;
}
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(3rem, 7vw, 6.8rem); line-height: 0.92; margin-bottom: 22px; letter-spacing: 0; }
h2 { font-size: clamp(2rem, 4vw, 3.7rem); line-height: 1; margin-bottom: 18px; letter-spacing: 0; }
h3 { margin-bottom: 10px; line-height: 1.15; }
.hero-content p:not(.eyebrow) {
  font-size: clamp(1.05rem, 1.3vw, 1.18rem);
  line-height: 1.68;
  color: var(--hero-copy);
  font-weight: 500;
  max-width: 610px;
  margin-bottom: 0;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 32px;
}

.strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-block: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--soft-shadow);
}
.stats-strip div {
  padding: 26px 28px;
  border-right: 1px solid var(--line);
}
.stats-strip div:last-child { border-right: 0; }
.stats-strip strong { display: block; font-size: 1.55rem; }
.stats-strip span { color: var(--muted); font-weight: 600; }

.content-section, .page-heading {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}
.content-section { padding: 88px 0; }
.page-heading { padding: 70px 0 24px; }
.two-col {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 52px;
  align-items: start;
}
.muted { color: var(--muted); line-height: 1.7; }
.feature-grid, .subject-grid, .pricing-grid {
  display: grid;
  gap: 16px;
}
.feature-grid {
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
.feature-card, .subject-card, .price-card, .auth-card, .panel, .metric-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
}
.feature-card:hover, .subject-card:hover, .price-card:hover, .panel:hover {
  border-color: rgba(0, 107, 104, 0.22);
}
.feature-card {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 188px;
  padding: 24px;
}
.feature-card span {
  display: grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  width: fit-content;
  margin-bottom: 8px;
  border-radius: 8px;
  padding: 0 10px;
  color: white;
  background: var(--teal);
  font-weight: 800;
  font-size: 0.82rem;
}
.feature-card h3 {
  margin-bottom: 4px;
  font-size: 1.08rem;
}
.feature-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.58;
}
.filters {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto 22px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.chip {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 800;
}
.chip.active { color: white; background: var(--teal); border-color: var(--teal); }
.subject-grid {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto 70px;
  grid-template-columns: repeat(3, 1fr);
}
.subject-card { padding: 22px; }
.subject-card .tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tag {
  display: inline-block;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
}
.resources { display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-weight: 700; font-size: 0.9rem; }
.pricing-grid {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto 88px;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.price-card {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 18px;
  min-height: 430px;
  padding: 30px;
}
.price-card h3 {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 800;
  line-height: 1.25;
}
.price-card.highlighted { border: 2px solid var(--teal); box-shadow: var(--shadow); }
.price {
  margin: 0;
  color: var(--teal);
  font-size: clamp(2.7rem, 4vw, 3.45rem);
  font-weight: 900;
  line-height: 0.98;
}
.price::before {
  content: "USD ";
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--muted);
  vertical-align: 1.05em;
}
.price span {
  display: block;
  margin-top: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--muted);
}
.price-card ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 0;
  list-style: none;
  color: var(--muted);
  line-height: 1.45;
}
.price-card li {
  position: relative;
  padding-left: 22px;
}
.price-card li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
}
.price-card .primary-btn {
  width: 100%;
  justify-self: stretch;
}
ul { padding-left: 20px; line-height: 1.9; color: var(--muted); }
.timeline {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto 80px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.timeline div {
  padding: 24px;
  border-top: 5px solid var(--gold);
  background: var(--card);
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
}
.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 26px;
}
.section-title-row h2,
.two-col h2,
.trust-section h2 {
  font-weight: 800;
}
.journey-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}
.journey-grid article, .trust-grid article {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--soft-shadow);
}
.journey-grid span {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 900;
}
.journey-grid strong, .trust-grid strong { display: block; margin-bottom: 8px; font-size: 1.05rem; }
.journey-grid p, .trust-grid span {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.58;
}
.trust-section {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 24px;
  align-items: start;
}
.trust-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.timeline strong, .timeline span { display: block; }
.timeline span { margin-top: 8px; color: var(--muted); line-height: 1.55; }
.contact-form, .auth-shell {
  width: min(860px, calc(100% - 40px));
  margin: 0 auto 80px;
}
.contact-form, .auth-card {
  display: grid;
  gap: 16px;
  padding: 24px;
  background: var(--card);
  border-radius: 8px;
  border: 1px solid var(--line);
}
label { display: grid; gap: 8px; font-weight: 800; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  background: var(--surface-strong);
  color: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(0, 107, 104, 0.09);
}
.form-note {
  min-height: 20px;
  margin: 0;
  color: var(--teal);
  font-weight: 800;
}
.auth-shell {
  display: grid;
  grid-template-columns: 1fr 430px;
  gap: 36px;
  padding-top: 72px;
  align-items: start;
}
.auth-copy {
  padding-top: 26px;
}
.trust-list {
  display: grid;
  gap: 10px;
  margin-top: 26px;
}
.trust-list span {
  display: block;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--hero-copy);
  font-weight: 800;
}
.auth-card h3 { margin-bottom: 4px; }
.password-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.mini-btn, .link-btn {
  border: 0;
  border-radius: 8px;
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 800;
  padding: 0 12px;
}
.link-btn {
  background: transparent;
  padding: 0;
  text-align: left;
}
.form-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}
.between { justify-content: space-between; }
.check-label {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 9px;
  color: var(--hero-copy);
  font-size: 0.92rem;
}
.check-label input {
  width: auto;
  accent-color: var(--teal);
}
.signup-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto 80px;
}
.checkout-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto 80px;
}
.checkout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 18px;
  align-items: start;
}
.checkout-card {
  display: grid;
  gap: 18px;
}
.payment-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.payment-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.payment-option input {
  width: auto;
  margin-top: 3px;
  accent-color: var(--teal);
}
.payment-option small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.45;
}
.checkout-summary {
  position: sticky;
  top: 92px;
}
.summary-row, .summary-total {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.summary-total {
  border-bottom: 0;
  color: var(--teal);
  font-size: 1.2rem;
}
.payment-state {
  display: grid;
  gap: 5px;
  margin-top: 16px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(201, 75, 75, 0.12);
  color: var(--red);
  font-weight: 800;
}
.payment-state.success {
  color: var(--green);
  background: rgba(34, 197, 94, 0.12);
}
.payment-state.pending {
  color: var(--gold);
  background: rgba(242, 184, 75, 0.15);
}
.compact-heading {
  width: 100%;
  padding-bottom: 18px;
}
.signup-form {
  display: grid;
  gap: 18px;
}
fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: var(--card);
  box-shadow: 0 8px 22px rgba(17,24,39,0.05);
}
legend {
  padding: 0 10px;
  color: var(--teal);
  font-weight: 900;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.terms-line { margin-top: 16px; }
.form-note[data-tone="error"] { color: var(--red); }
.form-note[data-tone="success"] { color: var(--teal); }

.app-page.active {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: calc(100vh - 72px);
}
.sidebar {
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(14px);
  padding: 24px 18px;
}
.sidebar nav, .admin-links { display: grid; gap: 8px; margin-top: 24px; }
.sidebar button {
  text-align: left;
  border: 0;
  background: transparent;
  padding: 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
  transition: background 160ms ease, transform 160ms ease;
}
.sidebar button.active, .sidebar button:hover { background: var(--teal-soft); color: var(--teal); transform: translateX(2px); }
.admin-links { border-top: 1px solid var(--line); padding-top: 18px; }
.admin-links span { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; font-weight: 800; }
.workspace { padding: 32px; min-width: 0; }
.workspace-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 18px;
  margin-bottom: 22px;
}
.workspace-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.avatar-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}
.avatar-chip span, .avatar-chip img {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--teal);
  color: white;
  object-fit: cover;
  font-weight: 900;
}
.workspace-head h2 { font-size: clamp(1.9rem, 3vw, 3rem); }
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.metric-card { padding: 18px; }
.metric-card {
  position: relative;
  overflow: hidden;
}
.metric-card::after {
  content: "";
  position: absolute;
  right: -24px;
  top: -24px;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.1);
}
.metric-card span { color: var(--muted); font-weight: 700; }
.metric-card strong { display: block; margin-top: 8px; font-size: 1.8rem; }
.panel-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
}
.panel { padding: 22px; overflow: hidden; }
.dashboard-hero {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  border-radius: 8px;
  color: white;
  background: linear-gradient(135deg, var(--teal-dark), var(--teal) 62%, var(--blue));
  box-shadow: var(--shadow);
}
.dashboard-hero h3 { font-size: clamp(1.7rem, 3vw, 2.7rem); margin-bottom: 10px; }
.dashboard-hero p, .dashboard-hero .eyebrow { color: rgba(255,255,255,0.86); }
.dashboard-focus {
  min-width: 160px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: 8px;
  background: rgba(255,255,255,0.12);
}
.dashboard-focus span, .dashboard-focus strong { display: block; }
.dashboard-focus strong { font-size: 3rem; }
.quick-action-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.quick-action, .exam-card, .prompt-panel button, .study-nav button {
  display: grid;
  gap: 6px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--card);
  color: var(--ink);
  font-weight: 800;
  box-shadow: var(--soft-shadow);
}
.quick-action span, .exam-card span { color: var(--muted); font-weight: 700; }
.quick-action:hover, .exam-card:hover, .prompt-panel button:hover, .study-nav button:hover {
  border-color: rgba(34, 197, 94, 0.36);
  background: var(--teal-soft);
}
.recommend-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--surface-strong), var(--surface));
  border: 1px solid var(--line);
}
.recommend-card span { color: var(--muted); line-height: 1.55; }
.learning-layout, .watch-layout, .tutor-layout {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
}
.watch-layout {
  grid-template-columns: minmax(360px, 0.9fr) minmax(0, 1.4fr);
}
.practice-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 0.7fr;
  gap: 18px;
}
.study-nav {
  align-self: start;
  display: grid;
  gap: 10px;
}
.study-nav button.active {
  background: var(--teal);
  color: white;
}
.reading-panel, .video-panel-pro, .tutor-chat { min-height: 360px; }
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 18px 0;
}
.chapter-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.chapter-card span, .chapter-card em { color: var(--muted); font-style: normal; font-weight: 700; }
.premium-video {
  min-height: 360px;
  background:
    radial-gradient(circle at 70% 24%, rgba(242,184,75,0.32), transparent 18rem),
    linear-gradient(135deg, #071f2f, var(--teal-dark) 70%);
}
.premium-video span {
  align-self: start;
  padding: 0 24px 24px;
  text-align: center;
  font-weight: 800;
}
.mux-player {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: #071f2f;
  margin-bottom: 16px;
}
.locked-video { background: linear-gradient(135deg, #2a1720, #7a1d1d); }
.processing-video { background: linear-gradient(135deg, #102a43, #6a4b10); }
.unavailable-video { background: linear-gradient(135deg, #3b1d24, #9f1d2f); }
.lesson-notes .list { margin-top: 16px; }
.video-tree {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}
.video-level,
.video-subject,
.video-book,
.video-section,
.video-chapter {
  display: grid;
  gap: 10px;
}
.video-level {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.video-level > strong { color: var(--teal); }
.video-subject,
.video-book,
.video-section,
.video-chapter {
  padding-left: 12px;
  border-left: 2px solid var(--line);
}
.video-subject > span,
.video-book,
.video-section,
.video-chapter {
  color: var(--hero-copy);
  font-weight: 800;
}
.video-lesson-card {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}
.video-lesson-card.locked {
  background: rgba(201, 75, 75, 0.08);
  border-color: rgba(201, 75, 75, 0.34);
}
.video-lesson-card img {
  width: 82px;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 8px;
}
.video-lesson-card span,
.video-lesson-card em {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-style: normal;
  font-size: 0.84rem;
}
.video-lesson-card em {
  color: var(--teal);
  font-weight: 900;
}
.quiz-tree {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}
.quiz-lesson {
  display: grid;
  gap: 10px;
  padding-left: 12px;
  border-left: 2px solid rgba(242, 184, 75, 0.45);
  color: var(--hero-copy);
  font-weight: 800;
}
.quiz-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}
.quiz-card.locked {
  background: rgba(201, 75, 75, 0.08);
  border-color: rgba(201, 75, 75, 0.34);
}
.quiz-card span,
.quiz-card em {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-style: normal;
  font-size: 0.84rem;
}
.quiz-card em {
  color: var(--teal);
  font-weight: 900;
}
.quiz-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.past-paper-grid {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}
.past-paper-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}
.past-paper-card.locked {
  background: rgba(201, 75, 75, 0.08);
  border-color: rgba(201, 75, 75, 0.34);
}
.past-paper-card span,
.past-paper-card em {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-style: normal;
  font-size: 0.84rem;
}
.past-paper-card em {
  color: var(--teal);
  font-weight: 900;
}
.paper-actions,
.table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.paper-actions a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.danger-action {
  color: var(--red);
  background: rgba(201, 75, 75, 0.1);
}
.admin-video-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}
.admin-video-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.admin-mux-preview {
  margin-top: 18px;
}
.admin-video-form button,
.admin-video-form .form-note {
  grid-column: 1 / -1;
}
.admin-video-form .full-span {
  grid-column: 1 / -1;
}
.empty-state {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
  font-weight: 800;
}
.quiz-feature {
  background: linear-gradient(180deg, var(--card), var(--surface));
}
.score-circle {
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
  margin: 14px 0;
  border-radius: 50%;
  background: conic-gradient(var(--green) 86%, var(--line) 0);
  color: var(--green);
  font-size: 2rem;
  font-weight: 900;
}
.exam-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.tutor-layout {
  grid-template-columns: minmax(0, 1fr) 320px;
}
.chat-bubble {
  width: fit-content;
  max-width: 85%;
  padding: 14px 16px;
  margin: 12px 0 18px;
  border-radius: 8px;
  background: var(--teal-soft);
  color: var(--hero-copy);
  font-weight: 700;
}
.prompt-panel {
  display: grid;
  gap: 10px;
  align-content: start;
}
.polished-row em {
  color: var(--teal);
  font-style: normal;
  font-weight: 900;
}
.wide-panel { grid-column: 1 / -1; }
.profile-panel {
  display: grid;
  gap: 22px;
}
.profile-top {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: center;
}
.avatar-upload {
  display: grid;
  justify-items: center;
  gap: 12px;
}
.profile-avatar {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 2rem;
  font-weight: 900;
  border: 4px solid var(--card);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.upload-btn input { display: none; }
.profile-form, .stack-form {
  display: grid;
  gap: 16px;
}
.security-panel {
  align-self: start;
}
.locked-panel {
  border: 1px solid rgba(201, 75, 75, 0.34);
  background: rgba(201, 75, 75, 0.08);
}
.lock-badge {
  display: inline-block;
  width: fit-content;
  padding: 7px 10px;
  margin-bottom: 14px;
  border-radius: 8px;
  color: var(--red);
  background: rgba(201, 75, 75, 0.12);
  font-weight: 900;
}
.access-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.access-card {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.access-card span {
  color: var(--muted);
  font-weight: 800;
}
.access-card.unlocked {
  border-color: rgba(25, 135, 84, 0.35);
  background: rgba(34, 197, 94, 0.12);
}
.access-card.unlocked span { color: var(--green); }
.analytics-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.ring-card {
  display: grid;
  justify-items: start;
}
.progress-ring {
  --value: 0;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 10px 0 14px;
  background: conic-gradient(var(--teal) calc(var(--value) * 1%), var(--line) 0);
  position: relative;
}
.progress-ring::after {
  content: "";
  position: absolute;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background: var(--card);
}
.progress-ring span {
  position: relative;
  z-index: 1;
  font-weight: 900;
  font-size: 2rem;
  color: var(--teal);
}
.mini-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.mini-metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}
.mini-metric span {
  display: block;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.84rem;
}
.mini-metric strong {
  display: block;
  margin-top: 8px;
  font-size: 1.25rem;
}
.chart-row {
  display: grid;
  grid-template-columns: 120px 1fr 48px;
  gap: 12px;
  align-items: center;
  margin: 14px 0;
}
.chart-row span, .chart-row strong { font-size: 0.92rem; }
.chart-track {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--line);
}
.chart-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--gold));
}
.line-chart {
  position: relative;
  height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: repeating-linear-gradient(0deg, var(--surface) 0 42px, var(--line) 43px 44px);
  overflow: hidden;
}
.line-chart svg {
  position: absolute;
  inset: 16px;
  width: calc(100% - 32px);
  height: calc(100% - 32px);
}
.line-chart polyline {
  fill: none;
  stroke: var(--teal);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.line-chart i {
  position: absolute;
  bottom: 16px;
  width: 8px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.18);
}
.topic-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.topic {
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 900;
}
.topic.strong {
  color: var(--green);
  background: rgba(34, 197, 94, 0.12);
}
.topic.weak {
  color: var(--red);
  background: rgba(201, 75, 75, 0.12);
}
.timeline-list {
  display: grid;
  gap: 12px;
}
.activity {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.activity strong { color: var(--teal); }
.activity span { color: var(--hero-copy); }
.list { display: grid; gap: 12px; }
.row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.row strong, .row span { display: block; }
.row span { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }
.progress-bar {
  height: 9px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}
.progress-bar i {
  display: block;
  height: 100%;
  background: var(--teal);
  border-radius: inherit;
}
.video-shell {
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background: linear-gradient(135deg, #102a43, var(--teal-dark));
  color: white;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
}
.video-shell.has-thumb {
  background-size: cover;
  background-position: center;
}
.integration-note {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
  font-weight: 700;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}
.integration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
}
.integration-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.integration-card h3 {
  margin: 0;
}
.integration-card small {
  color: var(--muted);
  font-weight: 800;
}
.integration-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.integration-actions button,
.prompt-panel button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 13px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}
.play { width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,0.18); font-size: 1rem; font-weight: 900; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 13px 10px;
}
.status { color: var(--green); font-weight: 800; }
.danger { color: var(--red); font-weight: 800; }

@media (max-width: 900px) {
  .topbar { padding: 0 18px; }
  .public-nav, .top-actions { display: none; }
  .menu-btn { display: block; margin-left: auto; border: 0; background: var(--card); color: var(--ink); font-size: 1.4rem; }
  .topbar.open { height: auto; flex-wrap: wrap; padding-bottom: 16px; }
  .topbar.open .public-nav, .topbar.open .top-actions { display: flex; width: 100%; flex-wrap: wrap; margin-left: 0; }
  .hero { min-height: 760px; align-items: end; }
  .hero-overlay { background: var(--hero-overlay); }
  .hero-content { padding: 64px 22px 48px; }
  .strip, .two-col, .feature-grid, .subject-grid, .pricing-grid, .timeline, .auth-shell, .app-page.active, .metric-grid, .panel-grid, .form-grid, .analytics-grid, .mini-metrics, .checkout-grid, .payment-options, .access-grid, .journey-grid, .trust-section, .trust-grid, .quick-action-grid, .learning-layout, .watch-layout, .practice-grid, .tutor-layout, .chapter-grid, .exam-card-grid, .integration-grid {
    grid-template-columns: 1fr;
  }
  .admin-video-form { grid-template-columns: 1fr; }
  .video-lesson-card { grid-template-columns: 70px 1fr; }
  .video-lesson-card button { grid-column: 1 / -1; }
  .quiz-card, .past-paper-card { grid-template-columns: 1fr; }
  .quiz-card-actions, .paper-actions { justify-content: flex-start; }
  .checkout-summary { position: static; }
  .stats-strip div { border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar nav, .admin-links { grid-template-columns: repeat(2, 1fr); }
  .workspace { padding: 20px; }
  .workspace-head { flex-direction: column; }
  .workspace-actions { justify-content: flex-start; }
  .dashboard-hero { flex-direction: column; }
  .dashboard-focus { min-width: 0; }
  .profile-top { grid-template-columns: 1fr; justify-items: start; }
  .chart-row { grid-template-columns: 1fr; gap: 7px; }
  .activity { grid-template-columns: 1fr; }
  .section-title-row { align-items: start; flex-direction: column; }
  .premium-video { min-height: 240px; }
  .auth-copy { padding-top: 0; }
  .sidebar nav, .admin-links { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .topbar { height: 64px; }
  .hero-logo { max-width: 220px; }
  .hero-logo .brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    font-size: 1.5rem;
  }
  .hero-logo span:not(.brand-mark) { font-size: 3.1rem; }
  h1 { font-size: 3.1rem; }
  h2 { font-size: 2rem; }
  .hero { min-height: 700px; }
  .content-section, .page-heading, .signup-shell, .checkout-shell { width: min(100% - 28px, 1180px); }
  .workspace { padding: 14px; }
  .sidebar nav, .admin-links { grid-template-columns: 1fr; }
  .form-actions, .form-row, .workspace-actions { align-items: stretch; }
  .form-actions > *, .workspace-actions > *, .hero-actions > * { width: 100%; }
  .admin-table { min-width: 680px; }
  .panel:has(.admin-table) { overflow-x: auto; }
}
