/* Longitude and latitude practice: an exam-booklet look. Pale sage paper, deep green ink, a vermilion route on every
   sphere, question numbers set large in the margin, figures in a monospaced face. */
:root {
  --bg: #eef2ea;
  --paper: #ffffff;
  --ink: #14231b;
  --muted: #45564c;
  --line: #d3ddd2;
  --edge: #7b8c80;
  --accent: #1d6343;
  --accent-ink: #ffffff;
  --accent-soft: #dcebe0;
  --route: #c2410c;
  --ok: #17663a;
  --ok-soft: #dcefe2;
  --close: #7c5200;
  --close-soft: #f6ebd2;
  --bad: #a32424;
  --bad-soft: #f8e2df;
  --focus: #0b63c9;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Roboto Mono", monospace;
  --r: 4px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111a15; --paper: #18241d; --ink: #e3ece5; --muted: #a9b9ae; --line: #2d3d33; --edge: #6f8476;
    --accent: #7fcca2; --accent-ink: #0d1a12; --accent-soft: #1d3326; --route: #ff8f5c;
    --ok: #7fd49e; --ok-soft: #173627; --close: #e7bf6a; --close-soft: #3a2f16; --bad: #f19a92; --bad-soft: #3d1f1d; --focus: #8cc8ff;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.55 var(--sans); }
a { color: var(--accent); }
.wrap { max-width: 1000px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--paper); padding: 8px 12px; z-index: 9; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.hero { padding: 24px 0 12px; }
h1 { font: 800 clamp(1.7rem, 5vw, 2.5rem)/1.12 var(--sans); letter-spacing: -0.02em; margin: 0 0 8px; }
.lede { margin: 0; max-width: 62ch; color: var(--muted); }
h2 { font: 750 1.4rem/1.2 var(--sans); margin: 0 0 10px; letter-spacing: -0.01em; }
h3 { font: 700 1.12rem/1.3 var(--sans); margin: 0; }

/* setup */
.setup { padding: 10px 0 4px; border-top: 2px solid var(--ink); }
.ctl { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; }
.fld { display: grid; gap: 3px; font-size: 16px; font-weight: 600; color: var(--muted); }
select, input { font: inherit; font-size: 16px; color: var(--ink); background: var(--paper); border: 1px solid var(--edge); border-radius: var(--r); min-height: 44px; padding: 6px 10px; }
select { padding-right: 28px; max-width: 100%; }
.f-level select { min-width: 14rem; }
.btn { font: 600 16px var(--sans); min-height: 44px; padding: 8px 16px; border-radius: var(--r); border: 1px solid var(--accent); background: var(--paper); color: var(--accent); cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.small { min-height: 44px; padding: 6px 14px; }
.btn:hover { filter: brightness(1.06); }
.link { font: inherit; color: var(--accent); background: none; border: 0; padding: 8px 2px; min-height: 44px; cursor: pointer; text-decoration: underline; }
.tdet { margin-top: 4px; }
.tdet > summary { cursor: pointer; min-height: 44px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 600; }
.tsum { font-weight: 400; color: var(--muted); }
.topics { border: 0; padding: 0 0 8px; margin: 0; }
.toggles { display: flex; flex-wrap: wrap; gap: 0 18px; }
.tg { display: flex; gap: 8px; align-items: center; min-height: 44px; }
.tg input { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); }
.hint { color: var(--muted); margin: 0; }
.tol { margin-top: 10px; max-width: 72ch; }
.note { border: 1px solid var(--bad); background: var(--bad-soft); padding: 8px 12px; margin: 10px 0; border-radius: var(--r); overflow-wrap: anywhere; }
.note.info { border-color: var(--accent); background: var(--accent-soft); }

/* the sheet */
.sheet { margin: 14px 0 0; }
.sheet:focus { outline: none; }
.sheet-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; }
.code { font-family: var(--mono); letter-spacing: 0.06em; }
.score { margin: 0; color: var(--muted); }
.sline { margin: 0 0 8px; color: var(--muted); }
.qs { list-style: none; margin: 0; padding: 0; }
.q { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px 12px; margin: 0 0 18px; }
.q h3 { display: flex; gap: 12px; align-items: baseline; }
.qn { flex: none; font: 800 1.9rem/1 var(--mono); color: var(--accent); min-width: 1.3ch; }
.qtop { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 6px 18px; align-items: start; }
.scen { margin: 8px 0 6px; }
.qfig { margin: 0; }
svg.fig { display: block; width: 100%; max-width: 300px; height: auto; margin: 0 auto; }
.fig .globe { fill: none; stroke: var(--ink); stroke-width: 1.3; }
.fig .eq { fill: none; stroke: var(--edge); stroke-width: 1; }
.fig .par { fill: none; stroke: var(--accent); stroke-width: 1.3; }
.fig .par.faint { stroke-width: 0.8; opacity: 0.7; }
.fig .mer { fill: none; stroke: var(--muted); stroke-width: 0.9; }
.fig .mer.gm { stroke: var(--edge); }
.fig .back { stroke-dasharray: 3 3; opacity: 0.75; }
.fig .route { fill: none; stroke: var(--route); stroke-width: 3; stroke-linecap: round; }
.fig .route.back { stroke-width: 2; }
.fig .route.gc { stroke-dasharray: 7 4; }
.fig .axis { stroke: var(--edge); stroke-width: 0.9; stroke-dasharray: 4 3; }
.fig .rad { stroke: var(--ink); stroke-width: 0.9; }
.fig .rad.r { stroke: var(--accent); stroke-width: 1.3; }
.fig .dot { fill: var(--ink); }
.fig .dot.pt { fill: var(--route); }
.fig .dot.c { fill: var(--accent); }
.fig text { fill: var(--ink); font: 13px var(--sans); paint-order: stroke; stroke: var(--paper); stroke-width: 3px; }
.fig text.pn { font-weight: 700; font-size: 15px; }
.fig text.sym { font-style: italic; fill: var(--accent); }
.fig text.small { font-size: 11px; fill: var(--muted); }
.fig text.rl { font-size: 11px; font-weight: 600; fill: var(--route); }
.fig.pr text { font-size: 14px; }
.fig.pr text.pn { font-size: 15.5px; }
.fig.pr text.rl, .fig.pr text.small { font-size: 13.5px; }
.fig text.pole { font-weight: 700; }
.calc { border-top: 1px solid var(--line); margin-top: 6px; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) 14rem; gap: 4px 14px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ain { display: flex; align-items: center; gap: 6px; }
.ain input { width: 100%; min-width: 0; font-family: var(--mono); }
.unit { width: 2.9rem; flex: none; color: var(--muted); }
.fbwrap { grid-column: 1 / -1; }
.fbwrap:empty { display: none; }
.fb { margin: 2px 0 0; padding: 4px 8px; border-radius: var(--r); }
.fb .mk { font-weight: 800; }
.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); }
.row.is-right input { border-color: var(--ok); border-width: 2px; }
.row.is-close input { border-color: var(--close); border-width: 2px; border-style: dashed; }
.row.is-wrong input, .row.is-unread input { border-color: var(--bad); border-width: 2px; }
.qfoot { margin: 10px 0 2px; }
.work > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; color: var(--accent); }
.keyt { width: 100%; border-collapse: collapse; margin: 4px 0 8px; }
.keyt th { text-align: left; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--edge); padding: 4px 6px; }
.keyt td { border-bottom: 1px solid var(--line); padding: 6px; vertical-align: top; }
.keyt .ka { font-family: var(--mono); white-space: nowrap; font-weight: 700; }
.keyt .kw span { display: block; }
.sheet-foot { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin: 4px 0 0; }
.ask { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--close-soft); padding: 6px 10px; border-radius: var(--r); }
.share { margin: 22px 0 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.print-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; }
.print-row label { display: grid; gap: 3px; font-weight: 600; color: var(--muted); }
.share-out label { display: grid; gap: 3px; }
.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; padding: 0; margin: 0; }
.recent li { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); padding: 6px 0; }
.recent small { display: block; color: var(--muted); font-size: 16px; }

/* content */
.content { margin: 34px 0 20px; max-width: 72ch; }
.content h2 { margin-top: 28px; }
.formulas { padding-left: 1.1rem; }
.formulas li { margin: 0 0 8px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 10px 0; min-height: 44px; font-weight: 600; }
.faq p { margin: 0 0 12px; }
.sources { color: var(--muted); margin-top: 24px; }
footer { border-top: 1px solid var(--line); padding: 18px 0 30px; color: var(--muted); }
.indep { margin: 0 0 10px; }
.sb-footer p { margin: 0 0 8px; }
.sb-more { line-height: 1.8; }
.toast { position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 140%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--r); max-width: calc(100% - 32px); transition: transform 0.2s; z-index: 20; pointer-events: none; }
.toast.on { transform: translate(-50%, 0); }
.print-root { display: none; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
@media (max-width: 720px) {
  .qtop { grid-template-columns: minmax(0, 1fr); }
  svg.fig { max-width: 280px; }
}
@media (max-width: 560px) {
  svg.fig { max-width: 230px; }
  .sline { display: none; }
  .sheet { margin-top: 8px; }
  body { font-size: 16px; }
  .row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .ain input { padding: 6px 8px; }
  .q { padding: 12px 12px 10px; }
  .f-level, .f-level select { width: 100%; min-width: 0; }
  .keyt thead { display: none; }
  .keyt tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; border-bottom: 1px solid var(--line); padding: 4px 0; }
  .keyt td { border-bottom: 0; padding: 2px 4px; }
  .keyt .kw { grid-column: 1 / -1; overflow-wrap: anywhere; }
}

/* ---------- print ---------- */
@media print {
  @page { margin: 12mm; }
  body { background: #fff; color: #000; font: 10.5pt/1.36 var(--sans); }
  main, footer, .toast, .skip { display: none !important; }
  .print-root { display: block; }
  svg { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  table.pt { width: 100%; border-collapse: collapse; }
  table.pt > tbody > tr > td, table.pt > thead > tr > td { padding: 0; }
  .prun { font: 8.5pt var(--sans); color: #444; padding-bottom: 5pt !important; }
  .psheet + .psheet, .pkey { break-before: page; }
  .ph { display: flex; justify-content: space-between; align-items: baseline; gap: 10pt; border-bottom: 2pt solid #000; margin-bottom: 5pt; }
  .ph h2 { font: 800 17pt var(--sans); margin: 0; white-space: nowrap; }
  .ph p { margin: 0; font-size: 9pt; text-align: right; }
  .pmeta { display: flex; justify-content: space-between; gap: 12pt; margin: 6pt 0; }
  .pnote, .ptol { font-size: 9pt; margin: 0 0 6pt; }
  .pq { list-style: none; margin: 0; padding: 0; }
  .pq > li, .pkq { padding: 6pt 0 8pt; border-bottom: 0.75pt solid #999; break-inside: avoid; }
  .pq h3, .pkq h3 { font: 700 12pt var(--sans); margin: 0 0 2pt; }
  .pwork { margin: 4pt 0 0; height: 30mm; font-size: 9pt; color: #444; }
  .pqtop { display: grid; grid-template-columns: minmax(0, 1fr) 60mm; gap: 8pt; align-items: start; }
  .pscen { margin: 0 0 2pt; font-size: 10.3pt; }
  .pfig svg.fig { width: 100%; max-width: none; }
  .fig .globe, .fig .rad { stroke: #000; }
  .fig .eq, .fig .axis { stroke: #555; }
  .fig .par, .fig .rad.r, .fig text.sym { stroke: #1d6343; }
  .fig .par, .fig .rad.r { fill: none; }
  .fig text.sym { fill: #1d6343; stroke: #fff; }
  .fig .mer { stroke: #333; }
  .fig .route { stroke: #c2410c; }
  .fig .dot { fill: #000; }
  .fig .dot.pt { fill: #c2410c; }
  .fig .dot.c { fill: #1d6343; }
  .fig text { fill: #000; stroke: #fff; }
  .fig text.rl { fill: #9a3412; }
  .pcalc { width: 100%; border-collapse: collapse; font-size: 9.8pt; margin-top: 3pt; }
  .pcalc td { padding: 4pt 0 1.5pt; border-bottom: 0.5pt solid #ccc; vertical-align: bottom; }
  .pcalc .pl { width: 50mm; white-space: nowrap; }
  .uline { display: inline-block; width: 36mm; border-bottom: 0.75pt solid #000; }
  .pkt { width: 100%; border-collapse: collapse; font-size: 9pt; margin: 3pt 0 2pt; }
  .pkt td { border-bottom: 0.5pt solid #bbb; padding: 2pt 4pt 2pt 0; vertical-align: top; }
  .pkt tr { break-inside: avoid; }
  .pkl { width: 34%; }
  .pka { font-family: var(--mono); font-weight: 700; white-space: nowrap; width: 18%; }
  .pkw { font-family: var(--mono); font-size: 8pt; color: #222; }
  .pkw span { display: block; }
}
