/* Pixel Trail: a trail-map look. Warm paper, ink outlines, hard pixel shadows. */
:root {
  --paper: #f7f1e1;
  --paper-2: #efe6cf;
  --card: #fffdf6;
  --ink: #2b2350;
  --ink-2: #5d5780;
  --line: #2b2350;
  --accent: #c43f29;
  --accent-ink: #ffffff;
  --sun: #f4cf49;
  --ok: #1d7a4b;
  --warn: #a8560c;
  --bad: #b3261e;
  --road-high: #2e8b57;
  --road-wild: #c9741b;
  --road-star: #b0379c;
  --road-mind: #2277b3;
  --shadow: 3px 3px 0 var(--line);
  --code-bg: #1f1b3a;
  --code-fg: #f2eefc;
  --code-gutter: #181430;
  --code-number: #9e97c9;
  --code-select: #4a4180;
  --font-display: 'Jersey 25', ui-monospace, Menlo, monospace;
  --font-body: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-code: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']):not([data-theme='contrast']) {
    --paper: #17142c; --paper-2: #211d3c; --card: #231f40; --ink: #f4efff; --ink-2: #b8b2d6; --line: #0a0818;
    --ok: #62d596; --warn: #f0b264; --bad: #ff8f85; --road-high: #55c98a; --road-wild: #eb9c47; --road-star: #e36ad0; --road-mind: #62b6ee;
    --shadow: 3px 3px 0 #0a0818;
  }
}

:root[data-theme='dark'] {
    --paper: #17142c; --paper-2: #211d3c; --card: #231f40; --ink: #f4efff; --ink-2: #b8b2d6; --line: #0a0818;
    --ok: #62d596; --warn: #f0b264; --bad: #ff8f85; --road-high: #55c98a; --road-wild: #eb9c47; --road-star: #e36ad0; --road-mind: #62b6ee;
    --shadow: 3px 3px 0 #0a0818;
  }
:root[data-theme='contrast'] {
  --paper: #ffffff; --paper-2: #e8e8e8; --card: #ffffff; --ink: #000000; --ink-2: #1f1f1f; --line: #000000;
  --accent: #a31f0b; --ok: #0a5a32; --warn: #6e3700; --bad: #8a120a;
  --road-high: #0f5c33; --road-wild: #7a4100; --road-star: #7c1f6d; --road-mind: #0e4d7a;
}
:root[data-theme='dark'] .topbar { background: #0d0b1f; color: var(--ink); }
:root[data-theme='dark'] .tab[aria-selected='true'] { background: var(--sun); color: #2b2350; }

html[data-editor='day'] { --code-bg: #fdfaf0; --code-fg: #1d1a33; --code-gutter: #efe9d8; --code-number: #5f5a78; --code-select: #cfe0ff; --t-keyword: #a01668; --t-def: #0b5f92; --t-variable: #1d1a33; --t-variable-2: #254a78; --t-property: #2f6a14; --t-number: #8a4b00; --t-string: #0f6b3f; --t-comment: #5f5a78; --t-operator: #1d1a33; --t-atom: #8a4b00; }
html[data-editor='soft'] { --code-bg: #2e3440; --code-fg: #e5e9f0; --code-gutter: #272c36; --code-number: #a3adbf; --code-select: #4c566a; --t-keyword: #c8a4d6; --t-def: #9ccfe0; --t-variable: #e5e9f0; --t-variable-2: #c6d6e8; --t-property: #b6d3a0; --t-number: #e8c78e; --t-string: #b6d3a0; --t-comment: #a3adbf; --t-operator: #e5e9f0; --t-atom: #e8c78e; }
html[data-editor='contrast'] { --code-bg: #000000; --code-fg: #ffffff; --code-gutter: #000000; --code-number: #ffffff; --code-select: #0a4aa8; --t-keyword: #ffb3e6; --t-def: #9fe8ff; --t-variable: #ffffff; --t-variable-2: #ffffff; --t-property: #c9ff9e; --t-number: #ffe27a; --t-string: #a6ffca; --t-comment: #d7d7d7; --t-operator: #ffffff; --t-atom: #ffe27a; }

html { font-size: calc(100% * var(--ui-scale, 1)); }
:root[data-spacing='wide'] body { line-height: 1.9; word-spacing: .12em; letter-spacing: .02em; }
:root[data-font='lexend'] { --font-body: 'Lexend', 'Atkinson Hyperlegible', system-ui, sans-serif; }
:root[data-font='system'] { --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif; }
:root[data-font='rounded'] { --font-body: 'Comic Sans MS', 'Comic Neue', 'Chalkboard SE', 'Lexend', sans-serif; }
:root[data-plain-headings] { --font-display: var(--font-body); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1.0625rem/1.5 var(--font-body); }
h1, h2 { font-family: var(--font-display); line-height: 1.05; margin: 0; font-weight: 400; letter-spacing: .01em; }
h3 { font-family: var(--font-body); line-height: 1.2; margin: 0; font-weight: 700; }
h1 { font-size: 2.7rem; }
h2 { font-size: 1.85rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
a { color: inherit; }
img { max-width: 100%; }
code { font-family: var(--font-code); font-size: .88em; background: var(--paper-2); padding: 1px 5px; border-radius: 3px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.muted { color: var(--ink-2); }
.small { font-size: .88rem; }
.mono { font-family: var(--font-code); font-size: .88rem; }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.tight { gap: 6px; }
.narrow { max-width: 1000px; margin: 0 auto; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.eyebrow { font-size: .82rem; letter-spacing: .03em; color: var(--ink-2); font-weight: 700; }
.lede { font-size: 1.15rem; }

.demo-banner { background: var(--sun); color: #2b2350; text-align: center; font-size: .85rem; padding: 3px 12px; }
.demo-banner > a.btn { margin-left: 10px; }
.topbar { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; padding: 8px 18px; background: var(--ink); color: var(--paper); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']):not([data-theme='contrast']) .topbar { background: #0d0b1f; color: var(--ink); } }
.brand { font: 400 1.8rem/1 var(--font-display); text-decoration: none; color: var(--sun); }
.navs { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.nav { padding: 5px 11px; text-decoration: none; border-radius: 3px; }
.nav:hover { background: rgba(255, 255, 255, .13); }
.nav[aria-current='page'] { background: var(--sun); color: #2b2350; font-weight: 700; }
.who { display: flex; gap: 10px; align-items: center; font-size: .92rem; }
.mini-av { height: 32px; image-rendering: pixelated; }
.topbar .btn { color: #2b2350; background: #fffdf6; }
.page { padding: 22px; max-width: 1240px; margin: 0 auto; }
body.in-workspace .page { max-width: none; padding: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 700 .95rem var(--font-body); padding: 7px 14px; border: 2px solid var(--line); border-radius: 3px; background: var(--card); color: var(--ink); box-shadow: 2px 2px 0 var(--line); cursor: pointer; text-decoration: none; }
.btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--line); }
.btn:active { transform: translate(2px, 2px); box-shadow: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.run { background: #16794a; color: #fff; }
.btn.danger { background: var(--bad); color: #fff; }
.btn.big { font-size: 1.08rem; padding: 10px 20px; align-self: flex-start; }
.btn.small { font-size: .82rem; padding: 3px 8px; box-shadow: 1px 1px 0 var(--line); }
.btn.link { background: none; border: 0; box-shadow: none; text-decoration: underline; padding: 2px; font-weight: 400; align-self: flex-start; }
.btn[aria-pressed='true'] { background: var(--sun); color: #2b2350; }

.guide { display: flex; flex-direction: column; gap: 8px; border-color: var(--ink); }
.guide h2 { font-size: 1.5rem; }
.guide p { margin: 0; max-width: 62ch; }
.guide-dots { list-style: none; display: flex; gap: 6px; margin: 0; padding: 0; }
.guide-dots li { width: 26px; height: 26px; display: grid; place-items: center; border: 2px solid var(--line); border-radius: 50%; font-size: .8rem; font-weight: 700; color: var(--ink-2); }
.guide-dots li.done { background: var(--ok, #1f7a4d); border-color: var(--ok, #1f7a4d); color: #fff; }
.guide-dots li.now { border-color: var(--ink); color: var(--ink); background: var(--sun); }
.card { background: var(--card); border: 2px solid var(--line); border-radius: 4px; box-shadow: var(--shadow); padding: 18px; }
input, textarea, select { font: inherit; color: var(--ink); background: var(--card); border: 2px solid var(--line); border-radius: 3px; padding: 7px 10px; max-width: 100%; }
textarea { width: 100%; }
.field { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: .92rem; }
.field input, .field textarea, .field select { font-weight: 400; font-size: 1rem; }
.field.small { font-size: .85rem; }
.tag { display: inline-block; font-size: .78rem; background: var(--paper-2); border: 1px solid var(--line); padding: 0 7px; margin: 0 4px 4px 0; border-radius: 3px; }
.needs-now { margin: 4px 0 0; font-size: .95rem; color: var(--ink-2); }
.needs-now a { font-weight: 700; }
.subtabs { display: flex; gap: 6px; margin: -6px 0 14px; flex-wrap: wrap; }
.subtabs a { font: 700 .88rem var(--font-body); padding: 4px 12px; border: 2px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--ink); }
.subtabs a[aria-current='page'] { background: var(--sun); color: #2b2350; border-color: #2b2350; }
.class-setting { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.class-setting > div { flex: 1 1 320px; }
.class-setting + .class-setting { border-top: 2px solid var(--paper-2); padding-top: 12px; }
.class-setting h3 { font-size: 1.05rem; }
.class-setting p { margin: 2px 0 0; max-width: 56ch; }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tab { font: 700 .95rem var(--font-body); padding: 7px 14px; border: 2px solid transparent; border-bottom: 0; background: none; color: var(--ink); cursor: pointer; text-decoration: none; }
.tab[aria-selected='true'] { background: var(--line); color: var(--paper); border-radius: 3px 3px 0 0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']):not([data-theme='contrast']) .tab[aria-selected='true'] { background: var(--sun); color: #2b2350; } }

/* Login */
.login { display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; max-width: 1100px; margin: 0 auto; padding: 36px 22px; align-items: start; }
.login-hero h1 { font-size: 5rem; color: var(--accent); }
.login-hero .lede { margin: 12px 0 26px; max-width: 30em; }
.trail-art { display: flex; gap: 8px; align-items: flex-end; padding: 18px; background: var(--paper-2); border-bottom: 8px solid var(--road-high); flex-wrap: wrap; }
.trail-art img { image-rendering: pixelated; }
.demo-students { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.demo-student { display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: 2px solid transparent; border-radius: 3px; font: inherit; font-size: .82rem; color: var(--ink); padding: 4px; cursor: pointer; }
.demo-student:hover { border-color: var(--line); background: var(--paper-2); }
.demo-student img { image-rendering: pixelated; height: 48px; }

.login-single { max-width: 560px; margin: 0 auto; padding: 48px 22px; }
.boot { padding: 24px; }

/* Student home */
.home { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
.home > .hero-card { grid-row: span 3; }
.hero-card { display: flex; flex-direction: column; gap: 12px; }
.hero-info { display: flex; flex-direction: column; gap: 7px; align-items: flex-start; }
.avatar-big { image-rendering: pixelated; width: 100%; max-width: 280px; display: block; background: var(--paper-2); border: 2px solid var(--line); }
.game-name { font-style: italic; }
.rank { font: 400 1.6rem var(--font-display); display: flex; gap: 10px; align-items: baseline; }
.xp { font: 400 .9rem var(--font-body); color: var(--ink-2); }
.xpbar { width: 100%; height: 14px; border: 2px solid var(--line); background: var(--paper-2); }
.xpfill { height: 100%; background: var(--sun); }
.road-dot { display: inline-block; width: 12px; height: 12px; margin-right: 6px; border: 1px solid var(--line); }
.road-dot.shared { background: var(--ink); }
.next { display: flex; flex-direction: column; gap: 10px; }
.next h2 { font-size: 2.5rem; }
.fork { border-color: var(--accent); }
.alert { border-color: var(--warn); }
.linkrow { text-decoration: none; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; width: 108px; padding: 8px 4px; background: var(--paper-2); border: 2px solid var(--line); border-radius: 3px; font: 700 .78rem var(--font-body); color: var(--ink); cursor: default; }
.badge small { font-weight: 400; font-size: .68rem; color: var(--ink-2); }
.badge-icon { font-size: 1.6rem; line-height: 1.2; }
.badge.locked { background: var(--card); font-weight: 400; }
.badge-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.badge-pick .badge { cursor: pointer; }
.badge[aria-pressed='true'] { background: var(--sun); color: #2b2350; }
.feedback { border-left: 4px solid var(--sun); padding-left: 10px; }

/* Choosing a road */
.roads { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.road-card { text-align: left; font: inherit; color: var(--ink); background: var(--card); border: 2px solid var(--line); border-top: 12px solid var(--road); box-shadow: var(--shadow); padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; }
.road-card[aria-pressed='true'] { outline: 4px solid var(--road); outline-offset: 2px; }
.road-card h2 { color: var(--ink); }

/* Character */
.character { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start; }
.options { display: flex; flex-wrap: wrap; gap: 7px; }
.swatch { width: 34px; height: 34px; border: 2px solid var(--line); border-radius: 3px; cursor: pointer; font-size: .8rem; padding: 0; }
.swatch[aria-pressed='true'] { outline: 3px solid var(--accent); outline-offset: 1px; }
.swatch:disabled { cursor: not-allowed; opacity: .65; }
.item { font: 700 .85rem var(--font-body); background: var(--card); color: var(--ink); padding: 6px 10px; border: 2px solid var(--line); border-radius: 3px; cursor: pointer; display: flex; flex-direction: column; align-items: flex-start; }
.item small { font-weight: 400; font-size: .72rem; color: var(--ink-2); }
.item[aria-pressed='true'] { background: var(--sun); color: #2b2350; }
.item:disabled { cursor: not-allowed; color: var(--ink-2); background: var(--paper-2); }
button.btn.on { background: var(--sun); color: #2b2350; }
/* Celebrations */
#fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.fx-burst { position: absolute; width: 0; height: 0; }
.fx-burst span { position: absolute; width: 7px; height: 7px; margin: -3px; border-radius: 1px; animation: fx-fly .7s ease-out forwards; }
.fx-confetti { position: absolute; inset: 0; }
.fx-confetti span { position: absolute; top: -14px; width: 9px; height: 13px; animation: fx-fall 2s ease-in forwards; }
.fx-pop { animation: fx-pop .45s cubic-bezier(.3, 1.6, .5, 1); }
.fx-card { pointer-events: auto; position: absolute; top: 70px; left: 50%; display: flex; align-items: center; gap: 14px; min-width: 300px; max-width: 90vw; padding: 12px 20px 12px 14px; text-align: left; font: inherit; color: #2b2350; background: #fffdf5; border: 3px solid #e0a400; border-radius: 6px; box-shadow: 0 0 22px rgba(224, 164, 0, .7), 4px 4px 0 #2b2350; cursor: pointer; transform: translateX(-50%); animation: fx-drop .55s cubic-bezier(.3, 1.5, .5, 1); }
.fx-card.is-rank { border-color: #9b4fd9; box-shadow: 0 0 22px rgba(155, 79, 217, .7), 4px 4px 0 #2b2350; }
.fx-card.leaving { animation: fx-leave .3s ease-in forwards; }
.fx-card-icon { font-size: 2.6rem; line-height: 1; animation: fx-wiggle 1s ease-in-out .3s 2; }
.fx-card-text { display: flex; flex-direction: column; }
.fx-card-eyebrow { font: 400 .8rem var(--font-display); color: #c43f29; text-transform: uppercase; letter-spacing: .05em; }
.fx-card strong { font-size: 1.25rem; }
.fx-card-detail { font-size: .85rem; }
.step-check.ok.fx-pop { background: #dff5e6; }
.celebrate .badge { animation: fx-pop .5s cubic-bezier(.3, 1.6, .5, 1) backwards; }
.celebrate .badge:nth-child(2) { animation-delay: .5s; }
.celebrate .badge:nth-child(3) { animation-delay: 1s; }
.celebrate .rankup { animation: fx-pop .6s cubic-bezier(.3, 1.6, .5, 1) .4s backwards; }
@keyframes fx-fly { from { transform: translate(0, 0) scale(1); opacity: 1; } to { transform: translate(var(--dx), var(--dy)) scale(.3); opacity: 0; } }
@keyframes fx-fall { from { transform: translateY(0) rotate(0); opacity: 1; } to { transform: translateY(105vh) rotate(600deg); opacity: .6; } }
@keyframes fx-pop { 0% { transform: scale(.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes fx-drop { from { transform: translate(-50%, -160%); } to { transform: translate(-50%, 0); } }
@keyframes fx-leave { to { transform: translate(-50%, -160%); opacity: 0; } }
@keyframes fx-wiggle { 0%, 100% { transform: rotate(0) scale(1); } 25% { transform: rotate(-12deg) scale(1.15); } 75% { transform: rotate(12deg) scale(1.15); } }
@media (prefers-reduced-motion: reduce) { .fx-card, .fx-card-icon, .celebrate .badge, .celebrate .rankup { animation: none; } }
/* Lesson ratings */
.rate { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 2px solid var(--line); border-radius: 4px; background: var(--paper-2); text-align: left; }
.rate-q { margin: 0; font-weight: 700; }
.rate-stars { display: flex; gap: 2px; }
.rate-star { font-size: 2rem; line-height: 1; background: none; border: 0; padding: 2px 4px; cursor: pointer; color: var(--ink-2); opacity: .45; }
.rate-star.on { color: #e0a400; opacity: 1; }
.rate-star:focus-visible { outline: 3px solid var(--accent); }
.rate-word { font-weight: 700; }
.rate-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rate-chip { font: 700 .85rem var(--font-body); padding: 5px 10px; border: 2px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink); cursor: pointer; }
.rate-chip[aria-pressed='true'] { background: var(--sun); color: #2b2350; }
.rate input { width: 100%; }
.rate-bars { display: flex; align-items: flex-end; gap: 3px; height: 32px; margin-top: 4px; }
.rate-bars span { width: 12px; background: #e0a400; border-radius: 2px 2px 0 0; }
.rate-comments { margin: 6px 0 0; padding-left: 18px; }
/* Confusing flags, "I'm stuck", and the teacher's help list */
.linklike { background: none; border: 0; padding: 0; font: inherit; font-size: .85rem; color: var(--ink-2); text-decoration: underline; cursor: pointer; }
.confuse { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.confuse input { width: 100%; }
.rate-xp { font-size: .75rem; font-weight: 700; padding: 1px 8px; border-radius: 10px; background: var(--sun); color: #2b2350; }
.help-box { margin-top: 14px; padding-top: 12px; border-top: 2px dashed var(--line); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.help-box input { width: 100%; }
.help-box.waiting { padding: 10px; border: 2px solid #c08a1e; border-radius: 4px; background: #fff3c4; color: #2b2350; }
.help-box p { margin: 0; }
.help-card { display: none; }
.help-card.has { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; border: 2px solid #c08a1e; border-radius: 4px; background: #fff3c4; color: #2b2350; }
.help-card h2 { margin: 0; font-size: 1.2rem; color: #2b2350; }
.help-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.help-list li { display: flex; align-items: center; gap: 10px; }
.help-list img { height: 32px; image-rendering: pixelated; }
.help-who { flex: 1; }
.help-note { display: block; font-style: italic; }
.pj-other.needs-help { animation: help-glow 1.8s ease-in-out infinite; }
.pj-person.needs-help { animation: help-hop 1.8s ease-in-out infinite; }
.pj-person.needs-help img { filter: drop-shadow(0 0 .5vh #fff) drop-shadow(0 0 1vh #ffd84a) drop-shadow(0 0 1.6vh #ffd84a); }
.pj-person.needs-help span { background: #ffd84a; }
.pj-help-btn[hidden] { display: none; }
.fb-list { margin: 4px 0 0; padding-left: 18px; }
.fb-lesson h3 { font-size: 1rem; margin: 0; }
@keyframes help-hop { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-1.2vh); } }
@keyframes help-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 216, 74, .9); } 50% { box-shadow: 0 0 0 6px rgba(255, 216, 74, 0); } }
@media (prefers-reduced-motion: reduce) { .pj-person.needs-help, .pj-other.needs-help { animation: none; } }
/* Trail Quest */
.quest-lobby { display: grid; grid-template-columns: 300px 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .quest-lobby { grid-template-columns: 1fr; } }
.quest-time { font-size: 1.2rem; margin: 0; }
.quest-powers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.quest-powers li { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border: 2px solid var(--line); border-radius: 3px; background: var(--card); }
.quest-powers li.off { opacity: .6; border-style: dashed; }
.quest-powers li.on { border-color: var(--ok, #2e8b57); }
.quest-lock { margin-left: auto; }
.quest-board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; counter-reset: place; }
.quest-board li { display: flex; align-items: center; gap: 8px; padding: 2px 8px; counter-increment: place; }
.quest-board li::before { content: counter(place) '.'; width: 1.6em; color: var(--ink-2); }
.quest-board li.me { background: var(--sun); color: #2b2350; font-weight: 700; }
.quest-board img { height: 28px; image-rendering: pixelated; }
.quest-board strong { margin-left: auto; }
.quest-play { display: flex; flex-direction: column; gap: 8px; max-width: 980px; margin: 0 auto; }
.quest-hud { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; font-size: 1.15rem; padding: 6px 12px; background: var(--card); border: 2px solid var(--line); box-shadow: var(--shadow); }
.quest-hud .btn { margin-left: auto; }
.quest-hud .warn { color: var(--accent); }
.quest-chip { font-size: .8rem; font-weight: 700; padding: 1px 8px; border: 2px solid var(--line); border-radius: 12px; opacity: .45; }
.quest-chip.ready { opacity: 1; background: var(--sun); color: #2b2350; }
.quest-stage { position: relative; border: 3px solid var(--line); box-shadow: var(--shadow); background: #000; line-height: 0; }
.quest-canvas { width: 100%; height: auto; image-rendering: pixelated; display: block; outline: none; }
.quest-note { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); line-height: 1.3; font-weight: 700; padding: 4px 12px; background: rgba(20, 16, 40, .88); color: #fff; border-radius: 4px; white-space: nowrap; }
.quest-note:empty { display: none; }
.quest-player { display: inline-flex; align-items: center; gap: 4px; }
.quest-board .btn { margin-left: 8px; }
.quest-race { list-style: none; margin: 0; padding: 0; }
.quest-card { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.quest-card .btn { margin-left: auto; }
.quest-earned { font-weight: 700; margin: 0; }
/* Character maker: rarity, glow, and celebrations. */
:root { --r-rare: #2f7de1; --r-epic: #9b4fd9; --r-legendary: #e0a400; }
.item { position: relative; }
.item.r-rare { border-color: var(--r-rare); }
.item.r-epic { border-color: var(--r-epic); }
.item.r-legendary { border-color: var(--r-legendary); background-image: linear-gradient(110deg, transparent 30%, rgba(255, 220, 90, .35) 50%, transparent 70%); background-size: 250% 100%; animation: shimmer 2.8s linear infinite; }
.item .rarity, .next-list .rarity, .unlock-card .rarity { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.r-rare .rarity { color: var(--r-rare); }
.r-epic .rarity { color: var(--r-epic); }
.r-legendary .rarity { color: var(--r-legendary); }
.item.locked, .swatch.locked { cursor: help; opacity: .62; background-color: var(--paper-2); color: var(--ink-2); }
.item.locked.r-legendary { animation: none; background-image: none; }
.new-tag { position: absolute; top: -8px; right: -6px; font: 700 .62rem var(--font-body); background: var(--accent); color: var(--accent-ink); padding: 1px 5px; border-radius: 8px; animation: pop 1.2s ease-in-out infinite; }
.swatch.new { box-shadow: 0 0 0 3px var(--r-legendary); }
.char-stage { position: relative; overflow: hidden; background: var(--paper-2); border: 2px solid var(--line); display: grid; place-items: center; }
.char-stage .avatar-big { position: relative; z-index: 1; border: 0; background: transparent; animation: bob 2.4s ease-in-out infinite; }
.char-stage::before { content: ''; position: absolute; inset: 8%; border-radius: 50%; opacity: 0; transition: opacity .3s; }
.char-stage.glowing::before { opacity: .7; background: radial-gradient(circle, var(--aura) 0%, transparent 68%); animation: pulse 2.2s ease-in-out infinite; }
.char-stage.glowing .avatar-big { filter: drop-shadow(0 0 6px var(--aura)); }
.char-stage.rainbow::before { background: conic-gradient(#ff5e5e, #ffb13d, #ffe14d, #6fe07a, #55b8ff, #a77bff, #ff5e5e); filter: blur(28px); animation: spin 6s linear infinite; }
.char-stage.rainbow .avatar-big { filter: drop-shadow(0 0 6px #fff); }
.char-burst { position: absolute; z-index: 2; left: 50%; top: 50%; width: 10px; height: 10px; border-radius: 50%; border: 4px solid var(--r-legendary); transform: translate(-50%, -50%) scale(0); opacity: 0; pointer-events: none; }
.char-stage.saved .char-burst { animation: burst .7s ease-out; }
.char-name { font: 400 1.6rem/1 var(--font-display); margin: 4px 0 0; }
.char-title { margin: 0; font-weight: 700; color: var(--r-epic); }
.char-title:empty { display: none; }
.collection { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; }
.next-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.next-list li { display: flex; flex-direction: column; gap: 3px; }
.new-gear { animation: pop 1.4s ease-in-out infinite; }
.unlock-party { position: relative; overflow: hidden; text-align: center; }
.unlock-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.unlock-card { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px; background: var(--card); border: 3px solid var(--line); box-shadow: var(--shadow); }
.unlock-card.r-rare { border-color: var(--r-rare); }
.unlock-card.r-epic { border-color: var(--r-epic); }
.unlock-card.r-legendary { border-color: var(--r-legendary); box-shadow: 0 0 14px var(--r-legendary); }
.unlock-card img { image-rendering: pixelated; height: 64px; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti span { position: absolute; top: -12px; width: 8px; height: 12px; animation: fall 2.2s ease-in forwards; }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -100% 0; } }
@keyframes pop { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes pulse { 0%, 100% { transform: scale(.92); opacity: .55; } 50% { transform: scale(1.05); opacity: .85; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes burst { 0% { transform: translate(-50%, -50%) scale(0); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(28); opacity: 0; } }
@keyframes fall { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(420px) rotate(540deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .item.r-legendary, .new-tag, .new-gear, .char-stage .avatar-big, .char-stage::before, .confetti span { animation: none !important; }
  .confetti { display: none; }
}
.char-options section { display: flex; flex-direction: column; gap: 5px; }
.ranks { list-style: none; padding: 0; margin: 0; }
.ranks li { display: flex; justify-content: space-between; padding: 3px 8px; }
.ranks li.now { background: var(--sun); color: #2b2350; font-weight: 700; }
.ranks li.now .muted { color: #2b2350; }
.ranks li.past { color: var(--ink-2); }

/* Journey map */
.map-scroll { overflow-x: auto; background: var(--card); border: 2px solid var(--line); box-shadow: var(--shadow); }
.map-svg { display: block; }
.road-dot.beyond { background: var(--road-mind); opacity: .5; }
.beyond-tag { margin: 0 0 0 6px; }
.gradebook .beyond-col { background: var(--paper-2); }
.world { image-rendering: pixelated; }
.world-night { display: none; }
.world-cloud { image-rendering: pixelated; opacity: .92; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']):not([data-theme='contrast']) .world-day { display: none; }
  :root:not([data-theme='light']):not([data-theme='contrast']) .world-night { display: inline; }
  :root:not([data-theme='light']):not([data-theme='contrast']) .world-cloud { opacity: .16; }
}
:root[data-theme='dark'] .world-day { display: none; }
:root[data-theme='dark'] .world-night { display: inline; }
:root[data-theme='dark'] .world-cloud { opacity: .16; }
:root[data-theme='contrast'] .world { opacity: .4; }
:root[data-theme='contrast'] .world-cloud { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .drift-0 { animation: cloud-drift 70s linear infinite alternate; }
  .drift-1 { animation: cloud-drift 95s linear infinite alternate-reverse; }
  .drift-2 { animation: cloud-drift 120s linear infinite alternate; }
  .me-sprite { animation: map-bob 1.2s steps(2) infinite; }
}
@keyframes cloud-drift { to { transform: translateX(150px); } }
@keyframes map-bob { 50% { transform: translateY(-4px); } }
.map-svg { --map-ground: #e9ead9; --map-band: rgba(70, 90, 60, .07); --map-line: rgba(70, 90, 60, .16); --map-tree: #a9bda2; --map-trunk: #b9a98c; --map-path: #f6efd9; --map-path-edge: #6b5a48; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']):not([data-theme='contrast']) .map-svg { --map-ground: #22263c; --map-band: rgba(255, 255, 255, .04); --map-line: rgba(200, 210, 255, .1); --map-tree: #3a4a55; --map-trunk: #40384a; --map-path: #cfc7b0; --map-path-edge: #0f1120; } }
:root[data-theme='dark'] .map-svg { --map-ground: #22263c; --map-band: rgba(255, 255, 255, .04); --map-line: rgba(200, 210, 255, .1); --map-tree: #3a4a55; --map-trunk: #40384a; --map-path: #cfc7b0; --map-path-edge: #0f1120; }
:root[data-theme='contrast'] .map-svg { --map-ground: var(--paper); --map-band: transparent; --map-line: transparent; --map-tree: transparent; --map-trunk: transparent; --map-path: var(--card); --map-path-edge: var(--ink); }
.map-ground { fill: var(--map-ground); }
.map-band { fill: var(--map-band); }
.map-contour { fill: none; stroke: var(--map-line); stroke-width: 2; stroke-dasharray: 2 7; stroke-linecap: round; }
.map-tree polygon { fill: var(--map-tree); }
.map-trunk { fill: var(--map-trunk); }
.stage-plate { fill: var(--card); stroke: var(--line); stroke-width: 2; }
.stage-name { font: 400 21px var(--font-display); fill: var(--ink); }
.trail-edge { fill: none; stroke: var(--map-path-edge); stroke-width: 12; stroke-linecap: round; stroke-linejoin: round; }
.trail { fill: none; stroke: var(--map-path); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.trail.extra { stroke-dasharray: 2 12; }
.trail-edge.extra { stroke-width: 10; opacity: .55; }
.trail.faint { opacity: .45; stroke-width: 4; }
.trail-edge.faint { stroke-width: 7; opacity: .25; }
.node-box { fill: var(--card); stroke: var(--line); stroke-width: 4; }
.node-ring { fill: none; stroke: var(--accent); stroke-width: 3; opacity: .7; }
.node-plate { fill: var(--card); opacity: .96; stroke: var(--map-line); stroke-width: 1; }
.node[class*='clickable'] { cursor: pointer; }
.node.clickable:hover .node-box { fill: var(--sun); }
.node.done .node-box { fill: #1d8f58; }
.node.done .node-mark { fill: #fff; }
.node.current .node-box { fill: var(--accent); }
.node.current .node-mark { fill: #fff; }
.node.offroad { opacity: .55; }
.node-mark { font: 700 15px var(--font-body); fill: var(--ink); }
.node-name { font: 12px var(--font-body); fill: var(--ink); }
.me-sprite { filter: url(#map-sticker) drop-shadow(0 0 5px var(--accent)); }
@media (prefers-reduced-motion: no-preference) { .node-ring { animation: node-ring 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; } }
@keyframes node-ring { 50% { transform: scale(1.12); opacity: .2; } }
.crowd { cursor: pointer; }
.crowd rect { fill: var(--accent); stroke: #fff; stroke-width: 2; }
.crowd text { fill: var(--accent-ink); font: 700 12px var(--font-body); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .88rem; align-items: center; }
.legend span { display: inline-flex; align-items: center; }
.people { list-style: none; padding: 0; margin: 0; }
.people li { display: flex; gap: 8px; align-items: center; padding: 2px 0; }
.people img { height: 30px; image-rendering: pixelated; }

.table-wrap { overflow-x: auto; }
.board { border-collapse: collapse; width: 100%; background: var(--card); font-size: .92rem; }
.board th { text-align: left; border-bottom: 2px solid var(--line); padding: 6px 10px; white-space: nowrap; }
.board td { border-bottom: 1px solid var(--paper-2); padding: 6px 10px; }
.board .num { text-align: right; font-variant-numeric: tabular-nums; }
.board tr.me { background: var(--paper-2); font-weight: 700; }
.person { white-space: nowrap; }
.person img { height: 24px; image-rendering: pixelated; vertical-align: middle; margin-right: 6px; }
.tight-row { gap: 4px; flex-wrap: nowrap; }

/* Lesson workspace */
.workspace { display: flex; flex-direction: column; height: calc(100vh - 52px); }
.lesson-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 8px 14px; border-bottom: 2px solid var(--line); flex-wrap: wrap; background: var(--paper-2); }
.lesson-head h1 { font-size: 1.9rem; }
.save-state { font-size: .82rem; color: var(--ink-2); }
.save-state.bad { color: var(--bad); font-weight: 700; }
.returned, .approved { padding: 6px 14px; border-bottom: 2px solid var(--line); }
.returned { background: #ffe5c9; color: #5c3106; }
.approved { background: #d3f3e0; color: #0f4a2b; }
.panes { flex: 1; display: grid; grid-template-columns: minmax(300px, 25%) 1fr minmax(320px, 420px); min-height: 0; }
.steps { overflow-y: auto; padding: 12px 14px 30px; border-right: 2px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.hook summary { cursor: pointer; font-weight: 700; font-size: .92rem; }
.hook p { margin-top: 6px; font-size: .95rem; }
.step-dots { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.step-dots button { width: 30px; height: 30px; border: 2px solid var(--line); background: var(--card); color: var(--ink); border-radius: 3px; font: 700 .82rem var(--font-body); cursor: pointer; padding: 0; }
.step-dots button.ok { background: #1d8f58; color: #fff; }
.step-dots button.on { outline: 3px solid var(--accent); outline-offset: 1px; }
.step-dots button.finish { background: var(--sun); color: #2b2350; }
.step-body { display: flex; flex-direction: column; gap: 10px; }
.md { display: flex; flex-direction: column; gap: 9px; }
.md ul { margin: 0; padding-left: 20px; }
.snippet { margin: 0; background: var(--code-bg); color: var(--code-fg); padding: 10px 12px; border-radius: 3px; overflow-x: auto; font-size: .82rem; line-height: 1.45; }
.snippet code { background: none; padding: 0; color: inherit; font-size: inherit; }
.hint summary { cursor: pointer; font-weight: 700; font-size: .92rem; }
.hint .md, .hint p { margin-top: 5px; font-size: .92rem; }
.step-check { font-size: .88rem; font-weight: 700; padding: 5px 9px; border-left: 4px solid; }
.step-check.ok { color: var(--ok); border-color: var(--ok); }
.step-check.wait { color: var(--ink-2); border-color: var(--ink-2); font-weight: 400; }
.step-nav { margin-top: 4px; }
.stretches { display: flex; flex-direction: column; gap: 7px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: .94rem; }
.check input { margin-top: 5px; }
.code-pane { min-width: 0; min-height: 0; }
.editor-host, .editor-host .CodeMirror { height: 100%; }
.CodeMirror { font: var(--code-size, 14px)/1.5 var(--font-code); background: var(--code-bg); color: var(--code-fg); }
.CodeMirror-gutters { background: var(--code-gutter); border-right: 1px solid var(--code-gutter); }
.CodeMirror-linenumber { color: var(--code-number); }
.CodeMirror-cursor { border-left: 2px solid var(--code-fg); }
.CodeMirror-selected, .CodeMirror-focused .CodeMirror-selected { background: var(--code-select); }
.CodeMirror-matchingbracket { color: var(--sun) !important; font-weight: 700; text-decoration: underline; }
.cm-s-default .cm-keyword { color: var(--t-keyword, #ff9ed8); }
.cm-s-default .cm-def { color: var(--t-def, #8fd8ff); }
.cm-s-default .cm-variable { color: var(--t-variable, #f2eefc); }
.cm-s-default .cm-variable-2 { color: var(--t-variable-2, #cfe6ff); }
.cm-s-default .cm-property { color: var(--t-property, #bfe7a6); }
.cm-s-default .cm-number { color: var(--t-number, #ffd479); }
.cm-s-default .cm-string { color: var(--t-string, #a5f0c1); }
.cm-s-default .cm-comment { color: var(--t-comment, #9b94c7); }
.cm-s-default .cm-operator { color: var(--t-operator, #f2eefc); }
.cm-s-default .cm-atom { color: var(--t-atom, #ffd479); }
.error-line { background: rgba(255, 80, 80, .28); }
.file-holder { font-size: .72rem; font-weight: 700; opacity: .85; }
.file-holder.mine { color: var(--ok, #2e8b57); }
.err-code { margin: 4px 0 0; padding: 4px 8px; background: rgba(0, 0, 0, .25); border-radius: 3px; font: .85rem var(--font-code, monospace); white-space: pre-wrap; }
.place-line { background: rgba(80, 160, 255, .22); }
.place-marker { font: 700 .8rem var(--font-body); color: #0b4f9e; background: #dcecff; border: 2px dashed #0b4f9e; border-radius: 3px; padding: 2px 8px; margin: 2px 0; }
.step-place { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-weight: 700; }
.step-place:empty { display: none; }
.game-pane { border-left: 2px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 0; }
.game-frame { width: 100%; max-width: 400px; aspect-ratio: 1; background: #14141f; border: 2px solid var(--line); align-self: center; }
.player, .player iframe { width: 100%; height: 100%; display: block; border: 0; }
.console { min-height: 80px; font-size: .88rem; background: var(--card); border: 2px solid var(--line); padding: 8px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.err { color: var(--bad); }
.log { font-family: var(--font-code); font-size: .8rem; }
.linejump { background: var(--bad); color: #fff; border: 0; font: 700 .78rem var(--font-body); padding: 1px 7px; cursor: pointer; border-radius: 2px; margin-bottom: 3px; }
.path-pick { font-size: .85rem; padding: 4px 6px; }
.celebrate h2 { font-size: 3.6rem; color: var(--accent); }
.rankup { font: 400 1.6rem var(--font-display); }

/* Sprites */
.sprite-editor { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start; }
.pixel-canvas { display: block; width: min(448px, 100%); aspect-ratio: 1; border: 2px solid var(--line); touch-action: none; cursor: crosshair; image-rendering: pixelated; }
.tools, .palette { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.palette .swatch { width: 26px; height: 26px; }
.palette input[type='color'] { width: 34px; height: 26px; padding: 0; }
.frames { display: flex; flex-wrap: wrap; gap: 5px; }
.frame { padding: 0; width: 42px; height: 42px; border: 2px solid var(--line); background: repeating-conic-gradient(#e7e4d8 0 25%, #f6f4ea 0 50%) 0 0 / 10px 10px; cursor: pointer; }
.frame canvas { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.frame[aria-pressed='true'] { outline: 3px solid var(--accent); outline-offset: 1px; }
.pixel-preview { border: 2px solid var(--line); image-rendering: pixelated; background: repeating-conic-gradient(#e7e4d8 0 25%, #f6f4ea 0 50%) 0 0 / 16px 16px; }
.sprite-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 10px; }
.sprite-tile { background: var(--card); border: 2px solid var(--line); padding: 8px; display: flex; flex-direction: column; gap: 3px; align-items: center; text-align: center; }
.sprite-img { height: 66px; display: flex; align-items: center; justify-content: center; background: repeating-conic-gradient(#e7e4d8 0 25%, #f6f4ea 0 50%) 0 0 / 12px 12px; width: 100%; overflow: hidden; }
.sprite-name { font-weight: 700; font-size: .9rem; overflow-wrap: anywhere; }
.tile-actions { justify-content: center; gap: 3px; }

/* Arcade */
.arcade-grid, .class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.arcade-card { display: flex; flex-direction: column; gap: 6px; border-top: 10px solid var(--road, var(--ink)); }
.arcade-card img { image-rendering: pixelated; align-self: flex-start; }
.class-card { text-decoration: none; display: flex; flex-direction: column; gap: 8px; }
.class-card:hover { background: var(--paper-2); }
.code { font-family: var(--font-code); letter-spacing: .08em; }
.add-class input { flex: 1; min-width: 200px; }
.howto { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.danger-zone { margin-top: 12px; align-items: flex-start; }

/* Gradebook */
.gradebook { border-collapse: collapse; background: var(--card); font-size: .84rem; }
.gradebook th, .gradebook td { border: 1px solid var(--paper-2); padding: 0; text-align: center; min-width: 30px; height: 30px; }
.gradebook thead th { padding: 3px; font-variant-numeric: tabular-nums; }
.gradebook .sticky { position: sticky; left: 0; background: var(--card); text-align: left; padding: 3px 10px 3px 6px; z-index: 1; font-weight: 700; min-width: 130px; }
.cell a { display: block; line-height: 30px; text-decoration: none; font-weight: 700; color: inherit; }
.cell.submitted, .key.submitted { background: #ffd34d; color: #3a2a00; }
.cell.approved, .key.approved { background: #a6e8c2; color: #0d3b23; }
.cell.returned, .key.returned { background: #ffb59e; color: #4a1604; }
.cell.working, .key.working { background: var(--paper-2); color: var(--ink-2); }
.key { display: inline-block; width: 14px; height: 14px; margin-right: 5px; border: 1px solid var(--line); }
.queue { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.review-grid { display: grid; grid-template-columns: minmax(280px, 400px) minmax(320px, 1fr) minmax(280px, 360px); gap: 16px; align-items: start; margin-top: 14px; }
.review-code { height: 620px; border: 2px solid var(--line); }
.review .console { flex: none; }
.levels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
.level { font: inherit; font-size: .72rem; line-height: 1.2; padding: 5px 3px; background: var(--card); color: var(--ink); border: 2px solid var(--line); border-radius: 3px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.level b { font-size: .95rem; }
.level[aria-checked='true'] { background: var(--sun); color: #2b2350; }
.checklist { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.checklist .ok { color: var(--ok); }
.checklist .warn { color: var(--warn); }
blockquote { margin: 0; padding: 6px 10px; border-left: 4px solid var(--sun); background: var(--paper-2); }

/* All lessons */
.road-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.road-title { color: var(--ink); border-bottom: 4px solid var(--road); }
.lesson-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.road-columns .lesson-list { grid-template-columns: 1fr; }
.lesson-row { text-decoration: none; display: flex; flex-direction: column; gap: 4px; font-size: .9rem; padding: 12px; box-shadow: 2px 2px 0 var(--line); }
.lesson-row:hover { background: var(--paper-2); }

.std-codes { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.std { font: 600 .72rem var(--font-code); padding: 0 5px; border: 1px solid var(--line); border-radius: 3px; }
.std.anchor { background: var(--ink); color: var(--paper); }
button.std { background: none; color: inherit; cursor: pointer; }
button.std.anchor { background: var(--ink); color: var(--paper); }
.std-link { font: 700 .72rem var(--font-body); align-self: center; margin-right: 2px; }
.lesson-title .std-codes { margin-top: 4px; }
.hook h3 { margin-top: 8px; font-size: .88rem; }
.std-lesson.locked { color: var(--ink-2); }
.std-summary { display: flex; flex-wrap: wrap; gap: 12px; }
.std-summary > div { background: var(--card); border: 2px solid var(--line); box-shadow: 2px 2px 0 var(--line); padding: 10px 16px; display: flex; flex-direction: column; min-width: 170px; }
.std-summary strong { font: 400 2.1rem/1 var(--font-display); }
.std-summary span { font-size: .85rem; color: var(--ink-2); }
.std-status { font-size: .78rem; font-weight: 700; padding: 1px 7px; border-radius: 3px; white-space: nowrap; }
.std-status.approved { background: #a6e8c2; color: #0d3b23; }
.std-status.turned { background: #ffd34d; color: #3a2a00; }
.std-status.practiced { background: var(--paper-2); color: var(--ink); border: 1px solid var(--line); }
.std-status.ahead { color: var(--ink-2); }
.std-list { margin: 4px 0; padding-left: 18px; font-size: .84rem; display: flex; flex-direction: column; gap: 4px; }
.std-block summary { cursor: pointer; font-weight: 700; font-size: .92rem; }
.std-block > div { margin-top: 6px; }
.std-table td { vertical-align: top; }
.std-table td:nth-child(2) { min-width: 320px; }
.std-table .std-none { color: var(--ink-2); }
.std-lesson { display: inline-block; font: 600 .78rem var(--font-code); margin-right: 5px; }

.step-do { font-size: 1.08rem; font-weight: 700; }
.step-do code { font-weight: 400; }
.step-dots button.quiz { border-radius: 50%; }
.quiz-q { font-size: 1.1rem; font-weight: 700; }
.quiz-options { display: flex; flex-direction: column; gap: 8px; }
.quiz-option { font: inherit; text-align: left; padding: 9px 12px; background: var(--card); color: var(--ink); border: 2px solid var(--line); border-radius: 3px; cursor: pointer; box-shadow: 2px 2px 0 var(--line); }
.quiz-option:hover:not(:disabled) { background: var(--paper-2); }
.quiz-option.right { background: #a6e8c2; color: #0d3b23; }
.quiz-option.wrong { background: #ffb59e; color: #4a1604; opacity: .75; box-shadow: none; cursor: not-allowed; }
.quiz-feedback p { display: flex; gap: 6px; }
.player { position: relative; }
.camera-prompt { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); white-space: nowrap; z-index: 2; }

/* Class display, for a projector */
body.projecting .topbar, body.projecting .demo-banner { display: none; }
body.projecting .page { max-width: none; padding: 0; }
.pj { --pj-gap: 14px; height: 100vh; display: flex; flex-direction: column; gap: var(--pj-gap); padding: 16px 20px; background: var(--paper); overflow: hidden; }
.pj-head { display: flex; align-items: center; gap: 18px; }
.pj-head > div:first-child { flex: 1; }
.pj-head h1 { font-size: 6vh; line-height: 1; }
.pj-head p { font-size: 2.2vh; color: var(--ink-2); }
.pj-controls { display: flex; gap: 6px; opacity: .8; transition: opacity .15s; }
.pj-controls:hover, .pj-controls:focus-within { opacity: 1; }
.pj-clock { position: relative; min-width: 230px; padding: 6px 44px 6px 18px; background: var(--ink); color: var(--paper); border: 2px solid var(--line); box-shadow: var(--shadow); text-align: center; }
.pj-clock.soon { background: #f4cf49; color: #2b2350; }
.pj-clock.over { background: #d9483b; color: #fff; }
.pj-time { font: 400 8.5vh/1 var(--font-display); font-variant-numeric: tabular-nums; }
.pj-time-note { font-size: 2vh; font-weight: 700; }
.pj-set { font: 700 1.3rem var(--font-body); padding: 18px 8px; background: none; border: 0; color: inherit; cursor: pointer; width: 100%; }
.pj-plus { position: absolute; top: 6px; right: 6px; font: 700 .85rem var(--font-body); background: none; color: inherit; border: 1px solid currentColor; border-radius: 3px; padding: 2px 6px; cursor: pointer; opacity: .7; }
.pj-panels { flex: 1; min-height: 0; display: grid; gap: var(--pj-gap); grid-template-columns: 1fr 1fr 1fr; grid-template-rows: minmax(0, 1fr) minmax(0, 1fr) auto; grid-template-areas: 'race race question' 'race race feed' 'standards standards standards'; }
.pj-panel { background: var(--card); border: 2px solid var(--line); box-shadow: var(--shadow); padding: 10px 16px; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 6px; }
.pj-panel h2 { font-size: 3.2vh; }
.pj-race-panel { grid-area: race; }
.pj-race-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pj-race-focus { margin: 0; padding-left: 2.4vh; font-size: 2.2vh; font-weight: 700; }
.pj-race { --ph: 9vh; flex: 1; min-height: 0; display: grid; gap: 0; position: relative; padding: 0 1.2vh 0 .4vh; border: 2px solid var(--line); overflow: hidden; container-type: size; }
/* Each stop is a block of the hill: characters stand on its grass top, and its face carries the step's number and name. */
.pj-stop { position: relative; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
/* A step's colour: a soft band behind its characters, its block, and its grass. Start is grey and the finish gold. */
.pj-stop { --band: hsl(var(--hue, 0) var(--hue-sat, 0%) 72% / .5); --face: hsl(var(--hue, 30) var(--face-sat, 12%) var(--face-light, 46%)); --cap: hsl(var(--hue, 30) var(--face-sat, 12%) var(--cap-light, 64%)); background: linear-gradient(0deg, var(--band), transparent 92%); box-shadow: inset 1px 0 0 rgba(255, 255, 255, .28); }
.pj-stop[style*='--hue'] { --hue-sat: 85%; --face-sat: 48%; }
/* Name tags take their step's colour too, so a name reads as belonging to its block. */
.pj-stop[style*='--hue'] .pj-person:not(.needs-help) span { background: hsl(var(--hue) 90% 92%); color: #2b2350; }
.pj-stop.finish .pj-person:not(.needs-help) span { background: #fff1b8; color: #2b2350; }
.pj-stop.finish { --band: rgba(255, 214, 74, .4); --face: #b8862b; --cap: #ffe07a; }
:root[data-theme='contrast'] .pj-stop { background: none; --face: var(--paper-2); --cap: var(--card); box-shadow: inset 2px 0 0 var(--line); }
.pj-block { position: relative; flex: none; height: calc(9.6vh + var(--rise, 0) * 20cqh); display: flex; flex-direction: column; align-items: center; gap: .5vh; padding: .9vh 2px 0; background-color: var(--face); background-image: linear-gradient(90deg, rgba(0, 0, 0, .1) 0 2px, transparent 2px), repeating-linear-gradient(0deg, rgba(0, 0, 0, .12) 0 2px, transparent 2px 3.4vh), linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, .22)); }
/* The top of the block, leaning back so the hill has depth. The next, taller block covers where it runs over. */
.pj-block-top { position: absolute; left: 0; right: 0; bottom: 100%; height: 2.6vh; background: linear-gradient(180deg, var(--face), var(--cap)); border-bottom: .5vh solid var(--face); transform: skewX(-38deg); transform-origin: bottom left; }
.pj-stop-mark { position: relative; flex: none; width: 4.6vh; height: 4.6vh; display: grid; place-items: center; font: 400 2.6vh/1 var(--font-display); background: var(--card); color: var(--ink); border: 2px solid var(--line); box-shadow: var(--shadow); }
.pj-stop.busy .pj-stop-mark { background: var(--accent); color: var(--accent-ink); }
.pj-stop.start .pj-stop-mark { opacity: .8; }
.pj-stop-label { font-size: 1.3vh; max-width: 100%; max-height: 3.1vh; overflow: hidden; font-weight: 700; line-height: 1.1; text-align: center; color: var(--ink); background: var(--card); border: 1px solid var(--line); padding: 1px 4px; letter-spacing: -.02em; }
.pj-racers { position: relative; z-index: 1; flex: 1; min-height: 0; min-width: 0; overflow: hidden; display: flex; flex-wrap: wrap-reverse; align-content: flex-start; align-items: flex-end; justify-content: center; gap: .3vh 0; padding: .6vh 0 1vh 1.6vh; }
.pj-person { margin: 0 calc(var(--ph) * -.05); max-width: 100%; }
.pj-person img { height: var(--ph); max-width: none; filter: drop-shadow(0 .4vh .2vh rgba(0, 0, 0, .3)); }
/* Names never hide. They shrink with the characters, but not below a size the back row can read. */
.pj-person span { font-size: clamp(1.35vh, calc(var(--ph) * .18), 2.5vh); line-height: 1.25; letter-spacing: -.02em; }
/* A long name takes a second line rather than pushing classmates off the block. */
.pj-race .pj-person span { white-space: normal; text-align: center; line-height: 1.1; width: max-content; min-width: min-content; max-width: max(7.5vh, calc(var(--ph) * 1.5)); }
.pj-others { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 1.7vh; }
.pj-other { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px 1px 2px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px; }
.pj-other img { height: 2.4vh; image-rendering: pixelated; }
.pj-question { grid-area: question; }
.pj-feed-panel { grid-area: feed; }
.pj-progress { grid-area: progress; }
.pj-standards { grid-area: standards; padding: 6px 16px; }
.pj-standards h2 { font-size: 2vh; }
.pj-standards ul { list-style: none; margin: 0; padding: 0; font-size: 1.6vh; display: flex; flex-direction: column; gap: 2px; }
.pj-focus { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1vh; font-size: 3.6vh; font-weight: 700; line-height: 1.15; }
.pj-count { display: inline-block; margin-left: 10px; font-size: 2vh; padding: 0 8px; background: var(--paper-2); border-radius: 10px; font-weight: 400; vertical-align: middle; }
.pj-sub, .pj-empty { font-size: 2vh; color: var(--ink-2); }
.pj-q { font-size: 3vh; font-weight: 700; line-height: 1.2; }
.pj-from { margin: 0; font-size: 1.8vh; color: var(--ink-2); }
.pj-feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .7vh; font-size: 2.3vh; line-height: 1.15; }
.pj-feed li { display: flex; align-items: center; gap: 8px; }
.pj-feed img { height: 3vh; image-rendering: pixelated; }
.pj-icon { font-size: 2.6vh; }
.pj-scene {
  --sky: var(--sky-day); --ground: var(--ground-day); --mark: var(--mark-day);
  background-color: var(--paper-2);
  background-image: var(--mark), var(--ground), var(--sky);
  background-repeat: no-repeat, repeat-x, repeat-x;
  background-size: contain, auto 4vh, auto calc(100% - 3.5vh);
  background-position: center bottom 3.5vh, left bottom, center bottom 3.5vh;
  image-rendering: pixelated;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']):not([data-theme='contrast']) .pj-scene { --sky: var(--sky-night); --ground: var(--ground-night); --mark: var(--mark-night); --face-light: 32%; --cap-light: 46%; }
}
:root[data-theme='dark'] .pj-scene { --sky: var(--sky-night); --ground: var(--ground-night); --mark: var(--mark-night); --face-light: 32%; --cap-light: 46%; }
:root[data-theme='contrast'] .pj-scene { background-image: none; }
.pj-people { margin-top: auto; display: flex; flex-wrap: wrap; gap: 2px 4px; justify-content: center; align-items: flex-end; }
.pj-person { display: flex; flex: none; flex-direction: column-reverse; align-items: center; }
.pj-person img { image-rendering: pixelated; display: block; flex: none; width: auto; }
.pj-person span { white-space: nowrap; font-weight: 700; padding: 0 .4vh; color: var(--ink); background: var(--card); border-bottom: 3px solid var(--road, transparent); }

.subhead { font: 700 1rem var(--font-body); }
.read-row { display: flex; gap: 8px; align-items: flex-start; }
.read-row > :first-child { flex: 1; }
.read-btn { flex: none; width: 32px; height: 32px; font-size: 1rem; line-height: 1; border: 2px solid var(--line); border-radius: 3px; background: var(--card); cursor: pointer; padding: 0; }
.read-btn:hover { background: var(--sun); }
.setting { display: flex; flex-direction: column; gap: 5px; }
.settings .item[aria-checked='true'] { background: var(--sun); color: #2b2350; }
.code-pane { display: flex; flex-direction: column; }
.code-pane .editor-host { flex: 1; min-height: 0; }
.file-bar { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; padding: 4px 8px; background: var(--paper-2); border-bottom: 2px solid var(--line); }
.file-tabs { display: flex; flex-wrap: wrap; gap: 3px; }
.file-tab { display: flex; align-items: center; background: var(--card); border: 2px solid var(--line); border-radius: 3px; }
.file-tab.on { background: var(--sun); }
.file-tab.on button { color: #2b2350; }
.file-tab button { font: 600 .8rem var(--font-code); background: none; color: var(--ink); border: 0; padding: 3px 8px; cursor: pointer; }
.file-tab .file-x { padding: 3px 7px 3px 0; }
.file-assets { display: flex; flex-wrap: wrap; gap: 3px; }
.file-asset { display: inline-flex; align-items: center; gap: 4px; font: .78rem var(--font-code); background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 3px; padding: 1px 6px 1px 2px; cursor: pointer; }
.file-asset img { height: 20px; max-width: 34px; object-fit: contain; image-rendering: pixelated; }
.file-actions { display: flex; gap: 4px; margin-left: auto; }

.alert-chip { display: inline-block; align-self: flex-start; font-weight: 700; font-size: .85rem; padding: 1px 8px; background: #ffd34d; color: #3a2a00; border-radius: 3px; }
.alert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.alert-card { background: var(--card); border: 2px solid var(--line); border-left-width: 10px; padding: 10px 14px; display: flex; flex-direction: column; gap: 3px; }
.alert-card.behind { border-left-color: #b3261e; }
.alert-card.watch { border-left-color: #c99a1e; }
.alert-card ul { margin: 0; padding-left: 18px; font-size: .95rem; }
.alert-level { font-size: .8rem; font-weight: 700; }
.cr-table th.cr-head { min-width: 86px; max-width: 120px; padding: 4px; font-size: .75rem; font-weight: 700; white-space: normal; }
.cr-table th.cr-head small { display: block; font-weight: 400; color: var(--ink-2); }
.cr-count { font-weight: 700; color: var(--bad); }
.cell.cr-missing, .key.cr-missing { background: #ffb59e; color: #4a1604; }
.cell.cr-late, .key.cr-late { background: #ffd34d; color: #3a2a00; }
.cell.cr-done, .key.cr-done { background: #a6e8c2; color: #0d3b23; }
.cell.cr-graded, .key.cr-graded { background: #7fd6a3; color: #0d3b23; }
.cell.cr-assigned, .key.cr-assigned { background: var(--paper-2); color: var(--ink-2); }

/* Overlays */
.backdrop { position: fixed; inset: 0; background: rgba(20, 16, 44, .66); display: flex; align-items: flex-start; justify-content: center; padding: 30px 16px; overflow-y: auto; z-index: 50; }
.modal { background: var(--card); border: 3px solid var(--line); box-shadow: 6px 6px 0 var(--line); padding: 20px; width: min(500px, 100%); outline: none; }
.modal.wide { width: min(1000px, 100%); }
#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 60; width: min(480px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--paper); padding: 8px 14px; border: 2px solid var(--line); box-shadow: var(--shadow); text-align: center; }
.toast.error { background: var(--bad); color: #fff; }
.toast.busy-note { background: var(--card); color: var(--ink); }
.data-card summary { cursor: pointer; }
.data-card > .stack { margin-top: 10px; }
.data-card input { flex: 1; min-width: 180px; }

@media (max-width: 1050px) {
  .workspace { height: auto; }
  .panes { grid-template-columns: 1fr; }
  .steps { border-right: 0; border-bottom: 2px solid var(--line); }
  .code-pane { height: 60vh; }
  .game-pane { border-left: 0; }
  .review-grid { grid-template-columns: 1fr; }
  .review-code { height: 420px; }
}
@media (max-width: 760px) {
  .page { padding: 16px; }
  .login, .home, .character, .sprite-editor { grid-template-columns: 1fr; }
  .login-hero h1 { font-size: 2.8rem; }
  .roads, .road-columns { grid-template-columns: 1fr; }
  .home > .hero-card { grid-row: auto; }
  .avatar-big { max-width: 200px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* Sound Studio */
.music-maker { min-width: 0; }
.mm-controls { align-items: flex-end; flex-wrap: wrap; }
.mm-save { align-items: flex-end; flex-wrap: wrap; }
.field.grow { flex: 1 1 200px; }
.mm-scroll { overflow-x: auto; padding-bottom: 4px; }
.mm-grids { display: flex; flex-direction: column; gap: 8px; min-width: 520px; }
.mm-grid { display: grid; gap: 2px; }
.mm-row { font: 700 .75rem var(--font-code); color: var(--ink-2); align-self: center; text-align: right; padding-right: 6px; white-space: nowrap; }
.mm-cell { height: 20px; padding: 0; border: 1px solid var(--line); border-radius: 0; background: var(--card); cursor: pointer; }
.mm-cell.alt { background: var(--paper-2); }
.mm-cell:hover { background: var(--sun); }
.mm-cell.now { outline: 2px solid var(--accent); outline-offset: -2px; }
.mm-lead .mm-cell.on { background: var(--road-star); }
.mm-bass .mm-cell.on { background: var(--road-mind); }
.mm-drums .mm-cell.on { background: var(--ink); }
.sound-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.sound-tile { display: flex; align-items: center; gap: 6px; padding: 6px; background: var(--card); border: 2px solid var(--line); }
.sound-tile code { flex: 1; min-width: 0; font-size: .85rem; }
.sound-play { flex: none; width: 32px; height: 32px; border: 2px solid var(--line); border-radius: 3px; background: var(--sun); color: #2b2350; cursor: pointer; }
.song-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.song-tile { display: flex; flex-direction: column; gap: 4px; padding: 10px; background: var(--card); border: 2px solid var(--line); }

/* Group projects */
.team-bar:empty { display: none; }
.team-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 6px 10px; background: var(--paper-2); border: 2px solid var(--line); font-size: .9rem; }
.team-turn { font-weight: 700; }
.group-row { align-items: center; flex-wrap: wrap; }
ol.steps { margin: 0; padding-left: 1.4rem; display: flex; flex-direction: column; gap: 4px; }

.bug { border-top: 2px solid var(--line); padding-top: 8px; }
.bug p { margin: 0 0 4px; }
.bug-errors { font-size: .78rem; max-height: 8em; overflow: auto; }

.preview-banner { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }

.quest-goal { padding: 1px 8px; background: #ffd23f; color: #1b1530; border-radius: 3px; }
.quest-goal.go { background: #7dffb0; animation: help-glow 1s ease-in-out infinite; }
.quest-par { display: inline-flex; align-items: center; gap: 4px; }
.quest-par-bar { width: 70px; height: 8px; background: rgba(0, 0, 0, .35); border: 1px solid var(--line); }
.quest-par-fill { height: 100%; background: #ffd23f; transition: width .2s linear; }
.quest-hearts.boosted { filter: drop-shadow(0 0 4px #ffd23f); }

.step-kind { display: inline-block; align-self: flex-start; margin: 0; padding: 3px 10px; border: 2px solid var(--line); border-radius: 3px; font-size: .85rem; font-weight: 700; }
.step-kind.do { background: var(--sun); color: #2b2350; }
.step-kind.read { background: var(--paper-2); color: var(--ink-2); }
.step-kind.answer { background: var(--accent); color: var(--accent-ink); }
.step-dots button.read { border-style: dashed; }
.step-dots button:disabled { opacity: .4; cursor: not-allowed; }
.step-dots button.quiz.next-up:not(.ok) { background: var(--accent); color: var(--accent-ink); animation: help-glow 1.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .step-dots button.quiz.next-up { animation: none; } }

/* XP purse, flying coins, answers, and full-screen moments */
.xp-purse { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; background: var(--sun); color: #2b2350; border: 2px solid #2b2350; border-radius: 999px; font-size: .9rem; }
.xp-purse.gained { box-shadow: 0 0 0 3px #fff, 0 0 18px 6px #ffd84a; }
.xp-purse-icon { font-size: 1.05rem; }
.fx-coin { position: absolute; font-size: 1.5rem; line-height: 1; margin: -.75rem; transition: transform .6s cubic-bezier(.5, -.3, .7, 1), opacity .6s; will-change: transform; }
.fx-right { animation: fx-right .7s ease-out; box-shadow: 0 0 0 3px #1d8f58, 0 0 20px 4px rgba(29, 143, 88, .6) !important; }
.fx-shake { animation: fx-shake .35s ease-in-out; }
.fx-rise { position: absolute; transform: translate(-50%, -100%); padding: 4px 14px; font: 400 1.7rem/1.1 var(--font-display); color: #fff; background: #1d8f58; border: 3px solid #0d3b23; border-radius: 6px; box-shadow: 3px 3px 0 #0d3b23; white-space: nowrap; animation: fx-rise 1.2s ease-out forwards; }
.fx-flash { position: absolute; inset: 0; box-shadow: inset 0 0 70px 24px rgba(46, 204, 113, .75); animation: fx-fade .9s ease-out forwards; }
.fx-splash { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 20px; text-align: center; color: #fff; cursor: pointer; overflow: hidden; background: radial-gradient(circle at 50% 42%, #5a3fb0 0%, #2b2350 55%, #120e26 100%); animation: fx-fade-in .25s ease-out; }
.fx-splash.is-rank { background: radial-gradient(circle at 50% 42%, #b0457f 0%, #4a1e52 55%, #1a0c22 100%); }
.fx-splash.is-lesson { background: radial-gradient(circle at 50% 42%, #1f9d68 0%, #14523c 55%, #0a2018 100%); }
.fx-splash.leaving { animation: fx-fade .28s ease-in forwards; }
.fx-rays { position: absolute; left: 50%; top: 42%; width: 160vmax; height: 160vmax; margin: -80vmax; background: repeating-conic-gradient(rgba(255, 216, 74, .16) 0 9deg, transparent 9deg 18deg); animation: fx-spin 16s linear infinite; pointer-events: none; }
.fx-splash > :not(.fx-rays) { position: relative; }
.fx-splash-icon { font-size: min(34vh, 34vw); line-height: 1; filter: drop-shadow(0 0 30px rgba(255, 216, 74, .9)); animation: fx-zoom .7s cubic-bezier(.2, 1.7, .4, 1) backwards, fx-wiggle 1.2s ease-in-out .8s 2; }
.fx-splash-eyebrow { margin: 0; font: 400 clamp(1.2rem, 4vh, 2.2rem) var(--font-display); letter-spacing: .08em; text-transform: uppercase; color: #ffd84a; animation: fx-up .5s ease-out .25s backwards; }
.fx-splash-title { margin: 0; font-size: clamp(2.4rem, 10vh, 6rem); color: #fff; text-shadow: 4px 4px 0 rgba(0, 0, 0, .45); animation: fx-up .5s ease-out .4s backwards; }
.fx-splash-detail { margin: 0; max-width: 34em; font-size: clamp(1rem, 2.8vh, 1.5rem); animation: fx-up .5s ease-out .55s backwards; }
.fx-splash-hint { margin: 14px 0 0; font-size: .9rem; opacity: .7; }
@keyframes fx-right { 0% { transform: scale(1); } 35% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes fx-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }
@keyframes fx-rise { 0% { opacity: 0; transform: translate(-50%, -60%) scale(.6); } 20% { opacity: 1; transform: translate(-50%, -110%) scale(1.1); } 80% { opacity: 1; transform: translate(-50%, -190%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -230%) scale(1); } }
@keyframes fx-fade { to { opacity: 0; } }
@keyframes fx-fade-in { from { opacity: 0; } }
@keyframes fx-spin { to { transform: rotate(360deg); } }
@keyframes fx-zoom { from { transform: scale(0) rotate(-40deg); } }
@keyframes fx-up { from { opacity: 0; transform: translateY(24px); } }
@media (prefers-reduced-motion: reduce) { .fx-splash, .fx-splash *, .fx-right, .fx-shake { animation: none !important; } }
.fx-splash.is-lesson .fx-splash-detail { font: 400 clamp(2rem, 8vh, 4.5rem) var(--font-display); color: #ffd84a; }

/* Idle nudge: a slow pulse on the next thing to do */
.nudge { animation: nudge 1.3s ease-in-out infinite; position: relative; z-index: 1; }
.CodeMirror.nudge { animation: nudge-edge 1.3s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 196, 0, 0); transform: scale(1); } 50% { box-shadow: 0 0 0 6px rgba(255, 196, 0, .85), 0 0 22px 8px rgba(255, 196, 0, .5); transform: scale(1.02); } }
@keyframes nudge-edge { 0%, 100% { box-shadow: inset 0 0 0 0 rgba(255, 196, 0, 0); } 50% { box-shadow: inset 0 0 0 5px rgba(255, 196, 0, .9); } }
@media (prefers-reduced-motion: reduce) { .nudge, .CodeMirror.nudge { animation: none; outline: 4px solid #ffc400; } }
.place-ghost { margin: 3px 0 0; padding: 4px 8px; font: 400 var(--code-size, 14px)/1.5 var(--font-code); color: #0b2a52; background: #fff; border-radius: 3px; white-space: pre; opacity: .85; }

/* Type-along ghost text, and the teacher's private stalled list */
.type-ghost { opacity: .5; color: #d6daff; pointer-events: none; white-space: pre; font-style: italic; }
.type-ghost.bad { opacity: 1; color: #ffb0a0; font-style: normal; font-weight: 600; }
:root[data-editor='day'] .type-ghost, :root[data-editor='soft'] .type-ghost { color: #4a4f80; }
:root[data-editor='day'] .type-ghost.bad, :root[data-editor='soft'] .type-ghost.bad { color: #b3261e; }
.stalled-card { padding: 8px 12px; background: var(--paper-2); border: 2px dashed var(--line); border-radius: 3px; }
.stalled-card summary { cursor: pointer; }

/* Journey map: a glow behind each character, and a tag on your own */
.halo-in { stop-color: #fff3a6; stop-opacity: 1; }
.halo-mid { stop-color: #ffd23f; stop-opacity: .8; }
.halo-out { stop-color: #ffc400; stop-opacity: 0; }
.you-tag rect, .you-tag polygon { fill: var(--accent); }
.you-tag rect { stroke: #fff; stroke-width: 2; }
.you-tag text { fill: var(--accent-ink); font: 700 11px var(--font-body); }
@media (prefers-reduced-motion: no-preference) { .map-halo { animation: halo-pulse 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; } .you-tag { animation: map-bob 1.2s steps(2) infinite; } }
@keyframes halo-pulse { 50% { opacity: .7; transform: scale(1.08); } }

/* Journey map: the pixel overworld under the trails */
.map-art { image-rendering: pixelated; }
.map-svg { --map-path: #f3e3bd; --map-path-edge: #7a6248; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']):not([data-theme='contrast']) .map-art { filter: brightness(.42) saturate(.75) hue-rotate(8deg); } }
:root[data-theme='dark'] .map-art { filter: brightness(.42) saturate(.75) hue-rotate(8deg); }
:root[data-theme='contrast'] .map-art { display: none; }
.node-plate { stroke: rgba(60, 50, 40, .35); }
.map-cloud { fill: rgba(30, 40, 60, .07); }
:root[data-theme='contrast'] .map-cloud { display: none; }

/* The 3D journey map */
.map3d { position: relative; overflow-x: auto; overflow-y: hidden; }
.map3d-stage { position: sticky; left: 0; width: 100%; height: 730px; overflow: hidden; background: #b9d0e6; }
.map3d-canvas { display: block; width: 100%; height: 730px; image-rendering: pixelated; }
.map3d-spacer { height: 1px; margin-top: -1px; }
.map3d-overlay { position: absolute; inset: 0; pointer-events: none; }
.map3d-sign { position: absolute; left: 0; top: 6px; padding: 1px 10px; white-space: nowrap; font: 400 20px/1.3 var(--font-display); color: var(--ink); background: var(--card); border: 2px solid var(--line); border-radius: 4px; box-shadow: 2px 2px 0 rgba(0, 0, 0, .25); z-index: 900; }
.pin { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; }
.pin > * { pointer-events: auto; }
/* A stop is a little building standing back from the trail, with a badge for done, next, or not yet.
   The pin itself sits on the road; --by and --bs carry the building to its own plot behind. */
.pin-stop { position: absolute; left: -36px; top: -60px; width: 72px; height: 72px; padding: 0; background: none; border: 0; transform-origin: 36px 60px; transform: translateY(var(--by, 0)) scale(var(--bs, 1)); }
.pin-stop img { display: block; width: 72px; height: 72px; max-width: none; image-rendering: pixelated; }
button.pin-stop { cursor: pointer; }
button.pin-stop:hover img, button.pin-stop:focus-visible img { filter: drop-shadow(0 0 6px #ffd84a) brightness(1.08); }
.pin-badge { position: absolute; right: -2px; top: 4px; width: 24px; height: 24px; display: grid; place-items: center; font: 700 13px/1 var(--font-body); color: var(--ink); background: var(--card); border: 4px solid var(--line); border-radius: 50%; box-shadow: 0 0 0 1.5px rgba(38, 30, 52, .85), 0 2px 0 1.5px rgba(0, 0, 0, .3); }
.pin-badge:empty { width: 16px; height: 16px; right: 2px; top: 8px; border-width: 4px; }
.pin.done .pin-badge { background: #1d8f58; color: #fff; }
.pin.current .pin-badge { background: var(--accent); color: #fff; box-shadow: 0 2px 0 rgba(0, 0, 0, .3), 0 0 0 3px rgba(255, 255, 255, .9), 0 0 0 6px var(--accent); }
.pin.current .pin-stop img { filter: drop-shadow(0 0 7px #fff) drop-shadow(0 0 4px var(--accent)); }
.pin.offroad .pin-stop, .pin.offroad .pin-name { opacity: .6; }
.pin-name { position: absolute; left: 0; top: var(--drop, 12px); transform: translateX(-50%) scale(var(--name, 1)); transform-origin: 50% 0; padding: 0 6px; white-space: nowrap; font: 12px/1.5 var(--font-body); color: var(--ink); background: var(--card); border: 1px solid rgba(38, 30, 52, .6); border-radius: 4px; box-shadow: 0 1px 0 rgba(0, 0, 0, .25); }
/* People stand on the road in front of the stop and to its right: feet on the paving, a dark
   outline so they are easy to find on any land, and a shadow that falls the way the land's do.
   A crowd stands in two rows, the back row drawn first. */
.pin-people { position: absolute; left: 34px; top: 0; width: 0; height: 0; }
.pin-person { position: absolute; width: 0; height: 0; }
.pin-person::before { content: ''; position: absolute; left: -11px; top: -6px; width: 34px; height: 11px; border-radius: 50%; background: radial-gradient(closest-side, rgba(24, 18, 40, .62), rgba(24, 18, 40, .34) 62%, rgba(24, 18, 40, 0)); transform: skewX(-24deg); }
.pin-person img { position: absolute; left: -26px; bottom: -1px; width: 78px; height: 52px; max-width: none; image-rendering: pixelated; filter: drop-shadow(1px 0 0 #261e34) drop-shadow(-1px 0 0 #261e34) drop-shadow(0 1px 0 #261e34) drop-shadow(0 -1px 0 #261e34); }
.pin-person.behind img { filter: drop-shadow(1px 0 0 #261e34) drop-shadow(-1px 0 0 #261e34) drop-shadow(0 1px 0 #261e34) drop-shadow(0 -1px 0 #261e34) brightness(.93); }
.pin-person.me img { filter: drop-shadow(1px 0 0 #261e34) drop-shadow(-1px 0 0 #261e34) drop-shadow(0 1px 0 #261e34) drop-shadow(0 -1px 0 #261e34) drop-shadow(0 0 5px var(--accent)); }
.pin-you { position: absolute; left: 0; top: -68px; transform: translateX(-50%); padding: 0 7px; font: 700 11px/1.6 var(--font-body); color: var(--accent-ink); background: var(--accent); border: 2px solid #261e34; border-radius: 9px; z-index: 2; }
.pin-count { position: absolute; transform: translateX(-50%); min-width: 22px; padding: 0 5px; font: 700 12px/1.6 var(--font-body); color: var(--accent-ink); background: var(--accent); border: 2px solid #261e34; border-radius: 11px; cursor: pointer; z-index: 3; }
@media (prefers-reduced-motion: no-preference) { .pin-person.me img { animation: pin-bob 1.2s steps(2) infinite; } }
@keyframes pin-bob { 50% { transform: translateY(-4px); } }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']):not([data-theme='contrast']) .map3d-canvas { filter: brightness(.6) saturate(.8); } }
:root[data-theme='dark'] .map3d-canvas { filter: brightness(.6) saturate(.8); }
.map-wrap > .row { margin-bottom: 6px; }

/* Life on the 3D map: animals, birds, and a balloon */
.critter { position: absolute; left: 0; top: 0; pointer-events: none; }
.critter img, .map3d-sky img { display: block; width: 100%; max-width: none; image-rendering: pixelated; }
.map3d-sky { position: absolute; left: 0; top: 0; height: 190px; pointer-events: none; will-change: transform; }
.map3d-overlay { overflow: hidden; }
.map3d-sky .flock { position: absolute; width: 70px; height: 30px; }
.map3d-sky .bird { position: absolute; width: 21px; }
.critter.twinkle img { filter: drop-shadow(0 0 4px #fff3a0); }
@media (prefers-reduced-motion: no-preference) {
  .critter.roam img { animation: roam 9s steps(24) infinite; }
  .critter.hop img { animation: hop 3s steps(6) infinite; }
  .critter.bob img { animation: critter-bob 4s ease-in-out infinite; }
  .critter.flit img { animation: flit 5s steps(10) infinite; }
  .critter.idle img { animation: critter-idle 4s steps(2) infinite; }
  .critter.twinkle img { animation: twinkle 3s ease-in-out infinite; }
  .map3d-sky .flock { animation: flock 40s ease-in-out infinite; }
}
/* How far each animal travels matches TRAVEL in js/game/critters.js, which keeps that much ground or water clear for it. */
@keyframes roam { 0% { transform: translateX(0) scaleX(1); } 46% { transform: translateX(110%) scaleX(1); } 50% { transform: translateX(110%) scaleX(-1); } 96% { transform: translateX(0) scaleX(-1); } 100% { transform: translateX(0) scaleX(1); } }
@keyframes hop { 0%, 60%, 100% { transform: translate(0, 0); } 15% { transform: translate(20%, -45%); } 30% { transform: translate(40%, 0); } 45% { transform: translate(60%, -45%); } }
@keyframes critter-bob { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(35%, 6%); } }
@keyframes critter-idle { 0%, 70%, 100% { transform: translateY(0); } 80% { transform: translateY(4%); } }
@keyframes flit { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(150%, -120%); } 50% { transform: translate(-80%, -200%); } 75% { transform: translate(-160%, -60%); } }
@keyframes twinkle { 0%, 100% { opacity: .15; transform: translate(0, 0); } 50% { opacity: 1; transform: translate(60%, -80%); } }
@keyframes balloon { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(26px, -9px); } }
@keyframes flock { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(90px, -12px); } }
.node-dot { fill: var(--ink); opacity: .4; }

.assignment-text { white-space: pre-wrap; font: .82rem/1.45 var(--font-body); background: var(--paper-2); border: 1px solid var(--line); padding: 8px 10px; margin: 6px 0 0; max-height: 18em; overflow: auto; font-weight: 400; }

.submitted-note { margin: 0; font-weight: 700; color: #1f7a3d; }
:root[data-theme='dark'] .submitted-note { color: #7fe0a0; }

/* Loading: a hiker hopping along a dotted trail. Used when the app starts and between pages. */
.loading { display: grid; justify-items: center; gap: 10px; padding: 9vh 16px; text-align: center; }
.boot-screen { min-height: 70vh; align-content: center; }
.loading-word { margin: 0; font: 400 3rem/1 var(--font-display); color: var(--ink); }
.loading-text { margin: 0; color: var(--ink-2); font-weight: 700; }
.loading-trail { position: relative; width: 300px; height: 64px; background: radial-gradient(circle, var(--line) 0 4px, transparent 5px) 0 100% / 30px 14px repeat-x; }
/* A square hiker with two eyes and a yellow pack. */
.loading-hiker { position: absolute; left: 0; bottom: 16px; width: 30px; height: 34px; background: radial-gradient(circle, var(--line) 0 2.5px, transparent 3px) 8px 9px / 12px 8px no-repeat, radial-gradient(circle, var(--line) 0 2.5px, transparent 3px) 19px 9px / 12px 8px no-repeat, linear-gradient(90deg, #f4cf49 0 7px, transparent 7px), var(--accent, #c43f29); border: 3px solid var(--line); border-radius: 3px; box-shadow: 4px 4px 0 rgba(0, 0, 0, .18); animation: hike 2.4s steps(9) infinite, hike-hop .267s ease-in-out infinite alternate; }
@keyframes hike { from { left: 0; } to { left: 270px; } }
@keyframes hike-hop { from { transform: translateY(0); } to { transform: translateY(-12px); } }
@media (prefers-reduced-motion: reduce) { .loading-hiker { animation: none; left: 135px; } }

/* A student's progress summary, laid out to print on one or two pages. */
.summary { max-width: 900px; }
.summary h2 { font-size: 1.4rem; margin-bottom: 8px; }
.summary-head { display: flex; gap: 16px; align-items: center; }
.summary-head img { image-rendering: pixelated; }
.glance { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 0; }
.glance div { border: 2px solid var(--line); background: var(--card); padding: 10px 12px; }
.glance dt { font: 700 1.5rem var(--font-body); }
.glance dd { margin: 0; font-size: .88rem; color: var(--ink-2); }
.summary-table tbody th { text-align: left; font-weight: 700; border-bottom: 1px solid var(--paper-2); background: none; }
.summary .quote { border-left: 4px solid var(--line); padding: 2px 0 2px 12px; margin: 8px 0; }
.summary .quote p { margin: 0; }
.summary-badges { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px 20px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
@media print {
  .topbar, .demo-banner, .no-print, #toasts, #modal-root { display: none !important; }
  body, .page { background: #fff !important; color: #000 !important; }
  html { font-size: 11.5px; }
  .summary { max-width: none; gap: 10px; }
  .summary .quote { margin: 4px 0; }
  .summary section { break-inside: avoid; }
  .glance div, .card { box-shadow: none !important; }
  a { color: inherit; text-decoration: none; }
}

/* The "Today" card: what a lesson builds and its key ideas. */
.today h2 { font-size: 2rem; }
.today h3 { font: 700 .8rem var(--font-body); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2); margin: 0; }
.today-top { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.today-top > .stack { flex: 1 1 280px; gap: 8px; }
.today-demo { margin: 0; flex: 0 0 220px; }
.today-frame { width: 220px; height: 220px; background: #14141f; border: 2px solid var(--line); }
/* The game is drawn at its full 400 dots and shrunk to fit, so the whole picture shows. */
.today-frame { overflow: hidden; box-sizing: content-box; }
.today-frame .player { width: 400px; height: 400px; transform: scale(.55); transform-origin: 0 0; }
.today-build { font-size: 1.15rem; font-weight: 700; margin: 0 0 6px; }
.ideas { margin: 0; display: grid; gap: 8px; }
.ideas div { border-left: 4px solid var(--sun); padding-left: 10px; }
.ideas dt { font: 700 1rem var(--font-code); }
.ideas dd { margin: 0; }

/* The lesson page, second look. One job per area: the step on the left says what to do, the code
   is in the middle, and the game with its Run button is on the right. Bright blocks of color mark
   what kind of step this is, so a student can find their place at a glance. */
:root { --step-do: #ffb703; --step-read: #5cc8ff; --step-ask: #ff7ab6; --go: #18c07a; --go-edge: #0a7a4b; }

/* Inside a lesson the top bar keeps only the way home, XP and who is signed in. */
body.in-workspace .navs a.nav:not([href='#/']) { display: none; }
body.in-workspace .tb-bug, body.in-workspace .tb-out { display: none; }

.lesson-head { padding: 6px 14px; }
.lesson-head h1 { font-size: 1.55rem; }
.lesson-actions { gap: 8px; align-items: center; }
.btn.key-ideas { background: var(--sun); color: #2b2350; }
.more-menu { position: relative; }
.more-menu > summary { list-style: none; cursor: pointer; }
.more-menu > summary::-webkit-details-marker { display: none; }
.more-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; display: flex; flex-direction: column; gap: 6px; min-width: 190px; padding: 10px; background: var(--card); border: 3px solid var(--line); box-shadow: 4px 4px 0 var(--line); }
.more-list .btn { justify-content: flex-start; box-shadow: none; white-space: nowrap; }

.panes { grid-template-columns: minmax(350px, 31%) 1fr minmax(320px, 420px); }
.steps { background: var(--paper-2); gap: 10px; padding: 12px 12px 30px; }

/* Progress: small, in one place, and out of the way of the instruction. */
.step-dots { gap: 3px; }
.step-dots button { width: 24px; height: 24px; font-size: .7rem; }

/* The instruction card. */
.step-body { background: var(--card); border: 3px solid var(--line); border-radius: 4px; box-shadow: 4px 4px 0 var(--line); padding: 0 14px 14px; gap: 12px; }
.step-body > .stack { gap: 12px; }
.step-body > h2:first-child, .step-body > .stack > h2:first-child { margin-top: 14px; }
.step-kind { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; align-self: stretch; margin: 0 -14px; padding: 8px 14px; border: 0; border-bottom: 3px solid var(--line); border-radius: 0; color: #2b2350; }
.step-kind b { font: 400 1.25rem var(--font-display); letter-spacing: .02em; }
.step-kind small { font: 700 .8rem var(--font-body); opacity: .85; white-space: nowrap; }
.step-kind.do { background: var(--step-do); color: #2b2350; }
.step-kind.read { background: var(--step-read); color: #2b2350; }
.step-kind.answer { background: var(--step-ask); color: #2b2350; }
.step-body h2 { font-size: 1.7rem; }
.step-do { font-size: 1.2rem; line-height: 1.45; }
.quiz-q { font-size: 1.2rem; line-height: 1.4; }

/* Code to add: large, labelled, and set apart from the sentence above it. */
.snippet-wrap { display: flex; flex-direction: column; }
.snippet-label { margin: 0; align-self: flex-start; padding: 3px 10px; background: var(--sun); color: #2b2350; border: 2px solid var(--line); border-bottom: 0; border-radius: 4px 4px 0 0; font: 700 .78rem var(--font-body); letter-spacing: .04em; text-transform: uppercase; }
.snippet { font-size: .9rem; line-height: 1.6; padding: 12px 12px; border: 2px solid var(--line); border-radius: 0 4px 4px 4px; }
.snippet-wrap > .snippet { border-left: 6px solid var(--sun); }

/* Why? and Hint read as buttons to press, not as more text. */
.step-body details.hint > summary { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 2px solid var(--line); border-radius: 999px; background: var(--paper-2); font-weight: 700; cursor: pointer; list-style: none; }
.step-body details.hint > summary::-webkit-details-marker { display: none; }
.step-body details.hint > summary::before { content: '＋'; }
.step-body details.hint[open] > summary::before { content: '－'; }
.step-body details.hint[open] > summary { margin-bottom: 8px; }

/* Moving on is the biggest thing on the card. */
.step-nav { margin-top: 6px; gap: 8px; align-items: stretch; }
.step-nav .step-next, .step-nav .btn.primary { flex: 1; font-size: 1.15rem; padding: 12px 16px; }
.step-nav .btn.primary { background: var(--go); color: #06301e; border-color: var(--line); }
.quiz-option { font-size: 1.05rem; padding: 12px 14px; border-width: 3px; box-shadow: 3px 3px 0 var(--line); }

/* Run sits over the game, as wide as the game, where a student is already looking. */
.run-bar { display: flex; gap: 8px; align-items: stretch; width: 100%; max-width: 400px; align-self: center; }
.run-bar .btn.run { flex: 1; font: 400 1.7rem var(--font-display); letter-spacing: .03em; padding: 8px 14px; background: var(--go); color: #06301e; border: 3px solid var(--line); box-shadow: 0 5px 0 var(--go-edge); }
.run-bar .btn.run:hover { transform: translateY(-1px); box-shadow: 0 6px 0 var(--go-edge); }
.run-bar .btn.run:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--go-edge); }
.run-bar .btn:not(.run) { font-size: .85rem; }

:root[data-theme='contrast'] { --step-do: #ffd000; --step-read: #9fe0ff; --step-ask: #ffb0d3; }

/* Menus in the top bar: a few named places, each opening a short list. */
body.in-workspace .navs a.nav:not([href='#/']) { display: revert; }
.nav-menu { position: relative; }
.nav-menu > summary { list-style: none; cursor: pointer; }
.nav-menu > summary::-webkit-details-marker { display: none; }
.nav-menu[open] > summary { background: rgba(255, 255, 255, .13); }
.nav-menu > summary[aria-current='page'] { background: var(--sun); color: #2b2350; font-weight: 700; }
.nav-list { position: absolute; left: 0; top: calc(100% + 8px); z-index: 30; display: flex; flex-direction: column; gap: 4px; min-width: 200px; padding: 8px; background: var(--card); color: var(--ink); border: 3px solid var(--line); box-shadow: 4px 4px 0 var(--line); }
.nav-list .nav-item { display: block; width: 100%; text-align: left; padding: 9px 12px; font: 700 1rem var(--font-body); color: var(--ink); background: none; border: 0; border-radius: 3px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.nav-list .nav-item:hover, .nav-list .nav-item:focus-visible { background: var(--sun); color: #2b2350; }

/* Steps run across the top, under the lesson's name, so the instruction card has the whole panel. */
.step-track { padding: 6px 14px; background: var(--paper-2); border-bottom: 2px solid var(--line); overflow-x: auto; }
.step-track .step-dots { flex-wrap: nowrap; gap: 5px; align-items: center; }
.step-track .step-dots button { width: 30px; height: 30px; font-size: .8rem; flex: none; }
.step-track .step-dots li + li::before { content: ''; display: inline-block; width: 8px; height: 3px; margin-right: 5px; background: var(--line); vertical-align: middle; opacity: .5; }
.step-track .step-dots li { display: flex; align-items: center; }

/* Answers: each choice its own bright color, so they read as buttons and as different. */
.quiz-option { color: #1b1640; font-weight: 700; border-color: var(--line); }
.quiz-option.c0 { background: #6ea8ff; }
.quiz-option.c1 { background: #ffb347; }
.quiz-option.c2 { background: #c9a0ff; }
.quiz-option.c3 { background: #5fd6c8; }
.quiz-option:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.quiz-option.c0:hover:not(:disabled) { background: #6ea8ff; }
.quiz-option.c1:hover:not(:disabled) { background: #ffb347; }
.quiz-option.c2:hover:not(:disabled) { background: #c9a0ff; }
.quiz-option.c3:hover:not(:disabled) { background: #5fd6c8; }
.quiz-option code { background: rgba(255, 255, 255, .6); color: #1b1640; }
.quiz-option.right { background: #37d67a; color: #06301e; }
.quiz-option.right::before { content: '✓ '; }
.quiz-option.wrong { background: var(--paper-2); color: var(--ink-2); text-decoration: line-through; opacity: .7; }

/* A question to read before the code to add is shown. */
.read-first { display: flex; flex-direction: column; gap: 10px; padding: 0 12px 12px; border: 3px solid var(--line); border-radius: 4px; background: var(--paper-2); }
.read-first-tag { margin: 0 -12px; padding: 6px 12px; background: var(--step-ask); color: #2b2350; border-bottom: 3px solid var(--line); font: 400 1.05rem var(--font-display); letter-spacing: .02em; }
.read-first .quiz-q { font-size: 1.1rem; }
.read-first-note { margin: 0; font-size: .88rem; color: var(--ink-2); }
.read-first-done { margin: 0; padding: 8px 12px; border-left: 6px solid var(--go); background: var(--paper-2); font-weight: 700; }

/* Panels a student can resize. */
.split { display: none; }
.console { flex: 1 1 var(--h-console, 120px); min-height: var(--h-console, 120px); }
.game-frame { flex: none; max-width: none; aspect-ratio: auto; }
.run-bar { max-width: none; }
@media (min-width: 1051px) {
  .panes { grid-template-columns: var(--w-steps, minmax(350px, 31%)) 10px minmax(0, 1fr) 10px var(--w-game, minmax(320px, 420px)); }
  .steps { border-right: 0; }
  .game-pane { border-left: 0; overflow: hidden; }
  .split { display: flex; align-items: center; justify-content: center; background: var(--line); touch-action: none; }
  .split.down { cursor: col-resize; }
  .split.across { cursor: row-resize; height: 10px; align-self: stretch; flex: none; border-radius: 3px; }
  .split span { display: block; border-radius: 2px; background: var(--paper); opacity: .7; }
  .split.down span { width: 3px; height: 36px; }
  .split.across span { width: 36px; height: 3px; }
  .split:hover, .split:focus-visible, .split.dragging { background: var(--accent); outline: none; }
}
@media (max-width: 1050px) { .panes { grid-template-columns: 1fr; } }
.read-first .quiz-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(95px, 1fr)); }
.read-first .quiz-option { text-align: center; padding: 10px 8px; }
.read-first-done { display: flex; gap: 8px; }
.read-first-done p { margin: 0; }

/* Buttons with depth: a darker lip along the bottom that the button sinks into when pressed. */
.btn, .quiz-option { box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .2), 0 3px 0 var(--line); padding-bottom: 10px; transition: transform .06s ease-out, box-shadow .06s ease-out, filter .06s; }
.btn:hover:not(:disabled), .quiz-option:hover:not(:disabled) { transform: translateY(-2px); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .2), 0 5px 0 var(--line); filter: brightness(1.06); }
.btn:active:not(:disabled), .quiz-option:active:not(:disabled) { transform: translateY(3px); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .2), 0 0 0 var(--line); filter: brightness(.95); }
.btn:disabled, .quiz-option:disabled { box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .12); transform: none; }
.btn.small { box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18), 0 2px 0 var(--line); padding-bottom: 5px; }
.btn.small:hover:not(:disabled) { box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18), 0 3px 0 var(--line); transform: translateY(-1px); }
.btn.small:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .18); }
.btn.big { padding-bottom: 14px; }
.btn.link, .btn.link:hover, .btn.link:active { box-shadow: none; transform: none; filter: none; padding-bottom: 2px; }
.more-list .btn, .more-list .btn:hover:not(:disabled) { box-shadow: none; padding-bottom: 7px; transform: none; }
.quiz-option { padding-bottom: 15px; }
.read-first .quiz-option { padding-bottom: 13px; }
.step-nav .step-next, .step-nav .btn.primary { padding-bottom: 15px; }
.run-bar .btn.run { box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .18), 0 5px 0 var(--go-edge); padding-bottom: 13px; }
.run-bar .btn.run:hover:not(:disabled) { transform: translateY(-2px); box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .18), 0 7px 0 var(--go-edge); }
.run-bar .btn.run:active:not(:disabled) { transform: translateY(5px); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .18), 0 0 0 var(--go-edge); }

/* Grid is a switch: it slides and turns green when the grid is showing. */
.btn.toggle { gap: 8px; font-size: .95rem; }
.btn.toggle[aria-pressed='true'] { background: var(--card); color: var(--ink); }
.switch { position: relative; width: 38px; height: 20px; border: 2px solid var(--line); border-radius: 999px; background: var(--paper-2); flex: none; transition: background .12s; }
.switch i { position: absolute; top: 1px; left: 1px; width: 14px; height: 14px; border-radius: 50%; background: var(--ink-2); transition: left .12s, background .12s; }
.btn.toggle[aria-pressed='true'] .switch { background: var(--go); }
.btn.toggle[aria-pressed='true'] .switch i { left: 19px; background: #fff; border: 1px solid var(--line); }

/* The game takes the room first. In a small panel the buttons over it shrink. */
.run-bar.compact .btn.run { font-size: 1.15rem; padding: 4px 10px 9px; }
.run-bar.compact .btn.toggle { font-size: .8rem; padding: 4px 8px 8px; gap: 5px; }
.run-bar.compact .switch { width: 30px; height: 16px; }
.run-bar.compact .switch i { width: 10px; height: 10px; }
.run-bar.compact .btn.toggle[aria-pressed='true'] .switch i { left: 15px; }
.game-pane { padding: 8px; }

/* Grid has its own color, and an instruction that names Run or Grid shows it as that button. */
:root { --grid: #b9a2ff; }
.btn.toggle, .btn.toggle[aria-pressed='true'] { background: var(--grid); color: #1b1640; }
.say-run, .say-grid { display: inline-block; padding: 0 8px 2px; border: 2px solid var(--line); border-radius: 4px; color: #1b1640; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18); white-space: nowrap; }
.say-run { background: var(--go); }
.say-run::before { content: '▶ '; font-size: .8em; }
.say-grid { background: var(--grid); }

/* Where to look first: the instruction card is outlined as a lesson opens, and Run twinkles. */
@keyframes card-hello { 0%, 100% { outline-color: transparent; outline-offset: 2px; } 50% { outline-color: var(--sun); outline-offset: 6px; } }
.step-body.hello { outline: 5px solid transparent; animation: card-hello 1.4s ease-in-out 5; }
.run-bar .btn.run { position: relative; overflow: visible; }
.twinkle { position: absolute; top: 4px; right: 12px; font-style: normal; font-size: 1rem; color: #fff; text-shadow: 0 0 6px #fff; opacity: 0; pointer-events: none; animation: run-twinkle 3.2s ease-in-out infinite; }
.twinkle.two { top: auto; bottom: 10px; right: auto; left: 14px; font-size: .75rem; animation-delay: 1.6s; }
@keyframes run-twinkle { 0%, 70%, 100% { opacity: 0; transform: scale(.3) rotate(0deg); } 80% { opacity: 1; transform: scale(1.2) rotate(40deg); } 90% { opacity: .4; transform: scale(.7) rotate(80deg); } }
@media (prefers-reduced-motion: reduce) { .step-body.hello { animation: none; outline-color: var(--sun); } .twinkle { animation: none; opacity: 0; } }

/* What matters in an instruction stands out: code is a chip that stays on one line, and a key idea
   is a yellow chip that opens its meaning. */
.say-code { display: inline-block; white-space: nowrap; padding: 0 7px 1px; margin: 1px 0; background: #dff1ff; color: #1b1640; border: 2px solid var(--line); border-radius: 4px; font-size: .92em; font-weight: 700; }
.say-idea { display: inline-block; white-space: nowrap; padding: 0 8px 2px; margin: 1px 0; background: var(--sun); color: #2b2350; border: 2px solid var(--line); border-radius: 4px; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18); cursor: pointer; }
.say-idea:hover, .say-idea:focus-visible { filter: brightness(1.08); transform: translateY(-1px); outline: none; }
.say-idea:active { transform: translateY(2px); box-shadow: none; }
code.say-idea { background: var(--sun); }
.ideas div.focus { background: var(--sun); color: #2b2350; border-left-color: var(--line); padding: 6px 10px; border-radius: 0 4px 4px 0; }

/* Line numbers on code in a question, so "line 3" can be found. */
.snippet-n { display: inline-block; width: 1.4em; margin-right: 12px; padding-right: 6px; text-align: right; color: var(--code-number, #9b94c7); border-right: 2px solid rgba(255, 255, 255, .18); user-select: none; }

/* Pressing Run shows that something happened. */
@keyframes ran-flash { 0% { box-shadow: 0 0 0 0 var(--go); } 40% { box-shadow: 0 0 0 7px var(--go); } 100% { box-shadow: 0 0 0 0 transparent; } }
.game-frame.ran { animation: ran-flash .6s ease-out 1; }
.console .ran { color: var(--ink); border-left: 5px solid var(--go); padding-left: 8px; }

/* High contrast: the green buttons carry black text on a brighter green. */
:root[data-theme='contrast'] { --go: #4dffa6; }
:root[data-theme='contrast'] .btn.run, :root[data-theme='contrast'] .step-nav .btn.primary { color: #000; }

/* Rarity words are small text, so they use a darker ink than the borders on light pages. */
:root { --r-rare-ink: #1f5fb8; --r-epic-ink: #7a35b5; --r-legendary-ink: #7d5b00; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']):not([data-theme='contrast']) { --r-rare-ink: #8cbcff; --r-epic-ink: #d1a4ff; --r-legendary-ink: #ffd35c; } }
:root[data-theme='dark'] { --r-rare-ink: #8cbcff; --r-epic-ink: #d1a4ff; --r-legendary-ink: #ffd35c; }
:root[data-theme='contrast'] { --r-rare-ink: #143f80; --r-epic-ink: #55208a; --r-legendary-ink: #5c4200; }
.r-rare .rarity { color: var(--r-rare-ink); }
.r-epic .rarity { color: var(--r-epic-ink); }
.r-legendary .rarity { color: var(--r-legendary-ink); }

/* Trail names: the real name a teacher keeps in their own browser sits quietly beside the trail name. */
.real-name { margin-left: 8px; font-size: .85rem; align-self: center; }
.name-key { border-left: 8px solid var(--sun); }
.trail-name-note { margin: 0; padding: 10px 12px; border: 2px solid var(--line); border-left: 8px solid var(--sun); background: var(--paper-2); }

/* Bringing a class over: what is sent and what stays, side by side. */
.import-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.import-two > div { padding: 12px 14px; border: 2px solid var(--line); border-radius: 4px; background: var(--paper-2); }
.import-two > div:last-child { border-left: 8px solid var(--go); }
