/* ===== fonts (self-hosted: Google Fonts is unreliable in mainland China) ===== */
@font-face { font-family: "Fraunces"; src: url(fonts/fraunces-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; 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: "Fraunces"; src: url(fonts/fraunces-latin-ext-400-normal.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1E00-1E9F,U+A720-A7FF; }
@font-face { font-family: "Fraunces"; src: url(fonts/fraunces-latin-400-italic.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; unicode-range: U+0000-00FF,U+2000-206F; }
@font-face { font-family: "Fraunces"; src: url(fonts/fraunces-latin-ext-400-italic.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; unicode-range: U+0100-02BA,U+02BD-02FF,U+1E00-1E9F; }
@font-face { font-family: "Fraunces"; src: url(fonts/fraunces-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-style: normal; font-display: swap; unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+2000-206F,U+20AC; }
@font-face { font-family: "Fraunces"; src: url(fonts/fraunces-latin-ext-600-normal.woff2) format("woff2"); font-weight: 600; font-style: normal; font-display: swap; unicode-range: U+0100-02BA,U+02BD-02FF,U+1E00-1E9F; }
@font-face { font-family: "Nunito Sans"; src: url(fonts/nunito-sans-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+2000-206F,U+20AC,U+2122; }
@font-face { font-family: "Nunito Sans"; src: url(fonts/nunito-sans-latin-ext-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0100-02BA,U+02BD-02FF,U+1E00-1E9F; }
@font-face { font-family: "Nunito Sans"; src: url(fonts/nunito-sans-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+2000-206F,U+20AC,U+2122; }
@font-face { font-family: "Nunito Sans"; src: url(fonts/nunito-sans-latin-ext-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0100-02BA,U+02BD-02FF,U+1E00-1E9F; }

/* ===== tokens ===== */
:root {
  --paper: var(--t-paper, #fbf6ee);
  --paper-2: color-mix(in srgb, var(--paper) 88%, var(--gold) 12%);
  --card: color-mix(in srgb, var(--paper) 55%, #fff 45%);
  --ink: var(--t-ink, #2a1f1c);
  --muted: var(--t-muted, #7a6a62);
  --accent: var(--t-accent, #b3261e);
  --accent2: var(--t-accent2, #1f6f8b);
  --gold: var(--t-gold, #b8892b);
  --line: color-mix(in srgb, var(--ink) 13%, transparent);
  --radius: 14px;
  --font-display: var(--font-display-custom, "Fraunces"), "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", Georgia, serif;
  --font-body: var(--font-body-custom, "Nunito Sans"), "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --tab-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1a1412; --card: #241c19; --ink: #f3ebe3; --muted: #b3a49b;
    --accent: #f07a6e; --accent2: #72bcd4; --gold: #dcb462;
    --line: rgba(243,235,227,.14); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #1a1412; --card: #241c19; --ink: #f3ebe3; --muted: #b3a49b;
  --accent: #f07a6e; --accent2: #72bcd4; --gold: #dcb462; --line: rgba(243,235,227,.14); color-scheme: dark;
}

/* ===== base ===== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.6 var(--font-body);
  background-image: radial-gradient(circle at 20% 0%, color-mix(in srgb, var(--gold) 10%, transparent), transparent 40%), radial-gradient(circle at 100% 30%, color-mix(in srgb, var(--accent2) 7%, transparent), transparent 35%);
  background-attachment: fixed;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
}
:lang(zh) body, html:lang(zh-CN) body { line-height: 1.75; }
img { max-width: 100%; display: block; }
a { color: var(--accent2); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
main { max-width: 780px; margin: 0 auto; padding: 8px 16px 40px; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; margin: 0; text-wrap: balance; }
p { margin: 0; }
section { margin-top: 32px; }
.eyebrow { font-family: var(--font-body); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 10px; }
.page-title { font-size: clamp(28px, 6vw, 40px); margin-top: 20px; }
.lede { color: var(--muted); margin-top: 6px; max-width: 60ch; }
.note { color: var(--muted); font-size: 13px; margin-top: 16px; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }
.banner { background: var(--paper-2); border-bottom: 1px solid var(--line); text-align: center; font-size: 13px; padding: 6px 16px; }
.banner-demo { background: color-mix(in srgb, var(--accent2) 14%, var(--paper)); }
.banner.soft { border: 1px dashed var(--line); border-radius: 10px; margin-top: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 14px; }

/* ===== header & nav ===== */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.seal { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: #fff6ec; font-family: "Songti SC", "STSong", "Noto Serif SC", serif; font-size: 20px; transform: rotate(-5deg); box-shadow: inset 0 0 0 2px color-mix(in srgb, #fff 25%, transparent); flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-desk { display: none; gap: 4px; margin-left: auto; }
.langs { display: flex; margin-left: auto; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: var(--card); flex: none; }
.lang-btn { border: 0; background: none; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; min-width: 40px; }
.lang-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.nav-link { display: flex; align-items: center; gap: 6px; text-decoration: none; color: var(--muted); font-size: 14px; font-weight: 700; padding: 6px 10px; border-radius: 999px; }
.nav-link[aria-current="page"] { color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.sm { width: 15px; height: 15px; }
.tabbar { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
.tabbar .nav-link { flex-direction: column; justify-content: center; gap: 2px; font-size: 11px; border-radius: 0; padding: 4px 2px; text-align: center; line-height: 1.2; }
.tabbar .nav-link[aria-current="page"] { background: none; }
.tabbar .nav-link span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
@media (min-width: 860px) {
  .nav-desk { display: flex; }
  .langs { margin-left: 8px; }
  .tabbar { display: none; }
  body { padding-bottom: 0; }
  .nav-desk .ic { display: none; }
}

/* ===== footer ===== */
.foot { text-align: center; color: var(--muted); font-size: 14px; padding: 24px 16px 40px; max-width: 780px; margin: 0 auto; }
.foot .wave { width: 100%; height: 24px; fill: none; stroke: var(--gold); stroke-width: 1.4; opacity: .7; margin-bottom: 14px; }
.foot-small { font-size: 12.5px; margin-top: 6px; }

/* ===== home ===== */
.hero { text-align: center; padding: 40px 0 8px; margin-top: 0; position: relative; }
.hero-seal { width: 92px; height: 92px; margin: 0 auto 18px; display: grid; place-items: center; background: var(--accent); color: #fff6ec; border-radius: 22px; font-size: 56px; font-family: "Songti SC", "STSong", "Noto Serif SC", serif; transform: rotate(-6deg); box-shadow: 0 10px 30px -12px color-mix(in srgb, var(--accent) 70%, transparent), inset 0 0 0 4px color-mix(in srgb, #fff 22%, transparent); }
.hero-date { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.hero-title { font-size: clamp(44px, 12vw, 76px); font-style: italic; font-weight: 400; margin-top: 6px; letter-spacing: -0.01em; }
.hero-count { display: inline-block; margin-top: 14px; padding: 4px 14px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); color: var(--accent); font-weight: 700; font-size: 14px; }
.hero-intro { max-width: 46ch; margin: 16px auto 0; color: var(--muted); }

.find { background: var(--card); border: 1.5px solid color-mix(in srgb, var(--gold) 55%, transparent); border-radius: calc(var(--radius) + 4px); padding: 20px; box-shadow: 0 14px 40px -28px color-mix(in srgb, var(--ink) 60%, transparent); }
.find.compact { margin-top: 18px; }
.find-title { display: block; font-family: var(--font-display); font-weight: 600; font-size: 22px; }
.find-hint { color: var(--muted); font-size: 14px; margin-top: 2px; }
.find input { width: 100%; margin-top: 12px; padding: 14px 16px; font-size: 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); }
.find-results { list-style: none; margin: 8px 0 0; padding: 0; }
.find-results a { display: flex; align-items: center; gap: 12px; padding: 10px 6px; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line); }
.find-results a:hover { background: var(--paper-2); }
.find-results small { display: block; color: var(--muted); font-size: 12.5px; }
.find-results .none { color: var(--muted); padding: 10px 6px; font-size: 14px; }
.dot { width: 14px; height: 14px; border-radius: 50%; flex: none; display: inline-block; }

.av { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: none; }
.av.sm { width: 36px; height: 36px; }
.av.lg { width: 76px; height: 76px; }
.av.mono { display: grid; place-items: center; background: color-mix(in srgb, var(--accent2) 18%, var(--paper)); color: var(--accent2); font-family: var(--font-display); font-weight: 600; font-size: 22px; }
.av.sm.mono { font-size: 16px; }
.av.lg.mono { color: #fff; font-size: 32px; }

.nownext .mini { list-style: none; padding: 0; margin: 0 0 14px; }
.mini li { display: flex; gap: 12px; padding: 6px 0 6px 12px; border-left: 3px solid var(--c); margin-bottom: 4px; }
.mini .mt { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 46px; }
.mini small { color: var(--muted); }
.more { font-weight: 700; text-decoration: none; }
.anns .ann { background: color-mix(in srgb, var(--accent) 8%, var(--card)); border-left: 4px solid var(--accent); padding: 12px 14px; border-radius: 10px; margin-bottom: 8px; }
.keydates { list-style: none; padding: 0; margin: 0; }
.keydates li { display: grid; grid-template-columns: 82px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.kd-date { font-family: var(--font-display); color: var(--accent); font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 16px; min-height: 120px; border-radius: var(--radius); text-decoration: none; color: var(--ink); border: 1px solid var(--line); background: var(--card); transition: transform .15s ease; }
.tile:hover { transform: translateY(-2px); }
.tile strong { font-family: var(--font-display); font-size: 19px; font-weight: 600; }
.tile span { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile.t0 { background: color-mix(in srgb, var(--accent) 10%, var(--card)); }
.tile.t2 { background: color-mix(in srgb, var(--accent2) 10%, var(--card)); }
.tile.t4 { background: color-mix(in srgb, var(--gold) 14%, var(--card)); }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(3, 1fr); } }

/* ===== schedule ===== */
.tabs { display: flex; gap: 6px; margin-top: 16px; overflow-x: auto; scrollbar-width: none; }
.tab { white-space: nowrap; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 700; font-size: 14px; background: var(--card); }
.tab[aria-current="page"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.sched-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.filter { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); font-weight: 700; }
.filter select { padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); max-width: 62vw; }
.strip { margin-top: 18px; padding: 12px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
.ticks { position: relative; height: 16px; margin-left: 92px; font-size: 10.5px; color: var(--muted); }
.ticks span { position: absolute; transform: translateX(-50%); font-variant-numeric: tabular-nums; }
.lane { display: flex; align-items: center; height: 20px; }
.lane-n { width: 92px; flex: none; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 8px; }
.lane-t { position: relative; flex: 1; height: 10px; border-bottom: 1px solid var(--line); }
.bar { position: absolute; top: 0; height: 10px; border-radius: 3px; opacity: .7; }
.bar.hard { opacity: 1; box-shadow: 0 0 0 1.5px var(--paper), 0 0 0 3px var(--ink); }
.block { margin-top: 30px; }
.block-h { border-bottom: 2px solid var(--c); padding-bottom: 8px; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: baseline; }
.block-h h3 { font-size: 21px; }
.block-span { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.block-h p { grid-column: 1 / -1; color: var(--muted); font-size: 14px; }
.evs { list-style: none; margin: 0; padding: 0; }
.ev { display: grid; grid-template-columns: 70px 1fr; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); position: relative; }
.ev.dim { opacity: .62; }
.ev-time { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 16px; position: relative; padding-left: 12px; }
.ev-time::before { content: ""; position: absolute; left: 0; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.ev.hard .ev-time::before { width: 9px; height: 9px; top: 6px; left: -1px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 25%, transparent); }
.ev-time small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.t-date { font-family: var(--font-display); color: var(--accent); font-size: 15px; }
.star { color: var(--accent); }
.ev-body h4 { font-family: var(--font-body); font-weight: 700; font-size: 16.5px; line-height: 1.35; }
.ev-lead { font-size: 14px; margin-top: 3px; }
.lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin-right: 2px; }
.ev-notes { font-size: 14px; color: var(--muted); margin-top: 3px; }
.ev-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.place-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; text-decoration: none; margin-right: 4px; }
.chip { font-size: 12px; border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 2px 9px; color: var(--ink); cursor: pointer; white-space: nowrap; }
.chip.more { cursor: default; color: var(--muted); }
.chip.big { font-size: 14px; padding: 7px 14px; text-decoration: none; display: inline-block; background: var(--card); }
.role-picker { display: flex; flex-wrap: wrap; gap: 8px; }

/* ===== my day ===== */
.me-head { display: flex; gap: 16px; align-items: center; margin-top: 20px; }
.me-head .page-title { margin-top: 0; }
.me-note { color: var(--muted); }
.role-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.role-list strong { display: block; }
.role-list span { font-size: 14px; color: var(--muted); }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { border-bottom: 1px dashed var(--line); }
.checklist label { display: flex; gap: 12px; padding: 10px 0; cursor: pointer; align-items: flex-start; }
.checklist input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; margin-top: 2px; }
.checklist input:checked + span { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ink) 40%, transparent); color: var(--muted); }
.checklist small { display: block; font-size: 12.5px; color: var(--gold); font-weight: 700; }
.me-day { margin-top: 18px; }
.me-day h3 { font-size: 19px; color: var(--accent); }

/* ===== people ===== */
.people { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .people { grid-template-columns: repeat(3, 1fr); } }
.person { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 16px 10px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); text-decoration: none; color: var(--ink); position: relative; }
.pn { font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.pnote { font-size: 13px; color: var(--muted); }

/* ===== places ===== */
.places { display: grid; gap: 14px; margin-top: 16px; }
.place { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; overflow: hidden; }
.place-photo { width: calc(100% + 36px); max-width: none; margin: -18px -18px 14px; height: 180px; object-fit: cover; }
.place h3 { font-size: 20px; }
.addr-zh { font-size: 22px; font-weight: 700; margin-top: 8px; letter-spacing: .02em; font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif; }
.addr { color: var(--muted); font-size: 14px; }
.place .pnote { margin-top: 8px; text-align: left; }
.place-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px -18px 0; padding: 14px 18px 0; border-top: 2px dashed var(--line); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); text-decoration: none; font-weight: 700; font-size: 14px; cursor: pointer; }
.btn.primary { background: var(--accent); color: #fff8f0; border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: transparent; margin-right: auto; }
.btn.sm { padding: 4px 10px; font-size: 12.5px; }
dialog.driver { border: 0; padding: 32px 24px; width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; background: #fffdf8; color: #111; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 22px; }
dialog.driver::backdrop { background: #000; }
.driver-ask { font-size: 18px; color: #555; }
.driver-zh { font-size: clamp(40px, 11vw, 84px); font-weight: 800; line-height: 1.25; font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif; word-break: break-all; }
.driver-name { font-size: 22px; color: #b3261e; }

/* ===== guide & pages ===== */
.cards { display: grid; gap: 12px; }
@media (min-width: 640px) { .cards { grid-template-columns: repeat(2, 1fr); } }
.gcard { display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); text-decoration: none; color: var(--ink); overflow: hidden; position: relative; }
.gcard img { margin: -16px -16px 10px; width: calc(100% + 32px); max-width: none; height: 150px; object-fit: cover; }
.gcard strong { font-family: var(--font-display); font-size: 19px; font-weight: 600; }
.gcard span { color: var(--muted); font-size: 14px; }
.hidden-page { opacity: .55; border-style: dashed; }
.page .back { display: inline-block; margin-top: 18px; }
.page .cover { border-radius: var(--radius); margin-top: 14px; width: 100%; max-height: 360px; object-fit: cover; }
.prose { margin-top: 22px; font-size: 16.5px; }
.prose h2 { font-size: 23px; margin: 30px 0 10px; }
.prose h3 { font-size: 19px; margin: 22px 0 8px; }
.prose p { margin: 0 0 14px; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 14px; }
.prose li { margin-bottom: 6px; }
.prose blockquote { margin: 18px 0; padding: 12px 16px; border-left: 4px solid var(--gold); background: var(--paper-2); border-radius: 0 10px 10px 0; font-style: italic; }
.prose blockquote p:last-child { margin: 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 18px; font-size: 14.5px; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.prose img { border-radius: 12px; margin: 16px 0; }
.prose code { font-size: .9em; }
.prose hr { border: 0; border-top: 1px dashed var(--line); margin: 24px 0; }

/* ===== edit mode ===== */
body.editing [data-e] { outline: 1.5px dashed color-mix(in srgb, var(--accent2) 55%, transparent); outline-offset: 3px; border-radius: 4px; cursor: text; min-height: 1em; min-width: 2em; display: inline-block; }
body.editing p[data-e], body.editing div[data-e], body.editing h1[data-e], body.editing h3[data-e], body.editing h4[data-e] { display: block; }
body.editing [data-e]:empty::before { content: "＋ add"; color: var(--accent2); font-size: 12px; font-weight: 700; }
body.editing [data-e]:hover { background: color-mix(in srgb, var(--accent2) 8%, transparent); }
body.editing [data-stale] { outline-color: color-mix(in srgb, var(--accent) 70%, transparent); position: relative; }
body.editing [data-stale]::after { content: attr(data-stale); position: absolute; top: -9px; left: -6px; font: 700 9px/1 var(--font-body); text-transform: uppercase; background: var(--accent); color: #fff; padding: 2px 4px; border-radius: 4px; }
body.editing [data-rec] { position: relative; }
.rec-btn { position: absolute; top: 6px; right: 6px; z-index: 2; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 15px; line-height: 1; box-shadow: 0 2px 8px -4px rgba(0,0,0,.4); }
.add-btn { display: inline-block; margin-top: 10px; border: 1.5px dashed color-mix(in srgb, var(--accent2) 60%, transparent); background: none; color: var(--accent2); border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: 13px; cursor: pointer; margin-right: 6px; }
.people .add-btn, .cards .add-btn { margin: 0; min-height: 60px; border-radius: var(--radius); }
.edit-bar { position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 10px); display: flex; gap: 4px; align-items: center; padding: 6px; border-radius: 999px; background: var(--ink); color: var(--paper); box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); max-width: calc(100vw - 16px); overflow-x: auto; }
@media (min-width: 860px) { .edit-bar { bottom: 18px; } }
.edit-bar button { background: none; border: 0; color: inherit; padding: 6px 10px; border-radius: 999px; font-weight: 700; font-size: 13px; cursor: pointer; white-space: nowrap; }
.edit-bar button:hover { background: rgba(255,255,255,.12); }
.edit-bar b { background: var(--accent); color: #fff; border-radius: 999px; padding: 0 6px; font-size: 11px; }
@media (max-width: 480px) { .eb-who { display: none; } }
.eb-who { padding: 0 8px; font-size: 13px; opacity: .8; white-space: nowrap; }
body.editing { padding-bottom: calc(var(--tab-h) + 80px); }

dialog.ed { border: 1px solid var(--line); border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 16px)); max-height: calc(100dvh - 32px); background: var(--paper); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); }
dialog.ed.wide { width: min(820px, calc(100vw - 16px)); }
dialog.ed::backdrop { background: rgba(20,12,10,.45); }
.ed-form header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--paper); z-index: 1; }
.ed-form h2 { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.x { border: 0; background: none; font-size: 18px; cursor: pointer; color: var(--muted); padding: 4px 8px; }
.ed-body { padding: 16px 18px 18px; display: grid; gap: 14px; }
.ed-body label { display: grid; gap: 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.ed-body input:not([type=checkbox]):not([type=color]), .ed-body select, .ed-body textarea { width: 100%; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 400; font-size: 15px; }
.ed-body textarea { resize: vertical; line-height: 1.5; }
.ed-body textarea.md { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13.5px; }
.ed-body input[type=color] { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); padding: 2px; }
.ed-body .check { display: flex; gap: 8px; align-items: center; font-weight: 400; color: var(--ink); }
.ed-body fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 12px; margin: 0; }
.ed-body legend { font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 0 4px; }
.ed-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; position: sticky; bottom: -18px; background: var(--paper); padding: 12px 0 14px; margin-bottom: -18px; border-top: 1px solid var(--line); }
.hint { font-size: 13px; color: var(--muted); }
.err { color: var(--accent); font-size: 14px; }
.grid2 { display: grid; gap: 10px; grid-template-columns: 1fr; }
.grid3 { display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); }
@media (min-width: 560px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs figure { margin: 0; display: grid; gap: 4px; }
.thumbs img { width: 90px; height: 90px; object-fit: cover; border-radius: 8px; }
.file-btn { cursor: pointer; }
.chips-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-pick { display: inline-flex !important; }
.chip-pick input { position: absolute; opacity: 0; pointer-events: none; }
.chip-pick span { border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 12.5px; font-weight: 400; color: var(--ink); cursor: pointer; background: var(--card); }
.chip-pick input:checked + span { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip-pick input:focus-visible + span { outline: 2px solid var(--accent); }
.text-links { display: flex; flex-wrap: wrap; gap: 6px; }
.text-links .btn { flex-direction: column; align-items: flex-start; border-radius: 12px; padding: 6px 12px; }
.text-links small { font-weight: 400; font-size: 11.5px; color: var(--muted); max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stale-tag { background: var(--accent); color: #fff; font-size: 10px; border-radius: 4px; padding: 1px 5px; text-transform: uppercase; letter-spacing: .04em; }
.stale-tag.soft { background: var(--muted); }
.lang-field { position: relative; }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 50vh; overflow: auto; }
.plain-list li { display: flex; gap: 8px; align-items: center; }
.plain-list li > span:not(.dot) { flex: 1; }
.plain-list small { color: var(--muted); }
.sortf { max-width: 140px; }
.face { align-items: end; }
.fname { font-size: 12.5px; word-break: break-all; align-self: center; }
.toast { position: fixed; z-index: 100; left: 50%; top: 16px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 999px; font-weight: 700; font-size: 14px; box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); animation: tin .2s ease-out; }
.toast.bad { background: var(--accent); color: #fff; }
@keyframes tin { from { opacity: 0; transform: translate(-50%, -8px); } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } .tile { transition: none; } }
@media print { .top, .tabbar, .foot, .edit-bar, .find, .rec-btn, .add-btn { display: none !important; } body { background: #fff; padding: 0; } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #1a1412; } }
:root[data-theme="dark"] .btn.primary { color: #1a1412; }
