/* ==========================================================================
   Amna's Learning Path — styles
   Clean, white, bold and playful: one idea per screen, big friendly buttons.
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  --bg: #ffffff; --surface: #ffffff; --soft: #f5f6f8; --soft-2: #eceef2;
  --line: #e4e6eb; --line-2: #d3d7df;
  --ink: #141414; --ink-2: #474d58; --ink-3: #6b7280;
  --btn: #141414; --btn-ink: #ffffff;
  --ok: #18a058; --ok-soft: #e4f6ec; --ok-deep: #0d7a41;
  --warm: #e08a00; --warm-soft: #fff3dc; --warm-deep: #9a5c00;
  --gold: #f5b301;
  --maths: #3b6cf6; --science: #12a37b; --english: #ec5a72; --spanish: #f39c12;
  --maths-soft: #e3eaff; --science-soft: #dcf5ec; --science-deep: #0b7a5b; --spanish-deep: #b36b00;
  --shadow: 0 1px 0 rgba(20, 20, 20, .04), 0 10px 30px -18px rgba(20, 20, 20, .35);
  --r: 20px; --r-sm: 14px; --r-lg: 28px;
  --tap: 48px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --fs: 17px;
  --lh: 1.6;
  --track: 0;
  --safe-b: env(safe-area-inset-bottom, 0px);

  /* Diagram colours (shared by the animated maths and science figures) */
  --paper: var(--surface); --wash: var(--soft); --wash-2: var(--soft-2);
  --num: #0aa46f; --num-deep: #077c53; --num-soft: #dff6ec;
  --alg: #3563e9; --alg-deep: #2547bd; --alg-soft: #e4ebff;
  --rat: #e07c05; --rat-deep: #b25f02; --rat-soft: #fff0d9;
  --geo: #7c4dea; --geo-deep: #5d31c0; --geo-soft: #eee6ff;
  --stat: #0e9bb5; --stat-deep: #087a90; --stat-soft: #ddf5fa;
  --stop: #da3535; --go: #12a150;
}
html[data-theme="cream"] { --bg: #fbf3e1; --surface: #fffaf0; --soft: #f4e9d1; --soft-2: #ecdfc1; --line: #e6d7b6; --line-2: #d8c59c; }
html[data-theme="turquoise"] { --bg: #e8f7f5; --surface: #f6fcfb; --soft: #d7efec; --soft-2: #c6e6e2; --line: #c2e4df; --line-2: #a6d5cf; --ink: #0f2a2a; --ink-2: #2f5150; --ink-3: #557a79; }
html[data-theme="lilac"] { --bg: #f4f0fc; --surface: #fbf9fe; --soft: #ebe4f8; --soft-2: #dfd5f3; --line: #ddd2f1; --line-2: #c9bae8; }
html[data-theme="dark"] {
  --bg: #0f1114; --surface: #171a1f; --soft: #20242b; --soft-2: #2a2f38; --line: #313741; --line-2: #414955;
  --ink: #f4f5f7; --ink-2: #c9ced6; --ink-3: #9aa2ae;
  --btn: #f4f5f7; --btn-ink: #111111;
  --ok: #3ccf82; --ok-soft: #12321f; --ok-deep: #8ff0bb;
  --warm: #ffb02e; --warm-soft: #3a2b0c; --warm-deep: #ffd37a;
  --maths: #6f93ff; --science: #36c99c; --english: #ff7f93; --spanish: #ffb84a;
  --maths-soft: #1b2650; --science-soft: #12352a; --science-deep: #7ee2c0; --spanish-deep: #ffc56b;
  --shadow: 0 0 0 1px #2a2f38;
  --num: #4ade80; --num-deep: #86efac; --num-soft: #123524;
  --alg: #60a5fa; --alg-deep: #93c5fd; --alg-soft: #0c2e45;
  --rat: #fbbf24; --rat-deep: #fcd34d; --rat-soft: #3d2b06;
  --geo: #c084fc; --geo-deep: #d8b4fe; --geo-soft: #2e1a45;
  --stat: #22d3ee; --stat-deep: #67e8f9; --stat-soft: #0c3440;
  color-scheme: dark;
}
html[data-size="s"] { --fs: 15px; }
html[data-size="m"] { --fs: 17px; }
html[data-size="l"] { --fs: 19.5px; }
html[data-size="xl"] { --fs: 22px; }
html[data-spacing="on"] { --lh: 1.9; --track: .04em; }
html[data-font="lexend"] { --font: 'Lexend', system-ui, sans-serif; }
html[data-font="atkinson"] { --font: 'Atkinson Hyperlegible', system-ui, sans-serif; }
html[data-motion="off"] *, html[data-motion="off"] *::before, html[data-motion="off"] *::after {
  animation: none !important; transition: none !important; scroll-behavior: auto !important;
}

/* 2. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: var(--fs); -webkit-text-size-adjust: 100%; background: var(--bg); }
html, body, body * { touch-action: manipulation; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg);
  line-height: var(--lh); letter-spacing: var(--track);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(72px + var(--safe-b));
}
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.2; letter-spacing: -.02em; font-weight: 800; }
h1 { font-size: clamp(1.9rem, 1.3rem + 2.4vw, 3rem); }
h2 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.8rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1rem; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; letter-spacing: inherit; }
input { font-size: max(16px, 1rem); }
img, svg { max-width: 100%; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px; }
.skip { position: absolute; left: -999px; top: 0; z-index: 200; background: var(--btn); color: var(--btn-ink); padding: .8rem 1rem; border-radius: 0 0 12px 0; }
.skip:focus { left: 0; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--maths); outline-offset: 3px; border-radius: 10px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 1.25rem; }
.muted { color: var(--ink-3); }
.small { font-size: .88rem; }

/* 3. Top bar & navigation --------------------------------------------------- */
.topbar { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 92%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1120px; margin: 0 auto; padding: .6rem 1.25rem; display: flex; align-items: center; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; flex: none; min-height: var(--tap); }
.brand-mark { width: 38px; height: 38px; }
.brand-text { font-weight: 600; font-size: 1.02rem; white-space: nowrap; }
.brand-text b { font-weight: 800; }
.mainnav { display: flex; gap: .25rem; }
.mainnav a { text-decoration: none; font-weight: 700; padding: .55rem .85rem; border-radius: 999px; color: var(--ink-2); min-height: 44px; display: flex; align-items: center; }
.mainnav a:hover { background: var(--soft); color: var(--ink); }
.mainnav a.on { background: var(--ink); color: var(--bg); }
.search { position: relative; flex: 1 1 200px; max-width: 320px; margin-left: auto; display: flex; align-items: center; }
.search svg { position: absolute; left: .9rem; color: var(--ink-3); }
.search input { width: 100%; min-height: 44px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--soft); padding: .5rem 1rem .5rem 2.5rem; color: var(--ink); -webkit-appearance: none; appearance: none; }
.search input:focus { background: var(--surface); border-color: var(--ink); }
.stats { display: flex; gap: .4rem; }
.stat-pill { display: flex; align-items: center; gap: .35rem; text-decoration: none; padding: .4rem .7rem; border-radius: 999px; background: var(--soft); font-weight: 800; min-height: 40px; }
.flame, .bolt { width: 18px; height: 18px; display: inline-block; background: no-repeat center / contain; }
.flame { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2c1 4 6 6 6 12a6 6 0 0 1-12 0c0-3 2-5 3-6 0 2 1 3 2 3 0-4-1-6 1-9Z' fill='%23ff7a1a'/%3E%3Cpath d='M12 12c.6 2 3 3 3 5.5a3 3 0 0 1-6 0c0-1.6 1.2-2.6 1.8-3.2.2 1 .7 1.4 1.2 1.4 0-1.8-.4-2.4 0-3.7Z' fill='%23ffd23f'/%3E%3C/svg%3E"); }
.bolt { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M13 2 4 14h7l-1 8 9-12h-7Z' fill='%23f5b301'/%3E%3C/svg%3E"); }
.icon-btn { width: var(--tap); height: var(--tap); border-radius: 50%; border: 0; background: var(--soft); display: grid; place-items: center; cursor: pointer; flex: none; color: var(--ink); }
.icon-btn:hover { background: var(--soft-2); }
.bottomnav { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; display: none; justify-content: space-around; background: color-mix(in srgb, var(--surface) 95%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: .3rem .25rem calc(.3rem + var(--safe-b)); }
.bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; font-size: .72rem; font-weight: 700; color: var(--ink-3); min-height: 56px; justify-content: center; border-radius: 14px; }
.bottomnav a.on { color: var(--ink); }
.bn-ico { width: 24px; height: 24px; display: block; }
.bn-ico svg { width: 24px; height: 24px; display: block; }

/* 4. Buttons ---------------------------------------------------------------- */
.btn, .btn-soft, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 52px; padding: .8rem 1.5rem;
  border-radius: 999px; font-weight: 800; font-size: 1rem; text-decoration: none; cursor: pointer; border: 2px solid transparent;
  transition: transform .12s ease, background-color .2s, box-shadow .2s; -webkit-user-select: none; user-select: none;
}
.btn { background: var(--btn); color: var(--btn-ink); box-shadow: 0 4px 0 color-mix(in srgb, var(--btn) 55%, #000); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--btn) 55%, #000); }
.btn[disabled] { background: var(--soft-2); color: var(--ink-3); box-shadow: none; cursor: default; transform: none; }
.btn-soft { background: var(--soft); color: var(--ink); border-color: var(--line); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn-soft:hover, .btn-ghost:hover { border-color: var(--ink-3); }
.wide { width: 100%; }
.btn.ok { background: var(--ok); color: #fff; box-shadow: 0 4px 0 var(--ok-deep); }
.btn.warm { background: var(--warm); color: #1d1300; box-shadow: 0 4px 0 var(--warm-deep); }
.link { background: none; border: 0; padding: .5rem; color: var(--ink-2); text-decoration: underline; cursor: pointer; font-weight: 700; min-height: 44px; }

/* 5. Home ------------------------------------------------------------------- */
.hero { padding: 2.5rem 0 1rem; display: grid; gap: 1.5rem; grid-template-columns: 1.3fr 1fr; align-items: center; }
.hero h1 span { display: inline-block; }
.hero .lead { font-size: 1.15rem; color: var(--ink-2); max-width: 46ch; }
.hero-art svg { width: 100%; height: auto; max-height: 280px; }
.statgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; margin: 1.25rem 0 2rem; }
.statcard { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.statcard b { display: block; font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.statcard span { color: var(--ink-3); font-size: .88rem; font-weight: 600; }
.goal { display: flex; align-items: center; gap: .8rem; }
.goal svg { width: 52px; height: 52px; flex: none; transform: rotate(-90deg); }
.goal circle { fill: none; stroke-width: 6; }
.continue {
  display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; text-decoration: none;
  background: var(--surface); border: 2px solid var(--ink); border-radius: var(--r-lg); padding: 1.1rem 1.25rem; margin-bottom: 2rem; box-shadow: 0 5px 0 var(--ink);
  transition: transform .12s;
}
.continue:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.continue .c-ico { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--c, var(--maths)); color: #fff; }
.continue .c-ico svg { width: 34px; height: 34px; }
.continue small { display: block; color: var(--ink-3); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: .75rem; }
.continue strong { font-size: 1.2rem; display: block; line-height: 1.25; }
.continue .go { width: 48px; height: 48px; border-radius: 50%; background: var(--btn); color: var(--btn-ink); display: grid; place-items: center; }
.section-h { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 2.25rem 0 1rem; }
.subjects { display: grid; gap: 1.1rem; grid-template-columns: repeat(2, 1fr); }
.subject {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: .5rem; text-decoration: none;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-lg); padding: 1.3rem; box-shadow: var(--shadow);
  transition: transform .15s, border-color .2s;
}
.subject:hover { transform: translateY(-3px); border-color: var(--c); }
.subject .s-art { height: 120px; margin: -1.3rem -1.3rem .6rem; background: color-mix(in srgb, var(--c) 14%, var(--surface)); display: grid; place-items: center; }
.subject .s-art svg { height: 104px; width: auto; }
.subject h3 { font-size: 1.4rem; margin: 0; }
.subject p { color: var(--ink-2); margin: 0; font-size: .95rem; }
.course-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .4rem; }
.course-chip { flex: 1 1 150px; border-radius: 14px; background: var(--soft); padding: .6rem .75rem; font-size: .85rem; font-weight: 700; }
.course-chip .bar { margin-top: .4rem; }
.bar { height: 8px; border-radius: 99px; background: var(--soft-2); overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--c, var(--ink)); transition: width .6s ease; }
.howgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.how { background: var(--soft); border-radius: var(--r); padding: 1.1rem 1.2rem; }
.how b { display: block; font-size: 1.05rem; margin-bottom: .2rem; }
.how p { margin: 0; color: var(--ink-2); font-size: .93rem; }
.how .n { width: 34px; height: 34px; border-radius: 10px; background: var(--btn); color: var(--btn-ink); display: grid; place-items: center; font-weight: 800; margin-bottom: .6rem; }

/* 6. Subject page & learning path ------------------------------------------- */
.shead { background: color-mix(in srgb, var(--c) 13%, var(--bg)); border-bottom: 1px solid var(--line); }
.shead-in { max-width: 1120px; margin: 0 auto; padding: 2rem 1.25rem 1.25rem; display: grid; grid-template-columns: 1fr auto; gap: 1.5rem; align-items: center; }
.shead .kick { display: inline-block; background: var(--c); color: #fff; font-weight: 800; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; padding: .35rem .7rem; border-radius: 8px; margin-bottom: .7rem; }
html[data-theme="dark"] .shead .kick { color: #111; }
.shead p { color: var(--ink-2); max-width: 56ch; }
.shead-art svg { width: 190px; height: auto; }
.tabs { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }
.tab { display: inline-flex; flex-direction: column; text-decoration: none; padding: .7rem 1.1rem; border-radius: 16px; border: 2px solid var(--line-2); background: var(--surface); font-weight: 800; min-height: 52px; justify-content: center; }
.tab small { font-weight: 600; color: var(--ink-3); font-size: .78rem; }
.tab.on { border-color: var(--ink); box-shadow: 0 3px 0 var(--ink); }
.sactions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }
.pathwrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 2rem; align-items: start; padding-top: 1.5rem; }
.side { position: sticky; top: 90px; display: grid; gap: 1rem; }
.sidecard { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r); padding: 1.1rem; box-shadow: var(--shadow); }
.sidecard h3 { font-size: 1rem; }
.unit { margin-bottom: 2.25rem; }
.unit-head { display: flex; gap: 1rem; align-items: center; background: var(--c); color: #fff; border-radius: var(--r); padding: 1rem 1.2rem; box-shadow: 0 4px 0 color-mix(in srgb, var(--c) 60%, #000); }
html[data-theme="dark"] .unit-head { color: #111; }
.unit-head small { display: block; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; opacity: .85; font-size: .74rem; }
.unit-head h3 { margin: 0; font-size: 1.2rem; }
.unit-head p { margin: .1rem 0 0; font-size: .9rem; opacity: .92; }
.unit-head .u-prog { margin-left: auto; text-align: right; font-weight: 800; font-size: .9rem; white-space: nowrap; }
.path { position: relative; padding: 1.5rem 0 .5rem; }
.node-row { display: flex; align-items: center; gap: 1rem; margin: 0 0 1.4rem; transform: translateX(var(--x, 0)); }
.node {
  position: relative; flex: none; width: 74px; height: 74px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
  background: var(--soft-2); color: var(--ink-3); box-shadow: 0 6px 0 var(--line-2); transition: transform .12s;
  text-decoration: none;
}
.node:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--line-2); }
.node svg { width: 34px; height: 34px; }
.node.done { background: var(--c); color: #fff; box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 60%, #000); }
.node.next { background: var(--surface); color: var(--c); border: 4px solid var(--c); box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 45%, var(--line-2)); }
.node.next::after { content: ""; position: absolute; inset: -12px; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--c) 40%, transparent); animation: ring 1.8s ease-out infinite; }
@keyframes ring { from { transform: scale(.85); opacity: 1; } to { transform: scale(1.15); opacity: 0; } }
.node-label { display: flex; flex-direction: column; text-decoration: none; max-width: 340px; }
.node-label strong { font-size: 1.02rem; line-height: 1.3; }
.node-label span { color: var(--ink-3); font-size: .85rem; }
.node-label .start { align-self: flex-start; margin-top: .35rem; font-size: .78rem; font-weight: 800; background: var(--btn); color: var(--btn-ink); padding: .25rem .65rem; border-radius: 99px; }
.node-label .score { color: var(--ok-deep); font-weight: 800; }

/* 7. Lesson player ---------------------------------------------------------- */
body.in-lesson { padding-bottom: 0; }
body.in-lesson .topbar, body.in-lesson .bottomnav { display: none; }
.player { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.p-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 1rem; padding: .75rem 1.25rem; background: var(--bg); }
.p-top .icon-btn { background: transparent; }
.p-progress { flex: 1; height: 14px; border-radius: 99px; background: var(--soft-2); overflow: hidden; }
.p-progress > span { display: block; height: 100%; width: 0; background: var(--c, var(--ok)); border-radius: 99px; transition: width .4s ease; }
.p-count { font-weight: 800; color: var(--ink-3); font-size: .9rem; min-width: 3.5em; text-align: right; }
.p-stage { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 1.25rem 1.25rem 10rem; }
.card-step { animation: in .35s ease both; }
@keyframes in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.p-tag { display: inline-block; font-size: .76rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--c); background: color-mix(in srgb, var(--c) 12%, var(--surface)); padding: .3rem .65rem; border-radius: 8px; margin-bottom: .8rem; }
.p-h { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.1rem); margin-bottom: 1rem; }
.p-text { font-size: 1.12rem; color: var(--ink); }
.p-text p { margin-bottom: .9rem; }
.like { margin-top: 1.25rem; display: flex; gap: .8rem; align-items: flex-start; background: var(--soft); border-radius: var(--r); padding: 1rem 1.1rem; }
.like .l-ico { flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--gold); display: grid; place-items: center; color: #1d1300; font-weight: 900; }
.like b { display: block; font-size: .78rem; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); margin-bottom: .1rem; }
.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: .65rem; }
.facts li { position: relative; padding: .85rem 1rem .85rem 3rem; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-sm); font-size: 1.04rem; }
.facts li::before { content: ""; position: absolute; left: 1rem; top: 1.15rem; width: 14px; height: 14px; border-radius: 5px; background: var(--c); }
.figure { background: var(--soft); border-radius: var(--r); padding: 1rem; text-align: center; margin: 1rem 0; }
.figure svg { width: 100%; height: auto; max-height: 340px; }
.figure figcaption { color: var(--ink-2); font-size: .95rem; margin-top: .5rem; }
.task { font-size: 1.25rem; font-weight: 800; background: var(--surface); border: 2px solid var(--ink); border-radius: var(--r); padding: 1rem 1.2rem; margin-bottom: 1rem; }
.wsteps { list-style: none; padding: 0; margin: 0; counter-reset: s; display: grid; gap: .6rem; }
.wsteps li { counter-increment: s; position: relative; padding: .8rem 1rem .8rem 3.2rem; border-radius: var(--r-sm); background: var(--soft); animation: in .3s ease both; }
.wsteps li::before { content: counter(s); position: absolute; left: .85rem; top: .8rem; width: 28px; height: 28px; border-radius: 9px; background: var(--c); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .85rem; }
html[data-theme="dark"] .wsteps li::before { color: #111; }
.answer-box { margin-top: 1rem; padding: 1rem 1.2rem; border-radius: var(--r); background: var(--ok-soft); border: 2px solid var(--ok); font-weight: 800; font-size: 1.12rem; animation: in .3s ease both; }
.answer-box small { display: block; font-weight: 600; font-size: .92rem; color: var(--ink-2); margin-top: .35rem; }
.q { font-size: clamp(1.25rem, 1.1rem + .8vw, 1.6rem); font-weight: 800; margin-bottom: 1.25rem; line-height: 1.35; }
.opts { display: grid; gap: .7rem; }
.opt {
  display: flex; align-items: center; gap: .9rem; width: 100%; text-align: left; min-height: 60px; padding: .8rem 1rem;
  border-radius: 16px; border: 2px solid var(--line-2); background: var(--surface); cursor: pointer; font-size: 1.05rem; font-weight: 600;
  box-shadow: 0 4px 0 var(--line-2); transition: transform .1s, border-color .15s, background-color .15s;
}
.opt:active:not([disabled]) { transform: translateY(3px); box-shadow: 0 1px 0 var(--line-2); }
.opt .k { flex: none; width: 32px; height: 32px; border-radius: 10px; border: 2px solid var(--line-2); display: grid; place-items: center; font-weight: 800; font-size: .85rem; color: var(--ink-3); }
.opt.sel { border-color: var(--maths); background: color-mix(in srgb, var(--maths) 8%, var(--surface)); box-shadow: 0 4px 0 var(--maths); }
.opt.sel .k { border-color: var(--maths); color: var(--maths); }
.opt.right { border-color: var(--ok); background: var(--ok-soft); box-shadow: 0 4px 0 var(--ok); }
.opt.right .k { background: var(--ok); border-color: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--warm); background: var(--warm-soft); box-shadow: 0 4px 0 var(--warm); }
.opt.wrong .k { background: var(--warm); border-color: var(--warm); color: #1d1300; }
.opt[disabled] { cursor: default; }
.tfrow { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.tfrow .opt { justify-content: center; font-size: 1.15rem; font-weight: 800; }
.answer-input { width: 100%; min-height: 60px; border-radius: 16px; border: 2px solid var(--line-2); background: var(--surface); padding: .8rem 1.1rem; font-size: 1.25rem; font-weight: 700; color: var(--ink); }
.answer-input:focus { border-color: var(--maths); }
.answer-input.right { border-color: var(--ok); background: var(--ok-soft); }
.answer-input.wrong { border-color: var(--warm); background: var(--warm-soft); }
.hintbtn { margin-top: .75rem; }
.hinttext { margin-top: .5rem; padding: .7rem .9rem; border-radius: 12px; background: var(--soft); color: var(--ink-2); }
.trylist { margin: 0 0 1rem; padding-left: 1.4rem; display: grid; gap: .5rem; font-size: 1.08rem; }
.wordgrid { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.word { background: var(--soft); border-radius: var(--r-sm); padding: .8rem .95rem; }
.word b { display: block; font-size: 1.02rem; }
.word span { color: var(--ink-2); font-size: .93rem; }
.phrases { list-style: none; padding: 0; margin: 0; display: grid; gap: .55rem; }
.phrases li { display: grid; grid-template-columns: 1fr auto; gap: .1rem .8rem; align-items: center; padding: .75rem .9rem; border-radius: var(--r-sm); background: var(--surface); border: 1.5px solid var(--line); }
.phrases .es-line { font-weight: 800; font-size: 1.1rem; }
.phrases .en-line { grid-column: 1; color: var(--ink-3); font-size: .95rem; }
.phrases .speak { grid-column: 2; grid-row: 1 / span 2; }
.recap { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .55rem; }
.recap li { display: flex; gap: .7rem; align-items: flex-start; font-size: 1.05rem; }
.recap li::before { content: "✓"; flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-weight: 900; font-size: .8rem; margin-top: .15rem; }
.tipbox { padding: 1rem 1.1rem; border-radius: var(--r); background: var(--warm-soft); border-left: 6px solid var(--warm); }

/* bottom action bar + feedback */
.p-bar { position: fixed; z-index: 35; left: 0; right: 0; bottom: 0; background: var(--bg); border-top: 1.5px solid var(--line); padding: 1rem 1.25rem calc(1rem + var(--safe-b)); }
.p-bar-in { max-width: 720px; margin: 0 auto; display: flex; gap: .8rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.p-bar .btn { min-width: 180px; }
.p-bar.fb-ok { background: var(--ok-soft); border-top-color: var(--ok); }
.p-bar.fb-warm { background: var(--warm-soft); border-top-color: var(--warm); }
.fb { flex: 1 1 320px; display: flex; gap: .8rem; align-items: flex-start; }
.fb .fb-ico { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 1.3rem; color: #fff; background: var(--ok); }
.fb-warm .fb .fb-ico { background: var(--warm); color: #1d1300; }
.fb strong { display: block; font-size: 1.15rem; color: var(--ok-deep); }
.fb-warm .fb strong { color: var(--warm-deep); }
.fb p { margin: .15rem 0 0; color: var(--ink-2); font-size: .98rem; max-height: 30vh; overflow: auto; }

/* finish screen */
.finish { text-align: center; padding-top: 2rem; }
.finish .trophy { width: 160px; height: 160px; margin: 0 auto 1rem; }
.finish-stats { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; margin: 1.25rem 0 2rem; }
.finish-stats div { min-width: 130px; border: 2px solid var(--line-2); border-radius: var(--r); padding: .8rem 1rem; }
.finish-stats b { display: block; font-size: 1.6rem; }
.finish-stats span { color: var(--ink-3); font-weight: 700; font-size: .85rem; }
.finish .row { display: flex; gap: .7rem; justify-content: center; flex-wrap: wrap; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: fall 2.4s ease-in forwards; }
@keyframes fall { to { transform: translate3d(var(--dx), 110vh, 0) rotate(720deg); opacity: .9; } }

/* 8. Practice, flashcards, search, progress ---------------------------------- */
.pagehead { padding: 2rem 0 1rem; }
.cards-stage { perspective: 1400px; max-width: 620px; margin: 0 auto; }
.fcard { position: relative; height: clamp(260px, 45vh, 380px); transform-style: preserve-3d; -webkit-transform-style: preserve-3d; transition: transform .55s cubic-bezier(.2, .7, .2, 1); cursor: pointer; }
.fcard.flip { transform: rotateY(180deg); }
.fface { position: absolute; inset: 0; border-radius: var(--r-lg); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 2rem; backface-visibility: hidden; -webkit-backface-visibility: hidden; border: 2px solid var(--line-2); background: var(--surface); box-shadow: 0 6px 0 var(--line-2); }
.fface.back { transform: rotateY(180deg); background: color-mix(in srgb, var(--c) 10%, var(--surface)); border-color: var(--c); box-shadow: 0 6px 0 var(--c); }
.fface .term { font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2.3rem); font-weight: 800; }
.fface .def { font-size: 1.2rem; }
.fface small { position: absolute; bottom: 1rem; color: var(--ink-3); font-weight: 700; }
.fcontrols { display: flex; gap: .7rem; justify-content: center; margin-top: 1.4rem; flex-wrap: wrap; }
.results { display: grid; gap: .7rem; }
.result { display: flex; gap: 1rem; align-items: center; text-decoration: none; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r); padding: .9rem 1rem; }
.result .dot { width: 14px; height: 14px; border-radius: 5px; background: var(--c); flex: none; }
.result small { display: block; color: var(--ink-3); }
.progrid { display: grid; gap: 1rem; grid-template-columns: repeat(2, 1fr); }
.chip-row { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0 1rem; }
.chip-btn { border: 2px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: .45rem .9rem; font-weight: 700; cursor: pointer; min-height: 44px; }
.chip-btn[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--bg); }

/* 9. Spanish speak buttons ----------------------------------------------------- */
.speak { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--spanish) 60%, var(--line)); background: color-mix(in srgb, var(--spanish) 14%, var(--surface)); color: var(--ink); cursor: pointer; display: inline-grid; place-items: center; vertical-align: middle; margin-left: .35rem; }
.speak.on { background: var(--spanish); color: #1d1300; animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }
.es { font-weight: 700; }

/* 10. Settings drawer, toast ---------------------------------------------------- */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(10, 12, 18, .45); }
.drawer { position: fixed; z-index: 70; top: 0; right: 0; bottom: 0; width: min(400px, 100vw); background: var(--surface); border-left: 1px solid var(--line); box-shadow: -20px 0 50px rgba(0, 0, 0, .18); transform: translateX(105%); transition: transform .3s ease; visibility: hidden; display: flex; flex-direction: column; }
.drawer.open { transform: none; visibility: visible; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 1.25rem; }
.drawer-body { overflow-y: auto; padding: 1rem 1.25rem 2rem; overscroll-behavior: contain; }
.set { margin-bottom: 1.4rem; }
.set h3 { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: .6rem; }
.hint { color: var(--ink-3); font-size: .85rem; margin: .5rem 0 0; }
.chips { display: flex; gap: .45rem; flex-wrap: wrap; }
.chips button { border: 2px solid var(--line-2); background: var(--surface); border-radius: 12px; padding: .5rem .85rem; font-weight: 700; cursor: pointer; min-height: 44px; }
.chips button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.swatches { display: flex; gap: .55rem; flex-wrap: wrap; }
.sw { width: 54px; height: 54px; border-radius: 16px; border: 3px solid var(--line-2); background: var(--c); cursor: pointer; font-weight: 800; color: #141414; }
.sw.dark { color: #fff; }
.sw[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--ink); }
#test-voice { margin-top: .6rem; }
.toast { position: fixed; z-index: 80; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: .75rem 1.2rem; border-radius: 999px; font-weight: 700; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); animation: in .25s ease; max-width: calc(100vw - 2rem); }

/* 11. Bionic reading ----------------------------------------------------------- */
.bx b, .bx-b { font-weight: 800; }
html[data-theme="dark"] .bx b { color: #fff; }

/* 12. Animation library used inside the diagrams ------------------------------- */
@keyframes spinAround { to { transform: rotate(360deg); } }
@keyframes throb { 0%, 100% { transform: scale(1); } 45% { transform: scale(1.14); } }
@keyframes dashFlow { to { stroke-dashoffset: -160; } }
@keyframes jiggle { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(1.6px, -1.4px); } 50% { transform: translate(-1.4px, 1.5px); } 75% { transform: translate(1.2px, 1.3px); } }
@keyframes roam { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(22px, -14px); } 50% { transform: translate(8px, 18px); } 75% { transform: translate(-20px, 6px); } }
@keyframes squeeze { 0%, 100% { transform: scaleX(1); } 50% { transform: scaleX(.62); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .15; } }
@keyframes grow { 0% { transform: scale(.25); opacity: 0; } 45% { opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes bobble { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes slideRight { 0% { transform: translateX(-4px); opacity: 0; } 12% { opacity: 1; } 88% { opacity: 1; } 100% { transform: translateX(96px); opacity: 0; } }
@keyframes waveShift { to { transform: translateX(-120px); } }
.an-spin { animation: spinAround 9s linear infinite; transform-box: fill-box; transform-origin: center; }
.an-spin-slow { animation: spinAround 22s linear infinite; transform-box: fill-box; transform-origin: center; }
.an-throb { animation: throb 1.15s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.an-flow { stroke-dasharray: 9 11; animation: dashFlow 2.4s linear infinite; }
.an-jig { animation: jiggle .55s steps(4) infinite; }
.an-roam { animation: roam 7s ease-in-out infinite; }
.an-right { animation: slideRight 3s linear infinite; }
.an-wave { animation: waveShift 2.6s linear infinite; }
.an-squeeze { animation: squeeze 3.6s ease-in-out infinite; transform-box: fill-box; transform-origin: left center; }
.an-blink { animation: blink 1.8s ease-in-out infinite; }
.an-grow { animation: grow 2.8s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.an-bob { animation: bobble 2.6s ease-in-out infinite; }
.d1 { animation-delay: .35s; } .d2 { animation-delay: .7s; } .d3 { animation-delay: 1.05s; } .d4 { animation-delay: 1.4s; } .d5 { animation-delay: 1.75s; } .d6 { animation-delay: 2.1s; }

/* 13. Responsive ----------------------------------------------------------------- */
@media (max-width: 1000px) {
  .mainnav { display: none; }
  .bottomnav { display: flex; }
  .pathwrap { grid-template-columns: 1fr; }
  .side { position: static; grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding-top: 1.5rem; }
  .hero-art { display: none; }
  .statgrid { grid-template-columns: repeat(2, 1fr); }
  .subjects, .howgrid, .progrid { grid-template-columns: 1fr; }
  .shead-in { grid-template-columns: 1fr; }
  .shead-art { display: none; }
  .brand-text { display: none; }
  .side { grid-template-columns: 1fr; }
  .node-row { transform: none !important; }
  .stats .stat-pill { padding: .4rem .55rem; }
}
@media (max-width: 480px) {
  .search { display: none; }
  .p-bar .btn { width: 100%; }
}
@media print {
  .topbar, .bottomnav, .p-bar, .drawer { display: none !important; }
}

/* monospace equation lines from maths data */
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .95em; white-space: pre-wrap; }

/* Bionic wrappers must never inherit layout rules aimed at real <b>/<span> elements */
.bx, .bx-vis { display: inline !important; margin: 0 !important; padding: 0 !important; font-size: inherit !important; color: inherit !important; background: none !important; width: auto !important; height: auto !important; }
.bx b { display: inline !important; margin: 0 !important; padding: 0 !important; font-size: inherit !important; color: inherit !important; background: none !important; letter-spacing: inherit; }
.bx .sr { position: absolute !important; }

/* 14. iPad and touch ---------------------------------------------------------------- */
:root { --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px); }
* { -webkit-tap-highlight-color: transparent; }
a, button, .opt, .node, .fcard, [role="button"] { touch-action: manipulation; }   /* no double-tap zoom delay */
input, select, textarea { font-size: max(16px, 1rem) !important; }                 /* stops iPad zooming in on focus */
.topbar, .p-bar, .bottomnav { padding-left: max(1rem, var(--safe-l)); padding-right: max(1rem, var(--safe-r)); }
body.in-lesson { overscroll-behavior-y: none; }
.p-bar { transition: transform .15s ease; }
img, svg { -webkit-user-select: none; user-select: none; }
.fcard, .node, .opt, .btn, .btn-soft { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* Touch screens: no sticky hover, clear press feedback instead */
@media (hover: none) {
  .subject:hover { transform: none; border-color: var(--line); }
  .mainnav a:hover { background: transparent; color: inherit; }
  .mainnav a.on:hover { background: var(--btn); color: var(--btn-ink); }
  .icon-btn:hover { background: transparent; }
  .btn-soft:hover, .btn-ghost:hover { border-color: var(--line); }
  .subject:active, .continue:active, .result:active { transform: scale(.985); }
  .opt:active:not([disabled]) { transform: translateY(2px); }
  .node:active { transform: translateY(4px); }
  .btn:active:not([disabled]), .btn-soft:active { transform: translateY(3px); box-shadow: none; }
}

/* Tablet sizes (iPad portrait and landscape): bigger targets, roomier lessons */
@media (min-width: 700px) and (max-width: 1370px) and (pointer: coarse) {
  .opt { min-height: 68px; font-size: 1.12rem; padding: 1rem 1.2rem; }
  .opt .k { width: 34px; height: 34px; }
  .answer-input { min-height: 68px; font-size: 1.4rem; }
  .btn, .btn-soft, .btn-ghost { min-height: 54px; }
  .p-bar .btn { min-width: 220px; }
  .p-stage { padding-top: 2.5rem; }
  .node { width: 84px; height: 84px; }
  .icon-btn { width: 48px; height: 48px; }
  .speak { width: 50px; height: 50px; }
  .bottomnav a { min-height: 58px; }
  .chips button, .swatches .sw { min-height: 48px; }
  .fcard { height: clamp(320px, 40vh, 460px); }
  .drawer { width: min(440px, 92vw); }
}
/* iPad portrait (768–834px wide): keep the home and subject pages two columns */
@media (min-width: 700px) and (max-width: 1000px) {
  .subjects { grid-template-columns: repeat(2, 1fr); }
  .howgrid { grid-template-columns: repeat(3, 1fr); }
  .search { max-width: 260px; }
}
/* iPad landscape (1024–1366px): room for the top navigation without crowding */
@media (min-width: 1001px) and (max-width: 1180px) {
  .mainnav a { padding-left: .7rem; padding-right: .7rem; }
  .search { max-width: 220px; }
}
