/* =========================================================
   21 Cambodian Endangered Trees — the.BUR console design system
   Navy shell, amber edge-ticks, stacked tabbed panels, paper readout body.
   DM Serif Display / Inter / JetBrains Mono; Khmer in Khmer OS Battambang.
   One deliberate look (like the.BUR theme): no dark variant.
   ========================================================= */
:root {
  --navy: #14213D;
  --navy-deep: #0A1526;
  --navy-soft: #1D2E52;
  --amber: #FCA311;
  --amber-deep: #E08F00;
  --paper: #F3EFE6;
  --surface: #FFFFFF;
  --ink: #12141A;
  --muted: #5B5F6B;
  --line: #DCD5C6;
  --line-dark: rgba(255, 255, 255, .14);
  --leaf: #3E6A31;

  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Space Mono', ui-monospace, monospace;
  --font-khmer: 'Khmer OS Battambang', 'Battambang', 'Khmer OS', 'Leelawadee UI', sans-serif;

  --frame-radius: 34px;
  --rail-w: 96px;
  color-scheme: light;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body); background: var(--navy-deep); color: var(--ink);
  line-height: 1.6; -webkit-font-smoothing: antialiased; padding: 10px;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
ul { list-style: none; }
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--navy); font-weight: 400; text-wrap: balance; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
[hidden] { display: none !important; }
[lang="km"], .khmer { font-family: var(--font-khmer); line-height: 1.9; }

/* ---------- console shell ---------- */
.shell { position: relative; max-width: 1520px; margin: 0 auto; background: var(--navy); border-radius: var(--frame-radius); overflow: hidden; overflow: clip; box-shadow: 0 30px 80px rgba(0, 0, 0, .45); }
.ticks { height: 14px; margin: 0 46px; opacity: .85; background: repeating-linear-gradient(90deg, var(--amber) 0 3px, transparent 3px 22px); }

.topbar { padding: 18px 34px 22px; }
.topbar-inner { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.brand { font-family: var(--font-display); font-size: 26px; color: #fff; line-height: 1; flex-shrink: 0; }
.brand span { color: var(--amber); }
.pill-nav { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; }
.pill-nav a {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .06em; color: #B9C0D6;
  padding: 10px 18px; border-radius: 100px; border: 1px solid var(--line-dark); white-space: nowrap; display: inline-block; transition: all .18s;
}
.pill-nav a:hover { color: #fff; border-color: var(--amber); }
.pill-nav a.active { background: var(--amber); color: var(--navy); border-color: var(--amber); font-weight: 700; }
.coords { font-family: var(--font-mono); font-size: 11px; color: #7C86A6; letter-spacing: .06em; text-align: right; }
.coords .lbl { color: var(--amber); }

/* ---------- readout ---------- */
.readout { background: var(--paper); border-radius: 26px 26px 0 0; overflow: hidden; overflow: clip; }
.hero-panel {
  position: relative; padding: 52px 40px 48px; color: #fff; overflow: hidden;
  background:
    radial-gradient(120% 140% at 85% 0%, rgba(252, 163, 17, .16), transparent 55%),
    linear-gradient(160deg, var(--navy-soft), var(--navy) 60%, var(--navy-deep));
}
.hero-panel::after { /* contour lines: a canopy-height map motif */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .18;
  background: repeating-radial-gradient(circle at 82% 120%, transparent 0 22px, rgba(252, 163, 17, .7) 22px 23px);
  mask-image: linear-gradient(90deg, transparent 35%, #000 80%); -webkit-mask-image: linear-gradient(90deg, transparent 35%, #000 80%);
}
.hero-panel > * { position: relative; z-index: 1; }
.hero-panel h1 { color: #fff; font-size: clamp(30px, 4.4vw, 44px); line-height: 1.12; max-width: 760px; }
.hero-panel h1 .khmer { display: block; font-size: .5em; color: var(--amber); margin-top: 8px; line-height: 1.6; }
.hero-panel p { color: rgba(243, 239, 230, .9); max-width: 620px; margin-top: 14px; font-size: 15.5px; line-height: 1.75; }
.section-lbl { font-family: var(--font-mono); font-size: 12px; letter-spacing: .14em; color: var(--amber-deep); display: block; margin-bottom: 10px; text-transform: uppercase; }
.hero-panel .section-lbl { color: var(--amber); }

.panel { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); border-bottom: 1px solid var(--line); }
.panel:last-of-type { border-bottom: none; }
.panel-tab { background: var(--navy-deep); display: flex; flex-direction: column; align-items: center; padding-top: 28px; gap: 14px; border-right: 1px solid var(--line-dark); }
.tab-num { background: var(--amber); color: var(--navy); font-family: var(--font-mono); font-weight: 700; font-size: 11px; border-radius: 50%; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; }
.tab-text { writing-mode: vertical-rl; transform: rotate(180deg); font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; color: var(--amber); }
.panel-body { padding: 36px 34px 44px; min-width: 0; }

/* ---------- inventory console: register | specimen ---------- */
.console { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 28px; align-items: start; }

.register { position: sticky; top: 10px; display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - 20px); min-width: 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--amber); border-radius: 4px; padding: 12px 14px; min-width: 0; }
.stat .n { font-family: var(--font-display); font-size: 28px; color: var(--navy); line-height: 1; font-variant-numeric: tabular-nums; }
.stat .n small { font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin-left: 3px; }
.stat .l { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); letter-spacing: .06em; margin-top: 6px; text-transform: uppercase; }

.search { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface); border: 2px solid var(--navy); border-left: 4px solid var(--amber); }
.search span { font-family: var(--font-mono); color: var(--amber-deep); }
.search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-family: var(--font-mono); font-size: 13px; color: var(--navy); letter-spacing: .03em; }
.search input::placeholder { color: var(--muted); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 11px; border: 1px solid var(--navy); border-radius: 4px; cursor: pointer; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .04em; background: var(--surface); color: var(--navy); transition: all .15s; }
.chip:hover, .chip[aria-pressed="true"] { background: var(--navy); color: #fff; }
.count { font-family: var(--font-mono); font-size: 11px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }

.reg-list { overflow-y: auto; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); min-height: 200px; overscroll-behavior: contain; }
.reg-list li + li { border-top: 1px solid var(--line); }
.reg-toggle {
  width: 100%; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 10px 12px; text-align: left; background: none; border: none; cursor: pointer; transition: background .15s;
}
.reg-toggle:hover { background: #FBF8F1; }
.reg-toggle[aria-checked="true"] { background: var(--navy); }
.reg-n { font-family: var(--font-mono); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.reg-names { display: flex; flex-direction: column; min-width: 0; }
.reg-cam { font-weight: 600; font-size: 14px; color: var(--navy); line-height: 1.25; }
.reg-km { font-family: var(--font-khmer); font-size: 13px; color: var(--amber-deep); line-height: 1.7; }
.reg-sci { font-size: 12px; font-style: italic; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reg-toggle[aria-checked="true"] .reg-cam { color: #fff; }
.reg-toggle[aria-checked="true"] .reg-km { color: var(--amber); }
.reg-toggle[aria-checked="true"] .reg-sci, .reg-toggle[aria-checked="true"] .reg-n { color: #B9C0D6; }
.switch { width: 34px; height: 20px; border-radius: 20px; border: 1px solid var(--line); background: #EDE8DC; position: relative; flex-shrink: 0; transition: background .18s, border-color .18s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform .18s, background .18s; }
.reg-toggle[aria-checked="true"] .switch { background: var(--amber); border-color: var(--amber); }
.reg-toggle[aria-checked="true"] .switch::after { transform: translateX(14px); background: var(--navy); }
.reg-empty { padding: 30px 16px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- specimen ---------- */
.specimen { min-width: 0; }
.spec-empty { border: 1px dashed var(--line); border-radius: 4px; padding: 70px 24px; text-align: center; color: var(--muted); background: rgba(255, 255, 255, .4); }
.spec-empty h3 { font-size: 24px; margin-bottom: 8px; }
.crumbs { font-family: var(--font-mono); font-size: 11px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; display: flex; gap: 10px; flex-wrap: wrap; }
.crumbs .sep { color: var(--amber-deep); }
.spec-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 24px; align-items: end; padding-bottom: 20px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.spec-names { min-width: 0; }
.cam-name { font-size: clamp(32px, 4vw, 46px); line-height: 1.08; margin-top: 10px; }
.km-name { font-family: var(--font-khmer); font-size: clamp(22px, 2.6vw, 30px); color: var(--amber-deep); line-height: 1.7; margin-top: 2px; }
.sci-name { font-size: 16px; color: var(--navy); margin-top: 2px; }
.sci-name i { font-family: var(--font-display); font-size: 19px; }
.sci-name span { color: var(--muted); font-size: 14px; margin-left: 6px; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.tag { background: var(--navy); color: var(--amber); font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; padding: 5px 10px; border-radius: 3px; text-transform: uppercase; white-space: nowrap; }
.tag.ghost { background: var(--surface); color: var(--navy); border: 1px solid var(--line); }

.spec-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.viewer-col { position: sticky; top: 10px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.info-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.bracket { position: relative; }
.bracket::before, .bracket::after { content: ""; position: absolute; width: 22px; height: 22px; border: 2px solid var(--amber); z-index: 2; pointer-events: none; }
.bracket::before { top: -2px; left: -2px; border-right: none; border-bottom: none; }
.bracket::after { bottom: -2px; right: -2px; border-left: none; border-top: none; }

.viewer { position: relative; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: linear-gradient(180deg, #E4E7E0 0%, #EEEAE0 55%, var(--paper) 100%); }
.viewer.tree { aspect-ratio: 4 / 5; max-height: calc(100vh - 230px); min-height: 360px; width: 100%; }
.viewer.seed { aspect-ratio: 16 / 10; width: 100%; background: linear-gradient(180deg, #ECE7DB, var(--paper)); }
.viewer canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.vlabel { position: absolute; top: 12px; left: 14px; z-index: 3; max-width: calc(100% - 150px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em; color: var(--navy); background: rgba(243, 239, 230, .85); padding: 4px 8px; border-radius: 3px; pointer-events: none; text-transform: uppercase; }
.vbusy { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; color: var(--navy); background: rgba(243, 239, 230, .55); z-index: 4; }

.vctl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { display: flex; justify-content: space-between; gap: 8px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
.field output { color: var(--navy); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--amber-deep); }
.checks { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }
.checks label { display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
.checks input { accent-color: var(--navy); }
.checks .btns { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 8px; background: var(--navy); color: #fff; font-family: var(--font-mono); font-size: 12px; letter-spacing: .04em; padding: 8px 16px; border-radius: 100px; border: 1px solid var(--navy); cursor: pointer; transition: background .2s; }
.btn:hover { background: var(--amber); color: var(--navy); border-color: var(--amber); }
.btn-ghost { background: transparent; color: var(--navy); border-color: var(--line); }
.btn-ghost:hover { background: var(--navy); color: #fff; border-color: var(--navy); }

.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.model-note { font-size: 13px; color: var(--muted); border-left: 3px solid var(--amber); padding-left: 12px; }

.block { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 22px 24px; }
.block h3 { font-size: 22px; margin-bottom: 8px; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.block h3 .kicker { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em; color: var(--amber-deep); text-transform: uppercase; }
.block p { font-size: 14.5px; color: #2a2a2a; max-width: 68ch; }
/* justified running text; hyphenation keeps the word spacing even (Khmer text is untouched) */
.block p, .leaf-facts li, .spec-empty p { text-align: justify; text-justify: inter-word; hyphens: auto; -webkit-hyphens: auto; }
.block p + p { margin-top: 10px; }
.block .calendar { margin-top: 14px; }
.block.seed .viewer { margin: 6px 0 14px; }
.seed-desc { font-size: 14px; }
details.block summary { cursor: pointer; list-style: none; }
details.block summary::-webkit-details-marker { display: none; }
details.block summary h3 { margin: 0; }
details.block summary h3::after { content: "+"; font-family: var(--font-mono); color: var(--amber-deep); }
details.block[open] summary h3::after { content: "–"; }
details.block[open] summary { margin-bottom: 10px; }
.refs { display: flex; gap: 10px; flex-wrap: wrap; }
.refs a { font-family: var(--font-mono); font-size: 11.5px; color: var(--navy); border: 1px solid var(--line); background: var(--surface); padding: 7px 12px; border-radius: 4px; }
.refs a:hover { border-color: var(--amber); }

/* flowering / fruiting month strip */
.months { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 3px; }
.months span { font-family: var(--font-mono); font-size: 9.5px; text-align: center; color: var(--muted); padding-top: 4px; }
.months i { display: block; height: 10px; border-radius: 2px; background: #EDE8DC; }
.months i.fl { background: var(--amber); }
.months i.fr { background: var(--leaf); }
.months i.fl.fr { background: linear-gradient(90deg, var(--amber) 50%, var(--leaf) 50%); }
.legend { display: flex; gap: 14px; font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); margin-top: 8px; letter-spacing: .04em; }
.legend b { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

/* ---------- method panel ---------- */
.method { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; }
.method h2 { font-size: 28px; margin-bottom: 12px; }
.method p { font-size: 14.5px; color: var(--muted); margin-bottom: 12px; max-width: 64ch; }
.method code { font-family: var(--font-mono); font-size: 12.5px; background: var(--surface); border: 1px solid var(--line); padding: 1px 6px; border-radius: 3px; color: var(--navy); }
.flag-list li { padding: 10px 0 10px 22px; position: relative; font-size: 14px; color: var(--ink); border-bottom: 1px solid var(--line); }
.flag-list li::before { content: ""; position: absolute; left: 0; top: 17px; width: 9px; height: 9px; background: var(--amber); border-radius: 2px; }
.flag-list i { font-family: var(--font-display); }

/* ---------- footer ---------- */
.readout-footer { background: var(--navy-deep); color: #fff; padding: 40px 40px 24px; }
.foot-top { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 28px; margin-bottom: 26px; }
.foot-brand p { color: #8892AC; font-size: 13px; margin-top: 6px; font-family: var(--font-mono); }
.foot-col h4 { font-family: var(--font-mono); font-size: 11px; color: #7C86A6; letter-spacing: .1em; margin-bottom: 12px; text-transform: uppercase; }
.foot-col a, .foot-col p { display: block; color: #C7CCDC; font-size: 14px; margin-bottom: 8px; }
.foot-col a:hover { color: var(--amber); }
.foot-bottom { border-top: 1px solid var(--line-dark); padding-top: 18px; font-size: 12px; color: #5D6684; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-family: var(--font-mono); }

/* ---------- specimen-only page ---------- */
body:has(.specimen-only) { background: var(--paper); padding: 0; }
.specimen-only { max-width: 1480px; margin: 0 auto; padding: 28px 24px 40px; }
.specimen-only .console { grid-template-columns: 300px minmax(0, 1fr); }
.specimen-only .register { gap: 6px; }
.sp-list { overflow-y: auto; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); overscroll-behavior: contain; }
.sp-list li + li { border-top: 1px solid var(--line); }
.sp-item { width: 100%; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: center; padding: 8px 10px; background: none; border: none; text-align: left; cursor: pointer; transition: background .15s; }
.sp-item:hover { background: #FBF8F1; }
.sp-item[aria-current="true"] { background: var(--navy); }
.sp-thumb { width: 64px; height: 64px; border: 1px solid var(--line); border-radius: 3px; display: block; }
.sp-item[aria-current="true"] .sp-thumb { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber); }
.sp-names { display: flex; flex-direction: column; min-width: 0; }
.sp-cam { font-weight: 600; font-size: 14px; color: var(--navy); line-height: 1.25; }
.sp-km { font-family: var(--font-khmer); font-size: 13px; color: var(--amber-deep); line-height: 1.7; }
.sp-sci { font-size: 12px; font-style: italic; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-item[aria-current="true"] .sp-cam { color: #fff; }
.sp-item[aria-current="true"] .sp-km { color: var(--amber); }
.sp-item[aria-current="true"] .sp-sci { color: #B9C0D6; }
@media (max-width: 980px) {
  .specimen-only .console { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- viewer tools: pan mode, full screen ---------- */
.vtools { position: absolute; top: 12px; right: 12px; z-index: 5; display: flex; gap: 6px; }
.viewer.seed .vtools { top: 18px; right: 20px; }
.vbtn {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; color: var(--navy);
  background: rgba(243, 239, 230, .92); border: 1px solid var(--line); border-radius: 3px;
  padding: 6px 10px; min-height: 32px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  touch-action: manipulation;
}
.vbtn:hover { border-color: var(--amber); }
.vbtn[aria-pressed="true"] { background: var(--navy); color: var(--amber); border-color: var(--navy); }
.vhint { position: absolute; left: 14px; bottom: 12px; z-index: 3; pointer-events: none; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .05em; color: var(--muted); background: rgba(243, 239, 230, .8); padding: 3px 7px; border-radius: 3px; }
.viewer.seed .vhint { bottom: auto; top: 50px; left: 20px; }
.viewer.pan-mode canvas { cursor: move; }
@media (max-width: 560px) { .vbtn .t { display: none; } .vbtn { min-width: 36px; justify-content: center; } }

.viewer:fullscreen, .viewer.is-max { width: 100vw; height: 100vh; height: 100dvh; max-height: none; aspect-ratio: auto; border: none; border-radius: 0; }
.viewer:-webkit-full-screen { width: 100vw; height: 100vh; max-height: none; aspect-ratio: auto; }
.viewer.is-max { position: fixed; inset: 0; z-index: 1000; padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px); }
html.viewer-max, html.viewer-max body { overflow: hidden; }
.viewer:fullscreen.bracket::before, .viewer:fullscreen.bracket::after, .viewer.is-max.bracket::before, .viewer.is-max.bracket::after { display: none; }

/* ---------- seed panel as a botanical plate ---------- */
.viewer.seed {
  aspect-ratio: 4 / 3;
  background:
    radial-gradient(120% 90% at 50% 40%, rgba(255, 252, 240, .65), transparent 70%),
    repeating-linear-gradient(0deg, rgba(120, 100, 60, .025) 0 1px, transparent 1px 3px),
    #F1E8D0;
  border-color: #D8CBA8;
  box-shadow: inset 0 0 0 10px #F1E8D0, inset 0 0 0 11px rgba(59, 49, 35, .45);
}
.viewer.seed .vlabel { background: rgba(241, 232, 208, .9); top: 18px; left: 20px; }
.plate-cap { position: absolute; left: 0; right: 0; bottom: 16px; z-index: 3; text-align: center; pointer-events: none; font-family: var(--font-display); font-size: 14px; color: #3b3123; letter-spacing: .02em; }
.plate-cap i { font-style: italic; }

.leaf-facts { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.leaf-facts li { position: relative; padding-left: 16px; font-size: 14px; color: #2a2a2a; }
.leaf-facts li::before { content: ""; position: absolute; left: 0; top: 9px; width: 7px; height: 7px; border-radius: 2px; background: var(--leaf); }

/* ---------- reference image galleries ---------- */
.ref-gallery { margin: 14px 0 6px; display: flex; flex-direction: column; gap: 8px; }
.rg-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.rg-lbl { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em; color: var(--amber-deep); text-transform: uppercase; }
.rg-count { font-family: var(--font-mono); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rg-stage { position: relative; margin: 0; aspect-ratio: 4 / 3; background: #1b2236; border-radius: 4px; overflow: hidden; display: grid; place-items: center; touch-action: pan-y; }
.rg-stage:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.rg-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; transform-origin: center center; will-change: transform; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.rg-stage { touch-action: pan-y; cursor: grab; user-select: none; }
.rg-stage.zoomed, .rg-stage.is-max, .rg-stage:fullscreen { touch-action: none; }
.rg-stage:active { cursor: grabbing; }
.rg-zoom { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 4px; align-items: center; z-index: 2; }
.rg-zoom .vbtn { min-width: 34px; justify-content: center; font-size: 15px; }
.rg-zoom .vbtn:disabled { opacity: .45; cursor: default; }
.rg-level { font-family: var(--font-mono); font-size: 11px; color: #F3EFE6; background: rgba(20, 33, 61, .8); padding: 4px 7px; border-radius: 3px; font-variant-numeric: tabular-nums; }
.rg-hint { position: absolute; left: 8px; bottom: 8px; z-index: 2; font-family: var(--font-mono); font-size: 10.5px; color: #C7CCDC; background: rgba(20, 33, 61, .75); padding: 3px 7px; border-radius: 3px; pointer-events: none; }
.rg-stage.zoomed .rg-hint { display: none; }
.rg-stage.zoomed .rg-nav { opacity: .35; }
@media (max-width: 560px) { .rg-hint { display: none; } }
.rg-stage.loading::after { content: "Loading image…"; position: absolute; font-family: var(--font-mono); font-size: 11px; color: #B9C0D6; }
.rg-fallback { color: #C7CCDC; text-align: center; font-size: 13px; padding: 20px; line-height: 1.7; }
.rg-fallback a { color: var(--amber); }
.rg-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 38px; height: 54px; border: 1px solid var(--amber); background: rgba(20, 33, 61, .85); color: var(--amber); font-size: 26px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.rg-nav:hover { background: var(--amber); color: var(--navy); }
.rg-prev { left: 8px; } .rg-next { right: 8px; }
.rg-fs { position: absolute; top: 8px; right: 8px; }
.rg-cap { font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.rg-lic { font-family: var(--font-mono); font-size: 11px; }
.rg-cap a { color: var(--navy); text-decoration: underline; text-decoration-color: var(--amber); }
.rg-thumbs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.rg-thumb { flex: 0 0 auto; width: 60px; height: 60px; padding: 0; border: 1px solid var(--line); border-radius: 3px; background: #EDE7D9; cursor: pointer; overflow: hidden; font-family: var(--font-mono); font-size: 12px; color: var(--navy); }
.rg-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rg-thumb[aria-current="true"] { border-color: var(--amber); box-shadow: 0 0 0 2px var(--amber); }
.rg-empty { font-size: 13px; color: var(--muted); background: #EDE7D9; border-radius: 4px; padding: 14px 16px; }
.rg-stage:fullscreen, .rg-stage.is-max { aspect-ratio: auto; width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; }
.rg-stage.is-max { position: fixed; inset: 0; z-index: 1000; }

/* ---------- province map ---------- */
.dist-wrap { display: flow-root; }  /* the map floats right; text wraps around it, then runs full width */
.kh-map { float: right; width: 190px; margin: 2px 0 10px 18px; display: flex; flex-direction: column; gap: 6px; }
.kh-map svg { width: 100%; height: auto; display: block; background: var(--paper); border: 1px solid var(--line); border-radius: 4px; padding: 8px; }
.kh-map path { fill: #E4DCCB; stroke: #FBF8F1; stroke-width: 1.2; stroke-linejoin: round; transition: fill .15s; }
.kh-map path.on { fill: var(--amber); stroke: var(--navy); stroke-width: 1.4; }
.kh-map path:hover { fill: #D2C8B3; }
.kh-map path.on:hover { fill: var(--amber-deep); }
.kh-map figcaption { display: flex; flex-direction: column; gap: 3px; }
.km-key { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .06em; color: var(--navy); text-transform: uppercase; display: flex; align-items: center; gap: 6px; }
.km-key b { width: 10px; height: 10px; border-radius: 2px; background: var(--amber); border: 1px solid var(--navy); flex-shrink: 0; }
.km-list { font-size: 12px; color: var(--muted); line-height: 1.5; }
.km-credit { font-family: var(--font-mono); font-size: 9.5px; color: var(--muted); opacity: .8; }
@media (max-width: 560px) { .kh-map { float: none; width: 100%; max-width: 260px; margin: 0 0 12px; } }

/* ---------- stat explanations ---------- */
.stat.has-tip { position: relative; }
.stat .info {
  display: inline-grid; place-items: center; width: 15px; height: 15px; margin-left: 4px; vertical-align: 1px;
  border-radius: 50%; border: 1px solid var(--amber-deep); background: transparent; color: var(--amber-deep);
  font-family: var(--font-display); font-style: italic; font-size: 10px; line-height: 1; cursor: help; padding: 0;
}
.stat .info:hover, .has-tip.open .info { background: var(--amber); border-color: var(--amber); color: var(--navy); }
.stat .tip {
  position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 20; width: max(220px, 100%); max-width: 280px;
  background: var(--navy); color: #F3EFE6; border-left: 3px solid var(--amber); border-radius: 4px;
  padding: 10px 12px; font-family: var(--font-body); font-size: 12.5px; line-height: 1.55; letter-spacing: 0; text-transform: none;
  box-shadow: 0 10px 26px rgba(10, 21, 38, .28); opacity: 0; visibility: hidden; transform: translateY(4px); transition: opacity .15s, transform .15s, visibility .15s;
  pointer-events: none;
}
.stat .tip::after { content: ""; position: absolute; left: 18px; top: 100%; border: 6px solid transparent; border-top-color: var(--navy); }
.has-tip:hover .tip, .has-tip:focus-within .tip, .has-tip.open .tip { opacity: 1; visibility: visible; transform: none; }
.stat-row .stat:nth-child(4) .tip, .stat-row .stat:nth-child(3) .tip { left: auto; right: 0; }
.stat-row .stat:nth-child(4) .tip::after, .stat-row .stat:nth-child(3) .tip::after { left: auto; right: 18px; }

/* ---------- species search ---------- */
.sp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-width: 0; }
.sp-head .section-lbl { margin: 0; flex-shrink: 0; }
.sp-total { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; font-variant-numeric: tabular-nums; }
/* the.BUR search field: white, navy frame, amber left rule, mono type */
.sp-search { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: var(--surface); border: 2px solid var(--navy); border-left: 4px solid var(--amber); transition: box-shadow .15s; }
.sp-search:focus-within { box-shadow: 0 0 0 3px rgba(252, 163, 17, .35); }
.sp-search .s-ico { font-family: var(--font-mono); color: var(--amber-deep); font-size: 16px; line-height: 1; }
.sp-search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-family: var(--font-mono); font-size: 12.5px; color: var(--navy); letter-spacing: .03em; padding: 0; }
.sp-search input::placeholder { color: var(--muted); }
.sp-search input::-webkit-search-cancel-button { display: none; }
.sp-search .s-clear { background: none; border: none; cursor: pointer; color: var(--muted); font-weight: 700; font-size: 16px; line-height: 1; padding: 0 2px; }
.sp-search .s-clear:hover { color: var(--navy); }
.sp-none { padding: 24px 14px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- share box ---------- */
.info-col .share-box { width: 100%; }
.share-box { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--amber); border-radius: 4px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.share-lbl { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; color: var(--amber-deep); text-transform: uppercase; }
.share-link { display: flex; gap: 8px; min-width: 0; }
.share-link input { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 12px; color: var(--navy); background: var(--paper); border: 1px solid var(--line); border-radius: 3px; padding: 7px 10px; }
.share-link .btn { flex-shrink: 0; }
.share-row { display: flex; gap: 6px; flex-wrap: wrap; }
.share-btn { background: var(--navy); color: #fff; padding: 7px 13px; border-radius: 4px; font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .03em; transition: background .15s; }
.share-btn:hover { background: var(--amber); color: var(--navy); }
.share-status { font-family: var(--font-mono); font-size: 11px; color: var(--muted); min-height: 1em; }
.share-status:empty { display: none; }
img.sp-thumb { object-fit: cover; background: #EDE7D9; }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .spec-grid { grid-template-columns: minmax(0, 1fr); }
  .viewer-col { position: static; }
  .viewer.tree { aspect-ratio: 16 / 11; max-height: none; }
}
@media (max-width: 980px) {
  .console { grid-template-columns: minmax(0, 1fr); }
  .register { position: static; max-height: none; }
  .reg-list { max-height: 340px; }
  .method { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  body { padding: 6px; }
  :root { --frame-radius: 20px; }
  .ticks { margin: 0 20px; }
  .topbar { padding: 14px 16px 16px; }
  .coords { display: none; }
  .hero-panel { padding: 34px 18px 32px; }
  .panel { grid-template-columns: minmax(0, 1fr); }
  .panel-tab { flex-direction: row; padding: 10px 16px; justify-content: flex-start; border-right: none; border-bottom: 1px solid var(--line-dark); }
  .tab-text { writing-mode: horizontal-tb; transform: none; }
  .panel-body { padding: 22px 16px 30px; }
  .spec-head { grid-template-columns: minmax(0, 1fr); }
  .specimen-only { padding: 18px 16px 30px; }
  .tags { justify-content: flex-start; }
  .vctl { grid-template-columns: minmax(0, 1fr); }
  .checks .btns { margin-left: 0; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .viewer.tree { aspect-ratio: 4 / 5; min-height: 0; }
  .block { padding: 18px 16px; }
  .readout-footer { padding: 30px 18px 20px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* =========================================================
   Header browsing, section shortcuts, touch and small-screen modes
   ========================================================= */
.spec-head { align-items: center; }
.spec-nav { display: flex; align-items: center; gap: 8px; }
.spec-nav .btn { padding: 7px 14px; }
.spec-pos { font-family: var(--font-mono); font-size: 11px; color: var(--muted); letter-spacing: .06em; font-variant-numeric: tabular-nums; min-width: 44px; text-align: center; }
.spec-grid > *, .info-col > * { scroll-margin-top: 16px; }

/* section shortcuts: shown once the page is one long column */
.sec-nav { display: none; }
/* section shortcuts as a the.BUR console strip: navy bar, outlined pills with amber index
   numbers, the current section filled amber, amber edge-ticks below. No animation. */
.sec-link {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
  color: #B9C0D6; border: 1px solid var(--line-dark); border-radius: 100px; padding: 7px 14px 7px 9px; scroll-snap-align: start;
}
.sec-link .n {
  display: inline-grid; place-items: center; min-width: 22px; height: 18px; padding: 0 4px; border-radius: 100px;
  background: rgba(252, 163, 17, .14); color: var(--amber); font-size: 10px; font-weight: 700; letter-spacing: 0; font-variant-numeric: tabular-nums;
}
.sec-link:hover { color: #fff; border-color: var(--amber); }
.sec-link[aria-current="true"] { background: var(--amber); border-color: var(--amber); color: var(--navy); font-weight: 700; }
.sec-link[aria-current="true"] .n { background: var(--navy); color: var(--amber); }
@media (max-width: 1280px) {
  .sec-nav {
    display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; scroll-padding-inline: 10px;
    position: sticky; top: 0; z-index: 30; margin: -6px 0 18px; padding: 10px 10px 16px;
    border-radius: 6px; box-shadow: 0 8px 20px rgba(10, 21, 38, .18);
    background:
      repeating-linear-gradient(90deg, var(--amber) 0 3px, transparent 3px 22px) left 14px bottom 0 / calc(100% - 28px) 5px no-repeat,
      var(--navy);
  }
  .sec-nav::-webkit-scrollbar { display: none; }
  .spec-grid > *, .info-col > * { scroll-margin-top: 64px; }
}

/* species bar (phones and tablets) */
.m-bar { display: none; }
.sp-close { display: none; place-items: center; width: 40px; height: 40px; margin-left: 4px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--navy); font-size: 15px; cursor: pointer; }
.sp-head { align-items: center; }
.sp-head .sp-total { margin-left: auto; }
@media (max-width: 980px) {
  .m-bar {
    display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 6px; align-items: center;
    position: sticky; top: 0; z-index: 60; margin: -18px -16px 18px; padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top));
    background: var(--navy); box-shadow: 0 6px 18px rgba(10, 21, 38, .25);
  }
  .m-step { height: 44px; border: 1px solid var(--line-dark); border-radius: 4px; background: transparent; color: var(--amber); font-size: 26px; line-height: 1; cursor: pointer; display: grid; place-items: center; touch-action: manipulation; }
  .m-step:active { background: var(--navy-soft); }
  .m-pick { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 44px; padding: 2px 4px; background: none; border: none; text-align: left; cursor: pointer; color: #fff; touch-action: manipulation; }
  .m-thumb { width: 40px; height: 40px; border-radius: 3px; border: 1px solid var(--amber); object-fit: cover; background: #EDE7D9; }
  .m-names { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
  .m-cam { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .m-km { font-family: var(--font-khmer); font-size: 12.5px; color: var(--amber); line-height: 1.6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .m-open { font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--navy); background: var(--amber); border-radius: 100px; padding: 6px 11px; white-space: nowrap; }
  .sec-nav { top: calc(60px + env(safe-area-inset-top)); margin-left: -16px; margin-right: -16px; border-radius: 0; border-top: 1px solid var(--line-dark); }
  .spec-grid > *, .info-col > * { scroll-margin-top: calc(124px + env(safe-area-inset-top)); }
  .spec-nav { display: none; }  /* the species bar carries previous / next */

  /* the species list becomes a bottom sheet */
  .specimen-only .register {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 210; max-height: 86vh; max-height: 86dvh; gap: 10px;
    background: var(--paper); border-radius: 18px 18px 0 0; padding: 22px 16px max(16px, env(safe-area-inset-bottom));
    box-shadow: 0 -18px 50px rgba(10, 21, 38, .35);
    transform: translateY(104%); visibility: hidden; pointer-events: none; transition: transform .28s cubic-bezier(.2, .8, .2, 1), visibility 0s .28s;
  }
  .specimen-only .register::before { content: ""; position: absolute; top: 8px; left: 50%; width: 42px; height: 4px; margin-left: -21px; border-radius: 4px; background: var(--line); }
  html.sheet-open .specimen-only .register { transform: none; visibility: visible; pointer-events: auto; transition: transform .28s cubic-bezier(.2, .8, .2, 1), visibility 0s; }
  html.sheet-open, html.sheet-open body { overflow: hidden; }
  .sheet-bg { position: fixed; inset: 0; z-index: 200; background: rgba(10, 21, 38, .5); }
  .sp-list { flex: 1; min-height: 0; max-height: none; }
  .sp-close { display: grid; }
}

/* 3D views on touch screens: tap to take over gestures */
.vgate { display: none; }
.viewer.touch .vgate { position: absolute; inset: 0; z-index: 4; display: grid; place-items: end center; padding-bottom: 14px; background: transparent; border: none; cursor: pointer; touch-action: pan-y; }
.viewer.touch.seed .vgate { padding-bottom: 44px; }  /* above the plate caption */
.vgate[hidden] { display: none !important; }
.vgate-pill { font-family: var(--font-mono); font-size: 12px; letter-spacing: .05em; color: #fff; background: rgba(20, 33, 61, .86); border: 1px solid var(--amber); border-radius: 100px; padding: 10px 16px; box-shadow: 0 6px 18px rgba(10, 21, 38, .25); }
.viewer.touch:not(.live) .vhint { display: none; }
.viewer.touch.live { box-shadow: 0 0 0 2px var(--amber); }
.vdone { background: var(--amber) !important; color: var(--navy) !important; border-color: var(--amber) !important; font-weight: 700; }
.viewer.touch .vtools .vbtn[title^="One-finger"] { display: none; }  /* two fingers already pan on touch */
.viewer.touch.is-max .vtools .vbtn[title^="One-finger"], .viewer.touch:fullscreen .vtools .vbtn[title^="One-finger"] { display: inline-flex; }

/* bigger targets wherever the pointer is a finger */
@media (pointer: coarse) {
  .vbtn { min-height: 44px; min-width: 44px; justify-content: center; }
  .btn { min-height: 44px; padding: 10px 18px; }
  .checks label { min-height: 40px; }
  .checks input { width: 20px; height: 20px; }
  input[type="range"] { height: 34px; }
  .stat .info { width: 24px; height: 24px; font-size: 13px; position: relative; }
  .stat .info::after { content: ""; position: absolute; inset: -10px; }
  .rg-nav { width: 44px; height: 60px; }
  .rg-thumb { width: 68px; height: 68px; }
  .share-btn { padding: 11px 15px; }
  .share-link input { min-height: 44px; font-size: 16px; }  /* 16px stops iOS zooming into the field */
  .sp-search input { font-size: 16px; }
  .sp-item { padding: 10px 12px; }
  .sec-link { padding: 10px 14px; }
}

/* phones */
@media (max-width: 760px) {
  .cam-name { font-size: 34px; margin-top: 0; }
  .spec-head { padding-bottom: 14px; margin-bottom: 14px; }
  .viewer.tree { aspect-ratio: 3 / 4; max-height: 72vh; max-height: 72svh; }
  .viewer.seed { aspect-ratio: 1 / 1; }
  .vlabel { max-width: calc(100% - 120px); font-size: 10px; }
  .viewer.touch.live .vlabel { max-width: calc(100% - 170px); }
  .vctl { gap: 6px 16px; }
  .checks { flex-direction: column; align-items: stretch; gap: 2px; }
  .checks .btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
  .checks .btns .btn { justify-content: center; padding-inline: 10px; white-space: nowrap; font-size: 11.5px; }
  .stat-row .stat:nth-child(3) .tip { left: 0; right: auto; }
  .stat-row .stat:nth-child(3) .tip::after { left: 18px; right: auto; }
  .stat-row .stat:nth-child(2) .tip { left: auto; right: 0; }
  .stat-row .stat:nth-child(2) .tip::after { left: auto; right: 18px; }
  .stat .tip { width: min(280px, calc(100vw - 48px)); }
  .block h3 { font-size: 21px; }
  .block p { font-size: 15px; line-height: 1.7; }
  .rg-stage { aspect-ratio: 1 / 1; }
  .share-link { flex-direction: column; }
  .share-row { display: grid; grid-template-columns: 1fr 1fr; }
  .share-btn { text-align: center; }
}

/* phones held sideways: let the 3D view use the full height */
@media (max-height: 520px) and (orientation: landscape) {
  .viewer.tree { aspect-ratio: auto; height: 82vh; height: 82svh; max-height: none; min-height: 0; }
  .viewer.seed, .rg-stage { aspect-ratio: auto; height: 78vh; height: 78svh; }
  .m-bar { padding-top: 6px; padding-bottom: 6px; }
  .sec-nav { position: static; }  /* only the species bar stays pinned when height is short */
}
.vtools .vdone .t { display: inline; }  /* keep the word on phones too */

/* =========================================================
   the.BUR console finish: navy instrument panels on a survey-grid paper
   (static only: no glows, no animated effects)
   ========================================================= */
body:has(.specimen-only) {
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(20, 33, 61, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 33, 61, .045) 1px, transparent 1px);
  background-size: 28px 28px;
}

/* ---- species sidebar: navy console panel ---- */
.specimen-only .register {
  background: var(--navy); border-radius: 6px; padding: 0 12px 12px; gap: 10px;
  box-shadow: 0 18px 40px rgba(10, 21, 38, .22); overflow: hidden;
}
.specimen-only .register::after {  /* amber edge-ticks along the top, as on the.BUR shell */
  content: ""; position: absolute; top: 0; left: 18px; right: 18px; height: 7px;
  background: repeating-linear-gradient(90deg, var(--amber) 0 3px, transparent 3px 18px); opacity: .9; pointer-events: none;
}
.specimen-only .sp-head { padding-top: 20px; }
.specimen-only .sp-head .section-lbl { color: var(--amber); }
.specimen-only .sp-total { color: #8892AC; }
.specimen-only .sp-search { border-color: var(--surface); }
.specimen-only .sp-list { background: transparent; border: none; border-radius: 0; scrollbar-color: var(--navy-soft) transparent; scrollbar-width: thin; }
.specimen-only .sp-list li + li { border-top: 1px solid var(--line-dark); }
.specimen-only .sp-item { border-left: 3px solid transparent; padding-left: 8px; }
.specimen-only .sp-item:hover { background: var(--navy-soft); }
.specimen-only .sp-cam { color: #fff; }
.specimen-only .sp-km { color: var(--amber); }
.specimen-only .sp-sci { color: #8892AC; }
.specimen-only .sp-thumb { border-color: var(--line-dark); }
.specimen-only .sp-item[aria-current="true"] { background: var(--navy-deep); border-left-color: var(--amber); }
.specimen-only .sp-none { color: #B9C0D6; }
.specimen-only .sp-close { background: transparent; color: #fff; border-color: var(--line-dark); }

/* ---- species header: navy band with the contour-line motif ---- */
.specimen-only .spec-head {
  position: relative; overflow: hidden; border: none; border-radius: 6px; padding: 30px 32px 28px; margin-bottom: 18px;
  background: linear-gradient(160deg, var(--navy-soft), var(--navy) 55%, var(--navy-deep));
  box-shadow: 0 18px 40px rgba(10, 21, 38, .18);
}
.specimen-only .spec-head::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .2;
  background: repeating-radial-gradient(circle at 88% 135%, transparent 0 20px, rgba(252, 163, 17, .75) 20px 21px);
  mask-image: linear-gradient(90deg, transparent 40%, #000 85%); -webkit-mask-image: linear-gradient(90deg, transparent 40%, #000 85%);
}
.specimen-only .spec-head > * { position: relative; z-index: 1; }
.specimen-only .spec-head::before {  /* ticks under the band */
  content: ""; position: absolute; left: 32px; right: 32px; bottom: 0; height: 6px; z-index: 1;
  background: repeating-linear-gradient(90deg, var(--amber) 0 3px, transparent 3px 22px);
}
.specimen-only .cam-name { color: #fff; margin-top: 0; }
.specimen-only .km-name { color: var(--amber); }
.specimen-only .sci-name { color: #E7E2D6; }
.specimen-only .sci-name span { color: #8892AC; }
.specimen-only .spec-nav .btn-ghost { color: #E7E2D6; border-color: var(--line-dark); background: transparent; }
.specimen-only .spec-nav .btn-ghost:hover { background: var(--amber); color: var(--navy); border-color: var(--amber); }
.specimen-only .spec-pos { color: var(--amber); }

/* ---- info sections: numbered amber badges, like the.BUR panel tabs ---- */
.info-col { counter-reset: sec; }
.info-col > .block:not([hidden]) { counter-increment: sec; }
.block { border-radius: 6px; box-shadow: 0 1px 0 rgba(20, 33, 61, .04), 0 10px 24px rgba(20, 33, 61, .05); }
.info-col > .block > h3 { justify-content: flex-start; align-items: center; gap: 4px 12px; padding-bottom: 12px; margin-bottom: 14px; position: relative; }
.info-col > .block > h3::before {
  content: counter(sec, decimal-leading-zero); flex-shrink: 0;
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--navy); color: var(--amber); font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: 0;
}
.info-col > .block > h3::after {  /* short amber rule under the heading */
  content: ""; position: absolute; left: 0; bottom: 0; width: 56px; height: 3px; background: var(--amber);
}
.info-col > .block > h3 .kicker { flex-basis: 100%; padding-left: 42px; margin-top: -6px; order: 3; }
.info-col > .block > h3 .btn { margin-left: auto; }

/* ---- tree controls and measurements: instrument cards ---- */
.vctl { border-radius: 6px; border-left: 3px solid var(--amber); }
.field output { color: var(--amber-deep); font-weight: 700; }
.stat-row .stat { background: var(--navy); border: none; border-left: 3px solid var(--amber); border-radius: 6px; box-shadow: 0 10px 24px rgba(10, 21, 38, .14); }
.stat-row .stat .n { color: #fff; }
.stat-row .stat .n small { color: var(--amber); }
.stat-row .stat .l { color: #B9C0D6; }
.stat-row .stat .info { border-color: var(--amber); color: var(--amber); }
.stat-row .stat .tip { background: var(--navy-deep); }
.stat-row .stat .tip::after { border-top-color: var(--navy-deep); }

/* ---- share box: navy card ---- */
.share-box { background: var(--navy); border: none; border-left: 3px solid var(--amber); border-radius: 6px; box-shadow: 0 18px 40px rgba(10, 21, 38, .18); }
.share-lbl { color: var(--amber); }
.share-link input { background: var(--navy-deep); border-color: var(--line-dark); color: #E7E2D6; }
.share-btn { background: transparent; border: 1px solid var(--line-dark); color: #E7E2D6; }
.share-btn:hover { background: var(--amber); border-color: var(--amber); color: var(--navy); }
.share-box .btn { background: var(--amber); border-color: var(--amber); color: var(--navy); }
.share-box .btn:hover { background: #fff; border-color: #fff; }
.share-status { color: #B9C0D6; }

/* ---- viewers and galleries: rounder frames to match ---- */
.viewer, .rg-stage { border-radius: 6px; }

/* ---- small screens ---- */
@media (max-width: 980px) {
  .specimen-only .register { background: var(--navy); border-radius: 18px 18px 0 0; padding: 22px 16px max(16px, env(safe-area-inset-bottom)); }
  .specimen-only .register::after { display: none; }
  .specimen-only .register::before { background: var(--line-dark); }
  .specimen-only .sp-head { padding-top: 0; }
}
@media (max-width: 760px) {
  .specimen-only .spec-head { margin: 0 -16px 14px; border-radius: 0; padding: 22px 16px 24px; }
  .specimen-only .spec-head::before { left: 16px; right: 16px; }
  .m-bar { box-shadow: none; border-bottom: 1px solid var(--line-dark); }
  .info-col > .block > h3::before { width: 26px; height: 26px; font-size: 10px; }
  .info-col > .block > h3 .kicker { padding-left: 38px; }
}

/* =========================================================
   Golden-ratio system (φ = 1.618)
   Type steps by √φ from a 15 px body: 11.8 · 15 · 19.1 · 24.3 · 30.9 · 39.3
   Space follows Fibonacci: 8 · 13 · 21 · 34 · 55
   Reading order: species name → Khmer → Latin → model → measurements → controls → sections
   ========================================================= */
:root {
  --phi: 1.618;
  --sp-1: 8px; --sp-2: 13px; --sp-3: 21px; --sp-4: 34px; --sp-5: 55px;
  --fs-xs: 11.8px; --fs-0: 15px; --fs-1: 19.1px; --fs-2: 24.3px; --fs-3: 30.9px; --fs-4: 39.3px;
  --lh: 1.618;
}

/* page frame and the two main columns */
.specimen-only { padding: var(--sp-4) var(--sp-3) var(--sp-5); }
.specimen-only .console { gap: var(--sp-4); }
.spec-grid { gap: var(--sp-4); grid-template-columns: minmax(0, 1.618fr) minmax(0, 1fr); }  /* model : text = φ : 1 */
.viewer-col { gap: var(--sp-2); }
.info-col { gap: var(--sp-3); }

/* type hierarchy */
.specimen-only .cam-name { font-size: var(--fs-4); line-height: 1.15; }
.specimen-only .km-name { font-size: var(--fs-2); line-height: var(--lh); margin-top: 2px; }
.specimen-only .sci-name { font-size: var(--fs-0); margin-top: 0; }
.specimen-only .sci-name i { font-size: var(--fs-1); }
.block h3 { font-size: var(--fs-2); line-height: 1.25; }
.block p, .leaf-facts li, .seed-desc { font-size: var(--fs-0); line-height: var(--lh); }
.block p + p { margin-top: var(--sp-2); }
.section-lbl, .rg-lbl, .share-lbl, .field label, .stat .l, .vlabel { font-size: var(--fs-xs); }
.rg-cap { font-size: 13px; line-height: var(--lh); }
.stat .n { font-size: var(--fs-3); }

/* blocks: Fibonacci padding; eyebrow kicker above the heading, as in the.BUR */
.block { padding: var(--sp-3) var(--sp-3) var(--sp-4); }
.info-col > .block > h3 { padding-bottom: var(--sp-2); margin-bottom: var(--sp-3); }
.info-col > .block > h3 .kicker { order: -1; flex-basis: 100%; padding-left: 0; margin: 0 0 2px; font-size: var(--fs-xs); }
.specimen-only .spec-head { padding: var(--sp-4) var(--sp-4) var(--sp-4); margin-bottom: var(--sp-3); }
.vctl { padding: var(--sp-2) var(--sp-3); gap: var(--sp-2) var(--sp-3); }
.stat-row { gap: var(--sp-2); }
.stat { padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-3); }
.share-box { padding: var(--sp-3); gap: var(--sp-2); }
.ref-gallery { margin: var(--sp-2) 0 var(--sp-1); gap: var(--sp-1); }

/* frames: tree is 1 : φ (portrait), plates and photos are φ : 1 */
.viewer.tree { aspect-ratio: 1 / 1.618; max-height: calc(100vh - 160px); }
.viewer.seed { aspect-ratio: 1.618 / 1; }
.rg-stage { aspect-ratio: 1.618 / 1; }
.kh-map { width: 186px; }  /* ≈ text column / φ² */

@media (max-width: 1280px) {
  .spec-grid { grid-template-columns: minmax(0, 1fr); }
  .viewer.tree { aspect-ratio: 1.618 / 1; max-height: none; }
}
@media (max-width: 760px) {
  :root { --fs-3: 24.3px; --fs-4: 30.9px; --fs-2: 19.1px; }
  .specimen-only { padding: var(--sp-3) 16px var(--sp-4); }
  .specimen-only .spec-head { padding: var(--sp-3) 16px var(--sp-4); }
  .block { padding: var(--sp-3) 16px var(--sp-3); }
  .viewer.tree { aspect-ratio: 1 / 1.272; max-height: 72svh; }  /* √φ: tall enough to read the tree on a phone */
  .viewer.seed, .rg-stage { aspect-ratio: 1 / 1; }  /* square plates keep the models usable at phone width */
}
@media (max-height: 520px) and (orientation: landscape) {
  .viewer.tree { aspect-ratio: auto; height: 82svh; max-height: none; }
  .viewer.seed, .rg-stage { aspect-ratio: auto; height: 78svh; }
}
/* map sits above the text (never squeezing it), split φ : 1 between map and province list */
.kh-map { float: none; width: 100%; max-width: none; margin: 0 0 var(--sp-3); display: grid; grid-template-columns: minmax(0, 1.618fr) minmax(0, 1fr); gap: var(--sp-2); align-items: start; }
.kh-map figcaption { padding-top: var(--sp-1); }
@media (max-width: 980px) {
  .m-bar { margin: calc(-1 * var(--sp-3)) -16px var(--sp-3); }
}
@media (max-width: 760px) {
  /* species bar, header band and section strip read as one navy block on phones */
  .m-bar { margin-bottom: 0; }
  .specimen-only .spec-head { margin-bottom: 0; border-top: 1px solid var(--line-dark); }
  .sec-nav { margin-top: 0; margin-bottom: var(--sp-3); }
}

/* ---- on/off toggles (replace the tick boxes); the knob slides, the track fills ---- */
.checks .switch-row { position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; font-size: 14px; user-select: none; -webkit-tap-highlight-color: transparent; }
.checks .switch-row input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.tgl {
  position: relative; flex-shrink: 0; width: 58px; height: 28px; border-radius: 100px;
  background: #E4DCCB; border: 1px solid var(--line); box-shadow: inset 0 1px 2px rgba(20, 33, 61, .12);
  transition: background .3s ease, border-color .3s ease;
}
.tgl-knob {
  position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 3px rgba(10, 21, 38, .3);
  transition: transform .32s cubic-bezier(.34, 1.4, .5, 1), background .3s ease;
}
.tgl-txt { position: absolute; top: 50%; transform: translateY(-50%); font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; transition: opacity .25s ease; }
.tgl-txt.on { left: 9px; color: var(--amber); opacity: 0; }
.tgl-txt.off { right: 8px; color: var(--muted); opacity: 1; }
.switch-row input:checked + .tgl { background: var(--navy); border-color: var(--navy); }
.switch-row input:checked + .tgl .tgl-knob { transform: translateX(30px); background: var(--amber); }
.switch-row input:checked + .tgl .tgl-txt.on { opacity: 1; }
.switch-row input:checked + .tgl .tgl-txt.off { opacity: 0; }
.switch-row:hover .tgl { border-color: var(--amber); }
.switch-row input:focus-visible + .tgl { outline: 2px solid var(--amber); outline-offset: 2px; }
.switch-row .tgl-lbl { line-height: 1.35; }
@media (max-width: 760px) { .checks .switch-row { min-height: 44px; } }

/* =========================================================
   Seed calendar, size comparison, province filter
   ========================================================= */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header tools */
.spec-tools { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--sp-1); margin-top: var(--sp-2); }
.tool-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 7px 16px 7px 10px; cursor: pointer;
  font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: .06em; text-transform: uppercase;
  color: #fff; background: rgba(255, 255, 255, .04); border: 1px solid var(--line-dark); border-radius: 100px;
}
.tool-btn .ico { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--amber); color: var(--navy); font-size: 13px; }
.tool-btn:hover { border-color: var(--amber); color: var(--amber); }
@media (pointer: coarse) { .tool-btn { min-height: 44px; } }

/* province filter in the species panel */
.sp-filter { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--line-dark); border-radius: 4px; }
.sp-filter-lbl { font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: .1em; text-transform: uppercase; color: #8892AC; }
.sp-filter select { flex: 1; min-width: 0; background: transparent; color: #fff; border: none; font-family: var(--font-mono); font-size: 12.5px; padding: 4px 0; cursor: pointer; }
.sp-filter select option { color: var(--navy); background: #fff; }
.sp-filter.on { border-color: var(--amber); background: rgba(252, 163, 17, .1); }
.sp-filter.on .sp-filter-lbl { color: var(--amber); }
@media (pointer: coarse) { .sp-filter select { font-size: 16px; min-height: 36px; } }

/* map: provinces that have species can be selected */
.kh-map path.pick { cursor: pointer; }
.km-tip { font-size: 12px; color: var(--navy); font-style: italic; }

/* dialogs: navy console panels */
.dlg {
  border: none; padding: 0; margin: auto; width: min(1080px, calc(100vw - 32px)); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
  background: var(--paper); color: var(--ink); border-radius: 8px; box-shadow: 0 30px 80px rgba(10, 21, 38, .45); overflow: auto;
}
.dlg-wide { width: min(1320px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(10, 21, 38, .62); }
html.dlg-open { overflow: hidden; }
.dlg-head {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4) calc(var(--sp-3) + 6px); color: #fff;
  background:
    repeating-linear-gradient(90deg, var(--amber) 0 3px, transparent 3px 22px) left var(--sp-4) bottom 0 / calc(100% - 2 * var(--sp-4)) 6px no-repeat,
    linear-gradient(160deg, var(--navy-soft), var(--navy) 55%, var(--navy-deep));
}
.dlg-head .section-lbl { color: var(--amber); margin-bottom: 4px; }
.dlg-head h2 { color: #fff; font-size: var(--fs-3); line-height: 1.15; }
.dlg-x { flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-dark); background: transparent; color: #fff; font-size: 16px; cursor: pointer; }
.dlg-x:hover { background: var(--amber); color: var(--navy); border-color: var(--amber); }
.dlg-note { padding: var(--sp-2) var(--sp-4) var(--sp-3); font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.dlg-note .k { display: inline-block; width: 22px; height: 10px; border-radius: 2px; }
.k.fl { background: var(--amber); } .k.fr { background: var(--leaf); }

/* seed calendar */
.cal-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); padding: var(--sp-3) var(--sp-4) var(--sp-2); }
.cal-month { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.cal-month select { font-family: var(--font-mono); font-size: 13px; color: var(--navy); background: var(--surface); border: 2px solid var(--navy); border-left: 4px solid var(--amber); padding: 7px 10px; min-height: 40px; }
.seg { display: inline-flex; border: 1px solid var(--navy); border-radius: 100px; overflow: hidden; }
.seg button { font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: .06em; text-transform: uppercase; padding: 9px 14px; min-height: 40px; background: var(--surface); color: var(--navy); border: none; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--navy); }
.seg button[aria-checked="true"] { background: var(--navy); color: var(--amber); font-weight: 700; }
.cal-count { margin-left: auto; font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: .06em; color: var(--amber-deep); text-transform: uppercase; }
.cal-wrap { overflow-x: auto; padding: 0 var(--sp-4); }
.cal { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.cal th, .cal td { border-bottom: 1px solid var(--line); }
.cal tbody tr:last-child > * { border-bottom: none; }
.cal thead th { position: sticky; top: 0; background: var(--navy); color: #B9C0D6; font-family: var(--font-mono); font-size: 10.5px; font-weight: 400; letter-spacing: .08em; text-transform: uppercase; padding: 10px 2px; }
.cal thead th:first-child { border-radius: 6px 0 0 0; text-align: left; padding-left: var(--sp-2); }
.cal thead th:last-child { border-radius: 0 6px 0 0; }
.cal thead th.now { color: var(--navy); background: var(--amber); font-weight: 700; }
.cal abbr { text-decoration: none; }
.cal .c-sp { width: 34%; text-align: left; }
.cal tbody th { padding: 0; font-weight: 400; }
.cal tbody th button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px var(--sp-2); background: none; border: none; text-align: left; cursor: pointer; }
.cal tbody th button:hover { background: #FBF8F1; }
.cal tbody th img { width: 34px; height: 34px; border-radius: 3px; object-fit: cover; flex-shrink: 0; border: 1px solid var(--line); }
.cal tbody th span { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.cal tbody th b { font-weight: 600; font-size: 13.5px; color: var(--navy); }
.cal tbody th i { font-size: 12px; color: var(--muted); }
.cal tbody tr.cur th button { background: var(--navy); }
.cal tbody tr.cur th b { color: #fff; } .cal tbody tr.cur th i { color: #B9C0D6; }
.cal td { padding: 0 2px; text-align: center; vertical-align: middle; }
.cal td.now { background: rgba(252, 163, 17, .1); }
.cal .bar { display: block; height: 14px; border-radius: 3px; background: #EDE8DC; }
.cal .bar.fl { background: var(--amber); }
.cal .bar.fr { background: var(--leaf); }
.cal .bar.fl.fr { background: linear-gradient(90deg, var(--amber) 50%, var(--leaf) 50%); }
.cal td.none { text-align: left; padding: 0 var(--sp-2); font-size: 12.5px; color: var(--muted); font-style: italic; }

/* size comparison */
.cmp-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); padding: var(--sp-3) var(--sp-4) var(--sp-2); }
.cmp-slot { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 2px solid var(--navy); border-left: 4px solid var(--amber); padding: 4px 10px; min-width: 0; }
.cmp-slot select { flex: 1; min-width: 0; border: none; background: transparent; font-family: var(--font-mono); font-size: 12.5px; color: var(--navy); min-height: 36px; cursor: pointer; }
.cmp-n { display: inline-grid; place-items: center; flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--navy); color: var(--amber); font-family: var(--font-mono); font-size: 11px; font-weight: 700; }
.cmp-body { display: grid; grid-template-columns: minmax(0, 1.618fr) minmax(0, 1fr); gap: var(--sp-3); padding: var(--sp-1) var(--sp-4) var(--sp-4); align-items: start; }
.viewer.cmp-view { aspect-ratio: 1.618 / 1; max-height: 68vh; min-height: 0; }
.cmp-table-wrap { overflow-x: auto; }
.cmp-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; font-size: 13.5px; }
.cmp-table thead th { background: var(--navy); color: #fff; text-align: left; vertical-align: top; padding: 10px; font-weight: 400; }
.cmp-table thead th:first-child { border-radius: 6px 0 0 0; } .cmp-table thead th:last-child { border-radius: 0 6px 0 0; }
.cmp-table thead th .cmp-n { background: var(--amber); color: var(--navy); margin-bottom: 6px; }
.cmp-table thead th b, .cmp-table thead th span[lang], .cmp-table thead th i { display: block; }
.cmp-table thead th b { font-weight: 600; }
.cmp-table thead th span[lang] { font-family: var(--font-khmer); color: var(--amber); font-size: 13px; line-height: 1.6; }
.cmp-table thead th i { color: #B9C0D6; font-size: 12px; }
.cmp-table tbody th { text-align: left; font-family: var(--font-mono); font-size: 10.5px; font-weight: 400; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 9px 10px; white-space: nowrap; }
.cmp-table tbody td { padding: 9px 10px; color: var(--navy); font-variant-numeric: tabular-nums; }
.cmp-table tbody td small { margin-left: 3px; font-family: var(--font-mono); font-size: 11px; color: var(--amber-deep); }
.cmp-table tbody tr + tr > * { border-top: 1px solid var(--line); }

@media (max-width: 980px) {
  .cmp-body { grid-template-columns: minmax(0, 1fr); }
  .cmp-pick { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .dlg, .dlg-wide { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .dlg-head { padding: max(var(--sp-2), env(safe-area-inset-top)) 16px calc(var(--sp-2) + 6px); background-position: left 16px bottom 0, 0 0; background-size: calc(100% - 32px) 6px, auto; }
  .dlg-head h2 { font-size: var(--fs-2); }
  .cal-bar, .cmp-pick { padding-left: 16px; padding-right: 16px; }
  .cal-wrap { padding: 0 16px; }
  .cal-count { margin-left: 0; flex-basis: 100%; }
  .cmp-body { padding: var(--sp-1) 16px var(--sp-3); }
  .viewer.cmp-view { aspect-ratio: 1 / 1; }
  .dlg-note { padding: var(--sp-2) 16px var(--sp-3); }
  .spec-tools { margin-top: var(--sp-1); }
}
noscript.seo-list ul { columns: 2; padding: 16px; }
/* the dialog header stays above the viewer buttons and table badges when the dialog scrolls */
.dlg-head { z-index: 40; }
.dlg .cmp-body, .dlg .cal-wrap { position: relative; z-index: 1; }
/* per-tree height in the size comparison */
.cmp-cell { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cmp-h { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 0 4px 0 6px; }
.cmp-h-lbl { font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.cmp-h output { font-family: var(--font-mono); font-size: 12.5px; font-weight: 700; color: var(--amber-deep); min-width: 52px; text-align: right; font-variant-numeric: tabular-nums; }
.cmp-h-reset { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--navy); cursor: pointer; font-size: 14px; line-height: 1; }
.cmp-h-reset:hover { border-color: var(--amber); }
@media (pointer: coarse) { .cmp-h-reset { width: 40px; height: 40px; } }

/* =========================================================
   UX pass: the model column fits the screen, roomier plates,
   tidy overlays, readable small text
   ========================================================= */

/* 1. Desktop: the pinned model column is exactly one screen tall; the tree takes whatever the
      measurements and controls leave, so the sliders and toggles are always in view */
@media (min-width: 1281px) and (min-height: 700px) {
  .viewer-col { height: calc(100vh - 20px); height: calc(100dvh - 20px); }
  .viewer-col .viewer.tree { flex: 1 1 auto; height: auto; min-height: 300px; max-height: none; aspect-ratio: auto; }
  .viewer-col .vctl { gap: 6px var(--sp-3); }
  .viewer-col .checks { gap: 0 var(--sp-3); }
  .viewer-col .checks .switch-row { min-height: 34px; }
}
@media (min-width: 1281px) and (max-height: 699px) {
  .viewer-col { position: static; }  /* too short to pin: let it scroll with the page */
}

/* 2. Leaf and fruit plates: square in the narrow text column, so the models have room */
@media (min-width: 1281px) {
  .info-col .viewer.seed { aspect-ratio: 1 / 1; }
}

/* 4. Overlays: let each viewer and gallery size its own controls */
.viewer, .rg-stage { container-type: inline-size; }
.vhint, .rg-hint { transition: opacity .2s; }
@media (hover: hover) {  /* hints show on hover, not on top of the model all the time */
  .viewer:not(:hover) .vhint, .rg-stage:not(:hover) .rg-hint { opacity: 0; }
}
@container (max-width: 560px) {
  .vbtn .t { display: none; }
  .vbtn { min-width: 34px; justify-content: center; }
  .vlabel { max-width: calc(100% - 110px); }
  .rg-hint { display: none; }
}
@container (max-width: 420px) {
  .viewer.seed .vhint { display: none; }
}
.vtools .vdone .t { display: inline; }
/* the "Tap to explore" pill sits high, clear of the trunk base, ruler and caption */
.viewer.touch .vgate { place-items: start center; padding: 62px 0 0; }
.viewer.touch.seed .vgate { padding-top: 66px; }

/* 5. Nothing below 12 px except the toggle's ON/OFF */
.months span { font-size: 11px; }
.legend { font-size: 12px; }
.km-key { font-size: 12px; }
.km-credit { font-size: 11px; opacity: 1; }
.km-tip { font-size: 12.5px; }
.rg-lic { font-size: 12px; }
.rg-hint, .vhint { font-size: 11.5px; }
.sp-total, .spec-pos { font-size: 12px; }
.sec-link { font-size: 11.8px; }
.cal thead th, .cmp-table tbody th { font-size: 11.5px; }
.stat .l { font-size: 11.8px; }

/* credits for calendar months taken from published sources */
.cal-src { margin-top: 8px; font-size: 12.5px; color: var(--muted); text-align: left; }
.cal-src a, .cal-sources a { color: var(--navy); text-decoration: underline; text-decoration-color: var(--amber); }
.cal-ref { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-right: 8px; border-radius: 50%; background: var(--amber); color: var(--navy); font-family: var(--font-mono); font-size: 11px; font-weight: 700; text-decoration: none; flex-shrink: 0; }
.cal tbody th { position: relative; }
.cal tbody th .cal-ref { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.cal-sources { padding: 0 var(--sp-4) var(--sp-4); font-size: 13px; color: var(--ink); }
.cal-sources h3 { font-size: var(--fs-1); margin-bottom: 6px; }
.cal-sources ol { padding-left: 22px; display: flex; flex-direction: column; gap: 4px; }
.cal-sources li { line-height: 1.5; }
.cal-sources li:target { background: rgba(252, 163, 17, .15); }
@media (max-width: 760px) { .cal-sources { padding: 0 16px var(--sp-3); } }
/* months that are only an estimate (borrowed from a related species) are striped, not solid */
.months i.est, .cal .bar.est, .est-key { background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .55) 0 3px, transparent 3px 7px); }
.est-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; background-color: var(--muted); }
.legend { flex-wrap: wrap; gap: 4px 14px; }
.legend span:not(:has(b)) { flex-basis: 100%; font-family: var(--font-body); letter-spacing: 0; font-size: 12.5px; }  /* notes run full width under the keys */
/* seed calendar legend */
.cal-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
.cal-legend > span { display: inline-flex; align-items: center; gap: 8px; }
.cal-legend .k { margin: 0; }
.cal-legend .k.est { background-color: var(--muted); background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .55) 0 3px, transparent 3px 7px); }
.cal-legend .cal-ref { margin: 0; }
.cal-legend p { flex-basis: 100%; margin: 0; }
