/* ひとりめし巡礼 —— 昭和大众食堂的印刷品：伝票、駅名標、品書き、判子
   部件语言见 DESIGN.md「部件语言」 */

:root {
  --paper: #f1e8d8;        /* 生成色：页面底 */
  --paper-hi: #fbf7ee;     /* 纸面：面板、按钮、伝票 */
  --paper-lo: #ebe1cf;     /* 悬停 */
  --paper-lo2: #e0d3bb;    /* 按下 */
  --ink: #1f1a17;
  --ink-2: #5b5149;
  --ink-3: #8f857b;
  --line: rgba(31, 26, 23, .78);   /* 墨线 */
  --line-soft: rgba(31, 26, 23, .16);
  --shu: #d9432b;          /* 朱 */
  --shu-deep: #b5331e;
  --ai: #2b4c7e;           /* 藍 */
  --ai-soft: #c9d3e0;
  --closed: #b9893c;       /* 闭店提示色：取插画暖黄调深，温和的「告知」感，不用灰黑 */
  --closed-ink: #7d5a22;

  --f-gothic: "Zen Kaku Gothic New", "Hiragino Sans", "PingFang SC", "Noto Sans SC", sans-serif;
  --f-mincho: "Shippori Mincho", "Hiragino Mincho ProN", "Songti SC", serif;
  --f-hand: "Klee One", "Zen Kaku Gothic New", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SF Mono", monospace;

  --shadow: 0 10px 28px -14px rgba(31, 26, 23, .38), 0 2px 6px -2px rgba(31, 26, 23, .12);
  --deck-w: min(400px, calc(100vw - 32px));
  --panel-w: min(330px, calc(100vw - 32px));
  --route-h: 64px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --t: 180ms;
}
/* 界面文字按界面语言选字形；日文数据另标 lang="ja" */
html:lang(zh-Hans) { --f-gothic: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Zen Kaku Gothic New", sans-serif; --f-mincho: "Songti SC", "SimSun", "Noto Serif SC", "Shippori Mincho", serif; }
html:lang(zh-Hant) { --f-gothic: "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", "Zen Kaku Gothic New", sans-serif; --f-mincho: "Songti TC", "PMingLiU", "Noto Serif TC", "Shippori Mincho", serif; }
[lang="ja"] { --f-gothic: "Zen Kaku Gothic New", "Hiragino Sans", sans-serif; --f-mincho: "Shippori Mincho", "Hiragino Mincho ProN", serif; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper); color: var(--ink);
  font: 400 14px/1.6 var(--f-gothic);
  overflow: hidden; -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--ai); text-underline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--shu); outline-offset: 2px; }

/* ---------- 地图与纸纹 ---------- */
#map { position: fixed; inset: 0 0 var(--route-h) 0; background: var(--paper); }
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  opacity: .3; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .35  0 0 0 0 .28  0 0 0 0 .2  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
/* 地图控件也换成纸面 */
.maplibregl-ctrl-attrib { font: 10.5px/1.4 var(--f-gothic); background: rgba(251, 247, 238, .88) !important; }
.maplibregl-ctrl-group { background: var(--paper-hi) !important; border-radius: 0 !important; box-shadow: 0 0 0 1px var(--line), var(--shadow) !important; }
.maplibregl-ctrl-group button { width: 32px !important; height: 32px !important; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line-soft) !important; }
.maplibregl-ctrl-group button:hover { background: var(--paper-lo) !important; }
.maplibregl-popup-content { border-radius: 0; background: var(--paper-hi); box-shadow: 0 0 0 1px var(--line), var(--shadow); padding: 6px 10px; font: 12px/1.5 var(--f-gothic); }
.maplibregl-popup-content b { font-family: var(--f-mincho); }
.maplibregl-popup-content small { font-family: var(--f-mono); color: var(--ink-3); }
.maplibregl-popup-tip { display: none; }
.maplibregl-popup-content .pop-status { display: inline-block; max-width: 220px; font-size: 11px; color: var(--ink-2); }
.maplibregl-popup-content .pop-status--closed { color: var(--closed-ink); font-weight: 700; }
.maplibregl-popup-content .pop-hint { display: inline-block; margin-top: 3px; font-size: 10.5px; color: var(--shu); }

/* ---------- 刊头：片头字卡 ---------- */
.masthead {
  position: fixed; z-index: 3; top: 0; left: 0; padding: 18px 90px 30px 24px;
  pointer-events: none;
  background: radial-gradient(ellipse 115% 120% at 0 0, var(--paper) 62%, rgba(241, 232, 216, 0) 86%);
}
.title-card { display: flex; align-items: center; gap: 14px; }
.tc-seal { width: clamp(48px, 4.2vw, 58px); height: clamp(48px, 4.2vw, 58px); flex: none; }
.tc-main { margin: 0; font: 800 clamp(28px, 3vw, 42px)/1 var(--f-mincho); letter-spacing: .12em; }
.tc-roman {
  margin: 8px 0 0; padding-top: 6px; border-top: 1px solid var(--line);
  font: 500 9.5px var(--f-mono); letter-spacing: .44em; color: var(--ink-2); white-space: nowrap;
}
.masthead__sub { margin: 12px 0 0; font-size: 12.5px; color: var(--ink-2); }
.masthead__meta { display: flex; align-items: center; gap: 14px; margin-top: 4px; pointer-events: auto; font-size: 12px; }
.masthead__count { margin: 0; font: 500 12px var(--f-mono); color: var(--ink-2); }
.masthead__count b { color: var(--shu); font-weight: 500; }
.credits-btn { background: none; border: 0; padding: 0; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 12px; }
.credits-btn:hover { color: var(--ink); }
.langs { display: flex; }
.langs button {
  background: none; border: 0; padding: 0 7px; cursor: pointer; font-size: 12px; color: var(--ink-3);
  border-left: 1px solid var(--line-soft); transition: color var(--t);
}
.langs button:first-child { border-left: 0; padding-left: 0; }
.langs button:hover { color: var(--ink); }
.langs button[aria-current="true"] { color: var(--ink); font-weight: 700; text-decoration: underline 2px var(--shu); text-underline-offset: 4px; }

/* 开场：主标题揭开 → 朱印盖下 → 副题淡入（全页唯一的大动画） */
@keyframes tc-reveal { from { clip-path: inset(-10% 100% -10% 0); } to { clip-path: inset(-10% 0 -10% 0); } }
@keyframes tc-stamp {
  0% { opacity: 0; transform: scale(1.6); }
  60% { opacity: 1; transform: scale(.95); }
  100% { opacity: 1; transform: none; }
}
@keyframes tc-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes tc-rule { from { border-top-color: transparent; } to { border-top-color: var(--line); } }
.tc-main { animation: tc-reveal .9s var(--ease) .15s both; }
.tc-seal { animation: tc-stamp .5s cubic-bezier(.3, .7, .4, 1) .85s both; }
.tc-roman { animation: tc-fade .6s var(--ease) 1.1s both, tc-rule .6s var(--ease) 1.1s both; }
.masthead__sub, .masthead__meta { animation: tc-fade .6s var(--ease) 1.3s both; }

/* ---------- 通用部件：札（纸面 + 墨线） ---------- */
.chip, .btn, .search input, .pref select {
  background: var(--paper-hi); border: 1px solid var(--line); border-radius: 0;
  transition: background var(--t) var(--ease), color var(--t) var(--ease), border-color var(--t) var(--ease);
}
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; cursor: pointer; font-size: 13px; white-space: nowrap; }
.btn:hover, .chip:hover { background: var(--paper-lo); }
.btn:active, .chip:active { background: var(--paper-lo2); }
.btn svg, .search svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- 右侧品書き：筛选面板 ---------- */
.filters {
  position: fixed; z-index: 3; top: 18px; right: 18px; width: var(--panel-w);
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px 14px 14px; background: var(--paper-hi);
  box-shadow: 0 0 0 1px var(--line-soft), var(--shadow);
}
.filters::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--shu); }
.filters__row { display: flex; gap: 6px; }
.filters__top { display: flex; gap: 6px; }
.filters__top .search { flex: 1; }
.filters__body { display: none; flex-direction: column; gap: 10px; }
.filters.is-open .filters__body { display: flex; }
/* 展开时按钮写「收起」，收起时写「筛选」并带已选条件数 */
.filters__toggle .ft-hide, .filters__toggle[aria-expanded="true"] .ft-show, .filters__toggle[aria-expanded="true"] .filters__badge { display: none; }
.filters__toggle[aria-expanded="true"] .ft-hide { display: inline; }
.filters__badge {
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--shu); color: var(--paper-hi);
  font: 600 10.5px/17px var(--f-mono); text-align: center;
}
.search { position: relative; display: block; }
.search svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search input { width: 100%; padding: 6px 10px 6px 31px; outline: none; font-size: 13px; }
.search input:focus { border-color: var(--ink); box-shadow: inset 0 -2px 0 var(--shu); }
.search input::placeholder { color: var(--ink-3); }
.filters__row .pref { flex: 1; min-width: 0; }
/* 两段式排序：选中的一段墨色反白，「离我最近」选中时用藍色 */
.seg { display: flex; flex: none; border: 1px solid var(--line); background: var(--paper-hi); }
.seg button {
  display: inline-flex; align-items: center; gap: 4px; padding: 0 9px; border: 0; background: none; cursor: pointer;
  font-size: 12.5px; white-space: nowrap; transition: background var(--t), color var(--t);
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { background: var(--paper-lo); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper-hi); }
.seg #sort-near[aria-pressed="true"] { background: var(--ai); }
.seg button.is-busy { opacity: .65; cursor: progress; }
.seg svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.pref { display: block; }
.pref select {
  appearance: none; width: 100%; padding: 6px 30px 6px 10px; font-size: 13px; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%231f1a17' stroke-width='1.5' stroke-linecap='round'><path d='M1 1.5l5 5 5-5'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center;
}
.pref select.is-set {
  background-color: var(--ink); color: var(--paper-hi); border-color: var(--ink);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23fbf7ee' stroke-width='1.5' stroke-linecap='round'><path d='M1 1.5l5 5 5-5'/></svg>");
}
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { padding: 1px 8px; font-size: 12px; line-height: 1.75; cursor: pointer; }
.chip--group { font-family: var(--f-mono); font-size: 11.5px; min-width: 34px; text-align: center; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper-hi); }
.chip--genre[aria-pressed="true"] { background: var(--shu); border-color: var(--shu); }
.chips--genre-collapsed .chip--genre:nth-child(n+9):not([aria-pressed="true"]) { display: none; }
.chip--more { border-style: dashed; color: var(--ink-2); }
/* 勾选框：小方印 */
.toggle { display: flex; gap: 8px; align-items: center; font-size: 12.5px; cursor: pointer; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.toggle input {
  appearance: none; width: 15px; height: 15px; margin: 0; flex: none; cursor: pointer;
  border: 1px solid var(--line); background: var(--paper-hi); display: grid; place-items: center;
}
.toggle input::after { content: ""; width: 8px; height: 4px; border: solid var(--paper-hi); border-width: 0 0 1.5px 1.5px; transform: translateY(-1px) rotate(-45deg); }
.toggle input:checked { background: var(--shu); border-color: var(--shu); }

/* ---------- 卡片组 ---------- */
.deck {
  position: fixed; z-index: 4; left: 24px; bottom: calc(var(--route-h) + 16px);
  top: max(178px, calc(100vh - var(--route-h) - 16px - 730px));
  width: var(--deck-w); display: flex; flex-direction: column;
}
.deck__stack { position: relative; flex: 1; min-height: 0; }
.deck__handle { display: none; }

/* 一张伝票 */
.slip {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  background: var(--paper-hi); box-shadow: 0 0 0 1px var(--line-soft), var(--shadow);
  transform-origin: 50% 110%;
  transition: transform .55s var(--ease), opacity .55s var(--ease);
  cursor: pointer; overflow: hidden;
}
.slip[data-depth="1"] { transform: translate(5px, -7px) rotate(1.4deg); pointer-events: none; }
.slip[data-depth="2"] { transform: translate(-4px, -12px) rotate(-1.2deg); pointer-events: none; }
.slip[data-depth="1"] > *, .slip[data-depth="2"] > * { visibility: hidden; }
.slip.is-ghost { z-index: 5; pointer-events: none; }  /* 翻页时正在滑出去的旧卡片，压在新卡片上面 */
.slip.is-entering { animation: arrive .5s var(--ease); }
@keyframes arrive { from { transform: translate(5px, -7px) rotate(1.4deg); } }
.slip::before {  /* 上沿撕口 */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 7px; z-index: 2;
  background: radial-gradient(circle at 5px -1px, var(--paper) 3px, transparent 3.4px) 0 0 / 10px 7px repeat-x;
}

/* 駅名標 */
.sign { padding: 16px 16px 0; text-align: center; flex: none; }
.sign__plate { border: 1px solid var(--line); background: #fff; padding: 7px 8px 0; }
.sign__name { font: 800 28px/1.15 var(--f-mincho); letter-spacing: .14em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sign__local { font: 500 10.5px var(--f-mono); color: var(--ink-2); letter-spacing: .08em; min-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sign__bar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  margin: 5px -8px 0; background: var(--ai); color: #fff; font-size: 11px; line-height: 22px;
}
.sign__bar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 7px; }
.sign__bar span:first-child { text-align: left; }
.sign__bar span:last-child { text-align: right; }
.sign__bar b { font: 500 10px var(--f-mono); background: var(--paper-hi); color: var(--ai); padding: 0 7px; white-space: nowrap; }
.sign__walk { font: 500 10.5px var(--f-mono); color: var(--ink-2); margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sign__walk b { color: var(--shu); font-weight: 500; }

/* 插画 + 说明条 */
.plate { position: relative; margin: 10px 16px 0; flex: none; aspect-ratio: 16 / 9; overflow: hidden; background: var(--paper-lo); box-shadow: 0 0 0 1px var(--line-soft); }
.plate > img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 6s linear; }
.slip[data-depth="0"] .plate > img { transform: scale(1.05); }
.plate__note {
  position: absolute; left: 0; bottom: 0; display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px 3px 6px; font-size: 10.5px; letter-spacing: .04em; line-height: 1.4;
  color: var(--paper-hi); background: rgba(31, 26, 23, .58);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); cursor: help;
}
.plate__note svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.plate__tip {
  position: absolute; left: 6px; right: 6px; bottom: 28px; padding: 7px 9px;
  background: var(--paper-hi); color: var(--ink); font-size: 11.5px; line-height: 1.55;
  box-shadow: 0 0 0 1px var(--line), var(--shadow);
  opacity: 0; transform: translateY(4px); pointer-events: none; transition: opacity var(--t), transform var(--t) var(--ease);
}
.plate__note:hover + .plate__tip, .plate__note:focus-visible + .plate__tip { opacity: 1; transform: none; }

/* 点菜单本体 */
.order { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 10px 16px 14px; }
.order__head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  font: 500 10.5px var(--f-mono); color: var(--ink-2);
  border-bottom: 3px double var(--line); padding-bottom: 3px;
}
.order__head .guests { color: var(--shu); font-family: var(--f-gothic); font-weight: 700; font-size: 11px; }
.order__lines {
  flex: 1; min-height: 0; overflow: hidden; margin: 0; padding: 0; list-style: none;
  background: repeating-linear-gradient(transparent 0 25px, var(--ai-soft) 25px 26px);
  font: 400 15px/26px var(--f-hand);
  mask-image: linear-gradient(#000 78%, transparent);
}
.order__lines li { display: flex; justify-content: space-between; gap: 10px; }
.order__lines li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order__lines li span:last-child { color: var(--ink-3); font-family: var(--f-mono); font-size: 11px; }
.order__lines .empty { color: var(--ink-3); font: 13px var(--f-gothic); }
.order__foot { display: flex; align-items: flex-end; gap: 10px; padding-top: 8px; border-top: 1px dashed var(--ink-3); }
.order__shop { flex: 1; min-width: 0; }
.order__shop h2 { margin: 0; font: 800 20px/1.25 var(--f-mincho); text-wrap: pretty; word-break: auto-phrase; }
.order__shop p { margin: 2px 0 0; font-size: 11.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 场记板：卡片翻到时拍板合上一下 */
.slate { flex: none; width: 78px; height: 54px; overflow: visible; }
.slate .ink { fill: var(--ink); }
.slate .paper { fill: var(--paper-hi); }
.slate__rule line { stroke: var(--paper-hi); stroke-opacity: .5; stroke-width: .8; }
.slate text { text-anchor: middle; dominant-baseline: central; }
.slate .s-title { font: 700 7px var(--f-gothic); letter-spacing: .3em; }
.slate .s-label { font: 500 4.4px var(--f-mono); letter-spacing: .12em; text-anchor: start; opacity: .7; }
.slate .s-val { font: 600 14px var(--f-mono); }
.slate .s-date { font: 500 6.4px var(--f-mono); letter-spacing: .1em; }
.slate__stick { transform-origin: 3px 14px; transform: rotate(-2deg); }
.slip.is-entering .slate__stick, .slip.is-clap .slate__stick { animation: clap .62s cubic-bezier(.5, 0, .2, 1) .12s both; }
@keyframes clap {  /* 抬起 7° 再合上，轻轻一下 */
  0% { transform: rotate(-7deg); }
  55% { transform: rotate(-7deg); }
  85% { transform: rotate(0deg); }
  100% { transform: rotate(-2deg); }
}
/* 闭店：插画柔和模糊（保留原色），中央一张纸色告示牌 */
.slip.is-closed .plate > img { filter: blur(3.5px); transform: scale(1.1) !important; }
.slip.is-closed .plate::after { content: ""; position: absolute; inset: 0; background: rgba(251, 247, 238, .22); pointer-events: none; }
.closed-note {
  position: absolute; left: 50%; top: 50%; z-index: 2; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 18px 7px; background: rgba(251, 247, 238, .94); color: var(--closed-ink);
  box-shadow: 0 0 0 1px var(--closed), 0 6px 16px -8px rgba(31, 26, 23, .35);
  text-align: center; white-space: nowrap; pointer-events: none;
}
.closed-note b { font: 700 17px var(--f-mincho); letter-spacing: .3em; padding-left: .3em; }
html:lang(en) .closed-note b { font-size: 15px; letter-spacing: .04em; padding-left: 0; }
.closed-note span { font-size: 11px; letter-spacing: .04em; color: var(--closed-ink); opacity: .85; }

/* ---------- 半券：控制条 ---------- */
.stub {
  position: relative; display: flex; align-items: stretch; height: 42px; margin-top: 12px;
  background: var(--paper-hi); box-shadow: 0 0 0 1px var(--line-soft), var(--shadow);
}
.stub::before {  /* 和伝票之间的打孔线 */
  content: ""; position: absolute; left: 10px; right: 10px; top: -7px; height: 1px;
  background: repeating-linear-gradient(90deg, var(--ink-3) 0 3px, transparent 3px 7px); opacity: .6;
}
.stub > * + * { border-left: 1px solid var(--line-soft); }
.stub__btn {
  width: 42px; flex: none; display: grid; place-items: center; padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--ink); transition: background var(--t);
}
.stub__btn:hover, .stub__random:hover { background: var(--paper-lo); }
.stub__btn:active, .stub__random:active { background: var(--paper-lo2); }
.stub__btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
/* 自动巡礼按钮（方案 B）：小锅计时圈 + 状态文字 + 动作图标。巡礼中朱色、锅冒热气；暂停时文字转灰、▶ 朱色 */
.stub__play {
  flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px 0 7px; border: 0; background: none; cursor: pointer;
  font: 700 13px var(--f-gothic); letter-spacing: .06em; color: var(--shu); white-space: nowrap; transition: background var(--t);
}
.stub__play:hover { background: var(--paper-lo); }
.stub__play:active { background: var(--paper-lo2); }
.stub__play[aria-pressed="false"] { color: var(--ink-2); }
.stub__pot { width: 30px; height: 30px; flex: none; color: var(--ink); overflow: visible; }
.stub__pot .ring-bg { fill: none; stroke: rgba(31, 26, 23, .14); stroke-width: 2.4; }
.stub__pot .ring-fg { fill: none; stroke: var(--shu); stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 94.25; stroke-dashoffset: 94.25; transform: rotate(-90deg); transform-origin: 18px 18px; }
.stub__pot .pot, .stub__pot .steam { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.stub__pot .steam { stroke-width: 1.6; }
.stub__pot .steam path { opacity: 0; }
.stub__play[aria-pressed="true"] .steam path { animation: steam 1.8s ease-in infinite; }
.stub__play[aria-pressed="true"] .steam path:nth-child(2) { animation-delay: .6s; }
.stub__play[aria-pressed="true"] .steam path:nth-child(3) { animation-delay: 1.2s; }
.stub__play[aria-pressed="true"] .lid { animation: lid 1.4s ease-in-out infinite; transform-origin: 18px 17px; }
@keyframes steam { 0% { opacity: 0; transform: translateY(1.5px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(-2.5px); } }
@keyframes lid { 0%, 70%, 100% { transform: none; } 78% { transform: translateY(-.7px) rotate(-3deg); } 86% { transform: translateY(-.4px) rotate(2deg); } }
/* 两种状态文字叠在同一格，只显示当前那个：按钮宽度按较长的固定，切换时页码不跳 */
.stub__state { display: grid; }
.stub__state > span { grid-area: 1 / 1; }
.stub__state > span + span, .stub__state.is-paused > span:first-child { visibility: hidden; }
.stub__state.is-paused > span + span { visibility: visible; }
.stub__act { width: 12px; height: 12px; flex: none; fill: currentColor; }
.stub__play[aria-pressed="true"] .ico-play, .stub__play[aria-pressed="false"] .ico-pause { display: none; }
.stub__play[aria-pressed="false"] .ico-play { color: var(--shu); }
.stub__pos { flex: 1; display: flex; align-items: center; justify-content: center; gap: .35em; font: 500 11.5px var(--f-mono); color: var(--ink-3); letter-spacing: .04em; white-space: nowrap; }
.stub__pos b { color: var(--ink); font-weight: 500; }
.stub__random {
  display: inline-flex; align-items: center; gap: 7px; padding: 0 14px; border: 0; background: none; cursor: pointer;
  color: var(--shu); font: 700 13px var(--f-mincho); letter-spacing: .06em; white-space: nowrap; transition: background var(--t);
}
.stub__random svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 详情 ---------- */
.detail {
  position: fixed; z-index: 6; top: 0; bottom: var(--route-h); left: calc(24px + var(--deck-w) + 14px);
  width: min(390px, calc(100vw - 48px)); overflow-y: auto; padding: 22px 22px 40px;
  background: var(--paper-hi); box-shadow: 0 0 0 1px var(--line-soft), var(--shadow);
  transform: translateY(calc(100% + var(--route-h) + 40px)); visibility: hidden;
  transition: transform .45s var(--ease), visibility 0s .45s;
}
.detail.is-open { transform: none; visibility: visible; transition: transform .45s var(--ease); }
.detail::before { content: ""; position: sticky; display: block; top: -22px; margin: -22px -22px 19px; height: 3px; background: var(--shu); z-index: 2; }
.detail__close {
  position: sticky; top: 0; float: right; z-index: 1; width: 32px; height: 32px; padding: 0; justify-content: center;
}
.detail .meta { margin: 0; font: 500 11px var(--f-mono); color: var(--ink-3); }
.detail h2 { font: 800 25px/1.3 var(--f-mincho); margin: 6px 0 2px; text-wrap: pretty; word-break: auto-phrase; }
.detail .reading { color: var(--ink-3); font-size: 12px; margin: 0; }
.detail h3 {
  display: flex; align-items: center; gap: 8px; margin: 22px 0 8px;
  font: 700 11px var(--f-gothic); letter-spacing: .16em; color: var(--shu);
}
.detail h3::after { content: ""; flex: 1; border-bottom: 3px double var(--line-soft); }
.detail .ep-title { margin: 0; font: 600 15px/1.5 var(--f-mincho); }
.detail dl { display: grid; grid-template-columns: 7em 1fr; gap: 5px 8px; margin: 0; font-size: 13px; }
.detail dt { color: var(--ink-3); }
.detail dd { margin: 0; }
.detail dd small { color: var(--ink-3); font-size: 11px; }
.detail ol { margin: 0; padding-left: 1.4em; font: 400 15px/1.85 var(--f-hand); }
.detail figure { margin: 0; }
.detail figure img { width: 100%; display: block; box-shadow: 0 0 0 1px var(--line-soft); }
.detail figcaption { font-size: 11px; color: var(--ink-2); margin-top: 5px; line-height: 1.55; }
.detail .note { font-size: 12px; color: var(--ink-2); background: var(--paper); padding: 7px 9px; margin: 10px 0 0; }
.detail .links { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.detail .links a {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; font-size: 12px; color: var(--ink);
  text-decoration: none; border: 1px solid var(--line); background: var(--paper-hi); transition: background var(--t);
}
.detail .links a:hover { background: var(--paper-lo); }
.detail .links a::after { content: "↗"; font-size: 10px; color: var(--ink-3); }

/* 用餐情境：小标签 + 说明框 */
.ctx-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 1px; }
.ctx-tag { display: inline-block; padding: 0 6px; font-size: 10.5px; line-height: 1.7; color: var(--shu-deep); border: 1px solid currentColor; background: var(--paper-hi); white-space: nowrap; }
.detail__tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0 0; }
.detail__tags .ctx-tag { font-size: 11.5px; line-height: 1.75; }
.ctx-box { margin: 12px 0 0; padding: 9px 11px; background: var(--paper); border-top: 2px solid var(--shu); font-size: 12.5px; line-height: 1.65; }
.ctx-box b { display: block; font-size: 11px; letter-spacing: .14em; color: var(--shu); margin-bottom: 3px; }
.ctx-box p { margin: 0; }
.ctx-orig { margin-top: 4px !important; color: var(--ink-2); }
.ctx-orig small { color: var(--ink-3); }

/* 营业状态：长方形小印 */
.status { display: inline-block; padding: 1px 8px; font-size: 11.5px; border: 1.5px solid currentColor; letter-spacing: .04em; }
.status--open { color: var(--ai); }
.status--closed { color: var(--closed); }
.status--relocated { color: var(--shu-deep); }
.status--partial { color: var(--ai); border-style: dashed; }
.status--unknown { color: var(--ink-3); border-style: dashed; }

/* ---------- 底部路线图（时间轴） ---------- */
.route { position: fixed; z-index: 3; left: 0; right: 0; bottom: 0; height: var(--route-h); background: var(--paper-hi); box-shadow: 0 -1px 0 var(--line); }
.route__track { position: absolute; left: 28px; right: 56px; bottom: 14px; height: 38px; }
.route__line { position: absolute; left: 0; right: 0; top: 20px; height: 3px; background: var(--ai); }
.route__stop {
  position: absolute; top: 17px; width: 9px; height: 9px; margin-left: -4.5px;
  border-radius: 50%; background: var(--paper-hi); border: 1.5px solid var(--ai);
  padding: 0; cursor: pointer; transition: transform var(--t), background var(--t);
}
.route__stop:hover { transform: scale(1.5); z-index: 2; }
.route__stop.is-dim { opacity: .2; pointer-events: none; }
.route__stop.is-closed { border-color: var(--closed); }
.route__stop.is-current { background: var(--shu); border-color: var(--shu); transform: scale(1.7); z-index: 3; }
.route__label {
  position: absolute; top: 0; font: 500 10px var(--f-mono); color: var(--ink-2); white-space: nowrap;
  border-left: 1px solid var(--line); padding-left: 3px; line-height: 12px; pointer-events: none;
}
.route__label b { color: var(--ink); font-weight: 600; }
.route__tip {
  position: absolute; bottom: 32px; transform: translateX(-50%); white-space: nowrap; pointer-events: none;
  background: var(--paper-hi); box-shadow: 0 0 0 1px var(--line), var(--shadow); font-size: 11px; padding: 2px 8px;
  opacity: 0; transition: opacity var(--t);
}

/* ---------- 地图上的标记 ---------- */
.pin-current { width: 34px; height: 42px; pointer-events: none; filter: drop-shadow(0 3px 4px rgba(31, 26, 23, .3)); }
.pin-current::after {
  content: ""; position: absolute; left: 50%; bottom: -4px; width: 34px; height: 34px; margin-left: -17px;
  border: 2px solid var(--shu); border-radius: 50%; transform: scaleY(.35); animation: ripple 1.8s ease-out infinite;
}
@keyframes ripple { from { opacity: .9; transform: scaleY(.35) scale(.4); } to { opacity: 0; transform: scaleY(.35) scale(1.6); } }
.pin-label {
  position: absolute; left: 50%; bottom: 48px; transform: translateX(-50%); white-space: nowrap;
  background: var(--paper-hi); color: var(--ink); padding: 2px 9px; font: 700 12px var(--f-mincho);
  box-shadow: 0 0 0 1px var(--line), var(--shadow);
}
.pin-me { width: 14px; height: 14px; border-radius: 50%; background: var(--ai); border: 3px solid var(--paper-hi); box-shadow: 0 0 0 1.5px var(--ai), 0 0 0 8px rgba(43, 76, 126, .16); }
.pin-me span { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); white-space: nowrap; font: 700 11px var(--f-gothic); color: var(--ai); text-shadow: 0 0 4px var(--paper), 0 0 2px var(--paper); }

/* ---------- 提示、弹窗、空状态 ---------- */
.toast {
  position: fixed; z-index: 9; left: 50%; top: 18px; transform: translate(-50%, -160%);
  max-width: min(460px, calc(100vw - 32px)); padding: 11px 14px 9px;
  background: var(--paper-hi); color: var(--ink); font-size: 13px; box-shadow: 0 0 0 1px var(--line-soft), var(--shadow);
  transition: transform .3s var(--ease);
}
.toast::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--shu); }
.toast.is-on { transform: translate(-50%, 0); }
.credits { max-width: 580px; border: 0; background: var(--paper-hi); padding: 26px 30px 22px; border-radius: 0; box-shadow: 0 0 0 1px var(--line-soft), var(--shadow); }
.credits::backdrop { background: rgba(31, 26, 23, .32); }
.credits h2 { font: 800 22px var(--f-mincho); margin: 0 0 10px; padding-bottom: 6px; border-bottom: 3px double var(--line); }
.credits h3 { font-size: 12px; letter-spacing: .14em; color: var(--shu); margin: 16px 0 4px; }
.credits p { font-size: 13px; margin: 0; text-wrap: pretty; }
.credits form { margin-top: 18px; text-align: right; }
.empty-state { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; background: var(--paper-hi); box-shadow: 0 0 0 1px var(--line-soft); font-size: 13.5px; color: var(--ink-2); padding: 20px; }

/* ---------- 窄屏 ---------- */
@media (max-width: 760px) {
  :root { --route-h: 50px; --deck-w: calc(100vw - 24px); }
  .masthead { padding: 10px 14px 16px; }
  .title-card { gap: 9px; }
  .tc-seal { width: 34px; height: 34px; }
  .tc-main { font-size: 22px; }
  .tc-roman, .masthead__sub, .masthead__count, .credits-btn { display: none; }
  .masthead__meta { position: fixed; top: 18px; right: 14px; margin: 0; }
  .filters { top: 60px; left: 12px; right: 12px; width: auto; padding: 10px 8px 8px; gap: 8px; }
  .filters::before { height: 2px; }
  /* 手机：默认只留搜索 + 筛选按钮，点开再显示其余；内容多时面板内滚动 */
  .filters__toggle[aria-expanded="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper-hi); }
  /* 展开时卡片已收起让位：面板可以用到控制条上方，内容多了在面板里滚动 */
  .filters__body { display: none; gap: 8px; max-height: calc(100vh - 270px); max-height: calc(100dvh - 270px); overflow-y: auto; }
  .filters.is-open .filters__body { display: flex; }
  .deck { left: 12px; bottom: calc(var(--route-h) + 8px); top: auto; }
  .deck__stack { flex: none; height: min(420px, 50vh); }
  /* 手机：卡片可以收起，只留控制条，把地图让出来；左右滑翻页、上下滑收起展开，交给脚本 */
  .deck { touch-action: none; }
  /* 卡片顶上的小标签：箭头 + 「收起卡片 / 展开卡片」，看得懂、好按（可点范围向四周扩到约 44px 高） */
  .deck__handle {
    display: inline-flex; align-items: center; gap: 4px; position: relative; z-index: 1; align-self: center;
    height: 28px; margin-bottom: 6px; padding: 0 14px 0 10px; border: 0; border-radius: 14px;
    background: var(--paper-hi); color: var(--ink-2); box-shadow: 0 0 0 1px var(--line), var(--shadow);
    font: 500 12px var(--f-gothic); letter-spacing: .04em; cursor: pointer;
  }
  .deck__handle::after { content: ""; position: absolute; inset: -8px -18px -8px; }
  .deck__handle:active { background: var(--paper-lo2); }
  .deck__handle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: transform var(--t) var(--ease); }
  .deck.is-min .deck__handle svg { transform: rotate(180deg); }
  .deck.is-min .deck__stack { display: none; }
  .deck.is-min .stub { margin-top: 0; }
  .sign__name { font-size: 24px; }
  .plate { aspect-ratio: 5 / 2; }
  .stub { height: 40px; margin-top: 10px; }
  .stub__random span { display: none; }  /* 手机：「随便吃一家」只留图标，给巡礼按钮让位 */
  .stub__random { padding: 0 12px; }
  .route__label { display: none; }
  .detail { left: 0; right: 0; width: auto; top: 10vh; }
  .maplibregl-ctrl-bottom-right { top: 108px; bottom: auto; }  /* 署名贴在筛选条下方右侧 */
  .maplibregl-ctrl-attrib { font-size: 9.5px; }
  .maplibregl-ctrl-group { display: none; }
}

/* 矮屏手机（如 360×640）：插画再压扁一点，步行时间那一行收起（详情里有） */
@media (max-width: 760px) and (max-height: 700px) {
  .plate { aspect-ratio: 3 / 1; }
  .sign__walk { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
