/* 省錢PM r63：一張印出來的比價表。米白紙、墨綠字，最低價用一塊方正的黃色標出來，只有這一個亮色。
   版面刻意排得密：字小、列矮，一個畫面要能看到很多型號。
   字型自己放（@font-face 在 fonts.css）：數字和英文用 IBM Plex Sans，中文用 Noto Sans TC，都只有 400 和 500 兩種粗細。 */

:root {
  --bg: #f7f7f7;
  --surface: #ebebeb;
  --paper: #fff;
  --ink: #0d2a1c;
  --muted: #5f6b64;
  --rule: #d6dbd8;
  --line: #0d2a1c;
  --mark: #f8dc3a;

  --sans: "IBM Plex Sans", "Noto Sans TC", sans-serif;

  /* 字級每一級至少差 1.3 倍，最小 12px */
  --t-xs: 0.75rem;   /* 12 小字：賣場標價、表頭、說明 */
  --t-s: 0.875rem;   /* 14 返回連結、型號頁的品類和尺寸 */
  --t-m: 1rem;       /* 16 內文、型號 */
  --t-l: 1.3125rem;  /* 21 價格、h2 */
  --t-xl: 1.75rem;   /* 28 型號頁價格 */
  --t-xxl: 2.3125rem; /* 37 h1 */

  --radius: 2px;
  --board: 64rem;
  --page: var(--board); /* 頁首、篩選、表格共用同一條左右邊 */
  --gutter: clamp(16px, 4vw, 40px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-synthesis-weight: none;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--t-m) / 1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

th,
b,
strong {
  font-weight: 500;
}

.top,
main,
.foot {
  max-width: calc(var(--page) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

a {
  color: var(--ink);
  text-decoration-line: underline;
  text-decoration-color: color-mix(in srgb, var(--ink) 40%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

a:hover {
  text-decoration-color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

h1,
h2,
p,
ul {
  margin: 0;
}

h1 {
  font-size: var(--t-xxl);
  font-weight: 500;
  line-height: 1.2;
}

h2 {
  font-size: var(--t-l);
  font-weight: 500;
  line-height: 1.4;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  padding: 8px 14px;
  background: var(--ink);
  color: var(--bg);
}

.skip:focus {
  top: 8px;
}

/* 頁首 */

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 32px;
  padding-block: 12px 4px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  color: var(--ink);
  font: 500 var(--t-l) / 1 var(--sans);
  letter-spacing: 0.02em;
  text-decoration: none;
}

.wordmark span {
  padding: 0.2em 0.28em;
  background: var(--mark);
  border-radius: var(--radius);
  font: 500 1.125rem / 1 var(--sans);
  letter-spacing: 0;
}

.top nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 28px;
}

.top nav a {
  padding-block: 8px;
  color: var(--ink);
  font-size: var(--t-m);
  text-decoration: none;
}

.top nav a:hover,
.top nav a[aria-current] {
  box-shadow: inset 0 -2px var(--ink);
}

.top nav a[aria-current] {
  font-weight: 500;
}

/* 版面節奏 */

main {
  padding-top: clamp(14px, 2.4vw, 28px);
}

main > section + section,
main > .item > section + section {
  margin-top: clamp(28px, 3.6vw, 44px);
}

section > h2 {
  margin-bottom: 6px;
}

.lead h1 + .dek {
  margin-top: 4px;
}

.lead-tight {
  margin-bottom: 12px;
}

.dek {
  max-width: 46em;
}

.aside {
  max-width: 62em;
  margin-top: 8px;
  color: var(--muted);
  font-size: var(--t-xs);
  line-height: 1.6;
}

.next {
  margin-top: 12px;
}

.next a {
  font-weight: 500;
}

.plain ul,
.prose ul {
  max-width: 42em;
  padding-left: 1.2em;
}

.plain li + li,
.prose li + li {
  margin-top: 4px;
}

/* 搜尋 */

.find {
  max-width: 560px;
  margin-top: 16px;
}

.find label,
.field label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: var(--t-xs);
  font-weight: 500;
  line-height: 1.4;
}

.find-row {
  display: flex;
}

.find input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  appearance: none;
}

.find button {
  height: 42px;
  padding: 0 20px;
  border: 1px solid var(--ink);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--ink);
  color: var(--bg);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.find button:hover {
  background: color-mix(in srgb, var(--ink) 86%, var(--bg));
}

::placeholder {
  color: var(--muted);
  opacity: 1;
}

/* 比價表 */

.legend {
  max-width: 52em;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: var(--t-xs);
  line-height: 1.6;
}

.legend .price {
  margin: 0 0.4em 0 0;
  padding: 0.05em 0.35em;
  color: var(--ink);
  font: 500 var(--t-xs) / 1.4 var(--sans);
  letter-spacing: 0;
}

.board-wrap {
  overflow-x: auto;
}

.board,
.cats,
.records,
.offers,
.cmp {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums lining-nums;
}

/* 型號欄不再吃掉整個版面：表格收到 64rem，一列從型號到價格一眼看完 */
.board {
  max-width: var(--board);
}

.board thead th,
.cats thead th,
.offers thead th,
.records thead th {
  padding: 6px 0 6px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  font-size: var(--t-xs);
  font-weight: 500;
  line-height: 1.5;
  text-align: right;
  white-space: nowrap;
}

.board thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.board thead th:first-child,
.cats thead th:first-child,
.offers thead th:first-child,
.records thead th:first-child {
  padding-left: 0;
  text-align: left;
}

.records thead th:nth-child(2) {
  text-align: left;
}

.board tbody tr,
.cats tbody tr,
.offers tbody tr,
.records tbody tr {
  border-bottom: 1px solid var(--rule);
}

.board tbody tr:hover {
  background: var(--surface);
}

.board td,
.board tbody th {
  padding: 5px 0 6px 16px;
  text-align: right;
  vertical-align: baseline;
}

.board .c-model {
  padding-left: 0;
  font-weight: 400;
  text-align: left;
}

.board .c-model a {
  color: var(--ink);
  text-decoration: none;
}

.board .c-model a:hover .model {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

.brand {
  color: var(--ink);
}

.model {
  font-weight: 500;
  overflow-wrap: anywhere;
}

.spec {
  margin-left: 12px;
  font-size: var(--t-s);
  white-space: nowrap;
}

.board .c-p {
  width: 12.75rem;
}

.board .c-gap {
  width: 6.5rem;
}

.board .c-hist {
  width: 6.5rem;
}

.board td.c-gap,
.board td.c-hist {
  font-size: var(--t-m);
}

/* 價格下面那一行小字：賣場標價和採用的信用卡 */
.sub {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 0 10px;
  color: var(--muted);
  font: 400 var(--t-xs) / 1.5 var(--sans);
  white-space: nowrap;
}

.board .c-hist {
  color: var(--muted);
}

.price {
  display: inline-block;
  margin-right: -0.3rem;
  padding: 0.0625rem 0.3rem;
  border-radius: var(--radius);
  font: 500 var(--t-l) / 1.2 var(--sans);
  font-variant-numeric: tabular-nums lining-nums;
}

/* 最低價：一塊方正的黃色，四角同樣的小圓角，貼齊數字 */
.price.is-low {
  background: var(--mark);
}

.is-none {
  color: var(--muted);
}

.flag {
  color: var(--muted);
  font: 400 var(--t-xs) / 1.4 var(--sans);
  white-space: nowrap;
}

.count {
  margin: 6px 0 2px;
  font-size: var(--t-m);
  font-weight: 500;
  line-height: 1.5;
}

#more {
  height: 40px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

#more:hover {
  background: var(--ink);
  color: var(--bg);
}

/* 品類表 */

.cats td,
.cats tbody th {
  padding: 7px 0 7px 16px;
  font: 400 var(--t-m) / 1.4 var(--sans);
  font-variant-numeric: tabular-nums lining-nums;
  text-align: right;
}

.cats tbody th {
  padding-left: 0;
  font-weight: 500;
  text-align: left;
}

.cats {
  max-width: 560px;
}

/* 品類分頁與篩選 */

.tabs {
  display: flex;
  gap: 0 26px;
  overflow-x: auto;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
  scrollbar-width: none;
}

.tabs a {
  padding: 6px 0 7px;
  color: var(--ink);
  font-size: var(--t-m);
  text-decoration: none;
}

.tabs a span {
  margin-left: 6px;
  color: var(--muted);
  font-size: var(--t-xs);
  font-variant-numeric: tabular-nums lining-nums;
}

.tabs a:hover,
.tabs a[aria-current] {
  box-shadow: inset 0 -2px var(--ink);
}

.tabs a[aria-current] {
  font-weight: 500;
}

.filters {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px 12px;
  margin: 12px 0;
  padding: 10px 12px;
  background: var(--surface);
}

.field input,
.field select {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: var(--t-m);
}

.field input:hover,
.field select:hover {
  border-color: var(--ink);
}

.check {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 10px;
  font-size: var(--t-m);
  cursor: pointer;
}

.check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--ink);
}

.js .js-hide {
  display: none;
}

.filters button {
  justify-self: start;
  height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--bg);
  font: inherit;
  font-weight: 500;
}

/* 型號頁 */

.back {
  display: inline-block;
  margin-bottom: 8px;
  font-size: var(--t-s);
}

.item-brand {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font: 400 var(--t-m) / 1.6 var(--sans);
  letter-spacing: 0;
}

/* 型號頁的 h1 是英數型號，字距只收這一個 */
.item h1 {
  font-size: var(--t-xxl);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 18px;
  margin-top: 6px;
  font-size: var(--t-m);
}

.verdict {
  max-width: 44em;
  margin-top: 12px;
  font-size: var(--t-m);
  font-weight: 500;
  line-height: 1.6;
}

.stores {
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.store {
  display: grid;
  grid-template-columns: 6.5rem 19rem minmax(0, 1fr);
  gap: 4px 20px;
  align-items: baseline;
  padding: 12px 0 14px;
  border-bottom: 1px solid var(--rule);
}

.store-name {
  font-size: var(--t-m);
  font-weight: 500;
}

.store-price .price {
  margin: 0 0 0 -0.3rem;
  font-size: var(--t-xl);
  font-variant-numeric: tabular-nums lining-nums;
}

.store-price .term {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: var(--t-xs);
  font-variant-numeric: tabular-nums lining-nums;
}

.store-none {
  color: var(--muted);
}

.store-info {
  font-size: var(--t-xs);
  line-height: 1.6;
}

.store-info p + p,
.store-info ul,
.store-info ul + p {
  margin-top: 3px;
}

.matched {
  overflow-wrap: anywhere;
}

.matched b,
.extras b {
  margin-right: 0.8em;
  color: var(--muted);
  font-weight: 400;
}

.extras {
  padding: 0;
  list-style: none;
}

.extras li + li {
  margin-top: 1px;
}

.records td,
.records tbody th {
  padding: 7px 0 7px 16px;
  font-size: var(--t-m);
  font-weight: 400;
  text-align: right;
  vertical-align: baseline;
}

.records tbody th,
.records td:nth-child(2) {
  padding-left: 0;
  text-align: left;
}

.records tbody th {
  color: var(--muted);
}

.records td:nth-child(2) {
  padding-left: 16px;
}

.records .amount {
  font: 500 var(--t-m) / 1.2 var(--sans);
  font-variant-numeric: tabular-nums lining-nums;
}

.note {
  display: block;
  color: var(--muted);
}

.specs {
  display: grid;
  grid-template-columns: minmax(8em, 14em) minmax(0, 1fr);
  max-width: 760px;
  margin: 0;
  border-top: 1px solid var(--line);
}

.specs dt,
.specs dd {
  margin: 0;
  padding: 5px 0;
  border-bottom: 1px solid var(--rule);
  font-size: var(--t-m);
}

.specs dt {
  padding-right: 16px;
  color: var(--muted);
}

.button {
  display: inline-block;
  padding: 7px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: var(--ink);
  color: var(--bg);
}

/* 每張卡回饋後多少錢 */

.offers td,
.offers tbody th {
  padding: 7px 0 7px 16px;
  font-size: var(--t-xs);
  font-weight: 400;
  text-align: right;
  vertical-align: top;
}

.offers tbody th {
  padding-left: 0;
  font-size: var(--t-m);
  font-weight: 500;
  text-align: left;
}

.offers thead th:nth-child(2),
.offers .cond {
  text-align: left;
}

.offers .cond {
  max-width: 26em;
  color: var(--muted);
}

.offers .amount {
  display: inline-block;
  font: 500 var(--t-m) / 1.3 var(--sans);
  font-variant-numeric: tabular-nums lining-nums;
}

.offers .amount.is-pick {
  margin-right: -0.3rem;
  padding: 0 0.3rem;
  background: var(--mark);
  border-radius: var(--radius);
}

.offers .note {
  font-weight: 400;
  font-size: var(--t-xs);
}

.offers .note b {
  color: var(--ink);
  font-weight: 500;
}

.plan {
  font-weight: 400;
}

/* 窄螢幕把條件收到卡片名稱下面，讓金額留在畫面裡 */
.cond-narrow {
  display: none;
}

.tag {
  margin-right: 6px;
  padding: 0 5px;
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  color: var(--ink);
  white-space: nowrap;
}

/* 並排比較 */

.results {
  max-width: 640px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.results button {
  display: flex;
  width: 100%;
  gap: 12px;
  align-items: baseline;
  padding: 11px 16px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--t-m);
  text-align: left;
  cursor: pointer;
}

.results button:hover {
  background: var(--mark);
}

#compare {
  margin-top: 36px;
}

.cmp th,
.cmp td {
  padding: 12px 0 12px 20px;
  border-bottom: 1px solid var(--rule);
  font-size: var(--t-m);
  font-weight: 400;
  text-align: left;
  vertical-align: baseline;
}

.cmp tbody th,
.cmp thead th:first-child {
  width: 9rem;
  padding-left: 0;
  color: var(--muted);
}

.cmp thead th {
  border-bottom: 1px solid var(--line);
  vertical-align: bottom;
}

.cmp thead a {
  display: block;
  color: var(--ink);
  font: 500 var(--t-l) / 1.2 var(--sans);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.cmp thead a:hover {
  text-decoration: underline;
}

.cmp .remove {
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: var(--t-xs);
  text-decoration: underline;
  text-underline-offset: 0.22em;
  cursor: pointer;
}

.cmp .price {
  margin: 0 0 0 -0.3rem;
}

.cmp .group th {
  padding-top: 28px;
  color: var(--ink);
  font-weight: 500;
}

/* 說明頁 */

.prose > h2 {
  margin: 28px 0 6px;
}

.prose > p {
  max-width: 42em;
}

.prose > p + p,
.prose > p + ul,
.prose > ul + p,
.prose > ul + .board-wrap,
.prose > .board-wrap + p {
  margin-top: 8px;
}

.prose h1 + .dek {
  margin-top: 6px;
}

.defs {
  max-width: 760px;
  border-collapse: collapse;
  border-top: 1px solid var(--line);
}

.defs th,
.defs td {
  padding: 7px 0;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: baseline;
}

.defs th {
  width: 7.5em;
  padding-right: 16px;
  font-weight: 500;
  white-space: nowrap;
}

/* 頁尾 */

.foot {
  margin-top: clamp(36px, 5vw, 60px);
  padding-block: 0 36px;
  color: var(--muted);
  font-size: var(--t-xs);
  line-height: 1.6;
}

.foot::before {
  display: block;
  margin-bottom: 12px;
  border-top: 1px solid var(--line);
  content: "";
}

.foot p {
  max-width: 50em;
}

.foot p + p {
  display: flex;
  gap: 24px;
  margin-top: 10px;
}

/* 手機：每個型號一塊，型號在上，三家價格排一排 */

@media (max-width: 760px) {
  :root {
    --t-l: 1.25rem;    /* 20 */
    --t-xl: 1.625rem;  /* 26 */
    --t-xxl: 1.625rem; /* 26 */
  }

  h1 {
    line-height: 1.3;
  }

  .top nav {
    gap: 0 24px;
  }

  .top nav a {
    padding-block: 6px;
  }

  .board thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .board,
  .board tbody {
    display: block;
  }

  .board tbody tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0 10px;
    padding: 8px 0 7px;
  }

  .board tbody tr:hover {
    background: none;
  }

  .board td,
  .board tbody th {
    width: auto;
    padding: 0;
    text-align: left;
  }

  .board .c-model {
    grid-column: 1 / -1;
    padding-bottom: 2px;
  }

  /* 標價和卡名各一行，三欄對齊 */
  .sub {
    flex-direction: column;
    justify-content: flex-start;
    margin-top: 1px;
    line-height: 1.4;
    white-space: normal;
  }

  .board .c-p,
  .board .c-gap,
  .board .c-hist {
    width: auto;
  }

  .board .c-p::before {
    display: block;
    color: var(--muted);
    font: 400 var(--t-xs) / 1.5 var(--sans);
    content: attr(data-store);
  }

  .price {
    margin: 0 0 0 -0.3rem;
  }

  .board .c-gap,
  .board .c-hist {
    padding-top: 4px;
    font-size: var(--t-m);
  }

  .board .c-gap {
    grid-column: 1 / -1;
    white-space: nowrap;
  }

  .spec {
    display: block;
    margin-left: 0;
    white-space: normal;
  }

  /* 六位數的先前紀錄也留在同一行，靠右 */
  .board .c-hist {
    grid-column: 2 / -1;
    text-align: right;
    white-space: nowrap;
  }

  .board .c-gap::before,
  .board .c-hist::before {
    margin-right: 8px;
    color: var(--muted);
    font: 400 var(--t-xs) / 1 var(--sans);
    content: attr(data-label);
  }

  .filters {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
  }

  .field-q {
    grid-column: 1 / -1;
  }

  .tabs {
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
  }

  .find button {
    padding: 0 18px;
  }

  .store {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
    padding: 10px 0 12px;
  }

  .store-info {
    margin-top: 4px;
  }

  .item .offers .cond {
    display: none;
  }

  .item .offers .cond-narrow {
    display: block;
  }

  .item .offers td {
    padding-left: 8px;
    white-space: nowrap;
  }

  .records thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .records,
  .records tbody,
  .records tr,
  .records td,
  .records tbody th {
    display: block;
    padding: 0;
    text-align: left;
  }

  .records tr {
    padding: 12px 0;
  }

  .records td:nth-child(2) {
    padding-left: 0;
  }

  .specs {
    grid-template-columns: minmax(0, 1fr);
  }

  .specs dt {
    padding-bottom: 0;
    border-bottom: 0;
    font-size: var(--t-xs);
  }

  .specs dd {
    padding-top: 2px;
  }

  .cmp th,
  .cmp td {
    padding-left: 12px;
  }

  .cmp tbody th,
  .cmp thead th:first-child {
    width: 5.5rem;
  }

  .cmp thead a {
    font-size: var(--t-m);
  }

  .cmp .price {
    font-size: var(--t-l);
  }
}

@media print {
  body {
    background: #fff;
  }

  .top nav,
  .find,
  .filters,
  .tabs,
  #more,
  .foot p + p {
    display: none;
  }
}

/* Store links are secondary to the quote; never rely on color alone. */
.merchant-action { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-end; gap: .15rem .35rem; margin-top: .2rem; line-height: 1.35; font-size: var(--t-xs); }
.merchant-action a { display: inline-block; padding: .15rem 0; text-decoration: underline; text-underline-offset: .15em; }
.merchant-action a:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

.breadcrumbs { margin: .7rem 0 0; font-size: var(--t-xs); color: var(--muted); }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: .15rem .55rem; margin: 0; padding: 0; list-style: none; }
.breadcrumbs li + li::before { content: "/"; margin-right: .55rem; }
.breadcrumbs a { text-decoration: underline; text-underline-offset: .15em; }


/* A price is information; only the merchant link is interactive. */
.store-info .merchant-action, .cmp .merchant-action { justify-content: flex-start; }
.merchant-scan { color: #4b5f53; white-space: nowrap; }
.merchant-badge { font-size: .85em; border: 1px solid currentColor; border-radius: .25rem; padding: .05em .25em; }
@media (hover: hover) and (pointer: fine) {
  :is(.board, .store-price, .cmp, .offers) .price:hover {
    outline: 2px solid #397052;
    outline-offset: 2px;
    background-color: #e1f2e7;
    border-radius: .2rem;
  }
  :is(.board, .store-price, .cmp, .offers) .price.is-low:hover {
    background-color: #ffea6a;
    outline-color: #766000;
  }
}

@media (max-width: 760px) {
  .board .merchant-action { justify-content: flex-start; }
}

.reward-formula { display: block; color: #365946; font: 500 var(--t-xs) / 1.45 var(--sans); margin-top: .17rem; white-space: normal; }

/* 比價結果：賣場名稱和省下金額各站一行。 */
.saving { display: inline-block; vertical-align: top; line-height: 1.3; }
.saving-store { display: block; color: var(--muted); font-size: var(--t-xs); white-space: normal; }
.saving-value { display: block; white-space: nowrap; font-weight: 700; }

/* A self-contained card selector; nothing is saved or sent when selecting a card. */
.card-control {
  display: grid; grid-template-columns: minmax(14rem, max-content) minmax(0, 1fr);
  column-gap: 1rem; row-gap: .35rem; align-items: end; margin: 1rem 0;
  padding: .8rem 1rem; background: var(--surface); border: 1px solid var(--line);
  border-radius: .4rem;
}
.card-control .field { min-width: 0; }
.card-control select { width: 100%; }
.card-control p, .tier-order { margin: 0; color: var(--muted); font-size: var(--t-xs); }
.card-control a { margin-inline-start: .4em; }
#card-assumptions, .card-control details, .card-control noscript { grid-column: 1 / -1; }
.card-control summary { cursor: pointer; font-size: var(--t-s); }
.card-control ul { margin: .35em 0; padding-inline-start: 1.5em; font-size: var(--t-xs); }
.product-tier {
  display: block; width: fit-content; max-width: 100%; color: var(--muted);
  font-size: var(--t-xs); line-height: 1.35; border-bottom: 1px solid var(--rule);
}
@media (max-width: 760px) {
  .card-control { grid-template-columns: minmax(0, 1fr); padding: .65rem .8rem; }
}

/* Same-size series comparison: stack readable cards rather than clipping a wide table. */
.compare-modes:not([hidden]) { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1rem; }
.compare-modes button { min-height: 44px; padding: .35rem .8rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; }
.compare-modes button[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 -2px var(--ink); font-weight: 600; }
.series-select { max-width: 16rem; margin: .75rem 0 .4rem; }
.series-select select { min-height: 44px; }
.series-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15.5rem), 1fr)); gap: .8rem; align-items: stretch; }
.series-tile { min-width: 0; padding: .85rem; border: 1px solid var(--rule); border-radius: var(--radius); }
.series-tile h2 { margin: .2rem 0 .35rem; font-size: var(--t-l); }
.series-tile p { margin: 0; }
.series-tile a { color: var(--ink); overflow-wrap: anywhere; }
.series-tier { color: var(--ink); font-size: var(--t-xs); font-weight: 700; }
.series-note, .series-proof { color: var(--muted); font-size: var(--t-xs); line-height: 1.5; }
.series-offers { margin: .75rem 0; }
.series-offers > div { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .2rem .45rem; align-items: start; border-top: 1px solid var(--rule); padding: .45rem 0; }
.series-offers dt { font-size: var(--t-xs); }
.series-offers dd { margin: 0; min-width: 0; text-align: right; }
.series-offers .series-note { display: block; }
.series-amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.series-proof { display: flex; flex-wrap: wrap; gap: .4rem .65rem; }

.facet {
  min-width: 0; align-self: start; border: 1px solid var(--line);
  background: var(--paper); border-radius: var(--radius);
}
.facet summary {
  min-height: 42px; padding: .4rem .55rem; cursor: pointer;
  color: var(--ink); font-size: var(--t-s);
}
.facet summary span { margin-inline-start: .35rem; color: var(--muted); font-size: var(--t-xs); }
.facet-options {
  min-width: 0; min-inline-size: 0; max-height: 15rem; overflow-y: auto;
  margin: 0; padding: .15rem .55rem .45rem; border: 0;
}
.facet-options label {
  display: flex; gap: .4rem; min-height: 34px; align-items: baseline;
  color: var(--ink); cursor: pointer; padding: .22rem 0; font-size: var(--t-s);
}
.facet-options label span { overflow-wrap: anywhere; }
.facet-options input { flex: none; accent-color: var(--ink); }
.facet-clear { align-self: start; justify-self: start; min-height: 34px; }
#filters .facet-clear[hidden] { display: none; }

/* 窄版表格：信用卡、回饋試算、賣場各一區，避免多段資料黏在一起。 */
@media (max-width: 1150px) {
  .board .sub { flex-wrap: wrap; white-space: normal; }
  .board .spec { white-space: normal; overflow-wrap: anywhere; }
  .board .sub + .reward-formula,
  .board .sub ~ .merchant-action {
    border-top: 1px solid var(--line);
    margin-top: .3rem;
    padding-top: .28rem;
  }
  .board .merchant-scan + a {
    border-inline-start: 1px solid var(--line);
    padding-inline-start: .35rem;
  }
}
@media (min-width: 761px) {
  .board .c-gap { border-inline-start: 1px solid var(--rule); }
}
@media (max-width: 760px) {
  .board td.c-gap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: .45rem;
    padding: .48rem .55rem;
    border-top: 1px solid var(--line);
    background: var(--surface);
  }
  .board td.c-gap::before { font-weight: 600; }
  .board td.c-gap .saving { text-align: right; }
}

.foot-social { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin-top: .75rem; }
.foot-social a {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 44px;
  color: var(--ink); font-size: var(--t-s); text-underline-offset: .2em;
}
.foot-social svg { flex: 0 0 20px; }

.seasonal-cards { list-style: none; padding-inline-start: 0; }
.seasonal-cards li { padding: .8rem 0; border-top: 1px solid var(--rule); }
.seasonal-cards li > span { display: block; margin-top: .28rem; }
.issuer-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: .5rem 1rem; }
.issuer-list small { display: block; color: var(--muted); }
