/* Layout concept: a walk round the balustrade. The story reads as one continuous
   frieze of stone panels, broken only by kāṇḍa thresholds; each panel sits on a
   thin "course line" like the joints between andesite blocks. */

@font-face { font-family: "Tiro Devanagari Sanskrit"; font-weight: 400; font-display: swap;
  src: url(fonts/tiro-devanagari-sanskrit-latin-400-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Tiro Devanagari Sanskrit"; font-weight: 400; font-display: swap;
  src: url(fonts/tiro-devanagari-sanskrit-latin-ext-400-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Tiro Devanagari Sanskrit"; font-weight: 400; font-display: swap;
  src: url(fonts/tiro-devanagari-sanskrit-devanagari-400-normal.woff2) format("woff2");
  unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20A8, U+20B9, U+25CC, U+A830-A839, U+A8E0-A8FF; }
@font-face { font-family: "Alegreya"; font-weight: 400; font-display: swap; src: url(fonts/alegreya-latin-400-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Alegreya"; font-weight: 400; font-display: swap; src: url(fonts/alegreya-latin-ext-400-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Alegreya"; font-weight: 400; font-style: italic; font-display: swap; src: url(fonts/alegreya-latin-400-italic.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Alegreya"; font-weight: 400; font-style: italic; font-display: swap; src: url(fonts/alegreya-latin-ext-400-italic.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Alegreya"; font-weight: 700; font-display: swap; src: url(fonts/alegreya-latin-700-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Alegreya"; font-weight: 700; font-display: swap; src: url(fonts/alegreya-latin-ext-700-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Alegreya Sans"; font-weight: 400; font-display: swap; src: url(fonts/alegreya-sans-latin-400-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Alegreya Sans"; font-weight: 400; font-display: swap; src: url(fonts/alegreya-sans-latin-ext-400-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Alegreya Sans"; font-weight: 500; font-display: swap; src: url(fonts/alegreya-sans-latin-500-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Alegreya Sans"; font-weight: 500; font-display: swap; src: url(fonts/alegreya-sans-latin-ext-500-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Alegreya Sans"; font-weight: 700; font-display: swap; src: url(fonts/alegreya-sans-latin-700-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Alegreya Sans"; font-weight: 700; font-display: swap; src: url(fonts/alegreya-sans-latin-ext-700-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  /* Colour: andesite stone, batik indigo, soga brown */
  --ground: #E7E8E2;
  --surface: #F4F4F0;
  --sunk: #D9DCD3;
  --ink: #1D2320;
  --ink-2: #505A54;
  --line: #C3C8BE;
  --indigo: #2B3D78;
  --on-indigo: #F4F4F0;
  --soga: #87521F;
  --good: #2F6B3F;
  --warn: #8A6414;
  --shade: rgba(20, 24, 22, .55);
  /* Type */
  --f-display: "Tiro Devanagari Sanskrit", "Noto Serif", "Iowan Old Style", Georgia, serif;
  --f-body: "Alegreya", "Noto Serif", "Iowan Old Style", Georgia, serif;
  --f-ui: "Alegreya Sans", "Noto Sans", "Segoe UI", system-ui, sans-serif;
  --step--1: .875rem; --step-0: 1.0625rem; --step-1: 1.25rem; --step-2: 1.6rem; --step-3: 2.1rem; --step-4: 2.9rem;
  --gutter: 16px;
  --measure: 66ch;
  --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #121513; --surface: #1A1E1B; --sunk: #242925; --ink: #E4E5DE; --ink-2: #A2ABA4;
    --line: #333A35; --indigo: #A9B5EC; --on-indigo: #121522; --soga: #D8A169; --good: #7FC08F; --warn: #E2BB62;
    --shade: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #121513; --surface: #1A1E1B; --sunk: #242925; --ink: #E4E5DE; --ink-2: #A2ABA4;
  --line: #333A35; --indigo: #A9B5EC; --on-indigo: #121522; --soga: #D8A169; --good: #7FC08F; --warn: #E2BB62;
  --shade: rgba(0, 0, 0, .6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: var(--f-body); font-size: var(--step-0); line-height: 1.55;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
}
img { max-width: 100%; display: block; }
a { color: var(--indigo); text-underline-offset: .18em; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; border-radius: 3px; }
[hidden] { display: none !important; }
.wrap { max-width: 1080px; margin-inline: auto; padding-inline: var(--gutter); }
.prose { max-width: var(--measure); }
.prose p { margin: 0 0 .9em; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 400; line-height: 1.15; text-wrap: balance; margin: 0; }
h1 { font-size: var(--step-4); letter-spacing: -.005em; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); }
@media (max-width: 599px) { h2 { font-size: var(--step-2); } }
.dev { font-family: var(--f-display); }
.eyebrow {
  font-family: var(--f-ui); font-size: var(--step--1); letter-spacing: .09em; text-transform: uppercase;
  color: var(--soga); font-weight: 500;
}
.muted { color: var(--ink-2); }
.ui { font-family: var(--f-ui); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--ground) 88%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar .wrap { display: flex; align-items: center; gap: 12px; min-height: 54px; }
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand b { font-family: var(--f-display); font-weight: 400; font-size: 1.45rem; }
.brand span { font-family: var(--f-ui); font-size: var(--step--1); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.iconbtn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; height: 36px; min-width: 36px;
  display: inline-grid; place-items: center; cursor: pointer; padding: 0 10px; font-family: var(--f-ui); font-size: var(--step--1);
  color: var(--ink);
}
.iconbtn svg { width: 18px; height: 18px; }
.topnav { display: none; gap: 2px; }
.topnav a {
  font-family: var(--f-ui); text-decoration: none; color: var(--ink-2); padding: 8px 10px; border-radius: 6px; font-weight: 500;
}
.topnav a[aria-current="page"] { color: var(--ink); background: var(--sunk); }

/* ---------- bottom nav (phones) ---------- */
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: grid; grid-template-columns: repeat(5, 1fr);
}
.tabbar a {
  height: var(--nav-h); display: grid; place-items: center; align-content: center; gap: 3px; text-decoration: none;
  color: var(--ink-2); font-family: var(--f-ui); font-size: .78rem; font-weight: 500;
}
.tabbar svg { width: 22px; height: 22px; }
.tabbar a[aria-current="page"] { color: var(--indigo); }
@media (min-width: 860px) {
  .topnav { display: flex; }
  .tabbar { display: none; }
  body { padding-bottom: 0; }
}

main { padding-block: 20px 56px; min-height: 60vh; }
.section { margin-top: 44px; }
.section > h2 { margin-bottom: 14px; }
.sectionhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 10px 18px;
  font-family: var(--f-ui); font-weight: 500; text-decoration: none; cursor: pointer; border: 1px solid transparent;
  background: var(--indigo); color: var(--on-indigo);
}
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn svg { width: 18px; height: 18px; }
.btnrow { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- home ---------- */
.hero { position: relative; margin-inline: calc(-1 * var(--gutter)); overflow: hidden; }
.hero img { width: 100%; aspect-ratio: 16 / 9; max-height: 62vh; object-fit: cover; object-position: 50% 40%; }
.hero .cap {
  position: absolute; inset: auto 0 0 0; padding: 60px var(--gutter) 22px;
  background: linear-gradient(to top, rgba(10,12,11,.82), rgba(10,12,11,0));
  color: #F2F1EA;
}
.hero .cap h1 { color: #F7F6F0; }
.hero .cap .dev { font-size: 1.25rem; opacity: .9; }
.hero .cap p { margin: 6px 0 0; font-family: var(--f-ui); max-width: 52ch; opacity: .92; }
@media (min-width: 860px) { .hero { margin-inline: 0; border-radius: 4px; } }
@media (max-width: 599px) {
  .hero img { aspect-ratio: 4 / 3; }
  .hero .cap h1 { font-size: 2.15rem; }
  .hero .cap .dev { font-size: 1.05rem; }
  .hero .cap p { font-size: .95rem; }
}
.intro { display: grid; gap: 24px; margin-top: 24px; }
@media (min-width: 860px) { .intro { grid-template-columns: 1.4fr 1fr; align-items: start; } }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.facts div { background: var(--surface); padding: 12px 14px; }
.facts b { display: block; font-family: var(--f-display); font-weight: 400; font-size: var(--step-2); font-variant-numeric: tabular-nums; }
.facts span { font-family: var(--f-ui); font-size: var(--step--1); color: var(--ink-2); }

/* frieze: horizontal walk past all panels */
.frieze { display: flex; gap: 6px; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 8px; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); }
.frieze a { flex: 0 0 auto; scroll-snap-align: start; text-decoration: none; color: var(--ink); width: 210px; }
.frieze img { height: 104px; width: 210px; object-fit: cover; background: var(--sunk); border-bottom: 3px solid var(--line); }
.frieze small { display: block; font-family: var(--f-ui); font-size: .8rem; color: var(--ink-2); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 18px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.card h3 { font-size: var(--step-1); }
@media (max-width: 599px) { h2 { font-size: var(--step-2); } }
.card p { margin: 0; }
.pill { display: inline-block; font-family: var(--f-ui); font-size: .78rem; font-weight: 500; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); justify-self: start; }
.pill.live { color: var(--good); border-color: currentColor; }
.pill.soon { color: var(--warn); border-color: currentColor; }

/* ---------- story list ---------- */
.kchips { position: sticky; top: calc(55px + env(safe-area-inset-top, 0px)); z-index: 20; background: var(--ground); padding-block: 10px; display: flex; gap: 6px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); }
.chip {
  flex: 0 0 auto; font-family: var(--f-ui); font-size: .9rem; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--indigo); color: var(--on-indigo); border-color: var(--indigo); }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-family: var(--f-ui); font-size: .95rem; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--indigo); }
.kanda { margin-top: 34px; scroll-margin-top: 120px; }
.kanda header { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding-bottom: 8px; border-bottom: 2px solid var(--ink); margin-bottom: 4px; }
.kanda header h2 { font-size: var(--step-2); }
.kanda header .dev { color: var(--soga); font-size: 1.1rem; }
.kanda header .muted { font-family: var(--f-ui); font-size: var(--step--1); margin-left: auto; }
.ep {
  display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 14px; padding-block: 12px; border-bottom: 1px solid var(--line);
  text-decoration: none; color: var(--ink); align-items: start;
}
.ep:hover h3 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }
.ep .thumb { width: 132px; aspect-ratio: 2 / 1; object-fit: cover; background: var(--sunk); }
.ep .ph {
  width: 132px; aspect-ratio: 2 / 1; display: grid; place-items: center; text-align: center; padding: 6px;
  background: repeating-linear-gradient(0deg, var(--sunk) 0 15px, var(--line) 15px 16px), var(--sunk);
  color: var(--ink-2); font-family: var(--f-ui); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase;
}
.ep.text .ph { background: transparent; border: 1px dashed var(--line); }
.ep h3 { font-size: 1.15rem; margin-top: 2px; }
.ep p { margin: 4px 0 0; color: var(--ink-2); font-size: .97rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { font-family: var(--f-ui); font-size: .8rem; letter-spacing: .05em; text-transform: uppercase; color: var(--soga); font-weight: 500; }
.meta.text { color: var(--ink-2); }
@media (min-width: 640px) {
  .ep { grid-template-columns: 220px minmax(0, 1fr); gap: 18px; }
  .ep .thumb, .ep .ph { width: 220px; }
}

/* ---------- episode detail ---------- */
.crumbs { font-family: var(--f-ui); font-size: .92rem; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs a { color: var(--ink-2); }
.epi-head { margin-top: 14px; display: grid; gap: 6px; }
.epi-head h1 { font-size: var(--step-3); }
.figure { margin: 18px calc(-1 * var(--gutter)) 0; position: relative; background: #0E100F; touch-action: pan-y; }
.figure img { width: 100%; max-height: 70vh; object-fit: contain; cursor: zoom-in; }
.figure .zoomhint {
  position: absolute; right: 10px; bottom: 10px; background: rgba(10,12,11,.7); color: #F2F1EA; border: 0;
  font-family: var(--f-ui); font-size: .85rem; padding: 6px 12px; border-radius: 999px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center;
}
.figure .zoomhint svg { width: 16px; height: 16px; }
@media (min-width: 860px) { .figure { margin-inline: 0; } }
.nophoto {
  margin-top: 18px; padding: 26px 20px; border: 1px dashed var(--line); text-align: center; color: var(--ink-2);
  font-family: var(--f-ui); display: grid; gap: 6px; justify-items: center;
  background: var(--surface);
}
.nophoto b { font-family: var(--f-display); font-weight: 400; color: var(--ink); font-size: var(--step-1); }
.credit { font-family: var(--f-ui); font-size: .8rem; color: var(--ink-2); margin-top: 6px; }
.epi-body { display: grid; gap: 28px; margin-top: 24px; }
@media (min-width: 900px) { .epi-body { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 40px; } }
.epi-body h2 { font-size: var(--step-1); margin-bottom: 8px; }
.seen { border-left: 3px solid var(--soga); padding-left: 14px; }
.notes { background: var(--surface); border: 1px solid var(--line); padding: 16px 18px; border-radius: 4px; }
.notes p:last-child { margin-bottom: 0; }
.charlist { display: flex; flex-wrap: wrap; gap: 6px; }
.charlist button { display: inline-flex; gap: 6px; align-items: baseline; }
.charlist .dev { font-size: .9rem; color: var(--ink-2); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 36px; border-top: 1px solid var(--line); padding-top: 14px; }
.pager a { text-decoration: none; color: var(--ink); padding: 10px 0; display: grid; gap: 2px; min-width: 0; }
.pager a.next { text-align: right; }
.pager small { font-family: var(--f-ui); color: var(--ink-2); font-size: .82rem; }
.pager span { font-family: var(--f-display); font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; }

/* zoom viewer */
.viewer { position: fixed; inset: 0; z-index: 60; background: #0B0D0C; display: grid; touch-action: none; }
.viewer img { position: absolute; left: 0; top: 0; transform-origin: 0 0; max-width: none; user-select: none; -webkit-user-drag: none; }
.viewer .vbar { position: absolute; top: env(safe-area-inset-top, 0px); right: 0; left: 0; display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; z-index: 2; color: #E9E8E1; font-family: var(--f-ui); gap: 10px; }
.viewer .vbar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer button { background: rgba(255,255,255,.12); color: #F2F1EA; border: 0; border-radius: 999px; height: 38px; min-width: 38px; padding: 0 12px; cursor: pointer; }

/* ---------- search ---------- */
.searchbox { display: flex; gap: 8px; margin-top: 14px; }
.searchbox input {
  flex: 1; min-width: 0; height: 50px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface);
  padding: 0 14px; font-family: var(--f-ui); font-size: 1.08rem;
}
.searchbox input:focus { outline: 2px solid var(--indigo); outline-offset: 0; }
.hints { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.resultsinfo { font-family: var(--f-ui); color: var(--ink-2); margin-top: 18px; font-size: .95rem; }
mark { background: color-mix(in srgb, var(--soga) 28%, transparent); color: inherit; padding: 0 1px; border-radius: 2px; }
.charfilter { margin-top: 18px; }
.charfilter summary { cursor: pointer; font-family: var(--f-ui); font-weight: 500; }
.charfilter .hints { margin-top: 10px; }

/* ---------- identify ---------- */
.idgrid { display: grid; gap: 22px; margin-top: 18px; }
@media (min-width: 860px) { .idgrid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: start; } }
.drop {
  border: 2px dashed var(--line); border-radius: 6px; padding: 26px 18px; display: grid; gap: 12px; justify-items: center; text-align: center;
  background: var(--surface);
}
.drop.over { border-color: var(--indigo); }
.drop svg { width: 40px; height: 40px; color: var(--indigo); }
.drop input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.status { font-family: var(--f-ui); display: grid; gap: 8px; }
.bar { height: 6px; background: var(--sunk); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--indigo); transition: width .2s; }
.querypic { max-height: 260px; width: auto; margin-inline: auto; border: 1px solid var(--line); }
.match { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); align-items: start; }
.match img { width: 150px; aspect-ratio: 2/1; object-fit: cover; }
.match h3 { font-size: 1.12rem; }
.conf { font-family: var(--f-ui); font-size: .85rem; font-weight: 500; }
.conf.strong { color: var(--good); }
.conf.possible { color: var(--warn); }
.conf.weak { color: var(--ink-2); }
.tips { font-size: .97rem; }
.tips li { margin-bottom: 4px; }

/* ---------- site / history / visit ---------- */
.photos { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .photos { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.photos figure { margin: 0; }
.photos img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; cursor: zoom-in; }
.photos figcaption { font-family: var(--f-ui); font-size: .9rem; color: var(--ink-2); margin-top: 6px; }
.plan { background: var(--surface); border: 1px solid var(--line); padding: 14px; overflow-x: auto; }
.plan svg { width: 100%; max-width: 560px; height: auto; display: block; margin-inline: auto; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.timeline li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; padding: 8px 0 8px 16px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 16px; width: 10px; height: 10px; background: var(--ground); border: 2px solid var(--soga); border-radius: 50%; }
.timeline b { font-family: var(--f-display); font-weight: 400; font-variant-numeric: tabular-nums; color: var(--soga); }
@media (max-width: 480px) { .timeline li { grid-template-columns: 1fr; gap: 0; } }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.routes { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.routes div { background: var(--surface); padding: 14px 16px; display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 14px; }
.routes b { font-family: var(--f-ui); font-weight: 700; }
@media (max-width: 560px) { .routes div { grid-template-columns: 1fr; gap: 4px; } }
.nearby { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.nearby div { border-top: 2px solid var(--ink); padding-top: 8px; }
.nearby b { font-family: var(--f-display); font-weight: 400; font-size: 1.12rem; }
.nearby p { margin: 4px 0 0; color: var(--ink-2); font-size: .97rem; }
.sources li { margin-bottom: 6px; }
.copy { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; background: var(--sunk); padding: 1px 5px; border-radius: 3px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--ink); color: var(--ground); font-family: var(--f-ui); padding: 10px 16px; border-radius: 999px; z-index: 70; max-width: calc(100% - 32px);
}
@media (min-width: 860px) { .toast { bottom: 24px; } }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
