/* Cashback Hub
   One bold element: the yellow shelf-ticket that carries the best rate.
   Everything else is navy ink on cool paper, quiet and dense. */

:root {
  --ink: #15233f;
  --ink-2: #33415c;
  --muted: #5d6878;
  --paper: #f2f4f7;
  --surface: #ffffff;
  --line: #dde2ea;
  --line-strong: #c4ccd8;
  --tag: #ffd43b;
  --tag-ink: #1d1a05;
  --go: #0b6e52;
  --go-hover: #085a43;
  --go-ink: #ffffff;
  --spark-hit: #10b981;
  --up: #0b7a5a;
  --down: #a63a22;
  --hero: #15233f;
  --hero-ink: #ffffff;
  --hero-muted: #b9c3d6;
  --focus: #2f6fe4;
  --hit-bg: #fff7d1;
  --track: #e3e7ee;
  --radius-s: 6px;
  --radius-m: 10px;
  --shadow-pop: 0 12px 32px rgba(21, 35, 63, .18);
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --w: 1120px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e8ecf3; --ink-2: #c7cfdd; --muted: #98a3b6;
    --paper: #0d1424; --surface: #151f35; --line: #24304a; --line-strong: #33415f;
    --go: #2fbf8d; --go-hover: #4fd3a3; --go-ink: #06241a; --spark-hit: #34d399;
    --up: #4fd3a3; --down: #f08a6f;
    --hero: #0a1020; --hero-ink: #f1f4f9; --hero-muted: #98a3b6;
    --focus: #7aa7ff; --shadow-pop: 0 12px 32px rgba(0, 0, 0, .5);
    --hit-bg: #2b2a14; --track: #2a3754;
    color-scheme: dark;
  }
  :root:not([data-theme="light"]) .trend { --spark-hit-fill: .28; }
}
:root[data-theme="dark"] .trend { --spark-hit-fill: .28; }
:root[data-theme="dark"] {
  --ink: #e8ecf3; --ink-2: #c7cfdd; --muted: #98a3b6;
  --paper: #0d1424; --surface: #151f35; --line: #24304a; --line-strong: #33415f;
  --go: #2fbf8d; --go-hover: #4fd3a3; --go-ink: #06241a; --spark-hit: #34d399;
  --up: #4fd3a3; --down: #f08a6f;
  --hero: #0a1020; --hero-ink: #f1f4f9; --hero-muted: #98a3b6;
  --focus: #7aa7ff; --shadow-pop: 0 12px 32px rgba(0, 0, 0, .5);
  --hit-bg: #2b2a14; --track: #2a3754;
  color-scheme: dark;
}

/* ------------------------------------------------------------ base */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* iPhone / iPad: follow the system text size (Dynamic Type) — the home-screen app has no aA menu.
   iOS only: on macOS Safari -apple-system-body is 13px. Layout sizes are in rem so they grow with it. */
@supports (font: -apple-system-body) and (-webkit-touch-callout: none) {
  html { font: -apple-system-body; }
}
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
}
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
p { margin: 0; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.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(--surface); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }

.muted { color: var(--muted); }
.small { font-size: .875rem; }

.wrap { max-width: var(--w); margin: 0 auto; padding: 32px 16px 64px; }
.wrap--narrow { max-width: 640px; }

/* ------------------------------------------------------------ ticket */

.ticket {
  --notch: 12px;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-width: 5.6rem;
  padding: 6px 14px 6px calc(var(--notch) + 12px);
  background: var(--tag);
  color: var(--tag-ink);
  clip-path: polygon(var(--notch) 0, 100% 0, 100% 100%, var(--notch) 100%, 0 50%);
  -webkit-mask: radial-gradient(circle at calc(var(--notch) + 3px) 50%, transparent 3px, #000 3.5px);
          mask: radial-gradient(circle at calc(var(--notch) + 3px) 50%, transparent 3px, #000 3.5px);
  line-height: 1;
  white-space: nowrap;
}
.ticket__pre {
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .01em;
  margin-bottom: 2px;
}
.ticket__num {
  font-weight: 850;
  font-stretch: 68%;
  font-size: 1.5rem;
  letter-spacing: -.01em;
}
.ticket__eq { font-size: .75rem; font-weight: 600; margin-top: 3px; }

.ticket--lg { --notch: 16px; padding: 10px 20px 10px calc(var(--notch) + 16px); }
.ticket--lg .ticket__num { font-size: 2.5rem; }
.ticket--xl { --notch: 22px; padding: 14px 28px 16px calc(var(--notch) + 20px); }
.ticket--xl .ticket__num { font-size: clamp(3.2rem, 9vw, 5.25rem); letter-spacing: -.02em; }
.ticket--xl .ticket__pre { font-size: .9375rem; margin-bottom: 4px; }
.ticket--xl .ticket__eq { font-size: 1rem; margin-top: 6px; }
.ticket--lg, .ticket--xl {
  -webkit-mask: radial-gradient(circle at calc(var(--notch) + 4px) 50%, transparent 5px, #000 5.5px);
          mask: radial-gradient(circle at calc(var(--notch) + 4px) 50%, transparent 5px, #000 5.5px);
}

/* ------------------------------------------------------------ buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1.5px solid var(--go);
  border-radius: var(--radius-s);
  background: var(--go);
  color: var(--go-ink);
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.btn:hover { background: var(--go-hover); border-color: var(--go-hover); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--surface); border-color: var(--ink-2); }
.btn--big { min-height: 52px; padding: 12px 24px; font-size: 1.0625rem; }
.linklike {
  background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}

.pill {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--tag);
  color: var(--tag-ink);
  font-size: .75rem;
  font-weight: 650;
  vertical-align: 1px;
}
.pill--quiet { background: transparent; color: var(--muted); border: 1px solid var(--line-strong); }
.pill--ends { background: transparent; color: var(--down); border: 1px solid currentColor; }

/* ------------------------------------------------------------ header */

.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
  padding-top: env(safe-area-inset-top); }  /* home-screen app: status bar overlays the page (black-translucent) */
.page-home .top { background: var(--hero); border-color: transparent; color: var(--hero-ink); position: static; }
.top__inner {
  max-width: var(--w); margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 20px;
}
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; flex: none; }
.brand__tag {
  width: 22px; height: 16px; background: var(--tag);
  clip-path: polygon(6px 0, 100% 0, 100% 100%, 6px 100%, 0 50%);
}
.brand__word { font-weight: 850; font-stretch: 72%; font-size: 1.375rem; letter-spacing: -.01em; }
.top__nav { margin-left: auto; display: flex; gap: 20px; align-items: center; font-size: .9375rem; }
.top__nav a { text-decoration: none; }
.top__nav a:hover, .top__nav .linklike:hover { text-decoration: underline; text-underline-offset: 3px; }
.top__nav .linklike { text-decoration: none; }
.top__nav { flex: none; }
.top__nav > a { white-space: nowrap; }
.navmore { position: relative; }
.navmore summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
}
.navmore summary::-webkit-details-marker { display: none; }
.navmore summary:hover { text-decoration: underline; text-underline-offset: 3px; }
.navmore summary svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.navmore[open] summary svg { transform: rotate(180deg); }
.navmore__menu {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 40; min-width: 200px;
  display: grid; padding: 6px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-m); box-shadow: var(--shadow-pop);
}
.navmore__menu a, .navmore__menu button {
  display: block; width: 100%; padding: 9px 12px; border: 0; background: none; border-radius: var(--radius-s);
  text-align: left; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.navmore__menu a:hover, .navmore__menu button:hover { background: var(--paper); text-decoration: none; }
.navmore__menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }

/* ------------------------------------------------------------ search */

.search { position: relative; }
.search input {
  width: 100%;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  border-radius: var(--radius-s);
}
/* 自己的清空按钮（iOS 自带的 × 时有时无），隐掉浏览器自带的免得出两个 */
.search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search__clear {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0;
  border: 0; background: none; color: var(--muted); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.search__clear[hidden] { display: none; }
.search__clear svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.search__clear:hover { color: var(--ink); }
.search--compact input { padding-right: 44px; }
.filter { max-width: 420px; margin-bottom: 14px; }
.row[hidden] { display: none !important; }
.search--hero .search__clear { position: static; transform: none; flex: none; width: 44px; height: 44px; }
.search--compact { flex: 1; min-width: 200px; max-width: 420px; }
.search--compact input { height: 40px; padding: 0 44px 0 12px; }

.search--hero {
  display: flex; align-items: center;
  max-width: 720px;
  background: var(--surface);
  border-radius: var(--radius-m);
  padding: 6px;
  box-shadow: var(--shadow-pop);
}
.search--hero input { border: 0; height: 52px; padding: 0 12px 0 44px; font-size: 1.125rem; color: var(--ink); }
.search--hero input:focus-visible { outline: none; }
.search--hero:focus-within { outline: 3px solid var(--tag); outline-offset: 2px; }
.search__icon {
  position: absolute; left: 18px; top: 50%; transform: translateY(-50%);
  fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round;
}
.search__go { flex: none; min-height: 52px; }

.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  margin: 0; padding: 6px; list-style: none;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-m);
  box-shadow: var(--shadow-pop);
  z-index: 30;
  max-height: min(70vh, 520px); overflow-y: auto;
}
.suggest a {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px;
  padding: 8px 10px; border-radius: var(--radius-s); text-decoration: none;
}
.suggest a[aria-selected="true"], .suggest a:hover { background: var(--paper); }
.suggest__item { display: flex; align-items: center; gap: 2px; }
.suggest__item > a { flex: 1; min-width: 0; }
.suggest__item > .fav { flex: none; }
.suggest__name { font-weight: 600; display: block; }
.suggest__meta { font-size: .8125rem; color: var(--muted); display: block; }
.suggest .ticket { min-width: 4.6rem; }
.suggest .ticket__num { font-size: 1.25rem; }
.suggest__all { display: block !important; text-align: center; font-size: .875rem; color: var(--muted); }
.suggest__empty { padding: 10px; color: var(--muted); font-size: .9375rem; }

/* ------------------------------------------------------------ hero (home) */

.hero { background: var(--hero); color: var(--hero-ink); }
.hero__inner { max-width: var(--w); margin: 0 auto; padding: 28px 16px 36px; }
.hero__title {
  font-weight: 850;
  font-stretch: 70%;
  font-size: clamp(2.4rem, 6.4vw, 4.75rem);
  line-height: .98;
  letter-spacing: -.015em;
  max-width: 19ch;
  margin-bottom: 28px;
}
.hero__sub { margin-top: 16px; color: var(--hero-muted); font-size: .9375rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 18px; }
.chips__label { color: var(--hero-muted); font-size: .875rem; margin-right: 4px; }
.chip {
  display: inline-block; padding: 5px 12px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .28); color: var(--hero-ink);
  text-decoration: none; font-size: .875rem;
}
.chip:hover { background: rgba(255, 255, 255, .1); }
/* 页面内的筛选条（/in-store 按州）：浅底版本 */
.chips--page { margin: 0 0 18px; }
.chips--page .chip { border-color: var(--line-strong); color: var(--ink); }
.chips--page .chip:hover { background: var(--line); }
.chips--page .chip.is-on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.chip__n { opacity: .65; font-size: .8125rem; }

/* ------------------------------------------------------------ home layout */

.home {
  max-width: var(--w); margin: 0 auto; padding: 36px 16px 64px;
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 40px; align-items: start;
}
.home__aside { position: sticky; top: 20px; display: grid; gap: 16px; }

.block + .block { margin-top: 40px; }
.block__title { font-size: 1.375rem; font-weight: 750; margin-bottom: 4px; }
.block__hint { color: var(--muted); font-size: .9375rem; margin-bottom: 14px; max-width: 70ch; }
.block__title + .list, .block__title + .offers { margin-top: 14px; }
/* collapsible sections (app.js wraps the title in a button and the rest in .collapse__body) */
.collapse__btn {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 0;
  background: none; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.collapse__chev { flex: none; margin-left: auto; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.collapse__btn:hover .collapse__chev { stroke: var(--ink); }
.is-collapsed .collapse__chev { transform: rotate(-90deg); }
.collapse__body > .list:first-child, .collapse__body > .offers:first-child { margin-top: 14px; }
.block.is-collapsed + .block { margin-top: 20px; }
.page-title { font-size: clamp(1.6rem, 3.6vw, 2.25rem); font-weight: 800; font-stretch: 80%; margin-bottom: 18px; }
/* 页面标题 + "?"：说明默认收起，点 ? 才展开（gift cards / in-store） */
.page-head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.page-head .page-title { margin-bottom: 0; }
.promo-short { display: none; }
.info-btn { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface); color: var(--muted); font-family: inherit; font-size: .9375rem; font-weight: 700; line-height: 1; padding: 0; cursor: pointer; position: relative; }
.info-btn::after { content: ""; position: absolute; inset: -8px; }
.info-btn:hover, .info-btn[aria-expanded="true"] { color: var(--ink); border-color: var(--ink-2); }
.lede { font-size: 1.0625rem; color: var(--ink-2); max-width: 62ch; margin-bottom: 24px; }
.empty { color: var(--ink-2); max-width: 60ch; }

/* store list */
.list {
  list-style: none; margin: 0; padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
}
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) 200px 6.4rem 44px; align-items: center; gap: 16px;
  padding: 10px 8px 10px 16px;
}
.row .ticket { justify-self: end; }
.row--simple { grid-template-columns: minmax(0, 1fr) 6.4rem; }
.row--hit { background: var(--hit-bg); box-shadow: inset 4px 0 0 var(--tag); }
.list .row--hit:first-child { border-radius: var(--radius-m) var(--radius-m) 0 0; }
.pill--hit { background: var(--go); color: var(--go-ink); }
.target-note { color: var(--muted); }

/* trend: step chart of the rate over time (like price_checker), min / max / changes underneath.
   With a target the line turns green above it and the part above the target is filled: that's the headline.
   Strokes don't scale with the svg (non-scaling-stroke), so widths below are screen px in both sizes. */
.trend { display: grid; gap: 2px; min-width: 0; --spark-hit-fill: .26; }
.spark { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; cursor: crosshair; }
.spark path, .spark line, .spark circle { vector-effect: non-scaling-stroke; }
.spark__area { fill: var(--ink-2); fill-opacity: .07; stroke: none; }
.spark--goal .spark__area { fill-opacity: .04; }
.spark__hitarea { fill: var(--spark-hit); fill-opacity: var(--spark-hit-fill); stroke: none; transition: fill-opacity .15s; }
.row:hover .spark__hitarea, .offer:hover .spark__hitarea, .spark:hover .spark__hitarea { fill-opacity: calc(var(--spark-hit-fill) + .14); }
.spark__ln { fill: none; stroke: var(--ink-2); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.spark__ln--hit { stroke: var(--spark-hit); stroke-width: 2.5; }
.spark__ln--miss { stroke: var(--muted); stroke-width: 1.5; opacity: .85; }
.spark__thr { stroke: var(--spark-hit); stroke-width: 1.25; stroke-dasharray: 4 3; opacity: .9; }
.spark__lbl {
  font-size: 9px; font-weight: 650; fill: var(--muted); dominant-baseline: middle;
  pointer-events: none;
}
.spark__lblbg { fill: var(--surface); opacity: .9; pointer-events: none; }
.spark__lbl--target { fill: var(--go); }
.trend--lg .spark__lbl { font-size: 5px; }
.spark__ref { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 1 3; opacity: .7; }
.spark__pt { fill: var(--surface); stroke: var(--ink-2); stroke-width: 1.5; }
.spark__now { fill: var(--ink-2); stroke: var(--surface); stroke-width: 1.5; }
/* with a target: points at/above it green, below it grey; "now" glows when it's at the target */
.spark__pt--hit { fill: var(--spark-hit); stroke: var(--spark-hit); }
.spark__pt--miss { fill: var(--surface); stroke: var(--muted); }
.spark__now--hit { fill: var(--spark-hit); }
.spark__now--miss { fill: var(--muted); }
.spark__halo { fill: var(--spark-hit); opacity: .35; pointer-events: none; animation: spark-pulse 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes spark-pulse { 50% { opacity: .12; transform: scale(1.35); } }
@media (prefers-reduced-motion: reduce) { .spark__halo { animation: none; } }
.spark circle:hover { stroke: var(--ink); stroke-width: 3; }
/* hover cursor (app.js): vertical line + dot on the step, stats line shows that day's value */
.spark__cur { pointer-events: none; }
.spark__cur line { stroke: var(--ink-2); stroke-width: 1; opacity: .5; }
.spark__cur circle { fill: var(--ink-2); stroke: var(--surface); stroke-width: 2; }
.spark__cur.is-hit circle { fill: var(--spark-hit); }
.spark__stats { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; min-height: 1.4em; }
.spark__stats.is-reading { color: var(--ink-2); font-weight: 650; }
.spark__stats .is-hit { color: var(--up); }
.trend--lg { max-width: 440px; gap: 6px; }
.trend--lg .spark__ln { stroke-width: 2.25; }
.trend--lg .spark__ln--hit { stroke-width: 3; }
.trend--lg .spark__pt { r: 1.6; }
.trend--lg .spark__now { r: 2; }
.trend--lg .spark__halo { r: 4; }
.trend--lg .spark__cur circle { r: 1.8; }
.trend--lg .spark__stats { font-size: .875rem; font-weight: 650; color: var(--ink-2); }
.row + .row { border-top: 1px solid var(--line); }
.row__main { text-decoration: none; min-width: 0; padding: 4px 0; }
.row__main:hover .row__name { text-decoration: underline; text-underline-offset: 3px; }
.row__name { display: block; font-weight: 650; font-size: 1.0625rem; overflow-wrap: anywhere; }
.row__meta { display: block; font-size: .875rem; color: var(--muted); }
.delta { font-weight: 600; white-space: nowrap; }
.delta--up { color: var(--up); }
.delta--down { color: var(--down); }
.delta--up::before { content: "▲ "; font-size: .7em; }
.delta--down::before { content: "▼ "; font-size: .7em; }

/* favourite */
.fav {
  width: 44px; height: 44px; display: inline-grid; place-items: center;
  background: none; border: 0; border-radius: 50%; cursor: pointer; color: var(--muted);
}
.fav svg { fill: none; stroke: currentColor; stroke-width: 1.8; transition: transform .2s; }
.fav:hover { color: var(--down); }
.fav.is-on { color: var(--down); }
.fav.is-on svg { fill: currentColor; }
.fav.pop svg { transform: scale(1.25); }

/* side notes */
.note {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
  padding: 18px 18px 16px;
}
.note--plain { background: transparent; }
.note__title { font-size: 1.0625rem; font-weight: 750; margin-bottom: 10px; }
.steps { margin: 0 0 12px; padding-left: 1.3em; display: grid; gap: 6px; font-size: .9375rem; }
.steps li::marker { font-weight: 750; color: var(--muted); }

/* ------------------------------------------------------------ merchant */

.deal {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
  padding: 24px 24px 28px;
  margin-bottom: 40px;
}
.deal__head { display: flex; align-items: center; gap: 6px; margin-bottom: 20px; }
.deal__name { font-size: clamp(1.9rem, 5vw, 3rem); font-weight: 850; font-stretch: 78%; letter-spacing: -.01em; overflow-wrap: anywhere; }
.deal__best { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: center; }
.deal__where { display: grid; gap: 12px; justify-items: start; }
.deal__on { font-size: 1.0625rem; }
.verdict { font-weight: 650; padding-left: 12px; border-left: 3px solid var(--line-strong); }
.verdict--good { border-color: var(--up); color: var(--up); }
.verdict--bad { border-color: var(--down); color: var(--down); }
.verdict--limited { border-color: var(--down); color: var(--ink-2); font-weight: 600; margin-top: 6px; }
.hit-note { font-weight: 650; background: var(--hit-bg); padding: 6px 10px; border-radius: var(--radius-s); box-shadow: inset 3px 0 0 var(--tag); }
.deal--hit { box-shadow: inset 0 4px 0 var(--tag); }

.deal__more {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px;
  margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line);
}
.deal__range, .target { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-content: start; min-width: 0; }
.deal__label { font-size: 1rem; font-weight: 750; }
.target__row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.target .field__input { flex: 0 1 8.5rem; min-width: 0; }
.target input { flex: 1; min-width: 0; border: 0; background: transparent; height: 44px; padding: 0 10px; font-size: 1.0625rem; font-weight: 650; }
.target input:focus-visible { outline: none; }
.stepper { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; }
.stepper__btn {
  width: 44px; height: 44px; flex: none; display: inline-grid; place-items: center;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-s); background: var(--surface);
  font-size: 1.375rem; font-weight: 650; line-height: 1; cursor: pointer; touch-action: manipulation;
}
.stepper__btn:hover { border-color: var(--ink-2); }
.stepper__btn:active { background: var(--line); }
.target__quick { display: flex; flex-wrap: wrap; gap: 8px; }
.qchip {
  min-height: 36px; padding: 6px 12px; border-radius: 999px; cursor: pointer; touch-action: manipulation;
  border: 1px solid var(--line-strong); background: transparent; font-size: .875rem; font-weight: 600;
}
.qchip:hover { background: var(--line); }

/* menu page (/me): the mobile home for everything the top nav holds on desktop */
.menu__title { font-size: .8125rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 8px; }
.menu { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
.menu li + li { border-top: 1px solid var(--line); }
.menu a, .menu button {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px 10px 16px;
  background: none; border: 0; text-align: left; text-decoration: none; cursor: pointer;
}
.menu a:hover, .menu button:hover { background: var(--paper); }
.menu__text { flex: 1; min-width: 0; display: grid; }
.menu__label { font-weight: 650; font-size: 1.0625rem; }
.menu__hint { font-size: .875rem; color: var(--muted); }
.menu__chev { flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* bottom tab bar: phones only (≤720px, see responsive) */
.tabbar { display: none; }

.offers { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
.offer {
  display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto auto; gap: 16px; align-items: center;
  padding: 14px 16px;
}
.offer + .offer { border-top: 1px solid var(--line); }
.offer__rank { font-weight: 800; font-stretch: 70%; font-size: 1.25rem; color: var(--muted); text-align: center; }
.offer--best .offer__rank { color: var(--ink); }
.offer__who { display: grid; gap: 2px; min-width: 0; }
.offer__site { font-weight: 700; font-size: 1.0625rem; }
.offer__desc { font-size: .875rem; color: var(--muted); }
.offer__promo { font-size: .875rem; color: var(--ink-2); }
.offer__newc { font-size: .8125rem; color: var(--ink-2); }
.offer__promo { font-weight: 600; color: var(--up); }
.offer__rate { display: grid; justify-items: end; text-align: right; }
.offer__rate .trend { width: 180px; margin: 4px 0 2px; }
.offer__num { font-weight: 850; font-stretch: 70%; font-size: 1.625rem; line-height: 1.05; white-space: nowrap; }
.offer__num small { font-size: .75rem; font-weight: 600; font-stretch: 100%; color: var(--muted); }
.offer__num b { font-weight: inherit; }
.offer--best .offer__num b { text-decoration: underline; text-decoration-color: var(--tag); text-decoration-thickness: .16em; text-underline-offset: .14em; }
.offer__eq { font-size: .8125rem; font-weight: 600; color: var(--ink-2); }
.offer__seen { font-size: .75rem; color: var(--muted); }
.offer__go { min-width: 64px; }

.chart { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 16px; }
.chart__legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .875rem; margin-bottom: 10px; }
.chart__legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart__legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.chart__plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart__plot text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart__grid { stroke: var(--line); stroke-width: 1; }
.chart__tip {
  position: absolute; pointer-events: none; background: var(--ink); color: var(--paper);
  padding: 6px 9px; border-radius: var(--radius-s); font-size: .8125rem; line-height: 1.35; white-space: nowrap;
  transform: translate(-50%, calc(-100% - 10px));
}
.chart__plot { position: relative; }

.stale summary { cursor: pointer; font-weight: 650; padding: 6px 0; }
.stale p { margin: 6px 0 10px; }
.stale__list { list-style: none; padding: 0; margin: 0; font-size: .9375rem; }
.stale__list li { display: grid; grid-template-columns: 10rem 1fr auto; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }

.dock { display: none; }

/* ------------------------------------------------------------ platforms */

.plats { list-style: none; margin: 0 0 20px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 16px; }
.plat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
  padding: 20px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; min-width: 0;
}
.plat .btn { max-width: 100%; text-align: center; }
.plat--stale { background: transparent; }
.plat--hidden { opacity: .6; }
.plat__head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.plat__name { font-size: 1.25rem; font-weight: 750; overflow-wrap: anywhere; }
.plat__tag { color: var(--ink-2); }
.plat__stat { font-size: .9375rem; color: var(--muted); }
.plat__stat strong { color: var(--ink); font-size: 1.0625rem; }
.plat__notes { margin: 0; padding-left: 1.1em; font-size: .9375rem; display: grid; gap: 4px; }
.plat .btn { margin-top: auto; }

/* ------------------------------------------------------------ go (handoff) */

.page-go .wrap { padding-top: 56px; }
.go { display: grid; gap: 18px; justify-items: start; }
.go__title { font-size: clamp(1.6rem, 4vw, 2.25rem); font-weight: 800; font-stretch: 80%; }
.go__count { color: var(--muted); }
.go .steps { font-size: 1rem; gap: 8px; }
.go__actions { display: flex; gap: 12px; flex-wrap: wrap; }
.check { display: inline-flex; gap: 8px; align-items: center; font-size: .9375rem; color: var(--muted); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--go); }

/* ------------------------------------------------------------ dialog / toast / footer */

.sheet {
  border: 0; padding: 0; border-radius: var(--radius-m);
  background: var(--surface); color: var(--ink);
  width: min(480px, calc(100vw - 32px));
  box-shadow: var(--shadow-pop);
}
.sheet::backdrop { background: rgba(10, 16, 32, .55); }
.sheet__body { padding: 24px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.sheet h2 { font-size: 1.375rem; font-weight: 750; }
.field { display: grid; gap: 6px; font-weight: 600; }
.field__input { display: flex; align-items: center; border: 1.5px solid var(--line-strong); border-radius: var(--radius-s); background: var(--paper); }
.field__input:focus-within { border-color: var(--focus); }
.field input { flex: 1; min-width: 0; border: 0; background: transparent; height: 44px; padding: 0 12px; font-size: 1.0625rem; font-weight: 650; }
.field input:focus-visible { outline: none; }
.field__suffix { padding: 0 12px; color: var(--muted); font-weight: 500; font-size: .9375rem; }
.sheet__actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
/* set targets：整个弹层滚动，Save 那一栏吸底，一直看得见 */
.sheet--tall { width: min(640px, calc(100vw - 32px)); }
.tg__bulk { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tg__bulk[hidden], .tg__amt[hidden], .tg__gone[hidden], .tg__meta[hidden] { display: none; }
.tg__bulk select { flex: 1 1 7rem; min-width: 0; height: 44px; padding: 0 8px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-s); background: var(--surface); color: var(--ink); font: inherit; }
.tg__amt { width: 4.75rem; }
.tg__bulk .btn { padding-left: 14px; padding-right: 14px; }
.tg__amt input { width: 100%; min-width: 0; border: 0; background: transparent; height: 44px; padding: 0 8px; font: inherit; font-weight: 650; }
.tg { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.tg__actions { position: sticky; bottom: 0; z-index: 1; background: var(--surface); padding: 10px 0 2px; margin-top: -10px; box-shadow: 0 -1px 0 var(--line); }
.sheet--tall { overscroll-behavior: contain; }
.tg__row {
  display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 4px 8px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.tg__row.is-hit { box-shadow: inset 3px 0 0 var(--tag); }
.tg__row.is-gone .tg__name { text-decoration: line-through; color: var(--muted); }
.tg__row.is-gone .tg__step { display: none; }
/* 数字框不要浏览器自带的上下箭头：窄框里会挤掉数字，加减用 −/+ 按钮 */
.tg input[type=number], .tg__amt input { -moz-appearance: textfield; appearance: textfield; }
.tg input::-webkit-inner-spin-button, .tg input::-webkit-outer-spin-button,
.tg__amt input::-webkit-inner-spin-button, .tg__amt input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.tg__pick { display: grid; place-items: center; height: 44px; cursor: pointer; }
.tg__pick input { width: 20px; height: 20px; accent-color: var(--go); }
.tg__info { display: grid; min-width: 0; }
.tg__name { font-weight: 650; overflow-wrap: anywhere; }
.tg__meta, .tg__gone { font-size: .8125rem; color: var(--muted); }
.tg__step .field__input { width: 5.5rem; }
.tg__step input { width: 100%; min-width: 0; border: 0; background: transparent; height: 44px; padding: 0 6px; font: inherit; font-weight: 650; text-align: right; }
.tg__step input:focus-visible { outline: none; }
.tg__step .field__suffix { padding: 0 8px 0 2px; }
.stepper__btn:disabled, .tg__step input:disabled { opacity: .4; cursor: default; }
@media (max-width: 720px) {
  .tg__step { grid-column: 2 / 4; }
}
/* sites you use：每行整行可点（≥44px） */
.sites { list-style: none; margin: 0; padding: 0; display: grid; border-top: 1px solid var(--line); }
.sites li { border-bottom: 1px solid var(--line); }
.sites__row { display: flex; align-items: center; gap: 12px; min-height: 48px; cursor: pointer; }
.sites__row input { width: 20px; height: 20px; accent-color: var(--go); flex: none; }
.sites__name { flex: 1; font-weight: 600; }
.qr { justify-self: center; line-height: 0; }
.push-state { display: grid; gap: 8px; }
/* other devices: send a code / bring one in */
.devices__part { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; justify-items: start; min-width: 0; padding-top: 14px; border-top: 1px solid var(--line); }
.devices__part [data-link-out] { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; width: 100%; min-width: 0; }
.devices__part .field, .devices__part .field__input { min-width: 0; width: 100%; }
.devices__part [data-link-out][hidden] { display: none; }
.devices__label { font-size: 1rem; font-weight: 750; }
.pair-code {
  font-size: 2.25rem; font-weight: 850; font-stretch: 80%; letter-spacing: .12em; line-height: 1.1;
  font-variant-numeric: tabular-nums; user-select: all;
}
.pair-in { display: flex; gap: 8px; width: 100%; }
.pair-in .field__input { flex: 1; min-width: 0; }
.pair-in input {
  flex: 1; min-width: 0; height: 44px; padding: 0 12px; border: 0; background: transparent;
  font-size: 1.25rem; font-weight: 700; letter-spacing: .12em; font-variant-numeric: tabular-nums;
}
.pair-in input:focus-visible { outline: none; }
.btn--danger { background: var(--down); border-color: var(--down); color: #fff; }
.btn--danger:hover { background: var(--down); border-color: var(--down); filter: brightness(.9); }
.menu__note { margin-top: 10px; }
.pair-hint {
  background: var(--hit-bg); box-shadow: inset 4px 0 0 var(--tag); border-radius: var(--radius-m);
  padding: 16px 18px; margin-bottom: 32px; display: grid; gap: 12px;
}
.pair-hint[hidden] { display: none; }
.pair-hint__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.push-state .steps { margin: 0; }
.qr svg { width: 200px; height: 200px; border-radius: var(--radius-s); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: var(--paper);
  padding: 10px 16px; border-radius: var(--radius-s);
  font-size: .9375rem; z-index: 60; box-shadow: var(--shadow-pop);
}

.foot { border-top: 1px solid var(--line); }
.foot__inner { max-width: var(--w); margin: 0 auto; padding: 28px 16px 40px; display: grid; gap: 8px; font-size: .8125rem; color: var(--muted); }
.foot p { max-width: 80ch; }

/* ------------------------------------------------------------ responsive */

@media (max-width: 900px) {
  .home { grid-template-columns: 1fr; gap: 32px; }
  .home__aside { position: static; }
}

@media (max-width: 720px) {
  /* header: navy on every page so the white status bar text of the home-screen app stays readable;
     the nav links move to /me, reached from the tab bar */
  .top { background: var(--hero); border-color: transparent; color: var(--hero-ink); }
  .top__inner { flex-wrap: wrap; gap: 10px 16px; }
  .search--compact { order: 3; flex-basis: 100%; max-width: none; }
  .search--compact input { color: var(--ink); height: 44px; }
  .top__nav { display: none; }
  .brand__word { font-size: 1.2rem; }

  body { --tabbar-h: 58px; --dock-h: 5rem; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr);  /* Home / Gift cards / In-store / Menu */
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
  .tabbar a {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: var(--tabbar-h); color: var(--muted); text-decoration: none;
    font-size: 11px; font-weight: 650; -webkit-tap-highlight-color: transparent;  /* px: like native tab bars, doesn't grow with text size */
  }
  .tabbar svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar a[aria-current="page"] { color: var(--ink); }
  .tabbar a[aria-current="page"] svg { stroke-width: 2.3; }
  .tabbar a[aria-current="page"]::before {
    content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--tag);
  }
  .tabbar__n {
    position: absolute; top: 6px; left: calc(50% + 8px); min-width: 17px; height: 17px; padding: 0 4px;
    border-radius: 999px; background: var(--down); color: #fff; font-size: 10px; line-height: 17px; text-align: center;
  }
  .toast { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px); }
  .foot__inner { padding-bottom: 24px; }

  /* dialogs become bottom sheets */
  .sheet {
    width: 100%; max-width: none; margin: auto 0 0; max-height: 92dvh; overflow-y: auto;
    border-radius: 16px 16px 0 0;
  }
  .sheet__body { padding: 22px 16px calc(18px + env(safe-area-inset-bottom)); }
  .sheet__body::before {
    content: ""; justify-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: -8px 0 -4px;
  }
  .sheet__actions .btn { flex: 1 1 auto; }
  .sheet[open] { animation: sheet-up .22s ease-out; }

  .hero__inner { padding: 20px 16px 28px; }
  .hero__title { margin-bottom: 20px; }
  .search--hero input { height: 48px; font-size: 1.0625rem; padding-left: 40px; }
  .search--hero .search__icon { left: 16px; }
  .search__go { display: none; }

  .row {
    grid-template-columns: minmax(0, 1fr) auto 40px; grid-template-areas: "main ticket fav" "range ticket fav";
    padding-left: 12px; gap: 6px 8px;
  }
  .row__main { grid-area: main; }
  .row .trend { grid-area: range; max-width: 220px; }
  .row .ticket { grid-area: ticket; }
  .row .fav { grid-area: fav; }
  .row--simple { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main ticket"; }
  /* 首页手机版：只留搜索框和关注；紧凑行不画走势图（点进商家页看） */
  .desk-only { display: none !important; }
  .page-home .home { padding-top: 20px; }
  .list--compact .trend { display: none; }
  .list--compact .row { grid-template-areas: "main ticket fav"; padding-top: 8px; padding-bottom: 8px; }
  .list--top5 .row:nth-child(n+6) { display: none; }
  .list--compact .promo-full { display: none; }
  .list--compact .promo-short { display: inline; }
  .deal__more { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .row .ticket__num { font-size: 1.3rem; }
  .ticket { min-width: 4.8rem; }

  .deal { padding: 18px 16px 22px; margin-bottom: 32px; }
  .deal__best { grid-template-columns: 1fr; gap: 18px; justify-items: start; }

  .offer { grid-template-columns: 1.4rem minmax(0, 1fr) auto; grid-template-areas: "rank who rate" "rank who go"; gap: 4px 12px; padding: 12px; }
  .offer__rank { grid-area: rank; align-self: start; padding-top: 2px; }
  .offer__who { grid-area: who; align-self: start; }
  .offer__rate { grid-area: rate; }
  .offer__go { grid-area: go; justify-self: end; min-height: 36px; padding: 6px 14px; min-width: 56px; margin-top: 4px; }

  .stale__list li { grid-template-columns: 1fr; gap: 0; }

  /* the deal dock sits on top of the tab bar: reserve both at the very end of the page (after the footer) */
  body.page-merchant { padding-bottom: calc(var(--tabbar-h) + var(--dock-h) + env(safe-area-inset-bottom)); }
  .dock {
    display: block; position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); z-index: 25;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 10px 16px;
    transform: translateY(110%); visibility: hidden; transition: transform .25s ease, visibility .25s;
  }
  .dock.is-shown { transform: none; visibility: visible; }  /* hidden: not tappable / focusable behind the tab bar */
  .dock__inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .dock .ticket__num { font-size: 1.3rem; }
  .dock .btn { flex: 1 1 0; min-width: 0; max-width: 260px; text-align: center; }
}

@keyframes sheet-up { from { transform: translateY(40px); opacity: .4; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
/* devices list (Other devices dialog) */
.device-list { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; gap: 8px; }
.device-list[hidden] { display: none; }
.device { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.device__name { font-weight: 650; overflow-wrap: anywhere; }
.device__tag { font-size: .75rem; font-weight: 600; color: var(--muted); margin-left: 4px; }
.device__meta { grid-column: 1; font-size: .8125rem; color: var(--muted); }
.device__remove { grid-column: 2; grid-row: 1 / span 2; min-height: 44px; white-space: nowrap; }
