/* Beijing Michelin Table
   Palette: palace-wall vermilion, glazed-tile ochre, jade, rice-paper neutrals. */

@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/InstrumentSerif-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/InstrumentSerif-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f4efe6;
  --paper-2: #ebe4d7;
  --card: #fffcf6;
  --ink: #1e1b17;
  --ink-2: #4a453e;
  --muted: #6b645a;
  --line: #ddd4c4;
  --line-soft: #e9e2d5;
  --vermilion: #a8352a;
  --vermilion-deep: #8e2a1f;
  --vermilion-wash: #f6e0d8;
  --ochre: #c9932e;
  --ochre-light: #f3d9a4;
  --ochre-wash: #f5e6c4;
  --ochre-ink: #7a5410;
  --jade: #2f6b5f;
  --jade-ink: #245348;
  --jade-wash: #dcebe5;
  --warn-ink: #7a4b00;
  --warn-wash: #fff1d6;
  --chart-muted: #8a8378;

  --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --cjk: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgb(30 27 23 / 6%), 0 8px 24px -12px rgb(30 27 23 / 18%);
  --topbar-h: 56px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 12px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  text-rendering: optimizeLegibility;
}
:lang(zh-Hans), [lang="zh-Hans"] { font-family: var(--cjk); }
img, svg { display: block; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--vermilion); }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 400; }
[hidden] { display: none !important; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--vermilion); outline-offset: 2px; border-radius: 4px; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 50; padding: 8px 14px; background: var(--ink); color: var(--paper); border-radius: 8px; }
.skip-link:focus { top: 8px; }

.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px;
  border: 1px solid transparent; background: none; cursor: pointer;
  font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, color .15s, border-color .15s, transform .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--vermilion); color: #fff8ee; }
.btn-primary:hover { background: var(--vermilion-deep); color: #fff8ee; }
.btn-outline { border-color: var(--ink); color: var(--ink); }
.btn-outline:hover { background: var(--ink); color: var(--paper); }
.btn-paper { background: #fff8ee; color: var(--vermilion-deep); }
.btn-paper:hover { background: #fff; color: var(--vermilion-deep); }
.btn-ghost-light { border-color: rgb(255 248 238 / 55%); color: #fff8ee; }
.btn-ghost-light:hover { background: rgb(255 248 238 / 12%); color: #fff8ee; }
.btn-text { padding: 0; min-height: 36px; color: var(--ink-2); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.btn-text:hover { color: var(--vermilion); }
.btn-big { min-height: 52px; padding: 0 28px; font-size: 16px; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.icon-btn {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card); cursor: pointer;
}
.icon-btn:hover { border-color: var(--ink); }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 max(16px, env(safe-area-inset-left));
  background: rgb(244 239 230 / 92%); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand:hover { color: var(--ink); }
.seal {
  display: grid; place-items: center; width: 32px; height: 32px; flex: none;
  background: var(--vermilion); color: #fff8ee; border-radius: 6px;
  font-size: 19px; font-weight: 600; line-height: 1;
  box-shadow: inset 0 0 0 2px var(--vermilion), inset 0 0 0 3px rgb(255 248 238 / 60%);
}
.brand-text { font-family: var(--serif); font-size: 22px; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text em { color: var(--vermilion); }
.topnav { display: flex; align-items: center; gap: 18px; font-size: 14px; font-weight: 500; }
.topnav a { text-decoration: none; color: var(--ink-2); }
.topnav a:hover { color: var(--vermilion); }
.btn-lucky-small { min-height: 38px; padding: 0 14px; background: var(--ink); color: var(--paper); font-size: 14px; }
.btn-lucky-small:hover { background: var(--vermilion); color: #fff8ee; }
@media (max-width: 640px) {
  .topnav a { display: none; }
  .brand-text { font-size: 19px; }
}

/* Hero */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(120% 90% at 85% 0%, rgb(255 255 255 / 9%), transparent 55%),
    radial-gradient(90% 120% at 0% 100%, rgb(0 0 0 / 18%), transparent 60%),
    var(--vermilion);
  color: #fff8ee;
}
.hero::after {
  content: "京"; position: absolute; right: -0.08em; bottom: -0.22em; z-index: 0;
  font-family: var(--cjk); font-weight: 600; font-size: clamp(260px, 42vw, 560px); line-height: 1;
  color: rgb(0 0 0 / 9%); pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; padding: clamp(36px, 7vw, 84px) 20px clamp(40px, 6vw, 72px); }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--ochre-light); }
.eyebrow--ink { color: var(--vermilion); }
.hero h1 {
  max-width: 15ch; margin: 14px 0 18px;
  font-family: var(--serif); font-size: clamp(44px, 8.4vw, 96px); line-height: .98; letter-spacing: -.01em;
}
.hero h1 em { font-style: italic; color: var(--ochre-light); }
html[lang="zh-CN"] .hero h1 { max-width: 12em; line-height: 1.12; }
.hero-lede { max-width: 60ch; font-size: clamp(16px, 2vw, 18px); color: rgb(255 248 238 / 88%); }
.hero-tally { display: flex; flex-wrap: wrap; gap: 8px; margin: 26px 0 0; padding: 0; list-style: none; }
.hero-tally li {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 10px;
  border: 1px solid rgb(255 248 238 / 30%); border-radius: 999px; font-size: 14px; background: rgb(0 0 0 / 8%);
}
.hero-tally b { font-family: var(--serif); font-size: 20px; font-weight: 400; line-height: 1; }
.hero-tally .stars { color: var(--ochre-light); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-origin { display: flex; gap: 10px; align-items: flex-start; max-width: 62ch; margin-top: 26px; font-size: 14px; color: rgb(255 248 238 / 82%); }
.hero-origin .icon { margin-top: 2px; color: var(--ochre-light); }
.fret {
  position: relative; z-index: 1; height: 14px; background-color: var(--vermilion-deep);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='14' viewBox='0 0 16 14'%3E%3Cpath d='M0 12.5H16M12 12.5V2H4V8.5H8.5V5' fill='none' stroke='%23d9a441' stroke-width='1.3'/%3E%3C/svg%3E");
  background-repeat: repeat-x; background-position: 0 0;
}

/* Finder layout */
.finder { max-width: 1240px; margin: 0 auto; padding: 28px 16px 64px; display: grid; gap: 24px; }
@media (min-width: 1024px) {
  .finder { grid-template-columns: 340px minmax(0, 1fr); gap: 32px; padding: 40px 24px 80px; align-items: start; }
  .panel { position: sticky; top: calc(var(--topbar-h) + 16px); max-height: calc(100vh - var(--topbar-h) - 32px); overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
}

/* Panel */
.panel { display: grid; gap: 12px; }
.panel-block { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.panel-title { font-family: var(--serif); font-size: 28px; line-height: 1.05; }
.panel-hint { margin-top: 4px; color: var(--muted); font-size: 14px; }
.panel-note { margin-top: 12px; font-size: 13px; color: var(--muted); }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.preset {
  min-height: 38px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--paper); font-size: 14px; font-weight: 500;
}
.preset:hover { border-color: var(--ink); }
.preset[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.disclosure { padding: 0; }
.disclosure > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px; cursor: pointer; list-style: none; font-weight: 600;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::after {
  content: ""; width: 9px; height: 9px; flex: none; margin-left: 4px;
  border-right: 1.8px solid var(--ink-2); border-bottom: 1.8px solid var(--ink-2);
  transform: rotate(45deg) translateY(-3px); transition: transform .2s;
}
.disclosure[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.disclosure > summary > span:first-child { margin-right: auto; }
.summary-value { font-size: 13px; font-weight: 500; color: var(--muted); text-align: right; }
.disclosure > :not(summary) { padding: 0 18px 18px; }

.criteria { display: grid; gap: 16px; }
.criterion { border: 0; margin: 0; padding: 0; min-width: 0; }
.criterion-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.criterion-name { font-weight: 600; font-size: 15px; padding: 0; }
.criterion-cov { font-size: 12px; color: var(--muted); }
.segmented { display: grid; grid-template-columns: repeat(4, 1fr); padding: 3px; gap: 3px; border-radius: 10px; background: var(--paper-2); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  display: grid; place-items: center; min-height: 36px; border-radius: 8px; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--ink-2); text-align: center;
}
.segmented label:hover { background: rgb(255 255 255 / 55%); }
.segmented input:checked + label { background: var(--card); color: var(--ink); font-weight: 650; box-shadow: 0 1px 2px rgb(30 27 23 / 14%); }
.segmented input:checked + label.lvl-0 { color: var(--muted); }
.segmented input:focus-visible + label { outline: 2px solid var(--vermilion); outline-offset: 1px; }

.filters { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.field-label { display: flex; align-items: center; gap: 6px; padding: 0; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
input[type="search"], select {
  width: 100%; min-height: 44px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--paper); font-size: 15px;
}
select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 17px) 19px, calc(100% - 12px) 19px; background-size: 5px 5px; background-repeat: no-repeat; }
input[type="search"]:focus, select:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px rgb(168 53 42 / 18%); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; font-size: 13px; font-weight: 500;
}
.chip span:hover { border-color: var(--ink); }
.chip input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip input:focus-visible + span { outline: 2px solid var(--vermilion); outline-offset: 2px; }
.chip small { opacity: .7; font-weight: 400; }
.toggle { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; min-height: 36px; }
.toggle input { width: 18px; height: 18px; accent-color: var(--vermilion); }
.info {
  display: inline-grid; place-items: center; width: 18px; height: 18px; padding: 0; border-radius: 50%;
  border: 1px solid var(--muted); background: none; color: var(--muted); font-size: 11px; font-weight: 700; cursor: help;
}

/* Results */
.results { min-width: 0; outline: none; }
.results-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 14px; }
.results-title { font-family: var(--serif); font-size: clamp(34px, 4.6vw, 46px); line-height: 1; }
.results-summary { margin-top: 6px; color: var(--ink-2); font-size: 15px; }
.view-toggle { display: inline-flex; padding: 3px; gap: 3px; border-radius: 999px; background: var(--paper-2); }
.seg { min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: none; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.seg[aria-pressed="true"] { background: var(--card); color: var(--ink); font-weight: 650; box-shadow: 0 1px 2px rgb(30 27 23 / 14%); }
.coverage-banner:empty { display: none; }
.coverage-banner {
  display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; padding: 12px 14px;
  border-radius: var(--radius-sm); background: var(--ochre-wash); color: var(--ochre-ink); font-size: 14px;
}
.coverage-banner .icon { margin-top: 2px; }

.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.card {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 16px;
  padding: 18px 18px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s;
}
.card:hover { border-color: #c9bda8; box-shadow: var(--shadow); }
.card-rank { grid-row: 1 / span 3; font-family: var(--serif); font-size: 34px; line-height: .9; color: var(--muted); min-width: 1.6ch; font-variant-numeric: tabular-nums; }
.card--top .card-rank { color: var(--vermilion); }
.card-main { min-width: 0; }
.card-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.card-name { font-family: var(--serif); font-size: clamp(24px, 3vw, 29px); line-height: 1.08; }
.card-name button { all: unset; cursor: pointer; }
.card-name button:focus-visible { outline: 2px solid var(--vermilion); outline-offset: 3px; border-radius: 4px; }
.card:hover .card-name { color: var(--vermilion-deep); }
.card-sub { margin-top: 4px; color: var(--ink-2); font-size: 14px; }
.card-sub .zh { font-size: 15px; color: var(--ink); }
.facts { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 14px 0 0; }
.fact { min-width: 0; }
.fact dt { font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.fact dd { margin: 2px 0 0; font-size: 15px; }
.fact b { font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.fact small { color: var(--muted); font-size: 12.5px; }
.fact .na { color: var(--muted); font-style: italic; font-size: 14px; }
.card-foot { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.card-score { grid-row: 1 / span 3; grid-column: 3; display: grid; justify-items: end; align-content: start; gap: 8px; min-width: 104px; }
.score-num { font-family: var(--serif); font-size: 40px; line-height: .85; font-variant-numeric: tabular-nums; }
.score-label { font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.meters { display: grid; gap: 4px; width: 104px; }
.meter { display: grid; grid-template-columns: 38px 1fr; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-2); }
.meter-track { height: 6px; border-radius: 3px; background: var(--vermilion-wash); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 3px; background: var(--vermilion); }
.missing { font-size: 12.5px; color: var(--muted); }
@media (max-width: 640px) {
  .card { grid-template-columns: auto minmax(0, 1fr); padding: 16px 14px 14px; gap: 2px 12px; }
  .card-rank { font-size: 28px; grid-row: auto; }
  .card-score { grid-column: 1 / -1; grid-row: auto; display: flex; align-items: center; justify-content: flex-start; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); min-width: 0; }
  .score-num { font-size: 32px; }
  .meters { grid-auto-flow: column; grid-template-rows: auto; width: auto; flex: 1; gap: 10px; }
  .meter { grid-template-columns: auto; gap: 3px; }
  .facts { gap: 8px 18px; }
}

/* Badges & tags */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 650; white-space: nowrap;
}
.badge svg { width: 12px; height: 12px; fill: currentColor; stroke: none; }
.badge--star { background: var(--vermilion); color: #fff8ee; }
.badge--star .stars { display: inline-flex; gap: 1px; color: var(--ochre-light); }
.badge--bib { background: var(--ochre-wash); color: var(--ochre-ink); }
.badge--selected { background: var(--jade-wash); color: var(--jade-ink); }
.badge--green { background: none; color: var(--jade-ink); box-shadow: inset 0 0 0 1px var(--jade); }
.tier { font-size: 12.5px; font-weight: 650; color: var(--ink-2); letter-spacing: .04em; }
.tier .off { color: #c5bcad; }
.tag {
  display: inline-flex; align-items: center; gap: 5px; min-height: 24px; padding: 2px 9px; border-radius: 6px;
  background: var(--paper-2); color: var(--ink-2); font-size: 12px; font-weight: 550; line-height: 1.3;
}
.tag--warn { background: var(--warn-wash); color: var(--warn-ink); }
.tag--warn::before { content: "!"; display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; background: var(--warn-ink); color: var(--warn-wash); font-size: 10px; font-weight: 800; }
.tag--old { background: #ece6f1; color: #4b3d63; }
.tag--branch { background: #e3ebf3; color: #2c4a66; }
.tag--notes { background: var(--jade-wash); color: var(--jade-ink); }
.prov { display: inline-flex; align-items: center; gap: 5px; min-height: 22px; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.prov::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.prov--full { background: var(--jade-wash); color: var(--jade-ink); }
.prov--snippet { background: var(--ochre-wash); color: var(--ochre-ink); }
.prov--shop, .prov--other { background: var(--paper-2); color: var(--ink-2); }
.prov--shop::before, .prov--other::before { background: none; box-shadow: inset 0 0 0 1.5px currentColor; }
.zh-only { display: inline; }
.zh-only abbr {
  display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 4px; vertical-align: 1px;
  background: var(--paper-2); color: var(--muted); font: 600 10px/16px var(--sans); text-decoration: none; letter-spacing: .04em; cursor: help;
}

/* Unranked */
.unranked-head { margin: 36px 0 14px; padding-top: 22px; border-top: 1px solid var(--line); }
.unranked-head h3 { font-family: var(--serif); font-size: 30px; line-height: 1.05; }
.unranked-head p { margin-top: 6px; max-width: 70ch; color: var(--ink-2); font-size: 14.5px; }
.cards--unranked .card-rank { font-size: 22px; color: #b3a995; }
.empty { padding: 48px 20px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--ink-2); display: grid; gap: 14px; justify-items: center; }

/* Chart */
.chart-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 14px; }
.chart-title { font-family: var(--serif); font-size: 26px; line-height: 1.1; }
.chart-sub { margin-top: 4px; color: var(--ink-2); font-size: 14px; max-width: 70ch; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 12px 0 4px; padding: 0; list-style: none; font-size: 13px; color: var(--ink-2); }
.chart-legend li { display: inline-flex; align-items: center; gap: 7px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.chart-svg { width: 100%; height: auto; overflow: visible; touch-action: manipulation; }
.chart-svg .grid { stroke: var(--line-soft); stroke-width: 1; }
.chart-svg .axis-label, .chart-svg .tick { fill: var(--muted); font: 12px var(--sans); }
.chart-svg .axis-title { fill: var(--ink-2); font: 600 12px var(--sans); }
.chart-svg .dot { stroke: var(--card); stroke-width: 2; transition: r .12s; }
.chart-svg .dot--muted { fill: var(--chart-muted); }
.chart-svg .dot--top { fill: var(--vermilion); }
.chart-svg .hit { fill: transparent; cursor: pointer; }
.chart-svg .hit:focus { outline: none; }
.chart-svg .pt:hover .dot, .chart-svg .pt:focus-within .dot, .chart-svg .pt.is-active .dot { r: 8; }
.chart-svg .pt:focus-visible .dot { stroke: var(--ink); }
.chart-svg .lbl { fill: var(--ink); font: 650 12px var(--sans); paint-order: stroke; stroke: var(--card); stroke-width: 3px; pointer-events: none; }
.chart-foot { margin-top: 8px; font-size: 13px; color: var(--muted); }

/* Tooltip & toast */
.tooltip {
  position: fixed; z-index: 80; max-width: 260px; padding: 10px 12px; border-radius: 10px;
  background: var(--ink); color: var(--paper); font-size: 13px; line-height: 1.4; pointer-events: none;
  box-shadow: 0 8px 24px rgb(0 0 0 / 25%);
}
.tooltip strong { display: block; font-size: 15px; font-weight: 650; }
.tooltip .tt-zh { color: #d8cfbf; }
.tooltip .tt-row { display: flex; justify-content: space-between; gap: 12px; margin-top: 2px; }
.tooltip .tt-row b { font-variant-numeric: tabular-nums; }
.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 90; transform: translateX(-50%);
  padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--paper); font-size: 14px; box-shadow: var(--shadow);
}

/* Guide section */
.guide { background: var(--card); border-top: 1px solid var(--line); }
.guide-inner { max-width: 1240px; margin: 0 auto; padding: 56px 20px 64px; }
.guide h2 { margin-top: 10px; font-family: var(--serif); font-size: clamp(34px, 5vw, 52px); line-height: 1.02; max-width: 22ch; }
.guide-grid { display: grid; gap: 16px; margin-top: 28px; }
@media (min-width: 760px) { .guide-grid { grid-template-columns: 1fr 1fr; } .guide-card--wide { grid-column: 1 / -1; } }
@media (min-width: 1100px) { .guide-grid { grid-template-columns: repeat(4, 1fr); } }
.guide-card { padding: 20px; border-radius: var(--radius); background: var(--paper); border: 1px solid var(--line-soft); font-size: 14.5px; color: var(--ink-2); }
.guide-card h3 { margin-bottom: 8px; font-family: var(--serif); font-size: 25px; line-height: 1.1; color: var(--ink); }
.guide-card p + p { margin-top: 10px; }
.legend-list { display: grid; gap: 10px; margin: 14px 0 0; }
.legend-list div { display: grid; gap: 3px; }
.legend-list dd { margin: 0; }
.def-list { margin: 0; }
.def-list dt { margin-top: 12px; font-weight: 650; color: var(--ink); }
.def-list dt:first-child { margin-top: 0; }
.def-list dd { margin: 3px 0 0; }
.prov-list { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 10px; }
.prov-list li { display: grid; gap: 4px; justify-items: start; }
.fine-print { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
@media (min-width: 1100px) { .fine-print { grid-template-columns: 1fr 1fr; column-gap: 36px; } }

.footer { padding: 28px 20px 40px; text-align: center; color: var(--muted); font-size: 13px; }
.footer p { max-width: 80ch; margin: 0 auto; }
.footer-small { margin-top: 8px !important; font-size: 12px; }

/* Dialogs */
html:has(dialog[open]) { overflow: hidden; }
dialog { padding: 0; border: 0; color: var(--ink); }
dialog::backdrop { background: rgb(30 27 23 / 48%); backdrop-filter: blur(2px); }
.sheet {
  width: min(780px, 100vw); max-width: 100vw; max-height: min(92vh, 100dvh); margin: auto auto 0;
  border-radius: 20px 20px 0 0; background: var(--paper); overflow: hidden; display: none;
}
.sheet[open] { display: flex; flex-direction: column; animation: sheet-in .28s cubic-bezier(.2, .8, .2, 1); }
@media (min-width: 820px) { .sheet { margin: auto; border-radius: 20px; max-height: 90vh; } }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-bar { position: absolute; top: 12px; right: 12px; z-index: 2; }
.sheet-body { overflow: auto; overscroll-behavior: contain; padding: 28px 22px 32px; }
@media (min-width: 820px) { .sheet-body { padding: 36px 40px 40px; } }

.d-badges { display: flex; flex-wrap: wrap; gap: 6px; padding-right: 52px; }
.d-title { margin-top: 12px; font-family: var(--serif); font-size: clamp(36px, 6vw, 52px); line-height: 1; }
.d-zh { margin-top: 6px; font-size: 20px; font-weight: 500; }
.d-meta { margin-top: 8px; color: var(--ink-2); font-size: 14.5px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.d-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.d-alert { margin-top: 18px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--warn-wash); color: var(--warn-ink); font-size: 14.5px; }
.d-alert strong { display: block; margin-bottom: 4px; }
.d-alert ul { margin: 8px 0 0; padding-left: 18px; }
.d-alert a { color: inherit; }
.d-note { margin-top: 18px; padding: 12px 14px; border-left: 3px solid var(--jade); background: var(--card); font-size: 14px; color: var(--ink-2); border-radius: 0 8px 8px 0; }
.d-section { margin-top: 30px; }
.d-section > h3 { font-family: var(--serif); font-size: 28px; line-height: 1.1; margin-bottom: 12px; }
.d-section > .d-lede { margin: -4px 0 14px; color: var(--ink-2); font-size: 14px; }
.stat-grid { display: grid; gap: 12px; }
@media (min-width: 620px) { .stat-grid { grid-template-columns: 1fr 1fr; } }
.stat { padding: 16px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); font-size: 14px; color: var(--ink-2); display: grid; gap: 6px; align-content: start; }
.stat-label { font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stat-value { font-size: 30px; font-weight: 650; letter-spacing: -.02em; color: var(--ink); line-height: 1.1; }
.stat-value small { font-size: 15px; font-weight: 500; color: var(--ink-2); letter-spacing: 0; }
.stat-value.na { font-size: 20px; font-weight: 500; color: var(--muted); font-style: italic; }
.stat-kind { font-weight: 650; color: var(--ink); }
.stat a { font-weight: 600; }
.stat .zh-poi { font-family: var(--cjk); }
.highlight { font-family: var(--serif); font-size: 23px; line-height: 1.3; color: var(--ink); }
.dish-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding: 0; list-style: none; }
.dish-list li { padding: 5px 11px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: 13.5px; }
.primer { margin-top: 12px; font-size: 14px; color: var(--ink-2); }
.primer b { color: var(--ink); }

.platforms { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.platform-sum { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: 13px; }
.platform-sum b { font-weight: 650; }
.notes { display: grid; gap: 12px; }
.note { padding: 16px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
.note-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); }
.platform { font-weight: 700; color: var(--ink); font-size: 12.5px; letter-spacing: .02em; }
.note-title { margin-top: 10px; font-weight: 650; font-size: 16px; line-height: 1.35; }
.note-title-zh { margin-top: 2px; font-size: 13px; color: var(--muted); }
.note-author { margin-top: 4px; font-size: 13px; color: var(--muted); }
.note-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; font-size: 14.5px; }
.note-list li { position: relative; padding-left: 26px; }
.note-list li::before { position: absolute; left: 0; top: 1px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-size: 12px; font-weight: 800; }
.note-list .pro::before { content: "+"; background: var(--jade-wash); color: var(--jade-ink); }
.note-list .con::before { content: "−"; background: var(--vermilion-wash); color: var(--vermilion-deep); }
.note-list .snip::before { content: "“"; background: var(--ochre-wash); color: var(--ochre-ink); font-family: var(--serif); font-size: 16px; }
.note-list .lim::before { content: "!"; background: var(--paper-2); color: var(--ink-2); }
.note-list .scp::before { content: "→"; background: var(--paper-2); color: var(--ink-2); font-size: 11px; }
.note-list .lbl { font-weight: 650; color: var(--ink); }
.note-dishes { margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.note-dishes b { font-weight: 650; }
.note-src { display: inline-block; margin-top: 12px; font-size: 13.5px; font-weight: 600; }
.note-src.na { color: var(--muted); font-weight: 400; }
.none-note { padding: 14px 16px; border-radius: var(--radius); border: 1px dashed var(--line); color: var(--muted); font-size: 14px; }
.siblings { display: flex; flex-wrap: wrap; gap: 8px; }
.sibling { min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 14px; }
.sibling:hover { border-color: var(--ink); }
.d-disclaimer { margin-top: 30px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }

/* Lucky */
.sheet--lucky { width: min(560px, 100vw); }
.lucky { text-align: center; }
.lucky h2 { margin-top: 8px; font-family: var(--serif); font-size: clamp(36px, 7vw, 46px); line-height: 1; }
.lucky-lede { max-width: 44ch; margin: 10px auto 0; color: var(--ink-2); font-size: 14.5px; }
.lucky-pool { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 18px 0 0; padding: 3px; border: 0; border-radius: 999px; background: var(--paper-2); }
.lucky-pool label { position: relative; }
.lucky-pool input { position: absolute; opacity: 0; pointer-events: none; }
.lucky-pool span { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 999px; cursor: pointer; font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.lucky-pool input:checked + span { background: var(--card); color: var(--ink); font-weight: 650; box-shadow: 0 1px 2px rgb(30 27 23 / 14%); }
.lucky-pool input:focus-visible + span { outline: 2px solid var(--vermilion); }
.lucky-pool input:disabled + span { opacity: .45; cursor: not-allowed; }
.tube-stage { height: 230px; display: grid; place-items: end center; margin: 18px 0 18px; }
.tube { position: relative; width: 108px; height: 210px; transform-origin: 50% 85%; }
.tube-body {
  position: absolute; left: 0; right: 0; bottom: 0; height: 128px; z-index: 2;
  display: grid; place-items: center; border-radius: 12px 12px 18px 18px;
  background:
    linear-gradient(90deg, rgb(0 0 0 / 22%), transparent 22%, rgb(255 255 255 / 18%) 42%, transparent 60%, rgb(0 0 0 / 25%)),
    var(--vermilion);
  box-shadow: inset 0 6px 0 rgb(0 0 0 / 18%), 0 10px 18px -8px rgb(30 27 23 / 50%);
}
.tube-body::before, .tube-body::after { content: ""; position: absolute; left: 0; right: 0; height: 6px; background: var(--ochre); }
.tube-body::before { top: 14px; }
.tube-body::after { bottom: 16px; }
.tube-body span { color: var(--ochre-light); font-size: 34px; font-weight: 600; }
.sticks { position: absolute; left: 14px; right: 14px; bottom: 100px; height: 64px; z-index: 1; display: flex; justify-content: space-around; align-items: flex-end; }
.sticks i { width: 9px; border-radius: 3px 3px 0 0; background: linear-gradient(90deg, #d8b46a, #f0d9a2 45%, #c99a45); }
.stick-drawn {
  position: absolute; left: 50%; bottom: 96px; z-index: 1; width: 26px; height: 120px; margin-left: -13px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 6px;
  border-radius: 4px 4px 0 0; background: linear-gradient(90deg, #d8b46a, #f6e3b4 45%, #cfa250);
  opacity: 0; transform: translateY(40px);
}
.stick-no { font: 700 9px/1 var(--sans); color: var(--vermilion-deep); }
.stick-name { writing-mode: vertical-rl; font-size: 13px; font-weight: 600; color: var(--vermilion-deep); max-height: 82px; overflow: hidden; letter-spacing: .05em; }
.tube.is-shaking { animation: shake .9s cubic-bezier(.36, .07, .19, .97); }
.tube.is-drawn .stick-drawn { opacity: 1; transform: translateY(-58px); transition: transform .5s cubic-bezier(.2, .9, .3, 1.2), opacity .2s; }
@keyframes shake {
  0%, 100% { transform: rotate(0); }
  10% { transform: rotate(-14deg) translateY(-4px); }
  22% { transform: rotate(12deg); }
  34% { transform: rotate(-12deg) translateY(-6px); }
  46% { transform: rotate(10deg); }
  58% { transform: rotate(-8deg) translateY(-3px); }
  70% { transform: rotate(6deg); }
  82% { transform: rotate(-3deg); }
}
.lucky-result:empty { display: none; }
.lucky-result { margin-top: 22px; text-align: left; }
.lucky-card { padding: 18px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); animation: sheet-in .35s ease-out; }
.lucky-card .card-name { font-size: 32px; }
.lucky-card .quote { margin-top: 12px; padding-left: 12px; border-left: 3px solid var(--ochre); font-size: 14.5px; color: var(--ink-2); }
.lucky-card .quote small { display: block; margin-top: 4px; color: var(--muted); font-size: 12.5px; }
.lucky-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.lucky-empty { text-align: center; color: var(--ink-2); }

/* Driver card */
.driver { width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh; margin: 0; background: #fff; }
.driver[open] { display: grid; place-items: center; }
.driver-inner { width: min(720px, 100%); padding: 32px 24px; text-align: center; }
.driver-hint { font-size: 13px; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.driver-ask { margin-top: 22px; font-size: clamp(20px, 5vw, 28px); color: var(--ink-2); }
.driver-name { margin-top: 14px; font-size: clamp(40px, 11vw, 76px); font-weight: 700; line-height: 1.12; color: var(--ink); word-break: break-word; }
.driver-addr { margin-top: 16px; font-size: clamp(22px, 6vw, 34px); line-height: 1.35; color: var(--ink); word-break: break-word; }
.driver-en { margin-top: 18px; font-size: 15px; color: var(--muted); }
.driver-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 30px; }

.noscript { padding: 20px; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (forced-colors: active) {
  .badge, .tag, .prov, .seg[aria-pressed="true"], .preset[aria-pressed="true"] { border: 1px solid CanvasText; }
  .chart-svg .dot--top { fill: Highlight; }
}
