:root {
  --bg: #f6f5f1; --card: #fff; --ink: #1d2433; --muted: #5d6677; --line: #e3e1da; --soft: #efede7;
  --brand: #1c2f54; --brand-ink: #fff; --accent: #d9482f; --focus: #2f6fdb;
  --frog: #3f8f3a; --sal: #b8641e; --turtle: #227d78; --lizard: #a07a12; --snake: #6b4fa8;
  --E: #1f7a4d; --N: #4d6a8a; --I: #b23b2b;
  --CR: #c4200f; --EN: #e46a2b; --VU: #d9a400; --NT: #7da21f; --DD: #8b8b80; --LP: #7a62c4; --EX: #222; --EW: #4a2f4a;
  --radius: 14px; --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 4px 14px rgba(20, 30, 50, .06);
  --font: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", "Meiryo", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161f; --card: #1b212d; --ink: #e8eaf0; --muted: #a0a8b8; --line: #2c3442; --soft: #232a37;
    --brand: #22365f; --focus: #7aa7ff; --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg); }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; z-index: 100; background: var(--card); padding: 8px 12px; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
[hidden] { display: none !important; }
i, .sci { font-style: italic; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--brand); color: var(--brand-ink);
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px 16px; align-items: center;
  padding: 10px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
}
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; min-width: 0; }
.brand img { border-radius: 50%; }
.brand h1 { margin: 0; font-size: 18px; line-height: 1.15; white-space: nowrap; }
.brand .sub { margin: 0; font-size: 12px; opacity: .8; white-space: nowrap; }
.search { position: relative; display: flex; align-items: center; max-width: 560px; width: 100%; justify-self: center; }
.search svg { position: absolute; left: 12px; opacity: .7; }
.search input {
  width: 100%; padding: 9px 12px 9px 38px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .12); color: #fff; outline: none;
}
.search input::placeholder { color: rgba(255, 255, 255, .7); }
.search input:focus { background: #fff; color: var(--ink); }
.search input:focus::placeholder { color: #888; }
.search input:focus + svg, .search:focus-within svg { color: #555; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.seg { display: inline-flex; border-radius: 999px; padding: 2px; background: rgba(0, 0, 0, .08); }
.seg button { border: 0; background: transparent; padding: 5px 11px; border-radius: 999px; font-size: 13px; display: inline-flex; align-items: center; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.topbar .seg { background: rgba(255, 255, 255, .14); }
.topbar .seg button { color: #fff; }
.topbar .seg button[aria-pressed="true"] { background: #fff; color: var(--brand); }
.pill {
  display: inline-flex; align-items: center; gap: 5px; border: 1px solid rgba(255, 255, 255, .3); background: transparent;
  color: #fff; border-radius: 999px; padding: 5px 11px; font-size: 13px; white-space: nowrap;
}
.pill b { background: rgba(255, 255, 255, .2); border-radius: 999px; padding: 0 7px; font-size: 12px; }
.pill[aria-pressed="true"] { background: #fff; color: var(--brand); }
.pill[aria-pressed="true"] b { background: var(--brand); color: #fff; }
.icon-btn { border: 0; background: transparent; width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; color: inherit; }
.icon-btn:hover { background: rgba(127, 127, 127, .15); }
.menu { position: relative; }
.menu-panel {
  position: absolute; right: 0; top: 42px; min-width: 250px; background: var(--card); color: var(--ink);
  border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); padding: 6px; z-index: 30;
}
.menu-panel button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 8px; }
.menu-panel button:hover { background: var(--soft); }
.menu-panel hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.tabs { grid-column: 1 / -1; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs a {
  display: inline-flex; gap: 6px; align-items: center; padding: 8px 14px 10px; text-decoration: none; opacity: .75;
  border-bottom: 3px solid transparent; white-space: nowrap; font-size: 14px;
}
.tabs a[aria-current="page"] { opacity: 1; border-bottom-color: var(--accent); font-weight: 600; }
.tabs a:hover { opacity: 1; }
.offline-bar { background: #fff4d6; color: #5a4400; padding: 6px 16px; font-size: 13px; text-align: center; }

main { max-width: 1400px; margin: 0 auto; padding: 14px max(16px, env(safe-area-inset-right)) 60px max(16px, env(safe-area-inset-left)); }
.view.narrow { max-width: 760px; margin: 0 auto; }

/* Group chips */
.groups { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: thin; }
.gchip {
  flex: none; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 6px 14px 6px 6px; box-shadow: var(--shadow); font-size: 14px;
}
.gchip .gi { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--ink); }
.gchip .gi svg { width: 18px; height: 18px; }
.gchip b { font-weight: 600; color: var(--muted); font-size: 12px; }
.gchip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.gchip[aria-pressed="true"] b { color: inherit; opacity: .8; }
.groups.small .gchip { padding: 4px 10px 4px 4px; font-size: 13px; }
.groups.small .gchip .gi { width: 24px; height: 24px; }

/* Filter bar */
.filterbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0 10px; }
.sel {
  position: relative; display: inline-flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 0 10px; height: 36px;
}
.sel svg { width: 16px; height: 16px; color: var(--muted); }
.sel select { border: 0; background: transparent; outline: none; height: 34px; max-width: 220px; cursor: pointer; }
.sel select option { color: var(--ink); background: var(--card); }
.rl-dot { width: 12px; height: 12px; border-radius: 50%; background: conic-gradient(var(--CR) 0 25%, var(--EN) 0 50%, var(--VU) 0 75%, var(--NT) 0); }
.chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 0 12px; height: 36px; font-size: 14px;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; }
.result-head { display: flex; gap: 12px; align-items: baseline; margin: 2px 0 10px; }
.result-head p { margin: 0; color: var(--muted); font-size: 14px; }
.link { border: 0; background: none; color: var(--focus); padding: 0; text-decoration: underline; text-underline-offset: 2px; }

/* Results */
.results.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.card {
  position: relative; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  border: 1px solid var(--line); cursor: pointer; display: flex; flex-direction: column; transition: transform .12s, box-shadow .12s;
  text-align: left; padding: 0; color: inherit;
}
.card-link { display: flex; flex-direction: column; flex: 1; text-decoration: none; color: inherit; position: relative; }
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(20, 30, 50, .14); }
.card .ph { aspect-ratio: 4 / 3; background: var(--soft); position: relative; overflow: hidden; }
.card .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .ph .none { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.card .ph .none svg { width: 44px; height: 44px; opacity: .35; }
.card .tags { position: absolute; left: 8px; top: 8px; display: flex; gap: 4px; flex-wrap: wrap; right: 44px; }
.card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 1px; flex: 1; }
.card .n1 { font-weight: 650; font-size: 15.5px; line-height: 1.3; }
.card .n2 { color: var(--muted); font-size: 13px; }
.card .sci { color: var(--muted); font-size: 13px; }
.card .meta { margin-top: auto; padding-top: 6px; display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.card .gbar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; }
.found-tick {
  position: absolute; right: 8px; top: 8px; width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, .35); color: #fff; display: grid; place-items: center; backdrop-filter: blur(4px);
}
.found-tick[aria-pressed="true"] { background: var(--E); }
.found-tick svg { width: 16px; height: 16px; stroke-width: 3; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 650; line-height: 1; padding: 4px 7px;
  border-radius: 6px; color: #fff; letter-spacing: .01em; white-space: nowrap;
}
.badge svg { width: 12px; height: 12px; stroke-width: 2.4; }
.b-E { background: var(--E); } .b-N { background: var(--N); } .b-I { background: var(--I); }
.b-venom { background: #111; color: #ffd84d; } .b-marine { background: #1769aa; }
.rl { background: var(--DD); }
.rl-CR { background: var(--CR); } .rl-EN { background: var(--EN); } .rl-VU { background: var(--VU); color: #2a2100; }
.rl-NT { background: var(--NT); } .rl-DD { background: var(--DD); } .rl-LP { background: var(--LP); } .rl-EX, .rl-EW { background: var(--EX); }

/* List view */
.results.list { display: flex; flex-direction: column; background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; }
.row { text-decoration: none; display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); cursor: pointer; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; width: 100%; color: inherit; }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--soft); }
.row img, .row .noimg { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: var(--soft); display: block; }
.row .n1 { font-weight: 600; }
.row .n2 { color: var(--muted); font-size: 13px; }
.row .right { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.row .ftick { width: 22px; height: 22px; border-radius: 50%; background: var(--E); color: #fff; display: grid; place-items: center; }
.row .ftick svg { width: 13px; height: 13px; stroke-width: 3; }
.fam-head { padding: 10px 12px 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--soft); border-bottom: 1px solid var(--line); font-weight: 650; }
.results.grid .fam-head { grid-column: 1 / -1; background: none; border: 0; padding: 10px 2px 0; }
.empty { padding: 50px 20px; text-align: center; color: var(--muted); }

/* Species sheet */
.sheet { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: flex-end; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(10, 15, 25, .5); animation: fade .15s; }
.sheet-card {
  position: relative; width: min(860px, 100%); height: 100%; background: var(--bg); overflow-y: auto; outline: none;
  animation: slide .2s ease-out; box-shadow: -10px 0 40px rgba(0, 0, 0, .25);
}
@keyframes slide { from { transform: translateX(40px); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }
.sheet-bar { position: sticky; top: 0; z-index: 5; display: flex; gap: 4px; padding: 8px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.sp-body { padding: 0 0 50px; }
.gallery { background: #0d1117; }
.gallery .main { position: relative; aspect-ratio: 16 / 10; display: grid; place-items: center; overflow: hidden; }
.gallery .main img { max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: contain; }
.gallery .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 12px 8px; font-size: 11.5px; color: #ddd; background: linear-gradient(transparent, rgba(0, 0, 0, .7)); }
.gallery .cap a { color: #fff; }
.gallery .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .45); color: #fff; display: grid; place-items: center; }
.gallery .nav.l { left: 10px; } .gallery .nav.r { right: 10px; }
.thumbs { display: flex; gap: 6px; padding: 8px; overflow-x: auto; }
.thumbs button { flex: none; border: 2px solid transparent; padding: 0; border-radius: 8px; overflow: hidden; width: 64px; height: 64px; background: #222; opacity: .7; }
.thumbs button[aria-current="true"] { border-color: #fff; opacity: 1; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nophoto { aspect-ratio: 16 / 7; display: grid; place-items: center; color: var(--muted); background: var(--soft); }
.sp-head { padding: 18px 22px 6px; }
.sp-head .kicker { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.sp-head .kicker .gi { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.sp-head .kicker .gi svg { width: 14px; height: 14px; }
.sp-head h2 { margin: 6px 0 0; font-size: 28px; line-height: 1.2; }
.sp-head .alt { font-size: 17px; color: var(--muted); margin-top: 2px; }
.sp-head .sciline { margin-top: 4px; font-size: 16px; }
.sp-head .sciline .auth { font-style: normal; color: var(--muted); font-size: 14px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 4px; }
.badges .badge { font-size: 12.5px; padding: 6px 9px; }
.desig { background: var(--soft); color: var(--ink); border: 1px solid var(--line); }
.found-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 8px 15px; font-weight: 550; box-shadow: var(--shadow);
}
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.good { background: var(--E); color: #fff; border-color: var(--E); }
.found-row input { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 7px 10px; }
.found-row input[type="text"] { flex: 1; min-width: 160px; }
.warn {
  margin: 14px 22px 0; padding: 12px 14px; border-radius: 12px; display: flex; gap: 10px; align-items: flex-start;
  background: #fff1ee; color: #6b1607; border: 1px solid #f3c3b8; font-size: 14px;
}
.warn.mild { background: #fff8e0; color: #574000; border-color: #eedb9a; }
.warn svg { width: 22px; height: 22px; margin-top: 1px; }
@media (prefers-color-scheme: dark) {
  .warn { background: #3a1a14; color: #ffd4c9; border-color: #6b2f22; }
  .warn.mild { background: #3a3014; color: #ffe9a6; border-color: #6b5a22; }
}
.sp-sec { margin: 16px 22px 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.sp-sec h3 { margin: 0 0 10px; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.sp-sec h3 svg { color: var(--muted); }
.sp-sec p { margin: 0 0 8px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.two .sp-sec + .sp-sec { margin-left: 0; }
.reg-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.reg-chip { font-size: 12.5px; border-radius: 999px; padding: 3px 10px; border: 1px solid var(--line); color: var(--muted); background: var(--bg); }
.reg-chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.reg-chip.intro { border: 1.5px dashed var(--I); color: var(--I); background: var(--bg); }
@media (prefers-color-scheme: dark) { .reg-chip.on { background: #3d63a8; border-color: #3d63a8; } }
.sp-map { height: 340px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.layer-toggle { display: flex; gap: 14px; font-size: 13px; margin-top: 8px; color: var(--muted); }
.layer-toggle label { display: inline-flex; gap: 5px; align-items: center; }
.months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; align-items: end; height: 110px; }
.months .m { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 3px; font-size: 11px; color: var(--muted); }
.months .bar { width: 100%; border-radius: 4px 4px 0 0; background: var(--frog); min-height: 2px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.rel { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.rel button { flex: none; width: 120px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); padding: 0; overflow: hidden; text-align: left; }
.rel img, .rel .noimg { width: 100%; height: 80px; object-fit: cover; display: block; background: var(--soft); }
.rel span { display: block; padding: 5px 7px; font-size: 12.5px; line-height: 1.25; }
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.links a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--soft); text-decoration: none; font-size: 13.5px; }
.wiki-src { font-size: 12.5px; color: var(--muted); }
.note-text { font-size: 14px; }

/* Map view */
.map-layout { display: grid; grid-template-columns: 300px 1fr; gap: 16px; height: calc(100vh - 150px); min-height: 520px; }
.map-side { display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.map-side .muted { margin: 0; font-size: 14px; }
.map-side .groups { flex-wrap: wrap; overflow: visible; }
.region-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.region-list li button { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 8px; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 9px 12px; }
.region-list li button[aria-pressed="true"] { background: var(--soft); font-weight: 650; }
.region-list .cnt { font-variant-numeric: tabular-nums; color: var(--muted); }
.region-list .bar { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: var(--soft); overflow: hidden; }
.region-list .bar i { display: block; height: 100%; background: var(--brand); }
@media (prefers-color-scheme: dark) { .region-list .bar i { background: #5d86d6; } }
.map-main { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.jp-map { position: absolute; inset: 0; }
.region-panel {
  position: absolute; right: 12px; top: 12px; bottom: 12px; width: min(360px, calc(100% - 24px)); z-index: 500;
  background: var(--card); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); display: flex; flex-direction: column; overflow: hidden;
}
.region-panel header { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.region-panel header h3 { margin: 0; font-size: 16px; flex: 1; }
.region-panel .rp-list { overflow-y: auto; flex: 1; }
.region-panel .row { grid-template-columns: 44px 1fr; row-gap: 4px; }
.region-panel .row .right { grid-column: 2; justify-content: flex-start; }
.region-panel .row img, .region-panel .row .noimg { width: 44px; height: 44px; }
.region-panel footer { padding: 10px 14px; border-top: 1px solid var(--line); }
.rmark { background: var(--brand); color: #fff; border-radius: 999px; font-weight: 700; font-size: 12px; display: grid; place-items: center; border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
.rmark.sel { background: var(--accent); }
.leaflet-container { font: inherit; background: #aad3df; }
/* Leaflet draws its vector layers in an <svg> sized by attributes: undo the icon defaults above. */
.leaflet-pane svg { width: auto; height: auto; fill: initial; stroke: initial; stroke-width: initial; }

/* Quiz */
.quiz-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.quiz-card .qhead { padding: 18px 20px 10px; }
.quiz-card h2 { margin: 0 0 4px; }
.quiz-opts { display: grid; gap: 12px; padding: 0 20px 20px; }
.quiz-opts .row2 { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.quiz-opts label.lbl { font-size: 13px; color: var(--muted); min-width: 90px; }
.quiz-photo { position: relative; background: #0d1117; height: min(52vh, 460px); display: grid; place-items: center; }
.quiz-photo img { width: 100%; height: 100%; object-fit: contain; }
.quiz-photo .cap { position: absolute; bottom: 6px; left: 10px; right: 10px; color: #bbb; font-size: 11px; }
.quiz-score { display: flex; gap: 16px; padding: 12px 20px; font-size: 14px; color: var(--muted); border-bottom: 1px solid var(--line); }
.quiz-score b { color: var(--ink); }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 16px 20px; }
.answers button {
  border: 1.5px solid var(--line); background: var(--bg); border-radius: 12px; padding: 12px 14px; text-align: left; min-height: 64px;
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
}
.answers button:hover:not(:disabled) { border-color: var(--focus); }
.answers button small { color: var(--muted); font-style: italic; }
.answers button.right { border-color: var(--E); background: color-mix(in srgb, var(--E) 14%, var(--bg)); }
.answers button.wrong { border-color: var(--I); background: color-mix(in srgb, var(--I) 12%, var(--bg)); }
.answers button:disabled { cursor: default; }
.feedback { padding: 0 20px 18px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.feedback p { margin: 0; flex: 1; font-weight: 600; }

/* Stats */
.stats-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 30px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13.5px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 16px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.panel h3 { margin: 0 0 12px; font-size: 15px; }
.hbar { display: grid; grid-template-columns: 150px 1fr 44px; gap: 8px; align-items: center; margin: 7px 0; font-size: 13.5px; }
.hbar .track { height: 18px; border-radius: 5px; background: var(--soft); overflow: hidden; display: flex; }
.hbar .track i { display: block; height: 100%; }
.hbar .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.hbar button { border: 0; background: none; padding: 0; text-align: left; color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.legend span { display: inline-flex; gap: 5px; align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.prog { margin: 8px 0; }
.prog .lab { display: flex; justify-content: space-between; font-size: 13.5px; }
.prog .track { height: 10px; border-radius: 6px; background: var(--soft); overflow: hidden; margin-top: 3px; }
.prog .track i { display: block; height: 100%; background: var(--E); }

/* Dialog & toast */
.dlg { border: 0; border-radius: 16px; padding: 22px 24px; max-width: 680px; width: calc(100% - 24px); background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.dlg::backdrop { background: rgba(10, 15, 25, .55); }
.dlg-x { float: right; margin: -8px -10px 0 0; }
.dlg h2 { margin-top: 0; }
.dlg li { margin: 4px 0; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; z-index: 90; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); font-size: 14px; }

/* Responsive */
@media (max-width: 900px) {
  .topbar { grid-template-columns: 1fr auto; }
  .search { grid-column: 1 / -1; grid-row: 2; max-width: none; }
  .tabs { grid-row: 3; }
  .brand .sub { display: none; }
  .map-layout { grid-template-columns: 1fr; height: auto; }
  .map-side { order: 2; }
  .map-main { order: 1; height: 62vh; min-height: 380px; }
  .region-list { max-height: 360px; }
  .two { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  body { font-size: 14.5px; }
  .brand h1 { font-size: 16px; }
  .brand img { width: 32px; height: 32px; }
  .pill span { display: none; }
  .results.grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card .body { padding: 8px 9px 10px; }
  .card .n1 { font-size: 14px; }
  .card .meta { display: none; }
  .sheet-card { width: 100%; }
  .sp-head { padding: 14px 16px 4px; }
  .sp-head h2 { font-size: 23px; }
  .sp-sec, .warn { margin-left: 12px; margin-right: 12px; }
  .answers { grid-template-columns: 1fr; }
  .hbar { grid-template-columns: 110px 1fr 36px; }
  .sel select { max-width: 150px; }
  .tabs a { padding: 8px 10px 10px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (max-width: 480px) { .brand > div { display: none; } }
