/* ============================================================
   Insight Bay, Practice Portal
   Extends the main site's design system (../../assets/css/styles.css)
   with portal-specific tokens, layouts, cards and a full dark mode.

   Conventions:
     :root        → light tokens (defaults inherited from main site)
     [data-theme="dark"] → dark overrides
     .ib-*        → portal namespace (mirrors the main site)
   ============================================================ */

:root {
  /* Portal-specific tokens layered on top of styles.css */
  --ibp-radius: 16px;
  --ibp-radius-lg: 22px;
  --ibp-radius-sm: 10px;
  --ibp-card-bg: #FFFFFF;
  --ibp-card-border: #E8E1D2;
  --ibp-card-hover-border: #C9C0AE;
  --ibp-soft-bg: #FAF7F2;
  --ibp-deep-bg: #EEE9DD;
  --ibp-text: var(--ib-ink, #20201E);
  --ibp-text-soft: var(--ib-ink-soft, #4A4742);
  --ibp-text-muted: var(--ib-ink-muted, #807A72);
  --ibp-line: #E2DCCF;
  --ibp-line-strong: #C9C0AE;
  --ibp-accent: var(--ib-accent, #C96442);
  --ibp-accent-hover: var(--ib-accent-hover, #B25535);
  --ibp-accent-soft: var(--ib-accent-soft, #F3DDCF);
  --ibp-gold: var(--ib-gold, #B58A3A);
  --ibp-success: var(--ib-success, #4F7A4A);
  --ibp-track: #ECE5D5;
  --ibp-fill: var(--ibp-accent);
  --ibp-shadow: 0 1px 2px rgba(32,32,30,.05), 0 12px 32px -16px rgba(32,32,30,.18);
  --ibp-shadow-hover: 0 6px 18px -4px rgba(32,32,30,.10), 0 24px 48px -16px rgba(32,32,30,.22);
  --ibp-font-display: 'Inter', 'Helvetica Neue', Arial, system-ui, sans-serif;
  --ibp-font-ui: 'Inter', 'Helvetica Neue', Arial, system-ui, sans-serif;
}

[data-theme="dark"] {
  --ibp-card-bg: #1E1D1B;
  --ibp-card-border: #2D2B27;
  --ibp-card-hover-border: #3F3C36;
  --ibp-soft-bg: #1A1917;
  --ibp-deep-bg: #161513;
  --ibp-text: #F2EFE8;
  --ibp-text-soft: #C9C4BB;
  --ibp-text-muted: #8E8A82;
  --ibp-line: #2D2B27;
  --ibp-line-strong: #3F3C36;
  --ibp-accent: #E8845E;
  --ibp-accent-hover: #F19770;
  --ibp-accent-soft: #3D2A20;
  --ibp-gold: #D9B265;
  --ibp-success: #7AAE73;
  --ibp-track: #2A2925;
  --ibp-shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 32px -16px rgba(0,0,0,.6);
  --ibp-shadow-hover: 0 6px 18px -4px rgba(0,0,0,.45), 0 24px 48px -16px rgba(0,0,0,.7);
}

/* ----- Portal body ----- */
.ib-portal-body {
  background: var(--ibp-soft-bg);
  color: var(--ibp-text);
  font-family: var(--ibp-font-ui);
  min-height: 100vh;
  transition: background-color .25s ease, color .25s ease;
}

.ib-skip-link {
  position: absolute; left: -9999px; top: 1rem;
  background: var(--ibp-text); color: var(--ibp-card-bg);
  padding: .5rem 1rem; border-radius: 999px; z-index: 999;
}
.ib-skip-link:focus { left: 1rem; }

.ib-noscript {
  max-width: 480px; margin: 4rem auto; padding: 2rem;
  background: var(--ibp-card-bg); border-radius: var(--ibp-radius);
  border: 1px solid var(--ibp-card-border);
}

/* ============================================================
   Header
   ============================================================ */
.ib-portal-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--ibp-soft-bg) 92%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--ibp-line);
}
.ib-portal-header__inner {
  max-width: 1240px; margin-inline: auto;
  padding: .9rem 1.25rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1.5rem; align-items: center;
}
.ib-portal-brand {
  display: inline-flex; align-items: center; gap: .65rem;
  color: var(--ibp-text);
}
.ib-portal-brand:hover { color: var(--ibp-text); }
.ib-portal-brand__mark {
  width: 36px; height: 36px; border-radius: 9px;
  display: inline-grid; place-items: center;
  background: var(--ibp-text); color: var(--ibp-card-bg);
  font-family: var(--ibp-font-display); font-weight: 700;
  font-size: .95rem; letter-spacing: .02em;
}
.ib-portal-brand__text { display: flex; flex-direction: column; gap: 3px; line-height: 1.12; }
.ib-portal-brand__text strong {
  font-family: var(--ibp-font-display);
  font-weight: 700; font-size: 1.02rem;
  letter-spacing: -.01em;
}
.ib-portal-brand__sub {
  font-size: .64rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ibp-text-muted);
}

.ib-portal-nav {
  display: flex; gap: 1.4rem; justify-content: center;
}
.ib-portal-nav a {
  color: var(--ibp-text-soft);
  font-size: .92rem; font-weight: 500;
}
.ib-portal-nav a:hover { color: var(--ibp-accent); }

.ib-portal-header__actions {
  display: inline-flex; gap: .55rem; align-items: center;
}

.ib-icon-btn {
  width: 38px; height: 38px;
  display: inline-grid; place-items: center;
  background: transparent;
  border: 1px solid var(--ibp-line);
  border-radius: 999px;
  color: var(--ibp-text-soft);
  cursor: pointer;
  transition: background .18s, color .18s, border-color .18s;
}
.ib-icon-btn:hover {
  border-color: var(--ibp-line-strong);
  color: var(--ibp-text);
  background: var(--ibp-deep-bg);
}
.ib-icon-btn svg { width: 18px; height: 18px; }

@media (max-width: 720px) {
  .ib-portal-header__inner { grid-template-columns: auto auto; }
  .ib-portal-nav { display: none; }
}

/* ============================================================
   Buttons (additive, main site supplies the base .ib-btn)
   ============================================================ */
.ib-btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .8rem 1.3rem;
  border-radius: 999px;
  font-family: var(--ibp-font-ui);
  font-weight: 500; font-size: .95rem;
  line-height: 1;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .18s, color .18s, border-color .18s, transform .15s;
}
.ib-btn:hover { transform: translateY(-1px); }
.ib-btn:focus-visible { outline: 2px solid var(--ibp-accent); outline-offset: 2px; }
.ib-btn[disabled] {
  opacity: .5; cursor: not-allowed; transform: none;
}

.ib-btn-lg  { padding: 1rem 1.6rem; font-size: 1rem; }
.ib-btn-sm  { padding: .55rem .95rem; font-size: .85rem; }

.ib-btn-primary {
  background: var(--ibp-text); color: var(--ibp-card-bg);
}
.ib-btn-primary:hover {
  background: var(--ibp-accent); color: #fff;
}

.ib-btn-accent {
  background: var(--ibp-accent); color: #fff;
}
.ib-btn-accent:hover { background: var(--ibp-accent-hover); }

.ib-btn-ghost {
  background: transparent;
  color: var(--ibp-text);
  border-color: var(--ibp-line-strong);
}
.ib-btn-ghost:hover {
  background: var(--ibp-deep-bg);
  border-color: var(--ibp-text);
}

.ib-btn svg { width: 16px; height: 16px; }

/* ============================================================
   Layout primitives
   ============================================================ */
.ib-container {
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: 1.25rem;
}
@media (min-width: 768px) {
  .ib-container { padding-inline: 2rem; }
}

.ib-stage {
  padding-block: 3rem 5rem;
  min-height: 60vh;
}
@media (min-width: 768px) {
  .ib-stage { padding-block: 4rem 6rem; }
}

.ib-section {
  padding-block: 4.5rem;
}
.ib-section--soft { background: var(--ibp-deep-bg); }

.ib-eyebrow {
  display: inline-block;
  font-family: var(--ibp-font-ui);
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ibp-accent);
  margin-bottom: 1rem;
}

/* Typography */
h1, h2, h3, h4 {
  font-family: var(--ibp-font-display);
  color: var(--ibp-text);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -.005em;
  margin: 0;
}
h1 { font-size: clamp(2.2rem, 4.6vw, 3.4rem); font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin-bottom: 1.2rem; letter-spacing: -.015em; }
h3 { font-size: clamp(1.05rem, 1.7vw, 1.25rem); }

p {
  color: var(--ibp-text-soft);
  line-height: 1.65;
  margin: 0 0 1rem;
}

a { color: var(--ibp-accent); text-decoration: none; }
a:hover { color: var(--ibp-accent-hover); }

/* ============================================================
   Hero (home view)
   ============================================================ */
.ib-hero {
  max-width: 1180px;
  margin: 0 auto;
  padding: 4rem 1.5rem 5rem;
  text-align: left;
}
@media (min-width: 768px) {
  .ib-hero { padding: 6rem 2rem 7rem; }
}
.ib-hero__title {
  font-size: clamp(2.4rem, 5vw, 4rem);
  font-weight: 800;
  letter-spacing: -.025em;
  max-width: 22ch;
  margin-bottom: 1rem;
}
.ib-hero__sub {
  font-family: var(--ibp-font-ui);
  font-size: clamp(1.15rem, 2.1vw, 1.45rem);
  font-weight: 600;
  color: var(--ibp-text);
  max-width: 44ch;
  line-height: 1.4;
  margin: 0 0 1rem;
}
.ib-hero__lead {
  font-size: 1.1rem;
  max-width: 56ch;
  margin-bottom: 2rem;
}
.ib-hero__actions {
  display: flex; flex-wrap: wrap; gap: .8rem;
  margin-bottom: 3rem;
}
.ib-hero__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem 2rem;
  list-style: none;
  padding: 1.25rem 0 0;
  border-top: 1px solid var(--ibp-line);
  margin: 0;
}
.ib-hero__stats li {
  color: var(--ibp-text-muted);
  font-size: .92rem;
  font-family: var(--ibp-font-display);
}
.ib-hero__stats strong {
  display: block;
  color: var(--ibp-text);
  font-size: 1.6rem;
  font-weight: 700;
}

/* How it works, premium vertical step cards */
.ib-how {
  list-style: none; padding: 0; margin: 2rem 0 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.1rem;
}
.ib-step {
  position: relative;
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 1.85rem 1.6rem;
  background: var(--ibp-card-bg);
  border: 1px solid var(--ibp-card-border);
  border-radius: var(--ibp-radius-lg);
  box-shadow: var(--ibp-shadow);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.ib-step:hover {
  transform: translateY(-3px);
  box-shadow: var(--ibp-shadow-hover);
  border-color: var(--ibp-line-strong);
}
.ib-step__num {
  position: absolute; top: 1.5rem; right: 1.6rem;
  font-family: var(--ibp-font-display); font-weight: 800;
  color: var(--ibp-accent); opacity: .32;
  font-size: 1rem; letter-spacing: .12em;
}
.ib-step__icon {
  width: 48px; height: 48px; flex: none;
  display: inline-grid; place-items: center;
  background: var(--ibp-accent-soft);
  color: var(--ibp-accent);
  border-radius: 14px;
  margin-bottom: 1.15rem;
}
.ib-step__icon svg { width: 24px; height: 24px; }
.ib-step__body h3 { margin: 0 0 .4rem; font-size: 1.06rem; line-height: 1.25; }
.ib-step__body p { margin: 0; font-size: .92rem; line-height: 1.6; color: var(--ibp-text-muted); }
@media (max-width: 900px) { .ib-how { grid-template-columns: 1fr 1fr; gap: 1rem; } }
@media (max-width: 480px) { .ib-how { grid-template-columns: 1fr; } }

/* Feature grid */
.ib-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.ib-feature {
  padding: 1.5rem;
  background: var(--ibp-card-bg);
  border: 1px solid var(--ibp-card-border);
  border-radius: var(--ibp-radius);
  transition: border-color .2s, transform .2s;
}
.ib-feature:hover { border-color: var(--ibp-line-strong); transform: translateY(-2px); }
.ib-feature__icon {
  width: 36px; height: 36px;
  display: inline-grid; place-items: center;
  background: var(--ibp-deep-bg); color: var(--ibp-text);
  border-radius: 10px; margin-bottom: .9rem;
}
.ib-feature__icon svg { width: 18px; height: 18px; }
.ib-feature p { margin: .35rem 0 0; font-size: .92rem; color: var(--ibp-text-muted); }

/* CTA strip */
.ib-cta-strip {
  background: var(--ibp-text);
  color: var(--ibp-card-bg);
  padding: 3rem 0;
}
.ib-cta-strip__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
  justify-content: space-between;
}
.ib-cta-strip h2 { color: var(--ibp-card-bg); margin-bottom: .25rem; }
.ib-cta-strip p { color: rgba(255,255,255,.7); margin: 0; }
.ib-cta-strip .ib-btn-primary { background: var(--ibp-card-bg); color: var(--ibp-text); }
.ib-cta-strip .ib-btn-primary:hover { background: var(--ibp-accent); color: #fff; }

[data-theme="dark"] .ib-cta-strip { background: #0E0D0C; }

/* ============================================================
   Breadcrumb
   ============================================================ */
.ib-breadcrumb { margin-bottom: 2rem; }
.ib-breadcrumb__list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; align-items: center;
  gap: .5rem;
  font-family: var(--ibp-font-display);
  font-size: .82rem;
  letter-spacing: .04em;
}
.ib-breadcrumb__item a { color: var(--ibp-text-muted); }
.ib-breadcrumb__item a:hover { color: var(--ibp-accent); }
.ib-breadcrumb__item.is-current { color: var(--ibp-text); }
.ib-breadcrumb__sep { color: var(--ibp-text-muted); display: inline-flex; }
.ib-breadcrumb__sep svg { width: 14px; height: 14px; }

/* ============================================================
   Stage header
   ============================================================ */
.ib-stage-header {
  margin-bottom: 2.5rem;
  max-width: 760px;
}
.ib-stage-header__lead {
  font-size: 1.05rem;
  color: var(--ibp-text-soft);
  margin-top: .65rem;
}

.ib-stage-footnote {
  margin-top: 3rem;
  font-size: .92rem;
  color: var(--ibp-text-muted);
  border-top: 1px solid var(--ibp-line);
  padding-top: 1.5rem;
}

/* ============================================================
   Cards (curriculum / grade / topic)
   ============================================================ */
.ib-region { margin-bottom: 3rem; }
.ib-region__heading {
  display: flex; align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.ib-region__heading h2 { font-size: 1.25rem; margin: 0; }
.ib-region__count {
  font-family: var(--ibp-font-display);
  font-size: .8rem; letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ibp-text-muted);
}

.ib-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.ib-card-grid--lg {
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}
.ib-card-grid--tight {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: .85rem;
}

.ib-card {
  position: relative;
  display: flex; flex-direction: column;
  padding: 1.5rem;
  background: var(--ibp-card-bg);
  border: 1px solid var(--ibp-card-border);
  border-radius: var(--ibp-radius);
  box-shadow: var(--ibp-shadow);
  color: var(--ibp-text);
  transition: transform .2s ease, border-color .2s, box-shadow .2s;
  overflow: hidden;
}
.ib-card:hover {
  transform: translateY(-3px);
  border-color: var(--ibp-card-hover-border);
  box-shadow: var(--ibp-shadow-hover);
  color: var(--ibp-text);
}
.ib-card:focus-visible {
  outline: 2px solid var(--ibp-accent);
  outline-offset: 2px;
}

.ib-card__icon {
  width: 44px; height: 44px; flex: none;
  display: inline-grid; place-items: center;
  background: var(--ibp-deep-bg);
  color: var(--ibp-text);
  border-radius: 11px;
  margin-bottom: 1rem;
  transition: background .2s, color .2s;
}
.ib-card:hover .ib-card__icon {
  background: var(--ibp-accent-soft);
  color: var(--ibp-accent);
}
.ib-card__icon svg { width: 22px; height: 22px; }

.ib-card__badge {
  position: absolute; top: 1rem; right: 1rem;
  background: var(--ibp-accent-soft); color: var(--ibp-accent);
  font-family: var(--ibp-font-display);
  font-size: .7rem; letter-spacing: .12em;
  padding: .3rem .55rem; border-radius: 999px;
  text-transform: uppercase;
}

.ib-card__body { flex: 1; display: flex; flex-direction: column; }
.ib-card__eyebrow {
  font-family: var(--ibp-font-display);
  font-size: .72rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ibp-text-muted);
  margin-bottom: .35rem;
}
.ib-card__title { margin-bottom: .4rem; font-size: 1.1rem; }
.ib-card__desc {
  margin: 0 0 1rem;
  font-size: .92rem;
  color: var(--ibp-text-muted);
  flex: 1;
}
.ib-card__stats {
  list-style: none; padding: 0; margin: 0 0 1rem;
  display: flex; flex-wrap: wrap; gap: .35rem;
}
.ib-card__stats li {
  font-family: var(--ibp-font-display);
  font-size: .75rem;
  letter-spacing: .04em;
  padding: .3rem .6rem;
  background: var(--ibp-deep-bg);
  color: var(--ibp-text-soft);
  border-radius: 999px;
}
.ib-card__cta {
  display: inline-flex; align-items: center; gap: .35rem;
  font-family: var(--ibp-font-display);
  font-size: .78rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ibp-accent);
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px dashed var(--ibp-line);
}
.ib-card__cta-arrow {
  width: 14px; height: 14px;
  transition: transform .2s ease;
}
.ib-card:hover .ib-card__cta-arrow { transform: translateX(4px); }

.ib-card--feature { padding: 2rem; }
.ib-card--feature .ib-card__title { font-size: 1.4rem; }
.ib-card--feature .ib-card__desc { font-size: 1rem; }

/* ============================================================
   Progress
   ============================================================ */
.ib-progress { display: flex; flex-direction: column; gap: .35rem; }
.ib-progress__track {
  width: 100%; height: 8px;
  background: var(--ibp-track);
  border-radius: 999px;
  overflow: hidden;
}
.ib-progress__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ibp-accent), var(--ibp-gold));
  border-radius: 999px;
  transition: width .3s ease;
}
.ib-progress__label {
  font-family: var(--ibp-font-display);
  font-size: .72rem;
  letter-spacing: .08em;
  color: var(--ibp-text-muted);
}

/* Circular ring */
.ib-ring-wrap {
  position: relative;
  display: inline-grid; place-items: center;
}
.ib-ring__track { stroke: var(--ibp-track); }
.ib-ring__fill { stroke: var(--ibp-accent); transition: stroke-dashoffset .4s ease; }
.ib-ring__center {
  position: absolute;
  font-family: var(--ibp-font-display);
  font-size: .85rem;
  color: var(--ibp-text);
}

/* Difficulty stars */
.ib-stars { display: inline-flex; gap: 4px; }
.ib-stars__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ibp-track);
}
.ib-stars__dot.is-on {
  background: var(--ibp-accent);
}

/* ============================================================
   Mastery level ladder (level view)
   ============================================================ */
.ib-ladder {
  list-style: none;
  padding: 0; margin: 0;
  display: flex; flex-direction: column;
  gap: 1rem;
  position: relative;
}
.ib-ladder::before {
  content: '';
  position: absolute;
  left: 28px; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--ibp-accent), var(--ibp-line-strong) 50%, var(--ibp-line));
  border-radius: 2px;
  z-index: 0;
}
@media (max-width: 700px) {
  .ib-ladder::before { display: none; }
}

.ib-ladder__item { position: relative; z-index: 1; }

.ib-level-card {
  display: grid;
  grid-template-columns: 60px 1fr;
  align-items: stretch;
  background: var(--ibp-card-bg);
  border: 1px solid var(--ibp-card-border);
  border-radius: var(--ibp-radius);
  box-shadow: var(--ibp-shadow);
  color: var(--ibp-text);
  transition: transform .2s, border-color .2s, box-shadow .2s;
  overflow: hidden;
}
.ib-level-card:hover {
  transform: translateY(-2px);
  border-color: var(--ibp-card-hover-border);
  box-shadow: var(--ibp-shadow-hover);
  color: var(--ibp-text);
}

.ib-level-card__rung {
  display: grid; place-items: center;
  background: var(--ibp-deep-bg);
  border-right: 1px solid var(--ibp-line);
  font-family: var(--ibp-font-display);
}
.ib-level-card__num {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ibp-text);
}

[data-level="1"] .ib-level-card__rung { background: color-mix(in srgb, var(--ibp-accent) 6%, var(--ibp-deep-bg)); }
[data-level="2"] .ib-level-card__rung { background: color-mix(in srgb, var(--ibp-accent) 14%, var(--ibp-deep-bg)); }
[data-level="3"] .ib-level-card__rung { background: color-mix(in srgb, var(--ibp-accent) 24%, var(--ibp-deep-bg)); }
[data-level="4"] .ib-level-card__rung { background: color-mix(in srgb, var(--ibp-accent) 36%, var(--ibp-deep-bg)); }
[data-level="5"] .ib-level-card__rung {
  background: linear-gradient(160deg, var(--ibp-accent), var(--ibp-gold));
  color: #fff;
}
[data-level="5"] .ib-level-card__num { color: #fff; }

.ib-level-card__body { padding: 1.5rem; display: flex; flex-direction: column; gap: .75rem; }
.ib-level-card__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.ib-level-card__head h3 { font-size: 1.2rem; }
.ib-level-card__tagline {
  font-family: var(--ibp-font-display);
  font-size: .85rem;
  letter-spacing: .04em;
  color: var(--ibp-accent);
  margin: 0;
}
.ib-level-card__desc { margin: 0; color: var(--ibp-text-muted); font-size: .95rem; }
.ib-level-card__skills {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; gap: .35rem;
}
.ib-level-card__skills li {
  font-size: .8rem;
  padding: .35rem .65rem;
  background: var(--ibp-deep-bg);
  color: var(--ibp-text-soft);
  border-radius: 999px;
  font-family: var(--ibp-font-display);
  letter-spacing: .02em;
}
.ib-level-card__meta {
  display: flex; flex-wrap: wrap; gap: 1rem;
  font-family: var(--ibp-font-display);
  font-size: .8rem; letter-spacing: .06em;
  color: var(--ibp-text-muted);
  text-transform: uppercase;
}
.ib-level-card__cta { align-self: flex-start; margin-top: .5rem; }

@media (max-width: 700px) {
  .ib-level-card { grid-template-columns: 1fr; }
  .ib-level-card__rung {
    border-right: none;
    border-bottom: 1px solid var(--ibp-line);
    padding: .8rem;
  }
}

/* ============================================================
   Practice page
   ============================================================ */
.ib-practice__header {
  display: flex; flex-wrap: wrap; gap: 1rem;
  justify-content: space-between; align-items: center;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  background: var(--ibp-card-bg);
  border: 1px solid var(--ibp-card-border);
  border-radius: var(--ibp-radius);
}
.ib-practice__ident { display: flex; flex-wrap: wrap; gap: .5rem; }
.ib-practice__crumb {
  font-family: var(--ibp-font-display);
  font-size: .8rem; letter-spacing: .08em;
  padding: .35rem .7rem;
  background: var(--ibp-deep-bg);
  border-radius: 999px;
  color: var(--ibp-text-soft);
}
.ib-practice__crumb--level {
  background: var(--ibp-accent); color: #fff;
}
.ib-practice__progress { display: flex; align-items: center; gap: 1rem; }
.ib-practice__progress strong { display: block; }
.ib-practice__progress p { margin: 0; color: var(--ibp-text-muted); font-size: .82rem; }

.ib-practice__grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 980px) {
  .ib-practice__grid { grid-template-columns: 1fr; }
}

.ib-practice__main { display: flex; flex-direction: column; gap: 1.25rem; }

.ib-practice__banner {
  display: flex; gap: .85rem;
  padding: 1rem 1.25rem;
  background: var(--ibp-accent-soft);
  border: 1px solid color-mix(in srgb, var(--ibp-accent) 40%, transparent);
  border-radius: var(--ibp-radius);
  color: var(--ibp-text);
}
.ib-practice__banner svg { color: var(--ibp-accent); flex: none; }
.ib-practice__banner strong { display: block; }
.ib-practice__banner p { margin: .2rem 0 0; color: var(--ibp-text-soft); font-size: .92rem; }

.ib-question {
  background: var(--ibp-card-bg);
  border: 1px solid var(--ibp-card-border);
  border-radius: var(--ibp-radius);
  padding: 2rem;
}
.ib-question__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.ib-question__count {
  font-family: var(--ibp-font-display);
  font-size: .8rem;
  letter-spacing: .12em;
  color: var(--ibp-text-muted);
  text-transform: uppercase;
}
.ib-question__prompt { font-size: 1.45rem; margin-bottom: .8rem; }
.ib-question__body { color: var(--ibp-text-soft); }

.ib-question__answer { margin-top: 1.5rem; }
.ib-question__label {
  display: block;
  font-family: var(--ibp-font-display);
  font-size: .8rem;
  letter-spacing: .08em;
  margin-bottom: .35rem;
  color: var(--ibp-text-soft);
}
.ib-input {
  width: 100%;
  padding: .9rem 1rem;
  background: var(--ibp-soft-bg);
  border: 1px solid var(--ibp-line);
  border-radius: var(--ibp-radius-sm);
  color: var(--ibp-text);
  font-family: var(--ibp-font-ui);
  font-size: 1rem;
}
.ib-input:focus { outline: 2px solid var(--ibp-accent); outline-offset: 1px; }
.ib-input:disabled { opacity: .65; cursor: not-allowed; }
.ib-question__actions {
  display: flex; flex-wrap: wrap; gap: .6rem;
  margin-top: 1rem;
}

.ib-panel {
  background: var(--ibp-card-bg);
  border: 1px solid var(--ibp-card-border);
  border-radius: var(--ibp-radius);
  padding: 1.5rem;
}
.ib-panel--ai {
  background: linear-gradient(180deg, var(--ibp-card-bg), var(--ibp-soft-bg));
  border-color: color-mix(in srgb, var(--ibp-accent) 25%, var(--ibp-card-border));
}
.ib-panel__head {
  display: flex; align-items: center; gap: .65rem;
  margin-bottom: .9rem;
}
.ib-panel__head svg {
  width: 18px; height: 18px;
  color: var(--ibp-accent);
}
.ib-panel__pill {
  margin-left: auto;
  font-family: var(--ibp-font-display);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: .3rem .55rem;
  border-radius: 999px;
  background: var(--ibp-deep-bg);
  color: var(--ibp-text-soft);
}
.ib-panel__list,
.ib-panel__body { margin: 0; color: var(--ibp-text-soft); }
.ib-panel__list { padding-left: 1.25rem; }
.ib-panel__list li { margin-bottom: .5rem; }
.ib-panel__actions { margin-top: 1rem; }

.ib-worked {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: .65rem;
}
.ib-worked li {
  padding: .8rem 1rem;
  border-left: 3px solid var(--ibp-accent);
  background: var(--ibp-deep-bg);
  border-radius: var(--ibp-radius-sm);
  color: var(--ibp-text-soft);
}

.ib-practice__side { display: flex; flex-direction: column; gap: 1.25rem; }
.ib-side-card {
  background: var(--ibp-card-bg);
  border: 1px solid var(--ibp-card-border);
  border-radius: var(--ibp-radius);
  padding: 1.5rem;
}
.ib-side-card .ib-eyebrow { margin-bottom: .5rem; }
.ib-side-card__stats {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .5rem 1rem;
  margin: 1rem 0 0;
  font-family: var(--ibp-font-display);
  font-size: .85rem;
}
.ib-side-card__stats dt { color: var(--ibp-text-muted); }
.ib-side-card__stats dd { margin: 0; color: var(--ibp-text); text-align: right; }
.ib-side-card__list {
  list-style: disc; padding-left: 1.2rem;
  margin: .75rem 0 1rem;
  color: var(--ibp-text-soft);
  font-size: .9rem;
}
.ib-side-card__list li { margin-bottom: .25rem; }
.ib-side-card__note {
  margin: .85rem 0 0;
  font-size: .8rem;
  color: var(--ibp-text-muted);
}

.ib-achievements { list-style: none; padding: 0; margin: .5rem 0 0; display: flex; flex-direction: column; gap: .65rem; }
.ib-achievements__item {
  display: flex; gap: .75rem; align-items: flex-start;
  padding: .65rem .8rem;
  border: 1px dashed var(--ibp-line);
  border-radius: var(--ibp-radius-sm);
}
.ib-achievements__item.is-locked { opacity: .55; }
.ib-achievements__icon {
  width: 30px; height: 30px;
  display: inline-grid; place-items: center;
  background: var(--ibp-deep-bg);
  color: var(--ibp-accent);
  border-radius: 8px; flex: none;
}
.ib-achievements__icon svg { width: 16px; height: 16px; }
.ib-achievements__item strong { display: block; font-size: .9rem; }
.ib-achievements__item p { margin: 0; font-size: .8rem; color: var(--ibp-text-muted); }

/* ============================================================
   Footer
   ============================================================ */
.ib-portal-footer {
  margin-top: 4rem;
  background: var(--ibp-deep-bg);
  border-top: 1px solid var(--ibp-line);
  color: var(--ibp-text-soft);
}
.ib-portal-footer__inner {
  max-width: 1180px; margin-inline: auto;
  padding: 3rem 2rem 2rem;
  display: grid;
  grid-template-columns: 1.8fr 1fr 1fr;
  gap: 2rem;
}
@media (max-width: 720px) {
  .ib-portal-footer__inner { grid-template-columns: 1fr; }
}
.ib-portal-footer__col { display: flex; flex-direction: column; gap: .5rem; }
.ib-portal-footer__col strong { color: var(--ibp-text); font-family: var(--ibp-font-display); }
.ib-portal-footer__col p { margin: 0; font-size: .92rem; color: var(--ibp-text-muted); }
.ib-portal-footer__col a {
  color: var(--ibp-text-soft); font-size: .92rem;
}
.ib-portal-footer__col a:hover { color: var(--ibp-accent); }
.ib-portal-footer__heading {
  font-family: var(--ibp-font-display);
  font-size: .8rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ibp-text-muted);
  margin-bottom: .25rem;
}
.ib-portal-footer__base {
  max-width: 1180px; margin: 0 auto;
  padding: 1rem 2rem 2rem;
  border-top: 1px solid var(--ibp-line);
  font-family: var(--ibp-font-display);
  font-size: .8rem; letter-spacing: .04em;
  color: var(--ibp-text-muted);
}

/* ============================================================
   Empty / 404
   ============================================================ */
.ib-empty { max-width: 560px; text-align: center; padding: 4rem 0; }
.ib-empty h1 { margin-bottom: 1rem; }
.ib-empty p { margin-bottom: 2rem; }

/* ============================================================
   Motion + accessibility
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Cards remain anchor elements, strip default link underline */
.ib-card, .ib-level-card { text-decoration: none; }
.ib-card:hover, .ib-level-card:hover { text-decoration: none; }

/* Focus styles */
:focus-visible {
  outline: 2px solid var(--ibp-accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ============================================================
   MOBILE-FIRST PORTAL REFINEMENTS
   Same audit philosophy as the main site:
   - 44px touch targets
   - Tighter rhythm on phones
   - Hero, breadcrumb, ladder, practice grid all sized for thumb use
   ============================================================ */

/* Touch targets */
@media (max-width: 720px) {
  .ib-icon-btn { width: 44px; height: 44px; }
  .ib-btn { min-height: 44px; }
  .ib-portal-nav a { min-height: 44px; display: inline-flex; align-items: center; }
}

/* Header chrome */
@media (max-width: 720px) {
  .ib-portal-header__inner { padding: .65rem 1rem; gap: .75rem; }
  .ib-portal-brand__mark { width: 32px; height: 32px; }
  .ib-portal-brand__text strong { font-size: .92rem; }
  .ib-portal-brand__sub { font-size: .65rem; }
}

/* Hero */
@media (max-width: 720px) {
  .ib-hero { padding: 2.5rem 1.25rem 3rem; }
  .ib-hero__title { font-size: clamp(2rem, 9vw, 2.7rem); }
  .ib-hero__sub { font-size: 1.1rem; }
  .ib-hero__lead { font-size: 1rem; line-height: 1.55; }
  .ib-hero__stats { grid-template-columns: 1fr 1fr; gap: .85rem 1rem; }
  .ib-hero__stats strong { font-size: 1.35rem; }
  .ib-hero__actions { gap: .6rem; }
  .ib-hero__actions .ib-btn { width: 100%; justify-content: center; }
}

/* How-it-works steps and feature grid */
@media (max-width: 720px) {
  .ib-section { padding-block: 2.75rem; }
  .ib-steps { gap: .85rem; }
  .ib-step { padding: 1.25rem; gap: .85rem; }
  .ib-feature { padding: 1.25rem; }
}

/* Stage header (curriculum / grade / topic / level pages) */
@media (max-width: 720px) {
  .ib-stage { padding-block: 2rem 3.5rem; }
  .ib-stage-header { margin-bottom: 1.5rem; }
  .ib-stage-header h1 { font-size: clamp(1.7rem, 7.5vw, 2.4rem); }
  .ib-stage-header__lead { font-size: 1rem; line-height: 1.55; }
}

/* Breadcrumb, wrap kindly on small screens */
@media (max-width: 720px) {
  .ib-breadcrumb { margin-bottom: 1.25rem; }
  .ib-breadcrumb__list { font-size: .75rem; gap: .35rem; }
}

/* Cards grid density on phones */
@media (max-width: 720px) {
  .ib-card-grid,
  .ib-card-grid--lg,
  .ib-card-grid--tight {
    grid-template-columns: 1fr;
    gap: .85rem;
  }
  .ib-card { padding: 1.25rem; }
  .ib-card__title { font-size: 1.05rem; }
  .ib-card__desc { font-size: .92rem; }
  .ib-card--feature { padding: 1.5rem; }
  .ib-card--feature .ib-card__title { font-size: 1.2rem; }
  .ib-card--feature .ib-card__desc { font-size: .95rem; }
  .ib-region { margin-bottom: 2rem; }
  .ib-region__heading h2 { font-size: 1.1rem; }
}

/* Level ladder */
@media (max-width: 720px) {
  .ib-ladder { gap: .8rem; }
  .ib-level-card__body { padding: 1.25rem; gap: .65rem; }
  .ib-level-card__head h3 { font-size: 1.05rem; }
  .ib-level-card__desc { font-size: .92rem; }
  .ib-level-card__skills li { font-size: .75rem; padding: .3rem .55rem; }
  .ib-level-card__meta { gap: .65rem; font-size: .72rem; }
  .ib-level-card__cta { width: 100%; justify-content: center; }
}

/* Practice page */
@media (max-width: 720px) {
  .ib-practice__header {
    padding: 1rem 1.1rem;
    flex-direction: column;
    align-items: flex-start;
  }
  .ib-practice__ident { gap: .35rem; }
  .ib-practice__crumb { font-size: .72rem; padding: .3rem .55rem; }
  .ib-question { padding: 1.4rem 1.25rem; }
  .ib-question__prompt { font-size: 1.2rem; }
  .ib-question__body { font-size: .95rem; }
  .ib-question__actions { gap: .5rem; }
  .ib-question__actions .ib-btn { width: 100%; justify-content: center; }
  .ib-panel { padding: 1.25rem 1.2rem; }
  .ib-panel__list { padding-left: 1.1rem; }
  .ib-side-card { padding: 1.25rem 1.2rem; }
}

/* Footer */
@media (max-width: 720px) {
  .ib-portal-footer { margin-top: 2.5rem; }
  .ib-portal-footer__inner { padding: 2rem 1.25rem 1.5rem; gap: 1.5rem; }
  .ib-portal-footer__base { padding: 1rem 1.25rem 1.75rem; font-size: .75rem; }
}

/* Block any horizontal scroll caused by overflow */
html, body { overflow-x: hidden; }

/* Images stay in their containers */
img { max-width: 100%; height: auto; }

/* ================================================================== */
/*  QUESTION RUNNER (live bank)                                        */
/* ================================================================== */

.ib-question__prompt--live { white-space: pre-line; }

.ib-question__note {
  margin: .35rem 0 0;
  font-size: .85rem;
  color: var(--ibp-text-muted);
}

.ib-opts {
  display: grid;
  gap: .6rem;
  margin-bottom: 1rem;
}

.ib-opt {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  width: 100%;
  text-align: left;
  padding: .8rem 1rem;
  border: 1.5px solid var(--ibp-line);
  border-radius: var(--ibp-radius-sm);
  background: var(--ibp-card-bg);
  color: var(--ibp-text);
  font: inherit;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.ib-opt:hover { border-color: var(--ibp-line-strong); }
.ib-opt.is-selected {
  border-color: var(--ibp-accent);
  background: var(--ibp-accent-soft);
}
.ib-opt.is-correct {
  border-color: var(--ibp-success);
  background: color-mix(in srgb, var(--ibp-success) 12%, var(--ibp-card-bg));
}
.ib-opt.is-wrong {
  border-color: #B0463C;
  background: color-mix(in srgb, #B0463C 10%, var(--ibp-card-bg));
}
.ib-opt:disabled { cursor: default; opacity: .85; }

.ib-opt__key {
  flex: 0 0 auto;
  width: 1.6rem;
  height: 1.6rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ibp-deep-bg);
  font-size: .8rem;
  font-weight: 700;
}
.ib-opt.is-correct .ib-opt__key { background: var(--ibp-success); color: #fff; }
.ib-opt.is-wrong .ib-opt__key { background: #B0463C; color: #fff; }

.ib-opt__text { white-space: pre-line; }

.ib-feedback {
  display: none;
  margin: .85rem 0 0;
  padding: .8rem 1rem;
  border-radius: var(--ibp-radius-sm);
  border: 1.5px solid var(--ibp-line);
  background: var(--ibp-soft-bg);
  font-size: .95rem;
}
.ib-feedback.is-correct,
.ib-feedback.is-wrong,
.ib-feedback.is-reveal { display: block; }
.ib-feedback.is-correct {
  border-color: var(--ibp-success);
  background: color-mix(in srgb, var(--ibp-success) 10%, var(--ibp-card-bg));
}
.ib-feedback.is-wrong {
  border-color: #B0463C;
  background: color-mix(in srgb, #B0463C 8%, var(--ibp-card-bg));
}

.ib-feedback__self {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .6rem;
}

.ib-runner-complete { text-align: left; }

/* ================================================================== */
/*  RUNNER v2, animations, steps panel, registration gate             */
/* ================================================================== */

/* Question card entrance */
.ib-question--enter { animation: ibCardIn .35s ease both; position: relative; overflow: visible; }
@keyframes ibCardIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* Wrong answer, shake */
.ib-shake { animation: ibShake .5s ease; }
@keyframes ibShake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

/* Feedback pop-in */
.ib-feedback.is-correct, .ib-feedback.is-wrong, .ib-feedback.is-reveal {
  animation: ibPop .3s cubic-bezier(.2, 1.4, .4, 1) both;
}
@keyframes ibPop {
  from { opacity: 0; transform: scale(.92); }
  to   { opacity: 1; transform: scale(1); }
}

/* Correct option pulse */
.ib-opt.is-correct { animation: ibGlow .8s ease 1; }
@keyframes ibGlow {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ibp-success) 55%, transparent); }
  100% { box-shadow: 0 0 0 14px transparent; }
}

/* Confetti */
.ib-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 5;
}
.ib-confetti__p {
  position: absolute;
  top: 38%;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  background: var(--clr, #C96442);
  opacity: 0;
  animation: ibConfetti var(--dur, 1s) ease-out forwards;
}
.ib-confetti__p:nth-child(odd) { width: 7px; height: 7px; border-radius: 50%; }
@keyframes ibConfetti {
  0%   { opacity: 1; transform: translate(0, 0) rotate(0); }
  100% { opacity: 0; transform: translate(var(--dx, 0), calc(var(--dy, -120px) + 220px)) rotate(var(--rot, 180deg)); }
}

@media (prefers-reduced-motion: reduce) {
  .ib-question--enter, .ib-shake, .ib-feedback, .ib-opt.is-correct, .ib-confetti__p { animation: none !important; }
}

/* Steps panel */
.ib-steps { margin-top: 1rem; padding: 0; overflow: hidden; }
.ib-steps__toggle {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  padding: .85rem 1.1rem;
  background: none;
  border: 0;
  color: var(--ibp-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.ib-steps__toggle:hover { color: var(--ibp-accent); }
.ib-steps__chev { margin-left: auto; transition: transform .25s ease; }
.ib-steps.is-open .ib-steps__chev { transform: rotate(180deg); }
.ib-steps__list {
  max-height: 0;
  opacity: 0;
  margin: 0;
  padding: 0 1.1rem;
  transition: max-height .35s ease, opacity .3s ease, padding .35s ease;
  counter-reset: ibstep;
  list-style: none;
}
.ib-steps.is-open .ib-steps__list {
  max-height: 600px;
  opacity: 1;
  padding: 0 1.1rem 1rem;
}
.ib-steps__list li {
  position: relative;
  padding: .45rem 0 .45rem 2.2rem;
  border-top: 1px dashed var(--ibp-line);
  counter-increment: ibstep;
}
.ib-steps__list li::before {
  content: counter(ibstep);
  position: absolute;
  left: 0;
  top: .55rem;
  width: 1.5rem;
  height: 1.5rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ibp-accent-soft);
  color: var(--ibp-accent);
  font-size: .78rem;
  font-weight: 700;
}

/* Teaching explanation + misconception note (generated banks) */
.ib-steps__explain,
.ib-steps__misconception {
  display: none;
  margin: 0;
  padding: .55rem 1.1rem 0;
  font-size: .92rem;
  line-height: 1.55;
}
.ib-steps.is-open .ib-steps__explain,
.ib-steps.is-open .ib-steps__misconception {
  display: block;
}
.ib-steps__explain strong { color: var(--ibp-accent); }
.ib-steps__misconception {
  border-top: 1px dashed var(--ibp-line);
  margin-top: .55rem;
  padding-top: .65rem;
  padding-bottom: 1rem;
}

/* Registration gate */
.ib-gate { max-width: 640px; margin: 0 auto; }
.ib-gate__form { margin-top: 1.25rem; display: grid; gap: 1rem; }
.ib-gate__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 600px) { .ib-gate__row { grid-template-columns: 1fr; } }
.ib-select { appearance: auto; }
.ib-gate__error { color: #B0463C; font-size: .9rem; min-height: 1.2em; margin: 0; }
.ib-gate__cta { justify-self: start; }
.ib-gate__fineprint { font-size: .8rem; color: var(--ibp-text-muted); margin: 0; }

/* icon sizing inside steps toggle */
.ib-steps__toggle svg { width: 20px; height: 20px; flex: 0 0 auto; }

/* per-question hint */
.ib-hint {
  display: none;
  margin-top: .85rem;
  padding: .75rem 1rem;
  border-left: 3px solid var(--ibp-gold);
  border-radius: var(--ibp-radius-sm);
  background: color-mix(in srgb, var(--ibp-gold) 9%, var(--ibp-card-bg));
  font-size: .95rem;
}
.ib-hint.is-shown { display: block; animation: ibPop .25s ease both; }

/* progressive hint ladder */
.ib-hints { display: grid; gap: .5rem; }
.ib-hints .ib-hint { margin-top: .35rem; }
.ib-hint__tag {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ibp-gold);
  margin-bottom: .25rem;
}
.ib-hint__text { display: block; }

/* ============================================================
   Premium solution walkthrough
   ============================================================ */
.ib-solution__count {
  font-size: .72rem;
  font-weight: 700;
  color: var(--ibp-accent);
  background: var(--ibp-accent-soft);
  border-radius: 999px;
  padding: .14rem .6rem;
  margin-left: .35rem;
}
.ib-steps.is-open .ib-steps__list { max-height: 3000px; }
.ib-solution__step { font-size: .97rem; line-height: 1.6; }
.ib-solution__step--in { animation: ibStepIn .34s ease both; }
@keyframes ibStepIn {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ib-solution__ctrls {
  display: none;
  gap: .55rem;
  align-items: center;
  padding: .35rem 1.1rem 1rem 2.2rem;
}
.ib-steps.is-open .ib-solution__ctrls { display: flex; flex-wrap: wrap; }
.ib-solution__next { min-width: 9.5rem; }
.ib-solution__extras { display: none; padding: .2rem 1.1rem 1.05rem; gap: .65rem; }
.ib-steps.is-open .ib-solution__extras { display: grid; }

/* teaching callout cards: why-it-works / another-way / watch-out */
.ib-callout {
  border: 1px solid var(--ibp-line);
  border-left-width: 3px;
  border-radius: var(--ibp-radius-sm);
  padding: .7rem .9rem .75rem;
  background: var(--ibp-soft-bg);
  animation: ibStepIn .4s ease both;
}
.ib-callout__title {
  display: block;
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .03em;
  margin-bottom: .3rem;
}
.ib-callout__body, .ib-callout p { margin: 0; font-size: .92rem; line-height: 1.55; }
.ib-callout__list { margin: 0; padding-left: 1.15rem; font-size: .92rem; line-height: 1.6; display: grid; gap: .25rem; }
.ib-callout--why   { border-left-color: var(--ibp-accent); }
.ib-callout--why   .ib-callout__title { color: var(--ibp-accent); }
.ib-callout--alt   { border-left-color: var(--ibp-success); }
.ib-callout--alt   .ib-callout__title { color: var(--ibp-success); }
.ib-callout--watch { border-left-color: var(--ibp-gold); background: color-mix(in srgb, var(--ibp-gold) 7%, var(--ibp-card-bg)); }
.ib-callout--watch .ib-callout__title { color: var(--ibp-gold); }
[data-theme="dark"] .ib-callout { background: rgba(255,255,255,.035); }
[data-theme="dark"] .ib-callout--watch { background: color-mix(in srgb, var(--ibp-gold) 12%, transparent); }
@media (prefers-reduced-motion: reduce) {
  .ib-solution__step--in, .ib-callout { animation: none !important; }
}
@media (max-width: 600px) {
  .ib-solution__ctrls { padding-left: 1.1rem; }
  .ib-callout__body, .ib-callout__list, .ib-solution__step { font-size: .9rem; }
}

/* review mode */
.ib-review__badge {
  font-size: .8rem;
  font-weight: 700;
  padding: .25rem .7rem;
  border-radius: 999px;
  border: 1.5px solid var(--ibp-line);
}
.ib-review__badge.is-right { color: var(--ibp-success); border-color: var(--ibp-success); }
.ib-review__badge.is-wrong { color: #B0463C; border-color: #B0463C; }
.ib-review__badge.is-skip  { color: var(--ibp-text-muted); }
.ib-review__line { margin: .35rem 0; }
.ib-review .ib-opt { cursor: default; }

/* clickable context chips */
a.ib-practice__crumb { text-decoration: none; cursor: pointer; transition: background .15s ease, color .15s ease; }
a.ib-practice__crumb:hover { background: var(--ibp-accent-soft); color: var(--ibp-accent); }
a.ib-practice__crumb--level:hover { background: var(--ibp-accent-hover); color: #fff; }

/* account sync line in sidebar */
.ib-acct-line { font-size: .82rem; color: var(--ibp-text-muted); margin: .75rem 0 0; }
.ib-acct-line strong { color: var(--ibp-text); }
.ib-acct-line__out {
  background: none; border: 0; color: var(--ibp-accent);
  font: inherit; font-size: .8rem; cursor: pointer; margin-left: .5rem; padding: 0;
  text-decoration: underline;
}

/* save-progress card on the completion screen */
.ib-savecard { margin-top: 1.5rem; padding: 1.25rem; }
.ib-savecard__body { margin: .5rem 0 1rem; color: var(--ibp-text-soft); }
.ib-savecard__row { display: flex; flex-wrap: wrap; gap: .75rem; }
.ib-savecard__row .ib-input { flex: 1 1 260px; }

/* gate: register/login switcher */
.ib-gate__switch {
  background: none; border: 0; color: var(--ibp-accent); cursor: pointer;
  font: inherit; font-size: .9rem; margin-top: 1rem; padding: 0; text-decoration: underline;
}

/* =====================================================================
   RESPONSIVE & CONSISTENCY GUARD, portal (UI audit, 2026-06)
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }

.ib-btn { white-space: nowrap; }

/* Level-card CTA: full-width but contained (border-box) and centered. */
@media (max-width: 980px) {
  .ib-level-card__cta { width: 100%; justify-content: center; }
}

/* Lighter buttons + sane stacking on phones. */
@media (max-width: 720px) {
  .ib-btn { padding: .72rem 1.15rem; font-size: .92rem; }
  .ib-question__actions { display: flex; flex-direction: column; align-items: stretch; }
  .ib-question__actions .ib-btn { white-space: normal; }
  .ib-practice__progress { flex-wrap: wrap; }
  .ib-input, .ib-select { font-size: max(16px, 1em); }
  .ib-savecard__row { flex-direction: column; }
  .ib-hint { font-size: .9rem; }
  .ib-review__badge { font-size: .72rem; }
}

/* Question prompt: never overflow on narrow screens. */
.ib-question__prompt--live { overflow-wrap: break-word; }

/* =====================================================================
   PORTAL DARK SYSTEM v2 + CTA STRIP REDESIGN (UI audit 2026-06)
   ===================================================================== */
[data-theme="dark"] {
  --ibp-soft-bg: #1C1B18;
  --ibp-deep-bg: #262420;
  --ibp-line: #34312B;
  --ibp-line-strong: #45413A;
}

/* "Ready to begin?" strip, dark-first: layered surface, readable type,
   brand-accent CTA, balanced spacing. (Was dark-on-dark in dark mode.) */
.ib-cta-strip { padding: 3.5rem 0; }
[data-theme="dark"] .ib-cta-strip {
  background: linear-gradient(180deg, #232120, #1C1B18);
  border-top: 1px solid rgba(242,239,232,.08);
  border-bottom: 1px solid rgba(242,239,232,.08);
}
[data-theme="dark"] .ib-cta-strip h2 { color: var(--ibp-text); }
[data-theme="dark"] .ib-cta-strip p { color: var(--ibp-text-soft); }
[data-theme="dark"] .ib-cta-strip .ib-btn-primary {
  background: var(--ibp-accent);
  color: #fff;
}
[data-theme="dark"] .ib-cta-strip .ib-btn-primary:hover {
  background: var(--ibp-accent-hover);
}
@media (max-width: 760px) {
  .ib-cta-strip__inner {
    flex-direction: column;
    justify-content: center;
    text-align: center;
  }
}

/* Focus states (match the main site). */
a:focus-visible, button:focus-visible,
input:focus-visible, select:focus-visible {
  outline: 2px solid var(--ibp-accent);
  outline-offset: 2px;
}

/* =====================================================================
   STUDENT DASHBOARD (Phase 2)
   ===================================================================== */
.ib-dash__loading { color: var(--ibp-text-muted); }

.ib-dash__cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .85rem;
  margin-bottom: 2rem;
}
.ib-dash__card {
  background: var(--ibp-card-bg);
  border: 1px solid var(--ibp-line);
  border-radius: var(--ibp-radius);
  padding: 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.ib-dash__card-value {
  font-family: var(--ibp-font-display);
  font-size: 1.6rem;
  font-weight: 700;
}
.ib-dash__card-label {
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ibp-text-muted);
}

.ib-dash__panel {
  background: var(--ibp-card-bg);
  border: 1px solid var(--ibp-line);
  border-radius: var(--ibp-radius);
  padding: 1.4rem 1.5rem;
  margin-bottom: 1.5rem;
}
.ib-dash__panel h2 { font-size: 1.05rem; margin-bottom: 1rem; }

.ib-dash__chart-wrap { overflow-x: auto; }
.ib-dash__chart { width: 100%; max-width: 680px; height: auto; }
.ib-dash__bar-total { fill: var(--ibp-deep-bg); }
.ib-dash__bar-correct { fill: var(--ibp-success); }
.ib-dash__chart-legend { font-size: .8rem; color: var(--ibp-text-muted); margin: .5rem 0 0; }
.ib-dash__legend-total { color: var(--ibp-deep-bg); }
.ib-dash__legend-correct { color: var(--ibp-success); }

.ib-dash__recs { margin: 0; padding-left: 1.2rem; }
.ib-dash__recs li { padding: .35rem 0; }
.ib-dash__recs a { color: var(--ibp-accent); font-weight: 600; margin-right: .6rem; }

.ib-dash__band {
  font-size: .75rem;
  font-weight: 700;
  padding: .15rem .55rem;
  border-radius: 999px;
  white-space: nowrap;
}
.ib-dash__band.is-weak   { background: rgba(176,70,60,.15);  color: #C0564A; }
.ib-dash__band.is-dev    { background: rgba(217,178,101,.18); color: var(--ibp-gold); }
.ib-dash__band.is-strong { background: rgba(79,122,74,.16);  color: var(--ibp-success); }

.ib-dash__topics { display: grid; gap: .9rem; }
.ib-dash__topic { display: block; text-decoration: none; color: inherit; }
.ib-dash__topic:hover strong { color: var(--ibp-accent); }
.ib-dash__topic-head {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  flex-wrap: wrap;
  margin-bottom: .35rem;
}
.ib-dash__topic-meta { font-size: .78rem; color: var(--ibp-text-muted); margin-right: auto; }
.ib-dash__bar {
  height: 8px;
  background: var(--ibp-track);
  border-radius: 999px;
  overflow: hidden;
}
.ib-dash__bar-fill { height: 100%; border-radius: 999px; }
.ib-dash__bar-fill.is-weak   { background: #C0564A; }
.ib-dash__bar-fill.is-dev    { background: var(--ibp-gold); }
.ib-dash__bar-fill.is-strong { background: var(--ibp-success); }

.ib-dash__history { list-style: none; margin: 0; padding: 0; }
.ib-dash__history li {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  padding: .5rem 0;
  border-top: 1px dashed var(--ibp-line);
  font-size: .9rem;
}
.ib-dash__history li:first-child { border-top: 0; }
.ib-dash__dot {
  width: 1.4rem; height: 1.4rem;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: .75rem; font-weight: 700;
  flex: 0 0 auto;
}
.ib-dash__dot.is-strong { background: rgba(79,122,74,.16); color: var(--ibp-success); }
.ib-dash__dot.is-weak   { background: rgba(176,70,60,.15); color: #C0564A; }
.ib-dash__dot.is-skip   { background: var(--ibp-deep-bg); color: var(--ibp-text-muted); }
.ib-dash__hist-given { color: var(--ibp-text-muted); font-style: italic; }
.ib-dash__hint-chip { font-size: .75rem; }
.ib-dash__hist-time { margin-left: auto; font-size: .75rem; color: var(--ibp-text-muted); }

.ib-dash__actions { margin-top: .5rem; }

/* ------------------------------------------------------------------ */
/* Phase 3, gamification: daily goal ring, XP bar, badges, rec chips  */
/* ------------------------------------------------------------------ */

.ib-dash__game-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: center;
}

.ib-dash__ringwrap { display: flex; align-items: center; gap: 1.1rem; }
.ib-dash__ring { width: 104px; height: 104px; flex: 0 0 auto; }
.ib-dash__ring-bg { stroke: var(--ibp-track); }
.ib-dash__ring-fg { stroke: var(--ibp-accent); transition: stroke-dashoffset .6s ease; }
.ib-dash__ring-text {
  fill: var(--ibp-text);
  font-family: var(--ibp-font-ui);
  font-size: 17px;
  font-weight: 700;
}
.ib-dash__goal-meta strong { display: block; margin-bottom: .15rem; }
.ib-dash__goal-meta p { margin: 0 0 .5rem; color: var(--ibp-text-soft); font-size: .9rem; }
.ib-dash__goal-edit { display: flex; align-items: center; gap: .55rem; }
.ib-dash__goal-val { font-weight: 700; font-size: .9rem; min-width: 4.2ch; text-align: center; }

.ib-dash__xp-level { margin: 0 0 .4rem; font-size: 1.25rem; font-weight: 700; }
.ib-dash__xp-total { color: var(--ibp-text-muted); font-size: .95rem; font-weight: 600; }
.ib-xpbar {
  height: 10px;
  border-radius: 999px;
  background: var(--ibp-track);
  overflow: hidden;
}
.ib-xpbar__fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ibp-accent), var(--ibp-gold));
  transition: width .6s ease;
}
.ib-dash__xp-note { margin: .5rem 0 0; font-size: .85rem; color: var(--ibp-text-muted); }

.ib-dash__badges {
  display: grid;
  gap: .8rem;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.ib-dash__badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  text-align: center;
  padding: .85rem .6rem;
  border: 1px solid var(--ibp-card-border);
  border-radius: var(--ibp-radius-sm);
  background: var(--ibp-soft-bg);
}
.ib-dash__badge strong { font-size: .9rem; }
.ib-dash__badge-emoji { font-size: 1.7rem; line-height: 1; }
.ib-dash__badge-desc { font-size: .75rem; color: var(--ibp-text-muted); }
.ib-dash__badge.is-locked { opacity: .55; filter: grayscale(.8); }

.ib-rec-chip {
  display: inline-block;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .15rem .5rem;
  border-radius: 999px;
  margin-right: .55rem;
  white-space: nowrap;
}
.ib-rec-chip.is-weak   { background: rgba(176,70,60,.15);   color: #C0564A; }
.ib-rec-chip.is-dev    { background: rgba(217,178,101,.18); color: var(--ibp-gold); }
.ib-rec-chip.is-strong { background: rgba(79,122,74,.16);   color: var(--ibp-success); }
.ib-rec-chip.is-new    { background: var(--ibp-accent-soft); color: var(--ibp-accent); }
.ib-dash__band.is-new  { background: var(--ibp-accent-soft); color: var(--ibp-accent); }

.ib-xp-chip {
  display: inline-block;
  margin-left: .55rem;
  font-size: .8rem;
  font-weight: 800;
  color: var(--ibp-gold);
  animation: ib-xp-pop .45s ease;
}
@keyframes ib-xp-pop {
  0%   { transform: scale(.6); opacity: 0; }
  60%  { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .ib-xp-chip { animation: none; }
}

/* ------------------------------------------------------------------ */
/* Phase 4, parent dashboard, family panel, diagnostic                */
/* ------------------------------------------------------------------ */

.ib-parent__form { display: grid; gap: .7rem; max-width: 420px; }
.ib-parent__child-head {
  display: flex;
  align-items: baseline;
  gap: .8rem;
  flex-wrap: wrap;
  margin-bottom: .8rem;
}
.ib-parent__child-head h2 { margin: 0; }
.ib-parent__cards { margin-bottom: 1rem; }
.ib-dash__card-value.is-strong { color: var(--ibp-success); }
.ib-dash__card-value.is-weak   { color: #C0564A; }

.ib-parent__dots { display: flex; align-items: center; gap: .3rem; margin: .4rem 0 .9rem; flex-wrap: wrap; }
.ib-parent__dot {
  width: .8rem; height: .8rem;
  border-radius: 50%;
  background: var(--ibp-track);
  display: inline-block;
}
.ib-parent__dot.is-on { background: var(--ibp-success); }

.ib-parent__weak h3 { margin: .2rem 0 .4rem; font-size: 1rem; }
.ib-parent__weak ul { margin: 0; padding-left: 1.1rem; }
.ib-parent__weak li { padding: .25rem 0; }
.ib-parent__weak a { color: var(--ibp-accent); font-weight: 600; }
.ib-parent__allgood { margin: .2rem 0 0; color: var(--ibp-success); font-weight: 600; }

.ib-parent__cta { border-color: var(--ibp-accent); }
.ib-parent__cta h2 { margin-top: 0; }

.ib-dash__family-row {
  display: flex;
  gap: .6rem;
  align-items: center;
  flex-wrap: wrap;
}
.ib-dash__family-row .ib-input { max-width: 320px; flex: 1 1 220px; }

.ib-diag__progress { margin-bottom: 1rem; display: grid; gap: .35rem; }

/* Visual mathematics (generated diagrams) */
.ib-viz {
  margin: 1rem auto 1.25rem;
  max-width: 560px;
  text-align: center;
}
.ib-viz__svg {
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}
@media (max-width: 480px) {
  .ib-viz { margin: .75rem auto 1rem; }
  .ib-viz__svg { max-height: 220px !important; }
}


/* ------------------------------------------------------------------ */
/* Live question counter (landing hero), exact figures from stats.js */
/* ------------------------------------------------------------------ */
.ib-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.ib-livecount {
  margin: 2.5rem auto 0;
  padding-top: 2rem;
  max-width: 760px;
  border-top: 1px solid var(--ibp-line);
}
.ib-livecount__primary {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
}
.ib-livecount__num {
  font-family: var(--ibp-font-display);
  font-size: clamp(2.6rem, 7vw, 4rem);
  font-weight: 700;
  line-height: 1;
  color: var(--ibp-text);
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}
.ib-livecount__label {
  font-family: var(--ibp-font-ui);
  font-size: .8rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ibp-accent);
}
.ib-livecount__note {
  margin: .6rem 0 0;
  text-align: center;
  font-size: .85rem;
  color: var(--ibp-text-muted);
}
.ib-livecount__substats {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem 2.25rem;
}
.ib-livecount__substats li {
  font-size: .9rem;
  color: var(--ibp-text-soft);
}
.ib-livecount__substats strong {
  color: var(--ibp-text);
  font-variant-numeric: tabular-nums;
  margin-right: .25rem;
}
@media (max-width: 640px) {
  .ib-livecount { margin-top: 2rem; padding-top: 1.5rem; }
  .ib-livecount__substats { gap: .4rem 1.25rem; }
}

/* =====================================================================
   MOTION SYSTEM v3 — "CONSTELLATION OF LEARNING", portal layer (2026-06)
   The portal shares the marketing site's motion grammar: one settle
   easing, points-plot-and-connect as the signature, transform/opacity
   only. The global reduced-motion guard above (line ~967) already
   disables every animation below; JS-driven moments check the media
   query themselves before injecting nodes.
   ===================================================================== */

:root {
  --ibe-out:    cubic-bezier(.22,.61,.21,1);
  --ibe-pop:    cubic-bezier(.3,1.25,.4,1);
  --ibe-spring: cubic-bezier(.34,1.45,.5,1);
}

/* ---------- Shared constellation keyframes ---------- */
@keyframes ib-node-in {
  from { opacity: 0; transform: scale(.2); }
  60%  { opacity: 1; transform: scale(1.25); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes ib-twinkle {
  0%, 100% { opacity: .95; }
  50%      { opacity: .45; }
}
@keyframes ib-line-draw { to { stroke-dashoffset: 0; } }

/* ---------- View choreography: each stage settles into place -------- */
.ib-view-anim > * { animation: ibp-view-in .34s var(--ibe-out) both; }
@keyframes ibp-view-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* Header elevates once content scrolls beneath it */
.ib-portal-header { transition: box-shadow .35s ease; }
.ib-portal-header.is-scrolled { box-shadow: 0 10px 30px -18px rgba(32,32,30,.28); }
[data-theme="dark"] .ib-portal-header.is-scrolled { box-shadow: 0 10px 30px -18px rgba(0,0,0,.65); }

/* Brand + icon buttons answer the hand */
.ib-portal-brand__mark { transition: transform .3s var(--ibe-pop); }
.ib-portal-brand:hover .ib-portal-brand__mark { transform: rotate(-6deg) scale(1.06); }
.ib-icon-btn svg { transition: transform .3s var(--ibe-pop); }
.ib-icon-btn:hover svg { transform: rotate(10deg) scale(1.08); }

/* ---------- Cards: cascade in, lean toward the cursor ---------- */
.ib-card-grid .ib-card,
.ib-card-grid--lg .ib-card,
.ib-card-grid--tight .ib-card,
.ib-ladder__item {
  animation: ibp-view-in .42s var(--ibe-out) both;
  animation-delay: calc(min(var(--ci, 0), 9) * 45ms);
}
.ib-card-grid > :nth-child(1), .ib-ladder__item:nth-child(1) { --ci: 0; }
.ib-card-grid > :nth-child(2), .ib-ladder__item:nth-child(2) { --ci: 1; }
.ib-card-grid > :nth-child(3), .ib-ladder__item:nth-child(3) { --ci: 2; }
.ib-card-grid > :nth-child(4), .ib-ladder__item:nth-child(4) { --ci: 3; }
.ib-card-grid > :nth-child(5), .ib-ladder__item:nth-child(5) { --ci: 4; }
.ib-card-grid > :nth-child(6), .ib-ladder__item:nth-child(6) { --ci: 5; }
.ib-card-grid > :nth-child(7) { --ci: 6; }
.ib-card-grid > :nth-child(8) { --ci: 7; }
.ib-card-grid > :nth-child(9) { --ci: 8; }
.ib-card-grid > :nth-child(n+10) { --ci: 9; }

/* Cursor spotlight (desktop only; JS sets --mx/--my) */
[data-spot] { position: relative; }
[data-spot]::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity .5s ease;
  background: radial-gradient(230px circle at var(--mx, 50%) var(--my, 50%),
              color-mix(in srgb, var(--ibp-accent) 8%, transparent), transparent 68%);
}
[data-spot]:hover::after { opacity: 1; }
@media (hover: none) { [data-spot]::after { display: none; } }

/* ---------- Buttons: same tactile grammar as the main site ---------- */
.ib-btn { translate: 0 0; transition: background .18s, color .18s, border-color .18s, transform .15s, translate .4s var(--ibe-out), scale .16s var(--ibe-out), box-shadow .3s var(--ibe-out); }
.ib-btn:active { scale: .97; }
.ib-btn-primary:hover, .ib-btn-accent:hover { box-shadow: 0 10px 24px -10px rgba(201,100,66,.4); }
[data-theme="dark"] .ib-btn-primary:hover,
[data-theme="dark"] .ib-btn-accent:hover { box-shadow: 0 10px 24px -10px rgba(0,0,0,.6); }
.ib-btn svg { transition: transform .3s var(--ibe-out); }
.ib-btn:hover svg { transform: translateX(3px); }

/* ---------- Question experience ---------- */
/* Entrance: settle with a touch of focus */
.ib-question--enter { animation: ibCardIn .42s var(--ibe-out) both; }
@keyframes ibCardIn {
  from { opacity: 0; transform: translateY(14px) scale(.99); filter: blur(3px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}

/* Options cascade in beneath the prompt */
.ib-opts .ib-opt {
  animation: ibp-view-in .38s var(--ibe-out) both;
  transition: border-color .18s ease, background .18s ease, transform .18s var(--ibe-out), box-shadow .25s var(--ibe-out);
}
.ib-opts .ib-opt:nth-child(1) { animation-delay: .05s; }
.ib-opts .ib-opt:nth-child(2) { animation-delay: .1s; }
.ib-opts .ib-opt:nth-child(3) { animation-delay: .15s; }
.ib-opts .ib-opt:nth-child(4) { animation-delay: .2s; }
.ib-opts .ib-opt:nth-child(n+5) { animation-delay: .25s; }
.ib-opt:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 16px -10px rgba(32,32,30,.25); }
.ib-opt:active:not(:disabled) { transform: none; }
.ib-opt.is-selected { animation: ibp-select .25s var(--ibe-pop); }
@keyframes ibp-select { 50% { transform: scale(1.012); } }
.ib-opt__key { transition: background .18s ease, color .18s ease, transform .25s var(--ibe-pop); }
.ib-opt:hover:not(:disabled) .ib-opt__key { transform: scale(1.08); }
.ib-opt.is-selected .ib-opt__key { background: var(--ibp-accent); color: #fff; }

/* Wrong answers: a considered nudge, not a punishment */
@keyframes ibShake {
  15%, 85% { transform: translateX(-2px); }
  30%, 70% { transform: translateX(3px); }
  45%, 55% { transform: translateX(-3px); }
}
.ib-shake { animation: ibShake .4s ease; }
.ib-opt.is-wrong { background: color-mix(in srgb, #B0463C 7%, var(--ibp-card-bg)); }

/* ---------- Constellation burst: the correct-answer signature ------- */
/* A point of understanding plots, then connects outward. */
.ib-burst { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 5; }
.ib-burst svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ib-burst line {
  stroke: var(--clr, var(--ibp-accent));
  stroke-width: 1.2;
  stroke-opacity: .5;
  stroke-dasharray: var(--len, 80);
  stroke-dashoffset: var(--len, 80);
  animation: ib-line-draw .45s var(--ibe-out) var(--d, 0s) forwards,
             ibp-burst-fade .5s ease calc(var(--d, 0s) + .55s) forwards;
}
.ib-burst circle {
  fill: var(--clr, var(--ibp-accent));
  transform-box: fill-box; transform-origin: center;
  opacity: 0;
  animation: ib-node-in .4s var(--ibe-pop) var(--d, 0s) forwards,
             ibp-burst-fade .55s ease calc(var(--d, 0s) + .6s) forwards;
}
@keyframes ibp-burst-fade { to { opacity: 0; } }

/* ---------- Streak + first-star chips (hidden delight, rare) -------- */
.ib-moment {
  position: absolute;
  top: -.9rem; left: 50%;
  z-index: 6;
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .45rem .95rem;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--ibp-gold), color-mix(in srgb, var(--ibp-gold) 70%, var(--ibp-accent)));
  color: #fff;
  font-family: var(--ibp-font-display);
  font-size: .82rem; font-weight: 700; letter-spacing: .04em;
  box-shadow: 0 10px 28px -12px rgba(181,138,58,.55);
  pointer-events: none;
  white-space: nowrap;
  animation: ibp-moment 2.4s var(--ibe-spring) both;
}
@keyframes ibp-moment {
  0%   { opacity: 0; transform: translate(-50%, 10px) scale(.8); }
  12%  { opacity: 1; transform: translate(-50%, 0) scale(1); }
  82%  { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -14px) scale(.96); }
}

/* ---------- Branded loading state: questions being plotted ---------- */
.ibp-loader {
  max-width: 460px;
  margin: 3rem auto;
  padding: 2.5rem 2rem;
  text-align: center;
  background: var(--ibp-card-bg);
  border: 1px solid var(--ibp-card-border);
  border-radius: var(--ibp-radius);
  box-shadow: var(--ibp-shadow);
}
.ibp-loader__sky { width: 180px; height: 90px; margin: 0 auto 1.25rem; display: block; }
.ibp-loader__sky line {
  stroke: var(--ibp-accent);
  stroke-width: 1.1;
  stroke-opacity: .45;
  stroke-dasharray: var(--len, 60);
  stroke-dashoffset: var(--len, 60);
  animation: ibp-loader-line 2.6s var(--ibe-out) var(--d, 0s) infinite;
}
.ibp-loader__sky circle {
  fill: var(--ibp-accent);
  transform-box: fill-box; transform-origin: center;
  opacity: 0;
  animation: ibp-loader-node 2.6s var(--ibe-out) var(--d, 0s) infinite;
}
.ibp-loader__sky circle.is-gold { fill: var(--ibp-gold); }
@keyframes ibp-loader-node {
  0%        { opacity: 0; transform: scale(.2); }
  10%, 72%  { opacity: 1; transform: scale(1); }
  88%, 100% { opacity: 0; transform: scale(.6); }
}
@keyframes ibp-loader-line {
  0%        { stroke-dashoffset: var(--len, 60); opacity: 1; }
  38%, 72%  { stroke-dashoffset: 0; opacity: 1; }
  88%, 100% { stroke-dashoffset: 0; opacity: 0; }
}
.ibp-loader strong { display: block; font-size: 1.05rem; margin-bottom: .3rem; color: var(--ibp-text); }
.ibp-loader p { margin: 0; font-size: .9rem; color: var(--ibp-text-muted); }

/* ---------- Completion: the constellation completes ---------- */
.ib-complete-k { width: min(240px, 60vw); height: auto; display: block; margin: 0 auto 1.25rem; }
.ib-complete-k line {
  stroke: var(--ibp-accent);
  stroke-width: 1.2;
  stroke-opacity: .5;
  stroke-dasharray: var(--len, 60);
  stroke-dashoffset: var(--len, 60);
  animation: ib-line-draw .7s var(--ibe-out) var(--d, 0s) forwards;
}
.ib-complete-k circle {
  fill: var(--ibp-accent);
  transform-box: fill-box; transform-origin: center;
  opacity: 0;
  animation: ib-node-in .5s var(--ibe-pop) var(--d, 0s) forwards,
             ib-twinkle 6s ease-in-out calc(var(--d, 0s) + 2s) infinite;
}
.ib-complete-k.is-gold line { stroke: var(--ibp-gold); stroke-opacity: .65; }
.ib-complete-k.is-gold circle { fill: var(--ibp-gold); }
.ib-runner-complete { text-align: center; }
.ib-runner-complete .ib-question__actions { justify-content: center; }

/* ---------- Progress meters acknowledge each step ---------- */
.ib-progress__fill { transition: width .5s var(--ibe-out); }
.ib-ring__fill { transition: stroke-dashoffset .55s var(--ibe-out); }
.ib-bump { animation: ibp-bump .55s var(--ibe-pop); }
@keyframes ibp-bump { 45% { transform: scale(1.045); } }

/* ---------- Feedback panel: settle, don't pop harshly ---------- */
.ib-feedback.is-correct, .ib-feedback.is-wrong, .ib-feedback.is-reveal {
  animation: ibPop .34s var(--ibe-pop) both;
}

/* ---------- Empty states still feel designed ---------- */
.ib-empty { animation: ibp-view-in .4s var(--ibe-out) both; }

/* ---------- Reduced motion: still everything new ---------- */
@media (prefers-reduced-motion: reduce) {
  .ib-view-anim > *, .ib-card-grid .ib-card, .ib-ladder__item,
  .ib-opts .ib-opt, .ib-question--enter, .ib-empty { animation: none !important; opacity: 1 !important; transform: none !important; }
  .ibp-loader__sky circle { opacity: 1; }
  .ibp-loader__sky line, .ib-complete-k line { stroke-dashoffset: 0; }
  .ib-complete-k circle { opacity: 1; }
  [data-spot]::after { display: none; }
  .ib-btn { translate: none !important; }
}
