/* 刷卡回饋評比：一般消費性網站的樣式（白色卡片、圓角、單一品牌色）
   字只用兩種大小：內文 1rem、小字 --fs-s（15px），長輩也看得清楚；能點的東西至少 44px 高 */
:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #f1f0eb;
  --stage: #eeece5;
  --text: #17191c;
  --text-2: #464b51;
  --line: #e3e1da;
  --line-2: #cdcac1;
  --brand: #0b6e4f;
  --brand-strong: #075a40;
  --brand-soft: #e1f0e9;
  --on-brand: #ffffff;
  --warn: #8a4b00;
  --warn-bg: #fff2d9;
  --danger: #b42318;
  --radius: 16px;
  --radius-sm: 10px;
  --fs-s: .9375rem;
  --tap: 44px;
  --topbar-h: 60px;
  --shadow: 0 1px 2px rgba(20, 24, 28, .05), 0 4px 14px rgba(20, 24, 28, .06);
  --shadow-lg: 0 16px 40px rgba(20, 24, 28, .18);
  --card-drop: drop-shadow(0 6px 10px rgba(20, 16, 8, .22));
  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111315; --surface: #1a1d20; --surface-2: #23272b; --stage: #23272b; --text: #f1f2f3; --text-2: #b8bec5;
    --line: #2d3236; --line-2: #3d4348; --brand: #3fbf8f; --brand-strong: #63d3a8; --brand-soft: #16362b; --on-brand: #07140e;
    --warn: #f3b866; --warn-bg: #3a2b12; --danger: #ff8a80; --card-drop: drop-shadow(0 6px 10px rgba(0, 0, 0, .55)); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111315; --surface: #1a1d20; --surface-2: #23272b; --stage: #23272b; --text: #f1f2f3; --text-2: #b8bec5;
  --line: #2d3236; --line-2: #3d4348; --brand: #3fbf8f; --brand-strong: #63d3a8; --brand-soft: #16362b; --on-brand: #07140e;
  --warn: #f3b866; --warn-bg: #3a2b12; --danger: #ff8a80; --card-drop: drop-shadow(0 6px 10px rgba(0, 0, 0, .55)); color-scheme: dark;
}

* { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 80px); }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.6; }
.page { max-width: 1200px; margin: 0 auto; padding: 0 16px 120px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; }
a { color: var(--brand); }
.hint, .note { color: var(--text-2); font-size: var(--fs-s); }
.warn-text { color: var(--warn); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- 頂部導覽 ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1200px; margin: 0 auto; padding: 0 16px; height: 60px; display: flex; align-items: center; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap); font-weight: 700; font-size: 1.05rem; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand-mark { width: 30px; height: 21px; }
.brand-mark rect { fill: var(--brand); }
.brand-mark .stripe { fill: var(--brand-strong); opacity: .9; }
.brand-mark .chip { fill: #e7c86a; }
.views { display: flex; gap: 4px; height: 100%; }
.views button { border: 0; background: none; padding: 0 12px; height: 100%; font-size: 1rem; font-weight: 500; color: var(--text-2); border-bottom: 3px solid transparent; cursor: pointer; border-radius: 0; }
.views button:hover { color: var(--text); }
.views button[aria-pressed="true"] { color: var(--text); font-weight: 700; border-bottom-color: var(--brand); }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.updated { font-size: var(--fs-s); color: var(--text-2); white-space: nowrap; }
.icon-btn { width: var(--tap); height: var(--tap); border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: inline-grid; place-items: center; cursor: pointer; color: var(--text); padding: 0; flex: none; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.icon-btn:hover { background: var(--surface-2); }
@media (max-width: 720px) {
  .topbar-in { gap: 2px 10px; height: auto; flex-wrap: wrap; padding-top: 4px; }
  .views { order: 3; width: 100%; height: 46px; }
  .views button { flex: 1; }
  .updated { display: none; }
}

/* ---------- 表單元件 ---------- */
input, select, button, textarea { font: inherit; color: var(--text); }
input[type="number"], input[type="text"], input[type="date"], input[type="search"], select {
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 8px 12px; min-height: var(--tap); width: 100%;
}
select { padding-right: 32px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface); font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--text); }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); font-weight: 700; }
.btn.primary:hover { background: var(--brand-strong); }
.btn.ghost { background: transparent; }
.btn.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-strong); font-weight: 700; }
.btn.small { padding: 0 16px; font-size: var(--fs-s); }
button.link { border: 0; padding: 0; min-height: var(--tap); background: none; color: var(--brand); text-decoration: underline; cursor: pointer; font-weight: 500; text-align: left; }
label.check { display: flex; gap: 10px; align-items: center; min-height: var(--tap); padding: 4px 0; cursor: pointer; }
label.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--brand); flex: none; }
label.check.inline { white-space: nowrap; }
.sel { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-s); color: var(--text-2); white-space: nowrap; }
.sel select, .sel input { width: auto; color: var(--text); font-size: 1rem; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.row-actions .spacer { flex: 1; }
.row-actions.center { justify-content: center; margin-top: 22px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 2px; }
.seg button { border: 0; background: none; min-height: var(--tap); padding: 0 18px; border-radius: 999px; cursor: pointer; color: var(--text-2); font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* ---------- 頁首 ---------- */
.intro { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px; align-items: center; padding: 32px 0 14px; }
.intro h1 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); font-weight: 700; letter-spacing: .01em; }
.intro p { margin: 10px 0 0; font-size: 1.05rem; color: var(--text-2); max-width: 36em; }
.intro-calc { grid-template-columns: minmax(0, 1fr); padding-bottom: 8px; }
.search { position: relative; margin-top: 22px; max-width: 520px; }
.search svg { position: absolute; left: 16px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); fill: none; stroke: var(--text-2); stroke-width: 2; stroke-linecap: round; }
.search input { min-height: 54px; padding-left: 46px; border-radius: 999px; font-size: 1.05rem; box-shadow: var(--shadow); border-color: var(--line); }
.intro-fan { position: relative; height: 230px; }
.intro-fan img { position: absolute; left: 50%; bottom: 6px; width: min(230px, 46%); transform-origin: 50% 170%;
  transform: translateX(-50%) rotate(calc(var(--i) * 10deg)); filter: var(--card-drop); transition: transform .35s; }
.intro-fan:hover img { transform: translateX(-50%) rotate(calc(var(--i) * 14deg)); }
/* 手機：拿掉扇形圖、縮短說明，讓第一張卡進到第一個畫面 */
@media (max-width: 760px) {
  .intro { grid-template-columns: minmax(0, 1fr); padding: 16px 0 6px; gap: 0; }
  .intro h1 { font-size: 1.5rem; }
  .intro p { margin-top: 4px; font-size: var(--fs-s); }
  .intro p .more { display: none; }
  .intro-fan { display: none; }
  .search { margin-top: 12px; }
  .search input { min-height: 50px; }
}

/* ---------- 類別分頁 ---------- */
.cats-h { font-size: 1rem; font-weight: 700; margin: 10px 0 2px; }
.cats-bar { position: sticky; top: var(--topbar-h); z-index: 15; background: var(--bg); border-bottom: 1px solid var(--line); margin: 0 -16px; padding: 0 16px; }
.cats { position: relative; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cats-bar.more-r .cats { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 64px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 64px), transparent); }
.cats-bar.more-l .cats { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 64px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 64px), transparent); }
.cats-bar.more-l.more-r .cats { -webkit-mask-image: linear-gradient(to right, transparent, #000 64px, #000 calc(100% - 64px), transparent); mask-image: linear-gradient(to right, transparent, #000 64px, #000 calc(100% - 64px), transparent); }
.cats button { flex: none; border: 0; background: none; padding: 8px 14px; min-height: 62px; cursor: pointer; color: var(--text-2); font-weight: 500; font-size: 1rem;
  border-bottom: 3px solid transparent; border-radius: 0; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; line-height: 1.35; }
.cats .cv { font-size: var(--fs-s); font-variant-numeric: tabular-nums; }
.cats button:hover { color: var(--text); }
.cats button[aria-selected="true"] { color: var(--text); font-weight: 700; border-bottom-color: var(--brand); }
.cats button[aria-selected="true"] .cv { color: var(--brand-strong); }
.cats-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: var(--tap); height: var(--tap); border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow); display: none; place-items: center; cursor: pointer; color: var(--text); padding: 0; }
.cats-arrow.l { left: 6px; }
.cats-arrow.r { right: 6px; }
.cats-arrow svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.cats-arrow:hover { background: var(--surface-2); }
.cats-bar.more-l .cats-arrow.l, .cats-bar.more-r .cats-arrow.r { display: grid; }
@media (hover: none) { .cats-arrow { display: none !important; } }

/* ---------- 篩選列 ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; padding: 14px 0; }
.filters .seg { margin-left: auto; }
.adv-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.adv-btn .dot { display: none; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); }
.adv-btn .adv-n-t { color: var(--brand-strong); font-weight: 700; }
.adv-btn[aria-expanded="true"] { border-color: var(--brand); background: var(--surface); }
.adv { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.adv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 4px 24px; align-items: center; }
.adv .hint { margin: 8px 0 0; }
/* 手機：銀行、回饋形式、條件排成一列 */
@media (max-width: 640px) {
  #view-browse .filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; padding: 12px 0; }
  #view-browse .filters .sel { display: block; }
  #view-browse .filters .sel select { width: 100%; padding: 8px 26px 8px 10px; }
  #view-browse .filters .seg { display: none; }
  #view-browse .filters .sel-l, .adv-btn .lg, .adv-btn .adv-n-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .adv-btn { padding: 0 12px; gap: 4px; }
  .adv-btn .dot { display: block; }
}

/* ---------- 結果 ---------- */
.result-bar { margin: 4px 0 14px; }
.result-bar b { display: block; font-size: 1.05rem; }
.result-bar .hint { margin: 2px 0 0; }
.empty { background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--text-2); }
.busy { padding: 28px; text-align: center; color: var(--text-2); }
#browse-wrap.stale { opacity: .55; transition: opacity .15s; }

/* 商品卡：比較卡片和試算排名共用。卡片夠寬時卡面放左邊，一個畫面看得到更多張 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: 16px; }
.pcard { container-type: inline-size; display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; transition: box-shadow .2s, transform .2s; }
.pcard:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.pcard.picked { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand), var(--shadow); }
.pc { flex: 1; min-width: 0; display: grid; grid-template-rows: auto 1fr; }
.pcard-face { position: relative; width: 100%; height: 150px; background: var(--stage); display: flex; align-items: center; justify-content: center; padding: 16px 28px; cursor: pointer; border: 0; border-radius: 0; }
.pcard-face .card-img { max-height: 118px; }
.pcard-face .noimg { width: min(72%, 190px); }
.rank { position: absolute; left: 10px; top: 10px; min-width: 32px; height: 32px; padding: 0 8px; border-radius: 999px; background: var(--surface); color: var(--text); font-size: var(--fs-s); font-weight: 700; display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.rank.top { background: var(--brand); color: var(--on-brand); }
.pcard-body { padding: 14px 18px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pcard-bank { font-size: var(--fs-s); color: var(--text-2); }
.pcard-name { font-size: 1.12rem; font-weight: 700; line-height: 1.4; }
.main-rate { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 10px; }
.main-rate .lbl { font-size: var(--fs-s); color: var(--text-2); }
.main-rate .val { font-size: 1.85rem; font-weight: 700; color: var(--brand-strong); font-variant-numeric: tabular-nums; line-height: 1.2; }
.main-rate .val.zero, .main-rate .val.neg { color: var(--text-2); }
.main-rate .cap { width: 100%; font-size: var(--fs-s); color: var(--text-2); }
.others { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; margin: 0; font-size: var(--fs-s); }
.others div { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); padding: 4px 0; }
.others dt { color: var(--text-2); }
.others dd { margin: 0; font-weight: 500; font-variant-numeric: tabular-nums; }
.facts { margin: 0; font-size: var(--fs-s); }
.facts div { display: grid; grid-template-columns: 4em minmax(0, 1fr); gap: 10px; border-bottom: 1px solid var(--line); padding: 4px 0; }
.facts dt { color: var(--text-2); }
.facts dd { margin: 0; }
.facts .warn dd { color: var(--warn); }
.meta { font-size: var(--fs-s); color: var(--text-2); display: flex; flex-direction: column; gap: 2px; }
.meta .warn-line { color: var(--warn); }
.pcard-actions { margin-top: auto; display: flex; gap: 8px; }
.pcard-actions .btn { flex: 1; }
@container (max-width: 439px) {
  .pcard-face { height: 132px; padding: 14px 28px; }
  .pcard-face .card-img { max-height: 104px; }
}
@container (min-width: 440px) {
  .pc { grid-template-columns: 176px minmax(0, 1fr); grid-template-rows: none; }
  .pcard-face { height: auto; padding: 48px 16px 18px; }
  .pcard-face .card-img { max-height: 150px; }
  .pcard-face .noimg { width: 100%; }
}
@container (min-width: 620px) {
  .others { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* 表格模式 */
.table-scroll { overflow: auto; max-height: 78vh; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.table-scroll.flat { max-height: none; box-shadow: none; }
.x-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
table.browse { font-size: var(--fs-s); border-collapse: separate; border-spacing: 0; }
table.browse th, table.browse td { border-bottom: 1px solid var(--line); padding: 8px 10px; vertical-align: middle; background: var(--surface); }
table.browse thead th { position: sticky; top: 0; z-index: 2; color: var(--text-2); white-space: nowrap; text-align: right; }
table.browse .c-name { position: sticky; left: 0; z-index: 1; min-width: 240px; max-width: 300px; text-align: left; border-right: 1px solid var(--line); }
table.browse thead .c-name { z-index: 3; }
table.browse .c-rate { text-align: right; min-width: 86px; white-space: nowrap; }
table.browse .c-act { text-align: center; white-space: nowrap; }
table.browse .c-fee { min-width: 230px; text-align: left; }
table.browse tr.picked td { background: var(--brand-soft); }
.name-cell { display: flex; gap: 10px; align-items: center; }
.r { font-weight: 700; font-variant-numeric: tabular-nums; }
.best .r, .r.best { color: var(--brand-strong); }
td.best { background: color-mix(in srgb, var(--brand-soft) 70%, var(--surface)) !important; }
.sub { font-size: var(--fs-s); color: var(--text-2); line-height: 1.4; white-space: normal; }
button.sort { border: 0; background: none; padding: 0; min-height: var(--tap); cursor: pointer; font-weight: 700; color: var(--text-2); font-size: var(--fs-s); }
button.sort.on { color: var(--brand-strong); }

/* ---------- 卡面圖 ---------- */
.card-img, .cmp-img, .mini-img, .dt-img { display: block; height: auto; width: auto; max-width: 100%; filter: var(--card-drop); }
.mini-img { max-height: 40px; max-width: 62px; flex: none; }
.cmp-img { max-height: 110px; max-width: 180px; margin: 0 auto 10px; }
.dt-img { max-height: 190px; max-width: 300px; }
/* 沒抓到卡面圖時，用銀行色排一張紙卡（純裝飾，卡名旁邊都有文字） */
.noimg { display: flex; flex-direction: column; justify-content: space-between; aspect-ratio: 1.586; background: var(--bank, #2b3a44); color: #fff;
  border-radius: 6% / 9.5%; filter: none; box-shadow: 0 6px 14px rgba(20,16,8,.22); padding: 7% 7% 8%; overflow: hidden; position: relative; text-align: left; }
.noimg::after { content: ""; position: absolute; right: -20%; top: -40%; width: 70%; height: 180%; background: rgba(255,255,255,.08); transform: rotate(25deg); }
.noimg .nb { font-size: .7rem; letter-spacing: .08em; opacity: .9; }
.noimg .chip { display: block; width: 16%; aspect-ratio: 1.3; border-radius: 3px; background: #d8c27a; }
.noimg b { font-size: .85rem; line-height: 1.3; }
.mini-img.noimg { width: 62px; padding: 4px 5px; }
.mini-img.noimg .nb, .mini-img.noimg b { font-size: 7px; }
.cmp-img.noimg { width: 170px; }
.dt-img.noimg { width: 280px; }
.dt-img.noimg b { font-size: 1rem; }

/* ---------- 比較列 ---------- */
.tray { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 0 12px 12px; pointer-events: none; }
.tray-in { pointer-events: auto; max-width: 900px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; }
.tray-cards { display: flex; gap: 10px; flex: 1; min-width: 0; overflow-x: auto; align-items: center; scrollbar-width: none; }
.tray-cards::-webkit-scrollbar { display: none; }
.tray-card { display: flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: 12px; padding: 4px 4px 4px 8px; flex: none; max-width: 240px; }
.tray-card span { font-size: var(--fs-s); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray-card button { flex: none; border: 0; background: none; cursor: pointer; width: 40px; height: 40px; border-radius: 50%; color: var(--text-2); font-size: 1.1rem; }
.tray-card button:hover { background: var(--line); }
.tray-slot { flex: none; padding: 0 14px; height: 48px; border: 1px dashed var(--line-2); border-radius: 12px; display: grid; place-items: center; font-size: var(--fs-s); color: var(--text-2); }
.tray-actions { display: flex; gap: 8px; }
@media (max-width: 640px) {
  .tray { padding: 0 8px 8px; }
  .tray-in { gap: 8px; padding: 8px; }
  .tray-cards { gap: 6px; }
  .tray-slot, .tray-card span { display: none; }
  .tray-card { padding: 2px 2px 2px 6px; gap: 0; }
  .tray-card .mini-img { max-width: 46px; max-height: 32px; }
  .tray-actions .btn { padding-inline: 14px; }
}

/* 小提示（例如「最多比較 4 張」） */
.toast { position: fixed; left: 50%; bottom: 104px; transform: translateX(-50%); z-index: 60; background: var(--text); color: var(--bg); padding: 12px 20px; border-radius: 12px;
  box-shadow: var(--shadow-lg); font-weight: 500; max-width: calc(100vw - 32px); width: max-content; text-align: center; }

/* ---------- 彈出面板 ---------- */
dialog.sheet { border: 0; padding: 0; border-radius: 20px; width: min(980px, calc(100vw - 32px)); max-height: calc(100vh - 48px); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); overflow: hidden; }
dialog.sheet[open] { display: flex; flex-direction: column; }
dialog.sheet::backdrop { background: rgba(10, 12, 14, .5); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px 12px 22px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 1.12rem; }
.sheet-body { overflow: auto; padding: 18px 22px 26px; }
@media (max-width: 640px) {
  dialog.sheet { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: 20px 20px 0 0; }
  .sheet-body { padding: 14px 16px 24px; }
}

/* 詳情 */
.dt-top { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 22px; align-items: center; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.dt-face { background: var(--stage); border-radius: var(--radius); padding: 18px 24px; display: grid; place-items: center; min-width: 260px; }
.dt-top h3 { font-size: 1.35rem; margin: 2px 0 6px; }
.dt-top .row-actions { margin-top: 12px; }
@media (max-width: 640px) { .dt-top { grid-template-columns: minmax(0, 1fr); } .dt-face { min-width: 0; } }
.dt-sec { padding: 18px 0 4px; }
.dt-sec h4 { font-size: 1.05rem; margin-bottom: 10px; }
.dt-sec h4.sub-h { margin-top: 18px; }
.dt-sec .hint { margin: 10px 0 0; }
.dt-calc h4 .money { font-size: 1.35rem; }
.rate-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.rate-grid .it { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.rate-grid .it .k { font-size: var(--fs-s); color: var(--text-2); }
.rate-grid .it .v { font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.rate-grid .it.best .v { color: var(--brand-strong); }
.rate-grid .it .sub { margin-top: 2px; }
.dt-list { margin: 0; padding-left: 1.2em; }
.dt-list li { margin: 4px 0; }
.dt-list.warn li::marker { color: var(--warn); }
.rule { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 8px; }
.rule .rh { display: flex; justify-content: space-between; gap: 10px; font-weight: 700; }
.rule .rh .rv { color: var(--brand-strong); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rule .rm { font-size: var(--fs-s); color: var(--text-2); margin-top: 2px; }
.quote { margin: 8px 0 0; padding: 8px 12px; background: var(--surface-2); border-radius: 8px; font-size: var(--fs-s); color: var(--text-2); }
table.calc-tbl th, table.calc-tbl td { text-align: left; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; font-size: var(--fs-s); }
table.calc-tbl th { color: var(--text-2); font-weight: 500; white-space: nowrap; }
table.calc-tbl .n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.calc-tbl tfoot td { font-weight: 700; }

/* 比較表 */
table.compare { font-size: var(--fs-s); border-collapse: separate; border-spacing: 0; }
table.compare th, table.compare td { border-bottom: 1px solid var(--line); padding: 10px 12px; vertical-align: top; text-align: left; background: var(--surface); }
table.compare thead th { text-align: center; min-width: 190px; vertical-align: bottom; }
table.compare thead th b { display: block; font-size: 1rem; }
table.compare thead .btn { margin-top: 6px; }
table.compare tbody th[scope="row"] { position: sticky; left: 0; z-index: 1; min-width: 104px; color: var(--text-2); font-weight: 500; }
table.compare td.n { text-align: center; }
table.compare tr.group th { background: var(--surface-2); color: var(--text); font-weight: 700; }
table.compare ul { margin: 0; padding-left: 1.1em; }
table.compare li { margin: 2px 0; }

/* ---------- 試算頁 ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; margin-top: 18px; }
.panel-head { margin-bottom: 12px; }
.panel-head h2 { font-size: 1.15rem; display: flex; align-items: center; gap: 10px; }
.panel-head .hint { margin: 6px 0 0; }
.step { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: var(--on-brand); font-size: var(--fs-s); font-weight: 700; flex: none; }
.cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 28px; }
.cols h3 { font-size: 1.05rem; margin-bottom: 4px; }
@media (max-width: 860px) { .cols { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .panel { padding: 16px 14px; } }

.spend th { text-align: left; font-size: var(--fs-s); font-weight: 500; color: var(--text-2); padding: 4px 8px 6px 0; }
.spend td { padding: 4px 8px 4px 0; vertical-align: middle; }
.spend td.name { width: 24%; }
.spend td.amt { width: 120px; }
.spend td.del { width: 48px; }
.spend .del button { width: var(--tap); height: var(--tap); border-radius: 50%; border: 0; background: none; cursor: pointer; color: var(--text-2); font-size: 1.1rem; }
.spend .del button:hover { background: var(--surface-2); color: var(--danger); }
.spend tfoot td { font-weight: 700; padding-top: 10px; }
@media (max-width: 640px) {
  .spend thead { display: none; }
  .spend tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .spend td { padding: 0; }
  .spend td.name { grid-column: 1 / -1; }
  .spend td.amt, .spend td.del { width: auto; }
}
.bank-pick { display: flex; flex-wrap: wrap; gap: 0 16px; font-size: var(--fs-s); padding: 6px 0; }
.bank-pick label { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; min-height: var(--tap); }
.bank-pick input { width: 20px; height: 20px; accent-color: var(--brand); }
details.fold { border-top: 1px solid var(--line); padding: 4px 0; }
details.fold > summary { cursor: pointer; font-weight: 500; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: var(--tap); }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: "展開"; flex: none; font-size: var(--fs-s); color: var(--brand); }
details.fold[open] > summary::after { content: "收起"; }
.units td { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-s); }
.units td:last-child { width: 110px; }

/* 搭配、我手上的卡 */
.money { color: var(--brand-strong); font-weight: 700; font-variant-numeric: tabular-nums; }
.combo { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-top: 12px; }
.combo-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.combo-money { text-align: right; }
.combo-money .money { font-size: 1.45rem; }
.combo-money .note { display: block; }
table.alloc { margin-top: 8px; }
table.alloc td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-s); vertical-align: middle; }
table.alloc td.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.alloc-card { display: inline-flex; align-items: center; gap: 8px; }
.mine-total { font-size: 1.05rem; }
.mine-total .money { font-size: 1.45rem; }
.mine-extra { font-size: 1.05rem; margin-top: 20px; }

/* ---------- 頁尾 ---------- */
.foot { border-top: 1px solid var(--line); background: var(--surface); }
.foot-in { max-width: 1200px; margin: 0 auto; padding: 22px 16px 120px; font-size: var(--fs-s); color: var(--text-2); }
.foot-in p { margin: 0 0 6px; }

/* ---------- 鍵盤焦點、減少動畫 ---------- */
:is(a, button, input, select, summary, textarea, [tabindex]):focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 60%, transparent); outline-offset: 2px; }
.cats button:focus-visible, .pcard-face:focus-visible { outline-offset: -3px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .pcard:hover { transform: none; }
  .intro-fan:hover img { transform: translateX(-50%) rotate(calc(var(--i) * 10deg)); }
}

/* 示範版 */
.demo-tag { margin-left: 8px; font-size: var(--fs-s); font-weight: 500; color: var(--text-2); }
