/* Map Skills Practice: a geography room wall map. Warm paper, navy ink, grid-line blue and a survey red accent. */
:root {
  --bg: #f4f2ec;
  --panel: #fffefa;
  --ink: #1d2733;
  --muted: #4d5966;
  --line: #cfd3cf;
  --accent: #b2322c;
  --accent-ink: #ffffff;
  --gridblue: #2f6fb4;
  --ok: #1e6b39;
  --ok-soft: #e1f0e5;
  --close: #8a5a00;
  --close-soft: #f6ecd6;
  --bad: #a32020;
  --bad-soft: #f8e3e1;
  --focus: #1a5fb4;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 4px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141a1f;
    --panel: #1c242b;
    --ink: #e5eaee;
    --muted: #a7b3bd;
    --line: #34404a;
    --accent: #ef8a7f;
    --accent-ink: #2a0d0b;
    --gridblue: #8db8ea;
    --ok: #82d39a;
    --ok-soft: #1a3324;
    --close: #f0c066;
    --close-soft: #3a2f17;
    --bad: #f39a90;
    --bad-soft: #3d2120;
    --focus: #8ab8ff;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.55 var(--sans); }
.wrap { max-width: 1340px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); text-underline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--panel); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.hero { padding: 18px 0 6px 14px; border-left: 6px solid var(--gridblue); margin: 12px 0 14px; max-width: 800px; }
h1 { font-size: clamp(1.65rem, 4.6vw, 2.4rem); line-height: 1.1; margin: 0 0 6px; letter-spacing: -0.02em; font-weight: 800; }
.lede { margin: 0 0 4px; color: var(--muted); max-width: 66ch; }
.xlink { margin: 0; font-size: 0.95rem; color: var(--muted); }
h2 { font-size: 1.2rem; line-height: 1.25; margin: 0 0 10px; }

/* setup */
.setup { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; margin: 0 0 12px; }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--panel); }
.seg button { font: inherit; font-size: 0.95rem; min-height: 44px; padding: 6px 12px; border: 0; background: transparent; color: var(--ink); cursor: pointer; white-space: nowrap; }
.seg button + button { border-left: 1.5px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--panel); font-weight: 600; }
.seg button:disabled { color: var(--muted); cursor: not-allowed; text-decoration: line-through; }
.scale-note { flex-basis: 100%; margin: -2px 0 0; font-size: 0.92rem; color: var(--muted); }
.qdrop { position: relative; }
.qdrop summary { list-style: none; cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 0.35em; padding: 6px 12px; border: 1.5px solid var(--line); border-radius: var(--r); background: var(--panel); font-size: 0.95rem; }
.qdrop summary::-webkit-details-marker { display: none; }
.qdrop summary::after { content: ""; width: 7px; height: 7px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg); margin: -3px 0 0 8px; }
.qdrop[open] summary::after { transform: rotate(-135deg); margin-top: 4px; }
.qdrop fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.qpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 12px; padding: 8px 12px; margin-top: 6px; border: 1.5px solid var(--line); border-radius: var(--r); background: var(--panel); }
@media (min-width: 700px) { .qdrop[open] .qpick { position: absolute; z-index: 5; width: 520px; box-shadow: 0 6px 20px rgb(0 0 0 / 0.15); } }
.qc { display: flex; align-items: center; gap: 8px; min-height: 40px; cursor: pointer; }
.qc input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.yearpick { display: inline-flex; align-items: center; gap: 8px; font-size: 0.95rem; }

.btn { font: inherit; font-size: 0.95rem; min-height: 44px; padding: 6px 16px; border: 1.5px solid var(--ink); border-radius: var(--r); background: var(--panel); color: var(--ink); cursor: pointer; font-weight: 600; }
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.small { padding: 4px 12px; font-size: 0.9rem; }
.link { font: inherit; font-size: 0.95rem; background: none; border: 0; padding: 8px 4px; min-height: 44px; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
select, input { font: inherit; font-size: 16px; color: var(--ink); background: var(--panel); border: 1.5px solid var(--line); border-radius: var(--r); min-height: 44px; padding: 6px 10px; max-width: 100%; }
input::placeholder { color: var(--muted); opacity: 0.8; }

.note { margin: 0 0 12px; padding: 10px 12px; border-left: 4px solid var(--gridblue); background: var(--panel); }
.note.warn { border-left-color: var(--bad); }

/* map and questions */
.work { display: grid; gap: 16px; outline: none; }
.mapbox { position: relative; margin: 0 -8px; background: var(--panel); border: 1.5px solid var(--line); border-radius: var(--r); padding: 6px; min-width: 0; }
@media (min-width: 600px) { .mapbox { margin: 0; padding: 10px; } }
.maphead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.maphead h2 { margin: 0; font-size: 1.05rem; }
.code { font-variant-numeric: tabular-nums; letter-spacing: 0.06em; }
.mapview { overflow: hidden; background: #fffdf7; border-radius: 2px; }
.mapview svg { display: block; width: 100%; height: auto; }
.mapbox.zoomed .mapview { overflow-x: auto; }
.mapbox.zoomed .mapview svg { width: 220%; max-width: none; }
.keybox { margin-top: 6px; }
.keybox summary { cursor: pointer; font-weight: 600; min-height: 40px; display: flex; align-items: center; font-size: 0.95rem; }
.key { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 2px 12px; font-size: 0.86rem; }
.key li { display: flex; align-items: center; gap: 8px; min-height: 26px; }
.key svg { flex: none; width: 46px; height: 23px; background: #fffdf7; border-radius: 2px; }
@media (min-width: 1060px) {
  .work { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); align-items: start; }
  .mapbox { position: sticky; top: 8px; }
}
.mapjump { position: fixed; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 15; min-height: 44px; padding: 0 18px;
  border: 0; border-radius: 22px; background: var(--ink); color: var(--panel); font: inherit; font-size: 1rem; font-weight: 600; cursor: pointer; box-shadow: 0 2px 10px rgb(0 0 0 / 0.25); }
@media (min-width: 1060px) { .mapjump { display: none; } }

.qs { min-width: 0; }
.qs-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.score { margin: 0; color: var(--muted); font-size: 0.95rem; }
.qlist { list-style: none; margin: 0; padding: 0; }
.q { padding: 12px 0 14px; border-top: 1.5px solid var(--line); }
.qt { display: flex; gap: 10px; align-items: center; margin: 0 0 4px; font-size: 1rem; }
.num { flex: none; width: 1.75em; height: 1.75em; display: inline-grid; place-items: center; font-weight: 700; font-size: 0.88rem; border: 1.5px solid var(--ink); border-radius: 50%; }
.is-right .num { background: var(--ok); border-color: var(--ok); color: var(--panel); }
.is-wrong .num { border-color: var(--bad); color: var(--bad); }
.qtext, .qbody, .q .work, .sectfig { margin-left: calc(1.75em + 10px); }
.qbody.one { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0 10px; }
.qbody.one .part { margin: 0; flex: 0 1 auto; min-width: 0; }
.qbody.one .fbwrap { max-width: 34ch; }
.qbody.one .qfoot { margin-top: 0; }
.qtext { margin-top: 0; margin-bottom: 8px; }
.part { margin: 0 0 8px; border: 0; padding: 0; min-width: 0; }
.prompt { display: block; font-size: 0.92rem; color: var(--muted); margin-bottom: 3px; }
.ain input { width: 12em; }
.ain select { max-width: 100%; }
.qfoot { margin-top: 2px; }
.fb { margin: 6px 0 0; padding: 6px 10px; border-radius: var(--r); font-size: 0.95rem; }
.fb.right { background: var(--ok-soft); color: var(--ok); }
.fb.close { background: var(--close-soft); color: var(--close); }
.fb.wrong, .fb.unread { background: var(--bad-soft); color: var(--bad); }
.q .work { display: block; margin-top: 6px; }
.q summary { cursor: pointer; color: var(--accent); font-size: 0.95rem; min-height: 32px; padding: 4px 0; }
.ans { margin: 6px 0 4px; }
.steps { margin: 0; padding-left: 1.2em; font-size: 0.95rem; color: var(--muted); }
.steps li { margin: 2px 0; }
.sketches { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 520px) { .sketches { grid-template-columns: repeat(3, 1fr); } }
.sk { display: block; border: 1.5px solid var(--line); border-radius: var(--r); padding: 6px; cursor: pointer; background: var(--panel); }
.sk:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.sk input { width: 20px; height: 20px; min-height: 0; margin: 0 6px 0 0; vertical-align: -4px; accent-color: var(--accent); }
.skl { font-weight: 600; font-size: 0.95rem; }
.sk svg { display: block; width: 100%; height: auto; margin-top: 4px; background: #fffdf7; }
.sectfig { margin-bottom: 8px; overflow-x: auto; background: #fffdf7; border: 1px solid var(--line); }
.sectfig svg { display: block; width: 100%; min-width: 320px; height: auto; }
.qs-foot { display: flex; gap: 8px 16px; align-items: center; flex-wrap: wrap; padding-top: 12px; border-top: 1.5px solid var(--line); }

/* share and print */
.share { margin: 22px 0 8px; padding: 14px 0; border-top: 3px solid var(--ink); }
.print-row { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; }
.print-row label { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.hint { color: var(--muted); font-size: 0.95rem; margin: 8px 0 0; }
.share-out label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.share-out input { width: 100%; }
.recent { margin-top: 12px; }
.recent summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; }
.recent ul { list-style: none; margin: 0; padding: 0; }
.recent li { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding: 4px 0; }
.recent small { display: block; color: var(--muted); }

/* content */
.content { max-width: 780px; margin: 18px 0 30px; }
.content h2 { margin-top: 26px; }
.content p { margin: 0 0 12px; }
.faq details { border-top: 1px solid var(--line); padding: 4px 0; }
.faq summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.faq p { margin: 4px 0 10px; }
.sources { font-size: 0.95rem; color: var(--muted); }

footer { border-top: 1.5px solid var(--line); padding: 16px 0 28px; font-size: 0.95rem; color: var(--muted); }
.indep { margin: 0 0 10px; }
.sb-footer p { margin: 0 0 8px; }
.sb-more a { color: var(--muted); }
.sb-credit a { color: var(--accent); }

.toast { position: fixed; left: 50%; bottom: 16px; transform: translate(-50%, 160%); max-width: min(92vw, 520px); background: var(--ink); color: var(--panel); padding: 10px 16px; border-radius: var(--r); font-size: 0.95rem; transition: transform 0.2s; z-index: 20; }
.toast.on { transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ---------- the map's own drawing (same on screen and paper; the paper stays light in dark mode) ---------- */
svg.map text, svg.sect text, .key svg text { font-family: var(--sans); }
svg .paper { fill: #fffdf7; }
svg .ct { fill: none; stroke: #c98a52; stroke-width: 0.14; stroke-linejoin: round; }
svg .ci { fill: none; stroke: #a8622a; stroke-width: 0.3; stroke-linejoin: round; }
svg .river { fill: none; stroke: #3d8ad0; stroke-linecap: round; stroke-linejoin: round; }
svg .river-line { display: none; }
svg .wood { fill: #d9edc9; stroke: #6f9e57; stroke-width: 0.12; }
svg .tree { fill: none; stroke: #2f6b28; stroke-width: 0.16; stroke-linejoin: round; }
svg .treec circle { fill: none; stroke: #2f6b28; stroke-width: 0.16; }
svg .built { fill: #eedcd2; }
svg .house { fill: #4f4741; }
svg .field { fill: #edf5dc; stroke: #5d8f33; stroke-width: 0.2; }
svg .road-case { fill: none; stroke: #2b2b2b; stroke-linecap: round; stroke-linejoin: round; }
svg .road { fill: none; stroke-linecap: round; stroke-linejoin: round; }
svg .road-main { stroke: #e2603f; }
svg .road-minor { stroke: #f7d65b; }
svg .road-lane { stroke: #fffdf7; }
svg .road-main.sa { stroke: #d8352a; }
svg .road-minor.sa { stroke: #c08447; }
svg .road-track { stroke: #2b2b2b; stroke-width: 0.3 !important; stroke-dasharray: 1 0.6; }
svg .gridl { fill: none; stroke: #3d7fc6; stroke-width: 0.13; }
svg .blockl { fill: none; stroke: #8a8a8a; stroke-width: 0.15; stroke-dasharray: 1 1; }
svg .xy { stroke: #c0262d; stroke-width: 0.3; }
svg .frame { fill: none; stroke: #1b1b1b; stroke-width: 0.3; }
svg .k-ink { fill: #1b1b1b; }
svg .k-paper { fill: #fffdf7; }
svg .k-stroke { stroke: #1b1b1b; stroke-width: 0.22; }
svg .k-line { fill: none; stroke: #1b1b1b; stroke-width: 0.25; stroke-linecap: round; }
svg .k-blue { fill: #2a6aa8; }
svg .k-pw { fill: none; stroke: #fff; stroke-width: 0.32; }
svg .k-water { fill: none; stroke: #3d8ad0; stroke-width: 0.3; }
svg .spot { fill: #1b1b1b; }
svg .lb { fill: #1b1b1b; paint-order: stroke; stroke: #fffdf7; stroke-width: 0.5px; stroke-linejoin: round; }
svg .lb-contour { fill: #9a5420; }
svg .lb-river { fill: #1f63a8; font-style: italic; }
svg .lb-wood { fill: #2a5a22; font-style: italic; }
svg .lb-village { font-weight: 700; letter-spacing: 0.02em; }
svg .lb-hill { font-style: italic; }
svg .mark .mk-dot { fill: #c0262d; }
svg .mark .mk-t { fill: #c0262d; font-size: 3px; font-weight: 700; paint-order: stroke; stroke: #fffdf7; stroke-width: 0.7px; }
svg .gnum text, svg .llf text { font-size: 2.3px; fill: #1b1b1b; }
svg .llf .blk { font-size: 2.4px; fill: #666; font-weight: 700; }
svg .tick { stroke: #1b1b1b; stroke-width: 0.2; fill: none; }
svg .marg text { font-size: 2.2px; fill: #1b1b1b; }
svg .marg .mg-s { font-size: 2.1px; }
svg .sb-b { fill: #1b1b1b; }
svg .sb-w { fill: #fffdf7; }
svg .sb-o { fill: none; stroke: #1b1b1b; stroke-width: 0.15; }
svg .na { stroke: #1b1b1b; stroke-width: 0.25; fill: none; }
svg .nh { fill: #1b1b1b; }
svg.sect .sg { fill: none; stroke: #c9ccc9; stroke-width: 0.15; }
svg.sect .sf { fill: none; stroke: #1b1b1b; stroke-width: 0.3; }
svg.sect .sp { fill: none; stroke: #b2322c; stroke-width: 0.55; stroke-linejoin: round; }
svg.sect .sl { font-size: 2.6px; fill: #1b1b1b; }
svg.sa-sect .sl { font-size: 2.4px; }
.map, .sect, .key svg { print-color-adjust: exact; -webkit-print-color-adjust: exact; }

.print-root { display: none; }

@media print {
  @page { margin: 11mm 12mm; }
  body { background: #fff; color: #000; font: 10.5pt/1.38 var(--sans); }
  main, footer, .toast, .skip, .mapjump { display: none !important; }
  .print-root { display: block; }
  .print-root .pt { width: 100%; border-collapse: collapse; }
  .print-root .pt > thead td { font-size: 8.5pt; color: #444; padding: 0 0 1.5mm; text-align: right; }
  .psheet, .pkey { break-after: page; }
  .print-root > section:last-child { break-after: auto; }
  .ph { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1.5pt solid #000; margin-bottom: 2mm; }
  .ph h2 { font-size: 14pt; margin: 0; }
  .ph p { margin: 0; font-size: 10pt; }
  .pmeta { display: flex; justify-content: space-between; margin: 0 0 2.5mm; font-size: 10pt; }
  .pmap { margin: 0 auto; }
  .pmap svg { display: block; width: 100%; height: auto; }
  .pkey-strip .key { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.4mm 2.5mm; font-size: 8pt; line-height: 1.2; margin-top: 1.5mm; }
  .pkey-strip .key li { min-height: 0; gap: 1.2mm; }
  .pkey-strip .key svg { width: 10mm; height: 5mm; background: none; }
  .pnote { margin: 1.5mm 0 0; font-size: 8.5pt; color: #333; }
  .pq { margin: 0; padding: 0; list-style: none; }
  .pq > li { break-inside: avoid; margin: 0 0 2.8mm; font-size: 10.5pt; }
  .pqt { margin: 0 0 1mm; }
  .pans { margin: 1mm 0 0 5mm; }
  .popt { display: inline-block; margin-right: 4mm; white-space: nowrap; }
  .blank { display: inline-block; vertical-align: baseline; height: 1em; border-bottom: 0.6pt solid #000; }
  .blank.w-s { width: 14mm; } .blank.w-m { width: 32mm; } .blank.w-l { width: 50mm; }
  .blank.w-name { width: 55mm; } .blank.w-date { width: 28mm; } .blank.w-score { width: 10mm; }
  .psk { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3mm; margin: 1mm 0 0 5mm; }
  .psk p { margin: 0; font-weight: 700; font-size: 9.5pt; }
  .psk svg { display: block; width: 100%; height: auto; }
  .psect { margin: 1mm 0 0 5mm; }
  .psect svg { display: block; } /* drawn in mm at true scale, so the vertical exaggeration is real on paper */
  .pk { margin: 0; padding-left: 6mm; }
  .pk > li { break-inside: avoid; margin-bottom: 2.4mm; }
  .pq > li:last-child, .pk > li:last-child { margin-bottom: 0; }
  .pkq { margin: 0; color: #333; }
  .pka { margin: 0.5mm 0; font-weight: 700; }
  .pks { margin: 0; padding-left: 5mm; font-size: 9.5pt; }
  .pkey.compact .pk > li { margin-bottom: 1mm; }
  .pkey.compact { break-after: auto; break-inside: avoid; margin-bottom: 6mm; }
  .pkey.compact + .pkey.compact .prun { display: none; }
  svg.sect .sg { stroke: #999; }
  svg.sect .sp { stroke: #000; }
}
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.crumbs { font-size: 0.92rem; color: var(--muted); margin: 12px 0 -4px; }

/* drawing a new map */
.busy-note { position: absolute; z-index: 3; left: 50%; top: 96px; transform: translateX(-50%); margin: 0; padding: 10px 16px; white-space: nowrap; border-radius: var(--r);
  background: var(--ink); color: var(--panel); font-weight: 600; box-shadow: 0 2px 10px rgb(0 0 0 / 0.25); }
.mapbox.busy .mapview, .mapbox.busy + .qs .qlist { opacity: 0.45; }
.mapview:empty { min-height: 300px; }
.clear-ask { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
