:root {
  --ink: #0e2a3b;
  --ink-2: #1d4256;
  --mist: #edf1f2;
  --paper: #ffffff;
  --line: #d3dcdf;
  --muted: #4f6672;
  --brass: #d9a21b;
  --brass-hi: #f3cf63;
  --brass-deep: #8a6408;
  --claret: #8a1f3d;
  --persimmon: #b8461f;
  --roast: #6b4a33;
  --ok: #1f7a4d;
  --warn: #a3321b;

  --display: "Bricolage Grotesque", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;

  /* things that keep their own colour whatever the theme */
  --harbour: #0e2a3b;
  --on-harbour: #edf1f2;
  --toolbar-bg: rgba(237, 241, 242, .96);
  --ph: #dfe6e8;
  --best-bg: #fdf7e6;
  --on-ink-soft: #a9c0ca;
  --on-k-soft: rgba(255, 255, 255, .75);
  --arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%230e2a3b' stroke-width='2'/%3E%3C/svg%3E");
  color-scheme: light;

  --r-card: 14px;
  --r-ctl: 999px;
  --toolbar-h: 0px;
}

/* night at the harbour: the same palette with the page and ink swapped, accents lifted to stay legible */
:root[data-theme="dark"] {
  --ink: #e2ebee;
  --ink-2: #b6c9d1;
  --mist: #0b1820;
  --paper: #13252f;
  --line: #29404d;
  --muted: #93a9b3;
  --brass-deep: #e3b547;
  --claret: #e7819c;
  --persimmon: #f19566;
  --ok: #62cf98;
  --warn: #ff8f75;
  --harbour: #06121a;
  --toolbar-bg: rgba(11, 24, 32, .94);
  --ph: #1c3341;
  --best-bg: #2b2412;
  --on-ink-soft: #46606d;
  --on-k-soft: rgba(11, 24, 32, .7);
  --arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23e2ebee' stroke-width='2'/%3E%3C/svg%3E");
  color-scheme: dark;
}
:root[data-theme="dark"] .card-img img, :root[data-theme="dark"] .d-img img, :root[data-theme="dark"] .mini img { filter: brightness(.92); }

* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;
  /* keep tap targets responsive on iOS (no double-tap-zoom wait) and no grey flash */
  -webkit-tap-highlight-color: transparent;
}
button, a, input, select, label { touch-action: manipulation; }
/* while an item is open the page behind stays put; only the item scrolls */
html.locked { overflow: hidden; }
body {
  margin: 0;
  font: 16px/1.5 var(--body);
  color: var(--ink);
  background: var(--mist);
}
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 8px 12px; z-index: 100; border-radius: 8px; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }

/* ---------- masthead ---------- */
.masthead {
  background-color: var(--harbour);
  color: var(--on-harbour);
  /* harbour lights: a row of brass dots along the waterline */
  background-image: radial-gradient(circle at 50% 50%, rgba(243, 207, 99, .55) 0 1.5px, transparent 2px);
  background-size: 22px 22px;
  background-position: 0 100%;
  background-repeat: repeat-x;
}
.masthead-inner {
  max-width: 1440px; margin: 0 auto;
  padding: 36px 24px 44px;
  display: flex; flex-wrap: wrap; gap: 24px 48px; align-items: end; justify-content: space-between;
}
.masthead h1 {
  font: 800 clamp(2.4rem, 6vw, 4.6rem)/0.95 var(--display);
  letter-spacing: -0.03em;
  margin: 0 0 12px;
}
.masthead .year { color: var(--brass-hi); }
.sub { margin: 0; max-width: 46ch; color: #c7d5db; font-size: 1.05rem; }
.facts { display: grid; grid-template-columns: repeat(2, auto); gap: 10px 32px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: .8rem; color: #93acb7; }
.facts dd { margin: 0; font-weight: 700; }
.status dd { color: var(--brass-hi); }
.prefs { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-bottom: -8px; font-size: .88rem; }
.pref-seg { display: inline-flex; border: 1px solid rgba(237, 241, 242, .35); border-radius: var(--r-ctl); padding: 2px; }
.pref-seg button, .pref-theme { border: 0; background: transparent; color: var(--on-harbour); border-radius: var(--r-ctl); padding: 4px 12px; min-height: 32px; }
.pref-seg button[aria-pressed="true"] { background: var(--on-harbour); color: var(--harbour); font-weight: 700; }
.pref-theme { display: inline-flex; align-items: center; gap: 6px; border: 1px solid rgba(237, 241, 242, .35); }
.pref-theme[aria-checked="true"] { background: var(--brass-hi); border-color: var(--brass-hi); color: #2b1f00; font-weight: 700; }

/* ---------- toolbar ---------- */
.toolbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--toolbar-bg);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.toolbar-row, .chips-row, .filters {
  max-width: 1440px; margin: 0 auto; padding: 0 24px;
}
.toolbar-row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; padding-top: 14px; }
.tabs { display: flex; gap: 4px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 4px; }
.tab {
  border: 0; background: transparent; border-radius: var(--r-ctl);
  padding: 6px 14px; font-weight: 700; white-space: nowrap;
}
.tab .n { font-weight: 400; color: var(--muted); margin-left: 4px; font-size: .9em; }
.tab[aria-selected="true"] { background: var(--ink); color: var(--mist); }
.tab[aria-selected="true"] .n { color: var(--on-ink-soft); }
.tab.k-food[aria-selected="true"], .tab.k-drink[aria-selected="true"] { background: var(--k); }
.tab.k-food[aria-selected="true"] .n, .tab.k-drink[aria-selected="true"] .n { color: var(--on-k-soft); }
.search {
  flex: 1 1 280px; display: flex; align-items: center; gap: 8px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-ctl);
  padding: 0 14px; min-height: 44px; color: var(--muted);
}
.search:focus-within { border-color: var(--ink); }
.search input { border: 0; outline: 0; flex: 1; min-width: 0; background: transparent; color: var(--ink); padding: 10px 0; }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
select {
  appearance: none; border: 1px solid var(--line); background: var(--paper) var(--arrow) no-repeat right 12px center;
  border-radius: 10px; padding: 8px 34px 8px 12px; min-height: 40px; max-width: 100%;
}
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--paper); }
.seg button { border: 0; background: transparent; padding: 8px 12px; min-height: 40px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink-2); color: var(--mist); }

.chips-row { display: flex; flex-wrap: wrap; gap: 8px 22px; padding-top: 10px; padding-bottom: 12px; }
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-group > span:not(.chip-label) { display: contents; }
.chip-label { font-size: .85rem; color: var(--muted); margin-right: 2px; }
.chip {
  border: 1px solid var(--line); background: var(--paper); border-radius: var(--r-ctl);
  padding: 4px 12px; min-height: 32px; font-size: .92rem;
}
.chip[aria-pressed="true"] { background: var(--brass); border-color: var(--brass-deep); color: #2b1f00; font-weight: 700; }
.filters {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px;
  padding-bottom: 16px; align-items: end;
}
.filters[hidden] { display: none; }
.filters label { display: grid; gap: 4px; font-size: .85rem; color: var(--muted); }
.filters select { width: 100%; color: var(--ink); font-size: 1rem; }

.btn, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 10px; padding: 8px 14px; min-height: 40px; font-weight: 700; text-decoration: none;
}
.btn { background: var(--ink); color: var(--mist); border: 1px solid var(--ink); }
.btn-ghost { background: var(--paper); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-ghost.danger { color: var(--warn); }
#filter-count:not(:empty) { background: var(--brass); color: #2b1f00; border-radius: 99px; padding: 0 7px; font-size: .8rem; }

/* ---------- layout ---------- */
.layout {
  max-width: 1440px; margin: 0 auto; padding: 20px 24px 40px;
  display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start;
}
.result-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.result-line p { margin: 0; color: var(--muted); }

/* ---------- token coin ---------- */
.coin {
  --s: 46px;
  width: var(--s); height: var(--s); border-radius: 50%;
  display: inline-grid; place-items: center; flex: none;
  background: radial-gradient(circle at 35% 30%, var(--brass-hi), var(--brass) 55%, #b9850d);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .35), inset 0 0 0 5px rgba(138, 100, 8, .55), 0 1px 0 rgba(14, 42, 59, .35);
  color: #2b1f00;
  font: 800 1.2rem/1 var(--display);
}
.coin b { font-weight: 800; }
.coin small { display: block; font: 700 .55rem/1 var(--body); letter-spacing: .02em; margin-top: 1px; }
.coin-sm { --s: 34px; font-size: .95rem; }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(188px, 1fr)); gap: 16px; }
.results:focus { outline: none; }
.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--paper); border-radius: var(--r-card); overflow: hidden;
  border: 1px solid var(--line);
  border-top: 4px solid var(--k);
}
.k-food { --k: var(--persimmon); }
.k-drink { --k: var(--claret); }
.card.in-plan { border-color: var(--brass-deep); box-shadow: 0 0 0 2px var(--brass); border-top-color: var(--k); }
.card.over .card-img img { filter: grayscale(.8); opacity: .55; }
.card-img { border: 0; padding: 0; background: var(--ph); aspect-ratio: 1; display: block; width: 100%; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-img.noimg::after { content: "No photo"; display: grid; place-items: center; height: 100%; color: var(--muted); font-size: .85rem; }
.card .coin { position: absolute; top: 10px; left: 10px; }
.card-body { padding: 10px 12px 4px; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.card-name {
  margin: 0; font: 700 1rem/1.25 var(--display); letter-spacing: -0.01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-exh { margin: 0; font-size: .85rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-desc {
  margin: 4px 0 0; font-size: .8rem; line-height: 1.4; color: var(--ink-2);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { margin: auto 0 0; padding-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .8rem; }
.booth { font-weight: 700; background: var(--mist); border-radius: 6px; padding: 1px 7px; }
.kind { color: var(--k); font-weight: 700; }
.ctrl { padding: 8px 12px 12px; }
.add {
  width: 100%; min-height: 40px; border-radius: 10px; border: 1.5px solid var(--ink);
  background: var(--paper); font-weight: 700;
}
.add:hover { background: var(--ink); color: var(--mist); }
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 6px; border-radius: 10px; background: var(--brass); padding: 3px; min-height: 40px; }
.stepper button { width: 34px; height: 34px; border-radius: 8px; border: 0; background: rgba(255, 255, 255, .65); color: #2b1f00; font-weight: 800; font-size: 1.1rem; }
.stepper button:hover { background: #fff; }
.stepper output { font-weight: 800; color: #2b1f00; min-width: 2ch; text-align: center; }
.stepper .sub-tok { font-weight: 400; font-size: .85rem; }

/* food and drinks sections */
.course { scroll-margin-top: var(--toolbar-h); }
.course + .course { margin-top: 44px; }
.course-head {
  position: sticky; top: var(--toolbar-h); z-index: 5;
  display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline;
  background: var(--mist); padding: 10px 0 12px; margin-bottom: 4px;
}
.course-head h2 {
  margin: 0; font: 800 1.7rem/1 var(--display); letter-spacing: -0.02em; color: var(--k);
  border-left: 6px solid var(--k); padding-left: 10px;
}
.jump { margin-left: auto; border: 1px solid var(--line); background: var(--paper); border-radius: var(--r-ctl); padding: 4px 12px; min-height: 32px; font-size: .9rem; }
.jump:hover { border-color: var(--ink); }

/* exhibitor view */
.group { grid-column: 1 / -1; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px; }
.group-head { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; margin-bottom: 12px; }
.group-head h3 { margin: 0; font: 700 1.2rem/1.2 var(--display); }
.group-head .booth { font-size: .9rem; }
.group .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.group .card { border-top-width: 3px; }

.empty { text-align: center; padding: 60px 20px; }
.empty p { font: 700 1.3rem var(--display); }
.sentinel { height: 1px; }

/* ---------- plan panel ---------- */
.plan {
  position: sticky; top: calc(var(--toolbar-h) + 16px);
  max-height: calc(100vh - var(--toolbar-h) - 32px); overflow: auto;
  background: var(--paper); border: 1px solid var(--line); border-radius: 18px;
}
.plan-bar { display: none; }
.plan-body { padding: 20px; }
.plan-head { display: flex; gap: 16px; align-items: center; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.stack { position: relative; width: 64px; height: 64px; flex: none; }
.stack .coin { --s: 56px; position: absolute; left: 4px; transition: transform .25s ease; }
.plan-total { margin: 0; font: 800 2.2rem/1 var(--display); letter-spacing: -0.02em; }
.plan-hkd { margin: 4px 0 0; color: var(--muted); }
.bump { animation: bump .3s ease; }
@keyframes bump { 40% { transform: scale(1.12); } }
.plan-sec { padding: 16px 0; border-bottom: 1px solid var(--line); }
.plan-sec h2 { margin: 0 0 10px; font: 700 1.05rem var(--display); }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; }
.have { display: grid; gap: 6px; }
.have input { width: 120px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; min-height: 40px; }
.have-msg { margin: 0; font-size: .9rem; color: var(--muted); }
.have-msg.ok { color: var(--ok); font-weight: 700; }
.have-msg.bad { color: var(--warn); font-weight: 700; }
.calc-ctrls { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; margin-bottom: 12px; }
.people { display: flex; gap: 10px; align-items: center; }
.people .stepper { background: var(--mist); min-height: 36px; }
.people .stepper output { color: var(--ink); }
.people .stepper button { background: var(--paper); color: var(--ink); }
.check { display: flex; gap: 8px; align-items: center; font-size: .95rem; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.option { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 8px; }
.option.best { border: 2px solid var(--brass); background: var(--best-bg); }
.option-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.option-top strong { font-family: var(--display); font-size: 1.05rem; }
.option-price { font: 800 1.25rem var(--display); white-space: nowrap; }
.option p { margin: 4px 0 0; font-size: .88rem; color: var(--muted); }
.tag-best { display: inline-block; background: var(--brass); color: #2b1f00; font-size: .75rem; font-weight: 700; border-radius: 6px; padding: 0 6px; margin-bottom: 4px; }
.note { font-size: .88rem; background: var(--mist); border-radius: 10px; padding: 8px 10px; margin: 8px 0 0; }

.block { margin-top: 12px; }
.block:first-child { margin-top: 0; }
.block h4 { margin: 0 0 6px; font: 700 .95rem var(--display); display: flex; justify-content: space-between; }
.plan-course + .plan-course { margin-top: 20px; }
.plan-course-head {
  display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 10px; padding-bottom: 4px;
  font: 800 1.1rem var(--display); color: var(--k); border-bottom: 2px solid var(--k);
}
.plan-course-head span + span { font-size: .9rem; }
.split { padding: 14px 0 16px; border-bottom: 1px solid var(--line); }
.split[hidden] { display: none; }
.split-bar { display: flex; gap: 2px; height: 10px; border-radius: 99px; overflow: hidden; background: var(--mist); }
.split-bar span { background: var(--k); }
.split-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 0; }
.split-legend dt { font-weight: 700; color: var(--k); display: flex; align-items: center; gap: 6px; }
.split-legend dt::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--k); }
.split-legend dd { margin: 0; font-size: .9rem; }
.stop { border-left: 3px solid var(--line); padding: 4px 0 6px 12px; margin-bottom: 6px; }
.stop-head { font-size: .85rem; color: var(--muted); }
.stop-head .booth { color: var(--ink); }
.line { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: start; padding: 4px 0; }
.line input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--ok); }
.line label { cursor: pointer; line-height: 1.3; }
.line.done label { text-decoration: line-through; color: var(--muted); }
.line-tok { font-weight: 700; white-space: nowrap; font-size: .9rem; }
.line-x { border: 0; background: none; color: var(--muted); padding: 0 4px; font-size: 1.1rem; line-height: 1; }
.plan-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 16px; }
.fine { font-size: .78rem; color: var(--muted); margin: 14px 0 0; }

/* ---------- dialog ---------- */
dialog {
  border: 0; padding: 0; border-radius: 20px; width: min(860px, calc(100vw - 24px));
  max-height: calc(100vh - 24px); /* fallback for Safari < 15.4 */
  max-height: calc(100dvh - 24px); color: var(--ink); background: var(--paper);
  overflow-y: auto; overscroll-behavior: contain;
}
dialog::backdrop { background: rgba(14, 42, 59, .6); }
.d-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.d-img { background: var(--ph); aspect-ratio: 1; position: sticky; top: 0; align-self: start; border-top: 6px solid var(--k); }
/* the photo stays in view while a long description scrolls beside it */
.d-img img { width: 100%; height: 100%; object-fit: cover; }
.d-img .coin { --s: 64px; position: absolute; top: 14px; left: 14px; font-size: 1.5rem; }
.d-info { padding: 22px 24px 24px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.d-close { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--paper); font-size: 1.4rem; box-shadow: 0 1px 4px rgba(14,42,59,.25); z-index: 2; }
.d-info h2 { margin: 0; font: 800 1.6rem/1.15 var(--display); letter-spacing: -0.02em; padding-right: 30px; }
.d-exh { margin: 0; font-weight: 700; }
.d-exh a { font-weight: 400; margin-left: 6px; }
.d-course { margin: 0 0 -6px; font-weight: 700; font-size: .9rem; color: var(--k); }
.d-desc { margin: 0; line-height: 1.55; }
.d-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; font-size: .95rem; }
.d-facts dt { color: var(--muted); }
.d-facts dd { margin: 0; }
.d-more h3 { margin: 6px 0 8px; font: 700 1rem var(--display); }
.d-more-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.mini { border: 1px solid var(--line); border-top: 3px solid var(--k); border-radius: 10px; background: var(--paper); padding: 0; text-align: left; overflow: hidden; font-size: .78rem; }
.mini img { aspect-ratio: 1; object-fit: cover; width: 100%; background: var(--ph); }
.mini span { display: block; padding: 4px 6px; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini b { color: var(--brass-deep); }
.mini.in { box-shadow: 0 0 0 2px var(--brass); }
.d-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.d-actions .ctrl { padding: 0; min-width: 180px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--mist); padding: 10px 16px; border-radius: 10px; z-index: 60; transition: .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.foot { max-width: 1440px; margin: 0 auto; padding: 0 24px 40px; font-size: .85rem; color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding-bottom: 96px; }
  .plan {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 40;
    max-height: 86vh; border-radius: 18px 18px 0 0; border-bottom: 0; overscroll-behavior: contain;
    padding-bottom: env(safe-area-inset-bottom); /* clear the home indicator */
    box-shadow: 0 -6px 24px rgba(14, 42, 59, .18);
  }
  .plan-bar {
    display: flex; width: 100%; align-items: center; gap: 12px; text-align: left;
    border: 0; background: var(--paper); padding: 12px 18px; position: sticky; top: 0; z-index: 1;
    border-bottom: 1px solid var(--line);
  }
  .plan-bar-text { flex: 1; min-width: 0; }
  .plan-bar-text span { color: var(--muted); font-size: .9rem; display: block; }
  .plan-bar-cta { font-weight: 700; background: var(--ink); color: var(--mist); border-radius: 8px; padding: 6px 12px; }
  .plan-body { display: none; }
  .plan.open .plan-body { display: block; }
  .toast { bottom: calc(90px + env(safe-area-inset-bottom)); }
}
@media (max-width: 720px) {
  .masthead-inner { padding: 24px 16px 34px; }
  .facts { grid-template-columns: 1fr 1fr; gap: 8px 16px; font-size: .92rem; }
  .toolbar-row, .chips-row, .filters, .layout, .foot { padding-left: 14px; padding-right: 14px; }
  /* on phones the filter bar would cover a third of the screen, so let it scroll away */
  .toolbar { position: static; }
  .tabs, .chips-row { scrollbar-width: none; }
  .tabs::-webkit-scrollbar, .chips-row::-webkit-scrollbar { display: none; }
  .tabs { width: 100%; overflow-x: auto; }
  .toolbar-actions { width: 100%; }
  .toolbar-actions select { flex: 1; }
  #surprise { white-space: nowrap; }
  .tab { flex: 1; padding: 6px 8px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .group .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card .coin { --s: 38px; font-size: 1rem; top: 6px; left: 6px; }
  .card-body { padding: 8px 10px 2px; }
  .card-desc { -webkit-line-clamp: 2; }
  .course-head h2 { font-size: 1.4rem; }
  .ctrl { padding: 6px 10px 10px; }
  .chips-row { flex-wrap: nowrap; overflow-x: auto; }
  .chip-group { flex-wrap: nowrap; }
  .chip { white-space: nowrap; }
  .d-wrap { grid-template-columns: 1fr; }
  .d-img { aspect-ratio: 4 / 3; position: relative; }
}
/* Chinese text: no tight tracking, a touch more leading */
:lang(zh) h1, :lang(zh) h2, :lang(zh) h3, :lang(zh) .plan-total { letter-spacing: 0; }
:lang(zh) .card-desc, :lang(zh) .d-desc { line-height: 1.6; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- festival map ---------- */
.map-dlg {
  width: calc(100vw - 24px); height: calc(100vh - 24px); /* fallback for Safari < 15.4 */
  height: calc(100dvh - 24px); max-width: none; max-height: none;
  overflow: hidden; display: grid; grid-template-rows: auto minmax(0, 1fr);
}
.map-dlg:not([open]) { display: none; }
.map-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 12px 64px 12px 18px; position: relative; border-bottom: 1px solid var(--line); }
.map-top h2 { margin: 0; font: 800 1.3rem var(--display); }
:lang(zh) .map-top h2 { letter-spacing: 0; }
.map-note { margin: 0; font-size: .9rem; }
.map-close { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); font-size: 1.4rem; }
.map-view { position: relative; overflow: hidden; touch-action: none; background: #c472b1; cursor: grab; user-select: none; -webkit-user-select: none; }
.map-view:active { cursor: grabbing; }
.map-layer { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.map-layer img { width: 3000px; height: 1893px; max-width: none; pointer-events: none; }
:root[data-theme="dark"] .map-layer img { filter: brightness(.85); }
.map-pins { position: absolute; inset: 0; pointer-events: none; }
.pin {
  position: absolute; left: 0; top: 0; pointer-events: auto;
  min-width: 30px; height: 30px; padding: 0 7px; border-radius: 99px;
  border: 2px solid #fff; background: var(--k); color: #fff;
  font: 800 .85rem/1 var(--display); box-shadow: 0 2px 6px rgba(14, 42, 59, .45);
}
.pin.k-food { --k: #b8461f; }
.pin.k-drink { --k: #8a1f3d; }
.pin.mixed { background: linear-gradient(135deg, #b8461f 50%, #8a1f3d 50%); }
.pin.done { background: #4f6672; }
.pin.bare { min-width: 18px; height: 18px; padding: 0; background: #fff; border: 3px solid #4f6672; box-shadow: 0 1px 4px rgba(14, 42, 59, .4); }
.sheet-none { margin: 2px 0 0; font-size: .88rem; }
.pin.on { z-index: 2; box-shadow: 0 0 0 4px var(--brass-hi), 0 2px 8px rgba(14, 42, 59, .5); }
.pin.focus::after {
  content: ""; position: absolute; inset: -9px; border-radius: 99px; border: 3px solid var(--brass-hi);
  animation: ping 1.4s ease-out infinite;
}
@keyframes ping { from { transform: scale(.7); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
.map-zoom { position: absolute; right: 12px; bottom: 12px; display: grid; gap: 6px; z-index: 3; }
.map-zoom button {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  font: 800 1.3rem/1 var(--display); display: grid; place-items: center; box-shadow: 0 1px 4px rgba(14, 42, 59, .25);
}
.map-sheet {
  position: absolute; left: 12px; bottom: 12px; z-index: 3; width: min(380px, calc(100% - 78px)); max-height: calc(100% - 24px);
  overflow: auto; overscroll-behavior: contain; background: var(--paper); border-radius: 14px; padding: 12px 14px;
  box-shadow: 0 4px 18px rgba(14, 42, 59, .35); cursor: auto;
}
.map-sheet[hidden] { display: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: start; gap: 8px; margin-bottom: 6px; }
.sheet-head h3 { margin: 0; font: 800 1.1rem var(--display); }
.sheet-item { display: grid; grid-template-columns: minmax(0, 1fr) 132px; gap: 8px; align-items: center; padding: 4px 0; border-top: 1px solid var(--line); }
.sheet-name { border: 0; background: none; padding: 4px 0; text-align: left; line-height: 1.3; }
.sheet-name b { color: var(--k); margin-right: 4px; }
.sheet-item .ctrl { padding: 0; }
.sheet-item .add, .sheet-item .stepper { min-height: 34px; }
.sheet-item .stepper button { width: 28px; height: 28px; }
.booth-btn { border: 0; cursor: pointer; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; color: var(--ink); }
@media (max-width: 720px) {
  .map-dlg { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; }
  .map-top { padding: 10px 60px 10px 14px; gap: 6px 12px; }
  .map-note { width: 100%; order: 3; }
  .map-sheet { left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); width: auto; max-height: 48%; }
  .map-zoom { bottom: auto; top: calc(10px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right)); }
}
/* you are here: a dot with its GPS accuracy as a soft circle */
.map-me { position: absolute; left: 0; top: 0; z-index: 2; pointer-events: none; }
.map-me[hidden] { display: none; }
.map-me::before {
  content: ""; position: absolute; width: calc(var(--r) * 2); height: calc(var(--r) * 2); left: calc(var(--r) * -1); top: calc(var(--r) * -1);
  border-radius: 50%; background: rgba(26, 115, 232, .18); border: 1px solid rgba(26, 115, 232, .5);
}
.map-me span { position: absolute; width: 18px; height: 18px; left: -9px; top: -9px; border-radius: 50%; background: #1a73e8; border: 3px solid #fff; box-shadow: 0 1px 5px rgba(0, 0, 0, .45); }
#locate[aria-pressed="true"] { background: #1a73e8; color: #fff; border-color: #1a73e8; }
.fix-spot {
  position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 3;
  border: 0; border-radius: 99px; padding: 8px 14px; background: var(--paper); color: var(--ink); font-weight: 700; font-size: .88rem;
  box-shadow: 0 2px 8px rgba(14, 42, 59, .3); white-space: nowrap;
}
.fix-spot[hidden] { display: none; }
.map-view.fixing { cursor: crosshair; }
.map-view.fixing .fix-spot { background: #1a73e8; color: #fff; }
