/* ==========================================================================
   好康據點 COUP SPOT — design system
   冷灰底、白卡、藍綠主色；卡片式優惠清單，行動優先。
   ========================================================================== */
:root {
  font-family: "Noto Sans TC", "PingFang TC", "Hiragino Sans CNS", "Microsoft JhengHei", system-ui, sans-serif;
  color: #0d1b1e;
  background: #f5f7f8;
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;

  --ink: #0d1b1e;
  --body: #33474b;
  --muted: #5d7075;
  --line: #e3e8ea;
  --line-strong: #cfdadd;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-soft: #f1f5f6;
  --brand: #0d7a6f;
  --brand-ink: #0a5f56;
  --brand-soft: #e8f4f2;
  --danger: #b4472f;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-pill: 999px;
  --header-h: 64px;
  --shadow-card: 0 8px 24px -18px rgba(13, 27, 30, .45);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: var(--scroll-offset, 150px); }
body { margin: 0; line-height: 1.65; background: var(--bg); color: var(--ink); }
a { color: inherit; text-decoration: none; }
button, select, input { font: inherit; }
button, a, select, summary { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 4px;
}
input:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: -80px; left: 16px; z-index: 100;
  padding: 10px 16px; background: var(--ink); color: #fff; border-radius: 0 0 8px 8px;
}
.skip-link:focus { top: 0; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 24px;
  height: var(--header-h); display: flex; align-items: center;
  justify-content: space-between; gap: 24px;
}
.wordmark {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 19px; font-weight: 800; letter-spacing: -.02em; color: var(--ink);
}
.wordmark em, .wordmark span { font-style: normal; color: var(--brand); }
.wordmark small { font-size: 9.5px; font-weight: 600; letter-spacing: .18em; color: var(--muted); }
.header-nav { display: flex; gap: 22px; font-size: 14px; color: var(--body); }
.header-nav a { padding: 6px 0; border-bottom: 2px solid transparent; }
.header-nav a:hover { color: var(--brand); border-bottom-color: var(--brand); }
.header-nav a[aria-disabled="true"] { color: #a9b7ba; border-bottom-color: transparent; }
.header-note { font-size: 11.5px; letter-spacing: .1em; color: var(--muted); }

/* ---------- Page shell ---------- */
.page { max-width: 1280px; margin: 0 auto; padding: 0 24px 72px; }
main { min-width: 0; }

/* ---------- Hero ---------- */
.hero { padding: 46px 0 26px; max-width: 880px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 16px;
  font-size: 12.5px; font-weight: 600; letter-spacing: .03em; color: var(--brand-ink);
  background: var(--brand-soft); border-radius: var(--radius-pill); padding: 6px 14px;
}
.hero-badge span { color: #8fb8b2; }
.hero h1 {
  margin: 0 0 14px; font-size: clamp(30px, 4.2vw, 50px);
  line-height: 1.14; letter-spacing: -.03em; font-weight: 800;
}
.br-mobile { display: none; }
.hero-lead { margin: 0; font-size: 16px; color: var(--muted); max-width: 56ch; }
.hero-points {
  display: flex; flex-wrap: wrap; gap: 12px 36px; margin: 26px 0 0; padding: 0; list-style: none;
  font-size: 13px; color: var(--muted);
}
.hero-points li { display: flex; align-items: baseline; gap: 7px; }
.hero-points strong { font-size: 19px; font-weight: 800; color: var(--ink); letter-spacing: -.02em; }

/* ---------- Toolbar (search + filters + categories) ---------- */
.toolbar {
  position: sticky; top: var(--header-h); z-index: 20;
  padding: 12px 24px 8px; margin: 0 -24px;
  background: rgba(245, 247, 248, .95);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.toolbar-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-field {
  position: relative; display: flex; align-items: center; gap: 8px;
  flex: 1 1 320px; min-width: 0; height: 46px; padding: 0 10px 0 12px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px;
}
.search-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.search-icon { flex: 0 0 auto; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 1.7; stroke-linecap: round; }
#offer-search {
  flex: 1 1 auto; min-width: 0; height: 100%; border: 0; outline: 0;
  background: transparent; font-size: 15px; color: var(--ink);
}
#offer-search::placeholder { color: #8a9a9d; }
#offer-search::-webkit-search-cancel-button { display: none; }
#clear-search {
  flex: 0 0 auto; min-height: 32px; padding: 4px 10px; border: 0; border-radius: 8px;
  background: var(--surface-soft); color: var(--muted); font-size: 12.5px; cursor: pointer;
}
#clear-search:hover { color: var(--ink); }

.quick-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.quick-filters button {
  min-height: 44px; padding: 0 16px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--body); border-radius: var(--radius-pill);
  font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.quick-filters button:hover { border-color: var(--brand); color: var(--brand-ink); }
.quick-filters button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

.mobile-index { display: block; margin-top: 10px; }
#category-nav {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 24px 4px; margin: 0 -24px;
  -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 40px), transparent 100%);
  mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 40px), transparent 100%);
}
#category-nav::-webkit-scrollbar { height: 0; }
#category-nav a {
  display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto;
  min-height: 44px; padding: 0 15px; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-pill);
  font-size: 13.5px; color: var(--body);
  transition: background .15s, color .15s, border-color .15s;
}
#category-nav a:hover { border-color: var(--brand); color: var(--brand-ink); }
#category-nav a small { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
#category-nav a[aria-current="location"] { background: var(--brand); border-color: var(--brand); color: #fff; }
#category-nav a[aria-current="location"] small { color: rgba(255, 255, 255, .82); }
#category-select { display: none; }

.toolbar-meta {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  margin-top: 6px; font-size: 12.5px; color: var(--muted);
}
#offer-results { margin: 0; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.toolbar-note { margin: 0; text-align: right; }

/* ---------- Sections & offer cards ---------- */
.offer-section { padding-top: 34px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.section-title h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.section-index {
  flex: 0 0 auto; font-size: 11.5px; font-weight: 700; letter-spacing: .1em;
  color: var(--brand-ink); background: var(--brand-soft); border-radius: 6px; padding: 3px 7px;
}
.section-count { flex: 0 0 auto; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.column-labels { display: none; }

.offer-list {
  display: grid; gap: 12px; margin-top: 14px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
}
.offer-row {
  display: grid; gap: 10px 14px; padding: 16px;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "desc desc"
    "code action"
    "expiry expiry";
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: box-shadow .18s, border-color .18s, transform .18s;
}
.offer-row:hover { border-color: var(--line-strong); box-shadow: var(--shadow-card); transform: translateY(-1px); }
.offer-description { grid-area: desc; min-width: 0; }
.offer-name { margin: 0 0 6px; font-size: 16.5px; font-weight: 700; line-height: 1.42; letter-spacing: -.01em; overflow-wrap: anywhere; }
.offer-name strong { color: var(--brand-ink); font-weight: 800; font-variant-numeric: tabular-nums; }
.offer-label { font-size: 13px; color: var(--muted); margin-bottom: 2px; line-height: 1.55; }
.offer-extra { font-size: 12.5px; color: #7b8d91; line-height: 1.55; }
.offer-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.offer-tag {
  font-size: 11.5px; font-weight: 600; color: var(--brand-ink);
  background: var(--brand-soft); border-radius: 6px; padding: 3px 8px;
}
.offer-code {
  grid-area: code; align-self: center; min-width: 0;
  padding: 10px 13px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface-soft); color: #0f2a2b;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 14px; font-weight: 600; letter-spacing: .09em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  user-select: text; -webkit-user-select: text;
}
.offer-code.revealed { border-style: solid; border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.claim {
  grid-area: action; align-self: center; min-height: 46px; min-width: 104px; padding: 0 18px;
  border: 0; border-radius: 12px; background: var(--brand); color: #fff;
  font-size: 14px; font-weight: 700; cursor: pointer; transition: background .15s, transform .1s;
}
.claim:hover { background: var(--brand-ink); }
.claim:active { transform: scale(.98); }
.claim.copied { background: var(--ink); }
.claim:disabled { background: #c7d2d4; color: #fff; cursor: default; }
.offer-expiry { grid-area: expiry; font-size: 12px; color: #7b8d91; font-variant-numeric: tabular-nums; }
.offer-expiry .year { color: inherit; }
.offer-expiry .past { color: var(--danger); font-weight: 600; }
.offer-row[data-expiry="dated"] .offer-expiry::before { content: "訂購截止 "; color: var(--muted); }
.offer-row[data-expiry="expired"] .offer-expiry::before { content: "已過期 "; }
.offer-navigation { grid-column: 1 / -1; padding-top: 6px; font-size: 12.5px; color: var(--danger); }
.offer-navigation a { color: var(--brand-ink); text-decoration: underline; text-underline-offset: 2px; }
.is-expired { background: #fafbfb; }
.is-expired .offer-name, .is-expired .offer-code { color: #93a3a6; }

/* ---------- Empty / toast ---------- */
.search-empty {
  margin-top: 28px; padding: 36px 24px; text-align: center;
  background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius);
}
.search-empty p { margin: 0 0 6px; color: var(--muted); font-size: 14px; }
.search-empty .empty-title { color: var(--ink); font-size: 17px; font-weight: 700; }
.search-empty button {
  margin-top: 12px; min-height: 44px; padding: 0 18px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill); background: var(--surface); font-size: 14px; cursor: pointer;
}
.search-empty button:hover { border-color: var(--brand); color: var(--brand-ink); }
.empty-state { padding: 20px 0; color: var(--muted); border-top: 1px solid var(--line); }
.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 60;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  width: max-content; max-width: min(90vw, 460px); padding: 12px 18px; border-radius: 12px;
  background: var(--ink); color: #fff; font-size: 13.5px; line-height: 1.5;
  box-shadow: 0 18px 40px -24px rgba(0, 0, 0, .6);
  transition: opacity .22s, transform .22s;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- FAQ ---------- */
.faq { margin-top: 60px; padding-top: 34px; border-top: 1px solid var(--line); }
.faq-head h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.02em; }
.faq-head p { margin: 0 0 18px; font-size: 14px; color: var(--muted); }
.faq-list { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 2px; font-size: 15.5px; font-weight: 600; cursor: pointer; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; flex: 0 0 auto; font-size: 20px; line-height: 1; color: var(--brand); font-weight: 700; }
.faq details[open] summary::after { content: "−"; }
.faq summary:hover { color: var(--brand-ink); }
.faq details[open] summary { color: var(--brand-ink); }
.faq-answer { padding: 0 2px 16px; max-width: 74ch; }
.faq-answer p { margin: 0 0 10px; font-size: 14.5px; color: var(--body); }
.faq-answer p:last-child { margin-bottom: 0; }
.faq-answer a { color: var(--brand-ink); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 64px; padding-top: 28px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
.footer-top { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.footer-mark { margin: 0 0 8px; font-size: 16px; font-weight: 800; color: var(--ink); }
.footer-mark small { display: block; margin-top: 4px; font-size: 10.5px; font-weight: 500; letter-spacing: .16em; color: var(--muted); }
.footer-note { margin: 0; max-width: 62ch; line-height: 1.8; }
.footer-links { display: flex; flex-direction: column; gap: 8px; }
.footer-links a { min-height: 32px; display: inline-flex; align-items: center; }
.footer-links a:hover { color: var(--brand); }
.footer-base {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12.5px;
}

/* ==========================================================================
   政策頁（Cookie 政策／隱私權政策／使用條款）
   ========================================================================== */
.breadcrumb { padding-top: 20px; font-size: 12.5px; color: var(--muted); }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb span { margin: 0 7px; color: #b6c3c6; }
.page-heading { padding: 26px 0 18px; }
.page-heading .issue { margin: 0 0 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .16em; color: var(--brand); }
.page-heading h1 { margin: 0 0 10px; font-size: clamp(26px, 3.4vw, 38px); line-height: 1.3; letter-spacing: -.025em; }
.page-heading .intro { margin: 0 0 10px; max-width: 66ch; color: var(--muted); font-size: 14px; line-height: 1.85; }
.page-heading .policy-date { margin: 0; font-size: 12.5px; color: var(--muted); }

.legal-layout { display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: 48px; align-items: start; margin-top: 6px; }
.legal-menu { position: sticky; top: calc(var(--header-h) + 18px); display: flex; flex-direction: column; gap: 3px; }
.legal-menu p { margin: 0 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .16em; color: var(--muted); text-transform: uppercase; }
.legal-menu a { padding: 10px 12px; border-radius: 10px; font-size: 13.5px; color: var(--body); }
.legal-menu a:hover { background: var(--surface); color: var(--brand-ink); }
.legal-menu a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; }

.legal-content { max-width: 76ch; min-width: 0; }
.legal-content section { padding: 20px 0; border-bottom: 1px solid var(--line); }
.legal-content section:first-child { padding-top: 4px; }
.legal-content h2 { margin: 0 0 10px; font-size: 17px; letter-spacing: -.01em; }
.legal-content p { margin: 0 0 10px; line-height: 1.85; color: var(--body); font-size: 14.5px; }
.legal-content a { color: var(--brand-ink); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.legal-content ul { margin: 8px 0 14px; padding-left: 20px; }
.legal-content li { margin-bottom: 7px; color: var(--body); font-size: 14.5px; }
.data-summary { margin: 0; display: grid; gap: 10px; }
.data-summary > div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.data-summary dt { font-size: 13.5px; font-weight: 700; }
.data-summary dd { margin: 4px 0 0; font-size: 13.5px; color: var(--muted); line-height: 1.75; }
.tracking-choice { margin: 12px 0 0; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.tracking-choice p { font-size: 14px; }
.tracking-choice label { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 10px 0; font-size: 14px; cursor: pointer; }
.tracking-choice input { margin-top: 4px; min-width: 18px; height: 18px; accent-color: var(--brand); }
.tracking-choice [role="status"] { font-size: 13.5px; font-weight: 600; color: var(--brand-ink); }
.policy-contact {
  margin: 26px 0 0; padding: 16px 18px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; font-size: 13.5px; color: var(--body);
}
.policy-contact p { margin: 0; }
.policy-footer { margin-top: 46px; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .legal-layout { grid-template-columns: 1fr; gap: 18px; }
  .legal-menu {
    position: static; flex-direction: row; flex-wrap: nowrap; overflow-x: auto;
    gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
  }
  .legal-menu p { display: none; }
  .legal-menu a {
    flex: 0 0 auto; white-space: nowrap; min-height: 44px;
    display: inline-flex; align-items: center;
    border: 1px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--surface);
  }
  .legal-menu a[aria-current="page"] { border-color: var(--brand); }
}

@media (max-width: 760px) {
  :root { --header-h: 58px; }
  .page { padding: 0 18px 56px; }
  .header-inner { padding: 0 18px; gap: 12px; }
  .header-nav, .header-note { display: none; }
  .hero { padding: 30px 0 18px; }
  .hero-lead { font-size: 15px; }
  .hero-points { gap: 10px 22px; margin-top: 20px; }
  .toolbar { padding: 12px 18px 8px; margin: 0 -18px; }
  #category-nav { padding: 2px 18px 4px; margin: 0 -18px; }
  .toolbar-meta { flex-direction: column; align-items: flex-start; gap: 2px; }
  .toolbar-note { text-align: left; }
  .offer-list { grid-template-columns: 1fr; gap: 10px; }
  .offer-row { padding: 14px; }
  .offer-name { font-size: 16px; }
  .claim { min-width: 92px; padding: 0 14px; }
  .section-title h2 { font-size: 18px; }
  .footer-top { gap: 20px; }
  .footer-links { flex-direction: row; flex-wrap: wrap; gap: 8px 18px; }
  .footer-base { margin-top: 20px; }
  .toast { bottom: 18px; font-size: 12.5px; padding: 11px 14px; }
}

@media (max-width: 420px) {
  .hero h1 { font-size: 27px; }
  .br-mobile { display: inline; }
  .quick-filters button { flex: 1 1 auto; padding: 0 10px; font-size: 13px; }
  .offer-row {
    grid-template-areas:
      "desc desc"
      "code code"
      "action expiry";
  }
  .claim { width: 100%; }
  .offer-expiry { align-self: center; text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .offer-row, .toast, .claim { transition: none; }
}
