/* 撲克工具箱 — 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; }
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;
}
/* 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; }
.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; }
.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; }
.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; }
.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;
}
.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; }
.paywall h3 {
  margin: 14px 0 8px; font-size: .78rem; color: var(--accent);
  letter-spacing: .14em; font-weight: 600;
}
.paywall-list { margin: 0 0 14px; padding-left: 0; list-style: none; }
.paywall-list li {
  position: relative; padding: 5px 0 5px 22px;
  font-size: .88rem; line-height: 1.45; color: var(--text);
}
.paywall-list li::before {
  content: "✓"; position: absolute; left: 2px; top: 5px;
  color: var(--accent2); font-weight: 700;
}
.paywall-price {
  margin: 0 0 12px; text-align: center;
  font-size: .9rem; font-weight: 700; color: var(--accent2);
}
.paywall .btn + .btn { margin-top: 8px; }
.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-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); }
.sync-status { font-size: 12px; opacity: 0.7; }
/* 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; }
.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; }

/* ===== 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; }
}
