:root {
  --bg: #f3eee4; --bg-surface: #fbf8f2; --bg-sunken: #e9e2d3; --text-primary: #1d1a15; --text-secondary: #4f483e; --accent: #1f4e79; --accent-ink: #163c5e; --line: #cfc6b4; --focus: #b3261e;
  --pin: #b3261e; --site: #c97a12;
  --map-sea-shallow: #a4c6d8; --map-sea-deep: #2c587f; --map-steppe: #d8c596; --map-tundra: #c9c2ab; --map-parkland: #c5c27c; --map-boreal: #7d9f68; --map-oak: #6b914f; --map-montane: #4a7749; --map-alpine: #b7b09c; --map-ice: #f4f8fb; --map-farm: #d3cf88; --map-shelf: #e2d5b3; --map-river: #2b6ea3; --map-border: #3d352b; --map-hill-low: 0.5;
  --font-display: "Fraunces", "Georgia", serif; --font-body: "Literata", "Georgia", serif; --font-ui: system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151a; --bg-surface: #1b2027; --bg-sunken: #0d1014; --text-primary: #f2ede4; --text-secondary: #b9b2a5; --accent: #93c3e4; --accent-ink: #b9d9f0; --line: #343b45; --focus: #ffb3ab;
    --pin: #ff7466; --site: #ffc46b;
    --map-sea-shallow: #2e5470; --map-sea-deep: #0b1826; --map-steppe: #8b7b56; --map-tundra: #6f7266; --map-parkland: #7b7e4f; --map-boreal: #4d6b44; --map-oak: #48693a; --map-montane: #32503a; --map-alpine: #7e7c70; --map-ice: #dfe9f0; --map-farm: #8f8c56; --map-shelf: #82755b; --map-river: #86bde6; --map-border: #ded5c4; --map-hill-low: 0.45;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12151a; --bg-surface: #1b2027; --bg-sunken: #0d1014; --text-primary: #f2ede4; --text-secondary: #b9b2a5; --accent: #93c3e4; --accent-ink: #b9d9f0; --line: #343b45; --focus: #ffb3ab;
  --pin: #ff7466; --site: #ffc46b;
  --map-sea-shallow: #2e5470; --map-sea-deep: #0b1826; --map-steppe: #8b7b56; --map-tundra: #6f7266; --map-parkland: #7b7e4f; --map-boreal: #4d6b44; --map-oak: #48693a; --map-montane: #32503a; --map-alpine: #7e7c70; --map-ice: #dfe9f0; --map-farm: #8f8c56; --map-shelf: #82755b; --map-river: #86bde6; --map-border: #ded5c4; --map-hill-low: 0.45;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--text-primary); font-family: var(--font-body); font-size: 1.0625rem; line-height: 1.6; }
a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--bg-surface); color: var(--text-primary); padding: .5rem 1rem; z-index: 50; }
.skip:focus { left: 1rem; top: 1rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 42rem; margin: 0 auto; padding: 0 1.1rem; }
.wide { max-width: 1400px; margin: 0 auto; padding: 0 1.1rem; }

.top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.1rem; max-width: 1400px; margin: 0 auto; font-family: var(--font-ui); font-size: .9rem; }
.top a.home { color: var(--text-secondary); text-decoration: none; }
.top .tools { display: flex; gap: .6rem; align-items: center; }
.btn { font: inherit; font-family: var(--font-ui); font-size: .9rem; color: var(--text-primary); background: var(--bg-surface); border: 1px solid var(--line); border-radius: 999px; padding: .4rem .9rem; cursor: pointer; }
.btn[aria-pressed="true"] { background: var(--text-primary); color: var(--bg); border-color: var(--text-primary); }
.btn:disabled { opacity: .5; cursor: default; }

header.hero { padding: 1.5rem 0 1rem; }
.kicker { font-family: var(--font-ui); text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; color: var(--text-secondary); margin: 0 0 .8rem; }
h1 { font-family: var(--font-display); font-weight: 500; font-variation-settings: "opsz" 144, "SOFT" 30; font-size: clamp(2.3rem, 7vw, 4.6rem); line-height: 1.02; letter-spacing: -.01em; margin: 0 0 1rem; }
.deck { font-size: clamp(1.15rem, 2.4vw, 1.4rem); line-height: 1.45; margin: 0 0 .6rem; }
.byline { font-family: var(--font-ui); color: var(--text-secondary); font-size: .85rem; margin: 0; }

#clock { position: relative; margin: 1.2rem auto 0; }
#clock .stage { position: relative; background: var(--bg-sunken); border-radius: 12px; overflow: hidden; }
#map { display: block; width: 100%; height: auto; }
#loader { position: absolute; inset: 0; display: grid; place-content: center; gap: .6rem; text-align: center; background: var(--bg-sunken); font-family: var(--font-ui); color: var(--text-primary); }
#loader[hidden] { display: none; }
.legend { display: flex; flex-wrap: wrap; gap: .35rem .8rem; font-family: var(--font-ui); font-size: .78rem; color: var(--text-secondary); padding: .5rem 0 0; }
.lg::before { content: ""; display: inline-block; width: .8em; height: .8em; border-radius: 2px; margin-right: .35em; vertical-align: -1px; border: 1px solid var(--line); }
.lg-sea::before { background: linear-gradient(90deg, var(--map-sea-shallow), var(--map-sea-deep)); }
.lg-shelf::before { background: var(--map-shelf); }
.lg-steppe.lg-v0::before { background: var(--map-steppe); } .lg-steppe.lg-v1::before { background: var(--map-parkland); } .lg-steppe.lg-v2::before { background: var(--map-boreal); } .lg-steppe.lg-v3::before { background: var(--map-oak); } .lg-steppe.lg-v4::before { background: var(--map-farm); }
.lg-montane::before { background: var(--map-montane); } .lg-alpine::before { background: var(--map-alpine); } .lg-ice::before { background: var(--map-ice); }

.controls { display: grid; grid-template-columns: 1fr; gap: .9rem; padding: 1rem 0; font-family: var(--font-ui); }
@media (min-width: 900px) { .controls { grid-template-columns: 1.6fr 1fr; align-items: start; } }
.timebox { background: var(--bg-surface); border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; }
#timeOut { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .8rem; min-height: 2.4rem; }
#timeOut .big { font-family: var(--font-display); font-size: clamp(1.5rem, 3.4vw, 2.1rem); font-weight: 500; }
#timeOut .sub { color: var(--text-secondary); }
#timeOut .period { margin-left: auto; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-secondary); }
input[type="range"] { width: 100%; margin: .6rem 0 .2rem; accent-color: var(--accent); height: 2rem; }
.ticks { display: flex; justify-content: space-between; font-size: .72rem; color: var(--text-secondary); position: relative; height: 1.1rem; }
.ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.ticks span:first-child { transform: none; } .ticks span:last-child { transform: translateX(-100%); }
@media (max-width: 600px) { .ticks span.opt { display: none; } }
.presets { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .7rem; }
.presets .btn { padding: .3rem .7rem; font-size: .82rem; }
.town { position: relative; background: var(--bg-surface); border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; }
.town label { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-secondary); margin-bottom: .4rem; }
.town .row { display: flex; gap: .5rem; }
.town input[type="text"] { flex: 1; min-width: 0; font: inherit; font-size: 1rem; padding: .5rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text-primary); }
#townList { position: absolute; left: 1rem; right: 1rem; top: 100%; margin: 0; padding: .3rem 0; list-style: none; background: var(--bg-surface); border: 1px solid var(--line); border-radius: 8px; z-index: 20; box-shadow: 0 8px 24px rgba(0,0,0,.18); max-height: 16rem; overflow: auto; }
#townList[hidden] { display: none; }
#townList li { padding: .4rem .8rem; cursor: pointer; }
#townList li small { color: var(--text-secondary); margin-left: .4rem; }
#townList li[aria-selected="true"], #townList li:hover { background: var(--bg-sunken); }
#townList li.none { color: var(--text-secondary); cursor: default; }
.layers { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-top: .8rem; font-size: .85rem; }
.layers label { display: inline-flex; gap: .35rem; align-items: center; }
#readout { font-family: var(--font-ui); font-size: .95rem; margin-top: .9rem; }
#readout p { margin: .25rem 0; }
#readout .k { text-transform: uppercase; letter-spacing: .1em; font-size: .75rem; color: var(--text-secondary); }
#readout .muted { color: var(--text-secondary); }
#fauna { list-style: none; margin: .6rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .3rem .8rem; font-size: .85rem; }
#fauna li { display: flex; flex-direction: column; padding: .35rem .5rem; border-left: 3px solid var(--map-oak); background: var(--bg-surface); border-radius: 0 6px 6px 0; }
#fauna li.gone { border-left-color: var(--line); color: var(--text-secondary); }
#fauna li.gone .nm { text-decoration: line-through; text-decoration-thickness: 1px; }
#fauna .nt { font-size: .75rem; line-height: 1.3; }
#fauna li.alive .nt { display: none; }

article { padding: 1.5rem 0 2rem; }
article h2 { font-family: var(--font-display); font-weight: 500; font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1.15; margin: 2.2rem 0 .7rem; }
.marker { font-family: var(--font-ui); font-size: .75rem; text-transform: uppercase; letter-spacing: .14em; color: var(--text-secondary); margin: 2.4rem 0 -.4rem; }
.marker a { color: inherit; text-decoration: none; }
.marker a:hover { text-decoration: underline; }
article p { margin: 0 0 1rem; }
figure { margin: 1.4rem 0; }
figure.numbers { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .6rem; }
figure.numbers div { background: var(--bg-surface); border: 1px solid var(--line); border-radius: 10px; padding: .8rem .9rem; }
figure.numbers b { display: block; font-family: var(--font-display); font-size: 1.8rem; font-weight: 500; line-height: 1.1; }
figure.numbers span { font-family: var(--font-ui); font-size: .8rem; color: var(--text-secondary); }
table { border-collapse: collapse; width: 100%; font-family: var(--font-ui); font-size: .9rem; margin: 1rem 0 1.4rem; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--text-secondary); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
td.n { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tablewrap { overflow-x: auto; }
.method { font-size: .95rem; color: var(--text-primary); }
.sources ol { padding-left: 1.2rem; font-size: .9rem; }
.sources li { margin-bottom: .4rem; }
footer { border-top: 1px solid var(--line); padding: 1.5rem 0 3rem; font-family: var(--font-ui); font-size: .85rem; color: var(--text-secondary); }
footer nav { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: .6rem; }
.totop { position: fixed; right: 1rem; bottom: 1rem; z-index: 30; }
noscript .fallback { background: var(--bg-surface); border: 1px solid var(--line); padding: 1rem; border-radius: 10px; margin: 1rem 0; }
