/* 撲克工具箱 — poker-table luxury dark theme, mobile-first */
:root {
  --bg: #0b0e0d;
  --bg2: #14181a;
  --bg3: #1d2326;
  --border: #2c3437;
  --border-soft: #242b2e;
  --text: #ece9e1;
  --muted: #93998f;
  --accent: #d4af6a;
  --accent2: #e8c87e;
  --accent-deep: #a9853f;
  --pos: #46d183;
  --neg: #e8596a;
  --tie: #c9a24b;
  --felt: #0d1512;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 28px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .3);
  --gold-grad: linear-gradient(135deg, #e8c87e, #d4af6a 55%, #b8934c);
  --inner-hi: inset 0 1px 0 rgba(255, 255, 255, .06);
  --accent-rgb: 212, 175, 106;
  --on-accent: #241a08;
  --glow1: rgba(24, 66, 48, .55);
  --glow2: rgba(13, 33, 24, .35);
  --bar-bg: rgba(15, 18, 17, .92);
  --topbar-bg: rgba(11, 14, 13, .82);
}

/* ===== 色系主題 ===== */
:root[data-theme="midnight"] {
  --bg: #0a0d13; --bg2: #121826; --bg3: #1a2233; --felt: #0c1220;
  --border: #2b3448; --border-soft: #232b3c;
  --accent: #8ab4f8; --accent2: #aecbfa; --accent-deep: #5e8ed6;
  --accent-rgb: 138, 180, 248; --on-accent: #0b1c33; --tie: #9db8e8;
  --gold-grad: linear-gradient(135deg, #aecbfa, #8ab4f8 55%, #5e8ed6);
  --glow1: rgba(26, 42, 74, .55); --glow2: rgba(14, 24, 46, .4);
  --bar-bg: rgba(12, 16, 24, .92); --topbar-bg: rgba(10, 13, 19, .82);
}
:root[data-theme="crimson"] {
  --bg: #0e0b0c; --bg2: #181214; --bg3: #221a1c; --felt: #150d0e;
  --border: #40312f; --border-soft: #332624;
  --accent: #e8938a; --accent2: #f2b3ab; --accent-deep: #c05f55;
  --accent-rgb: 232, 147, 138; --on-accent: #2e0e0a; --tie: #d89a84;
  --gold-grad: linear-gradient(135deg, #f2b3ab, #e8938a 55%, #c05f55);
  --glow1: rgba(66, 27, 24, .5); --glow2: rgba(36, 15, 13, .35);
  --bar-bg: rgba(17, 13, 14, .92); --topbar-bg: rgba(14, 11, 12, .82);
}
:root[data-theme="violet"] {
  --bg: #0d0b12; --bg2: #16121e; --bg3: #201a2c; --felt: #120d1a;
  --border: #382f48; --border-soft: #2c2439;
  --accent: #b79ce8; --accent2: #cdb8f2; --accent-deep: #8f6cc9;
  --accent-rgb: 183, 156, 232; --on-accent: #1d0e33; --tie: #b39ad8;
  --gold-grad: linear-gradient(135deg, #cdb8f2, #b79ce8 55%, #8f6cc9);
  --glow1: rgba(46, 30, 74, .5); --glow2: rgba(26, 16, 44, .38);
  --bar-bg: rgba(15, 12, 20, .92); --topbar-bg: rgba(13, 11, 18, .82);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f2efe8; --bg2: #faf8f3; --bg3: #ffffff; --felt: #e8e2d4;
  --border: #d3ccba; --border-soft: #e0dacb;
  --text: #26241d; --muted: #726f60;
  --accent: #a9853f; --accent2: #8a6a2a; --accent-deep: #6f541c;
  --accent-rgb: 169, 133, 63; --on-accent: #fffdf6; --tie: #a9853f;
  --gold-grad: linear-gradient(135deg, #c9a45c, #a9853f 55%, #8a6a2a);
  --glow1: rgba(24, 66, 48, .10); --glow2: rgba(13, 33, 24, .06);
  --bar-bg: rgba(250, 248, 243, .92); --topbar-bg: rgba(242, 239, 232, .85);
  --shadow: 0 10px 28px rgba(60, 50, 20, .10), 0 2px 6px rgba(60, 50, 20, .06);
  --inner-hi: inset 0 1px 0 rgba(255, 255, 255, .6);
}
/* 亮色主題：把深色版的半透明白改成實色面 */
:root[data-theme="light"] .card, :root[data-theme="light"] .stat-tile,
:root[data-theme="light"] .chart-menu-item { background: #fbfaf5; border-color: var(--border-soft); }
:root[data-theme="light"] input, :root[data-theme="light"] select, :root[data-theme="light"] textarea {
  background: #ffffff; border-color: var(--border);
}
:root[data-theme="light"] input:focus, :root[data-theme="light"] select:focus, :root[data-theme="light"] textarea:focus {
  background: #ffffff;
}
:root[data-theme="light"] .btn { background: #ffffff; border-color: var(--border); }
:root[data-theme="light"] .btn.primary { background: var(--gold-grad); border-color: transparent; }
:root[data-theme="light"] .tabs { border-top-color: rgba(0, 0, 0, .08); }
:root[data-theme="light"] .tab-btn { color: #8b8878; }
:root[data-theme="light"] .ev-item { background: #fbfaf5; border-color: var(--border-soft); }
:root[data-theme="light"] .street-block { background: #fbfaf5; }
:root[data-theme="light"] .session-item:hover, :root[data-theme="light"] .stats-table tr:nth-child(even) td { background: rgba(0, 0, 0, .025); }
:root[data-theme="light"] .equity-bar, :root[data-theme="light"] .bar-row .bar-track { background: rgba(0, 0, 0, .08); }
:root[data-theme="light"] .ev-result { background: rgba(0, 0, 0, .03); }
:root[data-theme="light"] input::placeholder, :root[data-theme="light"] textarea::placeholder { color: #a6a292; }
:root[data-theme="light"] .app-footer { color: #8b8878; }
:root[data-theme="light"] .nash-cell { background: rgba(0, 0, 0, .05); color: #8b8878; }
:root[data-theme="light"] .card-slot { background: rgba(0, 0, 0, .03); border-color: #c9c2b0; color: #a6a292; }
:root[data-theme="light"] .quiz-board { color: #26241d; }
* { box-sizing: border-box; }
/* hidden 屬性必須贏過任何 display 設定（.sheet-backdrop 的 flex 曾把它蓋掉，08-15 教訓） */
[hidden] { display: none !important; }
/* 全站尺寸以 rem 為主，改這個 font-size 就等於改字級（js/fontsize.js 會覆寫成 16×倍率） */
html { color-scheme: dark; font-size: 16px; }
/* 字級放大時任何元素橫向溢出都不准撐寬文件：文件一變寬，iOS 的 fixed 頂欄／底欄／FAB 會跟著位移、整頁往左跑。
   clip 不產生捲動容器（不影響 sticky/fixed）；舊 iOS 不認 clip 就退回 hidden。 */
html { overflow-x: hidden; overflow-x: clip; }
html, body {
  margin: 0; padding: 0;
  accent-color: var(--accent);
  background: var(--bg);
  background-image:
    radial-gradient(900px 480px at 50% -120px, var(--glow1), transparent 70%),
    radial-gradient(1200px 700px at 50% 110%, var(--glow2), transparent 70%);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC",
               "Microsoft JhengHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
/* 底部留白跟著 tab bar 的成長上限走（bar 用 clamp，最多長到 ~104px） */
main {
  max-width: 640px; margin: 0 auto;
  padding: 4px 14px calc(clamp(86px, 5.4rem, 104px) + env(safe-area-inset-bottom, 0px));
}

/* iOS 原生殼 safe-area：瀏海下的狀態列鋪一條同色模糊底，內容從 inset 下開始 */
body { padding-top: env(safe-area-inset-top, 0px); }
body::before {
  content: "";
  position: fixed; top: 0; left: 0; right: 0;
  height: env(safe-area-inset-top, 0px);
  background: var(--topbar-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  z-index: 30;
}

/* header — 小型導覽列（iOS style），標題靠左、同步鈕靠右 */
.app-header {
  max-width: 640px; margin: 0 auto;
  padding: 12px 14px 4px; position: relative;
  display: flex; align-items: center; gap: 6px;
  min-height: 56px;
}
.app-header h1 {
  /* px 不用 rem：頂欄是外框，字級調到最大時標題不該把 chips 擠掉 */
  margin: 0; font-size: 17px; letter-spacing: .02em; line-height: 1.3;
  font-weight: 800;
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: linear-gradient(120deg, var(--accent2), var(--accent) 70%, var(--accent-deep));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.app-header h1 .brand-icon {
  /* POKERHERO 品牌章：img 不受 h1 的 background-clip 文字漸層影響，可安全共存 */
  width: 34px; height: 34px; border-radius: 9px;
  vertical-align: -10px; margin-right: 10px;
}
/* header 右側 chips（語言 / 色系 / 字級 / 登入）統一尺寸，杜絕忽大忽小。
   字級用 px 不用 rem：頂欄是外框，放大字體時不該跟著撐開。 */
.hdr-chip, .icon-chip, .sync-login, .sync-chip {
  box-sizing: border-box;
  height: 32px; min-height: 0;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 12px; margin: 0;
  font-size: 12.5px; line-height: 1; letter-spacing: 0;
  color: var(--accent2);
  background: rgba(var(--accent-rgb), .07);
  border: 1px solid rgba(var(--accent-rgb), .3);
  border-radius: 999px;
  cursor: pointer; white-space: nowrap;
  flex-shrink: 0;
}
.app-footer {
  text-align: center; color: #5d645c; font-size: .72rem;
  max-width: 640px; margin: -70px auto 0;
  padding: 0 24px calc(96px + env(safe-area-inset-bottom, 0px));
}

/* 原生殼的賽事提醒開關（native.js 動態插入，瀏覽器版不會出現） */
.notif-toggle {
  display: flex; align-items: center; gap: 8px;
  margin: 10px 0; padding: 10px 12px;
  background: rgba(var(--accent-rgb), .06);
  border: 1px solid rgba(var(--accent-rgb), .18);
  border-radius: var(--radius-sm);
  font-size: .9rem; cursor: pointer;
}
.notif-toggle input { width: auto; margin: 0; }
.notif-toggle small { color: var(--muted); margin-left: auto; font-size: .72rem; }

/* tabs — 底部 tab bar（iOS style） */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex;
  max-width: 640px; margin: 0 auto;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
  background: var(--bar-bg);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, .07);
}
.tab-btn {
  position: relative;
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 5px 0 3px;
  background: none; border: none; border-radius: 10px;
  color: #7c837a; font-weight: 500;
  /* clamp：字級放大時 tab 列只跟著長一點點，7 顆才不會擠爆 */
  font-size: clamp(10px, .64rem, 12.5px);
  letter-spacing: .02em; cursor: pointer; white-space: nowrap;
  transition: color .18s, transform .18s;
  -webkit-tap-highlight-color: transparent;
}
.tab-btn svg {
  width: clamp(22px, 1.44rem, 26px); height: clamp(22px, 1.44rem, 26px);
  display: block; flex-shrink: 0;
  position: relative; z-index: 1;
  transition: transform .24s cubic-bezier(.34, 1.4, .64, 1), filter .18s;
}
.tab-btn span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; position: relative; z-index: 1; }
/* 選中 / 滑過時圖示後面浮出膠囊底，圖示微微上浮放大 */
.tab-btn::before {
  content: "";
  position: absolute; top: 2px; left: 50%;
  width: 44px; height: 30px; margin-left: -22px;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), .13);
  opacity: 0; transform: scale(.6);
  transition: opacity .2s, transform .28s cubic-bezier(.34, 1.4, .64, 1);
}
.tab-btn.active::before { opacity: 1; transform: none; }
/* 只在真的有滑鼠的裝置給 hover：手機點完 :hover 會黏著不放 */
@media (hover: hover) {
  .tab-btn:hover::before { opacity: 1; transform: none; }
  .tab-btn:hover { color: var(--accent2); }
  .tab-btn:hover svg { transform: translateY(-2px) scale(1.14); }
}
.tab-btn:active { transform: scale(.94); }
.tab-btn.active { color: var(--accent2); font-weight: 600; }
.tab-btn.active svg {
  transform: translateY(-1px) scale(1.08);
  filter: drop-shadow(0 0 6px rgba(var(--accent-rgb), .45));
}
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeUp .28s cubic-bezier(.22, .8, .36, 1); }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* cards / panels */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .028), rgba(255, 255, 255, .012));
  border: 1px solid rgba(255, 255, 255, .065);
  border-radius: var(--radius); padding: 16px 14px; margin: 12px 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
.card h2 {
  margin: 0 0 10px; font-size: .8rem; color: var(--accent);
  letter-spacing: .14em; font-weight: 600;
}
.hint { color: var(--muted); font-size: .84rem; margin: 4px 0 10px; line-height: 1.55; }
.row-between { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.row-between h2 { margin: 0; }

/* forms — iOS 填充式控件 */
label { display: block; margin: 10px 0; font-size: .84rem; color: var(--muted); letter-spacing: .04em; }
input, select, textarea {
  display: block; width: 100%; margin-top: 6px;
  padding: 11px 13px; font-size: 1rem; min-height: 46px;
  background: rgba(255, 255, 255, .05); color: var(--text);
  border: 1px solid rgba(255, 255, 255, .06); border-radius: 12px;
  transition: border-color .18s, background .18s, box-shadow .18s;
}
select {
  -webkit-appearance: none; appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2393998f' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
/* 下拉清單由瀏覽器畫，不吃 select 的半透明底色：不明講的話桌機 Chrome
   會給白底配我們的淺色字＝看不見（2026-08-06 踩過），這裡把底色/字色寫死。 */
select option { background-color: var(--bg2); color: var(--text); }
input[type="date"] { -webkit-appearance: none; appearance: none; }
textarea { font-family: inherit; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(var(--accent-rgb), .6);
  background: rgba(255, 255, 255, .065);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .14);
}
input::placeholder, textarea::placeholder { color: #565d55; }
input[type="range"] {
  padding: 0; border: none; background: transparent; box-shadow: none;
  height: 28px; margin-top: 8px;
}
input[type="range"]:focus { box-shadow: none; }
.note-body { white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* 兩欄 label 行數不同時，讓輸入框仍對齊底部 */
.grid-2 > label { display: flex; flex-direction: column; justify-content: flex-end; }
.grid-2 > label input, .grid-2 > label select { margin-top: 6px; }
/* 發數加減（2026-10-18）：stepper 自己吃掉 label 內 input 的 6px 間距；
   input 用 [type] 提高權重，才蓋得過上一行 .grid-2 > label input 的 margin-top */
.stepper { display: flex; align-items: center; gap: .4rem; margin-top: 6px; }
.stepper input[type="number"] { width: 4.2rem; text-align: center; margin-top: 0; -moz-appearance: textfield; appearance: textfield; }
/* 已有 −／＋ 鈕：藏掉桌機瀏覽器的原生上下箭頭（會把置中的數字擠歪）；鈕跟輸入框同高，手機好按 */
.stepper input[type="number"]::-webkit-inner-spin-button,
.stepper input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper .btn { padding: .35rem .8rem; min-width: 2.4rem; min-height: 46px; }
/* 場地下拉（2026-10-18）：選「其他…」時文字框接在 select 下方（兩個控制項直向排、間距同上面的 6px）；
   這一列改靠上對齊，場域選單才會跟場地選單同高，不會被往下推到文字框那一行 */
.venue-row { align-items: start; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.inline-select { width: auto; display: inline-block; margin: 0; padding: 8px 10px; }

/* buttons */
.btn {
  padding: 12px 16px; font-size: .95rem; font-weight: 600;
  background: rgba(255, 255, 255, .06); color: var(--text);
  border: 1px solid rgba(255, 255, 255, .07); border-radius: 12px;
  cursor: pointer;
  transition: border-color .18s, background .18s, transform .12s, box-shadow .18s, color .18s;
}
.btn:hover { border-color: rgba(var(--accent-rgb), .55); color: var(--accent2); }
.btn:active { transform: scale(.96); }
.btn:disabled {
  opacity: .4; cursor: not-allowed;
  border-color: var(--border); color: var(--text); transform: none;
}
.btn:focus-visible, .tab-btn:focus-visible, .card-slot:focus-visible, .deck-card:focus-visible {
  outline: 2px solid var(--accent2); outline-offset: 2px;
}
.btn.primary {
  background: var(--gold-grad);
  border-color: transparent; color: var(--on-accent); font-weight: 700;
  letter-spacing: .02em;
  box-shadow: 0 2px 10px rgba(var(--accent-rgb), .28);
}
.btn.primary:hover {
  color: var(--on-accent);
  box-shadow: 0 3px 14px rgba(var(--accent-rgb), .4);
}
.btn.full { width: 100%; margin-top: 10px; }
.btn.big { padding: 14px; font-size: 1rem; min-height: 50px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn-row .btn { flex: 1; min-width: 100px; }

/* session list */
.session-list { list-style: none; margin: 0; padding: 0; font-variant-numeric: tabular-nums; }
.session-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 6px; border-bottom: 1px solid var(--border-soft);
  border-radius: 8px;
  transition: background .15s;
}
.session-item:hover { background: rgba(255, 255, 255, .025); }
.session-item:last-child { border-bottom: none; }
.session-main { flex: 1; min-width: 0; }
.session-title { font-size: 1rem; }
.session-sub { color: var(--muted); font-size: .85rem; margin-top: 2px; word-break: break-all; }
.session-pl { font-weight: 800; font-size: 1.15rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.muted { color: var(--muted); }
.type-badge {
  font-size: .68rem; padding: 2px 8px; border-radius: 999px;
  background: rgba(var(--accent-rgb), .08); border: 1px solid rgba(var(--accent-rgb), .25);
  color: var(--accent2); letter-spacing: .04em;
  margin-right: 6px;
}
.del-btn {
  background: none; border: none; color: var(--neg);
  font-size: 1.2rem; padding: 8px; cursor: pointer; border-radius: 8px;
  transition: background .15s, transform .12s;
}
.del-btn:hover { background: rgba(232, 89, 106, .12); }
.del-btn:active { transform: scale(.9); }
.empty-msg { color: var(--muted); text-align: center; padding: 16px 0; }

/* stats table */
.stats-table-wrap { overflow-x: auto; }
.stats-table {
  width: 100%; border-collapse: collapse; font-size: .9rem;
  font-variant-numeric: tabular-nums;
}
.stats-table th, .stats-table td {
  padding: 9px 8px; text-align: right;
  border-bottom: 1px solid var(--border-soft); white-space: nowrap;
}
.stats-table th:first-child, .stats-table td:first-child { text-align: left; }
.stats-table th {
  color: var(--accent-deep); font-weight: 600; font-size: .8rem;
  text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid rgba(var(--accent-rgb), .25);
}
.stats-table tbody tr:nth-child(even) td,
.stats-table tr:nth-child(even) td { background: rgba(255, 255, 255, .018); }
.stats-table tr:last-child td { border-bottom: none; }

canvas { width: 100%; display: block; border-radius: 8px; }

/* ===== Equity tab ===== */
.hand-row { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.hand-label { width: 52px; font-size: .8rem; color: var(--muted); flex-shrink: 0; font-weight: 600; letter-spacing: .03em; }
.hand-label.hero { color: var(--pos); }
.hand-label.villain { color: var(--neg); }
.slots { display: flex; gap: 7px; flex-wrap: wrap; }
.card-slot {
  width: 48px; height: 66px;
  background: rgba(255, 255, 255, .025); color: #6b7269;
  border: 1.5px dashed #3b433f; border-radius: 7px;
  font-size: 1.05rem; font-weight: 700; cursor: pointer;
  transition: border-color .18s, background .18s, transform .12s, box-shadow .18s;
}
.card-slot:hover { border-color: rgba(var(--accent-rgb), .5); color: var(--accent2); }
.card-slot:active { transform: scale(.95); }
.card-slot.filled {
  border: 1px solid #cfd2d6; border-style: solid;
  background: linear-gradient(160deg, #ffffff, #eef0f2 70%, #e3e6ea);
  color: #14171d;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .45), inset 0 1px 0 #fff;
  font-size: 1.25rem; font-weight: 800;
}
.card-slot.active {
  border-color: var(--accent); border-style: solid;
  outline: 2px solid var(--accent); outline-offset: 1px;
  box-shadow: 0 0 14px rgba(var(--accent-rgb), .35);
}
.card-slot .red { color: #d02b3f; }

.deck-grid-wrap { overflow-x: auto; margin-top: 12px; padding-bottom: 4px; }
.deck-grid {
  display: grid;
  grid-template-columns: repeat(13, minmax(2.125rem, 1fr));
  gap: 4px;
  /* 用 rem：放大字級時格子跟著長，外層 .deck-grid-wrap 可橫向捲動 */
  min-width: 31.25rem;
}
.deck-card {
  padding: 9px 0; text-align: center;
  background: linear-gradient(165deg, #fdfefe, #eceff2);
  color: #14171d;
  border: 1px solid #c9ced4; border-radius: 7px;
  font-size: 1rem; font-weight: 800; cursor: pointer;
  line-height: 1.15;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35), inset 0 1px 0 #fff;
  transition: transform .12s, box-shadow .18s, opacity .18s;
}
.deck-card:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0, 0, 0, .45), inset 0 1px 0 #fff; }
.deck-card:active { transform: scale(.94); }
.deck-card small { display: block; font-size: .85em; font-weight: 600; }
.deck-card.suit-h, .deck-card.suit-d { color: #d02b3f; }
.deck-card.used {
  opacity: .18; pointer-events: none;
  filter: grayscale(.6);
  transform: none; box-shadow: none;
}

.equity-bar {
  display: flex; height: 26px; border-radius: 999px; overflow: hidden;
  background: rgba(0, 0, 0, .35);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .4);
  border: 1px solid var(--border-soft);
}
.equity-bar > div { transition: width .5s ease; }
.eq-hero { background: linear-gradient(180deg, #55e096, #2fae64); }
.eq-tie { background: linear-gradient(180deg, #e5bd68, #b58e3c); }
.eq-villain { background: linear-gradient(180deg, #f07a89, #d0414f); }
.equity-nums {
  display: flex; justify-content: space-between; margin-top: 8px;
  font-weight: 800; font-size: 1.05rem; font-variant-numeric: tabular-nums;
}
.eqp-row { margin: 10px 0; }
.eq-analysis {
  margin-top: 12px; padding-top: 10px;
  border-top: 1px solid var(--border-soft);
  font-size: .92rem; line-height: 1.8;
}
.eq-analysis h3 { margin: 0 0 4px; font-size: .95rem; }
.eqp-head { display: flex; justify-content: space-between; font-size: .92rem; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.eqp-bar { height: 16px; }
.ev-result {
  margin-top: 12px; padding: 13px 14px;
  background: rgba(0, 0, 0, .25);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); font-size: .95rem; line-height: 1.65;
  font-variant-numeric: tabular-nums;
}

/* ===== Push/Fold Nash tab ===== */
.nash-grid-wrap { overflow-x: auto; padding-bottom: 4px; }
.nash-grid {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 2px;
  /* 同 .deck-grid：rem 讓 13×13 手牌格在大字級下仍放得下 AKo 這種三字 */
  min-width: 30rem;
}
.nash-cell {
  text-align: center; padding: 6px 0;
  font-size: .68rem; font-weight: 600;
  border-radius: 4px;
  background: rgba(255, 255, 255, .035); color: #6f766d;
  transition: transform .1s, box-shadow .1s;
}
.nash-cell:hover {
  transform: scale(1.18); z-index: 2; position: relative;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .5);
}
.nash-cell.in { background: linear-gradient(160deg, #4bdc8b, #279c58); color: #06240f; font-weight: 700; }
.nash-cell.mix { background: linear-gradient(160deg, #e8c87e, #b58e3c); color: #2b1f07; font-weight: 700; }
.nash-cell.tb { background: linear-gradient(160deg, #ef7a70, #bc4038); color: #2e0e0c; font-weight: 700; }
.legend-tb { color: #ef7a70; font-weight: 600; }
.legend-call { color: #4bdc8b; font-weight: 600; }
/* 混合頻率檢視：格子橫向依 加注 / 跟注 / 棄牌 的頻率分段上色 */
.nash-cell.freq {
  color: #eef3ec; font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .75);
  line-height: 1.15;
}
.nash-cell.freq i {
  display: block; font-style: normal;
  font-size: .55rem; font-weight: 600; opacity: .95;
}
.nash-grid.editing {
  outline: 2px dashed var(--accent);
  outline-offset: 4px; border-radius: 6px;
}
.nash-grid.editing .nash-cell { cursor: pointer; }
.custom-row {
  display: flex; align-items: center; gap: 10px; margin: 8px 0;
}
.custom-badge {
  display: inline-block; padding: 3px 10px;
  background: rgba(var(--accent-rgb), .15);
  border: 1px solid var(--accent); color: var(--accent);
  border-radius: 999px; font-size: .78rem; font-weight: 700;
}
.custom-row .btn { padding: 6px 12px; font-size: .82rem; min-width: 0; }
.btn.active-role {
  background: var(--gold-grad);
  border-color: rgba(255, 235, 190, .4); color: var(--on-accent); font-weight: 700;
  box-shadow: 0 2px 12px rgba(var(--accent-rgb), .3), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.btn.active-role:hover { color: var(--on-accent); }
#rfiPosRow .btn { min-width: 0; padding: 10px 4px; font-size: .9rem; }
.quiz-q { text-align: center; margin: 14px 0; }
.quiz-hand {
  font-size: 2.6rem; font-weight: 800; letter-spacing: .05em;
  background: linear-gradient(160deg, var(--accent2), var(--accent2) 65%, var(--accent));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  text-shadow: 0 2px 20px rgba(var(--accent-rgb), .15);
}
.quiz-info { color: var(--muted); font-size: .9rem; margin-top: 6px; }
/* 翻後題型的公牌列 */
.quiz-board {
  margin-top: 8px; font-size: 1.5rem; font-weight: 700;
  letter-spacing: .06em; color: #eef3ec;
}
.quiz-board .red { color: #ef7a70; }
.quiz-board .board-tag {
  display: block; margin-top: 2px;
  font-size: .8rem; font-weight: 600; letter-spacing: 0; color: var(--muted);
}

/* ===== 複盤 tab ===== */
.street-block {
  border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  padding: 12px; margin: 10px 0;
  background: rgba(255, 255, 255, .022);
  box-shadow: var(--inner-hi);
}
.street-block h3 {
  margin: 0; font-size: .82rem; color: var(--accent2);
  letter-spacing: .08em; text-transform: uppercase; font-weight: 700;
}
.hand-item { border-bottom: 1px solid var(--border-soft); }
.hand-item:last-child { border-bottom: none; }
.hand-item .session-item { border-bottom: none; }
.hand-detail { padding: 0 4px 12px; }
.hand-detail .ev-result { margin-top: 8px; }

/* ===== 世界賽事 tab ===== */
.ev-region {
  margin: 18px 2px 8px; font-weight: 600; color: var(--muted);
  font-size: .74rem; letter-spacing: .16em;
}
.ev-item {
  padding: 12px 13px; margin: 8px 0;
  background: rgba(255, 255, 255, .028);
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 13px;
  transition: background .15s, border-color .15s;
  cursor: pointer;
}
.ev-item:hover { border-color: rgba(var(--accent-rgb), .3); }
.ev-top { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.ev-name { font-weight: 650; font-size: .95rem; color: var(--text); text-decoration: none; line-height: 1.35; }
a.ev-name { color: var(--accent2); }
a.ev-name:hover { text-decoration: underline; }
.ev-date {
  display: inline-block; padding: 2px 9px;
  background: rgba(var(--accent-rgb), .1);
  border: 1px solid rgba(var(--accent-rgb), .22);
  border-radius: 999px;
  color: var(--accent2); font-size: .72rem; white-space: nowrap;
  font-variant-numeric: tabular-nums; font-weight: 600;
}
.ev-sub {
  color: var(--muted); font-size: .79rem; margin-top: 7px; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ev-item.open .ev-sub { display: block; -webkit-line-clamp: unset; }

/* ===== ICM tab ===== */
.dyn-row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.dyn-row .row-label { width: 52px; flex-shrink: 0; color: var(--muted); font-size: .85rem; }
.dyn-row input { margin: 0; }
.dyn-row .del-btn { flex-shrink: 0; }

/* ---- 語言 / 色系 / 字級 圖示 chip 與自製下拉（尺寸統一在 .hdr-chip 群組規則） ---- */
.icon-chip { position: relative; width: 32px; padding: 0; overflow: hidden; }
.icon-chip .icon-chip-glyph { font-size: 15px; line-height: 1; pointer-events: none; display: inline-flex; align-items: center; justify-content: center; }
.icon-chip .icon-chip-glyph .ic { margin: 0; }
.icon-chip:focus-visible {
  outline: none;
  border-color: rgba(var(--accent-rgb), .7);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .14);
}
.icon-chip.chip-open {
  background: rgba(var(--accent-rgb), .18);
  border-color: rgba(var(--accent-rgb), .55);
}

/* 自製下拉：跟卡片同語言的小浮層，取代作業系統畫的陽春清單 */
.menu-pop {
  position: fixed; z-index: 70;
  min-width: 172px; max-width: min(76vw, 260px);
  padding: 6px;
  background: var(--bg2);
  border: 1px solid rgba(var(--accent-rgb), .28);
  border-radius: 14px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, .5), 0 2px 8px rgba(0, 0, 0, .35);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  overflow-y: auto; overscroll-behavior: contain;
  animation: menuIn .16s cubic-bezier(.22, .8, .36, 1);
}
@keyframes menuIn {
  from { opacity: 0; transform: translateY(-6px) scale(.97); }
  to { opacity: 1; transform: none; }
}
.menu-head {
  padding: 6px 10px 8px;
  font-size: 11px; letter-spacing: .12em; font-weight: 600;
  color: var(--accent); text-transform: uppercase;
}
.menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; margin: 0; padding: 9px 10px;
  background: none; border: none; border-radius: 10px;
  color: var(--text); font-family: inherit; font-size: 14px; text-align: left;
  cursor: pointer;
  transition: background .14s;
}
.menu-item:focus-visible { outline: none; background: rgba(var(--accent-rgb), .16); }
.menu-label { flex: 1; min-width: 0; line-height: 1.25; }
.menu-tick { color: var(--accent2); font-weight: 700; opacity: 0; flex-shrink: 0; display: inline-flex; }
.menu-tick .ic { margin: 0; }
.menu-item.sel { background: rgba(var(--accent-rgb), .12); color: var(--accent2); }
.menu-item.sel .menu-tick { opacity: 1; }
.menu-swatch {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, .22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}
@media (hover: hover) {
  .menu-item:hover { background: rgba(var(--accent-rgb), .14); }
}
:root[data-theme="light"] .menu-pop {
  background: #fbfaf5;
  box-shadow: 0 18px 42px rgba(60, 50, 20, .18), 0 2px 8px rgba(60, 50, 20, .1);
}
:root[data-theme="light"] .menu-swatch { border-color: rgba(0, 0, 0, .18); }
.inline-select { min-height: 0; }

/* ===== Pro 鎖定區塊與付費牆 ===== */
/* 鎖住的卡片：留一小截模糊的預覽當廣告，其餘裁掉並蓋上解鎖卡 */
.pro-locked {
  position: relative;
  /* min：矮卡片（只有一兩行內容）也要放得下鎖頭＋按鈕，否則會被裁掉
     兩者都用 rem，字級放大時一起長 */
  min-height: 11.5rem; max-height: 15rem;
  overflow: hidden;
}
.pro-locked > *:not(.pro-lock-overlay) {
  filter: blur(3px); opacity: .5;
  pointer-events: none; user-select: none;
}
.pro-lock-overlay {
  position: absolute; inset: 0; z-index: 3;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, rgba(11, 14, 13, .55), rgba(11, 14, 13, .92));
  border-radius: inherit;
}
:root[data-theme="light"] .pro-lock-overlay {
  background: linear-gradient(180deg, rgba(242, 239, 232, .6), rgba(242, 239, 232, .94));
}
.pro-lock-card { text-align: center; padding: 12px; }
.pro-lock-icon { font-size: 1.6rem; line-height: 1; display: flex; justify-content: center; color: var(--accent); }
.pro-lock-icon .ic { margin: 0; }
.pro-lock-title {
  margin: 6px 0 10px; font-weight: 700; font-size: .92rem;
  color: var(--accent2); letter-spacing: .04em;
}
.pro-more { margin-top: 12px; }

.paywall-backdrop {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 20px calc(16px + env(safe-area-inset-right, 0px))
           calc(20px + env(safe-area-inset-bottom, 0px))
           calc(16px + env(safe-area-inset-left, 0px));
  background: rgba(0, 0, 0, .62);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: fadeUp .22s cubic-bezier(.22, .8, .36, 1);
  overflow-y: auto;
}
.paywall {
  width: 100%; max-width: 420px;
  background: var(--bg2); border: 1px solid rgba(var(--accent-rgb), .3);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 18px 14px;
  /* 字級放大時內容比螢幕高：視窗本身捲動，不溢出到畫面外 */
  max-height: 100%; overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
.paywall-badge {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  background: var(--gold-grad); color: var(--on-accent);
  font-weight: 800; font-size: .74rem; letter-spacing: .1em;
}
.paywall-reason { margin: 12px 0 0; color: var(--text); font-size: .92rem; line-height: 1.5; }
/* 免費｜Pro 對照表：項目欄可換行；免費／Pro 欄預設單行。
   塞不下（長譯文、字級放大）時 JS 先加 .pw-wrap 讓 Pro 欄換行；Pro 欄被擠太窄就改 .pw-stack
   （每列項目獨佔一行、下面「免費｜Pro」兩格對半），2× 字級也不會擠成一字一行 */
.pw-compare { margin: 14px 0 0; }
.pw-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: .8rem; line-height: 1.35;
}
.pw-table th, .pw-table td {
  padding: 7px 4px; text-align: left; vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
.pw-table thead th {
  padding-top: 8px; font-size: .7rem; font-weight: 600;
  letter-spacing: .08em; color: var(--muted);
}
.pw-table tbody th { font-weight: 500; color: var(--text); }
.pw-table .pw-free, .pw-table .pw-pro { text-align: center; white-space: nowrap; }
.pw-table td.pw-free { color: var(--muted); }
.pw-table .pw-pro {
  color: var(--accent2); font-weight: 700;
  background: rgba(var(--accent-rgb), .09);
}
.pw-table thead .pw-pro { color: var(--accent); font-weight: 800; border-radius: 8px 8px 0 0; }
.pw-table tbody tr:last-child > * { border-bottom: 0; }
.pw-table tbody tr:last-child .pw-pro { border-radius: 0 0 8px 8px; }
.pw-table.pw-wrap .pw-pro { white-space: normal; }
.pw-table.pw-stack, .pw-stack thead, .pw-stack tbody { display: block; }
.pw-stack tr { display: grid; grid-template-columns: 1fr 1fr; }
.pw-stack thead .pw-item { display: none; }
.pw-stack tbody .pw-item { grid-column: 1 / -1; padding: 9px 4px 3px; border-bottom: 0; }
.pw-stack .pw-free, .pw-stack .pw-pro {
  display: flex; align-items: center; justify-content: center;
  white-space: normal; overflow-wrap: anywhere;
}
.pw-mark { display: inline-flex; vertical-align: middle; }
.pw-mark .ic { margin: 0; width: 1.15em; height: 1.15em; }
.pw-free .pw-mark { opacity: .7; }
.pw-note {
  margin: 8px 0 14px; text-align: center;
  font-size: .74rem; line-height: 1.5; color: var(--muted);
}
.paywall-price {
  margin: 0 0 12px; text-align: center;
  font-size: .9rem; font-weight: 700; color: var(--accent2);
}
.paywall .btn + .btn { margin-top: 8px; }
.pw-pay .btn { display: flex; align-items: center; justify-content: center; gap: 8px; }
.pw-pay .btn .ic { margin: 0; flex: none; width: 1.15em; height: 1.15em; }
.pw-pay .btn:disabled { opacity: .6; cursor: default; transform: none; }
.pw-pay-hint { margin: 8px 0 0; text-align: center; font-size: .76rem; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; }
.pw-pay-off { margin: 0 0 6px; text-align: center; font-size: .86rem; line-height: 1.6; color: var(--text); overflow-wrap: anywhere; }
.pw-pay-err { margin: 8px 0 0; text-align: center; font-size: .8rem; color: var(--danger, #e5534b); }
.pw-pay-err:empty { display: none; }
.pw-gis { display: flex; flex-direction: column; align-items: center; }
.pw-gis > div { margin-top: 6px; }
/* 推薦碼（js/webpay.js，2026-10-19）：login／pay 模式價格句下方「推薦碼（選填）」輸入列；套用後換成已套用列＋「移除」。
   輸入框與「套用」同一列，放不下（360 寬、長譯文、字級放大）時鈕自動換到下一行撐滿（flex-grow 999:1），不撐出橫向捲動 */
.pw-ref { margin: 0 0 4px; }
.pw-ref-label { margin: 0 0 6px; font-size: .78rem; line-height: 1.4; }
.pw-ref-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pw-ref-row .pw-ref-input {
  flex: 999 1 7.5rem; width: auto; min-width: 0; margin: 0;
  text-transform: uppercase; letter-spacing: .08em;
}
.pw-pay .pw-ref-row .btn { flex: 1 0 auto; margin: 0; min-height: 46px; padding-top: 0; padding-bottom: 0; white-space: nowrap; }
.pw-ref-err { margin: 6px 0 0; font-size: .78rem; line-height: 1.5; color: var(--danger, #e5534b); overflow-wrap: anywhere; }
.pw-ref-err:empty { display: none; }
.pw-ref-applied {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px 12px;
  padding: 8px 12px; border: 1px dashed rgba(var(--accent-rgb), .45); border-radius: var(--radius-sm);
  background: rgba(var(--accent-rgb), .07);
}
.pw-ref-ok {
  min-width: 0; text-align: center; overflow-wrap: anywhere;
  font-size: .84rem; font-weight: 600; line-height: 1.5; color: var(--accent2);
}
.pw-ref-ok .ic { width: 1.1em; height: 1.1em; }
.pw-ref-applied .pw-ref-remove {
  display: inline-block; width: auto; margin: 0; padding: 4px 2px;
  font-size: .8rem; color: var(--muted); text-decoration: underline; text-underline-offset: 2px;
}
.pw-ref-applied .pw-ref-remove:hover { color: var(--text); }
.pw-ref-applied .pw-ref-remove:disabled { opacity: .5; cursor: default; }
/* 原生殼付費牆「兌換優惠碼」（js/pro.js）：<a> 套 .btn-link，跟「稍後再說」同款（置中、不加底線） */
.paywall a.pw-redeem { text-align: center; text-decoration: none; }
.pw-result .paywall-badge { margin-bottom: 10px; }
.btn-link {
  display: block; width: 100%; margin-top: 10px; padding: 8px;
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: .82rem; font-family: inherit;
}
.btn-link:hover { color: var(--text); }
.paywall-links { margin: 6px 0 0; text-align: center; font-size: .76rem; color: var(--muted); }
.paywall-links a { color: var(--muted); text-decoration: none; }
.paywall-links a:hover { color: var(--accent2); }
.app-footer a { color: inherit; text-decoration: none; border-bottom: 1px solid currentColor; }

/* ---- cloud sync ---- */
/* 帳號／登入選單（sync.js openSheet；原生殼登入走 Apple / Google 原生 SDK） */
.acct-sheet .btn { display: block; width: 100%; margin: 0 0 8px; }
.acct-title { font-weight: 700; margin-bottom: 4px; }
.acct-sub { color: var(--muted); font-size: .82rem; margin: 0 0 14px; word-break: break-all; }
.btn-apple { background: #000; color: #fff; border-color: #000; font-weight: 600; }
.btn-apple:hover { background: #111; }
:root[data-theme="light"] .btn-apple { background: #000; color: #fff; }
.btn-google { background: #fff; color: #1f1f1f; border-color: #dadce0; font-weight: 600; }
.btn-google:hover { background: #f5f5f5; }
.btn-danger { color: #e5534b; border-color: rgba(229, 83, 75, .45); background: rgba(229, 83, 75, .06); }
.btn-danger:hover { background: rgba(229, 83, 75, .14); }

.sync-ui { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.sync-chip { width: 32px; padding: 0; font-weight: 700; transition: background .18s, box-shadow .18s; }
.sync-chip:hover { background: rgba(var(--accent-rgb), .14); box-shadow: 0 0 10px rgba(var(--accent-rgb), .2); }
/* 同步中遮罩：登入、連結帳號、合併後重載期間蓋住畫面，避免使用者看到資料跳動。層級在對話框（80）之下 */
.sync-busy {
  position: fixed; inset: 0; z-index: 75;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .55);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity .18s;
}
.sync-busy.show { opacity: 1; pointer-events: auto; }
.sync-busy-box {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  min-width: 150px; padding: 22px 26px 18px;
  background: var(--bg2); border: 1px solid var(--border-soft);
  border-radius: var(--radius); box-shadow: var(--shadow);
  color: var(--text); font-size: .95rem;
}
.sync-busy-ring {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid rgba(var(--accent-rgb), .22); border-top-color: var(--accent);
  animation: sync-spin .8s linear infinite;
}
@keyframes sync-spin { to { transform: rotate(360deg); } }
.sync-busy-mark, .sync-busy-bar { display: none; }
/* 開 App 的「系統資料確認中…」：接在 logo splash 之後、主畫面之前的整頁畫面（2026-10-03 Kurt）。
   底色同 splash／App 背景、品牌章＋細進度條，淡出 .25s；不用轉圈、不用半透明 */
.sync-busy.boot {
  background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none;
  transition: opacity .25s;
}
.sync-busy.boot .sync-busy-box {
  background: none; border: 0; box-shadow: none; padding: 0; gap: 18px;
  color: var(--muted); font-size: .9rem; letter-spacing: .04em;
}
.sync-busy.boot .sync-busy-ring { display: none; }
.sync-busy.boot .sync-busy-mark {
  display: block; width: 72px; height: 72px; border-radius: 18px;
  animation: sync-breathe 1.6s ease-in-out infinite;
}
.sync-busy.boot .sync-busy-bar {
  display: block; position: relative; overflow: hidden;
  width: 160px; height: 3px; border-radius: 999px;
  background: rgba(var(--accent-rgb), .18);
}
.sync-busy.boot .sync-busy-bar i {
  position: absolute; top: 0; bottom: 0; left: -40%; width: 40%; border-radius: 999px;
  background: var(--accent);
  animation: sync-slide 1.1s ease-in-out infinite;
}
@keyframes sync-breathe { 0%, 100% { opacity: .85; transform: scale(1); } 50% { opacity: 1; transform: scale(1.04); } }
@keyframes sync-slide { to { left: 100%; } }
@media (prefers-reduced-motion: reduce) {
  .sync-busy.boot .sync-busy-mark, .sync-busy.boot .sync-busy-bar i { animation: none; }
  .sync-busy.boot .sync-busy-bar i { left: 0; width: 100%; opacity: .6; }
}
/* 開 App 同步失敗的一次性提示（離線／逾時）：頂端小條、可關 */
.sync-notice {
  position: fixed; z-index: 80;
  top: calc(10px + env(safe-area-inset-top, 0px)); left: 50%;
  transform: translate(-50%, -8px);
  display: flex; align-items: center; gap: 10px;
  max-width: min(88vw, 480px); padding: 9px 10px 9px 16px;
  background: var(--bg3); border: 1px solid rgba(var(--accent-rgb), .35);
  border-radius: 999px; box-shadow: var(--shadow);
  color: var(--text); font-size: .88rem;
  opacity: 0; transition: opacity .2s, transform .2s;
}
.sync-notice.show { opacity: 1; transform: translate(-50%, 0); }
.sync-notice-close {
  width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(var(--accent-rgb), .12); color: var(--text);
  font-size: 1.05rem; line-height: 1; cursor: pointer;
}
.sync-notice-close:hover { background: rgba(var(--accent-rgb), .24); }
/* inline-flex + 固定高：不然大字級時外框被行高撐高，登入鈕跟其他 chip 對不齊 */
.sync-login-wrap {
  position: relative; overflow: hidden; border-radius: 999px; flex-shrink: 0;
  display: inline-flex; align-items: center; height: 32px; line-height: 0;
}
.sync-login { transition: background .18s, box-shadow .18s; }
.sync-login-wrap:hover .sync-login { background: rgba(var(--accent-rgb), .14); box-shadow: 0 0 10px rgba(var(--accent-rgb), .2); }
/* 官方 GIS 按鈕透明覆蓋在自訂按鈕上，點擊落在真按鈕 */
.gsi-slot {
  position: absolute; inset: 0; opacity: .0001;
  display: flex; align-items: center; justify-content: center;
  /* 空 slot 不能攔截點擊：GIS 被 webview 擋掉時，點擊要落到底下自畫的登入 pill */
  pointer-events: none;
}
.gsi-slot > div { transform: scale(2.2); transform-origin: center; pointer-events: auto; }

/* ===== 月報長條圖 ===== */
.bar-chart { margin-top: 10px; }
.bar-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: .8rem; font-variant-numeric: tabular-nums; }
.bar-row .bar-label { width: 58px; flex-shrink: 0; color: var(--muted); }
.bar-row .bar-track {
  flex: 1; height: 14px; background: rgba(0, 0, 0, .35);
  border-radius: 999px; overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .4);
  border: 1px solid var(--border-soft);
}
.bar-row .bar-fill { height: 100%; border-radius: 999px; transition: width .4s ease; }
.bar-fill.bar-pos { background: linear-gradient(90deg, #2fae64, #4bdc8b); }
.bar-fill.bar-neg { background: linear-gradient(90deg, #c14a42, #f07a89); }
.bar-fill.bar-acc { background: linear-gradient(90deg, var(--accent-deep), var(--accent2)); }

/* ===== 訓練 tab ===== */
.train-task { margin: 6px 0; font-size: .9rem; }
#masteryBars .bar-label { width: 84px; }
#masteryBars .bar-value { min-width: 96px; }
.bar-row .bar-value { flex-shrink: 0; min-width: 56px; text-align: right; }

/* ===== reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .card:hover, .deck-card:hover, .nash-cell:hover { transform: none; }
  .tab-btn:hover svg, .tab-btn.active svg, .tab-btn:active { transform: none; }
}

/* ---- RFI top-X% 滑桿 ---- */
.slider-row { display: flex; align-items: center; gap: 12px; margin: 10px 0 4px; }
.slider-row input[type="range"] {
  flex: 1; -webkit-appearance: none; appearance: none; height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, rgba(var(--accent-rgb), .55), rgba(var(--accent-rgb), .15));
  outline: none; cursor: pointer;
}
.slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f4dfae, #d4af6a 65%, #a8823e);
  border: 1px solid rgba(255, 255, 255, .25);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .5);
}
.slider-row input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f4dfae, #d4af6a 65%, #a8823e);
  border: 1px solid rgba(255, 255, 255, .25);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .5);
}
.pct-val {
  min-width: 56px; text-align: right; font-variant-numeric: tabular-nums;
  color: var(--accent2); font-weight: 600; font-size: .9rem;
}

/* ===== 賽程表視圖（js/schedule.js）===== */
.ev-sched-badge {
  flex: none; font-size: .72rem; font-weight: 650; color: var(--accent);
  border: 1px solid rgba(var(--accent-rgb), .45); border-radius: 999px;
  padding: .1rem .5rem; white-space: nowrap;
}
.ev-item.has-sched { cursor: pointer; }
.sched-backdrop {
  position: fixed; inset: 0; z-index: 70; overflow-y: auto;
  background: var(--bg);
  padding: calc(10px + env(safe-area-inset-top, 0px))
           calc(14px + env(safe-area-inset-right, 0px))
           calc(24px + env(safe-area-inset-bottom, 0px))
           calc(14px + env(safe-area-inset-left, 0px));
  animation: fadeUp .22s cubic-bezier(.22, .8, .36, 1);
}
.sched-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: .6rem;
  background: var(--topbar-bg);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  margin: -10px -14px 0; padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
  border-bottom: 1px solid var(--border-soft);
}
.sched-title { flex: 1; font-weight: 700; font-size: 1.05rem; line-height: 1.3; }
.sched-close {
  flex: none; width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--bg3); color: var(--text);
  font-size: .9rem; cursor: pointer;
}
.sched-meta { color: var(--muted); font-size: .82rem; margin: .6rem 0 .4rem; line-height: 1.4; }
.sched-legend { display: flex; flex-wrap: wrap; gap: .35rem .8rem; margin: .3rem 0 .6rem; }
.sched-leg { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; color: var(--muted); }
.sched-dot { width: .55rem; height: .55rem; border-radius: 50%; display: inline-block; }
.sched-day {
  position: sticky; top: calc(52px + env(safe-area-inset-top, 0px)); z-index: 1;
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg3); border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  padding: .35rem .7rem; margin: .7rem 0 .35rem; font-weight: 650; font-size: .88rem;
}
.sched-day-n { color: var(--muted); font-weight: 500; font-size: .78rem; }
.sched-row {
  display: flex; align-items: baseline; gap: .55rem;
  border-left: 3px solid transparent; border-bottom: 1px solid var(--border-soft);
  padding: .4rem .2rem .4rem .55rem;
}
.sched-time { flex: none; width: 2.9rem; color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.sched-name { flex: 1; font-size: .87rem; line-height: 1.35; min-width: 0; overflow-wrap: anywhere; }
.sched-amts { flex: none; display: flex; gap: .8rem; text-align: right; }
.sched-amt { display: flex; flex-direction: column; align-items: flex-end; min-width: 4.2rem; }
.sched-amt-main { font-size: .82rem; font-variant-numeric: tabular-nums; }
.sched-amt-usd { font-size: .68rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.sched-amt-tag { font-size: .62rem; color: var(--muted); opacity: .75; }
.sched-note { color: var(--muted); font-size: .78rem; line-height: 1.5; margin: .6rem 0 0; }
.sched-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; gap: .8rem; }
.sched-updated { color: var(--muted); font-size: .75rem; }
.sched-link { color: var(--accent2); font-size: .85rem; text-decoration: none; }
.sched-link:hover { text-decoration: underline; }

/* ===== ivey 式 hero 盈虧卡（2026-08-11）===== */
.hero-card { padding: 14px 16px 16px; }
.hero-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
/* 字級超大時 seg 四顆可壓縮、放不下就換行，幣種選單不會把整張卡撐出畫面 */
.hero-head .seg { min-width: 0; max-width: 100%; }
.hero-head .seg-btn { flex: 1 1 auto; min-width: 0; padding-left: .5rem; padding-right: .5rem; white-space: nowrap; }
.hero-head .inline-select { max-width: 100%; }
.seg { display: inline-flex; background: var(--bg3); border: 1px solid var(--border-soft); border-radius: 999px; padding: 2px; }
.seg-btn {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: .8rem; padding: .25rem .8rem; border-radius: 999px;
}
.seg-btn.active { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.hero-num {
  font-size: 2.6rem; font-weight: 800; letter-spacing: -.5px; line-height: 1.15;
  margin: .45rem 0 .15rem; font-variant-numeric: tabular-nums;
}
/* ===== FAB ＋ bottom sheet（2026-08-15，新增改「＋」彈出）===== */
.desktop-add-row { display: none; }
.fab {
  position: fixed; right: 18px;
  bottom: calc(clamp(72px, 4.9rem, 92px) + env(safe-area-inset-bottom, 0px));
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent);
  font-size: 1.9rem; line-height: 1; border: 0; cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .45);
  z-index: 30;
  transition: transform .15s;
}
.fab:active { transform: scale(.92); }
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, .55);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: var(--bg2); width: 100%; max-width: 640px;
  max-height: 88vh; overflow-y: auto; overscroll-behavior: contain;
  border-radius: 20px 20px 0 0;
  padding: 6px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  animation: sheet-up .22s ease;
}
@keyframes sheet-up {
  from { transform: translateY(48px); opacity: .5; }
  to { transform: none; opacity: 1; }
}
.sheet-grip { width: 42px; height: 4px; border-radius: 2px; background: var(--border); margin: 4px auto 8px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .3rem; }
.sheet-head h2 { margin: 0; }
.sheet-close {
  border: 0; background: var(--bg3); color: var(--muted); cursor: pointer;
  width: 30px; height: 30px; border-radius: 50%; font-size: .95rem; flex: none;
}
:root[data-theme="light"] .sheet { background: #f4f2ea; }

/* ===== 手牌記錄精靈＋列表分組（2026-08-15）===== */
.wiz-dots { display: flex; justify-content: center; gap: 8px; margin: .3rem 0 .7rem; }
.wiz-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.wiz-dot.active { background: var(--accent); }
.wiz-step h3 { margin: .2rem 0 .6rem; font-size: 1.02rem; }
.wiz-nav { margin-top: .8rem; }
.wiz-nav .btn { flex: 1; }
.cards-preview { display: flex; gap: 6px; min-height: 46px; align-items: center; color: var(--neg); font-size: .85rem; }
.card-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 52px; border-radius: 6px; background: #f7f5ee;
  font-weight: 800; font-size: 1.05rem; box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
}
.card-chip.suit-s { color: #22262e; }
.card-chip.suit-h { color: #d02b3f; }
.card-chip.suit-d { color: #1f6ff0; }
.card-chip.suit-c { color: #1e9e4a; }
.hand-preview {
  background: var(--bg3); border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  padding: .7rem .8rem; margin: .6rem 0; font-size: .8rem; line-height: 1.6;
  white-space: pre-wrap; overflow-x: auto; font-variant-numeric: tabular-nums;
}
.group-head {
  list-style: none; color: var(--muted); font-size: .8rem; font-weight: 700;
  padding: .75rem 0 .25rem;
}
.fav-star {
  border: 0; background: none; color: var(--border); font-size: 1.2rem;
  cursor: pointer; padding: 0 .25rem; flex: none; align-self: center;
}
.fav-star.on { color: var(--accent2); }
.fav-toggle {
  border: 1px solid var(--border); background: var(--bg3); color: var(--muted);
  width: 32px; height: 32px; border-radius: 999px; cursor: pointer; font-size: 1rem;
}
.fav-toggle.on { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.hand-search { margin: .4rem 0 .2rem; }

/* 儀表板類型頁籤（全部/現金桌/錦標賽，2026-08-14） */
.seg-tabs { display: flex; width: 100%; margin: 12px 0 0; }
.seg-tabs .seg-btn { flex: 1; padding: .45rem 0; font-size: .88rem; }

/* 期間切換 ‹ 2026/08 › */
.period-nav { display: flex; align-items: center; justify-content: center; gap: .3rem; margin-top: .55rem; }
.period-btn {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 1.25rem; line-height: 1; width: 2rem; height: 2rem; border-radius: 50%;
}
.period-btn:hover { background: var(--bg3); color: var(--accent2); }
.period-label {
  min-width: 5.4rem; text-align: center; font-weight: 700; font-size: .95rem;
  font-variant-numeric: tabular-nums;
}
/* 自訂起訖日（heroScope=custom 才出現） */
.custom-range { display: flex; align-items: center; justify-content: center; gap: .5rem; margin-top: .55rem; }
.custom-range input[type="date"] {
  width: auto; margin: 0; padding: 6px 10px; font-size: .85rem;
}
.custom-range-sep { color: var(--muted); }

/* 統計磚 2×3（2026-08-14，參考截圖） */
.stat-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.stat-tile {
  background: linear-gradient(180deg, rgba(255, 255, 255, .028), rgba(255, 255, 255, .012));
  border: 1px solid rgba(255, 255, 255, .065);
  border-radius: var(--radius); padding: 12px 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
.stat-tile-head {
  display: flex; justify-content: space-between; align-items: center;
  color: var(--muted); font-size: .78rem;
}
.stat-tile-head svg {
  width: 15px; height: 15px; flex: none; opacity: .65;
  fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.stat-tile-val {
  font-size: 1.35rem; font-weight: 800; margin-top: .25rem;
  font-variant-numeric: tabular-nums; letter-spacing: -.3px;
}
.stat-tile-val.pos { color: var(--pos); }
.stat-tile-val.neg { color: var(--neg); }
.chart-card { padding: 14px 10px 10px; }

.hero-num.pos { color: var(--pos); }
.hero-num.neg { color: var(--neg); }
.hero-num.muted { color: var(--muted); }
.hero-sub { color: var(--muted); font-size: .85rem; }

/* ===== 行為標籤 chips ＋ 洞察卡 ===== */
.mood-chips { display: flex; flex-wrap: wrap; gap: .45rem; margin: .2rem 0 .8rem; }
.mood-chip {
  border: 1px solid var(--border); background: var(--bg3); color: var(--muted);
  border-radius: 999px; padding: .32rem .8rem; font-size: .84rem; cursor: pointer;
}
.mood-chip.active {
  border-color: rgba(var(--accent-rgb), .6); background: rgba(var(--accent-rgb), .14);
  color: var(--accent2); font-weight: 650;
}
.insight-item {
  background: var(--bg3); border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  padding: .6rem .8rem; margin: .45rem 0; font-size: .9rem; line-height: 1.55;
}

/* ===== 中途事件編輯器＋列表時間軸 ===== */
.evt-editor { display: flex; flex-direction: column; gap: .4rem; margin: .2rem 0; }
.evt-row { display: flex; gap: .4rem; align-items: center; }
.evt-row select { flex: 0 0 6.2rem; }
.evt-row input[type="time"] { flex: 0 0 6.4rem; }
.evt-row input[type="number"] { flex: 1; min-width: 0; }
.btn-link { background: none; border: none; color: var(--accent2); cursor: pointer; font-size: .85rem; padding: .3rem 0; }
.session-timeline {
  margin-top: .45rem; padding: .45rem .7rem; border-left: 2px solid rgba(var(--accent-rgb), .5);
  background: var(--bg3); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.timeline-line { font-size: .82rem; color: var(--muted); line-height: 1.7; font-variant-numeric: tabular-nums; }
.filter-group { display: inline-flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; min-width: 0; max-width: 100%; }
.filter-group .inline-select { min-width: 0; max-width: 100%; }
/* 標題＋篩選列：字級超大時允許換行，不把卡片撐出畫面 */
.row-between:has(> .filter-group) { flex-wrap: wrap; gap: .4rem; }

/* ===== app 內建彈窗（toast + confirm，取代原生 alert/confirm）===== */
.toast-box {
  position: fixed; z-index: 80;
  top: calc(10px + env(safe-area-inset-top, 0px)); left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  max-width: min(88vw, 480px);
  padding: 11px 18px;
  background: var(--bg3);
  border: 1px solid rgba(var(--accent-rgb), .35);
  border-radius: 999px;
  box-shadow: var(--shadow);
  color: var(--text); font-size: .9rem; line-height: 1.45;
  opacity: 0; transform: translateY(-14px);
  transition: opacity .28s, transform .28s cubic-bezier(.3, 1.3, .6, 1);
}
.toast.show { opacity: 1; transform: none; }
.dlg-backdrop {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  padding: 28px;
  background: rgba(0, 0, 0, .55);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .18s;
}
.dlg-backdrop.show { opacity: 1; }
.dlg {
  width: 100%; max-width: 340px;
  padding: 20px 20px 16px;
  background: var(--bg2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transform: scale(.94); transition: transform .18s cubic-bezier(.3, 1.3, .6, 1);
}
.dlg-backdrop.show .dlg { transform: none; }
.dlg-msg { font-size: .95rem; line-height: 1.55; white-space: pre-line; }
.dlg-input { width: 100%; margin-top: 14px; }
.dlg-btns { display: flex; gap: 10px; margin-top: 18px; }
.dlg-btns .btn { flex: 1; margin: 0; }

/* ===== 首次使用導覽（spotlight + 教學卡）===== */
.tour-shield { position: fixed; inset: 0; z-index: 84; }
.tour-ring {
  position: fixed; z-index: 85; pointer-events: none;
  border: 2px solid var(--accent);
  border-radius: 14px;
  box-shadow: 0 0 0 200vmax rgba(0, 0, 0, .62), 0 0 18px rgba(var(--accent-rgb), .5);
  transition: top .32s cubic-bezier(.4, 1, .5, 1), left .32s cubic-bezier(.4, 1, .5, 1),
    width .32s cubic-bezier(.4, 1, .5, 1), height .32s cubic-bezier(.4, 1, .5, 1);
}
.tour-card {
  position: fixed; z-index: 86;
  padding: 16px 18px 14px;
  background: var(--bg2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: top .32s cubic-bezier(.4, 1, .5, 1), left .32s cubic-bezier(.4, 1, .5, 1);
}
.tour-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.tour-head strong { font-size: 1.02rem; color: var(--accent2); }
.tour-step { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tour-text { margin: .55rem 0 0; font-size: .88rem; line-height: 1.6; color: var(--text); }
.tour-dots { display: flex; gap: 5px; justify-content: center; margin: 12px 0 2px; }
.tour-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(var(--accent-rgb), .25); transition: background .2s, transform .2s;
}
.tour-dot.on { background: var(--accent); transform: scale(1.35); }
.tour-btns { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.tour-btns .tour-skip { margin-right: auto; }
/* 字級調大時按鈕不准字內直排，放不下就整顆換行 */
.tour-btns .btn { margin: 0; padding: 8px 16px; white-space: nowrap; flex-shrink: 0; }

/* ===== 策略分頁目錄（清單 → 單張圖，2026-08-24）===== */
.chart-group-title {
  margin: 20px 4px 8px; font-size: .78rem; color: var(--muted);
  letter-spacing: .12em; font-weight: 600;
}
.chart-group-title:first-child { margin-top: 8px; }
.chart-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: linear-gradient(180deg, rgba(255, 255, 255, .028), rgba(255, 255, 255, .012));
  border: 1px solid rgba(255, 255, 255, .065);
  border-radius: var(--radius); padding: 13px 14px; margin: 8px 0;
  color: var(--text); cursor: pointer; font: inherit;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  transition: background .15s, border-color .15s;
}
.chart-menu-item:active { background: rgba(255, 255, 255, .06); }
.cmi-txt { flex: 1; min-width: 0; }
.cmi-txt b { display: block; font-size: .95rem; font-weight: 600; }
.cmi-txt small { display: block; color: var(--muted); font-size: .8rem; margin-top: 2px; line-height: 1.45; }
.cmi-arrow { color: var(--muted); font-size: 1.25rem; line-height: 1; flex-shrink: 0; }
.chart-back {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: none; color: var(--accent); cursor: pointer;
  font: inherit; font-size: .92rem; font-weight: 600; padding: 10px 4px 2px;
}

/* ===== 桌面版佈局（≥900px，2026-08-15 Tony 定案「走 A」：同核雙版面）=====
   手機與原生殼維持底部 tab bar；寬螢幕自動切成左側選單＋寬版儀表板。 */
@media (min-width: 900px) {
  .tabs {
    top: 0; bottom: 0; right: auto; width: 236px;
    flex-direction: column; justify-content: flex-start; gap: 6px;
    max-width: none; margin: 0; padding: 72px 14px 20px;
    border-top: none; border-right: 1px solid rgba(255, 255, 255, .07);
  }
  :root[data-theme="light"] .tabs { border-right-color: rgba(0, 0, 0, .08); }
  /* 品牌標題移進側欄頂部（同一顆 h1 直接 fixed 過去，i18n / 漸層照舊），
     讓側欄有頭、跟導覽項目成一組，不再像獨立漂在左邊 */
  .app-header h1 {
    position: fixed; top: 0; left: 0; z-index: 21;
    width: 236px; box-sizing: border-box;
    padding: 24px 20px 0; font-size: 19px;
  }
  .tab-btn {
    flex: none; flex-direction: row; justify-content: flex-start; gap: 14px;
    padding: 12px 16px; font-size: 1.02rem; font-weight: 600; border-radius: 12px;
  }
  .tab-btn svg { width: 23px; height: 23px; }
  .tab-btn::before {
    top: 0; left: 0; width: 100%; height: 100%; margin: 0; border-radius: 12px;
  }
  .tab-btn.active::before { background: rgba(var(--accent-rgb), .16); }
  /* 內容欄貼著側欄排（間距 24–72px 封頂），不再以整個視窗置中——
     否則寬螢幕時側欄和內容中間隔一大條死空間，看起來各自為政 */
  .app-header, main {
    max-width: 980px;
    margin-left: calc(236px + clamp(24px, (100vw - 1216px) / 4, 72px));
    margin-right: auto;
  }
  /* h1 已 fixed 進側欄，頂欄只剩右側 chips */
  .app-header { padding: 16px 26px 0; justify-content: flex-end; min-height: 0; }
  main { padding: 8px 26px 60px; }
  /* 桌面版：FAB 收起來，改用內容區的「＋ 新增」按鈕 */
  .fab { display: none; }
  .desktop-add-row { display: flex; justify-content: flex-end; margin: 12px 0 0; }
  /* 記帳儀表板兩欄：曲線圖在左、統計磚在右，其他卡片維持整行 */
  #tab-tracker.active { display: grid; grid-template-columns: 3fr 2fr; gap: 0 16px; align-items: start; }
  #tab-tracker > * { grid-column: 1 / -1; }
  #tab-tracker .chart-card { grid-column: 1; }
  #tab-tracker .stat-tiles { grid-column: 2; }
  .app-footer {
    max-width: 980px;
    margin-left: calc(236px + clamp(24px, (100vw - 1216px) / 4, 72px));
    margin-right: auto;
    padding-bottom: 28px;
  }
  /* sheet 在桌面改成置中對話框 */
  .sheet-backdrop { align-items: center; padding: 28px; }
  .sheet { max-width: 560px; border-radius: 20px; }
  /* 策略目錄：桌面兩欄（group 標題各佔整行） */
  #chartMenu { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
  #chartMenu .chart-group-title { grid-column: 1 / -1; }
}

/* ===== 語音選牌（js/voice.js） ===== */
.btn.voice-rec {
  color: var(--neg);
  border-color: var(--neg);
  animation: voice-pulse 1.1s ease-in-out infinite;
}
.btn.voice-busy { opacity: .55; pointer-events: none; }
@keyframes voice-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}

/* ===== 記帳頁頂端語音助理（js/voice-ai.js，2026-10-19）=====
   全寬主按鈕吃各主題的 --gold-grad／--on-accent；下面一行小字說明，狀態列（#voiceAiStatus）有字時換掉它。
   錄音中沿用 voice.js 的 .voice-rec（按鈕內容換成停止圖示）：金底上不做整顆閃爍，改紅色內框＋外圈擴散脈動 */
.voice-top { margin: 0 0 4px; }
.btn.voice-ai-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 54px; padding: 12px 18px;
  background: var(--gold-grad); color: var(--on-accent);
  border: 0; border-radius: 16px;
  font-size: 1.08rem; font-weight: 700; letter-spacing: .04em;
  box-shadow: 0 10px 28px rgba(var(--accent-rgb), .22);
}
.btn.voice-ai-btn:hover { color: var(--on-accent); box-shadow: 0 12px 32px rgba(var(--accent-rgb), .32); }
.btn.voice-ai-btn:active { transform: scale(.98); }
:root[data-theme="light"] .btn.voice-ai-btn { background: var(--gold-grad); }
.voice-ai-btn .ic { width: 22px; height: 22px; margin: 0; }
.btn.voice-ai-btn.voice-rec { color: var(--on-accent); animation: voice-ring 1.2s ease-out infinite; }
.voice-ai-btn.voice-rec .ic { color: var(--on-accent); }
@keyframes voice-ring {
  0% { box-shadow: inset 0 0 0 2px var(--neg), 0 0 0 0 rgba(var(--accent-rgb), .55); }
  100% { box-shadow: inset 0 0 0 2px var(--neg), 0 0 0 14px rgba(var(--accent-rgb), 0); }
}
@media (prefers-reduced-motion: reduce) {
  .btn.voice-ai-btn.voice-rec { animation: none; box-shadow: inset 0 0 0 2px var(--neg), 0 0 0 4px rgba(var(--accent-rgb), .35); }
}
.voice-ai-status, .voice-ai-hint { margin: 8px 2px 0; font-size: .82rem; text-align: center; }
#voiceAiStatus:empty { display: none; }
#voiceAiStatus:not(:empty) + .voice-ai-hint { display: none; }

/* ===== 新增視窗「填表單｜貼上文字」（js/quicklog.js；2026-10-19 原記帳頁「快速記一筆」卡併進來）=====
   切換沿用 .seg-tabs；貼上模式的按鈕列：「解析」吃掉剩下寬度、「複製範例」是文字連結；結果每行一列（label 包 checkbox，整列可點） */
.add-mode { margin: .25rem 0 .5rem; }
.paste-mode textarea { width: 100%; min-height: 6.8rem; resize: vertical; }
.paste-mode .btn-row { align-items: center; }
.paste-mode .btn-row .btn-link { flex: none; width: auto; margin: 0; }
#quickStatus { white-space: pre-line; }   /* 批次解析的說明一句一行 */
.quick-list { margin-top: .5rem; }
.quick-row {
  display: flex; gap: .5rem; align-items: flex-start; padding: .35rem 0; border-bottom: 1px solid var(--border-soft);
  margin: 0; color: var(--text); font-size: .9rem; letter-spacing: 0; line-height: 1.45; cursor: pointer;
}
.quick-row.off { color: var(--muted); cursor: default; }
.quick-row input[type="checkbox"] {
  flex: none; width: 1.1rem; height: 1.1rem; min-height: 0; margin: .15rem 0 0; padding: 0; accent-color: var(--accent);
}
.quick-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.quick-src { display: block; margin-top: .1rem; color: var(--muted); font-size: .78rem; }
.quick-flag {
  flex: none; padding: .05rem .5rem; border: 1px solid var(--border); border-radius: 999px;
  color: var(--muted); font-size: .74rem; white-space: nowrap;
}

/* ===== 自製單色 icon（js/icons.js，2026-10-07：全 App 不用 emoji）=====
   .ic 跟著文字顏色；後面接文字時留一點間距，單獨當按鈕圖示時由容器置中 */
.ic { display: inline-block; vertical-align: -.16em; margin-right: .38em; flex: none; }
.ic:last-child:not(:first-child) { margin-right: 0; margin-left: .3em; }
.ic:only-child { margin: 0; }
.del-btn, .sheet-close, .sched-close, .fav-star, .fav-toggle { display: inline-flex; align-items: center; justify-content: center; }
.fav-star.on .ic path, .fav-toggle.on .ic path { fill: currentColor; }
.ic-dot { display: inline-flex; margin-right: .4em; vertical-align: -.1em; }
.ic-dot .ic { margin: 0; }
.ic-dot.pos { color: var(--pos); } .ic-dot.tie { color: var(--accent); } .ic-dot.neg { color: var(--neg); }
.chart-group-title .ic { vertical-align: -.2em; }
.hint > .ic:first-child { color: var(--accent); vertical-align: -.2em; }
.insight-item .ic { color: var(--accent); vertical-align: -.2em; }
.train-task .ic { color: var(--muted); }
.train-task.done .ic { color: var(--pos); }
#trainStreak .ic { color: var(--accent); }
#drillHand .ic { color: var(--accent); margin: 0; }
.pos .ic, .neg .ic { vertical-align: -.15em; }
.ev-sched-badge .ic { vertical-align: -.1em; margin-right: .25em; }
.voice-rec .ic { color: var(--neg); }

/* ===== 管理後台（App 內原生頁面，js/admin.js，2026-10-06）=====
   全螢幕、App 同色票；圖示是 inline SVG（currentColor）；清單用卡片列不是表格，手機好點好捲 */
.adm {
  position: fixed; inset: 0; z-index: 80;
  display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  padding-top: env(safe-area-inset-top, 0px);
  opacity: 0; transform: translateX(8%); transition: opacity .18s, transform .22s cubic-bezier(.2, .7, .2, 1);
  -webkit-font-smoothing: antialiased;
}
.adm.show { opacity: 1; transform: none; }
html.adm-open, html.adm-open body { overflow: hidden; }
.adm-ic { display: inline-block; vertical-align: -3px; flex: none; }
.adm-bar {
  flex: none; display: flex; align-items: center; gap: 4px;
  height: 52px; padding: 0 8px;
  background: var(--topbar-bg); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}
.adm-ib {
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: 12px; color: var(--text); padding: 0; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: background .15s, color .15s;
}
.adm-ib:active { background: rgba(var(--accent-rgb), .14); color: var(--accent2); }
.adm-ph { visibility: hidden; }
.adm-title { flex: 1; text-align: center; font-weight: 700; letter-spacing: .08em; font-size: 1rem; }
.adm-tabs { flex: none; display: flex; padding: 0 16px; border-bottom: 1px solid var(--border-soft); background: var(--bg); }
.adm-tab {
  display: inline-flex; align-items: center; gap: 7px; height: 46px; padding: 0 14px; margin-bottom: -1px;
  background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-size: .95rem; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: color .15s, border-color .15s;
}
.adm-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.adm-tab[aria-selected="true"] .adm-ic { color: var(--accent); }
.adm-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 16px 16px calc(28px + env(safe-area-inset-bottom, 0px));
}
.adm-view[hidden] { display: none; }
/* 重點數字 */
.adm-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.adm-stat {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  background: var(--bg2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 12px 14px 11px;
  color: var(--text); cursor: pointer; -webkit-tap-highlight-color: transparent; transition: border-color .15s, background .15s;
}
.adm-stat.on { border-color: rgba(var(--accent-rgb), .6); background: rgba(var(--accent-rgb), .08); }
.adm-stat .k { font-size: .78rem; color: var(--muted); }
.adm-stat.on .k { color: var(--accent); }
.adm-stat .v { font-size: 1.7rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.adm-stat .v.adm-v-sm { font-size: 1.05rem; line-height: 1.6; }
.adm-stat .h { font-size: .76rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.adm-link { display: inline-flex; align-items: center; gap: 5px; background: none; border: 0; padding: 0; color: var(--muted); font-size: .86rem; cursor: pointer; text-decoration: none; transition: color .15s; }
.adm-link:active { color: var(--text); }
.adm-morebtn { grid-column: 1 / -1; justify-self: start; padding: 6px 2px; }
.adm-morebtn .adm-ic { transition: transform .15s; }
.adm-morebtn.open .adm-ic { transform: rotate(180deg); }
.adm-more { display: none; flex-wrap: wrap; gap: 6px 22px; padding: 10px 2px 2px; font-size: .84rem; color: var(--muted); border-top: 1px solid var(--border-soft); margin-top: 2px; }
.adm-more.open { display: flex; }
.adm-more b { color: var(--text); font-weight: 500; margin-left: 6px; font-variant-numeric: tabular-nums; }
/* 搜尋＋篩選 */
.adm-filter { display: flex; gap: 8px; margin-top: 16px; }
.adm-search, .adm-sel {
  display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px;
  background: var(--bg2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); color: var(--muted);
  transition: border-color .15s;
}
.adm-search { flex: 1; min-width: 0; }
.adm-search:focus-within, .adm-sel:focus-within { border-color: rgba(var(--accent-rgb), .55); }
.adm-search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font: inherit; font-size: 16px; }
.adm-search input::placeholder { color: var(--muted); }
.adm-sel { position: relative; padding: 0; }
.adm-sel select { -webkit-appearance: none; appearance: none; height: 100%; padding: 0 32px 0 12px; background: none; border: 0; outline: 0; color: var(--text); font: inherit; font-size: 16px; max-width: 150px; }
.adm-sel .adm-ic { position: absolute; right: 10px; pointer-events: none; }
.adm-sort { display: flex; align-items: center; gap: 10px; margin: 12px 0 6px; font-size: .8rem; color: var(--muted); }
.adm-count { flex: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
.adm-sortbtns { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.adm-sortbtns::-webkit-scrollbar { display: none; }
.adm-sortbtns button {
  display: inline-flex; align-items: center; gap: 3px; height: 28px; padding: 0 10px; white-space: nowrap;
  background: none; border: 1px solid transparent; border-radius: 999px; color: var(--muted); font-size: .8rem; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: color .15s, border-color .15s, background .15s;
}
.adm-sortbtns button.on { color: var(--accent2); border-color: rgba(var(--accent-rgb), .45); background: rgba(var(--accent-rgb), .08); }
/* 清單列 */
.adm-list { display: flex; flex-direction: column; }
.adm-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 13px 2px 13px 0; background: none; border: 0; border-bottom: 1px solid var(--border-soft); color: var(--text); font: inherit;
  cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background .12s;
}
.adm-row:active { background: rgba(255, 255, 255, .035); }
.adm-row.static { cursor: default; }
.adm-row.static:active { background: none; }
.adm-row > .adm-ic { color: var(--muted); margin-left: -4px; }
.adm-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.adm-row-top { display: flex; align-items: center; gap: 7px; min-width: 0; }
.adm-acct { font-weight: 600; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-row-sub { font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-row-meta { font-size: .76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-dot { margin: 0 2px; }
.adm-row-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: .8rem; }
.adm-row-plan { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.adm-row-plan .adm-muted { font-size: .72rem; }
.adm-row-time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.adm-pro { color: var(--accent); font-weight: 700; }
.adm-kv .adm-pro { margin-right: 8px; }
.adm-muted { color: var(--muted); }
.adm-neg { color: var(--neg); }
.adm-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; overflow-wrap: anywhere; }
.adm-flag { flex: none; font-size: .68rem; font-weight: 600; line-height: 18px; padding: 0 7px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.adm-flag.neg { color: var(--neg); border-color: rgba(232, 89, 106, .5); }
.adm-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 44px 12px; color: var(--muted); text-align: center; font-size: .92rem; }
.adm-empty .adm-link { color: var(--accent); }
.adm-links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; }
.adm-links .adm-link { color: var(--accent); }
.adm-list-tf { margin-top: 14px; }
.adm-foot { margin: 16px 0 0; font-size: .78rem; color: var(--muted); line-height: 1.5; }
/* 明細：整頁滑入（手機）；內容分段，原始紀錄收在可展開區塊 */
.adm-detail {
  position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column;
  background: var(--bg); padding-top: env(safe-area-inset-top, 0px);
  transform: translateX(100%); transition: transform .22s cubic-bezier(.2, .7, .2, 1);
}
.adm-detail[hidden] { display: none; }
.adm-detail.show { transform: none; }
.adm-h { margin: 6px 0 2px; font-size: 1.2rem; font-weight: 700; overflow-wrap: anywhere; }
.adm-hsub { font-size: .85rem; }
.adm-alert { margin-top: 14px; padding: 10px 12px; border: 1px solid rgba(232, 89, 106, .45); border-radius: var(--radius-sm); color: var(--neg); font-size: .85rem; overflow-wrap: anywhere; }
.adm-kv { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px 14px; margin: 18px 0; font-size: .9rem; }
.adm-kv dt { color: var(--muted); }
.adm-kv dd { margin: 0; overflow-wrap: anywhere; }
.adm-kv dd small, .adm-rec small { display: block; font-size: .8rem; color: var(--muted); margin-top: 2px; }
.adm-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.adm-btn {
  display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 16px;
  background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font: inherit; font-size: .9rem; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: background .15s, border-color .15s, transform .05s;
}
.adm-btn:active { transform: scale(.97); background: rgba(255, 255, 255, .05); }
.adm-btn:disabled { opacity: .5; }
.adm-btn.danger { color: var(--neg); }
.adm-btn.primary { background: var(--gold-grad); border-color: transparent; color: var(--on-accent); font-weight: 700; }
.adm-btn.primary.danger { background: var(--neg); color: #fff; }
.adm-err { color: var(--neg); font-size: .85rem; margin-top: 10px; }
.adm-err:empty { display: none; }
.adm-secs { margin-top: 22px; }
.adm-sec { border-top: 1px solid var(--border-soft); }
.adm-sec:last-of-type { border-bottom: 1px solid var(--border-soft); }
.adm-sec > summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 14px 0; cursor: pointer; font-weight: 600; -webkit-tap-highlight-color: transparent; }
.adm-sec > summary::-webkit-details-marker { display: none; }
.adm-sec > summary .c { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.adm-sec > summary .adm-ic { margin-left: auto; color: var(--muted); transition: transform .15s; }
.adm-sec[open] > summary .adm-ic { transform: rotate(90deg); }
.adm-sec-body { padding: 0 0 14px; font-size: .9rem; }
.adm-sec-body .adm-kv { margin: 0 0 12px; gap: 7px 14px; font-size: .86rem; }
.adm-rec { padding: 10px 0; border-top: 1px solid var(--border-soft); overflow-wrap: anywhere; }
.adm-rec:first-child { border-top: 0; padding-top: 0; }
.adm-rec-h { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.adm-pre { margin: 10px 0 0; background: var(--bg2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 10px; font-size: .72rem; overflow: auto; max-height: 400px; white-space: pre-wrap; word-break: break-all; }
/* 確認視窗 */
.adm-modal { position: absolute; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .6); }
.adm-modal[hidden] { display: none; }
.adm-modal-box { width: min(400px, 100%); background: var(--bg2); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 20px 20px 18px; box-shadow: var(--shadow); }
.adm-modal-box h3 { margin: 0 0 2px; font-size: 1.05rem; font-weight: 700; }
.adm-who { font-size: .85rem; overflow-wrap: anywhere; }
.adm-modal-box label { display: block; font-size: .8rem; color: var(--muted); margin: 14px 0 0; }
.adm-modal-box .adm-sel { margin-top: 6px; height: 42px; }
.adm-modal-box .adm-sel select { width: 100%; max-width: none; }
.adm-modal-box textarea, .adm-modal-box input[type="date"] { display: block; width: 100%; margin-top: 6px; background: var(--bg3); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 9px 10px; color: var(--text); font: inherit; font-size: 16px; }
.adm-hint { font-size: .82rem; color: var(--muted); margin-top: 12px; }
.adm-modal-row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
@media (min-width: 700px) {
  .adm-body { padding-left: max(16px, calc((100% - 760px) / 2)); padding-right: max(16px, calc((100% - 760px) / 2)); }
  .adm-stats { grid-template-columns: repeat(4, 1fr); }
  .adm-detail { left: auto; width: min(620px, 100%); border-left: 1px solid var(--border-soft); box-shadow: var(--shadow); }
}
@media (prefers-reduced-motion: reduce) { .adm, .adm-detail { transition: none; } }

/* ----- 管理後台「付款」「推薦碼」分頁（js/admin.js，2026-10-19）-----
   分頁列：六個分頁在手機塞不下 → 橫向捲動（隱藏捲軸、snap 對齊分頁），分頁不縮、字不換行。
   捲動容器會切掉選中分頁用 -1px 外距壓在底線上的那 1px，所以底線改用 inset 陰影畫、分頁不再往下凸。
   後面「問題回報」那區還有 .adm-tab／.adm-tabs 的窄螢幕規則，這裡用 .adm 前綴提高權重，不靠先後順序。 */
.adm .adm-tabs {
  overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
  scrollbar-width: none; scroll-snap-type: x proximity; scroll-padding-inline: 16px;
  border-bottom: 0; box-shadow: inset 0 -1px 0 var(--border-soft);
}
.adm .adm-tabs::-webkit-scrollbar { display: none; }
.adm .adm-tabs .adm-tab { flex: none; margin-bottom: 0; white-space: nowrap; scroll-snap-align: start; }
@media (max-width: 480px) { .adm .adm-tabs { scroll-padding-inline: 6px; } }
/* 付款：狀態色（已付綠、失敗紅、其他／已退款灰）、推薦碼 tag */
.adm-pay-st { font-weight: 600; color: var(--muted); white-space: nowrap; }
.adm-pay-st.ok { color: var(--pos); }
.adm-pay-st.bad { color: var(--neg); }
.adm-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; letter-spacing: .04em; }
.adm-row-top .adm-code { flex: none; font-size: .92rem; }
.adm-code-tag { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--accent); border-color: rgba(var(--accent-rgb), .45); }
.adm-flag.ok { color: var(--pos); border-color: rgba(70, 209, 131, .45); }
.adm-stat .v .adm-cur { font-size: .52em; font-weight: 600; color: var(--muted); margin-right: 3px; letter-spacing: 0; }
/* 這兩組數字格：欄寬不被內容撐開（minmax 0），大字級時數字字級以畫面寬為上限，金額過長才換行 —— 不會把整頁撐出橫向捲動 */
.adm-pay-stats, .adm-rf-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.adm-pay-stats .v, .adm-rf-stats .v { font-size: min(1.7rem, 9vw); overflow-wrap: anywhere; }
@media (min-width: 700px) { .adm-pay-stats, .adm-rf-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.adm-row-side .adm-amt { font-weight: 700; font-size: .92rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.adm-row-side .adm-amt.adm-muted { font-weight: 600; }
/* 推薦碼：子視圖切換、各子視圖的工具列與篩選（label 歸零全站的上下外距，跟按鈕對齊；一排最多兩個下拉／月份，360 寬也不切字） */
.adm-rf-seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 14px; }
.adm-rf-seg .adm-btn { height: 38px; padding: 0 6px; white-space: nowrap; font-size: min(.9rem, 4.4vw); }
.adm-rf-seg .adm-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); font-weight: 700; background: rgba(var(--accent-rgb), .08); }
.adm-rf-pane[hidden] { display: none; }
.adm-rf-bar { justify-content: space-between; flex-wrap: wrap; row-gap: 8px; min-height: 32px; }
.adm-rf-bar .adm-btn { flex: none; gap: 5px; margin-left: auto; }
.adm-rf-filter { margin-top: 12px; }
.adm-rf-filter + .adm-rf-filter { margin-top: 8px; }
.adm-rf-filter > label { margin: 0; }
.adm-rf-filter input, .adm-rf-filter select { margin: 0; min-height: 0; }
.adm-rf-filter .adm-search input { padding: 0; }
.adm-rf-sels > label { flex: 1 1 0; min-width: 0; }
.adm-rf-sels .adm-sel select { width: 100%; max-width: none; min-width: 0; }
.adm-mon input { cursor: pointer; }
.adm-rf-msg { margin: 2px 2px 8px; font-size: .85rem; color: var(--pos); overflow-wrap: anywhere; }
.adm-rf-msg:empty { display: none; }
.adm-rf-msg.adm-neg { color: var(--neg); }
.adm-rf-sumerr { grid-column: 1 / -1; padding: 8px 2px; font-size: .85rem; color: var(--muted); }
.adm-rf-sumerr .adm-link { color: var(--accent); }
/* 推薦碼清單列：非有效的碼淡一點；剛建立／剛看過的碼反白（負外距＋等量內距，內容不位移） */
.adm-rc-row.dim .adm-code { color: var(--muted); }
.adm-row.sel { margin: 0 -8px; width: calc(100% + 16px); padding-left: 8px; padding-right: 10px; background: rgba(var(--accent-rgb), .08); border-radius: var(--radius-sm); border-bottom-color: transparent; }
.adm-ru-row .adm-row-side, .adm-rs-row .adm-row-side { align-self: center; }
.adm-ru-st { text-align: right; }
.adm-ru-per { display: block; margin-top: 2px; font-size: .72rem; color: var(--muted); }
.adm-ru-per.adm-neg { color: var(--neg); }
.adm-rs-per { flex: none; font-size: .8rem; color: var(--muted); }
.adm-rs-kol { font-weight: 400; font-size: .86rem; color: var(--muted); }
.adm-rs-wait { color: var(--accent); font-weight: 600; }
.adm-rs-pay { color: var(--accent); border-color: rgba(var(--accent-rgb), .5); }
.adm-rs-unpay { font-size: .8rem; white-space: nowrap; }
/* 推薦碼明細：分享連結、可編輯表單 */
.adm-code-h { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .05em; }
.adm-sh { margin: 22px 0 8px; font-size: .78rem; font-weight: 700; letter-spacing: .08em; color: var(--muted); }
.adm-share { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border-soft); }
.adm-share-k { flex: none; width: 3.2em; font-size: .82rem; color: var(--muted); }
.adm-share-u { flex: 1; min-width: 0; font-size: .76rem; line-height: 1.4; color: var(--text); -webkit-user-select: all; user-select: all; }
.adm-copy { flex: none; gap: 4px; }
.adm-rc-uses { margin-top: 2px; color: var(--accent); }
.adm-fhint { margin-top: 6px; font-size: .76rem; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; }
.adm-fhint[hidden] { display: none; }
.adm-fhint.ok { color: var(--pos); }
.adm-fhint.adm-neg { color: var(--neg); }
.adm-form .adm-f { display: block; margin: 14px 0 0; font-size: .8rem; color: var(--muted); letter-spacing: .02em; }
.adm-form .adm-f > input, .adm-form .adm-f > textarea {
  margin-top: 6px; min-height: 42px; padding: 9px 11px; font-size: 16px; color: var(--text);
  background-color: var(--bg3); border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
}
.adm-form .adm-f > textarea { line-height: 1.45; }
.adm-form .adm-f > .adm-flag { margin-left: 6px; }
.adm-form .adm-sel { margin-top: 6px; height: 42px; background: var(--bg3); }
.adm-form .adm-sel select { width: 100%; max-width: none; margin: 0; min-height: 0; }
.adm-form input[aria-invalid="true"], .adm-form textarea[aria-invalid="true"] { border-color: var(--neg); }
.adm-f-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; }
.adm-f-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 10px; }
.adm-f-grid > .adm-f { display: flex; flex-direction: column; justify-content: flex-end; }
.adm-f-save { margin-top: 18px; align-items: center; }
.adm-f-msg { font-size: .85rem; color: var(--pos); }
/* 視窗：內容太長（小螢幕＋鍵盤）可捲；月份／備註輸入、應付金額、匯款資料 */
.adm-modal-box { max-height: 100%; overflow-y: auto; overscroll-behavior: contain; }
.adm-modal-box .m-in { display: block; width: 100%; margin-top: 6px; min-height: 42px; background: var(--bg3); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 9px 10px; color: var(--text); font: inherit; font-size: 16px; }
.adm-m-amt { margin-top: 14px; font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.adm-m-lbl { margin-top: 14px; font-size: .8rem; color: var(--muted); }
.adm-m-payout { margin-top: 6px; padding: 10px 12px; background: var(--bg3); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); font-size: .9rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; -webkit-user-select: text; user-select: text; }

/* ---------- 問題回報與建議（js/feedback.js）---------- */
.fb-dlg { max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; }
.fb-title { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.fb-title .ic { flex: none; color: var(--accent); }
.fb-lbl { display: block; margin-top: 12px; font-size: .82rem; color: var(--muted); }
.fb-lbl .dlg-input { margin-top: 6px; font-size: 16px; color: var(--text); }
.fb-dlg textarea.dlg-input { display: block; resize: vertical; min-height: 7.5em; line-height: 1.5; font-family: inherit; }
.fb-dlg select.dlg-input { display: block; }
.fb-count { margin-top: 4px; text-align: right; font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.fb-note { margin-top: 12px; font-size: .75rem; line-height: 1.5; color: var(--muted); }
.fb-err { margin-top: 8px; font-size: .85rem; color: var(--neg); min-height: 0; }
.fb-err:empty { display: none; }
.acct-sheet .btn .ic { margin-right: 6px; vertical-align: -3px; }
/* 管理後台「回報」分頁 */
.adm-tab-n { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--neg); color: #fff; font-size: .7rem; font-weight: 700; line-height: 18px; text-align: center; }
.adm-fb-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.adm-fb-snip { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.adm-fb-msg { margin: 14px 0 6px; padding: 12px 14px; background: var(--bg3); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.adm-fb-st .adm-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.adm-fb-lbl { display: block; margin-top: 14px; font-size: .8rem; color: var(--muted); }
.adm-fb-lbl textarea { display: block; width: 100%; margin-top: 6px; background: var(--bg3); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 9px 10px; color: var(--text); font: inherit; font-size: 16px; resize: vertical; }
.adm-fb-sub { display: inline-flex; align-items: center; gap: 2px; padding: 0; overflow-wrap: anywhere; text-align: left; }
/* 三個分頁在窄螢幕＋大字級也要塞得下：分頁可縮、標籤過長就省略 */
.adm-tab { flex: 0 1 auto; min-width: 0; }
.adm-tab .adm-ic, .adm-tab .adm-tab-n { flex: none; }
.adm-tab > span:not(.adm-tab-n) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 480px) { .adm-tab { padding: 0 10px; gap: 5px; } .adm-tabs { padding: 0 8px; } }
/* 管理後台「語音」分頁（js/admin.js，2026-10-14）：試一句＋題庫狀態、3 個數字、單一下拉、單行列表（未處理列直接有兩顆動作鈕） */
.adm-tab .ic { margin: 0; }
.adm-tab[aria-selected="true"] .ic { color: var(--accent); }
.adm-vt { display: flex; gap: 8px; }
.adm-vt > label, .adm-vo-bar > label { margin: 0; }   /* 全站 label 有上下 10px 外距，這兩排要跟按鈕／計數對齊 */
.adm-vt-box { flex: 1; min-width: 0; }
.adm-vt-in { margin: 0; min-height: 0; padding: 0; }
.adm-vt-lang { flex: none; }
.adm-vt-lang select { max-width: 92px; padding-right: 28px; }
.adm-vt-lang select, .adm-vo-bar select { margin: 0; min-height: 0; }
.adm-vt-lang .adm-ic { right: 8px; }
.adm-vt-go { flex: none; height: 42px; padding: 0 14px; }
.adm-vt-out { margin-top: 10px; }
.adm-vt-out[hidden] { display: none; }
.adm-vt-res { background: var(--bg2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 12px 14px; }
.adm-vt-h { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.adm-vt-h .adm-mono { font-size: .74rem; }
.adm-vt-conf { margin-left: auto; font-size: .8rem; font-variant-numeric: tabular-nums; }
.adm-vt-res .adm-kv { margin: 10px 0 0; gap: 6px 14px; font-size: .86rem; }
.adm-vt-ans { margin-top: 10px; padding: 10px 12px; background: var(--bg3); border-radius: var(--radius-sm); line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .9rem; }
.adm-vt-m { margin-top: 8px; font-size: .72rem; }
.adm-vo-bank { margin: 8px 2px 0; font-size: .78rem; color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
.adm-vo-bank:empty { display: none; }
.adm-vo-bank-err { display: block; color: var(--neg); }
.adm-vo-stats { margin-top: 14px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.adm-vo-bar { align-items: center; margin-top: 14px; }
.adm-vo-bar .adm-count { margin-left: auto; font-size: .8rem; color: var(--muted); }
.adm-vo-row { cursor: default; padding: 8px 0; align-items: center; }
.adm-vo-row:active { background: none; }
.adm-vo-main {
  flex: 1; min-width: 0; display: flex; padding: 5px 4px 5px 0; margin: 0; background: none; border: 0; border-radius: 8px;
  color: inherit; font: inherit; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background .12s;
}
.adm-vo-main:active { background: rgba(255, 255, 255, .035); }
.adm-vo-text { font-size: .93rem; line-height: 1.45; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.adm-vo-acts { flex: none; display: flex; flex-direction: column; gap: 6px; }
.adm-btn.sm { height: 32px; padding: 0 10px; font-size: .8rem; white-space: nowrap; }
.adm-vo-st { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.adm-vo-dacts { margin-top: 14px; }
@media (min-width: 700px) { .adm-vo-acts { flex-direction: row; } }
/* 四個分頁：窄螢幕再收一點左右留白，標籤照樣可省略 */
@media (max-width: 480px) { .adm-tab { padding: 0 8px; } .adm-tabs { padding: 0 6px; } }

/* ===== 我的推薦碼（js/referral.js，2026-10-19）=====
   KOL 本人對帳頁：沿用管理後台的 .adm 全螢幕骨架（.adm-bar／.adm-body／.adm-stats／.adm-list／.adm-row／.adm-empty），
   這裡只放 .rfp- 專屬樣式。字級一律 rem；窄螢幕＋大字級時一律換行，不撐出橫向捲動 */
.rfp .adm-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rfp-body { overflow-x: hidden; overflow-wrap: anywhere; }
.rfp-block + .rfp-block { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--border-soft); }
.rfp-head { background: var(--bg2); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 16px; }
.rfp-code-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.rfp-code {
  min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 2rem; font-weight: 700;
  line-height: 1.15; letter-spacing: .1em; color: var(--accent2); overflow-wrap: anywhere; -webkit-user-select: all; user-select: all;
}
.rfp-chip { flex: none; max-width: 100%; font-size: .74rem; font-weight: 600; line-height: 1.7; padding: 0 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.rfp-chip.rfp-st-active { color: var(--pos); border-color: rgba(70, 209, 131, .5); }
.rfp-chip.rfp-st-ended, .rfp-chip.rfp-st-expired, .rfp-chip.rfp-st-exhausted { color: var(--neg); border-color: rgba(232, 89, 106, .5); }
.rfp-terms { margin-top: 8px; font-size: .88rem; line-height: 1.5; color: var(--muted); }
.rfp-copy-wrap { margin-top: 14px; }
.rfp .adm-btn { height: auto; min-height: 40px; max-width: 100%; padding: 6px 14px; gap: 6px; line-height: 1.3; text-align: center; }
.rfp .adm-btn.sm { min-height: 32px; padding: 4px 10px; white-space: normal; }
.rfp .adm-btn .ic { flex: none; }
.rfp .adm-btn.on { color: var(--pos); border-color: rgba(70, 209, 131, .5); }
.rfp-hint { margin-top: 6px; font-size: .78rem; line-height: 1.45; color: var(--muted); }
.rfp-hint:empty { display: none; }
/* 四格數字：只是顯示（不可點）；一格放不下 9.5rem 就自動排成一欄（大字級） */
.rfp .rfp-stats { margin-top: 14px; grid-template-columns: repeat(auto-fit, minmax(min(9.5rem, 100%), 1fr)); }
.rfp .adm-stat { min-width: 0; cursor: default; }
.rfp .adm-stat .v { font-size: 1.45rem; overflow-wrap: anywhere; }
.rfp .adm-stat .h { white-space: normal; }
.rfp-sec { margin-top: 24px; }
.rfp-h { margin: 0 0 2px; font-size: .95rem; font-weight: 700; letter-spacing: .02em; }
.rfp-link { padding: 10px 0 12px; border-bottom: 1px solid var(--border-soft); }
.rfp-link-k { font-size: .8rem; color: var(--muted); }
.rfp-link-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 4px; }
.rfp-url {
  flex: 1 1 12rem; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; line-height: 1.45;
  word-break: break-all; -webkit-user-select: all; user-select: all;
}
.rfp-link-row .adm-btn { flex: none; }
.rfp-note { margin: 10px 0 0; font-size: .82rem; line-height: 1.55; color: var(--muted); }
/* 每月結算／最近推薦：左（期別或日期＋小字）右（金額＋狀態），太擠就整塊換到下一行 */
.rfp .rfp-row { flex-wrap: wrap; align-items: flex-start; gap: 4px 12px; padding: 11px 0; }
.rfp-row-l { flex: 1 1 8rem; min-width: 0; }
.rfp-row-r { flex: 0 1 auto; min-width: 0; margin-left: auto; text-align: right; }
.rfp-row-t { font-size: .95rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.rfp-row-s { margin-top: 2px; font-size: .8rem; color: var(--muted); }
.rfp-x { color: var(--neg); white-space: nowrap; }
.rfp-x::before { content: "\00B7"; margin: 0 .35em; color: var(--muted); }
.rfp-adj { display: inline-block; margin-right: .45em; font-size: .72rem; font-weight: 600; color: var(--accent); white-space: nowrap; }
.rfp-st-paid, .rfp-st-ok { color: var(--pos); }
.rfp-st-pending { color: var(--accent); }
.rfp-rev .rfp-row-t, .rfp-rev .rfp-row-s { color: var(--muted); }
.rfp-rev .rfp-amt { text-decoration: line-through; }
.rfp-none { padding: 14px 0 4px; font-size: .9rem; color: var(--muted); }
.rfp-state .rfp-hint { margin-top: -4px; }
.rfp-foot { margin-top: 24px; }
