/* Dodo Study — fresh green & light theme */
:root {
  --bg: #f2f8f1;
  --surface: #ffffff;
  --surface-2: #eaf5ea;
  --text: #17301f;
  --muted: #5b7263;
  --line: #d6e8d6;
  --accent: #16a34a;
  --accent-strong: #15803d;
  --accent-ink: #ffffff;
  --accent-soft: #dcfce7;
  --sun: #f5b400;
  --sun-soft: #fff4cc;
  --good: #16a34a;
  --good-soft: #dcfce7;
  --bad: #dc2626;
  --bad-soft: #fee2e2;
  --warn: #c2700a;
  --warn-soft: #fef3c7;
  --hero-1: #22c55e;
  --hero-2: #0f9f6e;
  --shadow: 0 1px 2px rgba(22, 60, 35, .05), 0 6px 18px rgba(22, 60, 35, .07);
  --radius: 18px;
  --tabbar-h: 66px;
  --font: "Nunito", ui-rounded, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Arabic", sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1a13; --surface: #16241b; --surface-2: #1f3226; --text: #e6f2e9; --muted: #9bb5a3;
  --line: #2a4233; --accent: #34d399; --accent-strong: #10b981; --accent-ink: #052e1a; --accent-soft: #134e33;
  --sun: #facc15; --sun-soft: #3d330b;
  --good: #4ade80; --good-soft: #14432a; --bad: #f87171; --bad-soft: #4a1d1d; --warn: #fbbf24; --warn-soft: #43320b;
  --hero-1: #15803d; --hero-2: #065f46; --shadow: none; color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #0f1a13; --surface: #16241b; --surface-2: #1f3226; --text: #e6f2e9; --muted: #9bb5a3;
    --line: #2a4233; --accent: #34d399; --accent-strong: #10b981; --accent-ink: #052e1a; --accent-soft: #134e33;
    --sun: #facc15; --sun-soft: #3d330b;
    --good: #4ade80; --good-soft: #14432a; --bad: #f87171; --bad-soft: #4a1d1d; --warn: #fbbf24; --warn-soft: #43320b;
    --hero-1: #15803d; --hero-2: #065f46; --shadow: none; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--font);
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-strong); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
[hidden] { display: none !important; }

/* ---------- top bar & tabs ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 11px; background: linear-gradient(135deg, var(--hero-1), var(--hero-2)); color: #fff; display: grid; place-items: center; font-weight: 900; box-shadow: 0 3px 0 var(--accent-strong); }
.sync-status { font-size: .78rem; color: var(--muted); font-weight: 600; }
.gear { text-decoration: none; font-size: 1.2rem; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; }
.gear:hover { background: var(--surface-2); }

main { max-width: 760px; margin: 0 auto; padding: 8px 16px 16px; outline: none; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 6px 8px env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(22, 60, 35, .05);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: .7rem; font-weight: 700; color: var(--muted); text-decoration: none; border-radius: 14px; transition: background .15s; }
.tabbar a .ti { font-size: 1.3rem; line-height: 1.1; filter: grayscale(.9); opacity: .7; transition: transform .15s; }
.tabbar a span:last-child { white-space: nowrap; }
.tabbar a.active { color: var(--accent-strong); background: var(--accent-soft); }
.tabbar a.active .ti { filter: none; opacity: 1; transform: translateY(-1px) scale(1.08); }

/* ---------- building blocks ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card.tight { padding: 12px 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }
.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid > .card { margin-bottom: 0; }
@media (max-width: 340px) { .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 24px 0 10px; }
.section-title h2 { margin: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 10px 18px;
  border-radius: 14px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; text-decoration: none; color: var(--text); font-weight: 800;
  box-shadow: 0 3px 0 var(--line); transition: transform .06s, box-shadow .06s, background .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 0 var(--accent-strong); }
.btn.primary:hover { filter: brightness(1.05); background: var(--accent); }
.btn.primary:active:not(:disabled) { box-shadow: 0 1px 0 var(--accent-strong); transform: translateY(3px); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.danger { color: var(--bad); }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: .875rem; border-radius: 11px; box-shadow: 0 2px 0 var(--line); }
.btn.primary.sm { box-shadow: 0 2px 0 var(--accent-strong); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); color: var(--text);
}
textarea { resize: vertical; min-height: 46px; }
label.field { display: block; }
label.field > span { display: block; font-size: .85rem; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible, button:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }

.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.stat .v { font-size: 1.55rem; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .l { font-size: .78rem; font-weight: 600; color: var(--muted); }
@media (max-width: 420px) { .stat { padding: 10px; } .stat .v { font-size: 1.3rem; } }

.progress { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--c, var(--accent)); border-radius: 99px; transition: width .5s; }

.pill { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: .75rem; font-weight: 800; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.accent { background: var(--accent-soft); color: var(--accent-strong); }
.pill.sun { background: var(--sun-soft); color: #8a6300; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list a.item { display: flex; align-items: center; gap: 12px; width: 100%; color: var(--text); text-decoration: none; }

.empty { text-align: center; padding: 24px 10px; color: var(--muted); }
.banner { padding: 12px 14px; border-radius: 14px; background: var(--warn-soft); color: var(--text); margin-bottom: 14px; font-size: .9rem; }
.banner.info { background: var(--accent-soft); }
.back-link { display: flex; width: fit-content; align-items: center; gap: 4px; margin: 4px 0 10px; text-decoration: none; font-weight: 800; color: var(--accent-strong); }

/* ---------- home: hero, mission, goal, badges ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 24px; padding: 18px; color: #fff; margin-bottom: 14px;
  background: radial-gradient(circle at 85% 15%, rgba(255,255,255,.22) 0 60px, transparent 61px), linear-gradient(135deg, var(--hero-1), var(--hero-2));
  box-shadow: 0 10px 24px rgba(22, 120, 60, .25);
}
.hero h1 { color: #fff; margin: 0; font-size: 1.5rem; }
.hero .sub { opacity: .92; font-weight: 600; margin: 2px 0 12px; }
.hero .chips { display: flex; gap: 8px; flex-wrap: wrap; }
.hero .chip { background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.3); padding: 4px 10px; border-radius: 99px; font-weight: 800; font-size: .85rem; }
.hero .xpline { margin-top: 12px; }
.hero .xpline .progress { background: rgba(255,255,255,.25); height: 12px; }
.hero .xpline .progress > i { background: var(--sun); }
.hero .xpline .small { opacity: .95; font-weight: 700; margin-top: 4px; }
.goal-ring {
  --p: 0; flex: none; width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--sun) calc(var(--p) * 1%), rgba(255,255,255,.25) 0);
}
.goal-ring > div { width: 60px; height: 60px; border-radius: 50%; background: var(--hero-2); display: grid; place-items: center; text-align: center; line-height: 1.05; font-weight: 900; font-size: .95rem; }
.goal-ring > div small { display: block; font-size: .62rem; font-weight: 700; opacity: .9; }

.mission {
  display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 2px solid var(--accent); border-radius: 20px; padding: 14px 16px; margin-bottom: 14px;
  box-shadow: 0 4px 0 var(--accent-strong);
}
.mission:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--accent-strong); }
.mission .m-icon { font-size: 2rem; width: 52px; height: 52px; border-radius: 16px; background: var(--accent-soft); display: grid; place-items: center; flex: none; }
.mission .m-label { font-size: .75rem; font-weight: 900; color: var(--accent-strong); text-transform: uppercase; letter-spacing: .06em; }
.mission .m-title { font-weight: 800; font-size: 1.05rem; }
.mission .go { flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 1.2rem; font-weight: 900; }

.section-card { display: block; text-decoration: none; color: var(--text); margin-bottom: 0; position: relative; overflow: hidden; padding: 16px; }
.section-card::after { content: ""; position: absolute; right: -24px; bottom: -24px; width: 90px; height: 90px; border-radius: 50%; background: var(--c); opacity: .12; }
.section-card h2 { margin: 8px 0 2px; }
.section-card p { margin: 0; }
.sc-icon { font-size: 1.6rem; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 16%, transparent); }

.badges { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 420px) { .badges { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.badge { text-align: center; font-size: .68rem; font-weight: 700; color: var(--muted); line-height: 1.2; }
.badge .b-icon { width: 52px; height: 52px; margin: 0 auto 4px; border-radius: 50%; display: grid; place-items: center; font-size: 1.5rem; background: var(--sun-soft); border: 2px solid var(--sun); }
.badge.locked .b-icon { background: var(--surface-2); border-color: var(--line); filter: grayscale(1); opacity: .45; }
.badge.locked { opacity: .8; }

.subject-tile { display: block; text-decoration: none; color: var(--text); position: relative; overflow: hidden; }
.subject-tile .icon { font-size: 1.6rem; width: 50px; height: 50px; border-radius: 15px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 15%, transparent); flex: none; }

/* ---------- lesson ---------- */
.stepper { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0 16px; }
.stepper a, .stepper span { display: flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; color: var(--muted); font-size: .72rem; font-weight: 800; text-align: center; }
.stepper .dot { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 1.1rem; background: var(--surface); border: 2px solid var(--line); }
.stepper .done .dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.stepper .done { color: var(--accent-strong); }
.points { margin: 0; padding-left: 1.2rem; }
.points li { margin: 0 0 9px; }
.points li:last-child { margin-bottom: 0; }
.points li::marker { color: var(--accent); }
.example { border-left: 5px solid var(--accent); }
.example .ex-problem { font-weight: 800; margin: 4px 0 10px; white-space: pre-wrap; }
.ex-steps { margin: 0 0 10px; padding-left: 1.4rem; }
.ex-steps li { margin-bottom: 6px; padding: 8px 12px; background: var(--surface-2); border-radius: 12px; animation: pop .25s ease-out; }
.ex-steps li::marker { font-weight: 900; color: var(--accent-strong); }
.ex-answer { padding: 10px 12px; border-radius: 12px; background: var(--good-soft); margin-bottom: 4px; animation: pop .25s ease-out; }
.tips { border-left: 5px solid var(--sun); background: color-mix(in srgb, var(--sun-soft) 45%, var(--surface)); }
.status-dot { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: .85rem; font-weight: 900; }
.status-dot.started { border-color: var(--accent); background: var(--accent-soft); }
.status-dot.done { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- quiz & test ---------- */
.q-text { font-size: 1.15rem; font-weight: 800; margin-bottom: 14px; white-space: pre-wrap; }
.choices { display: grid; gap: 10px; }
.choice {
  text-align: left; padding: 12px 14px; min-height: 52px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); cursor: pointer;
  display: flex; gap: 12px; align-items: center; font-weight: 600; box-shadow: 0 3px 0 var(--line); transition: transform .06s, box-shadow .06s;
}
.choice:hover:not(:disabled) { border-color: var(--accent); }
.choice:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.choice .k { flex: none; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); font-weight: 900; font-size: .85rem; }
.choice.correct { border-color: var(--good); background: var(--good-soft); box-shadow: 0 3px 0 var(--good); animation: pop .25s ease-out; }
.choice.correct .k { background: var(--good); color: #fff; }
.choice.wrong { border-color: var(--bad); background: var(--bad-soft); box-shadow: 0 3px 0 var(--bad); animation: shake .3s; }
.choice.wrong .k { background: var(--bad); color: #fff; }
.choice.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 3px 0 var(--accent-strong); }
.choice.selected .k { background: var(--accent); color: var(--accent-ink); }
.choice:disabled { cursor: default; }
.explain { margin-top: 14px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); }
.qbar { display: flex; gap: 4px; margin-bottom: 14px; }
.qbar i { flex: 1; height: 10px; border-radius: 99px; background: var(--surface-2); }
.qbar i.ok { background: var(--good); }
.qbar i.no { background: var(--bad); }
.qbar i.cur { background: var(--sun); }
.big-score { font-size: 3rem; font-weight: 900; text-align: center; font-variant-numeric: tabular-nums; color: var(--accent-strong); }
.grade-badge { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 900; font-size: 1.15rem; background: var(--surface-2); }
.grade-badge.good { background: var(--good-soft); color: var(--good); }
.grade-badge.warn { background: var(--warn-soft); color: var(--warn); }
.grade-badge.bad { background: var(--bad-soft); color: var(--bad); }
.grade-badge.big { width: 68px; height: 68px; font-size: 2.1rem; border-radius: 20px; }
.xp-earned { display: inline-block; margin-top: 8px; padding: 6px 14px; border-radius: 99px; background: var(--sun-soft); color: #8a6300; font-weight: 900; }
details.topic-tests { border-top: 1px solid var(--line); padding-top: 8px; }
details > summary { cursor: pointer; padding: 8px 0; font-weight: 800; color: var(--accent-strong); }
.test-head { position: sticky; top: calc(54px + env(safe-area-inset-top)); z-index: 5; display: flex; align-items: center; gap: 10px; padding: 8px 0; background: var(--bg); }
.timer { font-variant-numeric: tabular-nums; font-size: .9rem; padding: 5px 12px; }
.timer.bad { background: var(--bad-soft); color: var(--bad); }
.qdots { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.qdots button { width: 34px; height: 34px; border-radius: 10px; border: 2px solid var(--line); background: var(--surface); font-size: .8rem; font-weight: 800; cursor: pointer; padding: 0; }
.qdots button.ans { background: var(--accent-soft); border-color: var(--accent); }
.qdots button.cur { outline: 3px solid var(--sun); outline-offset: 1px; }

/* ---------- flashcards ---------- */
.flash { perspective: 1000px; cursor: pointer; user-select: none; }
.flash-inner { position: relative; min-height: 240px; transition: transform .45s; transform-style: preserve-3d; }
.flash.flipped .flash-inner { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 24px; border-radius: 24px; border: 2px solid var(--line); background: var(--surface); box-shadow: 0 6px 0 var(--line); font-size: 1.2rem; font-weight: 700; white-space: pre-wrap;
}
.flash-face.back { transform: rotateY(180deg); background: var(--accent-soft); border-color: var(--accent); box-shadow: 0 6px 0 var(--accent); }

/* ---------- tutor ---------- */
.chat { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 18px; line-height: 1.55; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; }
.msg.assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; box-shadow: var(--shadow); }
.msg img { max-width: 100%; border-radius: 12px; display: block; margin-bottom: 6px; }
.msg p:last-child { margin-bottom: 0; }
.msg ul, .msg ol { margin: 0 0 .6rem; padding-left: 1.3rem; }
.msg code { background: var(--surface-2); padding: 1px 5px; border-radius: 6px; }
.composer { position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 8px); display: flex; gap: 8px; align-items: flex-end; background: var(--bg); padding-top: 6px; }
.composer textarea { flex: 1; max-height: 160px; }
.attach-preview { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.attach-preview img { height: 56px; border-radius: 10px; }
.typing { display: inline-flex; gap: 4px; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }

/* ---------- dashboard ---------- */
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 140px; padding-top: 8px; }
.bars .b { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.bars .b i { display: block; width: 100%; max-width: 34px; border-radius: 8px 8px 3px 3px; background: linear-gradient(var(--hero-1), var(--accent-strong)); min-height: 3px; }
.bars .b span { font-size: .72rem; font-weight: 700; color: var(--muted); }
.bars .b em { font-style: normal; font-size: .72rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.task-done .grow { text-decoration: line-through; color: var(--muted); }
.check { width: 26px; height: 26px; flex: none; accent-color: var(--accent); }
.pin-input { letter-spacing: .5em; text-align: center; font-size: 1.4rem; max-width: 220px; margin: 0 auto; display: block; }

/* ---------- feedback: toast, xp pop, confetti ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px); transform: translateX(-50%) translateY(20px); z-index: 30;
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 16px; font-size: .92rem; font-weight: 700; opacity: 0; pointer-events: none; transition: .25s; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.xp-pop { position: fixed; z-index: 40; pointer-events: none; font-weight: 900; color: #8a6300; background: var(--sun-soft); border: 2px solid var(--sun); padding: 4px 12px; border-radius: 99px; animation: xp-float 1s ease-out forwards; }
.confetti { position: fixed; inset: 0; z-index: 50; pointer-events: none; }

@keyframes pop { 0% { transform: scale(.96); opacity: .4; } 100% { transform: scale(1); opacity: 1; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@keyframes xp-float { 0% { transform: translate(-50%, 0) scale(.8); opacity: 0; } 20% { transform: translate(-50%, -8px) scale(1.05); opacity: 1; } 100% { transform: translate(-50%, -48px) scale(1); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- lesson show (narrated slides) & videos ---------- */
.media { margin-bottom: 14px; }
.media-card { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); margin: 0; padding: 10px; text-align: left; cursor: pointer; font: inherit; width: 100%; }
.media-card:hover { border-color: var(--accent); }
.m-thumb { position: relative; flex: none; width: 92px; aspect-ratio: 16 / 10; border-radius: 12px; background: #0f3d26 center / cover no-repeat; display: grid; place-items: center; overflow: hidden; }
.m-thumb.show { background: linear-gradient(135deg, var(--hero-1), var(--hero-2)); font-size: 1.6rem; }
.m-thumb:not(.show) span { width: 34px; height: 34px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; font-size: .9rem; padding-left: 2px; }
.video-frame { position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #000; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.player { border-radius: 24px; overflow: hidden; color: #fff; margin-bottom: 12px; background: radial-gradient(circle at 90% 0%, rgba(250,204,21,.18) 0 90px, transparent 91px), linear-gradient(160deg, #14532d, #0b3b22); box-shadow: 0 12px 28px rgba(10, 60, 30, .3); }
.stage { min-height: 340px; padding: 24px 22px 16px; display: flex; flex-direction: column; justify-content: center; animation: slidein .35s ease-out; }
.stage .s-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: #bbf7d0; font-weight: 900; }
.stage .s-body { font-size: 1.35rem; font-weight: 800; line-height: 1.4; margin-top: 8px; }
.stage .s-body strong { color: #fde68a; }
.stage .big-emoji { font-size: 3.4rem; line-height: 1; margin-bottom: 10px; }
.stage .s-problem { font-size: .95rem; font-weight: 700; padding: 10px 12px; background: rgba(255,255,255,.1); border-radius: 12px; margin: 8px 0 10px; }
.stage .s-steps, .stage .s-tips { margin: 0; padding-left: 1.3rem; }
.stage .s-steps li, .stage .s-tips li { margin-bottom: 8px; opacity: .65; }
.stage .s-tips li { opacity: 1; font-weight: 700; }
.stage .s-steps li.now { opacity: 1; font-weight: 800; color: #fef08a; font-size: 1.1rem; animation: pop .3s ease-out; }
.stage .s-answer { background: #facc15; color: #3a2a00; padding: 12px 14px; border-radius: 14px; font-weight: 900; font-size: 1.15rem; animation: pop .3s ease-out; }
.stage .s-hint { margin-top: 14px; font-weight: 800; color: #fde68a; }
.p-bar { display: flex; gap: 2px; padding: 0 16px 10px; }
.p-bar i { flex: 1; height: 5px; border-radius: 3px; background: rgba(255,255,255,.2); }
.p-bar i.on { background: #facc15; }
.p-ctrl { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 6px 14px 18px; }
.p-ctrl button { width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 1.15rem; cursor: pointer; }
.p-ctrl button:disabled { opacity: .35; cursor: default; }
.p-ctrl button.play { width: 66px; height: 66px; background: #facc15; color: #3a2a00; font-size: 1.6rem; box-shadow: 0 4px 0 #b88a00; }
.p-ctrl button.play:active { transform: translateY(3px); box-shadow: 0 1px 0 #b88a00; }
.p-ctrl .spd { width: auto; padding: 0 14px; border-radius: 99px; font-size: .85rem; font-weight: 900; }
@keyframes slidein { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
