/* ==========================================================================
   public.css — 前台公開頁（FE-1）：首頁 / 訂場 / 付款 / 入場票
   Tokens: UI-SPEC.md v0.4 §1（值同 design/prototypes/assets/panel.css 一致）
   Light + dark 兩套（D-32），跟 OS prefers-color-scheme，可用 header 掣手動切換
   （D-33，記 localStorage；?theme= 只供 QA 截圖）。

   由 panel.css 抽出公開頁真正用得到嘅部分（nav / button / card / booking /
   ticket / home / responsive），後台分頁、會員中心、表格、狀態示範區一律唔抄。
   Sections: 1 tokens · 2 base · 3 nav · 4 controls · 5 cards
             6 booking · 7 checkout · 8 ticket · 9 home · 10 responsive · 11 print
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
/* 三個入口，優先次序：手動 [data-theme] > OS @media > :root 預設（dark）。
   dark 做預設係刻意：冇 JS／首屏之前都唔會閃一下白色。 */
:root {
  /* 版面 */
  --wrap: 1100px;
  --nav-h: 60px;
  --page-pad: 20px 16px 24px;
  --tap: 44px;                 /* a11y：最小點擊高度 */
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.1);
  --shadow-up: 0 -6px 20px rgba(0, 0, 0, 0.35);

  /* App skin（dark） */
  --bg: #0f1419;
  --surface: #171d24;
  --surface-2: #1e252e;
  --border: #2d3640;
  --text: #e6e9ed;
  --muted: #98a2b3;
  --primary: #2f6fe4;          /* 做「底」用；白字 4.65:1 */
  --primary-ink: #ffffff;
  --link-fg: #4c8dff;          /* 做「字色」用；同色相、更亮 */
  --primary-hover: color-mix(in srgb, var(--primary) 88%, var(--primary-ink));
  --success: #1a7f37;
  --success-bg: #e6f4ea;
  --danger: #c62828;
  --danger-bg: #fdecec;
  --warn: #9a6700;
  --warn-bg: #fff4d6;
  --ok-fg: color-mix(in srgb, var(--success) 62%, var(--primary-ink));
  --ok-tint: color-mix(in srgb, var(--success) 22%, var(--surface-2));
  --bad-fg: color-mix(in srgb, var(--danger) 55%, var(--primary-ink));
  --bad-tint: color-mix(in srgb, var(--danger) 22%, var(--surface-2));
  --warn-fg: color-mix(in srgb, var(--warn) 62%, var(--primary-ink));
  --warn-tint: color-mix(in srgb, var(--warn) 20%, var(--surface-2));
  --info-tint: color-mix(in srgb, var(--primary) 16%, var(--bg));
  --info-fg: var(--link-fg);
  --muted-strong: var(--muted);
  --chip-sub-ink: var(--primary-ink);
  /* 優惠卡「會員專享」標籤（UI-SPEC §4；panel.css 同名 token） */
  --tag-member-bg: rgba(31, 95, 214, 0.18);
  --tag-member-fg: #7fb0ff;

  /* Marketing skin（首頁；兩套主題都係深底，所以呢組唔隨主題變） */
  --h-navy: #0b1b33;
  --h-ball: #d4f53c;
  --h-ball-ink: #0b1b33;
  --h-court: #1f5fd6;
  --h-court-text: #3b82f6;     /* 深底上嘅 #1f5fd6 只 3.23:1，亮一級到 5.03:1 */
  --h-muted: var(--muted);

  --ticket-page-bg: #0f1720;
  color-scheme: dark;
}

/* Light 值：下面 @media 同 [data-theme='light'] 共用，改嘅時候兩邊一齊改 */
:root[data-theme='light'] {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #dfe3e8;
  --text: #1c2430;
  --muted: #667085;
  --primary: #1f6feb;
  --primary-ink: #ffffff;
  --link-fg: color-mix(in srgb, var(--primary) 85%, #000000);
  --primary-hover: color-mix(in srgb, var(--primary) 86%, #000000);
  --ok-fg: color-mix(in srgb, var(--success) 92%, #000000);
  --ok-tint: var(--success-bg);
  --bad-fg: color-mix(in srgb, var(--danger) 92%, #000000);
  --bad-tint: var(--danger-bg);
  --warn-fg: color-mix(in srgb, var(--warn) 92%, #000000);
  --warn-tint: var(--warn-bg);
  --info-tint: color-mix(in srgb, var(--primary) 18%, var(--surface-2));
  --info-fg: color-mix(in srgb, var(--primary) 78%, #000000);
  --muted-strong: color-mix(in srgb, var(--muted) 94%, #000000);
  --tag-member-bg: #e8f0fe;
  --tag-member-fg: #1c4fb8;
  --shadow-up: 0 -6px 20px rgba(16, 24, 40, 0.14);
  --h-court-text: #1f5fd6;
  --ticket-page-bg: var(--bg);
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #f0f2f5;
    --border: #dfe3e8;
    --text: #1c2430;
    --muted: #667085;
    --primary: #1f6feb;
    --primary-ink: #ffffff;
    --link-fg: color-mix(in srgb, var(--primary) 85%, #000000);
    --primary-hover: color-mix(in srgb, var(--primary) 86%, #000000);
    --ok-fg: color-mix(in srgb, var(--success) 92%, #000000);
    --ok-tint: var(--success-bg);
    --bad-fg: color-mix(in srgb, var(--danger) 92%, #000000);
    --bad-tint: var(--danger-bg);
    --warn-fg: color-mix(in srgb, var(--warn) 92%, #000000);
    --warn-tint: var(--warn-bg);
    --info-tint: color-mix(in srgb, var(--primary) 18%, var(--surface-2));
    --info-fg: color-mix(in srgb, var(--primary) 78%, #000000);
    --muted-strong: color-mix(in srgb, var(--muted) 94%, #000000);
    --tag-member-bg: #e8f0fe;
    --tag-member-fg: #1c4fb8;
    --shadow-up: 0 -6px 20px rgba(16, 24, 40, 0.14);
    --h-court-text: #1f5fd6;
    --ticket-page-bg: var(--bg);
    color-scheme: light;
  }
}

/* ---------- 2. Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, 'Segoe UI', 'Microsoft JhengHei',
        'PingFang TC', 'Noto Sans TC', sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link-fg); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 12px; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
img { max-width: 100%; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: var(--page-pad); }
.narrow { max-width: 480px; }

/* 跳去主要內容：第一個可聚焦元素，聚焦時才滑入畫面 */
.skip-link {
  position: absolute;
  inset-block-start: -60px;
  inset-inline-start: 12px;
  z-index: 50;
  padding: 10px 16px;
  border-radius: 0 0 8px 8px;
  background: var(--primary);
  color: var(--primary-ink);
  font-weight: 700;
  text-decoration: none;
  transition: inset-block-start 0.15s;
}
.skip-link:focus-visible { inset-block-start: 0; }

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

/* ---------- 3. Nav ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 16px;
  min-height: var(--nav-h);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.topbar .brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 8px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}
.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--h-ball);
  box-shadow: 0 0 0 3px rgba(212, 245, 60, 0.18);
}

.nav-links { display: flex; flex: 1; flex-wrap: wrap; gap: 2px; }
.nav-links a,
.nav-links span {
  padding: 7px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.nav-links a:hover { background: var(--surface-2); color: var(--text); }
.nav-links a.active { background: var(--surface-2); color: var(--link-fg); }
/* 下一批才開嘅頁：唔係連結，唔會撳出 404 */
.nav-links span.soon { opacity: 0.55; cursor: default; }

.nav-user { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.nav-user .who { font-size: 13px; color: var(--muted); }

/* 主題切換（D-33）：40×40，圖示由 CSS 依「當前有效主題」決定 */
.theme-toggle {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 17px;
  line-height: 1;
}
.theme-toggle .ico { display: block; line-height: 1; }
.theme-toggle .ico-moon { display: none; }
:root[data-theme='light'] .theme-toggle .ico-moon { display: block; }
:root[data-theme='light'] .theme-toggle .ico-sun { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) .theme-toggle .ico-moon { display: block; }
  :root:not([data-theme='dark']) .theme-toggle .ico-sun { display: none; }
}

/* ---------- 4. Controls ---------- */
button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
button:hover,
.btn:hover { border-color: color-mix(in srgb, var(--border) 60%, var(--text)); }

button.primary,
.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
}
button.primary:hover,
.btn.primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

button.sm,
.btn.sm { min-height: 32px; padding: 5px 10px; font-size: 13px; }

button:disabled,
.btn[aria-disabled='true'] {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: var(--border);
}

/* 首頁 hero / CTA 用 pill */
.btn-hero,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 14px 28px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.btn-hero {
  background: var(--h-ball);
  color: var(--h-ball-ink);
  box-shadow: 0 8px 24px rgba(212, 245, 60, 0.28);
}
.btn-hero:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(212, 245, 60, 0.38); }
.btn-hero.sm { min-height: 40px; padding: 10px 20px; font-size: 14px; }
/* .btn-ghost 只喺固定深底（hero／CTA）出現，所以白字係刻意，唔跟主題 */
.btn-ghost { color: #fff; border: 2px solid rgba(255, 255, 255, 0.55); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); }

label { display: block; margin: 10px 0 4px; color: var(--muted); font-size: 13px; }
input,
select,
textarea {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}
input:focus,
select:focus,
textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
input[type='checkbox'],
input[type='radio'] { width: auto; }

/* 表單錯誤：input 旁邊一句繁中，唔會遮住 label */
.err { margin: 6px 0 0; color: var(--bad-fg); font-size: 13px; }
input[aria-invalid='true'] { border-color: var(--bad-fg); }

/* ---------- 5. Cards / badges / notices ---------- */
.card {
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.badge {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: 1px;
}
.badge.ok { background: var(--ok-tint); color: var(--ok-fg); }
.badge.bad { background: var(--bad-tint); color: var(--bad-fg); }
.badge.warn { background: var(--warn-tint); color: var(--warn-fg); }
.badge.info { background: var(--info-tint); color: var(--info-fg); }

.notice {
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 14px;
}
.notice.ok { background: var(--ok-tint); color: var(--ok-fg); }
.notice.bad { background: var(--bad-tint); color: var(--bad-fg); }
.notice.warn { background: var(--warn-tint); color: var(--warn-fg); }

.price { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.amount-pos { color: var(--ok-fg); font-variant-numeric: tabular-nums; }

/* 標籤 / 值：訂單摘要、付款拆帳 */
.kv { display: grid; gap: 0; }
.kv div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.kv div:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { text-align: right; }
.kv .total .k { color: var(--text); font-weight: 700; }
.kv .total .v { font-size: 22px; font-weight: 800; }

/* 空／錯誤狀態（UI-SPEC §6） */
.state {
  padding: 26px 18px;
  border-radius: 20px;
  background: var(--surface-2);
  text-align: center;
}
.state .icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 8px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 22px;
  line-height: 44px;
}
.state .big { margin: 8px 0; font-size: 22px; font-weight: 800; }
.state p { margin: 6px 0 0; color: var(--muted); }

/* ---------- 6. Booking ---------- */
.dates {
  display: flex;
  gap: 8px;
  margin: 14px 0 0;
  padding-bottom: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.date-chip {
  flex: 0 0 auto;
  min-width: 66px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
}
.date-chip:hover { border-color: color-mix(in srgb, var(--border) 50%, var(--text)); }
.date-chip b { display: block; font-size: 17px; }
.date-chip span { font-size: 12px; color: var(--muted); }
.date-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
}
.date-chip.active span { color: var(--chip-sub-ink); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 12px 0 16px;
  color: var(--muted);
  font-size: 13px;
}
.legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 5px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
  vertical-align: -1px;
}
.legend i.sel { background: var(--primary); border-color: var(--primary); }
.legend i.bk { background: var(--surface-2); }
/* T-725：封場（暫停開放）—— 同「已被預訂」用斜線紋分開。 */
.legend i.bl {
  background: repeating-linear-gradient(135deg, var(--surface-2) 0 3px, transparent 3px 6px);
}
.legend i.ps { border-style: dashed; border-color: var(--muted); background: transparent; }
.legend i.nc { position: relative; border: 0; background: none; }
.legend i.nc::after {
  content: '';
  position: absolute;
  inset-block-start: 3px;
  inset-inline-start: 4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--warn-fg);
}

.court { margin-bottom: 14px; }
.court-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.court-head h3 { margin: 0; font-size: 16px; }
.court-price { margin-left: auto; font-size: 14px; font-weight: 600; }
.court-price .muted { font-weight: 400; }

.slots {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
}
.slot {
  position: relative;
  min-height: var(--tap);
  padding: 9px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  /* 每格文字置中：<a> 預設靠左，會同 <button> 嘅格唔對齊。 */
  text-align: center;
}
.slot:hover:not(.booked):not(.past) { border-color: var(--primary); }
.slot.booked {
  background: var(--surface-2);
  color: var(--muted);
  text-decoration: line-through;
  cursor: not-allowed;
}
.slot.past {
  background: transparent;
  color: var(--muted);
  opacity: 0.45;
  cursor: not-allowed;
}
/* T-725 / D-45：封場時段。同「已被預訂」分得開 —— 斜線紋、唔劃走字、
   而且唔受 `button:disabled { opacity: .5 }` 影響（否則字幾乎睇唔到）。 */
.slot.blocked {
  background: repeating-linear-gradient(
    135deg,
    var(--surface-2) 0 6px,
    transparent 6px 12px
  );
  color: var(--text);
  opacity: 1;
  cursor: not-allowed;
}
.slot.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
}
/* 48 小時內開場：訂得，但唔設取消／改期（D-23）。用 inset，圓點永遠留喺格內。 */
.slot.nocancel { border-color: color-mix(in srgb, var(--warn) 42%, var(--border)); }
.slot.nocancel::after {
  content: '';
  position: absolute;
  inset-block-start: 5px;
  inset-inline-end: 5px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--warn-fg);
}
.slot.selected.nocancel::after { background: var(--primary-ink); }

/* 時間表要預留結算條嘅高度：條 bar 係 sticky，唔預留就會永久蓋住最後一張場地卡 */
.book-main { padding-bottom: 112px; }

/* 底部結算條（桌面 sticky bottom，手機變底部卡） */
.bar {
  position: sticky;
  bottom: 0;
  z-index: 6;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-up);
}
.bar .inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 20px;
  max-width: var(--wrap);
  margin: 0 auto;
}
.bar .summary { flex: 1 1 260px; min-width: 0; }
.bar .summary .t { font-weight: 600; }
.bar .summary .hint { font-size: 13px; color: var(--muted); }
.bar .totals {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-variant-numeric: tabular-nums;
}
.bar .totals .label { font-size: 13px; color: var(--muted); }
.bar .totals .price { font-size: 22px; }
.bar .discounts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}
.bar .discounts span { white-space: nowrap; }
.bar .discounts b { color: var(--ok-fg); font-weight: 600; }

/* ---------- 7. Checkout ---------- */
.steps-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  list-style: none;
}
.steps-mini li { padding: 3px 10px; border-radius: 999px; background: var(--surface-2); }
.steps-mini li.on { background: var(--primary); color: var(--primary-ink); font-weight: 600; }

.order-head { font-weight: 600; margin: 0 0 4px; }
.pay-method {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.pay-method .card-ico {
  flex: 0 0 auto;
  width: 34px;
  height: 24px;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--primary), var(--link-fg));
}
.pay-method b { display: block; }
form .field { margin-bottom: 6px; }

/* 付款三個狀態（處理中／成功／未完成）：同一個位置，只顯示當前嗰個。
   處理中由 public.js 喺 submit 之後即刻顯示，唔會卡住（瀏覽器照樣交表；
   完成後會導去入場票頁，失敗就 server 直接 render 未完成嗰格）。 */
.pay-state {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.pay-state[hidden] { display: none; }
.pay-state h2 { margin: 0 0 6px; }
.pay-state p { margin: 0 0 8px; }
.pay-state .row { margin-top: 12px; }
.pay-state.is-processing { border-style: dashed; }
.pay-state.is-failed { border-color: var(--bad-fg); background: var(--bad-tint); }
.pay-state.is-succeeded { border-color: var(--ok-fg); background: var(--ok-tint); }
.pay-state .price { margin: 6px 0 10px; }

/* ---------- 8. Ticket（固定深色票面，兩套 theme 都唔跟） ---------- */
body.ticket-mode { background: var(--ticket-page-bg); }

.ticket-view {
  --t-bg: #0f1720;
  --t-fg: #f3f6f9;
  --t-muted: #9aa8b6;
  --t-card: #18222d;
  --t-accent: #3ddc84;
  --t-accent-2: #2fb7ff;
  min-height: 100vh;
  background: var(--t-bg);
  color: var(--t-fg);
}
.t-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 440px;
  margin: 0 auto;
  padding: 24px 16px 32px;
}
.t-head { text-align: center; }
.t-venue {
  color: var(--t-muted);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.t-label { margin-top: 6px; font-size: 19px; font-weight: 700; line-height: 1.35; }
.t-holder { margin-top: 4px; color: var(--t-muted); font-size: 14px; }
.t-body { display: flex; flex-direction: column; gap: 14px; }

.t-theme-toggle {
  position: absolute;
  inset-block-start: 18px;
  inset-inline-end: 14px;
  z-index: 2;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
  color: var(--t-fg);
}

.qr-stage {
  position: relative;
  isolation: isolate;
  width: min(86vw, 360px);
  aspect-ratio: 1;
  margin: 6px auto 0;
  padding: 7px;
  border-radius: 26px;
  overflow: hidden;
}
.qr-stage::before {
  content: '';
  position: absolute;
  inset: -50%;
  z-index: -1;
  background: conic-gradient(from 0deg, var(--t-accent), var(--t-accent-2), #a78bfa, var(--t-accent));
}
/* QR 一律純白底：掃碼對比要緊，唔跟主題 */
.qr-card {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 14px;
  border-radius: 20px;
  background: #fff;
}
.qr-card svg { display: block; width: 100%; height: 100%; }

.entry-code { text-align: center; }
.entry-code span { display: block; color: var(--t-muted); font-size: 13px; }
.entry-code b {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(24px, 7vw, 30px);
  letter-spacing: 0.12em;
}

.banner { padding: 10px 14px; border-radius: 12px; text-align: center; font-weight: 700; }
.banner.ok { background: rgba(61, 220, 132, 0.15); color: var(--t-accent); }
.banner.wait { background: rgba(47, 183, 255, 0.12); color: var(--t-accent-2); }
/* 已入場：唔再係「可以入場」嘅綠，但亦唔係錯誤 —— 中性灰 */
.banner.used { background: rgba(255, 255, 255, 0.1); color: rgba(255, 255, 255, 0.75); }

.t-instr {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--t-card);
  font-size: 15px;
}
.t-instr .ico {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 3px solid var(--t-accent);
  border-radius: 50%;
  color: var(--t-accent);
  font-weight: 800;
}
.t-info { padding: 4px 14px; border-radius: 14px; background: var(--t-card); }
.t-info div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 14px;
}
.t-info div:last-child { border-bottom: 0; }
.t-info span:first-child { color: var(--t-muted); }
.t-note {
  margin: 0;
  color: var(--t-muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}
.t-note a { color: var(--t-accent-2); }
.t-back {
  display: inline-block;
  align-self: flex-start;
  margin-bottom: 4px;
  color: var(--t-muted);
  font-size: 14px;
  text-decoration: none;
}
.t-back:hover { color: var(--t-fg); }
.ticket-view .state { background: var(--t-card); }
.ticket-view .state p { color: var(--t-muted); }
/* 四種票狀態（UI-SPEC §6）：
   ok／wait 出 QR；used 出灰階 QR 加交叉；expired 灰階；cancelled 紅色。 */
.ticket-view .state .icon { background: rgba(255, 255, 255, 0.08); color: var(--t-fg); }
.ticket-view .state.used .icon { color: var(--t-accent); }
.ticket-view .state.expired .icon { color: var(--t-muted); }
.ticket-view .state.cancelled .icon,
.ticket-view .state.cancelled .big { color: #ff8080; }
.ticket-view .state.cancelled { border: 1px solid rgba(255, 128, 128, 0.35); }
.ticket-view.is-stale .t-info,
.ticket-view.is-stale .t-head { opacity: 0.55; filter: grayscale(1); }
.qr-card { position: relative; }
/* 只把 QR 本身灰掉；交叉要清楚（唔可以連交叉一齊變淡） */
.qr-card.is-void svg { filter: grayscale(1); opacity: 0.28; }
.qr-card.is-void::after {
  content: '✕';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #c62828;
  font-size: clamp(96px, 26vw, 150px);
  font-weight: 800;
  line-height: 1;
  opacity: 0.9;
}
.t-refund {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 128, 128, 0.1);
  color: var(--t-fg);
  font-size: 13px;
}

/* ---------- 9. Home ---------- */
.home {
  --h-text: var(--text);
  --h-muted: var(--muted);
}

.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: min(88vh, 760px);
  overflow: hidden;
  background: var(--h-navy);
  color: #fff;
}
.hero-scene {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(120% 90% at 68% 30%, rgba(76, 141, 255, 0.34) 0%, rgba(76, 141, 255, 0) 55%),
    linear-gradient(160deg, #16305a 0%, var(--h-navy) 48%, #071325 100%);
}
.hero-scene svg { display: block; width: 100%; height: 100%; }
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(11, 27, 51, 0.94) 0%, rgba(11, 27, 51, 0.74) 42%, rgba(11, 27, 51, 0.18) 100%),
    linear-gradient(0deg, rgba(11, 27, 51, 0.7) 0%, rgba(11, 27, 51, 0) 45%);
}
.hero-inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: end;
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 96px 20px 64px;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.ball-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--h-ball);
  box-shadow: 0 0 0 4px rgba(212, 245, 60, 0.25);
}
.hero h1 {
  max-width: 12em;
  margin: 0 0 18px;
  font-size: clamp(38px, 7vw, 76px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.hero-sub {
  max-width: 34em;
  margin: 0 0 28px;
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.7;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 34px 0 0;
  padding: 0;
  list-style: none;
}
.hero-facts li {
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 14px;
}
.hero-facts b { color: var(--h-ball); }

.h-section { padding: 56px 0; }
.h-wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.narrow-wrap { max-width: 760px; }
/* 只俾讀屏見到嘅文字（頁面冇可見標題時仍然有 heading） */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.h-kicker {
  margin: 0 0 10px;
  color: var(--h-court-text);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
}
.h-title {
  max-width: 18em;
  margin: 0 auto 40px;
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.2;
  text-align: center;
}

.feature-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.feature {
  padding: 26px 22px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.feature h3 { margin: 16px 0 8px; font-size: 19px; }
.feature p { margin: 0; color: var(--h-muted); line-height: 1.7; }
.f-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--h-navy);
}
.f-icon svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: var(--h-ball);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}
.f-icon svg .ball { fill: var(--h-ball); stroke: none; }

/* 會員專享輪播（hero 右側，原型 1 / 7） */
.member-promo {
  min-width: 0;
  padding: 18px 20px 20px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 22px;
  background: rgba(11, 27, 51, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.3);
}
.mp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.mp-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--h-ball);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.mp-count { color: rgba(255, 255, 255, 0.6); font-size: 12px; font-variant-numeric: tabular-nums; }
.mp-viewport { overflow: hidden; border-radius: 14px; }
.mp-track {
  display: flex;
  transition: transform 0.55s cubic-bezier(0.22, 0.8, 0.24, 1);
}
.mp-slide { flex: 0 0 100%; min-width: 0; min-height: 170px; padding: 2px 2px 4px; }
.mp-badge {
  color: var(--h-ball);
  font-size: clamp(36px, 4vw, 46px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.mp-slide h3 { margin: 10px 0 6px; color: #fff; font-size: 19px; }
.mp-slide p { margin: 0; color: rgba(255, 255, 255, 0.78); font-size: 14px; line-height: 1.6; }
.mp-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0 16px;
}
.mp-arrow {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 20px;
  line-height: 1;
}
.mp-arrow:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.3); }
.mp-dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.mp-dots button {
  width: 8px;
  height: 8px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
  transition: width 0.25s, background 0.25s;
}
.mp-dots button.on { width: 22px; background: var(--h-ball); }
.mp-cta { width: 100%; border: 0; font-family: inherit; }
.mp-note {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.65);
  font-size: 12px;
  text-align: center;
}

/* 發球機訓練：圖文（深底） */
.split { background: var(--h-navy); color: #fff; }
.split .h-kicker { color: var(--h-ball); text-align: left; }
.split .h-title { margin: 0 0 16px; color: #fff; text-align: left; }
.split-inner {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 48px;
  align-items: center;
}
.split-img {
  position: relative;
  margin: 0;
  border-radius: 22px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: radial-gradient(90% 80% at 30% 20%, #17335c 0%, #0a1626 70%);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
}
.split-img svg { display: block; width: 100%; height: 100%; }
.split-text p { color: rgba(255, 255, 255, 0.82); line-height: 1.8; }
.ticks { display: grid; gap: 10px; margin: 18px 0 26px; padding: 0; list-style: none; }
.ticks li { position: relative; padding-left: 30px; }
.ticks li::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--h-ball);
}
.ticks li::after {
  content: '';
  position: absolute;
  top: 8px;
  left: 6px;
  width: 5px;
  height: 9px;
  border: solid var(--h-navy);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

/* 最新優惠（8 張卡）＋ 充值 banner */
.offers { background: linear-gradient(180deg, rgba(212, 245, 60, 0.14), rgba(212, 245, 60, 0) 70%); }
.offer-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.offer {
  position: relative;
  padding: 24px 22px 20px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.offer::before {
  content: '';
  position: absolute;
  top: -36px;
  right: -36px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: var(--h-ball);
  opacity: 0.22;
}
.offer-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 12px;
  background: var(--h-navy);
  color: var(--h-ball);
  font-size: 22px;
  font-weight: 800;
}
.offer h3 { margin: 16px 0 6px; font-size: 18px; }
.offer p { margin: 0 0 14px; color: var(--h-muted); line-height: 1.6; }
.offer-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.offer-tags span {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 600;
}
.offer-tags span.member { background: var(--tag-member-bg); color: var(--tag-member-fg); }

.topup-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 26px;
  padding: 20px 24px;
  border-radius: 18px;
  background: var(--h-navy);
  color: #fff;
}
.topup-strip b { display: block; margin-bottom: 4px; color: var(--h-ball); }
.topup-strip span { color: rgba(255, 255, 255, 0.85); }
/* /topup/ 未做好：整條 banner 唔做死連結，講明原因 */
.topup-strip .btn-hero[aria-disabled='true'] { opacity: 0.55; cursor: not-allowed; }

/* 相片帶（原型用相片；呢度用 CSS／SVG 場景，唔發網絡請求） */
.gallery-section { padding: 0; }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.gallery figure {
  position: relative;
  height: 320px;
  margin: 0;
  overflow: hidden;
  background: #0a1626;
}
.gallery figure svg { display: block; width: 100%; height: 100%; }

/* 收費 */
.price-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.price-card {
  padding: 26px 20px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}
.price-card h3 { margin: 0 0 4px; font-size: 20px; }
.price-big { margin: 14px 0 4px; color: var(--h-muted); }
.price-big span {
  margin-right: 6px;
  color: var(--h-text);
  font-size: 34px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.price-card .btn-hero { margin-top: 16px; }

/* 三步 */
.steps-section { background: var(--surface-2); }
.steps {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}
.steps li {
  padding: 26px 22px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
}
.steps b {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--h-ball);
  color: var(--h-ball-ink);
  font-size: 20px;
  font-weight: 800;
}
.steps h3 { margin: 14px 0 6px; }
.steps p { margin: 0; color: var(--h-muted); line-height: 1.7; }

/* 常見問題 */
.faq {
  margin-bottom: 10px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--muted); font-weight: 700; }
.faq[open] summary::after { content: '−'; }
.faq p { margin: 0 0 16px; color: var(--h-muted); line-height: 1.7; }

/* 最後呼籲 */
.cta-final { background: linear-gradient(135deg, var(--h-court), var(--h-navy)); color: #fff; }
.cta-final h2 { margin: 0 0 10px; font-size: clamp(28px, 4.5vw, 44px); }
.cta-final p { margin: 0 0 24px; color: rgba(255, 255, 255, 0.85); }
.contact {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 22px;
  margin-top: 28px;
}
.contact a,
.contact span {
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}
.contact a:hover { background: rgba(255, 255, 255, 0.2); }

.h-footer {
  padding: 22px 16px 32px;
  color: var(--h-muted);
  font-size: 13px;
  text-align: center;
}
.h-footer .credits { display: block; margin-top: 6px; font-size: 12px; opacity: 0.8; }

/* ---------- 10. Responsive ---------- */
@media (min-width: 900px) {
  /* 首頁 hero：文字左、會員專享輪播右（原型 360px 側欄） */
  .hero-inner { grid-template-columns: minmax(0, 1fr) 360px; gap: 40px; }
  /* 14 個日期唔再橫向 scroll（F1）：flex-wrap 之後任何闊度都唔會切半個 chip */
  .dates {
    flex-wrap: wrap;
    row-gap: 8px;
    overflow: visible;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
  }
  /* 16 格強制一行（F2，D-22 16 節）——只限 .court 內，唔影響其他地方嘅 .slots */
  .court .slots { grid-template-columns: repeat(16, minmax(0, 1fr)); }
}

@media (max-width: 800px) {
  .nav-links { flex-wrap: nowrap; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .nav-links::-webkit-scrollbar { display: none; }
  .hero-inner { gap: 28px; padding: 72px 18px 44px; }
  .h-section { padding: 56px 0; }
  .split-inner { grid-template-columns: 1fr; gap: 28px; }
  .gallery {
    grid-template-columns: repeat(3, 72%);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }
  .gallery figure { height: 240px; scroll-snap-align: start; }
  .mp-slide { min-height: 150px; }
}

@media (max-width: 600px) {
  .wrap { padding: 16px 16px 24px; }
  .hide-sm { display: none; }

  /* nav 兩行：品牌一行、連結第二行橫向 scroll（F3） */
  .topbar { gap: 8px; padding: 10px 16px; }
  .topbar .brand { flex: 1; }
  .nav-links {
    order: 3;
    flex: 0 0 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav-links::-webkit-scrollbar { display: none; }

  .feature {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 2px 14px;
    align-items: start;
    padding: 18px;
  }
  .feature .f-icon { grid-row: span 2; width: 48px; height: 48px; border-radius: 14px; }
  .feature .f-icon svg { width: 28px; height: 28px; }
  .feature h3 { margin: 2px 0 4px; font-size: 17px; }
  .feature-grid,
  .price-grid,
  .steps { gap: 12px; }
  .h-title { margin-bottom: 28px; }

  /* 優惠卡左右撥（80% 寬 snap，UI-SPEC §7） */
  .offer-grid {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 80%;
    margin: 0 -16px;
    padding: 0 16px 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 16px;
  }
  .offer { scroll-snap-align: start; }
  .topup-strip { padding: 18px; }
  .topup-strip .btn-hero { width: 100%; }

  .bar .inner { gap: 10px; }
  .bar .summary { flex: 1 1 100%; }
  .bar .totals { flex: 1; }
  .bar .btn.primary,
  .bar button.primary { flex: 1 1 100%; min-height: var(--tap); }

  .slot { font-size: 13px; }
  .slots { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
  .book-main { padding-bottom: 200px; }  /* 手機 bar 變兩行，預留更多 */

  .hero-sub br { display: none; }
  .hero-scene .trail { display: none; }

  .t-wrap { padding: 20px 14px 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ---------- 11. Print（入場票：印出嚟或者存 PDF 都讀得到） ---------- */
@media print {
  body.ticket-mode { background: #fff; }
  .ticket-view { min-height: 0; background: #fff; color: #111; }
  .t-theme-toggle,
  .skip-link { display: none !important; }
  .t-head, .entry-code, .t-label, .t-holder { color: #111; }
  .t-venue, .t-note, .t-info span:first-child { color: #555; }
  .qr-stage { width: 260px; }
  .qr-stage::before { display: none; }
  .qr-card { padding: 6px; border: 1px solid #ccc; }
  .t-info, .t-instr, .banner { background: #f4f4f4; color: #111; }
  .t-info div { border-bottom: 1px solid #ddd; }
  .banner.ok { color: #0d6b3c; }
}

/* ---------- 12. Member pages (FE-3) ----------------------- */
/* 畀模板包住唔想折行嘅值（例如截止時間 2026-11-14 07:00）用。 */
.nowrap { white-space: nowrap; }
/* 會員批：頂欄用戶、我的訂場、會員中心／錢包、充值。
   全部由上面嘅 token 砌出嚟，所以 light／dark 兩套自動跟；冇任何固定 px 闊度，
   390px 之下靠 flex-wrap 同單欄 grid 收窄，唔會出現橫向 scroll。 */

.nav-user .who {
  max-width: 150px;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-user .who:hover { color: var(--link-fg); }
.logout-form { margin: 0; }

.page-head { margin-bottom: 4px; }

/* --- KPI 卡（會員中心） --- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.stats .card { margin-bottom: 0; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { margin-top: 6px; font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .sub { margin-top: 6px; line-height: 1.5; }

/* --- 充值：餘額帶 + 三個方案 --- */
.balance-card { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.balance-card .value { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }
.balance-note { text-align: right; }

.grid { display: grid; gap: 14px; }
.tiers { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 16px; }
.tier {
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
  padding: 22px 18px;
  text-align: center;
}
.tier-popular { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.tier-flag {
  margin-bottom: 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.tier-bonus { margin: 6px 0 2px; font-size: 18px; font-weight: 700; }
.tier-bonus .num { font-size: 30px; font-variant-numeric: tabular-nums; }
.tier-percent { margin: 0 0 4px; }
/* T-732 / D-54：可選標題同說明。只有 CMS 有值時先會出現，
   所以舊 row（冇 title／description）嘅版面同高度完全冇變。 */
.tier-title { margin: 4px 0 2px; font-size: 15px; font-weight: 700; line-height: 1.3; }
.tier-desc { margin: 0 0 6px; line-height: 1.45; }
.tier-credit { margin: 0 0 16px; }
.tier-btn { width: 100%; }
/* 有標題／說明嘅卡會高過其他卡；貼底對齊令所有「立即充值」掣同一水平。
   四張卡內容一樣時（舊 row）冇多餘空間，auto margin 等於 0，版面照舊。 */
.tier form { margin-top: auto; }

/* --- 我的訂場：分段 tabs --- */
.seg { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 18px; }
.seg-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}
.seg-item:hover { color: var(--text); }
.seg-item:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.seg-item.on {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-ink);
  font-weight: 600;
}
.seg-count { font-size: 12px; font-variant-numeric: tabular-nums; opacity: 0.85; }

/* --- 訂單卡 --- */
.order { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 18px; }
.order-main { flex: 1 1 300px; min-width: 0; }
.order-main h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 17px; }
.order-main p { margin: 0 0 3px; }
.order-side {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  margin-left: auto;
}
.order-amount { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.order-amount.strike { text-decoration: line-through; }
.order-actions { justify-content: flex-end; }
.cancel-form { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.reason-select { width: auto; max-width: 150px; min-height: 32px; padding: 5px 8px; font-size: 13px; }
.order-blocked { max-width: 260px; margin: 0; text-align: right; }

/* --- 交易紀錄表 --- */
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
table th,
table td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table th { color: var(--muted); font-size: 12px; font-weight: 600; }
table tr:last-child td { border-bottom: 0; }
table .right { text-align: right; }
.amount-neg { color: var(--text); font-variant-numeric: tabular-nums; }
.ledger-desc .small { display: block; }

label.check { display: flex; align-items: center; gap: 8px; margin-top: 14px; color: var(--text); font-size: 14px; }
label.check input { width: auto; margin: 0; }

/* --- 手機（≤768px，brief §3 要求唔用橫向 scroll） --- */
@media (max-width: 768px) {
  .order { gap: 10px; }
  .order-side { align-items: stretch; width: 100%; margin-left: 0; }
  .order-amount { text-align: left; }
  .order-actions,
  .cancel-form { justify-content: flex-start; }
  .reason-select { flex: 1 1 150px; max-width: none; }
  .order-blocked { max-width: none; text-align: left; }

  /* 交易紀錄由表格變卡片（每行一張，data-label 做欄名） */
  .ledger,
  .ledger tbody,
  .ledger tr,
  .ledger td { display: block; width: 100%; }
  .ledger thead { display: none; }
  .ledger tr {
    margin-bottom: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
  }
  .ledger td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 0;
    border: 0;
    text-align: left;
  }
  .ledger td::before {
    flex: 0 0 auto;
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
  }
  .ledger .ledger-desc { flex-direction: column; align-items: flex-start; gap: 2px; }
  .ledger .right { text-align: left; }
  .balance-note { text-align: left; }
}
