/* ===========================================================
   Sasta Basta — styles
   Colourful, friendly, high-contrast. Per-strand colour themes
   help memory. Includes print styles for worksheets.
   =========================================================== */

:root {
  --bg: #f6f8ff;
  --bg-soft: #ffffff;
  --ink: #1f2440;
  --ink-soft: #5b6280;
  --line: #e6e9f5;
  --brand: #6c4cff;
  --brand-2: #00c2a8;
  --triomatic-green: #8dc63f;
  --good: #1faa59;
  --bad: #e23d57;
  --warn: #f59e0b;
  --shadow: 0 8px 30px rgba(40, 30, 90, 0.10);
  --shadow-sm: 0 3px 12px rgba(40, 30, 90, 0.08);
  --radius: 18px;
  --radius-sm: 12px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  /* Strand colour palette */
  --c-number: #ff6b6b;
  --c-algebra: #6c4cff;
  --c-ratio: #f59e0b;
  --c-geometry: #00b8d4;
  --c-probability: #1faa59;
  --c-statistics: #e84393;
}

* { box-sizing: border-box; }

html {
  /* App ships its own themes — tell the browser NOT to auto-darken the light
     ones (Chrome/Android "force dark for websites"). The Triomatic theme opts
     back into dark below. */
  color-scheme: only light;
}
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }

/* ===================== Top bar ===================== */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px;
  padding: 12px 22px;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 1.25rem; }
.brand-logo { height: 44px; width: auto; display: block; }
.topnav { display: flex; gap: 8px; margin-left: auto; }
.topnav a {
  padding: 9px 16px; border-radius: 999px; color: var(--ink); font-weight: 700;
  background: #eef0fb; transition: .15s;
}
.topnav a:hover { background: #e3e6f7; transform: translateY(-1px); }
.topnav a.active { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.topbar-progress { margin-left: 6px; }
.ring {
  --p: 0;
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  background:
    radial-gradient(closest-side, #fff 72%, transparent 73%),
    conic-gradient(var(--brand-2) calc(var(--p) * 1%), #e6e9f5 0);
  font-size: .72rem; font-weight: 800; color: var(--ink);
}

/* ===================== Layout ===================== */
.view { max-width: 1080px; margin: 0 auto; padding: 26px 22px 90px; }
.section-title { font-size: 1.5rem; margin: 28px 0 14px; }
.muted { color: var(--ink-soft); }
.crumbs { font-size: .9rem; color: var(--ink-soft); margin-bottom: 14px; }
.crumbs a { color: var(--ink-soft); }
.crumbs a:hover { color: var(--brand); }

/* ===================== Hero ===================== */
.hero {
  position: relative; overflow: hidden;
  border-radius: 26px; padding: 40px 36px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff; box-shadow: var(--shadow);
}
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); margin-bottom: .3em; }
.hero p { font-size: 1.08rem; max-width: 640px; opacity: .96; }
.hero .pills { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.hero .pill { background: rgba(255,255,255,.18); padding: 7px 14px; border-radius: 999px; font-weight: 600; font-size: .9rem; }
.hero .blob { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .25; }
.hero .blob.b1 { width: 220px; height: 220px; background: #fff; right: -60px; top: -70px; }
.hero .blob.b2 { width: 140px; height: 140px; background: #ffd166; right: 120px; bottom: -60px; }

/* ===================== Subject switcher ===================== */
.subject-switch { display: inline-flex; flex-wrap: wrap; gap: 6px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 999px; padding: 5px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.subj-btn { display: inline-flex; align-items: center; gap: 7px; border: none; background: none; cursor: pointer; font-family: var(--font); font-weight: 800; font-size: .95rem; color: var(--ink-soft); padding: 9px 18px; border-radius: 999px; transition: .15s; }
.subj-btn .subj-emoji { font-size: 1.1rem; }
.subj-btn:hover { color: var(--ink); }
.subj-btn.active { background: var(--s, var(--brand)); color: #fff; }
.subj-board { font-size: .58rem; font-weight: 900; letter-spacing: .04em; padding: 2px 6px; border-radius: 999px; background: var(--s, var(--brand)); color: #fff; }
.subj-btn:not(.active) .subj-board { opacity: .85; }
.subj-btn.active .subj-board { background: rgba(255,255,255,.28); }

/* ---- Subject dropdown (top-right of Home) ---- */
.subj-bar { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.subj-dd { position: relative; }
.subj-dd-btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-family: var(--font); font-weight: 800; font-size: .95rem; color: var(--ink);
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 14px; box-shadow: var(--shadow-sm); transition: .15s;
}
.subj-dd-btn:hover { border-color: var(--s, var(--brand)); }
.subj-dd-btn .subj-dd-emoji { font-size: 1.1rem; }
.subj-dd-caret { color: var(--ink-soft); font-size: .75rem; }
.subj-dd-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60;
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); padding: 6px; min-width: 240px;
  max-width: calc(100vw - 24px); max-height: 72vh; overflow-y: auto;
}
.subj-dd-head { font-size: .72rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); padding: 8px 12px 4px; }
.subj-dd-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; cursor: pointer;
  border: none; background: none; font-family: var(--font); font-weight: 700; font-size: .95rem;
  color: var(--ink); padding: 10px 12px; border-radius: 10px;
}
.subj-dd-item:hover { background: var(--bg-soft); }
.subj-dd-item.active { background: var(--bg-soft); }
.subj-dd-item .subj-dd-emoji { font-size: 1.15rem; }
.subj-dd-label { flex: 1; }
.subj-dd-check { color: var(--s, var(--brand)); font-weight: 900; }

/* ===================== Exam-board branding ===================== */
.board-banner { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; background: var(--bg-soft); border: 1px solid var(--line); border-left: 6px solid var(--s, var(--brand)); border-radius: var(--radius); padding: 16px 18px; margin-top: 20px; box-shadow: var(--shadow-sm); }
.board-badge { flex: 0 0 auto; font-size: .82rem; font-weight: 800; padding: 7px 13px; border-radius: 999px; background: var(--s, var(--brand)); color: #fff; white-space: nowrap; }
.board-body { flex: 1; min-width: 220px; }
.board-lead { margin: 2px 0 6px; font-size: .95rem; line-height: 1.5; }
.board-codes { margin: 0; font-size: .82rem; font-weight: 800; color: var(--s, var(--brand)); }
.board-more { margin-top: 8px; }
.board-more > summary { cursor: pointer; font-weight: 800; font-size: .85rem; color: var(--ink-soft); list-style: none; }
.board-more > summary::-webkit-details-marker { display: none; }
.board-more[open] > summary { color: var(--s, var(--brand)); }
.board-more p { font-size: .85rem; line-height: 1.55; color: var(--ink-soft); margin: 8px 0 0; }
.board-disclaimer { font-size: .74rem !important; opacity: .82; }
.chapter-head .chip.board-chip { background: #fff; color: var(--s, var(--brand)); border: 1.5px solid var(--s, var(--brand)); }
.chapter-head .chip.ks2-chip { background: #ecfdf5; color: #047857; border: 1.5px solid #6ee7b7; }

/* ===== Personalised pace / study plan ===== */
.pace-card { border-left-color: var(--brand) !important; }
.pace-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.pace-kicker { font-size: .7rem; font-weight: 800; letter-spacing: .12em; color: var(--brand); opacity: .85; }
.pace-goal { font-size: 1.2rem; margin: 2px 0 0; line-height: 1.3; }
.pace-goal span { color: var(--brand); }
.pace-pill, .pace-mini-pill { font-weight: 800; font-size: .8rem; padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.pace-ok { background: #ecfdf5; color: #047857; border: 1.5px solid #6ee7b7; }
.pace-warn { background: #fffbeb; color: #b45309; border: 1.5px solid #fcd34d; }
.pace-slider { width: 100%; margin: 18px 0 4px; accent-color: var(--brand); cursor: pointer; }
.pace-slider-scale { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted, #64748b); }
.pace-readout { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0 6px; }
.pace-metric { flex: 1; min-width: 110px; background: var(--bg-soft, #f8fafc); border-radius: 12px; padding: 12px 10px; text-align: center; }
.pace-metric b { display: block; font-size: 1.4rem; color: var(--ink); line-height: 1.15; }
.pace-metric span { font-size: .73rem; color: var(--muted, #64748b); }
.pace-week { margin: 10px 0 4px; }
.pace-week-top { display: flex; justify-content: space-between; font-size: .82rem; font-weight: 700; margin-bottom: 6px; }
.pace-proj { font-size: .86rem; margin: 12px 0 6px; }
.pace-mini { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--bg-soft, #f8fafc); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin: 12px 0; text-decoration: none; color: var(--ink); font-size: .88rem; }
.pace-mini-txt { flex: 1 1 auto; }
.pace-mini-go { margin-left: auto; color: var(--brand); font-weight: 800; white-space: nowrap; }

/* ===== Calendar classroom: setup ===== */
.cls-setup { border-left-color: #6c4cff !important; }
.cls-row { display: flex; align-items: center; gap: 12px; margin: 12px 0; flex-wrap: wrap; }
.cls-row.cls-col { flex-direction: column; align-items: stretch; }
.cls-label { font-weight: 700; font-size: .9rem; min-width: 120px; }
.cls-select { padding: 8px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg-soft, #f8fafc); color: var(--ink); font: inherit; font-weight: 700; }
.cls-select-sm { padding: 5px 8px; font-size: .82rem; font-weight: 600; }
.cls-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.cls-chip { min-width: 40px; padding: 8px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg-soft, #f8fafc); color: var(--ink); font-weight: 800; cursor: pointer; }
.cls-chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.cls-subj { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--bg-soft, #f8fafc); color: var(--muted, #64748b); font-weight: 700; font-size: .82rem; cursor: pointer; opacity: .6; }
.cls-subj.on { opacity: 1; color: var(--s); border-color: var(--s); background: color-mix(in srgb, var(--s) 10%, transparent); }
.cls-adv { margin: 10px 0 4px; }
.cls-adv summary { cursor: pointer; font-weight: 700; font-size: .88rem; color: var(--brand); }
.cls-adv-list { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.cls-adv-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: .86rem; }
.cls-note { font-size: .82rem; margin-top: 10px; }

/* ===== Calendar classroom: schedule / agenda ===== */
.tw-goal { font-size: .8rem; font-weight: 600; }
.cal-day { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; background: var(--card, #fff); }
.cal-day.today { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 20%, transparent); }
.cal-date { font-weight: 800; font-size: .82rem; color: var(--muted, #64748b); margin-bottom: 8px; }
.cal-day.today .cal-date { color: var(--brand); }
.cal-empty { font-size: .82rem; padding: 2px 0; }
.cal-lesson { display: flex; align-items: center; gap: 8px; border-left: 3px solid var(--s); padding: 6px 4px 6px 10px; border-radius: 6px; }
.cal-lesson + .cal-lesson { margin-top: 4px; }
.cal-lesson-go { display: flex; align-items: center; gap: 10px; flex: 1; text-decoration: none; color: var(--ink); min-width: 0; }
.cal-lesson-ico { font-size: 1.1rem; }
.cal-lesson-txt { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.cal-lesson-txt b { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; }
.cal-lesson-txt .muted { font-size: .72rem; }
.cal-skip { border: 1px solid var(--line); background: var(--bg-soft, #f8fafc); color: #047857; border-radius: 8px; width: 30px; height: 30px; font-weight: 800; cursor: pointer; flex: none; }
.cal-skip:hover { background: #ecfdf5; border-color: #6ee7b7; }
.cal-wk { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; overflow: hidden; }
.cal-wk > summary { display: flex; justify-content: space-between; padding: 12px 14px; cursor: pointer; font-weight: 700; font-size: .9rem; }
.cal-wk-body { padding: 4px 14px 12px; display: flex; flex-direction: column; gap: 4px; }
.cal-mini { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-size: .85rem; border-left: 3px solid var(--s); padding: 4px 10px; border-radius: 6px; }
.journey-det > summary { cursor: pointer; font-weight: 800; }

/* ===== Home "Today" guide card ===== */
.today-card { border: 2px solid color-mix(in srgb, var(--brand) 35%, transparent); border-radius: 18px; padding: 16px; margin: 18px 0; background: var(--bg-soft, #f8fafc); }
.today-card.done { border-color: #6ee7b7; background: #ecfdf5; }
.today-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.today-kick { font-weight: 800; font-size: .74rem; letter-spacing: .08em; color: var(--brand); }
.today-link { font-weight: 700; font-size: .82rem; color: var(--brand); text-decoration: none; white-space: nowrap; }
.today-lessons { display: flex; flex-direction: column; gap: 8px; }
.today-lesson { display: flex; align-items: center; gap: 12px; background: var(--card, #fff); border: 1px solid var(--line); border-left: 4px solid var(--s); border-radius: 12px; padding: 10px 12px; text-decoration: none; color: var(--ink); }
.today-lesson-ico { font-size: 1.3rem; }
.today-lesson-txt { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.today-lesson-txt b { font-size: .95rem; }
.today-lesson-txt small { font-size: .74rem; color: var(--muted, #64748b); }
.today-go { color: var(--s); font-weight: 800; }
.today-rest { font-weight: 600; margin: 6px 0; }
.today-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.today-cta { --s: var(--brand); font-size: .9rem; padding: 9px 16px; }

/* ===================== Strand cards ===================== */
.grid { display: grid; gap: 18px; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card {
  background: var(--bg-soft); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--line);
  transition: transform .15s, box-shadow .15s; cursor: pointer;
  position: relative; overflow: hidden;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card .icon {
  width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
  font-size: 1.6rem; color: #fff; margin-bottom: 12px;
}
.card h3 { font-size: 1.15rem; margin-bottom: 4px; }
.card .meta { font-size: .85rem; color: var(--ink-soft); }
.card .bar { height: 8px; border-radius: 999px; background: #eef0fb; margin-top: 14px; overflow: hidden; }
.card .bar > i { display: block; height: 100%; border-radius: 999px; }
.card .strand-tag { position: absolute; top: 0; right: 0; width: 90px; height: 90px; opacity: .08; border-radius: 0 0 0 100%; }

/* strand colour helpers */
.s-number   { --s: var(--c-number); }
.s-algebra  { --s: var(--c-algebra); }
.s-ratio    { --s: var(--c-ratio); }
.s-geometry { --s: var(--c-geometry); }
.s-probability { --s: var(--c-probability); }
.s-statistics  { --s: var(--c-statistics); }
.card.s-number .icon, .card.s-algebra .icon, .card.s-ratio .icon,
.card.s-geometry .icon, .card.s-probability .icon, .card.s-statistics .icon { background: var(--s); }
.bar > i { background: var(--s, var(--brand)); }

/* ===================== Chapter list ===================== */
.chapter-list { display: grid; gap: 12px; }
.chapter-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-soft); border: 1px solid var(--line); border-left: 6px solid var(--s, var(--brand));
  border-radius: var(--radius-sm); padding: 14px 16px; cursor: pointer; transition: .15s;
}
.chapter-row:hover { box-shadow: var(--shadow-sm); transform: translateX(3px); }
.chapter-row .num { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--s, var(--brand)); color:#fff; font-weight: 800; flex: none; }
.chapter-row .ttl { font-weight: 700; }
.chapter-row .sub { font-size: .82rem; color: var(--ink-soft); }
.chapter-row .state { margin-left: auto; font-size: 1.3rem; }
.lvl-tag { font-size: .68rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.lvl-foundation { background: #e6f7ef; color: #1faa59; }
.lvl-higher { background: #efeaff; color: #6c4cff; }
.lvl-both { background: #fff3e0; color: #c77700; }

/* ===================== Chapter view tabs ===================== */
.chapter-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.chapter-head .chip { font-size: .8rem; font-weight: 700; padding: 4px 12px; border-radius: 999px; background: var(--s, var(--brand)); color: #fff; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0; border-bottom: 2px solid var(--line); }
.tab {
  padding: 10px 18px; border: none; background: none; font-weight: 700; font-size: .98rem;
  color: var(--ink-soft); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.tab.active { color: var(--s, var(--brand)); border-bottom-color: var(--s, var(--brand)); }
.tab .tab-emoji { margin-right: 6px; }
.panel { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Learn panel */
.notes { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow-sm); }
.notes h3 { color: var(--s, var(--brand)); margin-top: 1.2em; }
.notes h4 { margin: 1.1em 0 .3em; color: var(--ink); font-size: 1.02rem; }
.notes ul, .notes ol { padding-left: 1.3em; }
.notes li { margin: 3px 0; }
.notes p { margin: .6em 0; }
.notes .key { background: #f3f1ff; border-left: 4px solid var(--s, var(--brand)); padding: 12px 16px; border-radius: 8px; margin: 14px 0; }
.notes .why { background: #eef6ff; border-left: 4px solid #2f80ed; padding: 12px 16px; border-radius: 8px; margin: 14px 0; }
.notes .warn { background: #fdeef0; border-left: 4px solid var(--bad); padding: 12px 16px; border-radius: 8px; margin: 14px 0; }
.notes .tip { background: #e9f9f0; border-left: 4px solid var(--good); padding: 12px 16px; border-radius: 8px; margin: 14px 0; }
.notes .eg { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 10px 0; }
.notes table { border-collapse: collapse; margin: 12px 0; font-size: .95rem; }
.notes table td, .notes table th { border: 1px solid var(--line); padding: 6px 14px; text-align: center; }
.notes table th { background: #f3f1ff; }
.notes .lead { font-size: 1.05rem; }
.notes .illus { margin: 16px auto; max-width: 380px; }
.notes .illus svg { width: 100%; height: auto; display: block; border-radius: 12px; }
.notes .illus figcaption { text-align: center; font-size: .85rem; color: var(--ink-soft); margin-top: 6px; }
.example { border: 1px dashed var(--s, var(--brand)); border-radius: var(--radius-sm); padding: 16px 18px; margin: 16px 0; background: #fff; }
.example .q { font-weight: 700; margin-bottom: 8px; }
.example .steps { counter-reset: step; list-style: none; padding-left: 0; margin: 0; }
.example .steps li { counter-increment: step; padding: 4px 0 4px 34px; position: relative; }
.example .steps li::before { content: counter(step); position: absolute; left: 0; top: 4px; width: 22px; height: 22px; border-radius: 50%; background: var(--s, var(--brand)); color: #fff; display: grid; place-items: center; font-size: .75rem; font-weight: 800; }
.example .ans { margin-top: 8px; font-weight: 800; color: var(--good); }

/* Video toggle */
.video-toggle { display: flex; align-items: center; gap: 12px; margin: 18px 0; padding: 14px 18px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.switch { position: relative; width: 50px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: #cfd4ea; border-radius: 999px; transition: .2s; cursor: pointer; }
.switch .slider::before { content: ""; position: absolute; height: 22px; width: 22px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: var(--shadow-sm); }
.switch input:checked + .slider { background: var(--good); }
.switch input:checked + .slider::before { transform: translateX(22px); }
.video-wrap { margin-top: 16px; }
.video-frame { aspect-ratio: 16/9; width: 100%; border-radius: var(--radius-sm); overflow: hidden; border: 0; background: #000; }
.video-placeholder { aspect-ratio: 16/9; width: 100%; border-radius: var(--radius-sm); display: grid; place-items: center; text-align: center; background: repeating-linear-gradient(45deg, #f0f1fa, #f0f1fa 12px, #e9ebf7 12px, #e9ebf7 24px); color: var(--ink-soft); padding: 20px; }

/* ===================== Interests: picker, personalisation, made-for-you ===================== */
.interest-pick { text-align: left; }
.interest-title { display: block; font-size: .82rem; font-weight: 700; color: var(--ink); margin: 2px 2px 8px; }
.interest-title em { font-style: normal; font-weight: 500; color: var(--ink-soft); }
.interest-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.interest-tile { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px; border: 2px solid var(--line); border-radius: 12px; background: var(--bg-soft); font-family: var(--font); font-size: .64rem; font-weight: 700; color: var(--ink); cursor: pointer; transition: .12s; }
.interest-tile .it-emoji { font-size: 1.2rem; }
.interest-tile:hover { border-color: var(--brand); }
.interest-tile.sel { border-color: var(--brand); background: #f0edff; box-shadow: inset 0 0 0 1px var(--brand); }

/* ===== In-lesson compound-growth calculator (js/widgets.js) ===== */
.sbcalc { border: 2px solid var(--line); border-radius: 16px; padding: 16px; margin: 20px 0; background: var(--bg-soft); }
.sbcalc-head { font-size: 1rem; margin-bottom: 12px; }
.sbcalc-head span { color: var(--ink-soft); font-weight: 400; font-size: .85rem; }
.sbcalc-inputs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.sbcalc-inputs label { display: flex; flex-direction: column; gap: 4px; font-size: .76rem; font-weight: 700; color: var(--ink-soft); }
.sbcalc-inputs input { padding: 9px 10px; border: 2px solid var(--line); border-radius: 10px; font-family: var(--font); font-size: 1rem; font-weight: 700; color: var(--ink); background: #fff; }
.sbcalc-inputs input:focus { outline: none; border-color: var(--s, var(--brand)); }
.sbcalc-out { margin-top: 14px; }
.sbcalc-big { font-size: 1.1rem; }
.sbcalc-big b { color: var(--s, var(--brand)); font-size: 1.5rem; }
.sbcalc-sub { color: var(--ink-soft); font-size: .9rem; margin-top: 3px; }
.sbcalc-chart { display: flex; align-items: flex-end; gap: 3px; height: 90px; margin: 16px 0 8px; }
.sbcalc-bar { flex: 1; min-width: 3px; background: var(--s, var(--brand)); border-radius: 4px 4px 0 0; position: relative; opacity: .88; transition: height .15s ease; }
.sbcalc-bar span { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: .62rem; color: var(--ink-soft); white-space: nowrap; }
.sbcalc-note { font-size: .74rem; color: var(--ink-soft); background: var(--bg); border-radius: 10px; padding: 9px 11px; margin-top: 18px; line-height: 1.45; }

/* ===== Careers explorer ===== */
.career-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-top: 16px; }
.career-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 16px; padding: 16px; cursor: pointer; font-family: var(--font); transition: transform .14s ease, border-color .14s ease; box-shadow: var(--shadow-sm); }
.career-card:hover { transform: translateY(-2px); border-color: var(--brand); }
.career-emoji { font-size: 1.9rem; line-height: 1; }
.career-emoji.big { font-size: 3rem; }
.career-name { font-weight: 800; color: var(--ink); font-size: 1.02rem; }
.career-why { color: var(--ink-soft); font-size: .84rem; line-height: 1.35; }
.career-meta { margin-top: 4px; font-size: .74rem; font-weight: 700; color: var(--brand); }
.career-detail-head { display: flex; align-items: center; gap: 16px; margin: 6px 0 10px; }
.career-detail-head h1 { margin: 0; }
.career-h { margin: 22px 0 10px; }
.career-subs { display: flex; flex-wrap: wrap; gap: 8px; }
.career-sub-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-soft); color: var(--ink); border: 1.5px solid var(--s, var(--brand)); border-radius: 999px; padding: 5px 12px; font-size: .85rem; font-weight: 600; }
.career-sub-chip b { color: var(--s, var(--brand)); }
.career-topic-group { margin: 12px 0; }
.career-topic-subj { font-weight: 800; color: var(--s, var(--brand)); margin-bottom: 6px; }
.career-topic-list { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.career-topic { display: inline-block; background: var(--bg-soft); border: 1px solid var(--line); border-left: 3px solid var(--s, var(--brand)); border-radius: 8px; padding: 6px 11px; font-size: .84rem; color: var(--ink); text-decoration: none; transition: border-color .12s ease; }
.career-topic:hover { border-color: var(--s, var(--brand)); }
.career-more { font-size: .78rem; color: var(--ink-soft); }

/* ===== World countries explorer (js/widgets.js) ===== */
.sbx { border: 2px solid var(--line); border-radius: 16px; padding: 14px; margin: 20px 0; background: var(--bg-soft); }
.sbx-bar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.sbx-search { width: 100%; padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px; font-family: var(--font); font-size: 1rem; color: var(--ink); background: #fff; }
.sbx-search:focus { outline: none; border-color: var(--s, var(--brand)); }
.sbx-regions { display: flex; flex-wrap: wrap; gap: 6px; }
.sbx-region { font-family: var(--font); font-size: .78rem; font-weight: 700; padding: 6px 12px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--bg-soft); color: var(--ink-soft); cursor: pointer; }
.sbx-region.on { border-color: var(--s, var(--brand)); color: var(--s, var(--brand)); background: var(--bg); }
.sbx-count { font-size: .76rem; color: var(--ink-soft); margin-bottom: 8px; }
.sbx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(94px, 1fr)); gap: 8px; }
.sbx-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-soft); cursor: pointer; font-family: var(--font); transition: border-color .12s ease, transform .12s ease; }
.sbx-tile:hover { border-color: var(--s, var(--brand)); transform: translateY(-1px); }
.sbx-flag { font-size: 2rem; line-height: 1; }
.sbx-name { font-size: .72rem; font-weight: 700; color: var(--ink); text-align: center; line-height: 1.15; }
.sbx-detail { position: relative; border: 2px solid var(--s, var(--brand)); border-radius: 14px; padding: 16px; margin-bottom: 14px; background: var(--bg); }
.sbx-close { position: absolute; top: 8px; right: 10px; border: none; background: transparent; font-size: 1.1rem; cursor: pointer; color: var(--ink-soft); }
.sbx-d-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.sbx-d-flag { font-size: 3rem; line-height: 1; }
.sbx-d-head h3 { margin: 0; }
.sbx-d-grid { display: grid; gap: 8px; }
.sbx-row { display: grid; grid-template-columns: 165px 1fr; gap: 10px; font-size: .88rem; padding-bottom: 7px; border-bottom: 1px dashed var(--line); }
.sbx-row:last-child { border-bottom: none; }
.sbx-row-l { font-weight: 700; color: var(--ink-soft); }
.sbx-row-v { color: var(--ink); }
@media (max-width: 560px) { .sbx-row { grid-template-columns: 1fr; gap: 1px; } .sbx-row-l { font-size: .78rem; } }

/* ===== Flag & capital quiz game (js/widgets.js) ===== */
.sbq { border: 2px solid var(--line); border-radius: 16px; padding: 16px; margin: 20px 0; background: var(--bg-soft); }
.sbq-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sbq-modes, .sbq-regions { display: flex; flex-wrap: wrap; gap: 6px; }
.sbq-regions { margin-bottom: 12px; }
.sbq-mode, .sbq-region2 { font-family: var(--font); font-size: .76rem; font-weight: 700; padding: 5px 11px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--bg-soft); color: var(--ink-soft); cursor: pointer; }
.sbq-mode.on, .sbq-region2.on { border-color: var(--s, var(--brand)); color: var(--s, var(--brand)); background: var(--bg); }
.sbq-score { font-size: .82rem; font-weight: 800; color: var(--ink); }
.sbq-card { text-align: center; }
.sbq-flag { font-size: 5rem; line-height: 1; margin: 4px 0; }
.sbq-qname { font-weight: 800; font-size: 1.1rem; }
.sbq-q { color: var(--ink-soft); margin-bottom: 14px; }
.sbq-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; max-width: 520px; margin: 0 auto; }
.sbq-opt { font-family: var(--font); font-size: .95rem; font-weight: 700; padding: 12px; border-radius: 12px; border: 2px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; transition: border-color .12s ease; }
.sbq-opt:hover:not(:disabled) { border-color: var(--s, var(--brand)); }
.sbq-opt.correct { border-color: var(--good); background: #e9f9ee; color: #137a3a; }
.sbq-opt.wrong { border-color: var(--bad); background: #fdeaea; color: #b1221f; }
.sbq-opt:disabled { cursor: default; }
.sbq-feedback { margin-top: 14px; font-weight: 700; min-height: 1.4em; }
.sbq-feedback .fact { display: block; font-weight: 400; color: var(--ink-soft); font-size: .85rem; margin-top: 3px; }
.sbq-next { margin-top: 12px; }

.rw-lead { background: #fff8e6; border: 1px solid #f6dfa0; border-radius: 10px; padding: 9px 13px; font-weight: 600; margin: 0 0 12px; }
.rw-chip.match { box-shadow: 0 0 0 2px #facc15; }

.themed-example { margin-top: 14px; }
.themed-head { font-size: .85rem; font-weight: 800; color: var(--s, var(--brand)); margin-bottom: 6px; }

.madeforyou { background: var(--bg-soft); border: 1px solid var(--line); border-left: 5px solid var(--brand); border-radius: var(--radius); padding: 20px 22px; margin-top: 22px; box-shadow: var(--shadow-sm); }
.madeforyou h3 { margin: 0 0 4px; color: var(--brand); }
.mfy-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.mfy-chip { font-size: .9rem; font-weight: 700; color: #fff; background: var(--s, var(--brand)); padding: 8px 15px; border-radius: 999px; transition: .12s; }
.mfy-chip:hover { filter: brightness(1.06); transform: translateY(-1px); }

/* ===================== "Where you'll use this" (real-world / careers) ===================== */
.realworld {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-left: 5px solid var(--s, var(--brand)); border-radius: var(--radius);
  padding: 20px 24px; margin-top: 16px; box-shadow: var(--shadow-sm);
}
.realworld h3 { color: var(--s, var(--brand)); margin-top: 0; }
.rw-intro { font-size: 1.02rem; margin: 4px 0 10px; }
.rw-uses { padding-left: 1.2em; margin: 10px 0; }
.rw-uses li { margin: 6px 0; }
.rw-careers { margin-top: 14px; }
.rw-label { display: block; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); margin-bottom: 8px; }
.rw-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.rw-chip { font-size: .85rem; font-weight: 700; background: var(--s, var(--brand)); color: #fff; padding: 5px 12px; border-radius: 999px; }

/* ===================== Buttons ===================== */
.btn { display: inline-flex; align-items: center; gap: 8px; border: none; cursor: pointer; font-weight: 700; border-radius: 999px; padding: 11px 20px; font-size: .98rem; transition: .15s; }
.btn-primary { background: var(--s, var(--brand)); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-ghost { background: #eef0fb; color: var(--ink); }
.btn-ghost:hover { background: #e3e6f7; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.icon-btn { background: none; border: none; font-size: 1.1rem; cursor: pointer; color: inherit; padding: 6px; border-radius: 8px; }
.icon-btn:hover { background: rgba(0,0,0,.06); }

/* ===================== Quiz / Test ===================== */
.quiz-intro { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); text-align: center; }
.qcard { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow-sm); margin-bottom: 16px; }
.qcard .qnum { font-size: .78rem; font-weight: 800; color: var(--s, var(--brand)); text-transform: uppercase; letter-spacing: .05em; }
.qcard .qtext { font-size: 1.12rem; font-weight: 700; margin: 6px 0 16px; }
.options { display: grid; gap: 10px; }
.opt { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 2px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; transition: .12s; font-weight: 600; background: #fff; }
.opt:hover { border-color: var(--s, var(--brand)); }
.opt.sel { border-color: var(--s, var(--brand)); background: #f5f3ff; }
.opt.correct { border-color: var(--good); background: #e9f9f0; }
.opt.wrong { border-color: var(--bad); background: #fdeef0; }
.opt .letter { width: 28px; height: 28px; border-radius: 50%; background: #eef0fb; display: grid; place-items: center; font-weight: 800; flex: none; }
.opt.correct .letter { background: var(--good); color: #fff; }
.opt.wrong .letter { background: var(--bad); color: #fff; }
.input-answer { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.input-answer input { font-size: 1.1rem; padding: 11px 14px; border: 2px solid var(--line); border-radius: var(--radius-sm); width: 200px; font-family: var(--font); }
.input-answer input:focus { outline: none; border-color: var(--s, var(--brand)); }
.feedback { margin-top: 14px; padding: 12px 16px; border-radius: var(--radius-sm); font-weight: 600; display: none; }
.feedback.show { display: block; animation: fade .2s; }
.feedback.ok { background: #e9f9f0; color: #14854a; }
.feedback.no { background: #fdeef0; color: #b81e3a; }
.feedback .ai-hint { margin-top: 8px; font-weight: 600; }
.feedback .ai-hint a { cursor: pointer; text-decoration: underline; }

.quiz-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.quiz-progress .track { flex: 1; height: 10px; background: #eef0fb; border-radius: 999px; overflow: hidden; }
.quiz-progress .track > i { display: block; height: 100%; background: var(--s, var(--brand)); border-radius: 999px; transition: width .3s; }

.results { text-align: center; background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 34px; box-shadow: var(--shadow-sm); }
.results .score-ring { width: 130px; height: 130px; margin: 0 auto 16px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(closest-side, #fff 70%, transparent 71%), conic-gradient(var(--good) calc(var(--p)*1%), #eef0fb 0); }
.results .score-ring b { font-size: 1.8rem; }
.results .verdict { font-size: 1.3rem; font-weight: 800; margin: 8px 0; }
.confetti-pass { color: var(--good); }

/* ===================== Worksheet (screen + print) ===================== */
.worksheet-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.sheet { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 30px 34px; box-shadow: var(--shadow-sm); max-width: 820px; margin: 0 auto; }
/* shared logo mark (worksheet letterhead, plan header, test results) */
.tri-logo { height: 34px; width: auto; flex: none; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: .4em; }
.page-head h1 { margin: 0; }
.page-head .tri-logo { height: 44px; width: auto; }
.sheet .sheet-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.sheet .sheet-wordmark { font-size: 1.05rem; font-weight: 500; color: var(--ink); }
.sheet .sheet-wordmark strong { font-weight: 800; }
.sheet .sheet-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid var(--s, var(--brand)); padding-bottom: 14px; margin-bottom: 20px; }
.sheet .sheet-head h2 { margin: 0; }
.sheet .name-line { font-size: .9rem; color: var(--ink-soft); }
.sheet ol.qs { padding-left: 0; list-style: none; counter-reset: wq; }
.sheet ol.qs > li { counter-increment: wq; padding: 14px 0; border-bottom: 1px dashed var(--line); display: flex; gap: 14px; }
.sheet ol.qs > li::before { content: counter(wq) "."; font-weight: 800; color: var(--s, var(--brand)); min-width: 26px; }
.sheet .answer-space { height: 46px; }
.sheet .ans-key { margin-top: 24px; border-top: 2px solid var(--line); padding-top: 14px; }
.sheet .ans-key h3 { font-size: 1rem; }
.sheet .ans-key ol { columns: 2; font-size: .9rem; color: var(--ink-soft); }
.brand-foot { text-align: center; margin-top: 22px; font-size: .8rem; color: var(--ink-soft); }

/* ===================== Plan / Progress ===================== */
.plan-phase { background: var(--bg-soft); border: 1px solid var(--line); border-left: 6px solid var(--brand); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.plan-phase h3 { color: var(--brand); }
.plan-phase .term { font-size: .8rem; font-weight: 800; color: var(--ink-soft); text-transform: uppercase; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 16px; margin: 20px 0; }
.stat { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-align: center; box-shadow: var(--shadow-sm); }
.stat b { font-size: 2rem; display: block; color: var(--brand); }
.stat span { color: var(--ink-soft); font-size: .9rem; }

/* ===================== AI chat ===================== */
.chat-launcher {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
  border: none; cursor: pointer; padding: 13px 20px; border-radius: 999px;
  font-weight: 800; font-size: 1rem; box-shadow: var(--shadow);
  transition: transform .15s;
}
.chat-launcher:hover { transform: translateY(-2px) scale(1.02); }
.chat-launcher-icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.chat-launcher-logo { height: 22px; width: auto; display: block; }

.chat-panel {
  position: fixed; right: 22px; bottom: 22px; z-index: 70;
  width: min(410px, calc(100vw - 32px)); height: min(620px, calc(100vh - 40px));
  background: #fff; border-radius: 22px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
  transform: translateY(20px) scale(.96); opacity: 0; pointer-events: none;
  transition: transform .2s, opacity .2s;
}
.chat-panel.open { transform: none; opacity: 1; pointer-events: auto; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.chat-title { display: flex; align-items: center; gap: 10px; }
.chat-avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.18); flex: none; }
.chat-avatar-logo { height: 26px; width: auto; display: block; }
.chat-title small { display: block; opacity: .9; font-size: .78rem; }
.chat-head .icon-btn { margin-left: auto; color: #fff; }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: #f7f8ff; }
.msg { max-width: 86%; padding: 11px 14px; border-radius: 16px; font-size: .95rem; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.bot strong { color: var(--brand); }
.msg.typing { color: var(--ink-soft); font-style: italic; }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 10px; background: #f7f8ff; }
.chat-suggestions button { font-size: .82rem; background: #fff; border: 1px solid var(--line); color: var(--brand); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.chat-suggestions button:hover { background: #eef0fb; }
.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); align-items: flex-end; }
.chat-input textarea { flex: 1; resize: none; border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; font-family: var(--font); font-size: .95rem; max-height: 120px; }
.chat-input textarea:focus { outline: none; border-color: var(--brand); }
.btn-send { width: 44px; height: 44px; flex: none; border-radius: 50%; border: none; background: var(--brand); color: #fff; font-size: 1.1rem; cursor: pointer; }
.btn-send:disabled { opacity: .5; cursor: default; }
.chat-foot { text-align: center; font-size: .72rem; color: var(--ink-soft); padding: 6px; background: #f7f8ff; }
.tri-accent { color: var(--triomatic-green); font-weight: 800; }

/* ===== Site footer ===== */
.footer {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 28px 20px 92px; margin-top: 32px;
  border-top: 1px solid var(--line);
  text-align: left;
}
.footer-logo {
  height: 42px; width: auto; flex: none;
}
.footer-text { display: flex; flex-direction: column; line-height: 1.35; }
.footer-powered { font-weight: 700; color: var(--ink); font-size: .95rem; }
.footer-copy { font-size: .78rem; color: var(--ink-soft); margin-top: 2px; }

/* ===================== Misc ===================== */
.empty { text-align: center; color: var(--ink-soft); padding: 40px; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg,#eef0fb 25%,#f6f7ff 50%,#eef0fb 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

@media (max-width: 640px) {
  /* Keep the nav visible on phones — it wraps to its own full-width row.
     Everything else is shrunk so the header stays compact (2 rows, not 3). */
  .topbar { flex-wrap: wrap; gap: 8px 8px; padding: 9px 12px; }
  .brand-logo { height: 34px; }
  .icon-btn { font-size: 1.05rem; padding: 5px; }
  .topstat { font-size: .74rem; gap: 4px; }
  .profile-btn { font-size: .82rem; padding: 3px 9px 3px 3px; }
  .topnav { order: 3; width: 100%; justify-content: center; margin-left: 0; gap: 6px; }
  .topnav a { padding: 8px 14px; font-size: .92rem; }
  .topbar-progress { margin-left: auto; }
  .hero { padding: 28px 22px; }
  .chat-launcher-text { display: none; }
  .chat-launcher { padding: 16px; }
}

/* ===================== Welcome / name modal ===================== */
.welcome-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(31, 36, 64, 0.55); backdrop-filter: blur(5px);
  display: flex; justify-content: center;
  padding: 20px; overflow-y: auto; animation: fade .2s ease;
}
.welcome-card {
  background: #fff; border-radius: 24px; padding: 34px 28px 24px;
  width: 100%; max-width: 380px; text-align: center; box-shadow: var(--shadow);
  animation: pop .25s ease;
  margin: auto;   /* centre when it fits, top-align + scroll when taller than the screen */
}
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
.welcome-mark {
  width: 62px; height: 62px; border-radius: 18px; margin: 0 auto 14px; padding: 6px;
  display: grid; place-items: center; color: #fff; font-size: 2rem; font-weight: 800;
  background: #f7f3e8; box-shadow: var(--shadow-sm);
}
.welcome-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.welcome-card h2 { font-size: 1.4rem; margin-bottom: 6px; }
.welcome-card p { color: var(--ink-soft); margin-bottom: 18px; }
.welcome-card form { display: flex; flex-direction: column; gap: 12px; }
.welcome-card input {
  font-size: 1.1rem; padding: 13px 16px; border: 2px solid var(--line);
  border-radius: 14px; font-family: var(--font); text-align: center;
}
.welcome-card input:focus { outline: none; border-color: var(--brand); }
.welcome-card .btn { justify-content: center; }
.welcome-hint { display: block; color: var(--ink-soft); font-size: .78rem; margin: -4px 2px 2px; text-align: left; }
.opt-in { display: flex; gap: 10px; align-items: flex-start; text-align: left; font-size: .82rem; line-height: 1.4; color: var(--ink-soft); background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; cursor: pointer; }
.opt-in input { margin: 1px 0 0; width: 18px; height: 18px; flex: none; accent-color: var(--brand); cursor: pointer; }
.opt-in strong { color: var(--ink); }
.welcome-foot { margin-top: 16px; font-size: .75rem; color: var(--ink-soft); }
.welcome-foot a, .welcome-hint a { color: var(--brand); text-decoration: underline; }

/* Compact the welcome/name modal on phones so "Let's go" fits without scrolling.
   Placed AFTER the base .welcome-* rules so it wins on source order. */
@media (max-width: 640px) {
  .welcome-card { padding: 16px 16px 14px; border-radius: 20px; }
  .welcome-mark { width: 44px; height: 44px; margin-bottom: 6px; padding: 4px; border-radius: 14px; }
  .welcome-card h2 { font-size: 1.1rem; margin-bottom: 3px; }
  .welcome-card p { margin-bottom: 8px; font-size: .86rem; }
  .welcome-card form { gap: 8px; }
  .welcome-card input { padding: 10px 13px; font-size: .98rem; }
  .welcome-hint { font-size: .7rem; margin: -3px 2px 0; }
  .interest-title { font-size: .78rem; margin: 0 2px 5px; }
  .interest-tile { padding: 6px 2px; font-size: .62rem; }
  .interest-tile .it-emoji { font-size: 1.05rem; }
  .opt-in { padding: 8px 10px; font-size: .72rem; line-height: 1.3; }
  .welcome-foot { margin-top: 7px; font-size: .7rem; }
}

/* ===== Parental gate (press & hold) ===== */
.gate-badge { font-size: .68rem; font-weight: 800; color: var(--ink-soft); background: #eef0fb; padding: 2px 8px; border-radius: 999px; vertical-align: middle; margin-left: 6px; }
.gate-hold { position: relative; overflow: hidden; justify-content: center; width: 100%; user-select: none; -webkit-user-select: none; touch-action: none; }
.gate-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; background: rgba(255,255,255,.30); pointer-events: none; }
.gate-label { position: relative; z-index: 1; pointer-events: none; }
.hero-eyebrow { font-weight: 800; font-size: 1rem; opacity: .96; margin-bottom: 6px; }

/* ===================== Gamification: splash, confetti, rewards, badges ===================== */
.splash {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center; align-content: center; gap: 6px;
  background: #f7f4ec; color: #183a41; text-align: center;
  transition: opacity .45s ease;
}
.splash.hide { opacity: 0; pointer-events: none; }
.splash-logo { width: min(300px, 68vw); height: auto; animation: spRise .6s ease both; }
.splash-tag { color: #5d7379; font-size: .95rem; margin-top: 6px; animation: spRise .6s ease .16s both; }
.splash-brand { position: fixed; bottom: 34px; left: 0; right: 0; font-size: .85rem; color: #6f8085; animation: spRise .6s ease .24s both; }
.splash-brand .tri-accent { color: inherit; }
@keyframes spRise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.fx-confetti { position: fixed; inset: 0; z-index: 240; pointer-events: none; display: none; }

.reward-overlay {
  position: fixed; inset: 0; z-index: 250; display: flex; justify-content: center;
  padding: 20px; overflow-y: auto;
  background: rgba(15,17,20,.55); backdrop-filter: blur(5px); animation: fade .2s ease;
}
.reward-card {
  margin: auto;
  position: relative; overflow: hidden; background: var(--bg-soft);
  border-radius: 24px; padding: 30px 26px 22px; width: 100%; max-width: 340px;
  text-align: center; box-shadow: var(--shadow);
  animation: rewardpop .45s cubic-bezier(.2,1.3,.4,1) both;
}
.reward-burst {
  position: absolute; top: -50px; left: 50%; width: 280px; height: 280px; transform: translateX(-50%);
  background: conic-gradient(from 0deg, transparent 0 7%, rgba(141,198,63,.16) 7% 11%, transparent 11% 20%);
  border-radius: 50%; z-index: 0; animation: rburst 9s linear infinite;
}
.reward-medal, .reward-title, .reward-sub, .reward-badges, .reward-card .btn { position: relative; z-index: 1; }
.reward-medal {
  width: 92px; height: 92px; margin: 4px auto 12px; border-radius: 50%; display: grid; place-items: center; font-size: 3rem;
  background: radial-gradient(circle at 40% 35%, #fff6c9, #facc15 60%, #eab308);
  box-shadow: 0 8px 24px rgba(234,179,8,.4); animation: rbob 2s ease-in-out infinite;
}
.reward-title { font-size: 1.5rem; font-weight: 800; }
.reward-sub { color: var(--ink-soft); margin-top: 6px; }
.reward-badges { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 14px 0 4px; }
.reward-card .btn { justify-content: center; width: 100%; margin-top: 16px; }
@keyframes rewardpop { from { transform: scale(.7); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes rburst { to { transform: translateX(-50%) rotate(360deg); } }
@keyframes rbob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .reward-medal, .reward-burst { animation: none; } }

.badge-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.badge-pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700; color: var(--ink);
  background: var(--bg-soft); border: 1px solid var(--line); border-left: 3px solid #facc15;
  border-radius: 999px; padding: 5px 12px;
}
.badge-pill.locked { opacity: .55; filter: grayscale(.7); border-left-color: var(--line); }

.pill-stat { background: rgba(255,255,255,.30) !important; font-weight: 800; }

.topstat { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: .78rem; }
.topstat span { display: inline-flex; align-items: center; gap: 3px; background: #eef0fb; color: var(--ink); padding: 5px 9px; border-radius: 999px; white-space: nowrap; }

/* ===================== Theme picker ===================== */
.theme-btn { font-size: 1.2rem; line-height: 1; }
.theme-pop {
  position: fixed; z-index: 120; min-width: 234px; max-width: calc(100vw - 16px);
  background: var(--bg-soft); color: var(--ink);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); padding: 8px;
  animation: pop .15s ease;
}
.theme-pop[hidden] { display: none; }
.theme-pop-title { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); padding: 6px 8px 8px; }
.theme-opt {
  display: flex; align-items: center; gap: 11px; width: 100%;
  background: none; border: none; cursor: pointer; text-align: left;
  padding: 9px 8px; border-radius: 11px; color: var(--ink);
  font-family: var(--font); font-size: .95rem; font-weight: 700;
}
.theme-opt:hover { background: rgba(128,128,128,.13); }
.theme-opt.is-active { background: rgba(128,128,128,.10); }
.theme-opt-label em { font-style: normal; font-weight: 500; color: var(--ink-soft); font-size: .78rem; }
.theme-sw {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: grid; place-items: center; font-size: .9rem; color: #fff;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.10);
}
.sw-sasta     { background: linear-gradient(135deg, #2e8595, #ec9a34); }
.sw-classic   { background: linear-gradient(135deg, #6c4cff, #00c2a8); }
.sw-warm      { background: linear-gradient(135deg, #ff6b6b, #f59e0b); }
.sw-cool      { background: linear-gradient(135deg, #2f80ed, #00b8d4); }
.sw-triomatic { background: #0e0e0e; color: var(--triomatic-green); }
.theme-check { margin-left: auto; color: var(--brand); opacity: 0; font-weight: 800; }
.theme-opt.is-active .theme-check { opacity: 1; }

/* ===================== "Neuro-links" animated backdrop ===================== */
#neuroCanvas {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none; display: none;
}

/* ===================== Triomatic dark theme ===================== */
:root[data-theme="triomatic"] {
  --bg: #08090a;
  --bg-soft: #15181d;
  --ink: #eaf3df;
  --ink-soft: #9fb08c;
  --line: #2a2f26;
  --brand: #8dc63f;
  --brand-2: #b6ff3a;
  --shadow: 0 10px 30px rgba(0,0,0,.55);
  --shadow-sm: 0 3px 14px rgba(0,0,0,.45);
}
:root[data-theme="triomatic"] { color-scheme: only dark; }
:root[data-theme="triomatic"] body { background: #08090a; }
/* float content above the animated network */
:root[data-theme="triomatic"] .view,
:root[data-theme="triomatic"] .footer { position: relative; z-index: 1; }
:root[data-theme="triomatic"] .topbar { background: rgba(10,12,10,.82); }
:root[data-theme="triomatic"] .topnav a { background: #1b1f17; color: var(--ink); }
:root[data-theme="triomatic"] .topstat span { background: #1b1f17; color: var(--ink); }
:root[data-theme="triomatic"] .topnav a:hover { background: #232818; }
:root[data-theme="triomatic"] .topnav a.active { background: var(--brand); color: #0a0a0a; }
:root[data-theme="triomatic"] .icon-btn:hover { background: rgba(255,255,255,.08); }
:root[data-theme="triomatic"] .ring {
  background:
    radial-gradient(closest-side, #15181d 72%, transparent 73%),
    conic-gradient(var(--brand) calc(var(--p) * 1%), #2a2f26 0);
}
:root[data-theme="triomatic"] .hero {
  background: linear-gradient(135deg, #10140b 0%, #1d2611 100%);
  border: 1px solid var(--brand);
}
:root[data-theme="triomatic"] .card .bar,
:root[data-theme="triomatic"] .quiz-progress .track,
:root[data-theme="triomatic"] .opt .letter { background: #20251a; }
:root[data-theme="triomatic"] .notes .key { background: #1b2113; }
:root[data-theme="triomatic"] .notes .why { background: #122031; border-left-color: #3a8bdd; }
:root[data-theme="triomatic"] .notes .warn { background: #2a1417; }
:root[data-theme="triomatic"] .notes .tip { background: #122418; }
:root[data-theme="triomatic"] .notes .eg,
:root[data-theme="triomatic"] .example,
:root[data-theme="triomatic"] .opt { background: #11140d; }
:root[data-theme="triomatic"] .notes table th { background: #1b2113; }
:root[data-theme="triomatic"] .opt.sel { background: #1f2a12; }
:root[data-theme="triomatic"] .opt.correct { background: #11301f; }
:root[data-theme="triomatic"] .opt.wrong { background: #2c1419; }
:root[data-theme="triomatic"] .btn-ghost { background: #1b1f17; color: var(--ink); }
:root[data-theme="triomatic"] .btn-ghost:hover { background: #232818; }
:root[data-theme="triomatic"] .btn-primary { color: #0a0a0a; }
:root[data-theme="triomatic"] .input-answer input { background: #0c0e08; color: var(--ink); }
:root[data-theme="triomatic"] .lvl-foundation { background: #12301f; color: #5fcf8e; }
:root[data-theme="triomatic"] .lvl-higher { background: #241a3a; color: #b9a4ff; }
:root[data-theme="triomatic"] .lvl-both { background: #2e2410; color: #e0b25a; }
:root[data-theme="triomatic"] .feedback.ok { background: #11301f; color: #76e3a4; }
:root[data-theme="triomatic"] .feedback.no { background: #2c1419; color: #f29db0; }
/* chat panel */
:root[data-theme="triomatic"] .chat-panel { background: #12140e; }
:root[data-theme="triomatic"] .chat-log,
:root[data-theme="triomatic"] .chat-suggestions,
:root[data-theme="triomatic"] .chat-foot { background: #0c0e08; }
:root[data-theme="triomatic"] .msg.bot { background: #181c12; border-color: var(--line); color: var(--ink); }
:root[data-theme="triomatic"] .msg.bot strong { color: var(--brand); }
:root[data-theme="triomatic"] .msg.user { background: var(--brand); color: #0a0a0a; }
:root[data-theme="triomatic"] .chat-suggestions button { background: #181c12; color: var(--brand); border-color: var(--line); }
:root[data-theme="triomatic"] .chat-suggestions button:hover { background: #20251a; }
:root[data-theme="triomatic"] .chat-input textarea { background: #0c0e08; color: var(--ink); }

/* ===================== PRINT (worksheets) ===================== */
@media print {
  .topbar, .footer, .chat-launcher, .chat-panel, .tabs, .worksheet-actions,
  .crumbs, .chapter-head .chip, .video-toggle, #neuroCanvas, .theme-pop, .search-overlay,
  .pack-bar, .pack-list { display: none !important; }
  body { background: #fff; }
  .view { padding: 0; max-width: none; }
  .sheet { box-shadow: none; border: none; max-width: none; padding: 0; }
  .sheet .answer-space { height: 60px; }
  .pack-sheet { break-before: page; page-break-before: always; }
  .pack-print .qs > li { break-inside: avoid; page-break-inside: avoid; }
  .no-print { display: none !important; }
  .print-only { display: block !important; }
  @page { margin: 18mm; }
}
.print-only { display: none; }

/* ===================== Worksheet pack ===================== */
.pack-btn { position: relative; }
.pack-count { position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--brand); color: #fff; font-size: .62rem; font-weight: 800; display: grid; place-items: center; }
.pack-btn.has-items { filter: drop-shadow(0 0 0 transparent); }
.sr-pack.in { background: var(--good) !important; color: #fff !important; border-color: transparent !important; }
.pack-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.pack-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.pack-list { display: grid; gap: 8px; margin-bottom: 22px; }
.pack-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.pack-remove { border: none; background: none; color: var(--bad); font-weight: 700; cursor: pointer; font-size: .85rem; }
.pack-remove:hover { text-decoration: underline; }
.pack-print .sheet { margin-bottom: 26px; }
.pack-cover { text-align: center; }
.pack-cover .pack-title { font-size: 2.3rem; margin: 14px 0 2px; }
.pack-cover .pack-sub { margin-bottom: 8px; }
.pack-toc { text-align: left; max-width: 560px; margin: 22px auto; line-height: 1.9; padding-left: 1.2em; }
.pack-print.hide-keys .pack-key { display: none; }
.empty-pack { text-align: center; padding: 56px 20px; }
.empty-pack-ico { font-size: 3rem; margin-bottom: 6px; }
.empty-pack h2 { margin-bottom: 8px; }
.empty-pack p { max-width: 460px; margin: 0 auto 18px; }

/* ===================== Search (topics & printable worksheets) ===================== */
.search-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(12,14,28,.55); backdrop-filter: blur(3px); display: flex; justify-content: center; align-items: flex-start; padding: 7vh 16px 16px; }
.search-panel { width: min(700px, 100%); max-height: 86vh; background: var(--bg-soft); border-radius: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); }
.search-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.search-ico { font-size: 1.1rem; opacity: .8; }
.search-input { flex: 1; border: none; outline: none; font-size: 1.05rem; background: transparent; color: var(--ink); padding: 6px 2px; }
.search-input::placeholder { color: var(--ink-soft); }
.search-filters { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.sf-chip { border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px; padding: 6px 12px; font-size: .82rem; font-weight: 700; cursor: pointer; display: inline-flex; gap: 5px; align-items: center; }
.sf-chip.active { background: var(--s, var(--brand)); color: #fff; border-color: transparent; }
.search-results { overflow-y: auto; padding: 6px 10px 14px; }
.search-hint { color: var(--ink-soft); font-size: .92rem; line-height: 1.5; padding: 18px 10px; }
.search-count { color: var(--ink-soft); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 10px 6px 4px; }
.search-result { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: 12px; border-left: 4px solid var(--s, var(--brand)); background: var(--bg); margin: 8px 4px; flex-wrap: wrap; }
.sr-main { flex: 1 1 240px; min-width: 0; }
.sr-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: .72rem; color: var(--ink-soft); margin-bottom: 3px; }
.sr-strand { color: var(--s, var(--brand)); font-weight: 800; }
.sr-title { font-weight: 800; font-size: 1.02rem; color: var(--ink); }
.sr-sum { font-size: .85rem; color: var(--ink-soft); margin-top: 2px; }
.sr-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.sr-btn { border: 1px solid var(--line); background: var(--bg-soft); color: var(--ink); border-radius: 9px; padding: 8px 11px; font-size: .82rem; font-weight: 700; cursor: pointer; white-space: nowrap; transition: transform .1s; }
.sr-btn:hover { transform: translateY(-1px); }
.sr-btn.sr-primary { background: var(--s, var(--brand)); color: #fff; border-color: transparent; }
@media (max-width: 560px) {
  .search-overlay { padding: 3vh 8px 8px; }
  .search-result { gap: 8px; }
  .sr-actions { width: 100%; }
  .sr-btn { flex: 1 1 auto; text-align: center; }
}
.sr-year { color: var(--s, var(--brand)); font-weight: 800; }
.search-years { padding-top: 6px; }

/* ===================== Child profiles + parent dashboard ===================== */
.profile-btn { display: inline-flex; align-items: center; gap: 7px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer; font-family: var(--font); font-weight: 800; color: var(--ink); font-size: .9rem; }
.profile-btn:hover { box-shadow: var(--shadow-sm); }
.pf-avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--s, var(--brand)); color: #fff; font-weight: 800; font-size: .9rem; flex: none; }
.pf-avatar.big { width: 46px; height: 46px; font-size: 1.3rem; }
.pf-name { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* switcher menu */
.profile-menu-overlay { position: fixed; inset: 0; z-index: 95; background: rgba(12,14,28,.4); display: flex; justify-content: center; align-items: flex-start; padding: 9vh 16px; }
.profile-menu { width: min(340px, 100%); background: var(--bg-soft); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.pm-head { padding: 14px 16px 6px; font-weight: 800; font-size: 1.05rem; color: var(--ink); }
.pm-list { padding: 4px 8px; display: grid; gap: 4px; }
.pm-item { display: flex; align-items: center; gap: 10px; width: 100%; border: none; background: none; cursor: pointer; padding: 9px 10px; border-radius: 10px; font-family: var(--font); font-weight: 700; color: var(--ink); font-size: .95rem; text-align: left; }
.pm-item:hover { background: var(--bg); }
.pm-item.active { background: var(--bg); }
.pm-name { flex: 1; }
.pm-tick { color: var(--good); font-weight: 800; }
.pm-actions { border-top: 1px solid var(--line); padding: 8px; display: grid; gap: 4px; }
.pm-btn { border: none; background: none; cursor: pointer; padding: 10px; border-radius: 10px; font-family: var(--font); font-weight: 700; color: var(--brand); font-size: .92rem; text-align: left; }
.pm-btn:hover { background: var(--bg); }
/* dashboard */
.parents-head h1 { font-size: 1.8rem; margin-bottom: 4px; }
.parents-head { margin-bottom: 18px; }
.parent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.parent-card { background: var(--bg-soft); border: 1px solid var(--line); border-top: 5px solid var(--s, var(--brand)); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.pc-head { display: flex; align-items: center; gap: 12px; }
.pc-name { font-weight: 800; font-size: 1.15rem; }
.pc-active { font-size: .65rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; background: var(--good); color: #fff; padding: 2px 7px; border-radius: 999px; vertical-align: middle; }
.pc-overall { margin-left: auto; font-size: 1.6rem; font-weight: 900; color: var(--s, var(--brand)); }
.pc-stats { font-size: .84rem; color: var(--ink-soft); margin: 12px 0; }
.pc-subjects { display: grid; gap: 8px; }
.pc-sub { display: grid; grid-template-columns: 1fr 2fr auto; align-items: center; gap: 8px; font-size: .82rem; }
.pc-sub-name { color: var(--ink); font-weight: 700; }
.pc-bar { height: 8px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.pc-bar > i { display: block; height: 100%; border-radius: 999px; background: var(--s, var(--brand)); }
.pc-pct { color: var(--ink-soft); font-weight: 700; text-align: right; }
.pc-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.pc-del { color: var(--bad); }
.parent-add-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 180px; border: 2px dashed var(--line); border-radius: var(--radius); background: none; cursor: pointer; color: var(--ink-soft); font-family: var(--font); font-weight: 800; font-size: 1rem; }
.parent-add-card:hover { border-color: var(--brand); color: var(--brand); }
.pac-plus { font-size: 2.2rem; line-height: 1; }
@media (max-width: 480px) { .pf-name { display: none; } .profile-btn { padding: 4px; } }

/* ===================== Parent progress report ===================== */
.report-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.report-sheet .rp-overall { text-align: right; }
.report-sheet .rp-big { font-size: 2rem; font-weight: 900; color: var(--s, var(--brand)); }
.report-sheet .rp-stats { font-size: .9rem; color: var(--ink-soft); margin: 6px 0 18px; }
.report-sheet .rp-h { font-size: 1.05rem; margin: 22px 0 8px; color: var(--ink); }
.report-sheet .rp-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.report-sheet .rp-table th { text-align: left; color: var(--ink-soft); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; padding: 4px 8px; }
.report-sheet .rp-table td { padding: 7px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
.report-sheet .rp-table td:last-child { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.report-sheet .rp-bar { flex: 1; min-width: 90px; height: 8px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.report-sheet .rp-bar > i { display: block; height: 100%; border-radius: 999px; background: var(--s, var(--brand)); }
.report-sheet .rp-list { margin: 6px 0; padding-left: 1.2em; }
.report-sheet .rp-list li { margin: 5px 0; }
.report-sheet .rp-sub { color: var(--ink-soft); font-size: .82rem; }
.report-sheet .rp-ready { font-size: .88rem; color: var(--ink-soft); margin-top: 6px; }

/* ===================== Certificates ===================== */
.cert-list { display: grid; gap: 10px; margin-top: 6px; }
.cert-chip { display: flex; align-items: center; gap: 12px; background: var(--bg); border: 1px solid var(--line); border-left: 4px solid var(--s, var(--brand)); border-radius: 12px; padding: 12px 14px; color: var(--ink); }
.cert-chip:hover { box-shadow: var(--shadow-sm); transform: translateX(2px); }
.cert-chip-ico { font-size: 1.6rem; }
.cert-chip-txt { line-height: 1.35; }
.cert-chip-print { margin-left: auto; font-weight: 800; color: var(--s, var(--brand)); font-size: .85rem; white-space: nowrap; }
.certificate { background: #fff; border: 3px solid var(--s, var(--brand)); border-radius: 16px; padding: 10px; max-width: 880px; margin: 0 auto; box-shadow: var(--shadow-sm); }
.cert-inner { border: 2px solid var(--s, var(--brand)); border-radius: 12px; padding: 44px 48px; text-align: center; color: #1f2440; }
.cert-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 20px; }
.cert-brand .sheet-wordmark { color: #1f2440; }
.cert-kicker { font-size: 1.7rem; font-weight: 900; letter-spacing: .03em; color: var(--s, var(--brand)); text-transform: uppercase; }
.cert-presented { margin-top: 24px; color: #5b6280; }
.cert-name { font-size: 2.7rem; font-weight: 900; margin: 6px 0 4px; font-family: Georgia, "Times New Roman", serif; }
.cert-for { max-width: 560px; margin: 0 auto; font-size: 1.08rem; }
.cert-seal { margin: 24px auto 8px; width: 66px; height: 66px; border-radius: 50%; background: var(--s, var(--brand)); color: #fff; display: grid; place-items: center; font-size: 2rem; box-shadow: 0 4px 14px rgba(0,0,0,.15); }
.cert-foot { display: flex; justify-content: space-between; gap: 24px; margin-top: 30px; }
.cert-foot > div { border-top: 1.5px solid #5b6280; padding-top: 6px; min-width: 190px; font-size: 1rem; font-weight: 700; }
.cert-sig { font-weight: 800; }
.cert-cap { font-size: .72rem; font-weight: 600; color: #5b6280; text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }
@media print { .certificate { border-width: 3px; box-shadow: none; max-width: none; } }

/* ===================== Plans / pricing ===================== */
.plans-head { margin-bottom: 20px; }
.plans-head h1 { font-size: 1.9rem; margin-bottom: 4px; }
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; max-width: 760px; }
.plan-card { position: relative; background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; }
.plan-card.featured { border: 2px solid var(--brand); box-shadow: var(--shadow); }
.plan-card.current { outline: 2px solid var(--good); outline-offset: -2px; }
.plan-flag { position: absolute; top: -12px; left: 24px; background: var(--brand); color: #fff; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; padding: 4px 10px; border-radius: 999px; }
.plan-name { font-size: 1.3rem; font-weight: 800; }
.plan-price { font-size: 1.1rem; margin: 6px 0 2px; }
.plan-price b { font-size: 2rem; font-weight: 900; }
.plan-annual { font-size: .82rem; margin-bottom: 6px; }
.plan-tag { font-size: .9rem; margin-bottom: 14px; }
.plan-feats { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; }
.plan-feats li { font-size: .9rem; }
.plan-feats li.yes { color: var(--ink); }
.plan-feats li.no { color: var(--ink-soft); text-decoration: none; opacity: .7; }
.plan-cta { margin-top: auto; width: 100%; justify-content: center; }
.plan-cta:disabled { opacity: .6; cursor: default; }
.plans-foot { margin-top: 22px; font-size: .85rem; }

/* ===================== Golden Age of Islam ===================== */
:root { --ga-green: #1f7a5a; }
/* In-lesson callout */
.goldenage {
  margin-top: 18px; padding: 18px 20px; border-radius: var(--radius);
  background: linear-gradient(135deg, #f4faf6 0%, #fbf7ec 100%);
  border: 1px solid #dce9e0; border-left: 6px solid var(--ga-green);
  box-shadow: var(--shadow-sm);
}
.ga-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ga-head h3 { margin: 0; font-size: 1.05rem; color: var(--ga-green); }
.ga-mark { font-size: 1.2rem; }
.ga-scholar { margin: 2px 0 8px; font-size: 1rem; }
.ga-scholar .ga-meta { display: block; font-size: .82rem; color: var(--ink-soft); font-weight: 600; margin-top: 2px; }
.ga-what { margin: 0 0 8px; line-height: 1.55; }
.ga-legacy { margin: 0 0 10px; font-size: .9rem; color: var(--ink); background: #fff7e6; border-radius: 10px; padding: 8px 12px; }
.ga-more { font-weight: 800; font-size: .88rem; color: var(--ga-green); }
/* Home discovery card */
.ga-home-card {
  display: flex; align-items: center; gap: 14px; margin-top: 22px; padding: 16px 18px;
  border-radius: var(--radius); color: var(--ink); text-decoration: none;
  background: linear-gradient(135deg, #1f7a5a 0%, #2e8595 100%); box-shadow: var(--shadow-sm);
}
.ga-home-card .ga-home-mark { font-size: 1.8rem; flex: 0 0 auto; }
.ga-home-text { flex: 1; display: flex; flex-direction: column; color: #fff; }
.ga-home-text strong { font-size: 1.05rem; }
.ga-home-text span { font-size: .86rem; opacity: .92; }
.ga-home-arrow { color: #fff; font-size: 1.4rem; font-weight: 800; flex: 0 0 auto; }
/* Hub page */
.ga-subject { margin: 26px 0 6px; }
.ga-subject-h { font-size: 1.25rem; margin: 0 0 12px; padding-bottom: 8px; border-bottom: 2px solid var(--s, var(--ga-green)); color: var(--s, var(--ga-green)); }
.ga-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.ga-card {
  background: var(--bg-soft); border: 1px solid var(--line); border-top: 4px solid var(--s, var(--ga-green));
  border-radius: var(--radius-sm); padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.ga-field { font-size: .72rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; color: var(--s, var(--ga-green)); margin-bottom: 4px; }
.ga-card-name { margin: 0; font-size: 1.1rem; }
.ga-card-meta { font-size: .82rem; color: var(--ink-soft); font-weight: 600; margin: 2px 0 10px; }
.ga-card-what { margin: 0 0 10px; line-height: 1.55; font-size: .92rem; }
.ga-card-legacy { margin: 0 0 12px; font-size: .85rem; background: #fff7e6; border-radius: 10px; padding: 8px 11px; }
.ga-card-link { font-weight: 800; font-size: .85rem; color: var(--s, var(--ga-green)); }
.ga-hadith { text-align: center; font-style: italic; color: var(--ink-soft); margin: 30px auto 10px; max-width: 620px; line-height: 1.6; }
.ga-hadith span { font-style: normal; font-weight: 700; font-size: .85rem; }

/* ---- Lesson enrichment accordions (Learn tab: collapsed by default) ---- */
.lesson-acc > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; margin: 0;
}
.lesson-acc > summary::-webkit-details-marker { display: none; }
.lesson-acc > summary h3,
.lesson-acc > summary .themed-head { margin: 0; }
.lesson-acc > summary::after {
  content: "▾"; margin-left: auto; color: var(--ink-soft); font-size: .8rem;
  flex: 0 0 auto; transition: transform .2s;
}
.lesson-acc[open] > summary::after { transform: rotate(180deg); }
.lesson-acc:not([open]):hover { border-color: var(--s, var(--brand)); }
.lesson-acc .lesson-acc-body { margin-top: 12px; }
/* Robustly collapse the body when closed (some engines don't hide details content reliably) */
.lesson-acc:not([open]) > .lesson-acc-body { display: none; }

/* ===================== Mock exams ===================== */
.exam-home-card {
  display: flex; align-items: center; gap: 14px; margin-top: 14px; padding: 16px 18px;
  border-radius: var(--radius); color: #fff; text-decoration: none;
  background: linear-gradient(135deg, #6c4cff 0%, #8b5cf6 100%); box-shadow: var(--shadow-sm);
}
.exam-home-card .ga-home-mark { font-size: 1.8rem; flex: 0 0 auto; }
.exam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 8px; }
.exam-card {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
  background: var(--bg-soft); border: 1px solid var(--line); border-top: 4px solid var(--s, var(--brand));
  border-radius: var(--radius); padding: 20px 16px; cursor: pointer; font-family: var(--font); transition: .15s;
  box-shadow: var(--shadow-sm);
}
.exam-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.exam-emoji { font-size: 2rem; }
.exam-name { font-weight: 800; font-size: 1.05rem; color: var(--ink); }
.exam-meta { font-size: .82rem; color: var(--ink-soft); }
.exam-best { font-size: .8rem; font-weight: 700; color: var(--s, var(--brand)); margin-top: 4px; }
.exam-grade {
  display: inline-block; margin: 14px auto 2px; font-weight: 800; font-size: 1.15rem;
  padding: 8px 22px; border-radius: 999px; color: #fff;
}
.eg9, .eg8 { background: #15803d; } .eg7, .eg6 { background: #0891b2; }
.eg5, .eg4 { background: #ca8a04; } .eg3 { background: #ea580c; } .eg0 { background: #64748b; }
.exam-h { text-align: center; font-size: 1.05rem; margin: 22px 0 12px; }
.exam-strands { display: flex; flex-direction: column; gap: 10px; max-width: 560px; margin: 0 auto; }
.exam-strand-top { display: flex; justify-content: space-between; font-size: .9rem; margin-bottom: 4px; }
.exam-strand .bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.exam-strand .bar > i { display: block; height: 100%; border-radius: 999px; }
.exam-review { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 620px; margin: 0 auto; }
.exam-review-chip {
  font-size: .82rem; font-weight: 700; padding: 6px 13px; border-radius: 999px;
  background: #fff; border: 1.5px solid var(--brand, #6c4cff); color: var(--brand, #6c4cff); text-decoration: none;
}
/* exam countdown timer in the quiz progress bar */
.quiz-progress #qscore.time-low { color: #dc2626; font-weight: 800; }

/* ===================== Paywall (native app only) ===================== */
body.pw-locked { overflow: hidden; }
.pw-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; overflow-y: auto;
  background: linear-gradient(160deg, #2e8595 0%, #1f6472 55%, #163f4c 100%);
}
.pw-card {
  width: 100%; max-width: 460px; background: #fff; color: var(--ink);
  border-radius: 22px; padding: 26px 24px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.35);
  text-align: center; margin: auto;
}
.pw-badge {
  display: inline-block; font-size: .78rem; font-weight: 800; letter-spacing: .02em;
  padding: 6px 14px; border-radius: 999px; background: #fff2d9; color: #a9701a; margin-bottom: 12px;
}
.pw-title { font-size: 1.5rem; line-height: 1.15; margin: 0 0 6px; }
.pw-sub { color: var(--ink-soft); margin: 0 0 16px; font-size: .95rem; }
.pw-list { list-style: none; padding: 0; margin: 0 0 20px; text-align: left; }
.pw-list li { font-size: .92rem; line-height: 1.4; margin: 9px 0; color: var(--ink); }
.pw-cta {
  width: 100%; border: none; cursor: pointer; font-family: var(--font);
  font-weight: 800; font-size: 1.05rem; color: #fff; padding: 15px 20px; border-radius: 14px;
  background: linear-gradient(135deg, #ef8f2a, #e2731a); box-shadow: 0 8px 20px rgba(226,115,26,.35);
}
.pw-cta:disabled { opacity: .7; cursor: default; }
.pw-terms-line { font-size: .84rem; font-weight: 700; color: var(--ink); margin: 12px 0 4px; }
.pw-restore {
  background: none; border: none; cursor: pointer; font-family: var(--font);
  color: var(--brand, #2e8595); font-weight: 700; font-size: .9rem; padding: 8px; margin-bottom: 8px;
}
.pw-legal { font-size: .72rem; line-height: 1.5; color: var(--ink-soft); margin: 6px 0 0; }
.pw-legal a { color: var(--ink-soft); text-decoration: underline; }
@media (max-width: 420px) {
  .pw-card { padding: 22px 18px 18px; border-radius: 18px; }
  .pw-title { font-size: 1.32rem; }
}
