/* Earth: a light, paper-and-cards look (fonts and tones in the spirit of geo.tobiasbuilds.com). The globe itself is
   styled in earth.js; this file is only the chrome around it. */
:root {
  --font: "Fredoka", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Bricolage Grotesque", var(--font);
  --font-mono: "Martian Mono", ui-monospace, Menlo, monospace;
  --font-serif: "Instrument Serif", Georgia, serif;
  --paper: #efece6; --paper-2: #f6f4ef; --panel: #fbfaf7; --line: #e2ddd3; --line-2: #ece8e0;
  --fg: #2f3b45; --dim: #687682; --accent: #e8743b; --accent-deep: #cf3a2f; --accent-soft: #fbe6dc; --teal: #2f7d8c; --ice: #d8e7f0;
  --radius: 14px; --radius-s: 9px; --radius-l: 22px;
  --drawer-w: clamp(460px, 40vw, 620px); /* the lesson drawer; earth.js/lessons.js read its real width */
  --shadow: 0 6px 18px rgba(46,56,66,.14); --shadow-s: 0 2px 6px rgba(46,56,66,.1); --shadow-l: 0 10px 26px rgba(46,56,66,.18);
  --ease: cubic-bezier(.22,.61,.36,1);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height:100%; margin:0; }
body { background:var(--paper); color:var(--fg); font-family:var(--font); font-weight:400; overflow:hidden; -webkit-font-smoothing:antialiased; }
#map { position:fixed; inset:0; background:var(--paper); }
#map canvas { outline:none; }
button { font-family:inherit; }

/* labels in small mono caps, like the reference's "COUNTRY" / "CAPITAL" */
.label, .card small, .lesson-head small, .lesson-body small, .lesson-card small, .help h3, .tl-ticks span, .drawer-head small {
  font-family:var(--font-mono); font-size:10px; font-weight:500; letter-spacing:.14em; text-transform:uppercase; color:var(--dim);
}

/* Top bar */
.top { position:fixed; top:0; left:0; right:0; display:flex; align-items:center; gap:10px; padding:12px 14px; pointer-events:none; z-index:5; }
.top > * { pointer-events:auto; }
.brand { display:flex; align-items:center; gap:8px; cursor:default; user-select:none; font-family:var(--font-display); font-weight:800; font-size:17px; letter-spacing:-.01em; color:var(--fg); text-decoration:none; padding:6px; background:var(--panel); border:1px solid var(--line); border-radius:999px; box-shadow:var(--shadow-s); white-space:nowrap; }
.brand b { font-weight:800; color:var(--accent-deep); }
.brand em { font-family:var(--font-serif); font-style:italic; font-weight:400; font-size:19px; color:var(--teal); margin-left:0; }
.brand-logo { width:22px; height:22px; border-radius:6px; display:block; } /* the Recess R alone; "Earth" was dropped Nov 4 */
/* The layer chips stay tucked behind the layers button and peel out from it, right to left, on hover or tap. */
.layers { display:flex; flex-wrap:wrap; gap:6px; margin-left:auto; justify-content:flex-end; }
.layers .chip { opacity:0; transform:translateX(18px) scale(.92); pointer-events:none; transition:opacity .18s var(--ease), transform .22s var(--ease), background .2s, border-color .2s, color .2s; transition-delay:calc(var(--i, 0) * 15ms); }
.top.layers-open .layers .chip { opacity:1; transform:none; pointer-events:auto; transition-delay:calc(var(--i, 0) * 35ms); }
.layers-btn { display:grid; place-items:center; transition:background .2s, border-color .2s, color .2s; }
.layers-btn svg { display:block; }
.top.layers-open .layers-btn { background:var(--fg); border-color:var(--fg); color:#fff; }
.chip { font-family:var(--font); font-size:13px; font-weight:500; color:var(--fg); background:var(--panel); border:1px solid var(--line); border-radius:999px; padding:8px 13px; cursor:pointer; box-shadow:var(--shadow-s); transition:background var(--ease) .2s, border-color .2s, color .2s; }
.chip:hover { border-color:#cfc8bb; }
.chip[aria-pressed="true"] { background:var(--fg); border-color:var(--fg); color:#fff; }
.icon { width:36px; height:36px; border-radius:50%; border:1px solid var(--line); background:var(--panel); color:var(--fg); font-family:var(--font-display); font-weight:800; font-size:16px; cursor:pointer; box-shadow:var(--shadow-s); }
.icon:hover { border-color:#cfc8bb; }
.icon.small { width:30px; height:30px; font-size:14px; }

/* Place / event card */
.card { position:fixed; left:14px; bottom:60px; width:min(380px, calc(100vw - 28px)); padding:18px 20px 20px; background:var(--panel); border:1px solid var(--line); border-radius:var(--radius-l); box-shadow:var(--shadow-l); z-index:5; }
.card[hidden] { display:none; }
.card small { color:var(--accent-deep); }
.card h2 { font-family:var(--font-display); font-weight:800; font-size:30px; line-height:1.02; letter-spacing:-.02em; margin:6px 0 10px; }
.card p { margin:0; color:var(--fg); font-size:15px; line-height:1.55; }
.close { position:absolute; top:10px; right:10px; width:32px; height:32px; flex:none; padding:0; border-radius:50%; border:1px solid var(--line); background:var(--panel); color:var(--dim); font-size:0; line-height:0; cursor:pointer; }
/* the X is two crossed lines, so it sits exactly in the middle whatever the font */
.close::before, .close::after { content:""; position:absolute; left:50%; top:50%; width:42%; height:1.6px; border-radius:2px; background:currentColor; transform:translate(-50%, -50%) rotate(45deg); }
.close::after { transform:translate(-50%, -50%) rotate(-45deg); }
.close:hover { color:var(--fg); border-color:#cfc8bb; }

/* Bottom-left bits */
.bottom { position:fixed; left:14px; bottom:14px; display:flex; align-items:center; gap:8px; z-index:5; }
.coords { position:fixed; right:14px; bottom:14px; z-index:5; pointer-events:none; font-family:var(--font-mono); font-size:11px; color:var(--dim); background:var(--panel); border:1px solid var(--line); border-radius:999px; padding:9px 12px; min-width:150px; text-align:center; box-shadow:var(--shadow-s); }
.coords:empty { display:none; }
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib { margin-right:196px; }
.pill { font-family:var(--font); font-size:13px; font-weight:500; color:var(--fg); background:var(--panel); border:1px solid var(--line); border-radius:999px; padding:9px 14px; cursor:pointer; box-shadow:var(--shadow-s); }
.pill:hover { border-color:#cfc8bb; }
.pill.done { border-color:var(--teal); color:var(--teal); }
.pill.gold { background:var(--accent); border-color:var(--accent); color:#fff; }
.pill.gold:hover { background:#d9682f; }
.pill-tl[aria-pressed="true"] { background:var(--teal); border-color:var(--teal); color:#fff; }

/* Modal sheets (help, accuracy, lesson chooser) */
.help { position:fixed; inset:0; z-index:10; background:rgba(47,59,69,.35); display:flex; align-items:center; justify-content:center; padding:16px; backdrop-filter:blur(3px); }
.help[hidden] { display:none; }
.help-box { position:relative; width:min(640px, 100%); max-height:100%; overflow:auto; padding:26px 30px 30px; background:var(--panel); border:1px solid var(--line); border-radius:var(--radius-l); box-shadow:var(--shadow-l); }
.help h2 { font-family:var(--font-display); font-weight:800; font-size:38px; line-height:1; letter-spacing:-.02em; margin:0 0 12px; }
.help h3 { margin:22px 0 6px; color:var(--accent-deep); }
.help p { color:var(--fg); font-size:15px; line-height:1.55; margin:8px 0; }
.help b { font-weight:600; }
.help code { font-family:var(--font-mono); font-size:12px; color:var(--teal); }
.help pre { background:var(--paper-2); border:1px solid var(--line); border-radius:var(--radius-s); padding:10px 12px; font-family:var(--font-mono); font-size:12px; overflow:auto; color:var(--teal); }

/* Timeline bar */
.tl { position:fixed; left:14px; right:14px; bottom:60px; z-index:6; padding:12px 16px 8px; background:var(--panel); border:1px solid var(--line); border-radius:var(--radius-l); box-shadow:var(--shadow-l); transition:left .42s var(--ease); }
.tl[hidden] { display:none; }
.tl-row { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.tl-play { width:36px; height:36px; border-radius:50%; border:0; background:var(--accent); color:#fff; font-size:13px; cursor:pointer; flex:none; box-shadow:var(--shadow-s); }
.tl-year { font-family:var(--font-display); font-weight:800; font-size:28px; line-height:1; min-width:120px; letter-spacing:-.02em; }
.tl-chips { display:flex; gap:6px; flex-wrap:wrap; }
.tl-chips .chip { box-shadow:none; }
.tl-note { font-family:var(--font-mono); font-size:10px; letter-spacing:.06em; text-transform:uppercase; color:var(--dim); flex-basis:100%; order:10; margin-top:4px; }
#tl-info-btn { margin-left:auto; }
.tl .close { position:relative; top:auto; right:auto; width:30px; height:30px; }
.tl input[type=range] { width:100%; margin:10px 0 2px; accent-color:var(--accent); cursor:pointer; }
.tl-ticks { position:relative; height:16px; }
.tl-ticks span { position:absolute; transform:translateX(-50%); white-space:nowrap; }
.tl-ticks span:first-child { transform:none; }
.tl-ticks span:last-child { transform:translateX(-100%); }
body.tl-on .card { bottom:200px; }
body.tl-on .bottom { z-index:7; }

/* Lessons: a drawer that slides in from the left, opened by the Lessons button at the top left of the screen */
.drawer { position:fixed; top:0; left:0; bottom:0; width:min(var(--drawer-w), 100vw); display:flex; flex-direction:column; background:var(--panel); border-right:1px solid var(--line); box-shadow:var(--shadow-l); z-index:8; transform:translateX(-100%); transition:transform .42s var(--ease); }
body.drawer-open .drawer { transform:none; }
.drawer-tab { display:inline-flex; align-items:center; gap:8px; padding:9px 16px; background:var(--accent); color:#fff; border:0; border-radius:999px; cursor:pointer; box-shadow:var(--shadow-s); font-family:var(--font-display); font-weight:700; font-size:14px; letter-spacing:.02em; white-space:nowrap; } /* a button at the top left; the open drawer slides over it (Manny, Nov 4) */
.drawer-tab:hover { background:#d9682f; }
.drawer-head { display:flex; align-items:center; gap:10px; padding:20px 26px 14px; border-bottom:1px solid var(--line-2); }
.drawer-head h2 { font-family:var(--font-display); font-weight:800; font-size:30px; letter-spacing:-.02em; margin:0; }
.drawer-head .close { position:relative; top:auto; right:auto; margin-left:auto; width:34px; height:34px; }
.drawer-body { flex:1; overflow:auto; }
.lesson-list { display:grid; gap:12px; padding:18px 26px 28px; }
.course-head { display:flex; align-items:center; gap:10px; width:100%; padding:16px 18px; background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); color:var(--fg); cursor:pointer; text-align:left; font-family:var(--font-display); transition:border-color .2s; }
.course-head:hover { border-color:var(--accent); }
.course-num { font-weight:800; font-size:22px; color:var(--accent); }
.course-name { flex:1; font-weight:800; font-size:22px; letter-spacing:-.01em; }
.course-count { font-family:var(--font-mono); font-size:11px; letter-spacing:.1em; text-transform:uppercase; color:var(--dim); }
.chev { font-size:24px; line-height:1; color:var(--dim); transition:transform .2s; }
.course-head[aria-expanded="true"] { border-color:var(--accent); }
.course-head[aria-expanded="true"] .chev { transform:rotate(90deg); }
.course-lessons { display:grid; gap:10px; padding:2px 0 8px 18px; border-left:2px solid var(--accent-soft); margin-left:14px; }
.course-lessons[hidden] { display:none; }
.grade-pick { display:flex; flex-wrap:wrap; align-items:center; gap:8px; padding:4px 0 2px; } /* a course in grade bands: pick one, its lessons show below */
.grade-pick small { font-family:var(--font-mono); font-size:11px; letter-spacing:.1em; text-transform:uppercase; color:var(--dim); margin-right:4px; }
.grade-btn { padding:8px 14px; background:var(--paper-2); border:1px solid var(--line); border-radius:999px; color:var(--fg); font-family:var(--font-display); font-weight:700; font-size:14px; cursor:pointer; }
.grade-btn:hover { border-color:var(--accent); }
.grade-btn[aria-pressed="true"] { background:var(--accent); border-color:var(--accent); color:#fff; }
.grade-level { display:grid; gap:10px; }
.grade-level[hidden] { display:none; }
.lesson-card { text-align:left; padding:18px 20px; background:var(--paper-2); border:1px solid var(--line); border-radius:var(--radius); color:inherit; cursor:pointer; transition:border-color .2s, transform .2s; }
.lesson-card:hover { border-color:var(--accent); transform:translateY(-1px); }
.lesson-card small { color:var(--accent-deep); }
.lesson-card h3 { font-family:var(--font-display); font-weight:800; font-size:26px; line-height:1.05; letter-spacing:-.02em; margin:6px 0 6px; }
.lesson-card p { margin:0; color:var(--dim); font-size:15px; line-height:1.45; }

.lesson { display:flex; flex-direction:column; height:100%; }
.lesson[hidden] { display:none; }
.lesson-head { display:flex; align-items:center; gap:10px; padding:16px 26px 12px; }
.lesson-head small { color:var(--accent-deep); line-height:1.4; }
.lesson-head .back { font-family:var(--font); font-size:14px; font-weight:500; color:var(--dim); background:transparent; border:1px solid var(--line); border-radius:999px; padding:5px 10px; cursor:pointer; white-space:nowrap; }
.lesson-head .back:hover { color:var(--fg); border-color:#cfc8bb; }
.lesson-fig { margin:0 26px; background:var(--paper); position:relative; min-height:120px; border-radius:var(--radius); overflow:hidden; border:1px solid var(--line); }
.lesson-fig[hidden] { display:none; }
.lesson-fig img { display:block; width:100%; max-height:min(300px, 31vh); object-fit:cover; transition:opacity .3s; }
.lesson-fig.loading img { opacity:0; }
.lesson-fig.loading::after { content:"…"; position:absolute; inset:0; display:grid; place-items:center; color:var(--dim); font-size:28px; }
.lesson-fig figcaption { padding:8px 14px; font-size:13px; line-height:1.4; color:var(--dim); background:var(--panel); }
.lesson-fig figcaption a { color:var(--dim); }
.lesson-body { flex:1; overflow:auto; padding:18px 26px 14px; }
.lesson-body h2 { font-family:var(--font-display); font-weight:800; font-size:36px; line-height:1.05; letter-spacing:-.02em; margin:6px 0 10px; }
.lesson-body p { margin:0; font-size:18px; line-height:1.65; color:var(--fg); }
.lesson-body p b { font-weight:600; color:var(--accent-deep); }
/* Read-along: the word being read (lessons with word timings) */
.w { border-radius:4px; }
.read-along .w { cursor:pointer; }
.w.hov { background:#fff5cc; box-shadow:0 0 0 3px #fff5cc; } /* the sentence under the mouse: click to hear it again */
.w.on { background:#ffe27a; box-shadow:0 0 0 3px #ffe27a; }
.lesson-body dfn { font-style:normal; font-weight:600; color:var(--teal); text-decoration:underline dotted; text-underline-offset:3px; cursor:pointer; border-radius:3px; }
.lesson-body dfn:hover, .lesson-body dfn:focus-visible { background:#e1eef1; outline:none; }
.lesson-body p b.place { text-decoration:underline dotted; text-underline-offset:3px; cursor:pointer; border-radius:3px; }
.lesson-body p b.place:hover, .lesson-body p b.place:focus-visible { background:var(--accent-soft); outline:none; }
.def-card { position:fixed; z-index:20; padding:14px 16px 16px; background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow-l); }
.def-card[hidden] { display:none; }
.def-card small { font-family:var(--font-mono); font-size:10px; font-weight:500; letter-spacing:.14em; text-transform:uppercase; color:var(--teal); }
.def-card h4 { font-family:var(--font-display); font-weight:800; font-size:23px; letter-spacing:-.01em; margin:4px 28px 6px 0; }
.def-card p { margin:0; font-size:16px; line-height:1.5; color:var(--fg); }
.def-card .close { top:8px; right:8px; width:26px; height:26px; }
/* Checks: a question under the step; Next is locked until it is right */
.check { margin:18px 0 4px; padding:14px 16px 14px; background:var(--accent-soft, #fbeee4); border:1px solid #efd9c6; border-radius:var(--radius); }
.check small { color:var(--accent-deep); }
.check-head { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.check-play { width:26px; height:26px; border-radius:50%; border:1px solid var(--line); background:var(--panel); cursor:pointer; padding:0; display:grid; place-items:center; }
.check-play::before { content:""; width:0; height:0; border-style:solid; border-width:5px 0 5px 8px; border-color:transparent transparent transparent var(--accent); margin-left:2px; }
.check-play:hover { border-color:#cfc8bb; }
.check-q { margin:4px 0 10px !important; font-size:17px !important; font-weight:600; line-height:1.45 !important; }
.check-opts { display:grid; gap:7px; }
.check-row { display:flex; align-items:center; gap:8px; }
.check-row .check-opt { flex:1; }
.check-play.opt { flex:none; }
.check-opt { font-family:var(--font); font-size:15px; text-align:left; line-height:1.35; color:var(--fg); background:var(--panel); border:1px solid var(--line); border-radius:10px; padding:9px 12px; cursor:pointer; }
.check-opt:hover:not(:disabled) { border-color:#cfc8bb; }
.check-opt.wrong { opacity:.45; text-decoration:line-through; cursor:default; }
.check-opt.right { background:var(--teal); border-color:var(--teal); color:#fff; }
.check-form { display:flex; gap:8px; }
.check-form input { flex:1; min-width:0; font-family:var(--font); font-size:16px; color:var(--fg); background:var(--panel); border:1px solid var(--line); border-radius:999px; padding:9px 14px; }
.check-form input:focus { outline:2px solid var(--teal); outline-offset:1px; border-color:var(--teal); }
.check-form input:disabled { color:var(--teal); font-weight:600; }
.check-form .pill { padding:9px 16px; font-size:14px; }
.check-fb { margin:9px 0 0 !important; font-size:14px !important; line-height:1.45 !important; color:var(--accent-deep); min-height:0; }
.check-fb:empty { display:none; }
.check.ok { background:#e6f1ef; border-color:#bcd9d2; }
.check.ok small, .check.ok .check-fb { color:var(--teal); }
.check.shake { animation:check-shake .4s ease; }
@keyframes check-shake { 0%, 100% { transform:translateX(0); } 25% { transform:translateX(-6px); } 50% { transform:translateX(6px); } 75% { transform:translateX(-3px); } }
.lesson-foot .pill.locked { opacity:.45; cursor:not-allowed; }
.lesson-foot { display:flex; align-items:center; gap:12px; padding:14px 22px 18px; border-top:1px solid var(--line-2); }
.lesson-foot .pill { font-size:16px; padding:11px 18px; }
.lesson-body small, .lesson-head small { font-size:12px; }
/* Listen: reads the step aloud; a pulsing dot while it plays */
.lesson-meta { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.listen { display:inline-flex; align-items:center; gap:7px; font-family:var(--font); font-size:13px; font-weight:600; color:var(--fg); background:var(--panel); border:1px solid var(--line); border-radius:999px; padding:6px 12px 6px 9px; cursor:pointer; box-shadow:var(--shadow-s); transition:background .2s, border-color .2s, color .2s; }
.listen:hover { border-color:#cfc8bb; }
.listen-group { display:flex; align-items:center; gap:6px; }
.listen-ctl { display:inline-flex; align-items:center; justify-content:center; gap:2px; height:30px; min-width:30px; padding:0 7px; border-radius:999px; border:1px solid var(--line); background:var(--panel); color:var(--fg); cursor:pointer; font-family:var(--font); font-size:11px; font-weight:600; box-shadow:var(--shadow-s); }
.listen-ctl svg { width:15px; height:15px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.listen-ctl:hover { border-color:#cfc8bb; }
.listen-ico { width:0; height:0; border-style:solid; border-width:5px 0 5px 8px; border-color:transparent transparent transparent var(--accent); }
.listen.playing { background:var(--accent); border-color:var(--accent); color:#fff; }
.listen.playing .listen-ico { width:8px; height:8px; border:0; border-radius:50%; background:#fff; animation:listen-pulse 1.2s ease-in-out infinite; }
@keyframes listen-pulse { 0%, 100% { transform:scale(.7); opacity:.6; } 50% { transform:scale(1.1); opacity:1; } }
.lesson-foot .pill:disabled { opacity:.35; cursor:default; }
.lesson-dots { display:flex; gap:5px; flex:1; justify-content:center; flex-wrap:wrap; }
.lesson-dots .dot { width:11px; height:11px; border-radius:50%; border:1px solid #cfc8bb; background:transparent; padding:0; cursor:pointer; }
.lesson-dots .dot.on { background:var(--accent); border-color:var(--accent); }
.lesson-intro { margin:0 0 4px; padding:0 4px; font-size:15px; line-height:1.5; color:var(--dim); }
body.drawer-open .tl { left:calc(var(--drawer-w) + 14px); }
body.tl-hidden .tl { display:none; } /* a lesson with timeline: "hidden" drives the map by year without showing the bar */
body.drawer-open .card, body.drawer-open .bottom { display:none; }

/* The drawer's top bar: "Lessons" on the list, "← All lessons" and the lesson's name while a lesson is open. */
.dh-lesson { display:none; flex-direction:column; align-items:flex-start; gap:6px; min-width:0; }
body.lesson-on .dh-list { display:none; }
body.lesson-on .dh-lesson { display:flex; }
body.lesson-on .drawer-head { padding:14px 26px 12px; }
.dh-lesson small { font-family:var(--font-mono); font-size:12px; font-weight:500; letter-spacing:.12em; text-transform:uppercase; color:var(--accent-deep); line-height:1.4; }
.dh-lesson .back { font-family:var(--font); font-size:14px; font-weight:500; color:var(--dim); background:transparent; border:1px solid var(--line); border-radius:999px; padding:5px 12px; cursor:pointer; white-space:nowrap; }
.dh-lesson .back:hover { color:var(--fg); border-color:#cfc8bb; }
.drawer-head .close { align-self:center; }
body.lesson-on .lesson-fig { margin-top:16px; }

/* MapLibre's own bits */
.maplibregl-ctrl-group { background:var(--panel); border:1px solid var(--line); border-radius:var(--radius-s); box-shadow:var(--shadow-s); }
.maplibregl-ctrl-group button + button { border-top-color:var(--line); }
.maplibregl-ctrl-attrib { background:rgba(251,250,247,.8); color:var(--dim); font-family:var(--font-mono); font-size:9px; max-width:calc(100vw - 360px); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.maplibregl-ctrl-attrib:hover { white-space:normal; }
.maplibregl-ctrl-attrib a { color:var(--dim); }
.maplibregl-popup-content { background:var(--panel); color:var(--fg); border:1px solid var(--line); border-radius:var(--radius-s); font:500 13px var(--font); padding:8px 12px; }

@media (max-width: 900px) {
  /* on a phone the drawer is a bottom sheet, so the globe stays in view above it */
  .drawer { top:auto; height:60vh; width:100%; border-right:0; border-top:1px solid var(--line); border-radius:var(--radius-l) var(--radius-l) 0 0; transform:translateY(100%); }
  body.drawer-open .drawer { transform:none; }
  body.drawer-open .tl { display:none; }
  .coords { display:none; } /* mouse coordinates are moot on a phone */
  .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib { margin-right:0; }
  .lesson-fig img { max-height:140px; }
}
@media (max-width: 640px) {
  .top { flex-wrap:wrap; gap:8px; }
  .brand { font-size:15px; }
  .top .icon { order:1; }
  .top .layers-btn { margin-left:auto; }
  .layers { order:2; flex-basis:100%; margin-left:0; justify-content:flex-start; flex-wrap:nowrap; overflow-x:auto; padding-bottom:4px; scrollbar-width:none; display:none; }
  .top.layers-open .layers { display:flex; }
  .chip { padding:7px 10px; font-size:12px; flex:none; }
  .card { bottom:64px; }
  .tl { left:6px; right:6px; padding:8px 10px 4px; }
  .tl-year { font-size:22px; min-width:90px; }
  body.tl-on .card { bottom:236px; }
  .tl-ticks span:first-child { display:none; }
}
@media (prefers-reduced-motion: reduce) { * { transition:none !important; } }

/* Spots: a yellow tag with a pointer on a place; a click opens its pictures (the gallery below) */
.spot-wrap { display:grid; place-items:center; }
.spot { position:relative; transform-origin:50% 100%; border:0; cursor:pointer; font:600 13px var(--font); color:#1b1408; background:#f2b33d; padding:4px 10px; border-radius:999px; box-shadow:var(--shadow-s); margin-bottom:8px; }
.spot::after { content:""; position:absolute; left:50%; top:100%; transform:translateX(-50%); border:7px solid transparent; border-top-color:#f2b33d; border-bottom:0; }
.spot:hover, .spot:focus-visible { background:#ffc74d; outline:none; }
.spot.static { cursor:default; }
.spot.static:hover { background:#f2b33d; }
.gal { position:fixed; inset:0; z-index:9; display:grid; place-items:center; background:rgba(27,20,8,.22); }
.gal[hidden] { display:none; }
body.drawer-open .gal { left:min(var(--drawer-w), 100vw); }
.gal.pre { visibility:hidden; } /* laid out but unseen while the first picture decodes */
.gal-card { width:min(580px, calc(100% - 32px)); max-height:calc(100% - 32px); overflow:auto; position:relative; will-change:transform, opacity; background:var(--panel); border:1px solid var(--line); border-radius:var(--radius-l); box-shadow:var(--shadow-l); padding:16px 18px 14px; }
.gal-head { display:flex; align-items:center; gap:10px; margin:0 28px 10px 0; }
.gal-card h4 { margin:0; font-family:var(--font-display); font-weight:800; font-size:24px; line-height:1.05; }
.gal-card figure { margin:0; }
.gal-card img { display:block; width:100%; aspect-ratio:3 / 2; max-height:50vh; object-fit:cover; border-radius:var(--radius-s); background:#e8e2d6; } /* a fixed shape: the card never reflows while it opens */
.gal-card figcaption { margin-top:9px; font-size:16px; line-height:1.4; color:var(--fg); }
.gal-credit { color:var(--dim); font-size:12px; margin-left:6px; }
.gal-nav { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-top:12px; }
.gal-count { color:var(--dim); font-family:var(--font-mono); font-size:12px; }
.gal-close { top:12px; right:12px; width:34px; height:34px; z-index:1; }
/* Narrow screens: the story is a sheet across the bottom 60vh, so the picture card stays in the top half over the globe
   and never covers the text (Nov 4: with the card open, a tap on a sentence hit the card's backdrop instead). */
@media (max-width: 900px) { body.drawer-open .gal { left:0; bottom:50vh; } body.drawer-open .gal-card img { max-height:calc(50vh - 190px); } }

/* Peek: a picture a cue shows for a moment over the globe (narration only), then it goes away by itself */
.peek { position:fixed; z-index:9; left:50%; top:50%; transform:translate(-50%, -50%); width:min(440px, calc(100vw - 32px)); margin:0; background:var(--panel); border:1px solid var(--line); border-radius:var(--radius-l); box-shadow:var(--shadow-l); padding:12px 12px 10px; pointer-events:none; }
body.drawer-open .peek { left:calc(min(var(--drawer-w), 100vw) + (100vw - min(var(--drawer-w), 100vw)) / 2); }
.peek[hidden] { display:none; }
.peek img { display:block; width:100%; max-height:52vh; object-fit:contain; border-radius:var(--radius-s); background:#e8e2d6; } /* the whole picture, whatever its shape */
.peek figcaption { margin-top:8px; font-size:15px; line-height:1.4; color:var(--fg); }
.peek-credit { color:var(--dim); font-size:11px; margin-left:6px; }
@media (max-width: 900px) {
  /* on a phone or tablet the story is a bottom sheet (60vh), so the picture stays inside the globe area above it */
  body.drawer-open .peek { left:50%; top:20vh; width:min(440px, calc(100vw - 32px)); max-height:calc(40vh - 20px); overflow:hidden; }
  body.drawer-open .peek img { max-height:calc(40vh - 96px); }
}

/* Start screen: a lesson opened from a link shows only this until the child presses Start */
.start { position:fixed; inset:0; z-index:30; display:grid; place-items:center; background:var(--bg, #fbfaf7); }
.start-btn { font-family:var(--font-display); font-weight:800; font-size:34px; letter-spacing:-.01em; color:#fff; background:var(--accent); border:0; border-radius:999px; padding:22px 64px; cursor:pointer; box-shadow:var(--shadow-l); transition:transform .15s; }
.start-btn:hover, .start-btn:focus-visible { transform:scale(1.04); outline:none; }
.finished-card { display:grid; justify-items:center; gap:14px; text-align:center; padding:24px; max-width:520px; }
.finished-mark { width:96px; height:96px; border-radius:50%; display:grid; place-items:center; background:var(--accent); color:#fff; font-size:56px; font-weight:800; box-shadow:var(--shadow-l); }
.finished-card h2 { font-family:var(--font-display); font-weight:800; font-size:44px; letter-spacing:-.02em; margin:0; }
.finished-card p { margin:0; font-size:20px; line-height:1.5; color:var(--fg); }
.finished-btns { display:flex; flex-wrap:wrap; justify-content:center; gap:12px; margin-top:10px; }
.finished .start-btn { font-size:22px; padding:16px 36px; }
.finished-again { font-family:var(--font-display); font-weight:700; font-size:18px; padding:16px 28px; background:var(--panel); border:1px solid var(--line); border-radius:999px; color:var(--fg); cursor:pointer; }
.finished-again:hover { border-color:var(--accent); }
