/* ============ Ishaan's Study Hub — styles ============ */
:root {
  --bg: #faf6ef;
  --bg2: #f3ede2;
  --card: #ffffff;
  --card2: #fbf9f5;
  --ink: #1c2140;
  --ink2: #3a3f63;
  --muted: #72779a;
  --line: #ebe4d6;
  --accent: #6d4aff;
  --sc: #6d4aff;          /* current subject colour (set by JS) */
  --sc-soft: #efeaff;
  --good: #12a150;
  --good-soft: #e3f7ea;
  --bad: #e5484d;
  --bad-soft: #fdeaea;
  --warn: #f5a524;
  --warn-soft: #fff4de;
  --shadow-sm: 0 1px 2px rgba(28,33,64,.06), 0 2px 6px rgba(28,33,64,.05);
  --shadow: 0 2px 4px rgba(28,33,64,.05), 0 10px 30px -8px rgba(28,33,64,.14);
  --shadow-lg: 0 8px 20px -6px rgba(28,33,64,.18), 0 30px 60px -20px rgba(28,33,64,.25);
  --r: 20px;
  --r-sm: 12px;
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Baloo 2", "Nunito", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1226;
  --bg2: #151936;
  --card: #1a1e3d;
  --card2: #20254a;
  --ink: #eef0ff;
  --ink2: #cdd1f2;
  --muted: #9095bf;
  --line: #2b3060;
  --good-soft: #10331f;
  --bad-soft: #3a1618;
  --warn-soft: #3a2c10;
  --sc-soft: #262a55;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow: 0 10px 30px -10px rgba(0,0,0,.5);
  --shadow-lg: 0 30px 60px -20px rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh;
  font-family: var(--font); font-size: 17px; line-height: 1.6;
  color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
:lang(hi), .deva { font-family: "Noto Sans Devanagari", var(--font); }
:lang(or), .odia { font-family: "Noto Sans Oriya", var(--font); }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.01em; }
p { margin: 0 0 .8em; }
code, pre { font-family: var(--mono); }
.hide, [hidden] { display: none !important; }

/* background blobs */
.bg-blobs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-blobs span { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .35; }
.bg-blobs span:nth-child(1) { width: 480px; height: 480px; background: #ffd6a5; top: -140px; right: -120px; }
.bg-blobs span:nth-child(2) { width: 420px; height: 420px; background: #caffbf; bottom: -160px; left: -120px; opacity: .25; }
.bg-blobs span:nth-child(3) { width: 380px; height: 380px; background: var(--sc); top: 40%; left: 55%; opacity: .10; transition: background .6s; }
:root[data-theme="dark"] .bg-blobs span { opacity: .12; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; font-size: 22px; border-radius: 13px;
  background: linear-gradient(135deg, #7c5cff, #ff7ab6); box-shadow: 0 6px 16px -6px #7c5cff; }
.brand-text { display: flex; flex-direction: column; font-family: var(--display); font-size: 20px; line-height: 1.05; font-weight: 700; }
.brand-text small { font-family: var(--font); font-size: 12px; color: var(--muted); font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.chip, .icon-btn { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 14px; box-shadow: var(--shadow-sm); }
.icon-btn { padding: 7px 11px; }
.chip:hover, .icon-btn:hover { border-color: var(--sc); }
.xp-pill { white-space: nowrap; background: linear-gradient(135deg,#ffe29a,#ffc36b); color: #6a4100; border-radius: 999px; padding: 6px 14px; font-weight: 800; font-size: 14px; box-shadow: 0 4px 12px -4px #f5a524; }
.xp-pill.bump { animation: bump .5s; }
@keyframes bump { 40% { transform: scale(1.25); } }

main { max-width: 1180px; margin: 0 auto; padding: 22px clamp(16px, 4vw, 40px) 90px; outline: none; }
.view-enter { animation: viewIn .35s cubic-bezier(.2,.8,.2,1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 14px; padding: 12px 20px;
  font-weight: 800; font-size: 16px; background: var(--sc); color: #fff; box-shadow: 0 6px 16px -6px var(--sc); transition: transform .12s, box-shadow .2s, filter .2s; text-decoration: none; }
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn.ghost { background: var(--card); color: var(--ink); border: 1.5px solid var(--line); box-shadow: var(--shadow-sm); }
.btn.ghost:hover { border-color: var(--sc); }
.btn.soft { background: var(--sc-soft); color: var(--sc); box-shadow: none; }
.btn.sm { padding: 8px 14px; font-size: 14px; border-radius: 11px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.good { background: var(--good); box-shadow: 0 6px 16px -6px var(--good); }
.btn.bad { background: var(--bad); box-shadow: 0 6px 16px -6px var(--bad); }

/* ---------- home ---------- */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 22px; margin-bottom: 30px; }
.hero-card { position: relative; overflow: hidden; border-radius: 28px; padding: 30px 32px; color: #fff;
  background: radial-gradient(120% 140% at 0% 0%, #8b6bff 0%, #5b3df5 45%, #3a1fb8 100%); box-shadow: var(--shadow-lg); }
.hero-card h1 { font-size: clamp(30px, 4vw, 44px); margin-bottom: 6px; }
.hero-card p { opacity: .92; font-size: 18px; max-width: 520px; }
.hero-card .deco { position: absolute; right: -10px; bottom: -30px; font-size: 150px; opacity: .18; transform: rotate(-12deg); pointer-events: none; }
.hero-stats { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.hero-stat { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.25); border-radius: 14px; padding: 8px 14px; font-weight: 700; font-size: 14px; }
.hero-stat b { font-size: 20px; display: block; font-family: var(--display); }
.countdown { border-radius: 28px; padding: 24px; background: var(--card); box-shadow: var(--shadow); border: 1px solid var(--line); display: flex; flex-direction: column; }
.countdown h3 { font-size: 18px; color: var(--muted); font-family: var(--font); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.countdown .big { font-family: var(--display); font-size: 64px; font-weight: 800; line-height: 1; background: linear-gradient(135deg,#ff6b6b,#f5a524); -webkit-background-clip: text; background-clip: text; color: transparent; }
.countdown .big small { font-size: 22px; color: var(--ink2); -webkit-text-fill-color: var(--ink2); margin-left: 6px; }
.countdown .sub { color: var(--muted); font-weight: 600; margin-top: 4px; }
.countdown .bar { height: 10px; background: var(--bg2); border-radius: 99px; margin-top: auto; overflow: hidden; }
.countdown .bar i { display: block; height: 100%; background: linear-gradient(90deg,#12a150,#f5a524,#ff6b6b); border-radius: 99px; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 34px 0 14px; }
.section-title h2 { font-size: 28px; margin: 0; }
.section-title span { color: var(--muted); font-weight: 600; font-size: 15px; }

.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.subject-card { position: relative; text-decoration: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px;
  box-shadow: var(--shadow-sm); transition: transform .2s cubic-bezier(.2,.8,.2,1), box-shadow .2s, border-color .2s; overflow: hidden; display: flex; flex-direction: column; gap: 10px; min-height: 190px; }
.subject-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--c); }
.subject-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--c) 40%, var(--line)); }
.subject-card .top { display: flex; align-items: center; justify-content: space-between; }
.s-icon { width: 58px; height: 58px; display: grid; place-items: center; font-size: 30px; border-radius: 18px;
  background: color-mix(in srgb, var(--c) 16%, var(--card)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 25%, transparent); }
.subject-card h3 { font-size: 22px; margin: 4px 0 0; }
.subject-card p { color: var(--muted); font-size: 14.5px; margin: 0; line-height: 1.45; }
.subject-card .meta { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; font-size: 13px; font-weight: 700; color: var(--ink2); }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; background: var(--bg2); font-size: 12.5px; font-weight: 800; color: var(--ink2); white-space: nowrap; }
.pill.exam { background: #ffe8e8; color: #c62828; }
.pill.later { background: var(--bg2); color: var(--muted); }
.pill.sc { background: var(--sc-soft); color: var(--sc); }
:root[data-theme="dark"] .pill.exam { background: #3a1618; color: #ff8a8a; }
.ring { --p: 0; width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800;
  background: conic-gradient(var(--c, var(--sc)) calc(var(--p) * 1%), var(--bg2) 0); }
.ring span { width: 38px; height: 38px; border-radius: 50%; background: var(--card); display: grid; place-items: center; }
.subject-card.soon { opacity: .6; }

.tips-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 16px; }
.tip-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.tip-card h4 { font-size: 18px; }
.tip-card p { color: var(--ink2); font-size: 15px; margin: 0; }

/* ---------- exam timetable ---------- */
.exam-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: 12px; }
.exam-item { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; text-decoration: none; }
.exam-item .e-ic { font-size: 22px; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 15%, var(--card)); flex: none; }
.exam-item b { display: block; font-family: var(--display); font-size: 17px; }
.exam-item small { color: var(--muted); font-weight: 600; font-size: 13.5px; line-height: 1.35; display: block; }

/* ---------- breadcrumbs ---------- */
.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; font-weight: 700; color: var(--muted); margin-bottom: 14px; }
.crumbs a { text-decoration: none; padding: 4px 10px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); }
.crumbs a:hover { color: var(--sc); border-color: var(--sc); }

/* ---------- subject page ---------- */
.subject-hero { position: relative; overflow: hidden; border-radius: 28px; padding: 30px 32px; color: #fff; margin-bottom: 26px;
  background: linear-gradient(135deg, var(--sc) 0%, color-mix(in srgb, var(--sc) 60%, #1c2140) 100%); box-shadow: var(--shadow-lg); }
.subject-hero .emoji { position: absolute; right: 24px; top: 50%; transform: translateY(-50%) rotate(-8deg); font-size: 130px; opacity: .25; pointer-events: none; }
.subject-hero h1 { font-size: clamp(32px, 4.5vw, 48px); margin-bottom: 4px; }
.subject-hero p { opacity: .92; max-width: 640px; margin-bottom: 14px; font-size: 17px; }
.subject-hero .hero-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.subject-hero .tag { background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3); border-radius: 99px; padding: 5px 13px; font-size: 13.5px; font-weight: 700; }
.hero-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin: 6px 0 12px; max-width: 900px; position: relative; }
.hero-info > div { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25); border-radius: 16px; padding: 10px 14px; font-size: 14.5px; line-height: 1.45; font-weight: 600; }
.hero-info small { display: block; font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; opacity: .85; margin-bottom: 2px; }
.subject-hero .actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.subject-hero .btn { background: #fff; color: var(--sc); box-shadow: 0 8px 20px -8px rgba(0,0,0,.4); }
.subject-hero .btn.ghost { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.35); }

.chapter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.chapter-card { position: relative; display: flex; gap: 14px; align-items: flex-start; text-decoration: none; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 18px; box-shadow: var(--shadow-sm); transition: transform .2s, box-shadow .2s, border-color .2s; }
.chapter-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--sc) 45%, var(--line)); }
.chapter-card .c-emoji { flex: none; width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; font-size: 30px; background: var(--sc-soft); overflow: hidden; }
.chapter-card .c-emoji img { width: 100%; height: 100%; object-fit: cover; }
.chapter-card .c-body { flex: 1; min-width: 0; }
.chapter-card .c-num { font-size: 12.5px; font-weight: 800; color: var(--sc); text-transform: uppercase; letter-spacing: .05em; }
.chapter-card h3 { font-size: 20px; margin: 2px 0 4px; }
.chapter-card p { font-size: 14.5px; color: var(--muted); margin: 0 0 10px; line-height: 1.45; }
.chapter-card .c-stats { display: flex; gap: 6px; flex-wrap: wrap; }
.chapter-card .done-badge { position: absolute; top: 12px; right: 12px; }
.chapter-card.later { background: var(--card2); box-shadow: none; }
.chapter-card.later .c-emoji { filter: grayscale(.6); opacity: .8; }
.progress-line { height: 6px; border-radius: 99px; background: var(--bg2); overflow: hidden; margin-top: 10px; }
.progress-line i { display: block; height: 100%; background: var(--sc); border-radius: 99px; transition: width .5s; }

details.later-box { margin-top: 30px; }
details.later-box summary { cursor: pointer; list-style: none; font-family: var(--display); font-size: 22px; font-weight: 700; display: flex; align-items: center; gap: 10px; color: var(--ink2); }
details.later-box summary::-webkit-details-marker { display: none; }
details.later-box summary::before { content: "▸"; transition: transform .2s; color: var(--muted); }
details.later-box[open] summary::before { transform: rotate(90deg); }
details.later-box .chapter-grid { margin-top: 14px; }

/* ---------- chapter page ---------- */
.chapter-head { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; background: var(--card); border: 1px solid var(--line);
  border-radius: 26px; padding: 22px 26px; box-shadow: var(--shadow); margin-bottom: 18px; position: relative; overflow: hidden; }
.chapter-head::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 7px; background: var(--sc); }
.chapter-head .c-num { font-weight: 800; color: var(--sc); font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.chapter-head h1 { font-size: clamp(28px, 3.6vw, 40px); margin: 2px 0 6px; }
.chapter-head p { color: var(--ink2); margin: 0; }
.chapter-head .hero-img { width: 170px; height: 120px; border-radius: 18px; object-fit: cover; box-shadow: var(--shadow); cursor: zoom-in; }
.objectives { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.objectives span { font-size: 13.5px; font-weight: 700; padding: 4px 11px; border-radius: 99px; background: var(--sc-soft); color: var(--sc); }

.tabs { position: sticky; top: 64px; z-index: 30; display: flex; gap: 6px; padding: 6px; background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-sm); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 1 0 auto; border: 0; background: transparent; border-radius: 13px; padding: 10px 16px; font-weight: 800; font-size: 15px; color: var(--muted); white-space: nowrap; transition: background .2s, color .2s; }
.tab:hover { color: var(--ink); background: var(--bg2); }
.tab.active { background: var(--sc); color: #fff; box-shadow: 0 6px 14px -6px var(--sc); }
.tab .cnt { font-size: 12px; opacity: .8; margin-left: 4px; }

/* learn: concept stepper */
.learn-wrap { display: grid; grid-template-columns: 250px 1fr; gap: 20px; align-items: start; }
.toc { position: sticky; top: 136px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; box-shadow: var(--shadow-sm); max-height: calc(100vh - 160px); overflow: auto; }
.toc button { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; border: 0; background: transparent; border-radius: 12px; padding: 9px 10px; font-weight: 700; font-size: 14.5px; color: var(--ink2); line-height: 1.3; }
.toc button:hover { background: var(--bg2); }
.toc button.active { background: var(--sc-soft); color: var(--sc); }
.toc button .n { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: var(--bg2); color: var(--muted); }
.toc button.seen .n { background: var(--good); color: #fff; }
.toc button.active .n { background: var(--sc); color: #fff; }

.concept { background: var(--card); border: 1px solid var(--line); border-radius: 26px; padding: clamp(20px, 3vw, 34px); box-shadow: var(--shadow); min-height: 380px; }
.concept .step-label { font-size: 13px; font-weight: 800; color: var(--sc); text-transform: uppercase; letter-spacing: .07em; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.concept h2 { font-size: clamp(26px, 3vw, 34px); margin: 6px 0 14px; }
.concept .body { font-size: 18px; color: var(--ink); }
.concept .body ul, .concept .body ol { padding-left: 1.3em; margin: .4em 0 1em; }
.concept .body li { margin: .3em 0; }
.concept .body li::marker { color: var(--sc); font-weight: 800; }
.concept .body table, .rich table { border-collapse: separate; border-spacing: 0; width: 100%; margin: 12px 0 16px; font-size: 16px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.concept .body th, .rich th { background: var(--sc-soft); color: var(--ink); text-align: left; padding: 9px 12px; font-weight: 800; }
.concept .body td, .rich td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.concept .body tr:nth-child(even) td, .rich tr:nth-child(even) td { background: var(--card2); }
.table-scroll { overflow-x: auto; }
.hl { background: linear-gradient(transparent 55%, color-mix(in srgb, var(--sc) 30%, transparent) 55%); font-weight: 700; padding: 0 2px; }
.body b, .body strong { color: var(--ink); }
.body pre, .rich pre { background: #1c2140; color: #e8eaff; padding: 14px 16px; border-radius: 14px; overflow-x: auto; font-size: 15px; line-height: 1.5; }
.body code:not(pre code), .rich code:not(pre code) { background: var(--bg2); padding: 1px 6px; border-radius: 6px; font-size: .92em; }
.big-script { font-size: 2.2em; font-weight: 700; color: var(--sc); line-height: 1.3; }
.concept-media { display: grid; grid-template-columns: 1fr; gap: 18px; margin: 10px 0 16px; }
.concept-media.split { grid-template-columns: 1.1fr .9fr; align-items: start; }
figure.fig { margin: 0; background: var(--card2); border: 1px solid var(--line); border-radius: 18px; padding: 10px; }
figure.fig img { border-radius: 12px; max-height: 420px; width: auto; margin: 0 auto; object-fit: contain; cursor: zoom-in; background: #fff; }
figure.fig figcaption { font-size: 14px; color: var(--muted); text-align: center; padding: 8px 6px 2px; font-weight: 600; }
.svg-box { background: var(--card2); border: 1px solid var(--line); border-radius: 18px; padding: 14px; overflow-x: auto; }
.svg-box svg { width: 100%; height: auto; max-height: 460px; display: block; }

.callouts { display: grid; gap: 12px; margin-top: 16px; }
.callout { border-radius: 16px; padding: 14px 16px 14px 54px; position: relative; font-size: 16px; line-height: 1.5; }
.callout::before { position: absolute; left: 14px; top: 11px; font-size: 24px; }
.callout h5 { margin: 0 0 4px; font-family: var(--display); font-size: 16px; text-transform: uppercase; letter-spacing: .05em; }
.callout ul { margin: 0; padding-left: 1.1em; }
.callout.keys { background: var(--sc-soft); } .callout.keys::before { content: "📌"; } .callout.keys h5 { color: var(--sc); }
.callout.fun { background: #e8f4ff; } .callout.fun::before { content: "💡"; } .callout.fun h5 { color: #1565c0; }
.callout.tip { background: var(--warn-soft); } .callout.tip::before { content: "🧠"; } .callout.tip h5 { color: #b26a00; }
:root[data-theme="dark"] .callout.fun { background: #10263d; }
:root[data-theme="dark"] .callout.fun h5 { color: #7cb8ff; }
:root[data-theme="dark"] .callout.tip h5 { color: #ffc56b; }

.concept-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.dots i { width: 9px; height: 9px; border-radius: 99px; background: var(--line); transition: all .25s; cursor: pointer; }
.dots i.on { width: 26px; background: var(--sc); }
.dots i.seen { background: color-mix(in srgb, var(--sc) 45%, var(--line)); }
.speak-btn { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 4px 12px; font-size: 13px; font-weight: 800; color: var(--muted); }
.speak-btn:hover, .speak-btn.on { color: var(--sc); border-color: var(--sc); }

.finish-card { text-align: center; padding: 40px 20px; }
.finish-card .big-emoji { font-size: 70px; }

/* ---------- widgets ---------- */
.widget { margin-top: 18px; border: 2px dashed color-mix(in srgb, var(--sc) 35%, var(--line)); border-radius: 20px; padding: 16px; background: color-mix(in srgb, var(--sc) 4%, var(--card)); }
.widget-title { font-size: 13px; font-weight: 800; color: var(--sc); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }

.hotspots { position: relative; max-width: 640px; margin: 0 auto; }
.hotspots img, .hotspots svg { width: 100%; height: auto; border-radius: 14px; background: #fff; }
.spot { position: absolute; transform: translate(-50%, -50%); width: 30px; height: 30px; border-radius: 50%; border: 3px solid #fff; background: var(--sc); color: #fff; font-weight: 800; font-size: 13px;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--sc) 60%, transparent), 0 3px 8px rgba(0,0,0,.3); animation: pulse 2.2s infinite; padding: 0; z-index: 2; }
.spot.open { background: var(--good); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--sc) 55%, transparent), 0 3px 8px rgba(0,0,0,.3); } 70% { box-shadow: 0 0 0 14px transparent, 0 3px 8px rgba(0,0,0,.3); } 100% { box-shadow: 0 0 0 0 transparent, 0 3px 8px rgba(0,0,0,.3); } }
.spot-tip { position: absolute; z-index: 3; transform: translate(-50%, calc(-100% - 22px)); background: var(--ink); color: var(--bg); border-radius: 12px; padding: 8px 12px; font-size: 14px; width: max-content; max-width: 230px; box-shadow: var(--shadow-lg); pointer-events: none; animation: viewIn .2s; }
.spot-tip b { display: block; font-family: var(--display); font-size: 16px; }
.spot-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; justify-content: center; }
.spot-legend button { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 4px 11px; font-size: 13.5px; font-weight: 700; }
.spot-legend button.open { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.hs-mode { display: flex; gap: 8px; justify-content: center; margin-bottom: 10px; }

.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 10px; top: 6px; bottom: 6px; width: 4px; border-radius: 4px; background: linear-gradient(var(--sc), color-mix(in srgb, var(--sc) 30%, transparent)); }
.tl-item { position: relative; margin-bottom: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow-sm); display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center;
  opacity: 0; transform: translateX(-10px); animation: tlIn .4s forwards; }
@keyframes tlIn { to { opacity: 1; transform: none; } }
.tl-item::before { content: ""; position: absolute; left: -25px; top: 18px; width: 14px; height: 14px; border-radius: 50%; background: var(--card); border: 4px solid var(--sc); }
.tl-when { font-weight: 800; font-size: 13px; color: var(--sc); letter-spacing: .03em; }
.tl-item h4 { font-size: 18px; margin: 0 0 2px; }
.tl-item p { margin: 0; font-size: 15px; color: var(--ink2); }
.tl-item img { width: 110px; height: 80px; object-fit: cover; border-radius: 10px; cursor: zoom-in; }

.sort-pool { display: flex; flex-wrap: wrap; gap: 8px; min-height: 48px; padding: 10px; border-radius: 14px; background: var(--bg2); margin-bottom: 12px; }
.sort-item { border: 1.5px solid var(--line); background: var(--card); border-radius: 12px; padding: 7px 13px; font-weight: 700; font-size: 15px; box-shadow: var(--shadow-sm); cursor: grab; user-select: none; touch-action: none; }
.sort-item.picked { outline: 3px solid var(--sc); transform: scale(1.05); }
.sort-item.right { border-color: var(--good); background: var(--good-soft); color: var(--good); cursor: default; }
.sort-item.wrong { animation: shake .4s; border-color: var(--bad); background: var(--bad-soft); }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.sort-buckets { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.bucket { border: 2px dashed var(--line); border-radius: 16px; padding: 10px; min-height: 110px; background: var(--card); transition: border-color .2s, background .2s; }
.bucket.over, .bucket.target { border-color: var(--sc); background: var(--sc-soft); }
.bucket h5 { margin: 0 0 8px; font-family: var(--display); font-size: 16px; text-align: center; color: var(--ink2); }
.bucket .sort-item { display: inline-block; margin: 3px; font-size: 14px; padding: 5px 10px; }
.sort-status { text-align: center; font-weight: 800; margin-top: 10px; color: var(--muted); }

.compare-table { width: 100%; border-collapse: separate; border-spacing: 0; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); font-size: 15.5px; }
.compare-table th { padding: 10px 12px; color: #fff; background: var(--sc); font-family: var(--display); font-size: 17px; text-align: left; }
.compare-table th:nth-child(2) { background: color-mix(in srgb, var(--sc) 70%, #1c2140); }
.compare-table th:nth-child(3) { background: color-mix(in srgb, var(--sc) 50%, #1c2140); }
.compare-table td { padding: 10px 12px; border-top: 1px solid var(--line); background: var(--card); vertical-align: top; }
.compare-table tr:nth-child(even) td { background: var(--card2); }

.reveal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.mini-flip { perspective: 800px; min-height: 110px; cursor: pointer; }
.mini-flip .in { position: relative; width: 100%; height: 100%; min-height: 110px; transition: transform .5s cubic-bezier(.3,1.3,.5,1); transform-style: preserve-3d; }
.mini-flip.flipped .in { transform: rotateY(180deg); }
.mini-flip .f, .mini-flip .b { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 14px; display: grid; place-items: center; text-align: center; padding: 10px 12px; font-weight: 700; font-size: 15.5px; line-height: 1.35; }
.mini-flip .f { background: var(--card); border: 1.5px solid var(--line); box-shadow: var(--shadow-sm); }
.mini-flip .f::after { content: "tap"; position: absolute; bottom: 5px; right: 9px; font-size: 10px; color: var(--muted); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.mini-flip .b { background: var(--sc); color: #fff; transform: rotateY(180deg); font-weight: 600; font-size: 14.5px; }

.steps { counter-reset: st; display: grid; gap: 10px; }
.step { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px; transition: opacity .3s, transform .3s; }
.step.dim { opacity: .35; filter: grayscale(.6); }
.step .num { width: 40px; height: 40px; border-radius: 12px; background: var(--sc); color: #fff; display: grid; place-items: center; font-weight: 800; font-family: var(--display); font-size: 19px; }
.step h4 { margin: 0; font-size: 17px; }
.step p { margin: 2px 0 0; font-size: 15px; color: var(--ink2); }
.step img { width: 96px; height: 72px; object-fit: cover; border-radius: 10px; cursor: zoom-in; }
.steps-ctrl { display: flex; justify-content: center; gap: 8px; margin-top: 10px; }

/* math widgets */
.mw-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.mw-row label { font-weight: 800; font-size: 14px; color: var(--ink2); }
.mw-input { border: 2px solid var(--line); background: var(--card); border-radius: 12px; padding: 9px 12px; font: 700 18px var(--font); color: var(--ink); width: 180px; }
.mw-input.sm { width: 90px; }
.mw-input:focus { outline: none; border-color: var(--sc); box-shadow: 0 0 0 4px var(--sc-soft); }
select.mw-input { width: auto; }
.pv-table { width: 100%; border-collapse: separate; border-spacing: 4px; text-align: center; }
.pv-table th { font-size: 11.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; padding: 4px 2px; line-height: 1.2; }
.pv-table th.period { font-size: 13px; color: #fff; border-radius: 8px; padding: 5px; }
.pv-table td { font-family: var(--display); font-size: 28px; font-weight: 800; background: var(--card); border: 1.5px solid var(--line); border-radius: 10px; padding: 4px 0; min-width: 38px; }
.pv-table td.on { animation: pop .35s; }
@keyframes pop { 50% { transform: scale(1.2); } }
.mw-out { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 17px; margin-top: 10px; }
.mw-out .big { font-family: var(--display); font-size: 30px; font-weight: 800; color: var(--sc); letter-spacing: .02em; }
.mw-steps { margin: 8px 0 0; padding-left: 1.2em; }
.mw-steps li { margin: 4px 0; }
.frac-bar { display: flex; height: 44px; border-radius: 10px; overflow: hidden; border: 2px solid var(--ink2); margin: 6px 0; }
.frac-bar i { flex: 1; border-right: 2px solid var(--ink2); background: var(--card); transition: background .3s; }
.frac-bar i:last-child { border-right: 0; }
.frac-bar i.on { background: var(--sc); }
.frac-label { font-family: var(--display); font-weight: 800; font-size: 20px; }
.dec-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; width: min(320px, 100%); aspect-ratio: 1; border: 2px solid var(--ink2); padding: 2px; border-radius: 8px; background: var(--card); }
.dec-grid i { background: var(--bg2); border-radius: 2px; transition: background .2s; }
.dec-grid i.on { background: var(--sc); }
.col-work { font-family: var(--mono); font-size: 22px; line-height: 1.45; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 18px; display: inline-block; white-space: pre; }
.col-work .carry { color: var(--bad); font-size: 14px; }
.numline { width: 100%; height: auto; }
.tree svg { width: 100%; max-height: 360px; }

/* ---------- key terms ---------- */
.terms-tools { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.search-input { flex: 1; min-width: 200px; border: 1.5px solid var(--line); background: var(--card); border-radius: 14px; padding: 11px 14px; font: 600 16px var(--font); color: var(--ink); }
.search-input:focus { outline: none; border-color: var(--sc); box-shadow: 0 0 0 4px var(--sc-soft); }
.terms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.term { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow-sm); border-left: 5px solid var(--sc); }
.term b { font-family: var(--display); font-size: 19px; display: block; margin-bottom: 2px; }
.term span { color: var(--ink2); font-size: 15.5px; line-height: 1.45; display: block; }
.term.hidden-def span { filter: blur(6px); cursor: pointer; user-select: none; }

/* ---------- flashcards ---------- */
.fc-stage { max-width: 680px; margin: 0 auto; }
.fc-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-weight: 800; color: var(--muted); gap: 10px; flex-wrap: wrap; }
.fc-counts { display: flex; gap: 8px; }
.flashcard { perspective: 1400px; height: 360px; cursor: pointer; user-select: none; }
.flashcard .in { position: relative; width: 100%; height: 100%; transition: transform .6s cubic-bezier(.3,1.25,.5,1); transform-style: preserve-3d; }
.flashcard.flipped .in { transform: rotateY(180deg); }
.flashcard .face { position: absolute; inset: 0; border-radius: 28px; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; box-shadow: var(--shadow-lg); overflow: auto; }
.flashcard .front { background: var(--card); border: 1px solid var(--line); }
.flashcard .front::before { content: ""; position: absolute; inset: 14px; border-radius: 20px; border: 2px dashed color-mix(in srgb, var(--sc) 25%, transparent); pointer-events: none; }
.flashcard .back { background: linear-gradient(145deg, var(--sc), color-mix(in srgb, var(--sc) 55%, #1c2140)); color: #fff; transform: rotateY(180deg); }
.flashcard .face .txt { font-family: var(--display); font-size: clamp(22px, 3.2vw, 32px); font-weight: 700; line-height: 1.25; }
.flashcard .back .txt { font-family: var(--font); font-size: clamp(18px, 2.4vw, 23px); font-weight: 700; }
.flashcard .face img { max-height: 150px; width: auto; border-radius: 14px; margin-bottom: 14px; background: #fff; }
.flashcard .hint { position: absolute; bottom: 16px; font-size: 12.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.flashcard .back .hint { color: rgba(255,255,255,.7); }
.fc-actions { display: flex; justify-content: center; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.fc-anim-left { animation: flyL .35s forwards; }
.fc-anim-right { animation: flyR .35s forwards; }
@keyframes flyL { to { transform: translateX(-60px) rotate(-8deg); opacity: 0; } }
@keyframes flyR { to { transform: translateX(60px) rotate(8deg); opacity: 0; } }
.fc-done { text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 28px; padding: 40px 24px; box-shadow: var(--shadow); }
.kbd-hint { text-align: center; color: var(--muted); font-size: 13px; margin-top: 12px; font-weight: 600; }
kbd { background: var(--card); border: 1px solid var(--line); border-bottom-width: 3px; border-radius: 6px; padding: 0 6px; font-size: 12px; font-family: var(--mono); }

/* ---------- quiz ---------- */
.quiz-stage { max-width: 780px; margin: 0 auto; }
.quiz-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.quiz-progress { flex: 1; height: 12px; background: var(--bg2); border-radius: 99px; overflow: hidden; }
.quiz-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--sc), color-mix(in srgb, var(--sc) 60%, #ff7ab6)); border-radius: 99px; transition: width .4s cubic-bezier(.2,.8,.2,1); }
.quiz-count { font-weight: 800; color: var(--muted); font-size: 15px; white-space: nowrap; }
.streak { font-weight: 800; color: #e8590c; font-size: 15px; white-space: nowrap; }
.q-card { background: var(--card); border: 1px solid var(--line); border-radius: 26px; padding: clamp(20px, 3vw, 32px); box-shadow: var(--shadow); }
.q-type { font-size: 12.5px; font-weight: 800; color: var(--sc); text-transform: uppercase; letter-spacing: .08em; }
.q-text { font-family: var(--display); font-size: clamp(22px, 2.8vw, 28px); font-weight: 700; line-height: 1.3; margin: 6px 0 18px; }
.q-img { max-height: 240px; width: auto; border-radius: 16px; margin: 0 auto 18px; box-shadow: var(--shadow-sm); cursor: zoom-in; background: #fff; }
.options { display: grid; gap: 10px; }
.options.two { grid-template-columns: 1fr 1fr; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 2px solid var(--line); background: var(--card); border-radius: 16px; padding: 13px 16px; font-weight: 700; font-size: 17px; transition: border-color .15s, background .15s, transform .1s; }
.opt:hover:not([disabled]) { border-color: var(--sc); background: var(--sc-soft); }
.opt .letter { flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--bg2); font-weight: 800; font-size: 14px; color: var(--muted); }
.opt.correct { border-color: var(--good); background: var(--good-soft); animation: pop .35s; }
.opt.correct .letter { background: var(--good); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); animation: shake .4s; }
.opt.wrong .letter { background: var(--bad); color: #fff; }
.opt[disabled] { cursor: default; }
.tf-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tf-opts .opt { justify-content: center; font-size: 20px; padding: 20px; }
.fill-row { display: flex; gap: 10px; flex-wrap: wrap; }
.fill-input { flex: 1; min-width: 200px; border: 2px solid var(--line); background: var(--card); border-radius: 16px; padding: 14px 16px; font: 700 20px var(--font); color: var(--ink); }
.fill-input:focus { outline: none; border-color: var(--sc); box-shadow: 0 0 0 4px var(--sc-soft); }
.fill-input.correct { border-color: var(--good); background: var(--good-soft); }
.fill-input.wrong { border-color: var(--bad); background: var(--bad-soft); animation: shake .4s; }
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.match-col { display: grid; gap: 10px; align-content: start; }
.match-item { border: 2px solid var(--line); background: var(--card); border-radius: 14px; padding: 11px 14px; font-weight: 700; font-size: 16px; text-align: left; transition: all .15s; }
.match-item:hover:not([disabled]) { border-color: var(--sc); }
.match-item.sel { border-color: var(--sc); background: var(--sc-soft); }
.match-item.paired { border-color: var(--good); background: var(--good-soft); color: var(--good); }
.match-item.wrong { border-color: var(--bad); animation: shake .4s; }
.order-list { display: grid; gap: 8px; }
.order-item { display: flex; align-items: center; gap: 10px; border: 2px solid var(--line); background: var(--card); border-radius: 14px; padding: 10px 12px; font-weight: 700; font-size: 16px; }
.order-item .pos { width: 28px; height: 28px; border-radius: 9px; background: var(--sc-soft); color: var(--sc); display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; }
.order-item .txt { flex: 1; }
.order-item .mv { border: 1px solid var(--line); background: var(--card2); border-radius: 9px; width: 34px; height: 34px; font-size: 16px; }
.order-item .mv:hover { border-color: var(--sc); }
.order-item.correct { border-color: var(--good); background: var(--good-soft); }
.order-item.wrong { border-color: var(--bad); background: var(--bad-soft); }
.feedback { margin-top: 16px; border-radius: 16px; padding: 14px 16px; font-size: 16px; animation: viewIn .25s; }
.feedback.good { background: var(--good-soft); border: 1.5px solid color-mix(in srgb, var(--good) 40%, transparent); }
.feedback.bad { background: var(--bad-soft); border: 1.5px solid color-mix(in srgb, var(--bad) 40%, transparent); }
.feedback h4 { margin: 0 0 4px; font-size: 19px; }
.feedback.good h4 { color: var(--good); }
.feedback.bad h4 { color: var(--bad); }
.feedback p { margin: 0; color: var(--ink2); }
.q-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.quiz-start { text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 28px; padding: 36px 24px; box-shadow: var(--shadow); }
.quiz-start .big-emoji { font-size: 64px; }
.quiz-start .opts-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 18px 0; }
.result { text-align: center; }
.score-ring { --p: 0; width: 170px; height: 170px; margin: 10px auto 14px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--sc) calc(var(--p) * 1%), var(--bg2) 0); transition: --p 1s; }
.score-ring div { width: 136px; height: 136px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-family: var(--display); font-size: 40px; font-weight: 800; line-height: 1; }
.score-ring small { display: block; font-size: 14px; color: var(--muted); font-family: var(--font); }
.stars-row { font-size: 40px; letter-spacing: 6px; margin-bottom: 8px; }
.stars-row .off { filter: grayscale(1); opacity: .3; }
.review-list { text-align: left; margin-top: 20px; display: grid; gap: 10px; }
.review-item { border: 1px solid var(--line); border-left: 5px solid var(--bad); border-radius: 14px; padding: 12px 14px; background: var(--card); }
.review-item b { display: block; margin-bottom: 4px; }
.review-item .ans { color: var(--good); font-weight: 800; }
.review-item p { margin: 4px 0 0; color: var(--ink2); font-size: 15px; }

/* ---------- exam Q&A ---------- */
.qa-list { display: grid; gap: 12px; }
.qa { background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-sm); overflow: hidden; }
.qa-q { display: flex; gap: 12px; align-items: flex-start; width: 100%; border: 0; background: transparent; text-align: left; padding: 16px 18px; font-weight: 800; font-size: 17px; }
.qa-q .qn { flex: none; min-width: 34px; height: 34px; padding: 0 6px; border-radius: 11px; background: var(--sc-soft); color: var(--sc); display: grid; place-items: center; font-size: 14px; }
.qa-q .qt { flex: 1; line-height: 1.4; }
.qa-q .marks { flex: none; font-size: 12px; font-weight: 800; color: var(--muted); background: var(--bg2); padding: 3px 9px; border-radius: 99px; }
.qa-a { display: none; padding: 0 18px 16px 64px; color: var(--ink2); font-size: 16.5px; }
.qa.open .qa-a { display: block; animation: viewIn .25s; }
.qa.open .qa-q .qn { background: var(--sc); color: #fff; }
.qa-self { display: flex; gap: 8px; margin-top: 10px; }
.qa.got { border-left: 5px solid var(--good); }
.qa.again { border-left: 5px solid var(--warn); }

/* ---------- lightbox, search, toast, confetti ---------- */
.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(10,12,30,.86); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; animation: viewIn .2s; }
.lightbox img { max-width: 94vw; max-height: 84vh; border-radius: 14px; background: #fff; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.lightbox p { color: #fff; margin-top: 12px; font-weight: 700; text-align: center; }
.search-panel { position: fixed; inset: 0; z-index: 150; background: rgba(10,12,30,.45); backdrop-filter: blur(4px); display: flex; justify-content: center; padding: 80px 16px 16px; }
.search-box { width: min(680px, 100%); background: var(--card); border-radius: 22px; box-shadow: var(--shadow-lg); overflow: hidden; display: flex; flex-direction: column; max-height: 76vh; animation: viewIn .2s; }
.search-box input { border: 0; border-bottom: 1px solid var(--line); padding: 18px 20px; font: 700 19px var(--font); background: transparent; color: var(--ink); outline: none; }
.search-results { overflow: auto; padding: 8px; }
.search-results a { display: block; padding: 10px 12px; border-radius: 12px; text-decoration: none; }
.search-results a:hover, .search-results a.sel { background: var(--bg2); }
.search-results a b { display: block; font-size: 15.5px; }
.search-results a small { color: var(--muted); font-weight: 600; font-size: 13px; }
.search-results .empty { padding: 20px; text-align: center; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 300; background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 14px; font-weight: 800; box-shadow: var(--shadow-lg); animation: toastIn .3s; }
@keyframes toastIn { from { transform: translate(-50%, 20px); opacity: 0; } }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 400; width: 100%; height: 100%; }

.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: 22px; }
.empty-state .big-emoji { font-size: 56px; }
.note-box { background: var(--warn-soft); border-radius: 16px; padding: 12px 16px; font-size: 15px; color: var(--ink2); margin-bottom: 16px; }
.rich { font-size: 17px; }
.rich ul { padding-left: 1.3em; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .learn-wrap { grid-template-columns: 1fr; }
  .toc { position: static; max-height: none; display: flex; overflow-x: auto; gap: 4px; padding: 6px; }
  .toc button { flex: none; width: auto; }
  .toc button .t { display: none; }
  .concept-media.split { grid-template-columns: 1fr; }
  .chapter-head { grid-template-columns: 1fr; }
  .chapter-head .hero-img { width: 100%; height: 160px; }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  .hide-sm { display: none; }
  .brand-text small { display: none; }
  .options.two, .match-grid { grid-template-columns: 1fr; }
  .tl-item { grid-template-columns: 1fr; }
  .tl-item img { width: 100%; height: 140px; }
  .step { grid-template-columns: 40px 1fr; }
  .step img { grid-column: 1 / -1; width: 100%; height: 140px; }
  .flashcard { height: 320px; }
  .qa-a { padding-left: 18px; }
  .tabs { top: 60px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* keep grid children from forcing horizontal overflow */
.learn-wrap > *, .concept-media > *, .concept-host, .hero > *, .chapter-head > * { min-width: 0; }
.widget, .mw-out, .svg-box { max-width: 100%; overflow-x: auto; }
body { overflow-x: hidden; }
.pv-table th .sm { display: none; }
@media (max-width: 700px) { .pv-table th .lg { display: none; } .pv-table th .sm { display: inline; font-size: 13px; } .pv-table td { font-size: 22px; min-width: 26px; } .pv-table th.period { font-size: 11px; padding: 4px 2px; } .pv-table { border-spacing: 2px; } }
.passage { background: var(--card2); border: 1px solid var(--line); border-left: 5px solid var(--sc); border-radius: 14px; padding: 12px 16px; font-size: 16px; line-height: 1.6; max-height: 260px; overflow: auto; margin: 8px 0 12px; color: var(--ink2); }
.mini-flip.has-img, .mini-flip.has-img .in { min-height: 150px; }
figure.fig img { max-height: min(400px, 48vh); }

/* ================= v2: game layer & kid-friendly UI ================= */
.xp-pill { border: 0; cursor: pointer; font: inherit; font-weight: 800; font-size: 14px; }
.level-strip { display: flex; align-items: center; gap: 14px; margin-top: 18px; padding: 12px 16px; border-radius: 18px; text-decoration: none; color: #fff;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28); transition: background .2s, transform .2s; max-width: 560px; }
.level-strip:hover { background: rgba(255,255,255,.22); transform: translateY(-2px); }
.lv-ic { font-size: 40px; line-height: 1; filter: drop-shadow(0 4px 8px rgba(0,0,0,.25)); }
.lv-txt { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lv-txt b { font-family: var(--display); font-size: 20px; line-height: 1.1; }
.lv-txt small { opacity: .9; font-weight: 700; font-size: 13px; }
.lv-meta { font-size: 13px; font-weight: 800; line-height: 1.5; text-align: right; white-space: nowrap; }
.lv-bar { display: block; height: 9px; background: rgba(255,255,255,.25); border-radius: 99px; overflow: hidden; margin-top: 4px; }
.lv-bar i { display: block; height: 100%; background: linear-gradient(90deg, #ffe066, #ffa94d); border-radius: 99px; transition: width .8s cubic-bezier(.2,.8,.2,1); }
.lv-bar.big { height: 14px; max-width: 520px; }
.mini-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.mini-stats div { background: var(--bg2); border-radius: 14px; padding: 8px 12px; }
.mini-stats b { font-family: var(--display); font-size: 26px; display: block; line-height: 1.1; }
.mini-stats span { font-size: 12.5px; color: var(--muted); font-weight: 700; }

.ollie { display: flex; gap: 10px; align-items: flex-end; margin: 10px 0; text-align: left; }
.ollie.center { justify-content: center; }
.ollie-av { font-size: 38px; line-height: 1; flex: none; animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px) rotate(-4deg); } }
.ollie .bubble { position: relative; background: var(--sc-soft); color: var(--ink); border-radius: 16px 16px 16px 4px; padding: 10px 14px; font-size: 15px; font-weight: 600; line-height: 1.45; max-width: 520px; }
.ollie.sm .ollie-av { font-size: 30px; }
.ollie.sm .bubble { font-size: 14px; }
.countdown .ollie { margin-top: auto; }
.ollie-line { margin-top: 6px !important; font-weight: 700; color: var(--ink) !important; }

.mission-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.mission { position: relative; display: flex; gap: 14px; align-items: center; text-decoration: none; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 16px;
  box-shadow: var(--shadow-sm); transition: transform .2s, box-shadow .2s; overflow: hidden; }
.mission::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--c, var(--sc)); }
.mission:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.m-num { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 22px; color: #fff; background: var(--c, var(--sc)); box-shadow: 0 6px 14px -6px var(--c, var(--sc)); }
.m-body { flex: 1; min-width: 0; }
.m-sub { font-size: 12.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.mission h3 { font-size: 18px; margin: 2px 0 4px; }
.m-step { font-size: 14.5px; font-weight: 700; color: var(--ink2); }
.m-go { flex: none; font-weight: 800; color: var(--c, var(--sc)); font-size: 15px; }
.mission.side { --c: #e8590c; background: linear-gradient(135deg, var(--card), color-mix(in srgb, #e8590c 8%, var(--card))); }
.mission.side .m-num { font-size: 24px; }
.mission.calm { --c: #2f9e44; }

.parent-box { margin-top: 34px; background: var(--card2); border: 1px dashed var(--line); border-radius: 18px; padding: 12px 16px; }
.parent-box summary { cursor: pointer; font-weight: 800; color: var(--muted); font-size: 15px; }
.parent-box[open] summary { margin-bottom: 12px; }
.parent-hint { color: var(--muted); font-size: 13.5px; margin: 12px 0 0; }
.hero-info.plain > div { background: var(--card); border-color: var(--line); color: var(--ink2); }

.celebrate { position: fixed; inset: 0; z-index: 350; display: grid; place-items: center; background: rgba(10,12,30,.55); backdrop-filter: blur(4px); padding: 20px; animation: viewIn .25s; }
.celebrate-card { background: var(--card); border-radius: 28px; padding: 32px 28px; text-align: center; max-width: 380px; box-shadow: var(--shadow-lg); animation: popIn .5s cubic-bezier(.3,1.6,.5,1); }
@keyframes popIn { from { transform: scale(.6); opacity: 0; } }
.cel-icon { font-size: 84px; line-height: 1; margin-bottom: 8px; animation: wiggle 1.2s ease-in-out infinite; }
@keyframes wiggle { 25% { transform: rotate(-8deg) scale(1.05); } 75% { transform: rotate(8deg) scale(1.05); } }
.celebrate-card h2 { font-size: 26px; }
.celebrate-card p { color: var(--ink2); }

.trophy-hero { background: linear-gradient(135deg, #f59f00, #e8590c 60%, #c2255c); }
.trophy-hero .lv-bar { background: rgba(255,255,255,.3); }
.level-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.lvl { flex: none; width: 118px; text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 12px 8px; opacity: .45; filter: grayscale(.8); }
.lvl.on { opacity: 1; filter: none; }
.lvl.cur { border: 2px solid var(--sc); box-shadow: 0 8px 20px -10px var(--sc); transform: translateY(-3px); }
.lvl .i { font-size: 34px; }
.lvl b { display: block; font-family: var(--display); font-size: 15px; }
.lvl small { color: var(--muted); font-weight: 700; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.badge { text-align: center; background: var(--card2); border: 1px dashed var(--line); border-radius: 20px; padding: 16px 10px; color: var(--muted); }
.badge.won { background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-sm); color: var(--ink); }
.b-ic { font-size: 42px; line-height: 1.1; margin-bottom: 6px; }
.badge:not(.won) .b-ic { filter: grayscale(1); opacity: .6; }
.badge b { display: block; font-family: var(--display); font-size: 17px; }
.badge small { font-size: 13px; line-height: 1.35; display: block; margin-top: 2px; }

.subj-progress { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.subj-progress .lv-bar { flex: 1; min-width: 180px; margin: 0; background: rgba(255,255,255,.25); }
.subj-progress span { font-weight: 800; font-size: 15px; }
.c-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.c-stars { font-size: 15px; letter-spacing: 1px; }
.c-stars .off, .stars-row .off { filter: grayscale(1); opacity: .28; }
.c-next { font-size: 13px; font-weight: 800; color: var(--sc); }
.chap-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; }
.chap-nav a { flex: 0 1 48%; text-decoration: none; font-weight: 800; font-size: 14.5px; color: var(--ink2); background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; }
.chap-nav a:last-child { text-align: right; }
.chap-nav a:hover { border-color: var(--sc); color: var(--sc); }

details.objectives { margin-top: 10px; }
details.objectives summary { cursor: pointer; font-weight: 800; font-size: 14.5px; color: var(--sc); list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.objectives summary::-webkit-details-marker { display: none; }
details.objectives summary::after { content: "▾"; font-size: 12px; transition: transform .2s; }
details.objectives[open] summary::after { transform: rotate(180deg); }
details.objectives > div { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
details.objectives span { font-size: 13.5px; font-weight: 700; padding: 4px 11px; border-radius: 99px; background: var(--sc-soft); color: var(--sc); }
.tab .mark { margin-left: 5px; font-size: 12px; }
.tab.done:not(.active) { color: var(--good); }

.linkish { background: none; border: 0; padding: 0; color: var(--sc); font-weight: 800; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.fill-help { margin-top: 10px; font-size: 15px; color: var(--ink2); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.self-box { text-align: center; background: var(--card2); border: 1px dashed var(--line); border-radius: 18px; padding: 18px; }
.self-ans { font-size: 28px; font-weight: 800; color: var(--sc); margin-bottom: 6px; }
.helper { color: var(--muted); font-size: 14px; font-weight: 600; margin: 8px 0; }
.new-best { font-weight: 800; color: #e8590c; font-size: 18px; }
.stars-row span.pop { display: inline-block; animation: starPop .6s cubic-bezier(.3,1.8,.5,1) both; }
@keyframes starPop { from { transform: scale(0) rotate(-90deg); opacity: 0; } }
.qa-state { flex: none; font-size: 16px; }
.qa-sum { color: var(--muted); font-weight: 800; font-size: 14px; }
.tag.chk { cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.tag.chk input { accent-color: #fff; width: 16px; height: 16px; }
.term.hidden-def { cursor: pointer; }
.finish-card .ollie { margin: 14px auto; }
@media (max-width: 600px) {
  .lv-meta { display: none; }
  .mission-grid { grid-template-columns: 1fr; }
  .chap-nav { flex-direction: column; }
  .chap-nav a { flex-basis: auto; text-align: left !important; }
}
.tipline { background: var(--sc-soft); border-radius: 14px; padding: 10px 14px; font-size: 15px; line-height: 1.5; color: var(--ink2); margin: 12px 0; text-align: left; }
.tipline.center { max-width: 560px; margin: 14px auto; text-align: center; }
.countdown .tipline { margin-top: auto; }
.mission .m-num { font-size: 24px; }
figure.svg-box { margin: 0; } .svg-box figcaption { font-size: 14px; color: var(--muted); text-align: center; padding-top: 8px; font-weight: 600; }

/* audio */
.listen-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.listen-row span { color: var(--muted); font-size: 14px; font-weight: 600; }
.audio-bar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 120; display: flex; align-items: center; gap: 8px;
  background: var(--ink); color: var(--bg); border-radius: 18px; padding: 8px 10px; box-shadow: var(--shadow-lg); width: min(560px, calc(100vw - 24px)); animation: toastIn .25s; }
.audio-bar button { border: 0; background: rgba(255,255,255,.12); color: inherit; border-radius: 12px; height: 38px; min-width: 38px; padding: 0 10px; font-weight: 800; font-size: 15px; }
.audio-bar button:hover { background: rgba(255,255,255,.22); }
.audio-bar .ab-play { background: var(--sc); color: #fff; min-width: 46px; font-size: 17px; }
.ab-txt { flex: 1; min-width: 0; line-height: 1.2; }
.ab-txt small { display: block; font-size: 11px; font-weight: 800; opacity: .7; text-transform: uppercase; letter-spacing: .06em; }
.ab-txt b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
:root[data-theme="dark"] .audio-bar { background: #eef0ff; color: #1c2140; }
:root[data-theme="dark"] .audio-bar button { background: rgba(0,0,0,.08); }
body { padding-bottom: 20px; }
