/* QuantaPrism Code. Same friendly look as kids.quantaprism.com. Mobile first: works from 360 px. */
@font-face {
  font-family: "CodeSans";
  src: url("fonts/NotoSans-SemiBold-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --paper: #fff6e6;
  --paper-2: #ffeccc;
  --card: #ffffff;
  --ink: #2b2240;
  --ink-soft: #6a5f7d;
  --accent: #e0563f;
  --accent-dark: #b83e2a;
  --sun: #ffd54a;
  --sky: #3f8fe0;
  --sky-dark: #2a6db3;
  --leaf: #2f9e6b;
  --leaf-dark: #23784f;
  --plum: #7a4fb5;
  --line: #f0dcb8;
  --ok-bg: #e2f6ea;
  --ok-ink: #1f6e47;
  --try-bg: #fff0d6;
  --try-ink: #8a5a00;
  --bad-bg: #fde8e4;
  --bad-ink: #9b2c1a;
  --focus: #1d5fd1;
  --shadow: 0 6px 20px rgba(80, 50, 10, .12);
  --radius: 22px;
  --gutter: 16px;
  --track: var(--accent);
  --code-font: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", "Droid Sans Mono", monospace;
  --code-size: 19px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "CodeSans", "Noto Sans", system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.5;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-dark); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
p { margin: 0 0 .8em; }
code { font-family: var(--code-font); font-size: .92em; background: var(--paper-2); color: #6b2a8f; padding: 1px 6px; border-radius: 6px; white-space: pre-wrap; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 14px; border-radius: 10px; z-index: 10; }
.skip:focus { left: 8px; }
:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; border-radius: 8px; }
main:focus { outline: none; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- header and footer ---- */
.top { background: var(--paper-2); border-bottom: 3px solid var(--line); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 15px; line-height: 1.15; }
.brand img { width: 40px; height: 40px; }
.brand b { color: var(--accent); display: block; font-size: 20px; }
.toplink { font-size: 16px; color: var(--plum); font-weight: 700; text-decoration: none; padding: 8px 14px; border: 2px solid var(--plum); border-radius: 999px; white-space: nowrap; }
.toplink:hover { background: #f3ecfb; }
.foot { margin-top: 40px; padding: 24px 0 32px; color: var(--ink-soft); font-size: 15px; border-top: 3px solid var(--line); }
.loading { padding: 48px var(--gutter); text-align: center; color: var(--ink-soft); }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 10px 22px; border: 0; border-radius: 999px; font: inherit; font-weight: 800; font-size: 19px; cursor: pointer; text-decoration: none; color: #fff; background: var(--sky); box-shadow: 0 4px 0 var(--sky-dark); transition: transform .08s, box-shadow .08s; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--sky-dark); }
.btn.go { background: var(--leaf); box-shadow: 0 4px 0 var(--leaf-dark); }
.btn.go:active { box-shadow: 0 1px 0 var(--leaf-dark); }
.btn.warm { background: var(--accent); box-shadow: 0 4px 0 var(--accent-dark); }
.btn.soft { background: var(--card); color: var(--ink); box-shadow: 0 4px 0 var(--line); border: 2px solid var(--line); }
.btn.small { min-height: 42px; font-size: 16px; padding: 6px 16px; }
.btn[disabled] { opacity: .55; cursor: wait; }
.btn .tri { width: 0; height: 0; border-left: 14px solid currentColor; border-top: 9px solid transparent; border-bottom: 9px solid transparent; }
.btnrow { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 14px 0 4px; }

/* ---- home ---- */
.hero { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: center; padding: 26px 0 8px; text-align: center; }
.hero h1 { font-size: clamp(32px, 7vw, 54px); color: var(--accent); }
.hero p { font-size: clamp(18px, 3.4vw, 23px); color: var(--ink-soft); max-width: 680px; margin: 0 auto; }
.hero-pals { display: flex; justify-content: center; gap: 0; margin-top: 10px; }
.hero-pals img { width: 74px; height: 74px; border-radius: 50%; border: 4px solid #fff; box-shadow: var(--shadow); margin-left: -12px; background: var(--paper-2); }
.hero-pals img:first-child { margin-left: 0; }
.tracks { display: grid; grid-template-columns: 1fr; gap: 16px; padding: 18px 0 8px; list-style: none; margin: 0; }
@media (min-width: 620px) { .tracks { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; } }
@media (min-width: 980px) { .tracks { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; } }
.track { position: relative; display: flex; gap: 14px; align-items: center; height: 100%; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; padding: 16px; border: 3px solid transparent; border-top: 10px solid var(--tc, var(--accent)); transition: transform .12s, border-color .12s; }
.track:hover { transform: translateY(-3px); border-color: var(--sun); border-top-color: var(--tc, var(--accent)); }
.track .pal { flex: 0 0 auto; width: 92px; height: 92px; border-radius: 50%; overflow: hidden; border: 4px solid var(--tc); background: var(--paper-2); }
.track .pal img { width: 100%; height: 100%; object-fit: cover; }
.track-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.track-name { font-size: 23px; font-weight: 800; color: var(--tc); line-height: 1.15; }
.track-about { font-size: 15.5px; color: var(--ink-soft); line-height: 1.4; }
.track-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 15px; font-weight: 700; }
.bar { flex: 1 1 80px; height: 10px; background: var(--paper-2); border-radius: 99px; overflow: hidden; min-width: 70px; }
.bar i { display: block; height: 100%; background: var(--tc, var(--leaf)); border-radius: 99px; }

.panel { margin: 26px 0 0; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; border-top: 8px solid var(--plum); }
.panel h2 { color: var(--plum); font-size: 24px; }
.panel.sun { border-top-color: var(--sun); }
.panel.sun h2 { color: var(--try-ink); }
.note { font-size: 15px; color: var(--ink-soft); }

/* ---- stars ---- */
.stars { display: inline-flex; gap: 2px; vertical-align: middle; }
.star { width: 22px; height: 22px; display: inline-block; background: #e9dcc3; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.star.on { background: #ffb400; }
.stars.big .star { width: 34px; height: 34px; }
.star.pop { animation: pop .5s ease-out; }
@keyframes pop { 0% { transform: scale(.3); } 60% { transform: scale(1.35); } 100% { transform: scale(1); } }

/* ---- track page ---- */
.track-head { display: flex; gap: 16px; align-items: center; padding: 22px 0 6px; }
.track-head .pal { width: 110px; height: 110px; border-radius: 50%; overflow: hidden; border: 5px solid var(--track); flex: 0 0 auto; box-shadow: var(--shadow); }
.track-head .pal img { width: 100%; height: 100%; object-fit: cover; }
.track-head h1 { color: var(--track); font-size: clamp(28px, 6vw, 44px); margin: 0; }
.track-head p { margin: 4px 0 0; color: var(--ink-soft); }
.lessons { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 12px; }
.lesson-link { display: flex; align-items: center; gap: 14px; background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 14px 16px; color: var(--ink); text-decoration: none; border: 3px solid transparent; }
.lesson-link:hover { border-color: var(--sun); }
.lesson-num { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 20px; color: #fff; background: var(--track); }
.lesson-link.done .lesson-num { background: var(--leaf); }
.lesson-title { flex: 1 1 auto; font-weight: 800; font-size: 19px; line-height: 1.25; }

/* ---- lesson page ---- */
.crumbs { padding: 14px 0 0; font-size: 16px; }
.crumbs a { font-weight: 700; color: var(--track); text-decoration: none; }
.lesson-top { display: flex; gap: 14px; align-items: flex-end; margin: 10px 0 14px; }
.lesson-top .pal { width: 96px; height: 96px; border-radius: 50%; overflow: hidden; border: 5px solid var(--track); flex: 0 0 auto; box-shadow: var(--shadow); background: var(--paper-2); }
.lesson-top .pal img { width: 100%; height: 100%; object-fit: cover; }
.bubble { position: relative; background: var(--card); border-radius: 20px; padding: 12px 16px; box-shadow: var(--shadow); font-size: 17px; margin-bottom: 10px; }
.bubble::before { content: ""; position: absolute; left: -12px; bottom: 16px; border: 8px solid transparent; border-right: 12px solid var(--card); border-left: 0; }
.lesson-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.lesson-h h1 { font-size: clamp(26px, 5.5vw, 40px); color: var(--track); margin: 0; }
.lesson-h .count { color: var(--ink-soft); font-weight: 700; font-size: 16px; }

.cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; border-top: 8px solid var(--track); min-width: 0; }
.card h2 { font-size: 24px; display: flex; align-items: center; gap: 10px; }
.card h2 .dot { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-size: 18px; background: var(--track); flex: 0 0 auto; }
.card.learn { border-top-color: var(--sun); }
.card.learn h2 .dot { background: #e0a400; }
.card.try { border-top-color: var(--sky); }
.card.try h2 .dot { background: var(--sky); }
.card.turn { border-top-color: var(--leaf); }
.card.turn h2 .dot { background: var(--leaf); }
.learn p { font-size: 19px; }
.task { font-size: 20px; background: var(--try-bg); border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; }

.editor { border: 3px solid var(--line); border-radius: 18px; overflow: hidden; background: #fffdf7; min-height: 120px; }
.editor .cm-editor { max-height: 460px; }
.out { margin-top: 12px; }
.out-label { font-size: 15px; font-weight: 800; color: var(--ink-soft); margin: 0 0 4px; text-transform: uppercase; letter-spacing: .04em; }
.console { font-family: var(--code-font); font-size: 17px; background: #231b33; color: #f6f0ff; border-radius: 16px; padding: 12px 14px; min-height: 56px; max-height: 320px; overflow: auto; white-space: pre-wrap; word-break: break-word; margin: 0; }
.console .err { color: #ffb3a6; }
.console .dim { color: #b8a9d6; font-style: italic; }
.preview { width: 100%; height: 260px; border: 3px solid var(--line); border-radius: 16px; background: #fff; display: block; }

.result { border-radius: 16px; padding: 12px 16px; margin-top: 12px; font-size: 18px; }
.result.ok { background: var(--ok-bg); color: var(--ok-ink); font-weight: 700; }
.result.bad { background: var(--bad-bg); color: var(--bad-ink); }
.result pre { font-family: var(--code-font); font-size: 15px; background: rgba(255,255,255,.7); border-radius: 10px; padding: 6px 10px; margin: 4px 0 8px; white-space: pre-wrap; color: var(--ink); }
.hints { margin-top: 10px; }
.hint { background: #f3ecfb; border-left: 6px solid var(--plum); border-radius: 12px; padding: 10px 14px; margin: 8px 0 0; font-size: 17px; }
.hint pre { font-family: var(--code-font); margin: 4px 0 0; white-space: pre-wrap; }

.status { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; color: var(--ink-soft); background: var(--paper-2); border-radius: 999px; padding: 6px 14px; }
.status .led { width: 12px; height: 12px; border-radius: 50%; background: #e0a400; }
.status.ready .led { background: var(--leaf); }
.status.busy .led { animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* terminal */
.term-card { border-top-color: #231b33; }
.term-card h2 .dot { background: #231b33; }
.term-wrap { background: #1d1530; border-radius: 16px; padding: 8px; }
.term { height: 360px; }
.term .xterm { height: 100%; }
.term .xterm-viewport, .term .xterm-screen, .term .xterm { background: #1d1530 !important; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 4px; }
.chip { font-family: var(--code-font); font-size: 17px; font-weight: 700; border: 0; border-radius: 14px; padding: 10px 14px; background: #231b33; color: #b6f7c9; cursor: pointer; box-shadow: 0 4px 0 #0f0a1a; text-align: left; }
.chip::before { content: "$ "; color: #7fd1ff; }
.chip:active { transform: translateY(3px); box-shadow: 0 1px 0 #0f0a1a; }

.next-row { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 12px; margin: 22px 0 0; }

@media (min-width: 1000px) {
  .cols.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); grid-template-areas: "learn term" "try term" "turn term"; align-items: start; }
  .cols.two .a-learn { grid-area: learn; }
  .cols.two .a-try { grid-area: try; }
  .cols.two .a-turn { grid-area: turn; }
  .cols.two .a-term { grid-area: term; align-self: start; }
  .cols.two .sticky { position: sticky; top: 12px; }
  .term { height: 430px; }
}

/* celebration */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 20; }
.confetti i { position: absolute; top: -20px; width: 12px; height: 16px; border-radius: 3px; animation: fall 1.6s ease-in forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }

@media (max-width: 480px) {
  :root { --code-size: 17px; }
  body { font-size: 17px; }
  .learn p { font-size: 18px; }
  .card { padding: 14px; }
  .lesson-top .pal { width: 78px; height: 78px; }
  .track .pal { width: 78px; height: 78px; }
  .term { height: 320px; }
  .brand span span { display: none; }
  .brand b { font-size: 18px; }
  .track-head .pal { width: 84px; height: 84px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
.narrow { max-width: 940px; margin: 0 auto; }

/* ---------- "Page looks old? Get the newest version" (js/fresh.js) ---------- */
.fresh-link { background: none; border: 0; padding: 8px 0; margin: 0; font: inherit; font-size: 15px; color: var(--ink-soft); text-decoration: underline; cursor: pointer; min-height: 44px; }
.fresh-link:hover { color: var(--ink); }
dialog.fresh { width: min(580px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow: auto; border: 0; border-radius: 26px; padding: 22px 20px 18px; background: var(--card); color: var(--ink); box-shadow: 0 20px 50px rgba(0, 0, 0, .3); font: inherit; line-height: 1.45; }
dialog.fresh::backdrop { background: rgba(43, 34, 64, .45); }
.fresh h2 { margin: 0 40px 8px 0; font-size: 24px; line-height: 1.2; }
.fresh h3 { margin: 18px 0 6px; font-size: 19px; }
.fresh h4 { margin: 10px 0 2px; font-size: 16px; color: var(--plum); }
.fresh p { margin: 6px 0; }
.fresh ol { margin: 2px 0 6px; padding-left: 24px; }
.fresh li { margin: 3px 0; }
.fresh-x { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--line); background: var(--card); color: var(--ink); font-size: 26px; line-height: 1; cursor: pointer; }
.fresh-go { display: flex; width: 100%; align-items: center; justify-content: center; min-height: 60px; margin: 14px 0 6px; padding: 10px 22px; border: 0; border-radius: 999px; background: var(--leaf); color: #fff; font: inherit; font-weight: 800; font-size: 21px; cursor: pointer; box-shadow: 0 4px 0 var(--leaf-dark); }
.fresh-go:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--leaf-dark); }
.fresh-go[disabled] { opacity: .6; cursor: wait; }
.fresh-bar { height: 12px; border-radius: 999px; background: var(--paper-2, #ffeccc); overflow: hidden; margin: 8px 0 2px; }
.fresh-bar i { display: block; height: 100%; width: 0; background: var(--sun); }
.fresh-bar[hidden] { display: none; }
.fresh-status { min-height: 1.45em; font-weight: 800; }
.fresh-status.ok { color: var(--ok-ink, #1f6e47); }
.fresh-status.bad { color: var(--accent-dark); }
.fresh-hand { border-top: 3px solid var(--line); margin-top: 12px; }
.fresh-group { background: var(--paper); border-radius: 16px; padding: 4px 14px 6px; margin: 8px 0; }
.fresh-note { font-size: 15px; color: var(--ink-soft); }
.fresh-note.warn { background: var(--try-bg, #fff0d6); color: var(--try-ink, #8a5a00); border-radius: 12px; padding: 8px 12px; }
.fresh-close { display: block; margin: 12px auto 0; min-height: 44px; padding: 6px 22px; border-radius: 999px; border: 3px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 800; font-size: 16px; cursor: pointer; }
.fresh-toast { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); background: var(--ok-bg, #e2f6ea); color: var(--ok-ink, #1f6e47); border: 3px solid var(--leaf); border-radius: 18px; padding: 10px 18px; font-weight: 800; z-index: 60; box-shadow: var(--shadow); transition: opacity .5s; text-align: center; }
.fresh-toast.gone { opacity: 0; }

/* ---------- Compare languages (js/compare.js) ---------- */
.compare-track { background: linear-gradient(135deg, #fff 60%, #f3ecfb); }
.cmp-pal { display: grid !important; grid-template-columns: 1fr 1fr; place-items: center; padding: 10px; font-family: var(--code-font); font-weight: 800; font-size: 17px; background: #fff !important; }
.cmp-pal span:nth-child(1) { color: #3f8fe0; }
.cmp-pal span:nth-child(2) { color: #2f9e6b; }
.cmp-pal span:nth-child(3) { color: #0f9bb5; }
.cmp-pal span:nth-child(4) { color: #a77d00; }
.cmp-head { padding: 12px 0 4px; }
.cmp-head h1 { color: var(--track); font-size: clamp(28px, 6vw, 44px); margin: 0 0 6px; }
.cmp-head p { color: var(--ink-soft); max-width: 820px; }
.cmp-progs { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 4px; }
.cmp-prog { display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 6px 16px 6px 6px; border-radius: 999px; background: var(--card); color: var(--ink); text-decoration: none; font-weight: 800; font-size: 16px; border: 3px solid var(--line); box-shadow: 0 3px 0 var(--line); }
.cmp-prog:hover { border-color: var(--sun); }
.cmp-prog.on { border-color: var(--track); background: #f3ecfb; }
.cmp-prog-n { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--track); color: #fff; font-size: 15px; }
.cmp-prog-card { border-top-color: var(--track); }
.cmp-prog-card h2 { color: var(--track); }
.cmp-expect { max-width: 520px; }
.cmp-toggles { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.cmp-toggles-label { font-weight: 800; color: var(--ink-soft); font-size: 15px; }
.cmp-toggle { font: inherit; font-size: 15px; font-weight: 800; min-height: 40px; padding: 4px 14px; border-radius: 999px; border: 3px solid var(--lc); background: #fff; color: var(--ink-soft); cursor: pointer; }
.cmp-toggle[aria-pressed="true"] { background: var(--lc); color: #fff; }
.cmp-explain { position: sticky; top: 0; z-index: 5; margin: 18px 0 12px; background: #fffdf7; border: 3px solid var(--line); border-radius: 18px; padding: 10px 14px; box-shadow: var(--shadow); }
.cmp-explain-text { margin: 0 0 8px; font-size: 17px; min-height: 3em; } /* fixed height: the code under the mouse must not move */
.cmp-idea-name { background: var(--ic); padding: 1px 8px; border-radius: 8px; }
.cmp-legend { display: flex; flex-wrap: wrap; gap: 6px; }
.cmp-idea { font: inherit; font-size: 14px; font-weight: 800; min-height: 34px; padding: 2px 12px; border-radius: 999px; border: 2px solid rgba(0,0,0,.12); background: var(--ic); color: var(--ink); cursor: pointer; }
.cmp-idea[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink) inset; }
.cmp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; align-items: start; }
.cmp-lang { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; border-top: 8px solid var(--lc); min-width: 0; }
.cmp-lang-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.cmp-lang h3 { color: var(--lc); font-size: 22px; margin: 0; filter: brightness(.85); }
.cmp-lines { font-size: 14px; font-weight: 800; color: var(--ink-soft); white-space: nowrap; }
.cmp-how { font-size: 14px; color: var(--ink-soft); margin: 2px 0 8px; }
.cmp-code { counter-reset: ln; font-family: var(--code-font); font-size: 14.5px; line-height: 1.55; background: #fffdf7; border: 3px solid var(--line); border-radius: 14px; padding: 8px 8px 8px 0; margin: 0; white-space: pre-wrap; word-break: break-word; tab-size: 4; -moz-tab-size: 4; color: #2b2240; }
.cmp-code .ln { display: block; position: relative; padding: 0 6px 0 calc(40px + 2ch); text-indent: -2ch; border-radius: 6px; min-height: 1.55em; }
.cmp-code .ln::before { counter-increment: ln; content: counter(ln); position: absolute; left: 0; text-indent: 0; width: 30px; text-align: right; color: #a8987a; font-size: 13px; }
.cmp-code .ln.tagged { cursor: pointer; }
.cmp-code .ln.tagged:hover { background: #fff3db; }
.cmp-code .ln.hl, .cmp-code .ln.hl:hover { background: var(--ic); box-shadow: inset 4px 0 0 rgba(43,34,64,.55); }
.cmp-cards.focus .ln:not(.hl) { opacity: .6; }
.k-kw { color: #7a2fb5; font-weight: 700; }
.k-str { color: #1f7a3a; }
.k-num { color: #b5521b; }
.k-fn { color: #1d5fd1; }
.k-meta { color: #0f7c8c; }
.cmp-out { font-size: 15px; min-height: 40px; }
.cmp-badge { margin: 6px 0 0; font-weight: 800; font-size: 15px; border-radius: 10px; padding: 4px 10px; display: inline-block; }
.cmp-badge.ok { background: var(--ok-bg); color: var(--ok-ink); }
.cmp-badge.ok::before { content: "\2713  "; }
.cmp-badge.bad { background: var(--bad-bg); color: var(--bad-ink); }
.cmp-readonly { background: var(--try-bg); color: var(--try-ink); border-radius: 12px; padding: 8px 12px; font-size: 15px; margin: 12px 0 0; }
.cmp-learn { margin: 10px 0 0; font-size: 15px; font-weight: 800; }
.cmp-learn a { color: var(--ink); }
.cmp-lang .btnrow { margin-top: 10px; }
.cmp-jsbox { position: absolute; left: -9999px; top: 0; width: 10px; height: 10px; border: 0; }
.cmp-count, .cmp-all, .cmp-quiz { margin-top: 22px; border-top-color: var(--track); }
.cmp-bars { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.cmp-bars li { display: grid; grid-template-columns: 150px 1fr 36px; gap: 10px; align-items: center; font-weight: 800; font-size: 16px; }
.cmp-bar { height: 16px; background: var(--paper-2); border-radius: 99px; overflow: hidden; }
.cmp-bar i { display: block; height: 100%; background: var(--lc); border-radius: 99px; }
.cmp-bar-n { text-align: right; }
.cmp-table-wrap { overflow-x: auto; border-radius: 14px; border: 3px solid var(--line); }
.cmp-table { border-collapse: collapse; width: 100%; min-width: 900px; font-size: 15px; }
.cmp-table th, .cmp-table td { padding: 8px 10px; border-bottom: 2px solid var(--line); text-align: left; vertical-align: top; }
.cmp-table thead th { color: #fff; background: var(--lc, var(--plum)); font-size: 16px; }
.cmp-table thead th:first-child { background: var(--paper-2); }
.cmp-table tbody th { background: var(--paper); font-size: 15px; width: 150px; position: sticky; left: 0; }
.cmp-table tr:last-child td, .cmp-table tr:last-child th { border-bottom: 0; }
.cmp-q { border: 3px solid var(--line); border-radius: 16px; margin: 0 0 12px; padding: 8px 14px 10px; }
.cmp-q legend { font-weight: 800; padding: 0 6px; font-size: 18px; }
.cmp-a { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 17px; cursor: pointer; border-radius: 10px; padding: 2px 6px; }
.cmp-a:hover { background: var(--paper); }
.cmp-a input { width: 22px; height: 22px; accent-color: var(--plum); flex: 0 0 auto; }
.cmp-quiz-result:empty { display: none; }
.cmp-quiz-result { border-radius: 16px; padding: 12px 16px; margin-top: 12px; }
.cmp-quiz-result.ok { background: var(--ok-bg); }
.cmp-quiz-result.ok h3 { color: var(--ok-ink); font-size: 22px; }
.cmp-quiz-result.bad { background: var(--bad-bg); color: var(--bad-ink); font-weight: 700; }
.cmp-swipe { margin: 0 0 6px; }
@media (max-width: 699px) {
  .cmp-cards { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px; padding: 4px 2px 12px; margin: 0 calc(-1 * var(--gutter)); padding-left: var(--gutter); padding-right: var(--gutter); scroll-padding: 0 var(--gutter); }
  .cmp-lang { flex: 0 0 86%; scroll-snap-align: start; }
  .cmp-bars li { grid-template-columns: 110px 1fr 30px; font-size: 15px; }
  .cmp-table { min-width: 760px; font-size: 14px; }
  .cmp-table tbody th { width: 110px; }
  .cmp-explain { padding: 8px 10px; }
  .cmp-explain-text { font-size: 15px; min-height: 4.5em; }
  .cmp-code { font-size: 13px; tab-size: 2; -moz-tab-size: 2; }
  .cmp-code .ln { padding-left: calc(30px + 2ch); }
  .cmp-code .ln::before { width: 22px; font-size: 12px; }
  .cmp-toggle { min-height: 36px; font-size: 14px; padding: 2px 11px; }
  .cmp-prog { font-size: 15px; min-height: 42px; }
  .cmp-legend { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .cmp-idea { flex: 0 0 auto; }
}
.source-offer a { overflow-wrap: anywhere; }

/* The free part: courses that open with a membership (js/app.js locked) */
.lock-badge { background: #fff3c4; color: #6b4e00; border-radius: 999px; padding: 2px 10px; font-size: 14px; }
.track.locked .pal img { filter: grayscale(0.35); }
.lessons.locked .lesson-link { opacity: 0.75; cursor: default; }
.locked-panel h2 { margin-top: 0; }

/* ---- narration (js/narration.js, same as the AI Lab): speaker buttons, the text being read, the "Read to me" switch ---- */
/* The button is 44 px to tap but takes only a 26 px line: it never pushes the lines apart. */
.nar-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: -9px -6px -9px 2px; padding: 0; border: 0; background: none; color: var(--sky-dark); cursor: pointer; vertical-align: middle; flex: none; border-radius: 50%; -webkit-tap-highlight-color: transparent; }
.nar-btn svg { width: 32px; height: 32px; padding: 5px; border-radius: 50%; background: #e3effc; }
.nar-btn:hover svg, .nar-btn[data-nar-reading] svg { background: var(--sky); color: #fff; }
.nar-btn:focus-visible { outline-offset: -4px; border-radius: 50%; }
[data-nar-host] { position: relative; }
.nar-btn.nar-corner { position: absolute; right: 6px; bottom: 5px; margin: 0; }
.nar-btn.nar-corner svg { background: #e3effc; box-shadow: 0 0 0 3px var(--card); }
.tracks [data-nar-host] .track-meta { padding-right: 40px; }
[data-nar-on] { background-color: #fff3bf; box-shadow: 0 0 0 4px #fff3bf; border-radius: 8px; transition: background-color .25s, box-shadow .25s; }
.bubble[data-nar-on], .task[data-nar-on] { box-shadow: var(--shadow), 0 0 0 4px #fff3bf; }
.nar-switch { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; min-height: 44px; padding: 4px 10px 4px 8px; border: 3px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); font: inherit; font-weight: 800; font-size: 15px; cursor: pointer; white-space: nowrap; }
.nar-switch svg { width: 24px; height: 24px; flex: none; color: var(--ink-soft); }
.nar-switch i { position: relative; width: 34px; height: 20px; flex: none; border-radius: 999px; background: #d9cdb6; }
.nar-switch i::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.nar-switch[aria-checked="true"] { border-color: var(--leaf); background: var(--ok-bg); color: var(--ok-ink); }
.nar-switch[aria-checked="true"] svg { color: var(--leaf-dark); }
.nar-switch[aria-checked="true"] i { background: var(--leaf); }
.nar-switch[aria-checked="true"] i::after { transform: translateX(14px); }
/* phone: no room for the words; the speaker and the small switch stay */
/* the teacher (js/narration.js): Pause next to the switch, "Start with the teacher", the gentle pulse
   on what the teacher waits for (a still ring with reduced motion) */
.nar-pause { position: fixed; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 40; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 6px 16px 6px 12px; border: 3px solid var(--line); border-radius: 999px; background: var(--card); box-shadow: var(--shadow); color: var(--ink); font: inherit; font-weight: 800; font-size: 16px; cursor: pointer; white-space: nowrap; }
.nar-pause[hidden] { display: none; }
.nar-pause svg { width: 22px; height: 22px; flex: none; }
.nar-pause svg + svg { margin-left: -4px; }
.nar-pause[aria-pressed="true"] { border-color: var(--sky); color: var(--sky-dark); }
.teach-start { display: flex; align-items: center; justify-content: center; gap: 12px; width: min(100% - 32px, 520px); min-height: 64px; margin: 16px auto 4px; padding: 12px 26px; border: 0; border-radius: 999px; background: var(--leaf); box-shadow: 0 5px 0 var(--leaf-dark); color: #fff; font: inherit; font-weight: 800; font-size: 22px; line-height: 1.2; cursor: pointer; }
.teach-start svg { width: 30px; height: 30px; flex: none; }
.teach-start:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--leaf-dark); }
[data-teach-cue] { outline: 4px solid rgba(255, 184, 0, .95); outline-offset: 3px; animation: teach-cue 1.6s ease-in-out infinite; }
@keyframes teach-cue { 50% { outline-color: rgba(255, 184, 0, .2); outline-offset: 7px; } }
@media (max-width: 519px) { .nar-pause-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .nar-pause { padding: 6px 12px; } }
@media (max-width: 519px) { .nar-switch-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .top-in { gap: 8px; } }
@media (prefers-reduced-motion: reduce) { [data-nar-on], .nar-switch i::after { transition: none; } [data-teach-cue] { animation: none; } }
