:root {
  color-scheme: dark;
  --bg: #0b1020;
  --bg-soft: #131a2e;
  --card: #171f36;
  --card-2: #10182d;
  --text: #ffffff;
  --text-soft: #b6c2e0;
  --muted: #8290b3;
  --line: #24304f;
  --surface: var(--card);
  --primary: #3854d1;
  --primary-hover: #4d68e0;
  --success: #2bb673;
  --warning: #f5a623;
  --danger: #ef6b6b;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
  --logo-filter: brightness(0) invert(1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f6fc;
  --bg-soft: #ffffff;
  --card: #ffffff;
  --card-2: #e9eef9;
  --text: #091345;
  --text-soft: #55656c;
  --muted: #738893;
  --line: #d8e0f1;
  --surface: var(--card);
  --primary: #1e2f99;
  --primary-hover: #3854d1;
  --shadow: 0 24px 70px rgba(9, 19, 69, 0.12);
  --logo-filter: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 75% -10%, rgba(56, 84, 209, 0.3), transparent 34rem),
    linear-gradient(180deg, var(--bg), var(--bg-soft) 42rem, var(--bg));
  font-size: 16px;
  line-height: 1.5;
  transition: background 220ms ease, color 220ms ease;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg {
  display: block;
}

[hidden] {
  display: none !important;
}

img {
  max-width: 100%;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 90;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.25rem;
  padding: 0.75rem clamp(1rem, 4vw, 4rem);
  border-bottom: 1px solid color-mix(in srgb, var(--line), transparent 12%);
  background: color-mix(in srgb, var(--bg), transparent 12%);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
}

.brand img {
  width: 162px;
  height: 60px;
  object-fit: contain;
  object-position: left center;
  filter: var(--logo-filter);
}

.site-nav {
  justify-self: center;
  display: flex;
  gap: 1.25rem;
  color: var(--text-soft);
  font-size: 0.92rem;
  font-weight: 700;
}

.site-nav a:hover {
  color: var(--text);
}

.header-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.nav-toggle,
.theme-toggle {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: color-mix(in srgb, var(--card), transparent 8%);
  cursor: pointer;
}

.nav-toggle {
  display: none;
}

.nav-toggle span {
  width: 19px;
  height: 2px;
  margin: 3px auto;
  border-radius: 2px;
  background: currentColor;
}

.theme-toggle {
  position: relative;
  overflow: hidden;
}

.theme-toggle svg {
  position: absolute;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 220ms ease, opacity 220ms ease;
}

.theme-toggle .sun {
  opacity: 0;
  transform: translateY(18px) rotate(-45deg);
}

.theme-toggle .moon {
  opacity: 1;
  transform: translateY(0) rotate(0);
}

:root[data-theme="light"] .theme-toggle .sun {
  opacity: 1;
  transform: translateY(0) rotate(0);
}

:root[data-theme="light"] .theme-toggle .moon {
  opacity: 0;
  transform: translateY(-18px) rotate(45deg);
}

.header-cta,
.btn {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-weight: 800;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, border-color 180ms ease;
}

.header-cta {
  padding: 0 1rem;
  color: #fff;
  background: var(--primary);
  box-shadow: 0 14px 36px rgba(56, 84, 209, 0.26);
}

.btn {
  padding: 0.85rem 1.1rem;
  border: 1px solid transparent;
}

.btn:hover,
.header-cta:hover {
  transform: translateY(-1px);
}

.btn.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #1b2d87);
  box-shadow: 0 16px 38px rgba(56, 84, 209, 0.25);
}

.btn.primary:hover,
.header-cta:hover {
  background: var(--primary-hover);
}

.btn.secondary {
  color: var(--text);
  background: color-mix(in srgb, var(--card), transparent 5%);
  border-color: var(--line);
}

.section-pad {
  padding: clamp(4rem, 8vw, 7rem) clamp(1rem, 4vw, 4rem);
}

.hero,
.placement-hero {
  min-height: calc(100vh - 84px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  align-items: center;
  gap: clamp(2rem, 6vw, 5rem);
  padding-top: 3rem;
}

.placement-hero {
  min-height: auto;
  grid-template-columns: minmax(0, 980px);
  padding-bottom: 1rem;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: color-mix(in srgb, var(--primary-hover), #fff 18%);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 860px;
  margin-bottom: 1.25rem;
  font-size: clamp(3rem, 7.4vw, 6.2rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 1rem;
  font-size: clamp(2rem, 4.8vw, 4rem);
  line-height: 1.02;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0.65rem;
  font-size: 1.15rem;
}

.hero-lede,
.section-head p,
.placement-intro p,
.assessment-card p,
.step-head p {
  max-width: 760px;
  color: var(--text-soft);
  font-size: 1.08rem;
}

.hero-actions,
.proof-strip,
.community-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hero-actions.centered {
  justify-content: center;
}

.proof-strip {
  margin-top: 1.5rem;
}

.proof-strip span,
.category-meter span,
.community-benefits span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.7rem;
  color: var(--text-soft);
  background: color-mix(in srgb, var(--card), transparent 18%);
  font-size: 0.86rem;
  font-weight: 750;
}

.hero-visual {
  position: relative;
  display: grid;
  gap: 1.25rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--card), transparent 4%), var(--card-2));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-visual::before,
.assessment-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(color-mix(in srgb, var(--line), transparent 55%) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--line), transparent 55%) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, #000, transparent);
  pointer-events: none;
}

.chaos-stack,
.pipeline,
.score-card {
  position: relative;
}

.chaos-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.chaos-stack span {
  padding: 0.65rem 0.8rem;
  border: 1px solid color-mix(in srgb, var(--warning), transparent 55%);
  border-radius: 8px;
  color: color-mix(in srgb, var(--warning), #fff 25%);
  background: color-mix(in srgb, var(--warning), transparent 88%);
  font-size: 0.88rem;
  font-weight: 800;
}

.pipeline {
  display: grid;
  gap: 0.8rem;
  margin: 1rem 0;
}

.node {
  min-height: 58px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 1rem;
  background: color-mix(in srgb, var(--card), transparent 7%);
  font-weight: 850;
}

.node.active {
  border-color: color-mix(in srgb, var(--primary), transparent 35%);
  background: color-mix(in srgb, var(--primary), transparent 84%);
}

.node.goal {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #091345);
}

.score-card,
.contrast-card,
.mission-card,
.widget,
.price-card,
.faq-list details,
.testimonial-grid figure,
.assessment-card,
.community-panel,
.assessment-shell,
.report-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--card), transparent 3%);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.16);
}

.score-card {
  padding: 1rem;
}

.score-card p,
.score-card span,
.widget span,
.mission-card span,
.price-card span,
.assessment-top span,
.question-meta span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 780;
}

.score-card strong {
  display: block;
  margin: 0.2rem 0;
  font-size: 1.5rem;
}

.section-head {
  max-width: 900px;
  margin-bottom: 2rem;
}

.problem-grid,
.feature-grid,
.pricing-grid,
.testimonial-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.problem-grid article {
  min-height: 120px;
  display: flex;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  background: linear-gradient(180deg, color-mix(in srgb, var(--card), transparent 4%), var(--card-2));
  font-size: 1.1rem;
  font-weight: 850;
}

.contrast {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 2rem;
  background: linear-gradient(180deg, #080d1a, var(--bg-soft));
}

:root[data-theme="light"] .contrast {
  background: #091345;
  color: #fff;
}

:root[data-theme="light"] .contrast .contrast-card {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.15);
}

:root[data-theme="light"] .contrast .contrast-card li,
:root[data-theme="light"] .contrast .contrast-card ul,
:root[data-theme="light"] .contrast p,
:root[data-theme="light"] .contrast h2 {
  color: #fff;
}

.contrast .eyebrow,
.contrast-card h3 {
  color: color-mix(in srgb, var(--primary-hover), #fff 38%);
}

.contrast-grid {
  display: grid;
  gap: 1rem;
}

.contrast-card {
  padding: 1.2rem;
}

.contrast-card.muted {
  opacity: 0.88;
}

ul,
ol {
  margin: 0;
  padding-left: 1.2rem;
}

li + li {
  margin-top: 0.45rem;
}

.loop {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.7rem;
  margin-bottom: 1.5rem;
}

.loop span {
  min-height: 70px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--primary), transparent 55%);
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary), transparent 88%);
  color: color-mix(in srgb, var(--primary-hover), #fff 22%);
  font-weight: 850;
  text-align: center;
}

.feature-grid article {
  min-height: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  background: color-mix(in srgb, var(--card), transparent 4%);
}

.feature-grid p,
.price-card p,
.widget p,
.mission-card li,
.faq-list p,
blockquote,
.week p,
.report-box p,
.profile-form label {
  color: var(--text-soft);
}

.roadmap-shell {
  display: grid;
  gap: 0.8rem;
}

.phase {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: color-mix(in srgb, var(--card), transparent 4%);
}

.phase button {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
  border: 0;
  padding: 1rem;
  color: var(--text);
  background: transparent;
  text-align: left;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.weeks {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  padding: 0 1rem 1rem;
}

.phase.open .weeks {
  display: grid;
}

.week {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem;
  background: var(--card-2);
}

.week span {
  color: color-mix(in srgb, var(--primary-hover), #fff 18%);
  font-size: 0.82rem;
  font-weight: 850;
}

.assessment-preview,
.placement-page {
  background: linear-gradient(180deg, var(--bg-soft), var(--bg));
}

.assessment-card,
.community-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.5rem;
  align-items: center;
  padding: clamp(1rem, 3vw, 2rem);
}

.community-benefits {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.dashboard {
  background: linear-gradient(180deg, #080d1a, var(--bg-soft));
}

:root[data-theme="light"] .dashboard {
  background: #091345;
  color: #fff;
}

:root[data-theme="light"] .dashboard .eyebrow {
  color: color-mix(in srgb, var(--primary-hover), #fff 38%);
}

:root[data-theme="light"] .dashboard .section-head p {
  color: rgba(255, 255, 255, 0.78);
}

:root[data-theme="light"] .dashboard .mission-card,
:root[data-theme="light"] .dashboard .widget {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.15);
}

:root[data-theme="light"] .dashboard .mission-card li,
:root[data-theme="light"] .dashboard .widget p,
:root[data-theme="light"] .dashboard .widget span,
:root[data-theme="light"] .dashboard .mission-card span {
  color: rgba(255, 255, 255, 0.78);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.8fr;
  gap: 1rem;
}

.mission-card {
  grid-row: span 2;
  padding: 1.1rem;
}

.mission-card h3 {
  font-size: 2rem;
  line-height: 1.05;
}

.widget {
  min-height: 170px;
  padding: 1rem;
}

.widget strong {
  display: block;
  margin: 0.45rem 0;
  font-size: 1.6rem;
}

.ring {
  width: 86px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--primary-hover) 72%, var(--line) 0);
}

.testimonial-grid figure,
.price-card {
  margin: 0;
  padding: 1.1rem;
}

blockquote {
  margin: 0 0 1rem;
  font-size: 1.05rem;
}

figcaption {
  color: color-mix(in srgb, var(--primary-hover), #fff 18%);
  font-weight: 850;
}

.price-card {
  display: grid;
  gap: 0.8rem;
  align-content: start;
}

.price-card h3 {
  font-size: 2.2rem;
}

.price-card.recommended {
  color: #fff;
  background: linear-gradient(160deg, var(--primary), #091345);
  transform: translateY(-0.75rem);
}

.price-card.recommended p,
.price-card.recommended span {
  color: #dce5ff;
}

.faq-list {
  display: grid;
  gap: 0.75rem;
}

.faq-list details {
  padding: 1rem;
}

.faq-list summary {
  font-weight: 850;
  cursor: pointer;
}

.faq-list p {
  margin: 0.75rem 0 0;
}

.final-cta {
  text-align: center;
  background: var(--bg-soft);
}

.final-cta h2 {
  max-width: 880px;
  margin-inline: auto;
}

.placement-page {
  padding-top: 2rem;
}

.assessment-shell {
  position: relative;
  max-width: 1060px;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem);
  overflow: hidden;
}

.assessment-shell > * {
  position: relative;
}

.assessment-top {
  display: grid;
  gap: 0.8rem;
  margin-bottom: 1.4rem;
}

.assessment-top > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.assessment-top strong {
  color: var(--text);
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.progress-track span {
  display: block;
  width: 8%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary-hover), var(--success));
  transition: width 260ms ease;
}

.assessment-step {
  animation: stepIn 220ms ease both;
}

.profile-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.step-head {
  grid-column: 1 / -1;
}

.profile-form label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.86rem;
  font-weight: 780;
}

.profile-form input {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 0.85rem;
  color: var(--text);
  background: var(--card-2);
  font: inherit;
}

.profile-form input:focus,
.answer-btn:focus {
  outline: 2px solid color-mix(in srgb, var(--primary-hover), transparent 30%);
  outline-offset: 2px;
}

.question-step {
  padding: 0.5rem 0;
}

.question-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.question-step h2 {
  font-size: clamp(1.15rem, 3vw, 1.8rem);
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
  margin-bottom: 1.25rem;
}

.question-step h2 mjx-container,
.question-step h2 mjx-container svg,
.answer-btn mjx-container,
.answer-btn mjx-container svg {
  display: inline !important;
  vertical-align: middle;
}

.answers {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.answer-btn {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.95rem;
  background: var(--card-2);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.answer-btn:hover {
  border-color: var(--primary-hover);
  transform: translateY(-1px);
}

.answer-btn.selected {
  border-color: var(--success);
  background: color-mix(in srgb, var(--success), transparent 84%);
}

.assessment-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.form-error {
  grid-column: 1 / -1;
  min-height: 1.4rem;
  margin: 0;
  color: var(--danger);
  font-weight: 750;
}

.report-hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: clamp(1rem, 3vw, 1.5rem);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary), transparent 42%), var(--card-2));
}

.avatar {
  width: 68px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--primary-hover), var(--success));
  font-size: 1.65rem;
  font-weight: 900;
}

.readiness-visual {
  width: 116px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--success) var(--readiness, 0%), var(--line) 0);
}

.readiness-visual span {
  width: 84px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--card);
  font-size: 1.45rem;
  font-weight: 900;
}

.level-meter {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.45rem;
  margin: 1rem 0;
}

.level-point {
  position: relative;
  min-height: 78px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--card-2);
  font-weight: 850;
  text-align: center;
}

.level-point.active {
  color: #fff;
  border-color: var(--success);
  background: linear-gradient(135deg, var(--primary), var(--success));
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin: 1rem 0;
}

.report-box {
  padding: 1rem;
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

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

@media (max-width: 960px) {
  .site-header {
    grid-template-columns: auto 1fr;
  }

  .header-actions {
    grid-column: 2;
  }

  .nav-toggle {
    display: inline-grid;
  }

  /* .site-nav drawer styles are defined below in the new drawer section */

  .hero,
  .contrast,
  .assessment-card,
  .community-panel,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .problem-grid,
  .feature-grid,
  .pricing-grid,
  .testimonial-grid,
  .loop,
  .weeks,
  .report-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .site-header {
    padding-inline: 0.85rem;
  }

  .brand img {
    width: 132px;
    height: 50px;
  }

  .header-cta {
    display: none;
  }

  .section-pad {
    padding: 3.5rem 1rem;
  }

  .hero {
    min-height: auto;
    padding-top: 2.25rem;
  }

  h1 {
    font-size: clamp(2.65rem, 14vw, 4.2rem);
  }

  .problem-grid,
  .feature-grid,
  .pricing-grid,
  .testimonial-grid,
  .loop,
  .weeks,
  .profile-form,
  .report-grid,
  .level-meter,
  .answers {
    grid-template-columns: 1fr;
  }

  .hero-actions .btn,
  .final-cta .btn,
  .community-actions .btn,
  .assessment-actions .btn,
  .report-actions .btn {
    width: 100%;
  }

  .assessment-actions,
  .report-actions {
    flex-direction: column;
  }

  .price-card.recommended {
    transform: none;
  }

  .report-hero {
    grid-template-columns: 1fr;
    text-align: left;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .node.active,
  .ring {
    animation: lift 3.6s ease-in-out infinite;
  }

  @keyframes lift {
    0%,
    100% {
      transform: translateY(0);
    }
    50% {
      transform: translateY(-4px);
    }
  }
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE NAV — RIGHT-SIDE DRAWER
═══════════════════════════════════════════════════════════════ */

/* Overlay backdrop — display is controlled by script.js (style.display) */
.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 101;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms ease;
  display: none; /* default hidden; JS sets style.display="block" before adding .visible */
}

.nav-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

body.nav-open {
  overflow: hidden;
}

/* Drawer reset (desktop: remove old styles) */
@media (max-width: 960px) {
  .site-nav {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: min(320px, 85vw);
    z-index: 110;
    display: flex !important; /* always rendered, controlled by transform */
    flex-direction: column;
    gap: 0;
    border: none;
    border-left: 1px solid var(--line);
    border-radius: 0;
    background: var(--bg-soft);
    box-shadow: -8px 0 48px rgba(0, 0, 0, 0.24);
    padding: 1rem 0 1.5rem;
    transform: translateX(100%);
    transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
  }

  .site-nav.open {
    transform: translateX(0);
    display: flex !important;
  }


  .site-nav a {
    padding: 0.95rem 1.5rem;
    border-bottom: 1px solid var(--line);
    font-size: 1rem;
    transition: background 140ms ease, color 140ms ease;
  }

  .site-nav a:hover {
    background: color-mix(in srgb, var(--primary), transparent 90%);
    color: var(--primary-hover);
  }

  /* Close button inside drawer */
  .nav-close-btn {
    align-self: flex-end;
    margin: 0 1rem 0.5rem;
    width: 40px;
    height: 40px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
  }

  .nav-close-btn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
  }

  /* Login/Sign Up button at bottom of mobile drawer */
  .nav-auth-mobile {
    margin-top: auto;
    padding: 1.25rem 1.5rem 0.5rem;
    border-top: 1px solid var(--line);
  }

  .nav-login-mobile {
    display: flex !important;
    width: 100%;
    justify-content: center;
    font-size: 0.97rem;
    min-height: 46px;
  }
}

@media (min-width: 961px) {
  .nav-social {
    display: none;
  }
  .nav-close-btn {
    display: none;
  }
  .nav-auth-mobile {
    display: none;
  }
  /* Overlay never visible on desktop — JS won't open drawer anyway */
  .nav-overlay {
    display: none !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   SOCIAL ICONS
═══════════════════════════════════════════════════════════════ */

.social-icon {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text-soft);
  background: color-mix(in srgb, var(--card), transparent 8%);
  transition: color 180ms ease, border-color 180ms ease, transform 180ms ease, background 180ms ease;
  flex-shrink: 0;
}

.social-icon:hover {
  color: var(--text);
  border-color: var(--primary-hover);
  background: color-mix(in srgb, var(--primary), transparent 86%);
  transform: translateY(-2px);
}

.social-icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* PNG social icons — full colour branded icons */
.social-icon-png {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  width: 36px;
  height: 36px;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.social-icon-png:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.social-icon-png img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

/* ═══════════════════════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════════════════════ */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 2.25rem clamp(1rem, 4vw, 4rem);
}

.footer-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-social {
  display: flex;
  gap: 0.6rem;
  margin-left: auto;
}

.footer-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  width: 100%;
  text-align: center;
}

@media (max-width: 640px) {
  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
  .footer-social {
    margin-left: 0;
  }
}

/* ═══════════════════════════════════════════════════════════════
   AUTH PAGES  (login, signup, forgot-password)
═══════════════════════════════════════════════════════════════ */

.auth-main {
  min-height: calc(100vh - 84px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(2rem, 5vw, 4rem) clamp(1rem, 4vw, 2rem);
  background:
    radial-gradient(circle at 65% -5%, rgba(56, 84, 209, 0.18), transparent 30rem),
    var(--bg);
}

.auth-container {
  width: 100%;
  max-width: 440px;
}

.auth-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(1.75rem, 5vw, 2.5rem);
  background: color-mix(in srgb, var(--card), transparent 2%);
  box-shadow: var(--shadow);
  animation: stepIn 280ms ease both;
}

.auth-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.auth-logo {
  width: 130px;
  height: auto;
  filter: var(--logo-filter);
}

.auth-title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  line-height: 1.1;
  margin-bottom: 0.35rem;
  text-align: center;
}

.auth-subtitle {
  color: var(--text-soft);
  font-size: 0.96rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

/* Google button */
.google-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 1rem;
  color: var(--text);
  background: color-mix(in srgb, var(--card), transparent 4%);
  font: inherit;
  font-weight: 700;
  font-size: 0.96rem;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.google-btn:hover {
  border-color: var(--primary-hover);
  background: color-mix(in srgb, var(--primary), transparent 92%);
  transform: translateY(-1px);
}

.google-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.google-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Divider */
.auth-divider {
  position: relative;
  display: flex;
  align-items: center;
  margin: 1.25rem 0;
  color: var(--muted);
  font-size: 0.84rem;
}

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

.auth-divider span {
  padding: 0 0.85rem;
}

/* Form fields */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.form-group label {
  color: var(--text-soft);
  font-size: 0.86rem;
  font-weight: 780;
}

.form-group input {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 0.9rem;
  color: var(--text);
  background: var(--card-2);
  font: inherit;
  font-size: 0.96rem;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-hover);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-hover), transparent 75%);
}

.form-group input::placeholder {
  color: var(--muted);
}

/* Auth submit button */
.auth-submit {
  width: 100%;
  min-height: 50px;
  margin-top: 0.5rem;
  font-size: 1rem;
  border: none;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
}

.auth-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none !important;
}

/* Error / success messages */
.auth-error {
  min-height: 1.2rem;
  margin: 0.35rem 0 0.5rem;
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 700;
  display: none;
}

.auth-success {
  padding: 0.85rem 1rem;
  border: 1px solid color-mix(in srgb, var(--success), transparent 60%);
  border-radius: 10px;
  background: color-mix(in srgb, var(--success), transparent 88%);
  color: color-mix(in srgb, var(--success), var(--text) 20%);
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 0.85rem;
}

/* Auth links */
.auth-link {
  margin: 0.85rem 0 0;
  color: var(--text-soft);
  font-size: 0.9rem;
  text-align: center;
}

.auth-link a {
  color: var(--primary-hover);
  font-weight: 700;
  transition: color 140ms ease;
}

.auth-link a:hover {
  color: var(--text);
}

/* Spinner inside buttons */
.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  flex-shrink: 0;
}

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

/* Ghost header CTA variant (logout in header) */
.header-cta--ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-soft);
  box-shadow: none;
  font-size: 0.88rem;
}

.header-cta--ghost:hover {
  background: color-mix(in srgb, var(--card), transparent 8%);
  color: var(--text);
}

/* ═══════════════════════════════════════════════════════════════
   DASHBOARD PAGE
═══════════════════════════════════════════════════════════════ */

.dashboard-page {
  min-height: calc(100vh - 84px);
  max-width: 1100px;
  margin-inline: auto;
}

/* Loading */
.dashboard-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 1rem;
  color: var(--text-soft);
}

.loading-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--line);
  border-top-color: var(--primary-hover);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.progress-loading {
  min-height: 42vh;
}

.loading-progress {
  width: min(340px, 80vw);
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line), transparent 12%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line), transparent 20%);
}

.loading-progress span {
  display: block;
  width: 48%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--primary-hover), var(--success));
  animation: progressSlide 1.15s ease-in-out infinite;
}

@keyframes progressSlide {
  0% { transform: translateX(-115%); }
  55% { transform: translateX(75%); }
  100% { transform: translateX(215%); }
}

/* Welcome bar */
.db-welcome {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary), transparent 60%), var(--card-2));
  box-shadow: var(--shadow);
  margin-bottom: 2.5rem;
  animation: stepIn 300ms ease both;
}

.db-avatar {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-hover), var(--success));
  color: #fff;
  font-size: 1.6rem;
  font-weight: 900;
  flex-shrink: 0;
}

.db-welcome h1 {
  font-size: clamp(1.35rem, 3vw, 2rem);
  margin-bottom: 0.2rem;
}

.db-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-left: auto;
}

/* Sections */
.db-section {
  margin-bottom: 2.5rem;
  animation: stepIn 320ms ease both;
}

.db-section-title {
  font-size: 1.3rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

/* Profile card */
.db-profile-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--card), transparent 3%);
  overflow: hidden;
}

.db-profile-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

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

.db-label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 780;
}

.db-value {
  font-weight: 700;
  font-size: 0.96rem;
}

/* Empty state */
.db-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  padding: 3rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--text-soft);
  text-align: center;
}

/* Placement test cards */
.db-tests-list {
  display: grid;
  gap: 1rem;
}

.db-test-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem;
  background: color-mix(in srgb, var(--card), transparent 3%);
  transition: border-color 180ms ease;
}

.db-test-card:hover {
  border-color: color-mix(in srgb, var(--primary), transparent 50%);
}

.db-test-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.db-test-index {
  font-weight: 900;
  font-size: 1.05rem;
}

.db-test-date {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  margin-top: 0.15rem;
}

.db-test-level {
  padding: 0.35rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--primary), transparent 55%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary), transparent 86%);
  color: color-mix(in srgb, var(--primary-hover), #fff 22%);
  font-size: 0.82rem;
  font-weight: 850;
  white-space: nowrap;
}

.db-test-scores {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.db-test-stat {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.db-test-stat span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 780;
}

.db-test-stat strong {
  font-size: 1rem;
  font-weight: 800;
}

.db-test-rec {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.9rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

@media (max-width: 640px) {
  .db-welcome {
    flex-direction: column;
    text-align: center;
  }
  .db-avatar {
    margin-inline: auto;
  }
  .db-actions {
    margin-left: 0;
    width: 100%;
    flex-direction: column;
  }
  .db-actions .btn {
    width: 100%;
  }
  .db-profile-row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}


/* ═══════════════════════════════════════════════════════════════
   SOCIAL AUTH BUTTONS — Two-button layout (Google + Apple)
═══════════════════════════════════════════════════════════════ */
.social-btns {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

/* Apple button — matches Google button sizing */
.apple-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 1rem;
  color: var(--text);
  background: color-mix(in srgb, var(--card), transparent 4%);
  font: inherit;
  font-weight: 700;
  font-size: 0.96rem;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}
.apple-btn:hover {
  border-color: var(--text-soft);
  background: color-mix(in srgb, var(--text), transparent 93%);
  transform: translateY(-1px);
}
.apple-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
/* Dark mode: Apple button turns black with white text (Apple HIG) */
[data-theme="dark"] .apple-btn {
  background: #1c1c1e;
  border-color: #3a3a3c;
  color: #fff;
}
[data-theme="dark"] .apple-btn:hover {
  background: #2c2c2e;
  border-color: #636366;
}

.apple-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Google button spinner fix */
.google-btn .btn-spinner {
  border-color: rgba(0,0,0,0.2);
  border-top-color: #4285F4;
}

/* ═══════════════════════════════════════════════════════════════
   AUTH FEEDBACK — smart error + action button container
═══════════════════════════════════════════════════════════════ */
.auth-feedback {
  margin: 0.35rem 0 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.auth-feedback .auth-error {
  display: block;
  margin: 0;
}

/* Small "Create Account" / "Sign In" action button inside error area */
.auth-action-btn {
  align-self: flex-start;
  min-height: 38px;
  padding: 0 1rem;
  font-size: 0.88rem;
  border-radius: 8px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

/* Context banner — shown when arriving from placement test */
.auth-context-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.9rem 1rem;
  border: 1px solid color-mix(in srgb, var(--primary-hover), transparent 55%);
  border-radius: 12px;
  background: color-mix(in srgb, var(--primary), transparent 88%);
  color: color-mix(in srgb, var(--primary-hover), var(--text) 15%);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
  animation: stepIn 280ms ease both;
}

.auth-context-banner svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 0.05rem;
  stroke: currentColor;
}

.auth-context-banner p {
  margin: 0;
  font-weight: 700;
  line-height: 1.4;
}

/* Auth gate — full-area loading state in placement test */
.assessment-auth-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 3rem 2rem;
  text-align: center;
  color: var(--text-soft);
}

/* Loading dots animation */
.loading-dots {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  justify-content: center;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-hover);
  animation: dot-pulse 1.2s ease-in-out infinite both;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-pulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%            { transform: scale(1);   opacity: 1;   }
}


/* ═══════════════════════════════════════════════════════════════
   RESET PASSWORD PAGE — loading / success states
═══════════════════════════════════════════════════════════════ */
.rp-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem 0;
  color: var(--text-soft);
  font-size: 0.95rem;
}

.rp-success-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--success), transparent 82%);
  color: var(--success);
  font-size: 2rem;
  font-weight: 900;
  margin: 0 auto 1.25rem;
}

/* ═══════════════════════════════════════════════════════════════
   DASHBOARD avatar legacy styles
═══════════════════════════════════════════════════════════════ */
.db-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

/* Override old db-avatar to support photo inside */
.db-avatar {
  overflow: hidden;
  position: relative;
}

/* ═══════════════════════════════════════════════════════════════
   PROFILE PAGE — Photo upload section
═══════════════════════════════════════════════════════════════ */
.profile-photo-section {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
}

.profile-photo-wrap {
  position: relative;
  display: inline-block;
}

/* Large avatar on profile page */
.profile-avatar-lg {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-hover), var(--success));
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 2.8rem;
  font-weight: 900;
  overflow: hidden;
  border: 3px solid var(--line);
  flex-shrink: 0;
}

/* Camera badge trigger */
.profile-photo-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary-hover);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  border: 2px solid var(--bg);
  transition: transform 160ms ease, background 160ms ease;
}
.profile-photo-badge:hover {
  transform: scale(1.1);
  background: color-mix(in srgb, var(--primary-hover), #000 15%);
}
.profile-photo-badge svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.profile-photo-controls {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

/* Upload progress bar */
.upload-progress-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 340px;
}
.upload-progress-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.upload-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-hover), var(--success));
  border-radius: 999px;
  transition: width 80ms linear;
}
.upload-progress-label {
  font-size: 0.84rem;
  color: var(--text-soft);
  font-weight: 780;
  min-width: 2.5rem;
  text-align: right;
}

/* Photo feedback messages */
.photo-error {
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0;
}
.photo-success {
  color: var(--success);
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0;
}
.photo-hint {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0;
}

@media (max-width: 640px) {
  .profile-photo-controls {
    flex-direction: column;
  }
  .profile-photo-controls .btn {
    width: 100%;
  }
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE NAV — ensure overlay display is block when .visible
   (overrides the display:none from the old block)
═══════════════════════════════════════════════════════════════ */


.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 9999;
  background: var(--primary-hover);
  color: #fff;
  padding: 0.5rem 1.25rem;
  border-radius: 0 0 8px 8px;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  transition: top 200ms ease;
  white-space: nowrap;
}
.skip-link:focus {
  top: 0;
  outline: 3px solid #fff;
  outline-offset: 2px;
}


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


.footer-legal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  text-align: center;
}
.footer-legal-links {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  list-style: none;
  margin: 0;
  padding: 0;
}
.footer-legal-links a {
  color: var(--text-soft);
  font-size: 0.84rem;
  text-decoration: none;
  transition: color 150ms ease;
}
.footer-legal-links a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}
.footer-legal-links span {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1;
}


.legal-page {
  padding-top: clamp(2rem, 6vw, 4rem);
  padding-bottom: clamp(3rem, 8vw, 6rem);
}
.legal-inner {
  max-width: 780px;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}
.legal-inner h1 {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 900;
  margin: 0 0 0.35rem;
  color: var(--text);
}
.legal-meta {
  color: var(--text-soft);
  font-size: 0.9rem;
  margin: 0 0 2.5rem;
}
.legal-inner h2 {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 2.25rem 0 0.75rem;
  color: var(--text);
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--line);
}
.legal-inner h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 1.5rem 0 0.5rem;
  color: var(--text);
}
.legal-inner p {
  color: var(--text-soft);
  line-height: 1.75;
  margin: 0 0 1rem;
}
.legal-inner ul {
  color: var(--text-soft);
  line-height: 1.75;
  padding-left: 1.5rem;
  margin: 0 0 1rem;
}
.legal-inner ul li { margin-bottom: 0.4rem; }
.legal-inner a {
  color: var(--primary-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.legal-inner a:hover { color: var(--text); }


.error-page {
  min-height: 62vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(3rem, 10vw, 8rem) clamp(1rem, 5vw, 3rem);
  gap: 1.25rem;
}
.error-code {
  font-size: clamp(5rem, 22vw, 10rem);
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
  letter-spacing: -0.03em;
}
.error-title {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 800;
  margin: 0;
  color: var(--text);
}
.error-message {
  color: var(--text-soft);
  font-size: 1.05rem;
  max-width: 460px;
  margin: 0 auto;
  line-height: 1.65;
}
.error-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 0.75rem;
}


.about-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
  color: var(--text-soft);
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}
.about-breadcrumb a {
  color: var(--primary-hover);
  text-decoration: none;
}
.about-breadcrumb a:hover {
  text-decoration: underline;
}
.about-breadcrumb span[aria-current] {
  color: var(--text-soft);
}

.announcement-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.65rem 1rem;
  text-align: center;
  color: #fff;
  background: var(--primary);
  font-weight: 800;
}

.metric-grid,
.story-grid,
.info-grid,
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.metric-card,
.story-card,
.info-grid article,
.empty-state,
.lead-form,
.admin-form,
.admin-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--card), transparent 4%);
  box-shadow: var(--shadow);
}

.metric-card,
.info-grid article,
.empty-state {
  padding: 1.2rem;
}

.metric-card strong,
.info-grid strong {
  display: block;
  font-size: clamp(1.5rem, 5vw, 2.4rem);
  line-height: 1.1;
}

.metric-card span,
.info-grid span,
.story-card span,
.admin-item span {
  color: var(--text-soft);
  font-size: 0.86rem;
  font-weight: 800;
}

.story-card {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.story-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 6px;
}

.story-card h3,
.story-card p {
  margin: 0;
}

.story-card p,
.empty-state p,
.form-status {
  color: var(--text-soft);
}

.compact article {
  min-height: auto;
}

.lead-capture {
  max-width: 860px;
  margin-inline: auto;
}

.lead-form {
  display: grid;
  gap: 0.9rem;
  padding: clamp(1rem, 4vw, 1.5rem);
}

.lead-form label,
.admin-form label {
  display: grid;
  gap: 0.4rem;
  color: var(--text-soft);
  font-weight: 800;
}

.lead-form input,
.lead-form select,
.lead-form textarea,
.admin-form input,
.admin-form select,
.admin-form textarea,
.resource-tools input,
.resource-tools select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  color: var(--text);
  background: var(--bg-soft);
  font: inherit;
}

.floating-whatsapp {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 120;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #25d366;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.26);
}

.floating-whatsapp svg,
.footer-social .social-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.sticky-mobile-cta {
  position: fixed;
  left: 1rem;
  right: 5rem;
  bottom: 1rem;
  z-index: 59;
  display: none;
  justify-content: center;
}

.resource-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 260px);
  gap: 0.75rem;
  margin: 0 auto 1.5rem;
  max-width: 920px;
}

.featured-resource {
  border-color: color-mix(in srgb, var(--primary), var(--line) 35%);
}

.lead-dialog {
  width: min(92vw, 460px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

.lead-dialog::backdrop {
  background: rgba(0, 0, 0, 0.48);
}

.content-page,
.article-page,
.admin-shell {
  min-height: 70vh;
}

.article-layout {
  max-width: 820px;
  margin-inline: auto;
}

.article-layout h1 {
  font-size: clamp(2rem, 7vw, 4rem);
  line-height: 1.05;
  margin: 0 0 1rem;
}

.article-lede {
  color: var(--text-soft);
  font-size: 1.1rem;
}

.article-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  margin: 1.5rem 0;
}

.article-body {
  color: var(--text-soft);
  line-height: 1.8;
}

.internal-links {
  display: grid;
  gap: 0.6rem;
  margin: 2rem 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.internal-links a {
  color: var(--primary-hover);
  font-weight: 800;
}

.admin-shell {
  padding: clamp(1rem, 4vw, 2rem);
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.admin-header h1 {
  margin: 0.2rem 0;
  font-size: clamp(1.7rem, 4vw, 2.8rem);
}

.admin-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.7rem;
  margin-bottom: 1rem;
}

.admin-tabs button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  color: var(--text);
  background: var(--card);
  font-weight: 800;
  cursor: pointer;
}

.admin-tabs button.active {
  color: #fff;
  background: var(--primary);
}

.admin-bulk-toolbar {
  position: sticky;
  top: 76px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--card), transparent 3%);
  box-shadow: var(--shadow);
}

.admin-select {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 800;
}

.admin-select input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.admin-group-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--card), transparent 4%);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.admin-group-card summary {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 1rem;
  cursor: pointer;
}

.admin-group-body {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border-top: 1px solid var(--line);
}

.activity-list {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding-left: 1rem;
  color: var(--text-soft);
}

.activity-list li {
  line-height: 1.6;
}

.admin-two-col {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.admin-form {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
}

.admin-form h2 {
  margin: 0;
}

.admin-list {
  display: grid;
  gap: 0.75rem;
}

.admin-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
}

.admin-item p {
  color: var(--text-soft);
  margin: 0.4rem 0;
}

.admin-item-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn.danger {
  color: var(--danger);
}

@media (max-width: 760px) {
  .sticky-mobile-cta {
    display: inline-flex;
  }

  .resource-tools,
  .admin-two-col,
  .admin-header {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .admin-item {
    flex-direction: column;
  }

  .admin-group-card summary {
    grid-template-columns: 1fr;
  }
}

/* Auth UI Fade-in */
.auth-main { opacity: 0; transition: opacity 0.3s; }
.auth-checked .auth-main { opacity: 1; }

/* Admin Dashboard UI */
.admin-header-actions { display: flex; align-items: center; gap: 1rem; }
.global-search-container input { padding: 0.5rem 1rem; border-radius: 6px; border: 1px solid var(--line); background: var(--card); color: var(--text); width: 300px; }
.dashboard-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.metric-card { background: var(--card); border: 1px solid var(--line); padding: 1.5rem; border-radius: 8px; text-align: center; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.metric-card h3 { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.metric-card p { font-size: 2rem; font-weight: 700; color: var(--primary); margin: 0; }
.dashboard-lower { display: grid; grid-template-columns: 2fr 1fr; gap: 2rem; }
.dashboard-activity, .dashboard-quick-actions { background: var(--card); border: 1px solid var(--line); padding: 1.5rem; border-radius: 8px; }
.dashboard-quick-actions button { display: block; width: 100%; margin-bottom: 0.5rem; }
.activity-feed-item { padding: 0.75rem 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.activity-feed-item:last-child { border-bottom: none; }
.activity-time { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; display: block; }

/* Admin Three Col */
.admin-three-col { display: grid; grid-template-columns: 280px minmax(320px, 1fr) minmax(320px, 1fr); gap: 2rem; align-items: start; }
@media (max-width: 1024px) { .admin-three-col { grid-template-columns: 1fr; } }
.markdown-preview { background: var(--card); border: 1px solid var(--line); padding: 1.5rem; border-radius: 8px; overflow-y: auto; max-height: calc(100vh - 150px); font-family: system-ui, sans-serif; line-height: 1.6; }
.markdown-preview h1 { font-size: 1.8rem; margin-bottom: 1rem; }
.markdown-preview h2 { font-size: 1.4rem; margin-top: 1.5rem; margin-bottom: 0.5rem; }
.markdown-preview p { margin-bottom: 1rem; }
.markdown-preview img { max-width: 100%; border-radius: 8px; }

.form-actions-inline { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; }
.autosave-status { font-size: 0.85rem; color: var(--text-muted); }

/* Drag and drop */
.admin-item[draggable=true] { cursor: grab; }
.admin-item.dragging { opacity: 0.5; border-color: var(--primary); }

/* Phase 3: Premium UI & QC Additions */
.card, .price-card, .feature-grid article, .admin-panel { background: var(--card); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,0.05); box-shadow: var(--shadow); transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease; }
.card:hover, .price-card:hover, .feature-grid article:hover { transform: translateY(-4px); box-shadow: 0 32px 90px rgba(0, 0, 0, 0.4); border-color: rgba(255,255,255,0.1); }
.site-header { background: rgba(11, 16, 32, 0.7); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-bottom: 1px solid rgba(255,255,255,0.05); }
:root[data-theme=light] .site-header { background: rgba(255, 255, 255, 0.8); border-bottom: 1px solid rgba(0,0,0,0.05); }
.reveal-hidden { opacity: 0; transform: translateY(30px); transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1); }
.reveal-visible { opacity: 1; transform: translateY(0); }


/* ============================================================
   V15 ADDITIONS — Skeleton, Carousel, Admin CRUD, Layout Fixes
   ============================================================ */

/* ── Skeleton Loaders ─────────────────────────────────────── */
@keyframes skeleton-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton-text {
  background: linear-gradient(90deg, var(--card) 25%, var(--line) 50%, var(--card) 75%);
  background-size: 800px 100%;
  animation: skeleton-shimmer 1.6s infinite linear;
  border-radius: 6px;
  color: transparent !important;
  user-select: none;
  min-height: 1em;
  display: block;
}

.skeleton-text::after {
  content: '\00a0';
}

/* ── WhatsApp — suppress on admin/login/dashboard pages ──── */

.desmos-panel {
  width: min(360px, 100%);
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  overflow: hidden;
}

.bluebook-brand {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}

.bluebook-brand img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.desmos-panel summary {
  cursor: pointer;
  padding: .75rem 1rem;
  font-weight: 700;
}

.desmos-panel iframe {
  display: block;
  width: 100%;
  height: 480px;
  border: 0;
}

@media (max-width: 760px) {
  .desmos-panel[open] {
    position: fixed;
    inset: 5vh 1rem;
    z-index: 1000;
    box-shadow: 0 24px 70px rgba(0,0,0,.25);
  }

  .desmos-panel iframe {
    height: calc(90vh - 3rem);
  }
}

/* ── Carousel ─────────────────────────────────────────────── */
.carousel-viewport {
  overflow: hidden;
  position: relative;
  width: 100%;
}

.carousel-track {
  display: flex;
  gap: 1.5rem;
  animation: carousel-scroll 30s linear infinite;
  will-change: transform;
  width: max-content;
}

.carousel-track:hover {
  animation-play-state: paused;
}

@keyframes carousel-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

.carousel-item {
  flex: 0 0 320px;
  min-width: 280px;
  max-width: 340px;
}

@media (max-width: 600px) {
  .carousel-item { flex: 0 0 260px; min-width: 240px; }
}

.card-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 0.75rem;
}

.card-role {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.card-score {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  margin-bottom: 0.5rem;
}

/* ── Price card bullets ───────────────────────────────────── */
.price-bullets {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  text-align: left;
}

.price-bullets li {
  padding: 0.3rem 0;
  padding-left: 1.4rem;
  position: relative;
  font-size: 0.9rem;
}

.price-bullets li::before {
  content: '✓';
  color: var(--primary);
  position: absolute;
  left: 0;
  font-weight: 700;
}

/* ── Feature icon ─────────────────────────────────────────── */
.feature-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}

.feature-link {
  display: inline-block;
  margin-top: 0.75rem;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.9rem;
}

/* ── Admin Homepage Grid ──────────────────────────────────── */
.admin-homepage-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 900px) {
  .admin-homepage-grid { grid-template-columns: 1fr; }
}

.admin-homepage-col {
  display: grid;
  gap: 0;
}

/* ── Admin CRUD mini sections (Stats / FAQ) ───────────────── */
.admin-crud-section {
  background: var(--surface, var(--card));
  border: 1px solid var(--border, var(--line));
  border-radius: 10px;
  padding: 1.25rem;
}

.admin-crud-section h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
}

.admin-mini-list {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.admin-mini-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-soft, var(--card-2));
  border: 1px solid var(--border, var(--line));
  border-radius: 8px;
  font-size: 0.9rem;
}

.admin-mini-item > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.admin-mini-item strong {
  font-size: 1rem;
  display: block;
}

.admin-mini-item span {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-mini-form {
  padding-top: 1rem;
  border-top: 1px solid var(--border, var(--line));
  margin-top: 0.5rem;
}

/* ── Section Order Drag List ──────────────────────────────── */
.section-order-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.section-order-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-soft, var(--card));
  border: 1px solid var(--border, var(--line));
  border-radius: 8px;
  cursor: grab;
  font-size: 0.9rem;
  user-select: none;
  transition: background 0.15s;
}

.section-order-item:active { cursor: grabbing; }
.section-order-item.dragging { opacity: 0.45; border-color: var(--primary); }
.section-order-item .drag-handle { color: var(--muted); font-size: 1rem; }

/* ── Admin Three-Column (Blog/SEO Editor) ─────────────────── */
.admin-three-col {
  display: grid;
  grid-template-columns: 260px 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
  min-height: 0;
}

@media (max-width: 1100px) {
  .admin-three-col {
    grid-template-columns: 1fr 1fr;
  }
  .admin-three-col-list { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .admin-three-col { grid-template-columns: 1fr; }
}

.admin-three-col-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.admin-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border, var(--line));
}

.admin-list-header h3 { margin: 0; font-size: 0.95rem; }

.admin-three-col-editor {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-right: 0.5rem;
}

.admin-three-col-preview {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.preview-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Admin item improvements ──────────────────────────────── */
.admin-item {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
}

.admin-item .drag-handle {
  cursor: grab;
  color: var(--muted);
  font-size: 1rem;
  padding: 0.25rem;
}

.admin-item-body {
  min-width: 0;
}

.admin-item-body strong {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-item-body p {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

.status-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-published { background: rgba(43,182,115,0.15); color: #2bb673; }
.status-draft     { background: rgba(130,144,179,0.15); color: var(--muted); }
.status-scheduled { background: rgba(245,166,35,0.15); color: #f5a623; }

/* ── Bullet editor (pricing) ──────────────────────────────── */
.bullet-editor { border-top: 1px solid var(--border, var(--line)); margin-top: 1rem; }

.bullet-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.bullet-row input {
  flex: 1;
}

/* ── Text muted utility ───────────────────────────────────── */
.text-muted { color: var(--muted); font-size: 0.875rem; }

/* ── Announcement bar ─────────────────────────────────────── */
.announcement-bar {
  background: var(--primary);
  color: #fff;
  text-align: center;
  padding: 0.6rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  position: relative;
  z-index: 100;
}

/* ── Lead form on homepage ────────────────────────────────── */
.lead-form {
  display: grid;
  gap: 0.75rem;
}

.lead-form label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.lead-form input {
  padding: 0.65rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border, var(--line));
  background: var(--bg-soft, var(--card));
  color: var(--text);
  width: 100%;
}

/* ── Admin draggable items ────────────────────────────────── */
.draggable-item { cursor: grab; }
.draggable-item:active { cursor: grabbing; }
.draggable-item.dragging { opacity: 0.4; border-color: var(--primary) !important; }

/* ═══════════════════════════════════════════════════════════════
   FOOTER — Stacked column layout (V16)
═══════════════════════════════════════════════════════════════ */

.footer-inner--stacked {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.25rem;
}

.footer-inner--stacked .footer-brand img {
  margin-inline: auto;
}

.footer-inner--stacked .footer-social {
  margin-left: 0;
  justify-content: center;
}

.footer-nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  justify-content: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-nav-links a {
  color: var(--text-soft);
  font-size: 0.84rem;
  text-decoration: none;
  transition: color 150ms ease;
}

.footer-nav-links a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.footer-nav-links span {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1;
}

.footer-inner--stacked .footer-copy {
  width: auto;
}

/* ═══════════════════════════════════════════════════════════════
   ARTICLE BODY — Reading container & typography (V16)
═══════════════════════════════════════════════════════════════ */

.article-page.section-pad {
  max-width: 860px;
  margin-inline: auto;
}

.article-body {
  max-width: 720px;
  margin-inline: auto;
  font-size: 1.08rem;
  line-height: 1.85;
  color: var(--text-soft);
}

.article-body p {
  margin-bottom: 1.4rem;
  color: var(--text-soft);
}

.article-body h2 {
  margin-top: 2.25rem;
  margin-bottom: 0.85rem;
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  color: var(--text);
  line-height: 1.2;
}

.article-body h3 {
  margin-top: 1.75rem;
  margin-bottom: 0.65rem;
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  color: var(--text);
  line-height: 1.3;
}

.article-body h4 {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  font-size: 1rem;
  color: var(--text);
}

.article-body ul,
.article-body ol {
  padding-left: 1.6rem;
  margin-bottom: 1.4rem;
}

.article-body li {
  margin-bottom: 0.55rem;
}

.article-body img {
  width: 100%;
  border-radius: 8px;
  margin: 1.75rem 0;
}

.article-body a {
  color: var(--primary-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 140ms ease;
}

.article-body a:hover {
  color: var(--text);
}

.article-body blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--primary-hover);
  background: color-mix(in srgb, var(--primary), transparent 90%);
  border-radius: 0 8px 8px 0;
  color: var(--text);
  font-style: italic;
}

.article-body code {
  background: color-mix(in srgb, var(--card-2), transparent 10%);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.15em 0.4em;
  font-size: 0.9em;
  font-family: ui-monospace, "Cascadia Code", "Fira Code", monospace;
}

.article-body pre {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.4rem;
}

.article-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.9rem;
}

/* ── Article bottom WhatsApp CTA ─────────────────────────────── */

.article-cta {
  max-width: 720px;
  margin: 3rem auto 0;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--primary), transparent 88%),
    color-mix(in srgb, var(--card), transparent 4%));
  text-align: center;
}

.article-cta h2 {
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  margin-bottom: 0.65rem;
  color: var(--text);
}

.article-cta p {
  color: var(--text-soft);
  margin-bottom: 1.25rem;
  font-size: 1rem;
}

.article-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.75rem;
  font-size: 1rem;
}

/* ═══════════════════════════════════════════════════════════════
   ADMIN - Collapsible article cards
═══════════════════════════════════════════════════════════════ */

.admin-collapsible-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--card), transparent 4%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  transition: border-color 160ms ease;
}

.admin-collapsible-item[open] {
  border-color: color-mix(in srgb, var(--primary), transparent 55%);
}

.admin-collapsible-summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.admin-collapsible-summary::-webkit-details-marker {
  display: none;
}

.admin-collapsible-summary:hover {
  background: color-mix(in srgb, var(--primary), transparent 94%);
}

.admin-collapsible-title {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.admin-collapsible-title strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 380px;
  font-size: 0.95rem;
}

.admin-collapsible-toggle {
  color: var(--muted);
  font-size: 1rem;
  transition: transform 200ms ease;
  flex-shrink: 0;
}

.admin-collapsible-item[open] .admin-collapsible-toggle {
  transform: rotate(180deg);
}

.admin-collapsible-body {
  padding: 0.85rem 1rem 1rem;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0.85rem;
  background: color-mix(in srgb, var(--card-2), transparent 10%);
}

.admin-collapsible-excerpt {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.875rem;
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════
   CONTACT PAGE SOCIAL LINKS
═══════════════════════════════════════════════════════════════ */

.contact-social-links {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 1rem;
}

.contact-social-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--card), transparent 4%);
  color: var(--text);
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.contact-social-btn:hover {
  transform: translateY(-2px);
  border-color: var(--primary-hover);
}

.contact-social-btn svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

/* Brand colors on hover */
.contact-social-btn.whatsapp:hover {
  border-color: #25D366;
  background: color-mix(in srgb, #25D366, var(--card) 94%);
  color: #25D366;
}

.contact-social-btn.facebook:hover {
  border-color: #1877F2;
  background: color-mix(in srgb, #1877F2, var(--card) 94%);
  color: #1877F2;
}

.contact-social-btn.instagram:hover {
  border-color: #E1306C;
  background: color-mix(in srgb, #E1306C, var(--card) 94%);
  color: #E1306C;
}

.contact-social-btn.tiktok:hover {
  border-color: #000000;
  background: color-mix(in srgb, var(--text), var(--card) 94%);
}
[data-theme="dark"] .contact-social-btn.tiktok:hover {
  border-color: #ffffff;
}

/* Platform pages */
.platform-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: end;
}

.platform-page {
  max-width: 1180px;
  margin: 0 auto;
}

.platform-workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.filter-panel,
.resource-panel,
.question-bank-row {
  background: color-mix(in srgb, var(--card), transparent 4%);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.filter-panel,
.resource-panel {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
}

.filter-panel label,
.schedule-form label {
  display: grid;
  gap: 0.35rem;
  color: var(--text-soft);
  font-weight: 700;
}

.filter-panel input,
.filter-panel select,
.schedule-form input,
.schedule-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.78rem 0.85rem;
  background: var(--bg-soft);
  color: var(--text);
}

.toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.toolbar-row h2 {
  margin: 0;
}

.schedule-form,
.hero-actions,
.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.question-list,
.review-stack {
  display: grid;
  gap: 0.8rem;
}

.question-bank-row,
.resource-panel a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg-soft), transparent 14%);
}

.question-bank-row span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Legacy .bluebook-shell — overridden by the authoritative flex-column
   rules at the bottom of this file. Kept for non-practice pages. */
.bluebook-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #f6f7fb;
  color: #111827;
}

.bluebook-header,
.bluebook-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 3vw, 2rem);
  background: #ffffff;
  border-bottom: 1px solid #d9deea;
}

.bluebook-footer {
  border-top: 1px solid #d9deea;
  border-bottom: 0;
}

.bluebook-body {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  min-height: 0;
}

.bluebook-nav {
  display: grid;
  align-content: start;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.45rem;
  padding: 1rem;
  background: #e9edf6;
  border-right: 1px solid #d9deea;
}

.bluebook-nav button {
  min-width: 0;
  height: 42px;
  border: 1px solid #aeb8ce;
  border-radius: 8px;
  background: #fff;
  color: #172033;
  cursor: pointer;
}

.bluebook-nav button.active {
  background: #1e2f99;
  color: #fff;
}

.bluebook-nav button.flagged {
  border-color: #f5a623;
  box-shadow: inset 0 -4px 0 #f5a623;
}

.bluebook-question {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem);
}

/* ── Consistent question typography ── */
.sat-stimulus,
.sat-stem,
.bb-rr-question-content,
.bb-rr-rationale-body,
.bb-rr-choices {
  margin-bottom: 1rem;
  font-size: 1.05rem;
  line-height: 1.6;
  word-break: normal;
  overflow-wrap: break-word;
}

.bluebook-choice,
.student-response {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 0.8rem;
  align-items: start;
  padding: 0.9rem;
  margin-bottom: 0.75rem;
  border: 1px solid #cbd3e4;
  border-radius: 8px;
  background: #fff;
  position: relative;   /* contain the zero-size hidden radio */
  cursor: pointer;
  transition: border-color 0.15s;
}

/* Highlight the whole card when selected */
.bluebook-choice:has(input[type="radio"]:checked) {
  border-color: var(--primary, #2563eb);
  background: color-mix(in srgb, var(--primary, #2563eb), transparent 92%);
}

/* Highlight the letter badge when selected */
.bluebook-choice:has(input[type="radio"]:checked) .choice-badge {
  background: var(--primary, #2563eb);
  color: #fff;
  border-color: var(--primary, #2563eb);
}



/* Only the letter badge gets the circle — NOT every span inside (which would hit MathJax spans) */
.choice-badge {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  min-width: 30px;
  border: 1.5px solid #aeb8ce;
  border-radius: 999px;
  font-weight: 800;
  flex-shrink: 0;
  font-size: 0.9rem;
  line-height: 1;
}



/* Hide the raw radio button — the choice-badge circle is the only visible indicator */
.bluebook-choice input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  position: absolute;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.student-response {
  grid-template-columns: 1fr;
}

.student-response input {
  max-width: 260px;
  border: 1px solid #aeb8ce;
  border-radius: 8px;
  padding: 0.85rem;
}

.practice-review {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: clamp(1rem, 4vw, 3rem);
}

@media (max-width: 860px) {
  .platform-hero,
  .platform-workspace {
    grid-template-columns: 1fr;
  }

  .filter-panel,
  .resource-panel {
    position: static;
  }

  .bluebook-body {
    grid-template-columns: 1fr;
  }

  .bluebook-nav {
    grid-template-columns: repeat(8, minmax(40px, 1fr));
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid #d9deea;
  }
}

.announcement-bar {
  z-index: 140;
}

@media (max-width: 960px) {
  .site-nav {
    top: 2.55rem !important;
    z-index: 130;
  }
}

.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
}

.google-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.qb-builder {
  display: grid;
  gap: 1.25rem;
}

.qb-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.qb-summary article,
.qb-domain,
.skill-domain,
.progress-chart,
.history-columns section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 1rem;
}

.qb-summary strong {
  display: block;
  font-size: 1.6rem;
}

.qb-summary span {
  color: var(--muted);
}

.qb-filter-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 0.9rem;
  align-items: end;
}

.qb-filter-row label {
  display: grid;
  gap: 0.35rem;
  font-weight: 700;
}

.qb-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.qb-tree {
  display: grid;
  gap: 0.75rem;
}

.qb-domain summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-weight: 800;
}

.qb-skill-list {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.8rem;
}

.qb-skill-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.8rem;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg-soft), transparent 15%);
}

.qb-skill-row label {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.qb-play {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--primary);
  color: #fff;
  cursor: pointer;
}

.dashboard-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.25rem 0;
}

.dashboard-tabs button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  padding: 0.65rem 1rem;
  font-weight: 800;
  cursor: pointer;
}

.dashboard-tabs button.active {
  background: var(--primary);
  color: #fff;
}

.progress-chart svg {
  width: 100%;
  height: 180px;
  max-height: 180px;
}

.progress-chart circle {
  fill: var(--surface);
  stroke: var(--primary);
  stroke-width: 1.6;
}

/* Chart data point circles */
.progress-chart circle {
  fill: var(--primary);
  stroke: var(--surface);
  stroke-width: 2;
  cursor: pointer;
  transition: r 0.15s;
}
.progress-chart circle:hover,
.progress-chart circle:focus {
  r: 6;
  outline: none;
}

.chart-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.25rem 0;
}

.latest-score {
  font-weight: 900;
  margin: 0;
  font-size: 1rem;
}
.latest-score.up  { color: #15803d; }
.latest-score.down{ color: #b91c1c; }

/* History cards — now clickable buttons */
.db-test-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.db-test-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 18px color-mix(in srgb, var(--primary) 15%, transparent);
  transform: translateY(-1px);
}
.db-test-score-badge {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--primary);
}
.db-test-view-cta {
  display: block;
  margin-top: 0.6rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  text-align: right;
}

/* ── Session results modal ── */
.sr-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
  backdrop-filter: blur(4px);
}
.sr-modal {
  background: var(--surface);
  border-radius: 16px;
  width: 100%;
  max-width: 740px;
  padding: 2rem;
  box-shadow: 0 24px 64px rgba(0,0,0,0.3);
  position: relative;
  animation: srSlideIn 0.22s ease;
}
@keyframes srSlideIn {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
.sr-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.sr-eyebrow {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  margin: 0;
}
.sr-date { color: var(--muted); margin: 0.25rem 0 0; font-size: 0.88rem; }
.sr-score-circle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--primary);
  flex-shrink: 0;
}
.sr-score-val { font-size: 1.5rem; font-weight: 900; color: var(--primary); line-height: 1; }
.sr-score-lbl { font-size: 0.65rem; font-weight: 700; color: var(--muted); margin-top: 2px; }
.sr-close {
  background: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 1rem;
  color: var(--muted);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.sr-close:hover { background: var(--line); }
.sr-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.75rem;
  padding: 1rem;
  background: var(--bg-soft);
  border-radius: 10px;
}
.sr-stat { text-align: center; }
.sr-stat-n { display: block; font-size: 1.6rem; font-weight: 900; }
.sr-stat-l { font-size: 0.75rem; color: var(--muted); }
.sr-section-title {
  font-size: 0.88rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 1.25rem 0 0.75rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}
.sr-domains { display: grid; gap: 0.5rem; }
.sr-domain-row {
  display: grid;
  grid-template-columns: 1fr 160px 56px;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}
.sr-bar-track {
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.sr-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.sr-table-wrap {
  overflow-x: auto;
  margin-top: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.sr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}
.sr-table th {
  background: var(--bg-soft);
  padding: 0.6rem 0.75rem;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--line);
}
.sr-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--line);
}
.sr-table tr:last-child td { border-bottom: none; }
.bb-answer-correct  { color: #15803d; font-weight: 700; }
.bb-answer-incorrect{ color: #b91c1c; font-weight: 700; }

.skills-breakdown,
.history-columns {
  display: grid;
  gap: 1rem;
}

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

.skill-domain h3 {
  margin-top: 0;
}

.skill-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--line);
}

.skill-strong {
  color: #15803d;
}

.skill-weak {
  color: #b91c1c;
}

.bluebook-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
}

.bluebook-tools button {
  border: 1px solid #cbd3e4;
  background: #fff;
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  font-weight: 800;
  cursor: pointer;
}

/* legacy rule – overridden by the definitive .bluebook-body block below */

.bluebook-side-panel {
  border-left: 1px solid #d9deea;
  background: #fff;
  padding: 1rem;
  overflow: auto;
}

.desmos-frame {
  width: 100%;
  min-height: 520px;
  border: 0;
}

.choice-eliminate {
  grid-column: 3;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid #cbd3e4;
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.bluebook-choice {
  /* 3 columns: [badge] [content] [eliminate button] — radio input is invisible (zero-size) */
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.choice-content {
  min-width: 0;
  width: 100%;
}

.bluebook-choice.is-eliminated {
  opacity: 0.55;
}

.bluebook-choice.is-eliminated > div {
  text-decoration: line-through;
}

.pause-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-content: center;
  gap: 0.75rem;
  background: rgba(246, 247, 251, 0.7);
  backdrop-filter: blur(10px);
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 0.6rem;
  margin: 1rem 0;
}

.review-grid button {
  height: 46px;
  border: 1px solid #aeb8ce;
  border-radius: 8px;
  background: #fff;
}

.review-grid button.answered {
  border-color: #1e2f99;
}

.review-grid button.flagged {
  box-shadow: inset 0 -4px 0 #f5a623;
}

.admin-header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.admin-header-actions input {
  min-width: min(320px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
}

@media (max-width: 860px) {
  .qb-summary,
  .qb-filter-row,
  .history-columns {
    grid-template-columns: 1fr;
  }

  .bluebook-header,
  .bluebook-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .bluebook-body {
    grid-template-columns: 1fr;
  }

  .bluebook-side-panel {
    border-left: 0;
    border-top: 1px solid #d9deea;
  }
}

/* Final repair pass overrides */
:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary-hover), #fff 18%);
  outline-offset: 3px;
}

.hero .skeleton-text {
  min-height: 0;
  color: inherit !important;
  background: none;
  animation: none;
}

.story-card img,
.card-avatar {
  height: auto;
  min-height: 120px;
  max-height: 220px;
  border-radius: 8px;
  object-fit: contain;
  object-position: center;
  background: color-mix(in srgb, var(--bg-soft), var(--card) 50%);
}

.story-card .card-score,
.card-score {
  color: #fff;
}

.qb-continue-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid color-mix(in srgb, var(--primary), var(--line) 45%);
  border-radius: 18px;
  padding: 1rem;
  background: color-mix(in srgb, var(--card), var(--primary) 8%);
}

.qb-continue-card h2,
.qb-continue-card p {
  margin: 0;
}

.qb-filter-row select,
.qb-filter-row input {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  min-height: 48px;
  padding: 0.75rem 1rem;
}

.qb-domain,
.qb-summary article {
  background: color-mix(in srgb, var(--card), transparent 4%);
}

.qb-play {
  font-size: 0.82rem;
}

/* Legacy .bluebook-shell — overridden by the authoritative flex-column
   rules in the practice-page section. Kept for non-practice pages. */
.bluebook-shell {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  min-height: calc(100vh - 160px);
  background: var(--bg-soft);
  color: var(--text);
}

.bluebook-topbar,
.bluebook-footer {
  position: sticky;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 3vw, 2rem);
  background: color-mix(in srgb, var(--card), transparent 2%);
  border-block: 1px solid var(--line);
}

.bluebook-topbar {
  top: 0;
}

.bluebook-footer {
  bottom: 0;
}

/* ── Bluebook body: 2-col base, 3-col when calculator is open ── */
.bluebook-body {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  /* stretch to fill the 1fr row in .bluebook-shell */
  align-self: stretch;
  overflow: hidden;
  background: color-mix(in srgb, var(--bg), var(--bg-soft) 42%);
}

.bluebook-body.has-calculator {
  grid-template-columns: 112px minmax(0, 1fr) minmax(300px, 380px);
}

/* ── Question navigator ── */
.bluebook-nav {
  /* scroll within its grid cell, don't set max-height in pixels */
  overflow-y: auto;
  overflow-x: hidden;
  background: color-mix(in srgb, var(--card), transparent 5%);
  border-right: 1px solid var(--line);
}

.bluebook-nav button {
  border-color: var(--line);
  background: var(--bg-soft);
  color: var(--text);
}

/* Current question – blue, highest priority */
.bluebook-nav button.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary), transparent 55%);
}

/* Answered – green outline */
.bluebook-nav button.answered {
  border-color: var(--success);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--success), transparent 65%);
}

/* Flagged – yellow glow */
.bluebook-nav button.flagged {
  border-color: var(--warning);
  box-shadow: 0 0 14px color-mix(in srgb, var(--warning), transparent 35%);
}

/* ── Docked calculator panel (right column) ── */
.calculator-panel {
  display: flex;
  flex-direction: column;
  /* stretch to full height of the grid row */
  align-self: stretch;
  border-left: 1px solid var(--line);
  background: #fff;
  overflow: hidden;
  /* ensure the panel doesn't overflow its column */
  min-width: 0;
  min-height: 0;
  position: sticky;
  top: 0;
  /* fill from top of viewport to bottom when sticky */
  height: calc(100vh - 120px);
  max-height: 100%;
}

.calculator-panel .desmos-frame,
.calculator-panel iframe {
  flex: 1 1 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
  display: block;
}

/* ── Image unavailable placeholder ── */
.image-unavailable {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
  background: color-mix(in srgb, var(--bg-soft), transparent 20%);
  min-width: 120px;
  min-height: 48px;
}

.bluebook-question {
  width: min(860px, 100%);
  align-self: start;
  /* allow the question area to scroll independently */
  overflow-y: auto;
  padding: 1.5rem clamp(1rem, 3vw, 2rem);
  /* Take full height of its cell so sticky footer anchors correctly */
  box-sizing: border-box;
}

/* ── Share toast ── */
.practice-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  background: #1a2540;
  color: #fff;
  padding: 0.65rem 1.4rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 4px 24px rgba(0,0,0,0.28);
  white-space: nowrap;
  pointer-events: none;
  animation: toast-in 0.2s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  color: var(--muted);
  font-weight: 700;
}

.bluebook-choice,
.student-response {
  border-color: var(--line);
  background: var(--card);
  color: var(--text);
}

/* Dark-mode selected state — override the light-mode :has() rule */
.bluebook-choice:has(input[type="radio"]:checked) {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary), var(--card) 88%);
}

.bluebook-choice:has(input[type="radio"]:checked) .choice-badge {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}


.student-response input {
  background: var(--bg-soft);
  color: var(--text);
}

.bluebook-tools button,
.icon-btn {
  min-width: 44px;
  min-height: 44px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}

.icon-btn svg,
.flag-btn svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.flag-btn {
  color: #ef4444;
}

.bluebook-timer {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 900;
}

.modal-backdrop,
.pause-overlay {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(12px);
}

.practice-modal,
.pause-card {
  width: min(92vw, 760px);
  max-height: 86vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  padding: 1rem;
  box-shadow: var(--shadow);
}

/* .calculator-modal removed – calculator is now a docked panel, not a modal */

.modal-close {
  float: right;
  font-size: 1.4rem;
}

.reference-sheet img {
  width: 100%;
  max-height: 74vh;
  object-fit: contain;
  border-radius: 8px;
}

.desmos-frame {
  width: 100%;
  height: 100%;
  min-height: 480px;
  border: 0;
  background: #fff;
  display: block;
}

.pause-card {
  width: min(92vw, 420px);
  display: grid;
  gap: 0.75rem;
  text-align: center;
}

.btn.danger,
.btn.secondary.danger {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.placement-results .report-box strong {
  display: block;
  font-size: clamp(2rem, 8vw, 4rem);
}

.contact-details-only {
  display: grid;
  max-width: 760px;
  margin-inline: auto;
}

.db-avatar,
.db-avatar-wrap,
.profile-photo-section,
.profile-avatar-lg,
.profile-photo-wrap {
  display: none !important;
}

body[data-page="admin"] .admin-shell {
  padding-top: 1rem;
}

@media (max-width: 860px) {
  .qb-continue-card,
  .bluebook-topbar,
  .bluebook-footer {
    align-items: stretch;
    flex-direction: column;
  }

  /* Mobile: single column, calculator stacks ABOVE question */
  .bluebook-body,
  .bluebook-body.has-calculator {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
    overflow-y: auto;
    height: auto;
  }

  .bluebook-nav {
    grid-column: 1;
    grid-row: 1;
    max-height: none;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    /* Override the flex-direction:column from desktop */
    flex-direction: row;
  }

  /* Calculator panel on top on mobile */
  .calculator-panel {
    grid-column: 1;
    grid-row: 2;
    position: static; /* remove sticky on mobile */
    border-left: 0;
    border-bottom: 1px solid var(--line);
    height: 320px;
    max-height: 320px;
    min-height: 0;
  }

  .calculator-panel .desmos-frame,
  .calculator-panel iframe {
    min-height: 0;
    height: 100%;
  }

  /* Question below calculator */
  .bluebook-question {
    grid-column: 1;
    grid-row: 3;
    width: 100%;
    overflow-y: visible;
    padding: 1rem;
  }
}

/* ============================================================
   SAT EGYPT — BLUEBOOK-STYLE PRACTICE EXPERIENCE
   All new rules below.
   ============================================================ */

/* ── Hide site footer and announcement bar on practice pages ── */
body[data-page="practice"] site-footer,
body[data-page="practice"] .announcement-bar {
  display: none !important;
}

body[data-page="practice"] {
  min-height: 100vh;
  overflow: hidden;
}

/* ── Bluebook shell: full-height flex column ── */
.bluebook-shell {
  display: flex !important;
  flex-direction: column !important;
  height: 100vh !important;
  min-height: 100vh !important;
  background: #f5f6fa;
  color: #111827;
  position: relative;
}

[data-theme="dark"] .bluebook-shell {
  background: #0d1117;
  color: #e6eaf6;
}

/* ── Top test bar ── */
.bb-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1.25rem;
  background: #1a2540;
  color: #ffffff;
  border-bottom: 2px solid #243055;
  min-height: 56px;
}

.bb-topbar-left  { display: flex; align-items: center; gap: 0.5rem; }
.bb-topbar-center{ display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
.bb-topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; }

.bb-directions-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s;
}
.bb-directions-btn:hover { background: rgba(255,255,255,0.1); }
.bb-directions-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.bb-timer {
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.bb-timer--hidden [data-timer] { visibility: hidden; }

.bb-timer-toggle {
  background: transparent !important;
  border-color: rgba(255,255,255,0.25) !important;
  color: #fff !important;
  width: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  height: 36px !important;
}
.bb-timer-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.bb-tool-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  min-height: 44px;
  line-height: 1.1;
}
.bb-tool-btn:hover { background: rgba(255,255,255,0.12); }
.bb-tool-btn--active { background: rgba(255,255,255,0.2) !important; border-color: rgba(255,255,255,0.5) !important; }
.bb-tool-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── Question header strip ── */
.bb-question-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1.25rem;
  background: #252f48;
  color: #ffffff;
  border-bottom: 1px solid #1a2540;
  min-height: 48px;
}

.bb-qnum-badge {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: #3854d1;
  color: #fff;
  font-weight: 900;
  font-size: 1rem;
  flex-shrink: 0;
}

.bb-mark-review-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.75);
  border-radius: 6px;
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.bb-mark-review-btn:hover { border-color: #ef4444; color: #ef4444; }
.bb-mark-review-btn--active { color: #ef4444 !important; border-color: #ef4444 !important; }
.bb-mark-review-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.bb-share-btn {
  margin-left: auto;
  background: transparent !important;
  border-color: rgba(255,255,255,0.3) !important;
  color: rgba(255,255,255,0.75) !important;
}
.bb-share-btn:hover { border-color: rgba(255,255,255,0.7) !important; color: #fff !important; }
.bb-share-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── Main body ── */
.bb-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.bb-body--spr {
  flex-direction: row;
  --spr-left-width: 320px;
}

.bb-spr-directions {
  width: var(--spr-left-width, 320px);
  min-width: 160px;
  max-width: 55%;
  flex-shrink: 0;
  overflow-y: auto;
  background: #fff;
  border-right: 1px solid #d9deea;
  padding: 1.25rem 1rem;
}
[data-theme="dark"] .bb-spr-directions {
  background: #161d30;
  border-color: #24304f;
}

.bb-body--dirs-hidden .bb-spr-directions,
.bb-body--dirs-hidden .bb-spr-divider {
  display: none;
}

.bb-spr-divider {
  width: 8px;
  flex-shrink: 0;
  background: #e2e6f0;
  cursor: col-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background 0.15s;
  user-select: none;
}
.bb-spr-divider:hover,
.bb-body--resizing .bb-spr-divider { background: #3854d1; }
.bb-spr-divider::after { content: "⋮⋮"; font-size: 0.65rem; color: #8290b3; letter-spacing: -2px; }
[data-theme="dark"] .bb-spr-divider { background: #24304f; }

.bb-question-panel {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  padding: 1.5rem clamp(1rem, 4vw, 2.5rem);
  max-width: 860px;
  align-self: flex-start;
  width: 100%;
}

.bb-body:not(.bb-body--spr) .bb-question-panel {
  margin: 0 auto;
}

.bb-body--calc-open .bb-question-panel {
  margin-left: 440px;
  margin-right: auto;
  max-width: 860px;
}

.bb-body--spr .bb-question-panel {
  margin: 0;
  max-width: none;
}

/* ── Bottom bar ── */
.bb-bottombar {
  position: sticky;
  bottom: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: #1a2540;
  color: #fff;
  border-top: 2px solid #243055;
  min-height: 60px;
  /* Always stick to the bottom of the viewport, even on short content */
  margin-top: auto;
  flex-shrink: 0; /* Never collapse — bottom bar stays full height always */
}

.bb-bottombar-left  { display: flex; align-items: center; }
.bb-bottombar-center{ display: flex; justify-content: center; }
.bb-bottombar-right { display: flex; align-items: center; justify-content: flex-end; gap: 0.6rem; }

.bb-student-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.bb-nav-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #252f48;
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  border-radius: 999px;
  padding: 0.55rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.bb-nav-trigger:hover { background: rgba(255,255,255,0.15); }
.bb-nav-trigger svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

.bb-nav-btn {
  font-size: 0.9rem;
  padding: 0.55rem 1.35rem;
  border-radius: 8px;
  font-weight: 700;
}

/* ── Navigator popup ── */
.bb-navigator-overlay {
  position: fixed;
  inset: 0;
  z-index: 59;
  background: transparent;
}

.bb-navigator-popup {
  position: fixed;
  bottom: 68px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  background: #fff;
  border: 1px solid #d9deea;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.22);
  padding: 1.25rem;
  min-width: 320px;
  max-width: min(94vw, 560px);
  max-height: 70vh;
  overflow-y: auto;
}
[data-theme="dark"] .bb-navigator-popup {
  background: #161d30;
  border-color: #24304f;
  color: #e6eaf6;
}

.bb-nav-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.25rem;
  margin-bottom: 1rem;
  font-size: 0.8rem;
  color: #55656c;
  border-bottom: 1px solid #e5e9f5;
  padding-bottom: 0.75rem;
}
[data-theme="dark"] .bb-nav-legend { border-color: #24304f; color: #8290b3; }

.bb-nav-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
}

.bb-nav-legend-swatch {
  width: 26px !important;
  height: 26px !important;
  font-size: 0.7rem !important;
  pointer-events: none;
}

/* ── Nav grid ── */
.bb-nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

/* ── Nav tile states ── */
.bb-nav-tile {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  border: 2px solid transparent;
  background: #fff;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s, background 0.15s;
}
[data-theme="dark"] .bb-nav-tile { background: #1c2640; }

.bb-nav-tile--unanswered {
  border: 2px dashed #aeb8ce;
  background: #f5f6fa;
  color: #172033;
}
[data-theme="dark"] .bb-nav-tile--unanswered { background: #1c2640; border-color: #38475e; color: #b6c2e0; }

.bb-nav-tile--answered {
  border: 2px solid #2bb673;
  background: rgba(43,182,115,0.08);
  color: #1a7049;
  box-shadow: 0 0 0 1px rgba(43,182,115,0.3);
}
[data-theme="dark"] .bb-nav-tile--answered { background: rgba(43,182,115,0.12); color: #4cd899; }

.bb-nav-tile--current {
  border: 2px solid #3854d1 !important;
  background: #3854d1 !important;
  color: #fff !important;
  box-shadow: 0 0 0 3px rgba(56,84,209,0.3) !important;
}

.bb-nav-tile--flagged {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 2px rgba(239,68,68,0.3) !important;
}

.bb-nav-tile-flag {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  background: #ef4444;
  border-radius: 4px;
  display: grid;
  place-items: center;
  color: #fff;
}
.bb-nav-tile-flag svg { width: 9px; height: 9px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

.bb-nav-actions {
  display: flex;
  justify-content: center;
  padding-top: 0.75rem;
  border-top: 1px solid #e5e9f5;
}
[data-theme="dark"] .bb-nav-actions { border-color: #24304f; }

.bb-nav-review-btn { width: 100%; justify-content: center; }

/* ── More menu ── */
.bb-more-menu {
  position: fixed;
  top: 60px;
  right: 1.25rem;
  z-index: 70;
  background: #fff;
  border: 1px solid #d9deea;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  overflow: hidden;
  min-width: 200px;
}
[data-theme="dark"] .bb-more-menu { background: #161d30; border-color: #24304f; }

.bb-more-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.7rem 1rem;
  text-align: left;
  background: transparent;
  border: none;
  color: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
}
.bb-more-item:hover { background: #f0f2f9; }
[data-theme="dark"] .bb-more-item:hover { background: #1c2640; }
.bb-more-item svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.bb-more-item--danger { color: #ef4444; }
.bb-more-sep { border-top: 1px solid #e5e9f5; margin: 0.3rem 0; }
[data-theme="dark"] .bb-more-sep { border-color: #24304f; }

/* ── Toast ── */
.practice-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  background: #1a2540;
  color: #fff;
  padding: 0.65rem 1.4rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 4px 24px rgba(0,0,0,0.28);
  pointer-events: none;
  animation: toast-in 0.2s ease;
  max-width: 90vw;
  text-align: center;
  white-space: normal;
}
.practice-toast--error { background: #7f1d1d; }

/* ── Floating calculator window ── */
.calc-floating-window {
  position: fixed;
  z-index: 80;
  border: 1px solid #24304f;
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.32);
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 300px;
  min-height: 280px;
}

.calc-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #1a2540;
  color: #fff;
  cursor: grab;
  user-select: none;
  border-radius: 11px 11px 0 0;
  flex-shrink: 0;
}
.calc-titlebar:active { cursor: grabbing; }
.calc-titlebar-left { display: flex; align-items: center; gap: 0.5rem; }
.calc-titlebar-right { display: flex; align-items: center; gap: 0.4rem; }
.calc-icon { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.calc-title { font-weight: 700; font-size: 0.85rem; }

.calc-mode-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  color: rgba(255,255,255,0.8);
  border-radius: 5px;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.calc-mode-btn.active { background: rgba(255,255,255,0.3); color: #fff; }
.calc-mode-btn:hover { background: rgba(255,255,255,0.25); }

.calc-close-btn {
  background: transparent !important;
  border-color: rgba(255,255,255,0.3) !important;
  color: rgba(255,255,255,0.8) !important;
  width: 30px !important;
  min-width: 30px !important;
  height: 30px !important;
  min-height: 30px !important;
}
.calc-close-btn:hover { background: rgba(239,68,68,0.35) !important; border-color: #ef4444 !important; color: #fff !important; }
.calc-close-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

.calc-body {
  flex: 1 1 auto;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.calc-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: #fff;
}

.calc-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem;
  background: #f5f6fa;
  text-align: center;
  color: #55656c;
}
.calc-fallback svg { width: 40px; height: 40px; fill: none; stroke: #8290b3; stroke-width: 1.5; }
.calc-fallback p { margin: 0; font-weight: 700; }
.calc-fallback-sub { font-size: 0.85rem; color: #8290b3; margin: 0 !important; }

.calc-resize-handle { position: absolute; background: transparent; }
.calc-resize-se { bottom: 0; right: 0; width: 16px; height: 16px; cursor: se-resize; }
.calc-resize-s  { bottom: 0; left: 16px; right: 16px; height: 6px; cursor: s-resize; }
.calc-resize-e  { top: 40px; right: 0; bottom: 6px; width: 6px; cursor: e-resize; }

/* ── SPR directions ── */
.spr-directions-content { padding: 0.25rem 0; }

.spr-directions-heading {
  font-size: 1rem;
  font-weight: 800;
  margin: 0 0 0.75rem;
  color: #111827;
}
[data-theme="dark"] .spr-directions-heading { color: #e6eaf6; }

.spr-directions-list {
  padding-left: 1.2rem;
  margin: 0 0 1.25rem;
  font-size: 0.87rem;
  line-height: 1.6;
  color: #333;
}
[data-theme="dark"] .spr-directions-list { color: #b6c2e0; }
.spr-directions-list li { margin-bottom: 0.45rem; }

.spr-directions-examples-heading {
  font-size: 0.9rem;
  font-weight: 800;
  margin: 0 0 0.6rem;
  color: #111827;
  border-top: 1px solid #e5e9f5;
  padding-top: 0.75rem;
}
[data-theme="dark"] .spr-directions-examples-heading { color: #e6eaf6; border-color: #24304f; }

.spr-examples-table-wrap { overflow-x: auto; border-radius: 8px; }

.spr-examples-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.spr-examples-table th {
  background: #252f48;
  color: #fff;
  font-weight: 700;
  padding: 0.45rem 0.6rem;
  text-align: left;
  white-space: nowrap;
}
.spr-examples-table td {
  border: 1px solid #e2e6f0;
  padding: 0.4rem 0.6rem;
  vertical-align: top;
}
[data-theme="dark"] .spr-examples-table td { border-color: #24304f; }
.spr-examples-table tbody tr:nth-child(even) td { background: #f8f9fc; }
[data-theme="dark"] .spr-examples-table tbody tr:nth-child(even) td { background: #1c2640; }
.spr-ex-answer { font-weight: 800; white-space: nowrap; }
.spr-ex-bad { color: #ef4444; }

/* ── SPR input / preview / validation ── */
.spr-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 320px;
}

.spr-label { font-weight: 700; font-size: 0.9rem; color: #55656c; }

.spr-input {
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.75rem 1rem;
  border: 2px solid #aeb8ce;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  max-width: 220px;
  transition: border-color 0.15s;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}
[data-theme="dark"] .spr-input { background: #1c2640; color: #e6eaf6; border-color: #38475e; }
.spr-input:focus { outline: none; border-color: #3854d1; }
.spr-input--error { border-color: #ef4444 !important; }

.spr-validation {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #ef4444;
  min-height: 1.2rem;
  margin: 0;
}
.spr-validation--hidden { visibility: hidden; }
.spr-validation-icon { font-size: 0.9rem; }

.spr-preview {
  font-size: 0.9rem;
  font-weight: 700;
  color: #111827;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  flex-wrap: wrap;
}
[data-theme="dark"] .spr-preview { color: #e6eaf6; }

.spr-preview-label { font-weight: 900; color: #111827; }
[data-theme="dark"] .spr-preview-label { color: #e6eaf6; }
.spr-preview-value { font-size: 1.05rem; font-weight: 800; color: #3854d1; }
.spr-preview-placeholder { color: #8290b3; font-weight: 400; font-style: italic; }

/* ── Review page (Check Your Work) ── */
.bb-review-page {
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 4vw, 2rem);
}

.bb-review-title {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 900;
  margin: 0 0 0.25rem;
  color: #111827;
}
[data-theme="dark"] .bb-review-title { color: #e6eaf6; }

.bb-review-sub { font-size: 0.95rem; color: #55656c; margin: 0 0 1.5rem; }

.bb-review-summary {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.bb-review-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  min-width: 80px;
  background: #fff;
  border: 1px solid #e2e6f0;
  border-radius: 10px;
  padding: 0.75rem 1rem;
}
[data-theme="dark"] .bb-review-stat { background: #161d30; border-color: #24304f; }

.bb-review-stat-num { font-size: 1.8rem; font-weight: 900; color: #111827; line-height: 1; }
[data-theme="dark"] .bb-review-stat-num { color: #e6eaf6; }

.bb-review-stat-label { font-size: 0.78rem; font-weight: 700; color: #55656c; text-transform: uppercase; letter-spacing: 0.05em; }

.bb-review-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #55656c;
}

.bb-review-grid-main { margin-bottom: 2rem; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); }

.bb-review-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding-top: 1rem;
  border-top: 1px solid #e2e6f0;
}
[data-theme="dark"] .bb-review-actions { border-color: #24304f; }

/* ── Results page ── */
.bb-results-page {
  max-width: 1000px;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 4vw, 2rem);
}

.bb-results-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid #e2e6f0;
}
[data-theme="dark"] .bb-results-header { border-color: #24304f; }

.bb-results-eyebrow { font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: #3854d1; margin: 0 0 0.3rem; }

.bb-results-title { font-size: clamp(1.4rem, 4vw, 2rem); font-weight: 900; margin: 0 0 0.25rem; color: #111827; }
[data-theme="dark"] .bb-results-title { color: #e6eaf6; }

.bb-results-date { font-size: 0.85rem; color: #8290b3; margin: 0; }

.bb-score-circle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3854d1, #5b79f5);
  color: #fff;
  text-align: center;
  flex-shrink: 0;
  box-shadow: 0 4px 24px rgba(56,84,209,0.35);
}
.bb-score-value { font-size: 1.5rem; font-weight: 900; line-height: 1; }
.bb-score-label { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin-top: 0.15rem; opacity: 0.85; }

.bb-results-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.bb-results-stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 1.25rem 1rem;
  border-radius: 12px;
  text-align: center;
  border: 1px solid #e2e6f0;
  background: #fff;
}
[data-theme="dark"] .bb-results-stat-card { background: #161d30; border-color: #24304f; }
.bb-results-stat-card--correct  { border-color: #2bb673; }
.bb-results-stat-card--incorrect{ border-color: #ef4444; }
.bb-results-stat-card--omitted  { border-color: #f5a623; }

.bb-stat-num { font-size: 2.2rem; font-weight: 900; line-height: 1; color: #111827; }
[data-theme="dark"] .bb-stat-num { color: #e6eaf6; }
.bb-results-stat-card--correct .bb-stat-num  { color: #2bb673; }
.bb-results-stat-card--incorrect .bb-stat-num{ color: #ef4444; }
.bb-results-stat-card--omitted .bb-stat-num  { color: #f5a623; }
.bb-stat-label { font-size: 0.78rem; font-weight: 700; color: #55656c; text-transform: uppercase; letter-spacing: 0.05em; }

.bb-results-two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }

.bb-results-section { margin-bottom: 2rem; }

.bb-results-section-title {
  font-size: 1.1rem;
  font-weight: 900;
  color: #111827;
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e2e6f0;
}
[data-theme="dark"] .bb-results-section-title { color: #e6eaf6; border-color: #24304f; }

.bb-results-domain { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0.5rem 0.75rem; margin-bottom: 0.85rem; }
.bb-results-domain-label { grid-column: 1 / -1; display: flex; justify-content: space-between; font-size: 0.85rem; font-weight: 700; color: #111827; }
[data-theme="dark"] .bb-results-domain-label { color: #e6eaf6; }
.bb-results-bar-track { height: 10px; background: #e2e6f0; border-radius: 999px; overflow: hidden; }
[data-theme="dark"] .bb-results-bar-track { background: #24304f; }
.bb-results-bar-fill { height: 100%; background: linear-gradient(90deg, #3854d1, #5b79f5); border-radius: 999px; transition: width 0.6s ease; }
.bb-results-bar-pct { font-size: 0.8rem; font-weight: 800; color: #3854d1; white-space: nowrap; grid-column: 2; }

.bb-skills-table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
.bb-skills-table th { text-align: left; padding: 0.5rem 0.6rem; font-weight: 800; color: #55656c; border-bottom: 2px solid #e2e6f0; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }
[data-theme="dark"] .bb-skills-table th { border-color: #24304f; color: #8290b3; }
.bb-skills-table td { padding: 0.5rem 0.6rem; border-bottom: 1px solid #f0f2f9; }
[data-theme="dark"] .bb-skills-table td { border-color: #1c2640; }

.bb-difficulty-badge { display: inline-block; padding: 0.2rem 0.55rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700; }
.bb-difficulty-easy   { background: rgba(43,182,115,0.15); color: #1a7049; }
.bb-difficulty-medium { background: rgba(245,166,35,0.15); color: #92560a; }
.bb-difficulty-hard   { background: rgba(239,68,68,0.15); color: #9b1c1c; }

.bb-results-questions-section { grid-column: 1 / -1; }
.bb-results-table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid #e2e6f0; }
[data-theme="dark"] .bb-results-table-wrap { border-color: #24304f; }
.bb-results-table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
.bb-results-table th { background: #252f48; color: #fff; font-weight: 700; padding: 0.6rem 0.85rem; text-align: left; white-space: nowrap; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.bb-results-table td { padding: 0.6rem 0.85rem; border-bottom: 1px solid #f0f2f9; vertical-align: middle; }
[data-theme="dark"] .bb-results-table td { border-color: #1c2640; }
.bb-results-table tbody tr:hover td { background: #f8f9fc; }
[data-theme="dark"] .bb-results-table tbody tr:hover td { background: #1c2640; }

.bb-answer-correct  { display: inline-flex; align-items: center; gap: 0.3rem; color: #2bb673; font-weight: 700; }
.bb-answer-incorrect{ display: inline-flex; align-items: center; gap: 0.3rem; color: #ef4444; font-weight: 700; }
.bb-answer-omitted  { color: #f5a623; font-weight: 700; }
.bb-answer-correct svg, .bb-answer-incorrect svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

.bb-review-link { font-size: 0.8rem; padding: 0.3rem 0.75rem; border-radius: 6px; }

.bb-results-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
  padding-top: 2rem;
  border-top: 1px solid #e2e6f0;
  margin-top: 1rem;
}
[data-theme="dark"] .bb-results-actions { border-color: #24304f; }

/* ── Review from results ── */
.bb-result-review { display: flex; flex-direction: column; min-height: calc(100vh - 100px); }

.bb-rr-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.75rem 1.25rem;
  background: #1a2540;
  color: #fff;
  border-bottom: 1px solid #243055;
}

.bb-rr-nav { display: flex; align-items: center; gap: 0.75rem; }
.bb-rr-nav-btn { font-size: 0.85rem; padding: 0.4rem 0.9rem; }
.bb-rr-position { font-size: 0.85rem; font-weight: 700; color: rgba(255,255,255,0.8); }

.bb-rr-status-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-weight: 700;
  font-size: 0.9rem;
  border-bottom: 1px solid transparent;
}
.bb-rr-status-bar svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.bb-rr-correct  { background: rgba(43,182,115,0.12); color: #1a7049; border-color: rgba(43,182,115,0.3); }
.bb-rr-incorrect{ background: rgba(239,68,68,0.1);  color: #9b1c1c; border-color: rgba(239,68,68,0.25); }
.bb-rr-omitted  { background: rgba(245,166,35,0.1);  color: #92560a; border-color: rgba(245,166,35,0.25); }

.bb-rr-body { flex: 1 1 auto; display: grid; grid-template-columns: 1fr 300px; gap: 0; overflow: hidden; }

.bb-rr-question-panel { padding: 1.5rem clamp(1rem, 3vw, 2rem); overflow-y: auto; border-right: 1px solid #e2e6f0; }
[data-theme="dark"] .bb-rr-question-panel { border-color: #24304f; }

.bb-rr-section-label { font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: #8290b3; margin-bottom: 1rem; }
.bb-rr-question-content { margin-bottom: 1.25rem; }
.bb-rr-choices { display: flex; flex-direction: column; gap: 0.5rem; }

.bb-rr-choice {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: start;
  padding: 0.75rem;
  border: 1.5px solid #e2e6f0;
  border-radius: 8px;
  background: #fff;
}
[data-theme="dark"] .bb-rr-choice { background: #161d30; border-color: #24304f; }
.bb-rr-choice--correct      { border-color: #2bb673 !important; background: rgba(43,182,115,0.06) !important; }
.bb-rr-choice--wrong        { border-color: #ef4444 !important; background: rgba(239,68,68,0.06) !important; }
.bb-rr-choice--your-correct { border-color: #2bb673 !important; background: rgba(43,182,115,0.1) !important; }

.bb-rr-badge { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.75rem; font-weight: 700; white-space: nowrap; padding: 0.15rem 0.5rem; border-radius: 999px; }
.bb-rr-badge svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.bb-rr-badge--correct { background: rgba(43,182,115,0.15); color: #1a7049; }
.bb-rr-badge--wrong   { background: rgba(239,68,68,0.12);  color: #9b1c1c; }

.bb-rr-spr-answers { display: flex; flex-direction: column; gap: 0.6rem; }
.bb-rr-spr-row { display: flex; align-items: center; gap: 0.5rem; }
.bb-rr-spr-label { font-weight: 700; font-size: 0.9rem; color: #55656c; }
.bb-rr-spr-val { font-weight: 800; font-size: 1rem; padding: 0.2rem 0.6rem; border-radius: 6px; }
.bb-rr-spr-val--correct { background: rgba(43,182,115,0.12); color: #1a7049; }
.bb-rr-spr-val--wrong   { background: rgba(239,68,68,0.1);  color: #9b1c1c; }

.bb-rr-side-panel { padding: 1.25rem; overflow-y: auto; background: #f8f9fc; display: flex; flex-direction: column; gap: 1.25rem; }
[data-theme="dark"] .bb-rr-side-panel { background: #0d1117; }

.bb-rr-meta { display: flex; flex-direction: column; gap: 0.4rem; }
.bb-rr-meta-row { font-size: 0.85rem; color: #55656c; }
[data-theme="dark"] .bb-rr-meta-row { color: #8290b3; }

.bb-rr-rationale { background: #fff; border-radius: 8px; border: 1px solid #e2e6f0; padding: 1rem; }
[data-theme="dark"] .bb-rr-rationale { background: #161d30; border-color: #24304f; }
.bb-rr-rationale-title { font-size: 0.9rem; font-weight: 800; margin: 0 0 0.65rem; color: #111827; }
[data-theme="dark"] .bb-rr-rationale-title { color: #e6eaf6; }
.bb-rr-rationale-body { font-size: 1.05rem; line-height: 1.6; color: #333; }
[data-theme="dark"] .bb-rr-rationale-body { color: #b6c2e0; }
.bb-rr-rationale--empty { color: #8290b3; font-style: italic; border-style: dashed; }

/* ── Keyboard shortcuts modal ── */
.shortcuts-title { font-size: 1.1rem; font-weight: 900; margin: 0 0 1rem; color: #111827; }
[data-theme="dark"] .shortcuts-title { color: #e6eaf6; }
.shortcuts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; }
.shortcuts-section h4 { font-size: 0.85rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: #8290b3; margin: 0 0 0.6rem; }
.shortcuts-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.shortcuts-table td { padding: 0.35rem 0.4rem; border-bottom: 1px solid #f0f2f9; }
[data-theme="dark"] .shortcuts-table td { border-color: #1c2640; }
.shortcuts-table td:first-child { white-space: nowrap; width: 1%; }

kbd {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border: 1px solid #cbd3e4;
  border-radius: 4px;
  background: #f5f6fa;
  color: #172033;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.75rem;
  font-weight: 700;
  margin: 0 0.1rem;
  box-shadow: 0 1px 0 #aeb8ce;
}
[data-theme="dark"] kbd { background: #1c2640; color: #e6eaf6; border-color: #38475e; box-shadow: 0 1px 0 #24304f; }

.reference-error { color: #ef4444; font-style: italic; padding: 1rem; }

/* ── Mobile ── */
@media (max-width: 768px) {
  .bb-topbar {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
  }
  .bb-topbar-left  { grid-column: 1; grid-row: 1; }
  .bb-topbar-center{ grid-column: 2; grid-row: 1; }
  .bb-topbar-right { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
  .bb-tool-btn span { display: none; }

  .bb-question-header { padding: 0.4rem 0.75rem; }

  .bb-body--spr {
    flex-direction: column;
    --spr-left-width: 100%;
  }
  .bb-spr-directions {
    width: 100% !important;
    max-width: 100%;
    max-height: 220px;
    border-right: none;
    border-bottom: 1px solid #d9deea;
  }
  .bb-spr-divider { display: none; }

  .calc-floating-window {
    left: 0 !important;
    right: 0 !important;
    bottom: 68px !important;
    top: auto !important;
    width: 100% !important;
    height: 280px !important;
    border-radius: 12px 12px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }

  .bb-body--calc-open .bb-question-panel { margin-left: 0; }

  .bb-navigator-popup {
    position: fixed;
    inset: 0;
    transform: none;
    border-radius: 0;
    max-height: none;
    bottom: 0;
    max-width: 100vw;
    width: 100vw;
    overflow-y: auto;
    border: none;
  }

  .bb-bottombar { padding: 0.6rem 0.75rem; gap: 0.5rem; grid-template-columns: auto 1fr auto; }
  .bb-student-name { display: none; }

  .bb-rr-body { grid-template-columns: 1fr; }
  .bb-rr-question-panel { border-right: none; }
  .bb-rr-side-panel { border-top: 1px solid #e2e6f0; }

  .bb-review-summary { gap: 0.75rem; }
  .bb-review-stat { min-width: 60px; padding: 0.5rem 0.6rem; }
  .bb-review-stat-num { font-size: 1.4rem; }
}

@media (max-width: 480px) {
  .bb-topbar-right { flex-wrap: wrap; gap: 0.3rem; }
  .bb-nav-trigger { font-size: 0.8rem; padding: 0.45rem 0.85rem; }
  .bb-results-stats { grid-template-columns: 1fr 1fr; }
  .bb-score-circle { width: 80px; height: 80px; }
  .bb-score-value { font-size: 1.2rem; }
}

/* ============================================================
   PRACTICE PAGE: TARGETED FIXES
   ============================================================ */

/* ── Force light mode on practice pages — never inherit dark ── */
body[data-page="practice"],
body[data-page="practice"] .bluebook-shell,
body[data-page="practice"] .bb-topbar,
body[data-page="practice"] .bb-bottombar,
body[data-page="practice"] .bb-question-panel,
body[data-page="practice"] .bb-body {
  color-scheme: light !important;
}

body[data-page="practice"] {
  height: 100vh;
  overflow: hidden;
}

/* ── Hide site chrome on practice pages ── */
body[data-page="practice"] site-header,
body[data-page="practice"] site-footer,
body[data-page="practice"] .announcement-bar,
body[data-page="practice"] .whatsapp-fab,
body[data-page="practice"] #whatsapp-btn,
body[data-page="practice"] [data-whatsapp],
body[data-page="practice"] .global-header {
  display: none !important;
}

/* ── Remove any top margin/padding the site header would have created ── */
body[data-page="practice"] .bluebook-shell {
  margin-top: 0 !important;
  padding-top: 0 !important;
  /* Fill the entire viewport so the grid rows add up correctly */
  height: 100dvh !important;
  height: 100vh !important;
  min-height: 100dvh;
  min-height: 100vh; /* fallback for browsers without dvh */
}

/* The bb-body middle row must stretch to fill remaining space */
body[data-page="practice"] .bb-body {
  flex: 1;
  min-height: 0;
}

/* ── SPR: answer directions text formatting ── */
.spr-directions-content {
  font-size: 0.9rem;
  line-height: 1.7;
  color: #172033;
}

.spr-directions-intro {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  line-height: 1.65;
}

.spr-directions-list {
  padding-left: 1.4rem;
  margin: 0 0 1rem;
  list-style: disc;
}

.spr-directions-list li {
  margin-bottom: 0.55rem;
  line-height: 1.6;
  word-spacing: normal;
  white-space: normal;
}

.spr-directions-list li + li {
  margin-top: 0;
}

/* ── SPR: fraction preview ── */
.spr-fraction {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  font-weight: 800;
  font-size: 1.1rem;
  color: #3854d1;
  vertical-align: middle;
}

.spr-frac-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  line-height: 1.1;
}

.spr-frac-num,
.spr-frac-den {
  display: block;
  padding: 0 0.15rem;
  font-size: 0.9em;
  line-height: 1.2;
}

.spr-frac-line {
  display: block;
  width: 100%;
  height: 1.5px;
  background: #3854d1;
  margin: 1px 0;
}

.spr-decimal,
.spr-integer {
  font-weight: 800;
  font-size: 1.1rem;
  color: #3854d1;
}

/* ── SVG / figure rendering: no cropping ── */
.sat-stimulus svg,
.sat-stem svg,
.choice-content svg,
.bb-rr-question-content svg,
.bb-rr-choices svg {
  max-width: 100% !important;
  height: auto !important;
  overflow: visible !important;
}

.sat-stimulus figure,
.sat-stem figure,
.choice-content figure {
  margin: 0.75rem 0;
  max-width: 100%;
}

.sat-stimulus img,
.sat-stem img,
.choice-content img {
  max-width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}

/* ── Prevent MathJax menu and accessibility UI from ever appearing ── */
.mjx-menu,
.mjx-context-menu,
.MJX_Menu,
.MathJax_Menu,
.MathJax_MenuFrame,
.MathJax_MenuArrow,
.MathJax_Explorer,
.mjx-explorer,
.mjx-assistive-mml,
.MathJax_Assistive_MML {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  position: absolute !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

/* ── Image/asset unavailable fallback ── */
.image-unavailable {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  background: #f5f6fa;
  border: 1px dashed #aeb8ce;
  border-radius: 6px;
  font-size: 0.8rem;
  color: #8290b3;
  font-style: italic;
}

/* ── Choice content: raw / fallback ── */
.choice-raw {
  font-family: ui-monospace, monospace;
  font-size: 0.82rem;
  background: #f0f2f9;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  word-break: break-all;
}

.choice-fallback {
  color: #8290b3;
  font-style: italic;
  font-size: 0.85rem;
}

/* ── Pause overlay ── */
.pause-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 14, 32, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.pause-card {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  min-width: 280px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  text-align: center;
}

.pause-card h2 {
  font-size: 1.5rem;
  font-weight: 900;
  color: #111827;
  margin: 0 0 0.5rem;
}

.pause-card .btn {
  width: 100%;
  justify-content: center;
}

/* ── SPR example table improvements ── */
.spr-examples-table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #e2e6f0;
  margin-top: 0.5rem;
}

.spr-examples-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.spr-examples-table th {
  background: #252f48;
  color: #fff;
  font-weight: 700;
  padding: 0.55rem 0.75rem;
  text-align: left;
  white-space: nowrap;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.spr-examples-table td {
  border-bottom: 1px solid #e2e6f0;
  padding: 0.5rem 0.75rem;
  vertical-align: top;
  line-height: 1.5;
}

.spr-examples-table tbody tr:last-child td {
  border-bottom: none;
}

.spr-examples-table tbody tr:nth-child(even) td {
  background: #f8f9fc;
}

/* ── Analytics error / toast: don't show "local only" if save succeeded ── */
.practice-toast {
  animation: toast-in 0.2s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Prevent text nodes from collapsing spacing in directions ── */
.spr-directions-content *,
.spr-directions-list li,
.spr-directions-intro {
  word-spacing: normal;
  letter-spacing: normal;
  white-space: normal;
  overflow-wrap: break-word;
}

/* \u2500\u2500 MathML inside practice panels \u2500\u2500 */
.sat-stem mjx-container,
.sat-stimulus mjx-container,
.choice-content mjx-container,
.spr-preview mjx-container {
  overflow-x: auto;
  overflow-y: visible;
  max-width: 100%;
}

/* Prevent MathJax SVG from being clipped at the container boundary */
mjx-container svg {
  overflow: visible !important;
  max-width: 100%;
  height: auto;
}

/* Ensure choice math content uses natural inline sizing and does not collapse */
.choice-content mjx-container,
.choice-content mjx-container svg,
.choice-content svg {
  display: inline-block !important;
  width: auto !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow: visible !important;
  vertical-align: middle !important;
  margin: 0 !important;
}

.choice-content mjx-container svg {
  height: auto !important;
}

/* ── Fix vertical math rendering ──────────────────────────────────────────────
   Question JSON has <math> elements as SIBLINGS to <p> elements (block-level).
   Making the <p> children of sat-stem/sat-stimulus inline lets math variables
   like k, j, a, b flow with the surrounding text instead of breaking lines.
   Genuine block equations (display="block") stay on their own line.         */
.sat-stem > p,
.sat-stimulus > p {
  display: inline;
}

/* Add a tiny space after each inline paragraph so sentences don't run together */
.sat-stem > p::after,
.sat-stimulus > p::after {
  content: ' ';
}

/* Force block paragraphs for block math/figures generated by normalization */
.bb-block-item,
.bb-block-item > math,
.bb-block-item > mjx-container,
.bb-block-item > figure,
.bb-block-item > table,
.bb-block-item > svg {
  display: block !important;
  width: 100%;
  margin: 0.85rem 0;
}

.bb-block-item {
  line-height: 1.5;
}

/* Inline MathML that hasn't been processed yet */
math[display="inline"] {
  display: inline;
}

/* Block / display MathML */
math[display="block"] {
  display: inline-block !important;
  margin: 0 0.3em;
}

.sat-stem mjx-container,
.sat-stimulus mjx-container,
.choice-content mjx-container {
  display: inline-block !important;
  margin: 0 0.2rem !important;
}

/* Question content SVGs (diagrams embedded in HTML) */
.sat-stem svg,
.sat-stimulus svg,
.choice-content svg {
  overflow: visible;
  max-width: 100%;
  height: auto;
}

/* ── Hide browser-generated spinner controls in question content ── */
.sat-stimulus input[type="number"]::-webkit-inner-spin-button,
.sat-stimulus input[type="number"]::-webkit-outer-spin-button,
.sat-stem input[type="number"]::-webkit-inner-spin-button,
.sat-stem input[type="number"]::-webkit-outer-spin-button,
.choice-content input[type="number"]::-webkit-inner-spin-button,
.choice-content input[type="number"]::-webkit-outer-spin-button,
.bb-rr-question-content input[type="number"]::-webkit-inner-spin-button,
.bb-rr-question-content input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Also disable spinner controls in Firefox/modern browsers */
.sat-stimulus input[type="number"],
.sat-stem input[type="number"],
.choice-content input[type="number"],
.bb-rr-question-content input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

/* ── Inline equation images: flow with text ── */
.sat-stem img.question-inline,
.sat-stimulus img.question-inline,
.choice-content img.question-inline {
  display: inline-block;
  vertical-align: middle;
  max-height: 1.6em;
  width: auto;
}

/* ── Block figure images: graphs, diagrams, tables ── */
img.question-figure {
  display: block;
  margin: 1rem auto;
  min-width: 200px;
  max-width: min(100%, 550px);
  height: auto;
}

/* Geometry diagrams (SVG) */
img.question-figure[src*="svg"] {
  max-width: min(100%, 400px);
}

/* Table images: full width */
img.question-figure.question-table {
  max-width: 100%;
}

/* Ensure question panel is the only scrolling container */
.bb-question-panel {
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body[data-page="practice"] .bb-question-panel {
  max-height: 100%;
}

/* Preserve visual flow for inline math and small equation images */
.sat-stem > p,
.sat-stimulus > p {
  display: inline;
}

.sat-stem > p.bb-block-item,
.sat-stimulus > p.bb-block-item {
  display: block !important;
}
