/* ===========================
   FILE name : ai_model.css (FULL CLEAN)
   Goals:
   - Keep ALL original selectors/features
   - Remove duplicates / unify cascade
   - Fix &gt; -> >
   - Keep "FINAL PATCH" sticky/rank logic as the single source of truth
   =========================== */

/* ===========================
   THEME VARIABLES
   =========================== */
:root{
  --c-primary:#011d5d;                 /* main navy */
  --c-bg:#f3f4f5;                      /* layout background */
  --c-surface:#ffffff;                 /* cards/boxes */
  --c-border:#d6d9de;                  /* borders */
  --c-border-2:#c9ced6;
  --c-text:#0b0f14;
  --c-muted:#667085;
  --c-primary-soft: rgba(1,29,93,.08);
  --c-primary-soft-strong: rgba(1,29,93,.14);
  --c-primary-outline: rgba(1,29,93,.38);
  --shadow-sm: 0 2px 10px rgba(0,0,0,.06);
  --shadow-md: 0 10px 20px rgba(0,0,0,.06);
  --radius: 8px;
}
html { -webkit-text-size-adjust: 100%; }
/* ===========================
   Base Layout
   =========================== */
*{ box-sizing: border-box; }
html, body{
  margin:0;
  padding:0;
  overflow-x:hidden;
}
body{
  font-family: Arial, "Microsoft JhengHei", sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
}
h1,h2{ margin:0 0 10px; }
/* ===========================
   Updates list nice layout
   =========================== */
#updatesList .update-item{
  display:flex;
  align-items:flex-start;
  gap:10px;
  padding:8px 0;
  border-bottom: 1px dashed rgba(0,0,0,.08);
}
#updatesList .update-item:last-child{ border-bottom:0; }

#updatesList .update-text{
  flex:1 1 auto;
  min-width:0;
  line-height:1.45;
  font-size:14px;
}
#updatesList .update-time{
  flex:0 0 auto;
  white-space: nowrap;
}
/* ============================================================
   Horse final result coloring (X/Y matrix)
   ============================================================ */
.cell-pos{
  display:inline-block;
  padding:4px 8px;
  margin-bottom:4px;
  border-radius:6px;
  font-weight:700;
  line-height:1.2;
}
.cell-pos.pos-1{ background-color:#ff4d4f; color:#fff; }
.cell-pos.pos-2{ background-color:#fa8c16; color:#fff; }
.cell-pos.pos-3{ background-color:#1677ff; color:#fff; }
.cell-pos.pos-4{ background-color:#52c41a; color:#fff; }
/* ===========================
   Jockey x Race Matrix (CLEAN: keep one source)
   =========================== */
.matrix-scroll{
  width:100%;
  overflow:auto;
  -webkit-overflow-scrolling:touch;
  border-radius:12px;
}
.matrix-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  background:var(--c-surface);
  min-width:1200px; /* wide table, allow horizontal scroll */
}
.matrix-table th,
.matrix-table td{
  border:1px solid var(--c-border-2);
  padding:10px 10px;
  vertical-align:top;
  text-align:center;
  font-size:13px;
  white-space:nowrap;
}
.matrix-table th{
  background:#e9ecf1;
  color:var(--c-primary);
  font-weight:900;
  position:sticky;
  top:0;
  z-index:3;
}
.matrix-table tbody tr:nth-child(even) td{ background:#fafafa; }
.matrix-table .sticky-col-x{
  position:sticky;
  left:0;
  z-index:4;
  background:#fff;
  text-align:left;
  min-width:180px;
  box-shadow:6px 0 10px rgba(0,0,0,.08);
}
.matrix-table tbody tr:nth-child(even) .sticky-col-x{ background:#fafafa; }
.matrix-table td.cell-hit{
  background:rgba(1,29,93,.04);
  font-weight:700;
}
.matrix-table td.cell-empty{ background:#fff; }
/* ===========================
   HERO / TOP IMAGE (index.php)
   =========================== */

.updates-more-wrap{
  margin-top:12px;
  display:flex;
  justify-content:center;
}

#updatesShowMoreBtn{
  min-width:120px;
}

.dash-kv.single{
  display:block;
}

.code-block {
  display: block;
  width: 100%;
  max-width: 100%;

  white-space: pre-wrap;   /* ✅ 核心 */
  word-break: break-word;
  overflow-wrap: break-word;

  overflow-x: auto;

  padding: 14px;

  color: #111;
  border-radius: 8px;

  font-size: 13px;
  line-height: 1.6;
}

.hero{
  position:relative;
  margin: 0 0 24px 0;
  overflow:hidden;
  background:#000;
}
.hero-media{
  position:relative;
  width:100%;
  height:min(48vh, 520px);
}
.hero-media img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
  filter:contrast(1.05) saturate(1.05);
}
.hero-media::after{
  content:"";
  position:absolute;
  inset:0;
  background:linear-gradient(
    180deg,
    rgba(0,0,0,.15) 0%,
    rgba(0,0,0,.35) 60%,
    rgba(0,0,0,.55) 100%
  );
}
.hero-overlay{
  position:absolute;
  inset:0;
  display:flex;
  align-items:flex-end;
}
.hero-content{
  max-width:1400px;
  width:100%;
  margin:0 auto;
  color:#fff;
}
.hero-title{
  margin:0;
  font-size:clamp(28px, 4vw, 44px);
  font-weight:1000;
  letter-spacing:1px;
  text-shadow:0 2px 10px rgba(0,0,0,.45);
}
.hero-sub{
  margin:8px 0 0;
  font-size:clamp(14px, 2vw, 18px);
  opacity:.92;
  max-width:720px;
  line-height:1.5;
}
.hero-actions{
  margin-top:16px;
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  align-items:center;
}
.hero-actions .badge{
  display:inline-flex !important;
  align-items:center;
  justify-content:center;
  height:24px;
  padding:0 12px;
  line-height:1;
  font-size:12px;
  font-weight:800;
  margin-left:0 !important;
}
.hero-actions .badge-blue{
  background:#e6f0ff !important;
  color:#003a8c !important;
  border-color:#b3c7ff !important;
}
/* ===========================
   Dashboard layout
   =========================== */
.dash-wrap{
  max-width:1400px;
  margin:0 auto;
  padding-left:20px;
  padding-right:20px;
}
.dash-span-12{ 
  grid-column:1 / -1 !important;
}
.dash-grid{
  display:grid;
  grid-template-columns:repeat(12, 1fr);
  gap:16px;
}
.dash-span-5{ grid-column: span 5; }
.dash-span-6{ grid-column: span 6; }
.dash-span-7{ grid-column: span 7; }
.dash-card{ padding:14px; }
.dash-card-head{
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom:10px;
}
.dash-card-title{
  display:flex;
  align-items:center;
  gap:8px;
  margin:0;
  font-size:18px;
  font-weight:900;
  color:var(--c-primary);
}
.dash-card-actions{
  margin-left:auto;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.dash-pills{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.dash-kv{
  margin-top:12px;
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:10px;
}
.dash-kv-item{
  padding:10px 10px;
  border:1px solid var(--c-border);
  border-radius:10px;
  background:rgba(1,29,93,.03);
}
.dash-big{
  display:flex;
  align-items:flex-end;
  gap:12px;
  margin-top:6px;
}
.dash-big-num{
  font-size:44px;
  font-weight:1000;
  letter-spacing:1px;
  color:var(--c-primary);
  line-height:1;
}
.dash-big-sub{
  padding-bottom:6px;
  font-size:13px;
}
.dash-list{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.dash-list-row{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 10px;
  border:1px solid var(--c-border);
  border-radius:10px;
  background:#fff;
}
.dash-updates{
  margin:8px 0 0 18px;
  padding:0;
  line-height:1.7;
}
#dealerPickLine .dp-h-ago{
  color: var(--c-muted);
  font-size: 12px;
  margin-left: 6px;
  white-space: nowrap;
}
#dealerPickLine .dp-h-row{
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
}
#dealerPickLine .dp-h-time{
  white-space: nowrap;
  flex: 0 0 auto;
  min-width: 140px;
}
#dealerPickLine .dp-h-text{
  white-space: nowrap;
  overflow-x: auto;
}
.box{
  background:var(--c-surface);
  border:1px solid var(--c-border);
  border-radius:var(--radius);
  padding:14px;
}
.modal-card {
  z-index: 100002 !important;
  position: relative;
}
.horse-nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  user-select: none;
  z-index: 20;
}
.horse-nav-left {
  left: 10px;
}
.horse-nav-right {
  right: 10px;
}
.horse-nav-arrow:hover {
  background: rgba(0,0,0,0.85);
}
#dealerPickLine.dealer-pick-split .dp-grid{
  display:flex;
  align-items:flex-start;
  gap:16px;
}
#dealerPickLine.dealer-pick-split .dp-left{
  flex: 0 0 46%;
  min-width: 0;
}
#dealerPickLine.dealer-pick-split .dp-right{
  flex: 1 1 auto;
  min-width: 0;
  border-left: 1px solid rgba(0,0,0,.08);
  padding-left: 14px;
}
#dealerPickLine.dealer-pick-split .dp-h-title{
  margin-bottom: 6px;
}
#dealerPickLine.dealer-pick-split .dp-h-row{
  display:flex;
  gap:10px;
  line-height:1.6;
  font-size:13px;
}
#dealerPickLine.dealer-pick-split .dp-h-time{
  flex: 0 0 auto;
  width: 48px;
  font-variant-numeric: tabular-nums;
  color: var(--c-muted);
}
#dealerPickLine.dealer-pick-split .dp-h-text{
  flex: 1 1 auto;
  min-width: 0;
}
.roi-loading {
  display:inline-block;
  width:14px;
  height:14px;
  border:2px solid rgba(0,0,0,0.15);
  border-top:2px solid #888;
  border-radius:50%;
  animation: roi-spin 0.8s linear infinite;
}
@keyframes roi-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.roi-table td, .roi-table th {
    padding: 4px 6px;
    text-align: center;
	font-size: 13px;
}
.roi-table th:first-child,
.roi-table td:first-child {
  text-align: left;
  width: 110px;
}
.roi-lockable {
  position: relative;
}
.roi-lockable.locked td:not(:first-child) {
  filter: blur(4px);
}
.roi-lockable.locked::after {
  content: "ROI 回報組合未準備好，賽事前一天14:00提供。";
  position: absolute;
  top: 0;
  left: 110px;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(4px);
  font-size: 14px;
  font-weight: bold;
  color: #333;
  text-align: center;
  padding: 10px;
  z-index: 10;
}
.dp-h-text {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.6;
}
.dp-h-time {
  font-size: 15px;
  color: #999;
}
.dp-h-more{
  margin-top: 8px;
  text-align: center;
  padding: 10px 8px;
  font-weight: 700;
  color: #1976d2;
  cursor: pointer;
  user-select: none;
}
.hn-circle-normal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  color: #000;
  font-weight: 700;
  font-size: 12px;
  border: 1px solid #ccc;
  margin: 0 2px;
  line-height: 1;
}
.hn-circle.shift {
  background: #e6f4ff;
  border: 1px solid #1677ff;
  color: #1677ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 12px;
  margin: 0 2px;
  line-height: 1;
}
.hn-circle-hot {
  background: #fff7cc;
  border: 1px solid #f5c542;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #000;
  font-weight: 700;
  font-size: 12px;
  margin: 0 2px;
  line-height: 1;
}
.hn-circle-warn {
  background: #ffe6e6;
  border: 1px solid #ff4d4f;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #000;
  font-weight: 700;
  font-size: 12px;
  margin: 0 2px;
  line-height: 1;
}
.dp-compare-box {
  margin-top: 8px;
  background: #f5f5f5;
  padding: 6px 10px;
  border-radius: 8px;
  line-height: 1.6;
}
.hn-circle-r1 {
  background:#e53935;
  color:#fff;
  border:1px solid #fecaca;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 12px;
  margin: 0 2px;
  line-height: 1;
}
.hn-circle-r2 {
  background:#fb8c00;
  color:#fff;
  border:1px solid #fdba74;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 12px;
  margin: 0 2px;
  line-height: 1;
}
.hn-circle-r3 {
  background:#1e88e5;
  color:#fff;
  border:1px solid #93c5fd;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 12px;
  margin: 0 2px;
  line-height: 1;
}
.hn-circle-r4 {
  background:#43a047;
  color:#fff;
  border:1px solid #86efac;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 12px;
  margin: 0 2px;
  line-height: 1;
}
.dp-h-time-last {
  font-weight: 700;
}
/* Mobile: stack */
@media (max-width:1000px){
  #dealerPickLine.dealer-pick-split .dp-grid{
    flex-direction:column;
  }
  #dealerPickLine.dealer-pick-split .dp-right{
    border-left:0;
    padding-left:0;
    border-top: 1px solid rgba(0,0,0,.08);
    padding-top: 10px;
  }
}
.dots::after {
  content: '...';
  display: inline-block;
  animation: dots 1.2s infinite steps(3);
}
@keyframes dots {
  0% { content: ''; }
  33% { content: '.'; }
  66% { content: '..'; }
  100% { content: '...'; }
}
.muted{ color:var(--c-muted); }
.small-muted{ color:var(--c-muted); font-size:12px; }
.winrate-level {
  display:inline-flex;
 align-items: center;
  gap:4px;
  margin-left:6px;
  font-size:12px;
  line-height: 1;
  vertical-align: middle;
}
.winrate-dot {
  width:8px;
  height:8px;
  border-radius:50%;
  display:inline-block;
}
.winrate-high .winrate-dot {
  background:#16a34a; /* 綠 */
}
.winrate-mid .winrate-dot {
  background:#f59e0b; /* 黃 */
}
.winrate-low .winrate-dot {
  background:#9ca3af; /* 灰 */
}
.winrate-text {
  font-weight:600;
}
/* =========================================
   badge-style select (match badge badge-blue)
   ========================================= */
.badge-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: var(--badge-blue-bg, #1e90ff);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 6px 32px 6px 14px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  position: relative;
  background-image:
    linear-gradient(45deg, transparent 50%, white 50%),
    linear-gradient(135deg, white 50%, transparent 50%);
  background-position:
    calc(100% - 16px) 50%,
    calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.badge-select:hover {
  filter: brightness(1.05);
}
.badge-select:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(30,144,255,0.35);
}
.badge-select option {
  color: #111;
}
/* 新馬 badge */
.badge-new{
  background:#eef2ff;
  color:#3730a3;
  border-color:#c7d2fe;
}
.name-cn{
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
}
.name-cn .name-mid{
  justify-self: center;
  text-align: center;
  white-space: nowrap;
}
.name-cn .badge-new{
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
}
.badge{
  display:inline-block;
  padding:2px 6px;
  border-radius:999px;
  font-size:11px;
  margin-left:3px;
  border:1px solid rgba(0,0,0,.15);
}
.badge-blue{
  background:#e6f0ff;
  color:#003a8c;
  border-color:#b3c7ff;
}
.badge-shield{
  background:#e7fff2;
  color:#0b6b3a;
  border-color:#9ae6c1;
}
.badge.badge-gray{
  background:#eee;
  color:#666;
  border:1px solid #ddd;
}
.dash-card-actions .badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  height:22px;
  padding:0 10px;
  line-height:1;
  font-size:12px;
  font-weight:800;
  margin-left:0;
}
.dash-card-actions .badge-blue{
  background:#e6f0ff !important;
  color:#003a8c !important;
  border-color:#b3c7ff !important;
}
.topk-hint{
  display:inline-block;
  margin-left:10px;
  padding:2px 8px;
  border-radius:999px;
  font-size:12px;
  background:rgba(255,255,255,0.12);
  color:#fff;
  border:1px solid rgba(255,255,255,0.2);
  vertical-align:middle;
}
.th-sub{
  font-size:11px;
  color:#888;
  font-weight:400;
}
.th-sub12{
  font-size:12px;
  color:#888;
  font-weight:400;
}
.jk-plus {
  color: #2563eb;
  font-weight: 700;
  margin-left: 2px;
}
.page-container{
  padding-left:20px;
  padding-right:20px;
}
/* ===========================
   馬號欄：置中顯示「馬號 + 升跌箭嘴」
   =========================== */
table.race-table td.sticky-col-1{ text-align:center; }
.horse-num-center{
  display:inline-flex;
  justify-content:center;
  width:100%;
}
.horse-num-wrap{
  position:relative;
  width:2.5ch;
  text-align:center;
}
.horse-num{
  display:inline-block;
  width:100%;
  text-align:center;
  font-weight:inherit;
}
.rank-delta{
  position:absolute;
  left:100%;
  margin-left:4px;
  top:50%;
  transform:translateY(-50%);
  display:inline-flex;
  align-items:center;
  font-weight:700;
}
.rank-delta.rank-none::after{
  content:"";
}
.rank-delta-text{
  font-size:11px;
  font-weight:700;
  line-height:1;
  opacity:.85;
}
.rank-up{ color:#ff3b30; }
.rank-down{ color:#9aa0a6; }
.horse-num.up::after{
  content:" ▲";
  color:#ff3b30;
  font-weight:900;
}
.horse-num.down::after{
  content:" ▼";
  color:#9aa0a6;
  font-weight:900;
}
.horse-num.up::after{
  content:" ▲";
  color:#ff3b30;
  font-weight:900;
}
.horse-num.down::after{
  content:" ▼";
  color:#9aa0a6;
  font-weight:900;
}
.rank-dot{ display:none !important; }
.rank-delta.rank-up::after{
  content:"▲";
  color:#ff3b30;
  font-weight:900;
  font-size:11px;
}
.rank-delta.rank-down::after{
  content:"▼";
  color:#9aa0a6;
  font-weight:900;
  font-size:11px;
}
@keyframes rankPulse{
  0%   { transform: scale(0.85); box-shadow: 0 0 0 0 currentColor; opacity: .6;}
  60%  {transform: scale(1.05); box-shadow: 0 0 0 5px rgba(0,0,0,0); opacity: 1;}
  100% { transform: scale(0.85); box-shadow: 0 0 0 0 rgba(0,0,0,0); opacity: .6; }
}
.stable-left{
  position:absolute;
  right:100%;
  margin-right:3px;
  top:50%;
  transform:translateY(-50%);
  margin-left:0 !important;
  white-space:nowrap;
  font-size:10px;
  padding:1px 3px;
}
.suspended-left{
  position:absolute;
  right:100%;
  margin-right:3px;
  top:50%;
  transform:translateY(-50%);
  white-space:nowrap;
  background:#c62828;
  color:#ffffff;
  font-size:10px;
  padding:1px 4px;
  border-radius:4px;
  font-weight:700;
  z-index:5;
}
.suspended-left.badge-gray{
  background-color: #c62828;
  color: #ffffff;
}
.ai-kw {
  background: #fff2a8;
  font-weight: 700;
  padding: 0 2px;
  border-radius: 3px;
}
/* ===========================
   Table header row + switch
   =========================== */
.table-header-row{
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom:6px;
}
.table-title{
  display:flex;
  align-items:center;
  gap:10px;
  margin:0;
}
.table-header-row .col-switch{ margin-left:auto; }

.col-switch{
  display:flex;
  gap:8px;
  margin:6px 0 10px;
  flex-wrap:wrap;
}
.col-switch .pill.small-pill.active{
  background:#1f6feb;
  border-color:#1f6feb;
  color:#fff;
}
/* MI: text + border only */
table.race-table td.mi-cell { text-align:center; font-weight:900; }

.mi-tag{
  display:inline-block;
  padding:1px 6px;
  line-height:1.1;
  border:1px solid currentColor;  /* 邊框跟字色 */
  border-radius:4px;              /* 想方角就改 0 */
  background:transparent;
}

.mi-tag.mi-a{ color:#16a34a !important; }
.mi-tag.mi-b{ color:#6b7280 !important; }
.mi-tag.mi-c{ color:#dc2626 !important; }
.race-table.mode-ai th.col-ai-history,
.race-table.mode-ai td.ai-history{ display:none; }
.race-table.mode-hist th.col-ai-summary,
.race-table.mode-hist td.ai-summary{ display:none; }
table.race-table.hide-ai-summary th.col-ai-summary,
table.race-table.hide-ai-summary td.ai-summary{ display:none !important; }
table.race-table.hide-ai-history th.col-ai-history,
table.race-table.hide-ai-history td.ai-history{ display:none !important; }
/* ===========================
   ✅ AI 精選 column
   =========================== */
.picks-actions{
  margin:6px 0 14px;
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}
th.col-ai-pick,
td.ai-pick-cell{
  text-align:center;
  vertical-align:middle;
}
td.ai-pick-cell{
  padding-left:6px;
  padding-right:6px;
}
/* ===========================
   AI 精選 — dot with mark (green/yellow/grey)
   =========================== */
td.ai-pick-cell{
  text-align:center;
  vertical-align:middle;
}
.pick-dot{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:16px;
  height:16px;
  border-radius:999px;
  vertical-align:middle;
  box-shadow:0 0 0 1px rgba(0,0,0,.14) inset;
  line-height:1;
}
.pick-mark{
  font-size:11px;
  font-weight:900;
  color:#fff;
  transform:translateY(-0.5px);
  user-select:none;
}
.pick-green{ background:#16a34a; }   /* 綠 */
.pick-yellow{ background:#f59e0b; }  /* 黃 */
.pick-gray{ background:#9ca3af; }    /* 灰 */
.pick-blue { background:#3f7cff; color:#fff; }
.pick-wrap { display:inline-flex; align-items:center; gap:6px; }
.pick-xx { display:inline-block; min-width:3ch; text-align:right; }
.pick-pending { opacity: .55; }
.pick-dot.pick-gray { background:#e5e7eb; } /* if you already have, keep it */
.mark-blue { color: #3f7cff; }      /* only for 未達顯示條件 mark */
.pick-gray .pick-mark.mark-blue{ color:#3f7cff; }
.pick-gray .pick-mark.mark-blue{
  color:#3f7cff;
  opacity:1;
}
/* nav marquee chips */
.nav-chip{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width: 22px;
  height: 22px;
  padding: 0 8px;
  margin: 0 4px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #d1d5db; /* grey border */
  color: #111827;
  font-weight: 800;
  font-size: 13px;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}

/* “冷” label chip */
.nav-chip.nav-chip-cold{
  background:#f3f4f6;
  border-color:#cbd5e1;
  color:#374151;
  font-weight: 900;
}
/* 冷：純文字 label（無 block、無 border） */
.nav-cold-label{
  margin: 0 6px;
  color:#6b7280;
  font-weight:900;
  font-size:13px;
  line-height:1;
}

/* 拖>：純文字 label（無 block、無 border） */
.nav-drag-label{
  margin: 0 6px;
  color:#374151;
  font-weight:900;
  font-size:13px;
  line-height:1;
}

/* 場次分隔符：純文字 */
.nav-marquee-sep{
  margin: 0 10px;
  color:#9ca3af;
  font-weight:900;
}
.nav-bottom-yellow{
  position: relative;
  z-index: 9999;
  height: 30px;
  background:#ffe066;
  color:#111;
  display:flex;
  align-items:center;
  overflow:hidden;
  padding:6px 15px;
  font-size:14px;

  /* ✅ ADD THIS: bottom shadow/border */
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.25), 0 6px 12px rgba(0,0,0,.12);
}

/* =========================
   AI 精選 change signal (blink border like odds signal)
   ========================= */
@keyframes aiPickSignalPulse{
  0%   { box-shadow: 0 0 0 0 rgba(59,130,246,.00); }
  25%  { box-shadow: 0 0 0 3px rgba(59,130,246,.22); }
  55%  { box-shadow: 0 0 0 6px rgba(59,130,246,.38); }
  100% { box-shadow: 0 0 0 0 rgba(59,130,246,.00); }
}
.pick-wrap.pick-signal{
  animation: aiPickSignalPulse 1.4s ease-in-out 1;
  border-radius: 999px;
}
.pick-wrap.pick-signal .pick-dot{
  outline: 2px solid rgba(59,130,246,.65);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(59,130,246,.20);
}
/* ===========================
   Suspended runner
   =========================== */
.race-table tr.is-suspended td{
  background-color:#f3f4f5 !important;
  color:#777 !important;
}
tr.is-suspended .suspended-left{
  opacity:1 !important;
  filter:none !important;
}
tr.is-suspended td{ color:#666 !important; }
/* ===========================
   AI hit box
   =========================== */
.ai-hit-box{
  background:#f6fbff;
  border-left:4px solid #2b7cff;
}
.ai-hit-box ul li{ margin:4px 0; }
#openOddsSignalsBtn.has-top-signals{
  border: 2px solid #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59,130,246,.22);
}
#openOddsSignalsBtn.has-top-signals.pulse{
  animation: topSignalPulse 1.2s ease-in-out infinite;
}
@keyframes topSignalPulse{
  0%   { box-shadow: 0 0 0 3px rgba(59,130,246,.22); }
  50%  { box-shadow: 0 0 0 6px rgba(59,130,246,.38); }
  100% { box-shadow: 0 0 0 3px rgba(59,130,246,.22); }
}
#oddsSignalsModal .modal-card{
  width: min(1200px, calc(100vw - 24px));
  max-height: min(85vh, 920px);
  overflow: hidden;
}
#oddsSignalsModal .modal-body{
  padding: 0 !important;
  overflow: hidden;
}
#oddsSignalsFrame{
  width: 100%;
  height: 75vh;
  max-height: 820px;
  border: 0;
  display: block;
}
/* ===========================
   Rank Chart Modal (Ghost Bar)
   =========================== */
.rank-chart-wrap{ 
  margin-top:12px;
}
.rank-chart-row{
  font-size:14px;
  display:grid;
  grid-template-columns:160px 1fr 84px;
  padding:10px 0;
  gap:10px;
  align-items:center;
}
.rank-chart-left{
  display:flex;
  align-items:center;
  gap:6px;
  min-width:0;
  max-width:260px;
  white-space:nowrap;
  font-variant-numeric:tabular-nums;
}
.rank-chart-left .rk{
  flex:0 0 42px;
  font-weight:700;
  max-width:30px;
}
.rank-chart-left .hn{
  flex:0 0 auto;
}
/* Horse number circle badge */
.rank-chart-left .hn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:26px;
  height:26px;
  border-radius:999px;
  font-weight:900;
  font-variant-numeric:tabular-nums;
  line-height:1;
  background:#eef2f7;
  color:#0b0f14;
  border:1px solid rgba(0,0,0,.18);
  box-shadow:0 1px 2px rgba(0,0,0,.12);
}
.rank-chart-left .hn.pf-1{ background:#e53935; border-color:#b71c1c; color:#fff; }
.rank-chart-left .hn.pf-2{ background:#fb8c00; border-color:#ef6c00; color:#fff; }
.rank-chart-left .hn.pf-3{ background:#1e88e5; border-color:#1565c0; color:#fff; }
.rank-chart-left .hn.pf-4{ background:#43a047; border-color:#2e7d32; color:#fff; }
.rank-chart-left .hname{
  flex:1 1 auto;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  opacity:.95;
}
.rank-chart-bar{
  position:relative;
  height:14px;
  border-radius:999px;
  background:rgba(255,255,255,0.08);
  overflow:hidden;
}
.rank-bar-ghost{
  position:absolute;
  left:0; top:0; bottom:0;
  width:0%;
  background:rgba(255,255,255,0.22);
}
.rank-bar-current{
  position:absolute;
  left:0; top:0; bottom:0;
  width:0%;
  background:linear-gradient(90deg, rgba(0,170,255,0.95), rgba(120,92,255,0.95));
  box-shadow:0 0 0 1px rgba(255,255,255,0.08) inset;
  transition:width 380ms ease;
}
.rank-chart-row.is-suspended .rank-bar-current{ background:#9aa0a6 !important; opacity:0.9; }
.rank-chart-row.is-suspended .rank-bar-ghost{ background:#c9ccd1 !important; opacity:0.55; }
.rank-chart-row.is-suspended .rank-chart-left,
.rank-chart-row.is-suspended .rank-chart-right{ opacity:0.75; }

.rank-chart-right{
  text-align:right;
  font-variant-numeric:tabular-nums;
  white-space:nowrap;
}
.rank-delta-badge{
  display:inline-flex;
  align-items:center;
  gap:4px;
  padding:2px 8px;
  border-radius:999px;
  font-size:12px;
  background:rgba(255,255,255,0.08);
}
.rank-delta-badge.up{
  color:#ff0707;
  border:1px solid rgba(62,224,143,0.35);
}
.rank-delta-badge.down{
  color:#b8b8b8;
  border:1px solid rgba(184,184,184,0.28);
}
.rank-delta-badge.none{ opacity:.55; }

.rank-chart-explain{
  margin-top:14px;
  font-size:13px;
  line-height:1.55;
  color:var(--c-text);
}
.rank-chart-explain ul{ margin:8px 0 8px 18px; padding:0; }
.rank-chart-explain li{ margin:4px 0; }
.rank-chart-explain .small-muted{
  margin-top:8px;
  opacity:.75;
  color:var(--c-muted);
}
/* Stable marker (only 1 stable) */
.rank-chart-row.is-stable{ position:relative; }
.rank-chart-row.is-stable::before{
  content:"🛡 穩定範圍線";
  position:absolute;
  left:6px;
  bottom:-9px;
  font-size:11px;
  font-weight:800;
  letter-spacing:.3px;
  padding:2px 8px;
  border-radius:999px;
  background:rgba(0, 160, 120, 0.18);
  border:1px solid rgba(0, 160, 120, 0.55);
  color:#0b6b3a;
  box-shadow:0 1px 2px rgba(0,0,0,.15);
}
.rank-chart-row.is-stable::after{
  content:"";
  position:absolute;
  left:0; right:0;
  bottom:-2px;
  height:1px;
  background:rgba(80,180,255,0.35);
}
/* Jump highlight effect */
@keyframes jumpGlow{
  0%   { background: rgba(80,180,255,0.00); box-shadow: 0 0 0 rgba(0,0,0,0); }
  20%  { background: rgba(80,180,255,0.12); box-shadow: 0 0 0 2px rgba(80,180,255,0.22) inset; }
  100% { background: rgba(80,180,255,0.00); box-shadow: 0 0 0 rgba(0,0,0,0); }
}
#horsesTbody tr.jump-highlight{ animation: jumpGlow 1.2s ease; }
.rank-chart-row.jump-highlight-chart{ animation: jumpGlow 0.9s ease; }
/* ===========================
   Login page centering
   =========================== */
body.login-page{
  min-height:100vh;
  display:block;
}
body.login-page #loginBox{
  max-width:520px;
  width:100%;
  margin-left:auto;
  margin-right:auto;
  position:relative;
  top:calc(50vh - 90px);
  transform:translateY(-50%);
}
/* ===========================
   Form inputs – SAIMA style
   =========================== */
@supports (-webkit-touch-callout: none){
  input, textarea, select, button, [contenteditable]{
    font-size:16px !important;
  }
}
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"]{
  width:100%;
  padding:10px 12px;
  font-size:14px;
  font-family:inherit;
  color:var(--c-text);
  background:#fff;
  border:1px solid var(--c-border-2);
  border-radius:10px;
  outline:none;
  transition:border-color .12s ease, box-shadow .12s ease;
}
#loginBox label{
  display:inline-block;
  margin-bottom:6px;
  font-weight:800;
  color:var(--c-primary);
}
#loginBox .powered-btn{ margin-right:8px; }

input:focus{
  border-color:var(--c-primary);
  box-shadow:0 0 0 4px rgba(1,29,93,.14);
}
input:disabled{ background:#f3f4f5; color:#999; }
input::placeholder{ color:#999; }

/* compensate sticky nav height */
@supports (position: sticky){
  body.login-page #loginBox{ margin-top:60px; }
}
/* error */
.error-box{
  padding:14px 16px;
  border-radius:8px;
  background:#fff3cd;
  border:1px solid #ffeeba;
  color:#856404;
}
.error-title{
  font-weight:700;
  font-size:15px;
  margin-bottom:6px;
}
.error-msg{ font-size:14px; }
.error-hint{
  margin-top:6px;
  font-size:13px;
  color:#6c757d;
}
.error-retry{
  margin-top:8px;
  font-size:13px;
  font-style:italic;
  color:#555;
}
/* ===========================
   Sorting UI
   =========================== */
.race-table thead th[aria-sort="ascending"],
.race-table thead th[aria-sort="descending"]{
  background:#eef6ff;
  color:#0b3d91;
}
.race-table thead th[data-sort]{
  cursor:pointer;
  user-select:none;
  white-space:nowrap;
}
.race-table thead th[data-sort]::after{
  content:" ↕";
  font-size:12px;
  opacity:.35;
}
.race-table thead th[data-sort][aria-sort="ascending"]::after{
  content:" ▲";
  opacity:1;
}
.race-table thead th[data-sort][aria-sort="descending"]::after{
  content:" ▼";
  opacity:1;
}
.race-table td.sorted-cell{
  background-image: linear-gradient(rgba(43,124,255,.14), rgba(43,124,255,.14)) !important;
  background-color: transparent !important;
}
/* ✅ FORCE restore result 1–4 background when sorted */
table.race-table td.sorted-cell.result-1{ background-color:#e53935 !important; background-image:none !important; }
table.race-table td.sorted-cell.result-2{ background-color:#fb8c00 !important; background-image:none !important; }
table.race-table td.sorted-cell.result-3{ background-color:#1e88e5 !important; background-image:none !important; }
table.race-table td.sorted-cell.result-4{ background-color:#43a047 !important; background-image:none !important; }
/* ===========================
   Column widths (UPDATED after removing 膽/腳)
   =========================== */
/* 3 檔位 */
table.race-table th:nth-child(3),
table.race-table td:nth-child(3){
  width:60px; min-width:60px; max-width:60px;
}
/* 4 練馬師 */
table.race-table th:nth-child(4),
table.race-table td:nth-child(4){
  width:80px; min-width:80px; max-width:80px;
}
/* 5 騎師 */
table.race-table th:nth-child(5),
table.race-table td:nth-child(5){
  width:100px; min-width:100px; max-width:100px;
}
/* 6 HKJC Mark */
table.race-table th:nth-child(6),
table.race-table td:nth-child(6){
  width:70px; min-width:70px; max-width:70px;
}
/* 7 獨贏(即時) */
table.race-table th:nth-child(7),
table.race-table td:nth-child(7){
  width:100px; min-width:100px; max-width:100px;
}
/* 8 位置(即時) */
table.race-table th:nth-child(8),
table.race-table td:nth-child(8){
  width:100px; min-width:100px; max-width:100px;
}
/* 9 值博獨贏 */
table.race-table th:nth-child(9),
table.race-table td:nth-child(9){
  width:80px; min-width:80px; max-width:80px;
}
/* 10 值博位置 */
table.race-table th:nth-child(10),
table.race-table td:nth-child(10){
  width:80px; min-width:80px; max-width:80px;
}
/* 11 勝出率 */
table.race-table th:nth-child(11),
table.race-table td:nth-child(11){
  width:110px; min-width:110px; max-width:110px;
}
/* 12 入位率 */
table.race-table th:nth-child(12),
table.race-table td:nth-child(12){
  width:90px; min-width:90px; max-width:90px;
}
/* 13 即時風險 */
table.race-table th:nth-child(13),
table.race-table td:nth-child(13){
  width:370px; min-width:370px; max-width:370px;
}

/* 14 預測 */
table.race-table th:nth-child(14),
table.race-table td:nth-child(14){
  width:160px; min-width:160px; max-width:160px;
  text-align:center;
}

/* 15 盤口偏差 */
table.race-table th:nth-child(15),
table.race-table td:nth-child(15){
  width:100px; min-width:100px; max-width:100px;
  text-align:center;
}

/* 16 AI 分數預測 (pred_score) */
table.race-table th:nth-child(16),
table.race-table td:nth-child(16){
  width:120px; min-width:120px; max-width:120px;
}

/* 17 同場相對 (field_rel) */
table.race-table th:nth-child(17),
table.race-table td:nth-child(17){
  width:120px; min-width:120px; max-width:120px;
}

/* 18 AI 精選 */
table.race-table th:nth-child(18),
table.race-table td:nth-child(18){
  width:90px; min-width:90px; max-width:90px;
  text-align:center;
}

/* 19 AI 重點分析 */
table.race-table th:nth-child(19),
table.race-table td:nth-child(19){
  width:580px; min-width:580px; max-width:580px;
  text-align:left;
}

/* 20 賽前歷史穩定度分析 */
table.race-table th:nth-child(20),
table.race-table td:nth-child(20){
  width:350px; min-width:350px; max-width:350px;
  text-align:left;
}

/* 21 賽果 */
table.race-table th:nth-child(21),
table.race-table td:nth-child(21){
  width:70px; min-width:70px; max-width:70px;
}
/* 同時放寬 max-width（保留你原本意圖） */
.ai-summary{ max-width:520px; } /* will be overridden later by final unified ellipsis */
/* risk text */
td .val-pos{ color:#0a8f3c; font-weight:700; }
td .val-neg{ color:#888; }
td .risk{ color:#d33; font-weight:600; }
.risk-badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:2px 8px;
  border-radius:999px;
  border:1px solid rgba(0,0,0,.12);
  background:#f7f8fa;
  color:#1b2a4a;
  font-weight:700;
  font-size:12px;
  cursor:help;
  white-space:nowrap;
}
td.risk-cell{
  text-align:left;
  max-width:320px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
/* ===========================
   Odds DROP — FINAL (穩 block 同款)
   =========================== */
/* ===========================
✅ 賠率大異動 — 紅色閃爍框
=========================== */
@keyframes oddsSpikeBorderBlink {
  0%   { box-shadow: 0 0 0 0 rgba(220,38,38,0); }
  30%  { box-shadow: 0 0 0 3px rgba(220,38,38,0.6); }
  60%  { box-shadow: 0 0 0 6px rgba(220,38,38,0.35); }
  100% { box-shadow: 0 0 0 0 rgba(220,38,38,0); }
}
.pre-pick-badge{
  display:inline-block;
  margin-left:6px;
  padding:2px 6px;
  border-radius:4px;
  font-size:11px;
  font-weight:600;
  background:#2563eb; /* 藍底 */
  color:#ffffff;      /* 白字 */
  white-space:nowrap;
  vertical-align:middle;
}
.odds-wrap.is-odds-spike {
  animation: oddsSpikeBorderBlink 1.2s ease-in-out infinite;
  border-radius: 6px;
}
/* 父層：預留 icon 位 */
.odds-wrap{
  position: relative;
  display: inline-block;
}

/* icon 永遠固定 */
.odds-wrap .odds-icon{
  position: absolute;
  top: 50%;
  left: -16px;                  /* ✅ 普通情況 */
  width: 16px;
  text-align: center;
  transform: translateY(-50%);
  pointer-events: none;
}

/* ▼ 本體 */
.odds-wrap .odds-icon::before{
  display: inline-block;
  width: 100%;
  text-align: center;
}
/* ✅ 關鍵：鎖死 odds 數字顯示寬度 */

.num-dot, .num-sign, .num-char {
  display: inline-block;
  vertical-align: baseline;
  line-height: 1;
}

.num-dot{
  display:inline-block;
  width:0.4em;
  text-align:center;
  flex:0 0 auto;
}

.odds-wrap .num-odometer{
  display: inline-flex;
  justify-content: center;
  min-width: 6ch;
  width: auto;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.odds-wrap.is-late-drop-win .odds-icon::before{
  content: '▼';
  color: #dc2626;
  animation: lateDropBlink 1s infinite;
  opacity: 1;
}

.odds-wrap.is-late-drop-place .odds-icon::before{
  content: '▼';
  color: #16a34a;
  animation: lateDropBlink 1s infinite;
  opacity: 1;
}

@keyframes lateDropBlink {
  0%   { opacity: 1; }
  50%  { opacity: 0.25; }
  100% { opacity: 1; }
}
/* ===========================
   Odds dim + status
   =========================== */
.race-table td.vb-odds{ color:#1f6feb; font-weight:600; }
.vb-odds.odds-capped{
  opacity:0.45;
  background-color:#f6f6f6;
  font-style:italic;
  color:#666;
}
.vb-odds.odds-capped:hover{ opacity:0.7; }

.vb-odds .odds-lock{
  margin-left:4px;
  font-size:0.85em;
  opacity:0.85;
  cursor:help;
}
.odds-status{
  margin:10px 0 12px;
  padding:10px 12px;
  border-radius:10px;
  background:#0b1220;
  border:1px solid rgba(255,255,255,.08);
  color:#cbd5e1;
  font-size:14px;
}
.odds-status b{ color:#fff; }
.odds-status .sub{ display:block; margin-top:4px; color:#94a3b8; font-size:13px; }
.odds-status.is-ok{ background:rgba(34,197,94,.08); border-color:rgba(34,197,94,.25); }
.odds-status.is-warn{
  background:#fff6e5;
  border:1px solid #f0b429;
  color:#8a4b00;
  font-weight:600;
}
.odds-status.is-warn b{ color:#7a3e00; font-weight:700; }
/* ===========================
   Race meta line
   =========================== */
.race-meta-line{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  margin:10px 0 14px;
  padding:10px 12px;
  background:var(--c-surface);
  border:1px solid var(--c-border);
  border-radius:10px;
  font-size:15px;
  line-height:1.6;
  color:var(--c-text);
}
.race-meta-line b{ font-weight:800; color:var(--c-primary); }
.race-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:20px;
  font-weight:900;
  letter-spacing:1px;
  padding:8px 16px;
  min-height:36px;
  border-radius:999px;
  line-height:1;
  background: linear-gradient(135deg, #011d5d, #0b3d91);
  color:#fff;
  border:1px solid rgba(255,255,255,.22);
  box-shadow:0 10px 22px rgba(1,29,93,.25);
  text-shadow:0 1px 2px rgba(0,0,0,.35);
}
.race-status{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:14px;
  font-weight:800;
  padding:6px 12px;
  line-height:1;
  border-radius:999px;
  font-family:inherit;
  white-space:nowrap;
}
.race-status.ended{
  background:#eee;
  color:#444;
  border:1px solid #ddd;
}
/* ===========================
   Sort disabled
   =========================== */
th.sort-disabled{
  opacity:.45;
  cursor:default !important;
  pointer-events:none;
}
/* =========================
   Horse Detail Modal
   ========================= */
.hd-header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.hd-horse-img-wrap {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
}
.hd-horse-img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #f8fafc;
}
.hd-title {
  font-weight: 900;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hd-subtitle {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hd-jockey-box {
  margin-bottom: 12px;
}
.hd-jockey-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.hd-jockey-avatar-wrap {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
}
.hd-jockey-avatar {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid #e5e7eb;
  background: #f3f4f6;
}
.hd-section {
  margin-top: 12px;
}
.hd-section b {
  display: block;
  margin-bottom: 6px;
}
.hd-meta {
  line-height: 1.6;
}
/* ===========================
   Modal extras
   =========================== */
.modal-header-actions{
  display:flex;
  align-items:center;
  gap:8px;
}
.modal-wide{
  max-width:1100px;
  width:min(1100px, calc(100vw - 24px));
}
.debug-frame{
  width:100%;
  height:min(75vh, 720px);
  border:0;
  background:#fff;
  border-radius:10px;
}
/* ===========================
   AI confidence colors (semantic)
   =========================== */
.ai-conf{
  font-weight:700;
  padding:2px 6px;
  border-radius:10px;
  font-size:12px;
}
/* unified ellipsis for AI columns */
.ai-summary{ max-width:360px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ai-history{ max-width:420px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
/* ===========================
   Lowest value BOX markers (FIXED > operator)
   =========================== */
td.u-red-lowest,
td.u-green-lowest{
  background:transparent !important;
  color:inherit !important;
  font-weight:normal;
  padding-top:6px;
  padding-bottom:6px;
}

/* ✅ lowest odds：支援新結構 odds-wrap + num-odometer */
td.u-red-lowest .odds-wrap .num-odometer,
td.u-red-lowest .num-odometer{
  background:#e53935 !important;
  color:#fff !important;
  padding:2px 6px;
  border-radius:6px;
  font-weight:800;
}

td.u-green-lowest .odds-wrap .num-odometer,
td.u-green-lowest .num-odometer{
  background:#00a67e !important;
  color:#fff !important;
  padding:2px 6px;
  border-radius:6px;
  font-weight:800;
}

/* ===========================
   Top Picks Cards
   =========================== */
.top3{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(320px, 1fr));
  gap:20px;
  margin-bottom:24px;
}
.top3 .card{
  background:var(--c-surface);
  padding:22px;
  border:3px solid var(--c-primary);
  border-radius:10px;
  font-size:15px;
}
.stable-card{ border-color:#00a67e !important; }
.stable-row{ background:#eafff5 !important; }
/* ===========================
   Base Table styles
   =========================== */
table{
  width:100%;
  background:var(--c-surface);
}
th,td{
  border:1px solid var(--c-border-2);
  padding:6px 8px;
  text-align:center;
}
th{
  background:#e9ecf1;
  color:var(--c-primary);
}
.top-pick{ background:#e8f4ff; }

/* Result Cell Coloring */
.result-cell{
  background:#e0e0e0;
  color:#222;
  font-weight:700;
  text-align:center;
  padding:4px 10px;
  border-radius:6px;
  white-space:nowrap;
}
.result-cell.result-1{ background-color:#e53935 !important; color:#fff; }
.result-cell.result-2{ background-color:#fb8c00 !important; color:#fff; }
.result-cell.result-3{ background-color:#1e88e5 !important; color:#fff; }
.result-cell.result-4{ background-color:#43a047 !important; color:#fff; }
.result-cell.result-other{ background:#e0e0e0; color:#222; }
table.race-table td.result-cell{ background-image:none !important; }
/* ===========================
   ✅ TOP NAV 
   =========================== */
#raceNav{
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  z-index: 9999;
  background: var(--c-primary);
  padding: 12px 20px;
  border-radius: 0;
}
#raceNav .nav-inline{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}
#raceNav .nav-title{
  font-size:18px;
  font-weight:800;
  white-space:nowrap;
  color:#fff;
}
#raceNav .nav-sep{
  color: rgba(255,255,255,.7);
  font-weight:600;
}
#raceNav .nav-sub{
  font-weight:600;
  color: rgba(255,255,255,.92);
  white-space:nowrap;
}
#raceNav .pill{
  display:inline-block;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.10);
  text-decoration:none;
  color:#fff;
  font-size:20px; 
  font-weight:600;
  white-space:nowrap;
  cursor: pointer;
  user-select: none;
}
#raceNav .pill:hover{ 
  background: rgba(255,255,255,.16);
}
#raceNav .pill.active{
  border-color:#fff;
  background:#fff;
  color: var(--c-primary);
}
#raceNav .pill.ended{
  background:#2f2f2f !important;
  color:#fff !important;
  border-color:#1f1f1f !important;
  opacity:.9;
}
#raceNav .pill.ended.active{
  background:#b71c1c !important;
  border-color:#7f0000 !important;
  opacity:1;
}
#raceNav .pill.first-open{
  background: rgba(255,255,255,.16);
  border-color: var(--c-primary-outline);
}
#raceNav .pill.first-open.active{
  background:#ffffff;
  border-color: rgba(1,29,93,.28);
}
#raceNav #raceNavPills a.pill.first-open.active{
  color: #000!important;
  background:#fff !important;
  border:1px solid rgba(0,166,126,.55) !important;
}
#raceNavPills{
  display:inline-flex;
  gap:4px;
  align-items:center;
  white-space:nowrap;
  flex:1 1 auto;
  min-width:0;
  max-width:100%;
  overflow-x:auto;
}
#raceNav.auth-expired a.pill{
  pointer-events:none;
  opacity:0.5;
}
#raceNavSpacer{
  display: none !important;
}
#raceNav .nav-right{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  gap:8px;
}
.nav-admin-link{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  border-radius:999px;
  background:#ffe8cc;
  color:#8a4b00;
  font-weight:800;
  font-size:12px;
  text-decoration:none;
  border:1px solid rgba(138,75,0,.15);
}
.nav-admin-link:hover{
  filter:brightness(0.98);
}
.nav-inline{
  display:flex;
  align-items:center;
  gap:10px;
}
.nav-user{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 12px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.10);
  color:#fff;
  font-size:14px;
  white-space:nowrap;
}
.nav-user:hover{ background: rgba(255,255,255,.16); }
.nav-user-icon{
  color:#a7f3d0;
  display:inline-flex;
  align-items:center;
  font-size:16px;
  line-height:1;
}
.nav-username{ font-weight:700; }
.nav-user .nav-logout{
  color:#fff;
  text-decoration:none;
  font-weight:600;
}
.nav-user .nav-logout:hover{
  color:#ffdddd;
  text-decoration:underline;
}
/* Base pill outside nav */
.pill{
  display:inline-block;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--c-primary);
  background: var(--c-primary-soft);
  text-decoration:none;
  color: var(--c-primary);
  font-weight:700;
  white-space:nowrap;
  cursor:pointer;
}
.pill:hover{ background: var(--c-primary-soft-strong); }
.small-pill{ font-size:12px; padding:4px 10px; }
.nav .pill.ended{
  background:#2f2f2f;
  color:#fff;
  border-color:#1f1f1f;
  opacity:.85;
}
.nav .pill.active{ opacity:1; }
.nav .pill.ended.active{
  background:#b71c1c;
  border-color:#7f0000;
  opacity:1;
}
/* ===========================
   NAV Refresh Indicator
   =========================== */
.nav-loading-dot{
  width:8px;
  height:8px;
  border-radius:50%;
  background:#fff;
  box-shadow:0 0 0 rgba(255,255,255,.55);
  animation: navPulse 1s infinite ease-in-out;
}
@keyframes navPulse{
  0%   { transform:scale(0.9); box-shadow:0 0 0 0 rgba(255,255,255,.55); opacity:.7; }
  60%  { transform:scale(1.2); box-shadow:0 0 0 8px rgba(255,255,255,0); opacity:1; }
  100% { transform:scale(0.9); box-shadow:0 0 0 0 rgba(255,255,255,0); opacity:.7; }
}
#raceNav.is-refreshing{ border-color: rgba(255,255,255,.32); }
#navLoading.is-stopped .nav-loading-dot{
  width: 10px;               /* 你可改大細 */
  height: 10px;
  border-radius: 999px;
  background: #ef4444;       /* 紅色 */
  box-shadow: 0 0 0 0 transparent;
  animation: none;           /* 停止閃動 */
}
#navLoading.is-stopped .nav-loading-dot{
  border: none !important;
}
#navLoading.is-done{
  background: rgba(22, 163, 74, .95);
  border-color: rgba(22, 163, 74, .95);
}
#navLoading.is-done .nav-loading-dot{
  background:#fff;
  animation:none;
}
/* floating loading pill */
#navLoading.nav-loading-floating .nav-loading-dot{ background:#011d5d; }
#navLoading.nav-loading-floating{
  position:fixed;
  top:180px;
  right:20px;
  z-index:20000;
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 12px;
  border-radius:999px;
  background:rgba(255,255,255,.92);
  border:1px solid rgba(1,29,93,.18);
  color:#011d5d;
  font-weight:800;
  font-size:12px;
  box-shadow:0 8px 20px rgba(0,0,0,.12);
  opacity:1;
  transition: opacity .18s ease, transform .18s ease;
  transform: translateY(0);
}
/* ✅ STOP REFRESH — force full red dot (highest priority) */
#navLoading.is-stopped.nav-loading-floating .nav-loading-dot{
  background:#ef4444 !important;
  box-shadow: none;
  animation: none;
}
#navLoading.nav-loading-floating[hidden]{
  display:inline-flex !important;
  opacity:0;
  pointer-events:none;
  transform: translateY(-6px);
}
#navLoading[hidden]{ display:none !important; }
/* ===========================
   topBars
   =========================== */
#topBars{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  z-index: 9999;
  background: transparent;
  isolation: auto !important;
}
/* ===========================
   Footer Credit
   =========================== */
#topBars .footer-credit{
  position: fixed;
  right: 16px;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  z-index: 10001;
  pointer-events: auto;
  
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #ffffff;
  background-clip: padding-box;
  border-radius: 999px;
  border: 1px solid rgba(1,29,93,.18);
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  color: var(--c-primary);
    transform: none !important;
}
.footer-credit a{
  color: var(--c-primary);
  font-weight: 800;
  text-decoration: none;
}
.footer-credit a:hover{
  text-decoration: underline;
}
#cacheLine{ margin-top:0px; margin-bottom:30px; }
/* ======================================================
   ✅ HERO FINAL SPACING — EXACT 10px LEFT / RIGHT
   This overrides all previous hero padding rules
   ====================================================== */
.hero-content{
  padding-left: 10px !important;
  padding-right: 10px !important;
}
/* ===========================
   Modal (Model Info)
   =========================== */
.modal{
  position:fixed;
  inset:0;
  display:none;
  z-index: 100000 !important;   /* > 99999 */
}
.modal.show{ display:block; }
.modal-backdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.45);
  backdrop-filter: blur(2px);
  z-index: 100001 !important;
}
.modal-card{
  position:relative;
  margin:8vh auto;
  width:min(720px, 94vw);
  background: var(--c-surface);
  border-radius:14px;
  border:1px solid rgba(0,0,0,.12);
  box-shadow:0 24px 70px rgba(0,0,0,.35);
  overflow:hidden;
  outline:none;
}
.modal-card.modal-wide{
  width:min(1400px, 98vw);
}
@media (min-width:1200px){
  .modal-card.modal-wide .top3{
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  }
}
.modal-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 18px;
  border-bottom:1px solid rgba(0,0,0,.08);
  background:linear-gradient(180deg, #f7f8fa, #f1f3f6);
}
.modal-header h3{
  margin:0;
  font-size:18px;
  font-weight:900;
  color: var(--c-primary);
}
.modal-close{
  border:none;
  background:none;
  font-size:22px;
  cursor:pointer;
  line-height:1;
  color: var(--c-primary);
}
.modal-body{ padding:18px; }
.modal-content{
  font-size:14px;
  line-height:1.6;
  color: var(--c-text);
}
.modal-body-scroll{
  max-height:70vh;
  overflow:auto;
}
.modal-footer{
  margin-top:16px;
  padding-top:14px;
  border-top:1px solid rgba(0,0,0,.08);
  display:flex;
  justify-content:center;
}
/* ===========================
   Fullscreen Loading Overlay
   =========================== */
.overlay{
  position:fixed;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  background:rgba(0,0,0,.45);
  z-index:9999;
  backdrop-filter: blur(2px);
}
.overlay.show{ display:flex; }
.overlay-card{
  width:min(420px, 92vw);
  background: var(--c-surface);
  border:1px solid rgba(0,0,0,.12);
  border-radius:14px;
  padding:22px 20px;
  box-shadow:0 18px 60px rgba(0,0,0,.25);
  text-align:center;
}
.overlay-title{
  font-weight:800;
  font-size:18px;
  margin-top:10px;
  color: var(--c-primary);
}
.overlay-sub{
  color: var(--c-muted);
  font-size:14px;
  margin-top:6px;
}
.spinner{
  width:46px;
  height:46px;
  border-radius:50%;
  border:4px solid #e6e6e6;
  border-top-color: var(--c-primary);
  margin:0 auto;
  animation:spin .85s linear infinite;
}
@keyframes spin{ to{ transform: rotate(360deg); } }
body.noscroll{ overflow:hidden; }
/* ===========================
   Gradient button
   =========================== */
.powered-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 800;
  font-size: 13px;
  color: #0b0f14;
  background: linear-gradient(135deg, #a7f3d0, #60a5fa);
  box-shadow: 0 8px 18px rgba(0,0,0,.25);
  transition: transform .12s ease, filter .12s ease;
  border: none;
  cursor: pointer;
}
.powered-btn:hover{ transform: translateY(-1px); filter: brightness(1.05); }
.powered-btn:active{ transform: translateY(0px); filter: brightness(.98); }
/* ===========================
   Responsive (mobile)
   =========================== */
#navCountdown{ display:none; }
@media (max-width: 1000px){
  .dash-span-5, .dash-span-6, .dash-span-7{ grid-column: span 12; }
  .dash-kv{ grid-template-columns: repeat(2, minmax(0,1fr)); }
  .rank-chart-row{ grid-template-columns: 110px 1fr 74px; padding-top:8px; padding-bottom:8px; }
  .rank-chart-left .rk{ display:none; }
  .race-table .name-en{display: none !important;}
  .race-table td small.small-muted{display: none !important;}
  #raceNav .nav-inline{ display:flex; flex-wrap:wrap; align-items:center; min-width:0; }
  /* 表格內容字體 */
  table.race-table td{
    font-size:16px !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;

  }
  /* 表頭字體 */
  table.race-table th{
    font-size:16px !important;
  }
  /* 1) Sticky 馬名欄寬（最穩：改變數） */
  table.race-table{
	--sticky-col-2:150px !important;
  }
  /* 2) 練馬師（第4欄）= 90px */
  table.race-table th:nth-child(4),
  table.race-table td:nth-child(4){
	width:90px !important;
	min-width:90px !important;
	max-width:90px !important;
  }
  /* 3) 騎師（第5欄）= 60px */
  table.race-table th:nth-child(5),
  table.race-table td:nth-child(5){
	width:100px !important;
	min-width:100px !important;
	max-width:100px !important;
  }
  /* ROW 1 */
  #raceNav img, #raceNav .nav-title{ order:1; }
  #raceNav .nav-right{
    order:2;
    margin-left:auto;
    flex:0 0 auto;
    align-self:center;
  }
  /* FORCE NEW LINE -> ROW 2 */
  #raceNav .nav-break{
    order:3;
    flex:0 0 100%;
    height:0;
  }
  /* ROW 2 */
  #raceNav .nav-sub{
    order:4;
    flex:1 1 auto;
    white-space:nowrap;
    font-weight:700;
  }
  #navCountdown{
    color:#ffffff !important;
    text-shadow:0 1px 2px rgba(0,0,0,.45);
    display:inline-flex;
    order:5;
    margin-left:auto;
    white-space:nowrap;
    font-weight:800;
    font-size:12px;
    padding:4px 10px;
    border-radius:999px;
    border:1px solid rgba(255,255,255,.22);
    background:rgba(255,255,255,.10);
  }
  /* ROW 3 */
  #raceNavPills{
    order:6;
    flex:0 0 100%;
    display:flex;
    flex-wrap:wrap;
    gap:6px;
    margin-top:6px;
  }
  /* ROW 4: loading */
  #navLoading{ order:8; margin-left:auto; margin-top:6px; }
  #navLoading[hidden]{ display:none !important; }
  #raceNav .nav-sep{ display:none; }
  .table-header-row{ flex-wrap:wrap; }
  .table-header-row .col-switch{
    margin-left:0;
    width:100%;
    justify-content:flex-end;
    margin-top:6px;
  }
  .nav-sep{ display:none; }
  .nav-marquee{
	font-size:19px;
  }
  .nav-chip{
	font-size:18px;
  }
}
.payout-box{
  background: #fafafa;
}
.payout-row{
  display: grid;
  grid-template-columns: 64px 1fr 80px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #eee;
}
.payout-type{
  font-weight: 700;
  color: #444;
}
.payout-horses{
  font-family: monospace;
  color: #333;
}
.payout-value{
  text-align: right;
  font-weight: 700;
}
.payout-table { display: grid; gap: 8px; }
.payout-type { font-weight: 700; }
.payout-horses { color: #666; }
.payout-value { font-weight: 700; white-space: nowrap; }
.payout-box{
  min-height: 90px;
  border-left: 4px solid #2f7cf6;
  padding-left: 14px;

}
/* ===========================
   NAV bottom marquee (FIXED)
   =========================== */
.nav-bottom-yellow{
  position: relative;
  z-index: 9999;
  height: 30px;
  background:#ffe066;
  color:#111;
  display:flex;
  align-items:center;
  overflow:hidden;
  padding:6px 15px;
  font-size:14px;

}
.nav-marquee{
  position: relative;
  overflow: hidden;
  width: 100%;
}
.nav-marquee-track{
  position: relative;
  display: inline-block;
  white-space: nowrap;
  will-change: transform;
  animation: navMarqueeScroll 25s linear infinite;
}

.nav-marquee.is-paused .nav-marquee-track{
  animation-play-state: paused !important;
}
@keyframes navMarqueeScroll{
  0% {
    transform: translateX(100vw);
  }
  100%{
    transform: translateX(-110%);
  }
}
#raceContent{
  padding-top: calc(env(safe-area-inset-top, 0px) + var(--topbars-h, 160px) + 8px);
}
@keyframes navMarquee{
  0%   { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}
@media (max-width:768px){
  .nav-chip{ height:20px; min-width:20px; font-size:12px; padding:0 7px; margin:0 3px; }
  .matrix-table{ min-width:780px; }
  .matrix-table .sticky-col-x{ min-width:150px; }
  .hero-media{ height:36vh; }
  .hero-title{ font-size:26px; }
  .dash-kv{ grid-template-columns:1fr; }
  .dash-big-num{ font-size:38px; }
  .race-table{ --sticky-col-2:120px; }
  .race-table td.sticky-col-2 .name-en{ display:none; }
  .race-table .name-en{ display:none !important; }
  .race-table td small.small-muted{ display:none !important; }
  #raceNav{
    margin:0;
    border-radius:0;
  }
  #dealerPickLine .dp-h-row{
    flex-wrap: wrap;
  }
  #dealerPickLine.dealer-pick-split .dp-grid{
    flex-direction: column;
  }
  #dealerPickLine.dealer-pick-split .dp-left{
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
}
/* Reduce motion */
@media (prefers-reduced-motion: reduce){
  table.race-table tbody tr{ transition:none !important; transform:none !important; }
}
/* ===================================================================
   FINAL PATCH — GUARANTEED WORKING (CLEAN VERSION)
   Sticky column bleed-through FIXED
   Keep this as the SINGLE source of truth for race-table behaviour.
   =================================================================== */
/* ===========================
 Horse Detail – Race History Table ONLY
=========================== */
table.race-table-history{
  width:100%;
  min-width:900px;
  border-collapse:separate;
  border-spacing:0;
  table-layout:fixed;
  background: var(--c-surface);
}
/* header */
table.race-table-history thead th{
  background:#f3f4f6;
  color:var(--c-primary);
  font-weight:700;
  font-size:12px;
  padding:6px;
  border:1px solid var(--c-border-2);
  white-space:nowrap;
}
/* body cells */
table.race-table-history td{
  font-size:12px;
  padding:5px 6px;
  border:1px solid var(--c-border-2);
  white-space:nowrap;
  text-align:center;
}
/* ✅ AI 精選 cell align (FINAL PATCH safe) */
table.race-table td.ai-pick-cell{ text-align:center; vertical-align:middle; }
table.race-table td.ai-pick-cell span{ vertical-align:middle; }
/* zebra rows */
table.race-table-history tbody tr:nth-child(even){
  background:#fafafa;
}
/* ===========================
✅ FORCE FIXED ROW HEIGHT
=========================== */
table.race-table tbody tr {
  min-height: 52px;          /* ✅ 你可以 48 / 52 / 56，自行微調 */
  height: 52px;
}
/* hover */
table.race-table-history tbody tr:hover{
  background:#eef7ff;
}
/* === AI badge: circle for 1 char, pill for 2+ chars === */
.ai-conf{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  height:18px;
  min-width:18px;
  padding:0 6px;
  font-size:12px;
  font-weight:800;
  line-height:1;
  color:#fff;
  border:none;
  border-radius:999em;
  vertical-align:middle;
  margin-right:4px;
}
/* colors */
.ai-conf.conf-high{ background:#16a34a; }
.ai-conf.conf-medium{ background:#f59e0b; }
.ai-conf.conf-low{ background:#dc2626; }
.ai-conf.conf-insufficient{ background:#6b7280; }
.ai-conf.conf-na{ background:#9ca3af; }
/* optional */
.ai-conf.conf-insufficient{
  padding:0 7px;        /* a bit more breathing room */
  font-size:11px;
  letter-spacing:0;
}
/* ---------- Table scroll ---------- */
.table-scroll{
  width:100%;
  max-width:100%;
  overflow-x:auto;
  overflow-y:hidden;
  -webkit-overflow-scrolling:touch;
}
/* ---------- Table base (DESKTOP FIX) ---------- */
table.race-table{
  width:100%;
  min-width:1820px;
  table-layout:fixed;
  border-collapse:separate;
  border-spacing:0;
  white-space:nowrap;
}
/* ---------- Zebra rows ---------- */
table.race-table tbody tr{ background:#ffffff; }
table.race-table tbody tr:nth-child(even){ background:#fafafa; }
/* ---------- Hover row (single source of truth) ---------- */
table.race-table tbody tr:hover,
table.race-table tbody tr.row-hover{
  background:#fff7d6;
  transform:none; /* prevent rare sticky repaint glitch */
}
/* ---------- Sticky header ---------- */
table.race-table thead th{
  position:sticky;
  top:0;
  z-index:4;
  background:#e9ecf1;
}
/* ---------- Cell typography ---------- */
table.race-table th{
  font-size:12.5px;
  font-weight:700;
  padding:6px 6px;
}
table.race-table td{
  font-size:13px;
  padding:5px 6px;
}
/* ---------- Global overflow safety ---------- */
table.race-table th,
table.race-table td{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
/* ===========================
   Animated Number (Odometer) — FINAL
   =========================== */
.num-odometer{
  display:inline-flex;
  align-items:center;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.num-digit{
  position:relative;
  display:inline-block;
  vertical-align:middle;
  width:0.62em;
  height:1em;
  overflow:hidden;
}
.num-digit-inner{
  position:absolute;
  left:0;
  top:0;
  width:100%;
  transform: translateY(0);
  transition: transform 2000ms ease-in-out; 
  will-change: transform;
}
.num-digit-inner span{
  display:block;
  height:1em;
  line-height:1em;
  text-align:center;
}
.num-char{
  display:inline-block;
  margin:0 1px;
  line-height:1em;
  vertical-align:middle;
}
.odo-no-anim .num-digit-inner{
  transition: none !important;
}
.num-odometer.odo-up{ color:#16a34a; }
.num-odometer.odo-down{ color:#dc2626; }
/* ===============================
   FIX: Odds slide CENTERED and NO sideways movement
   Scope: only inside race table
   =============================== */
.race-table .num-odometer.value-slide{
  display:flex !important;          /* flex container */
  align-items:center;
  justify-content:center;           /* ✅ center horizontally */
  width:100% !important;
}

/* old / new sliding spans */
.race-table .num-odometer.value-slide .vs{
  left:0;
  right:0;
  width:100%;
  display:flex;
  align-items:center;
  justify-content:center;           /* ✅ center content */
  text-align:center;
}

/* invisible width holder (still needed) */
.race-table .num-odometer.value-slide .vs.measure{
  display:flex;
  width:100%;
  justify-content:center;
  visibility:hidden;
}
/* ======================================================
   ✅ STICKY COLUMNS — CORE FIX
   ====================================================== */
table.race-table th.sticky-col,
table.race-table td.sticky-col{
  position:sticky;
  background:#ffffff;               /* MUST be opaque */
  background-clip:padding-box;
  isolation:isolate;
}
table.race-table tbody tr:nth-child(even) td.sticky-col{ background:#fafafa; }
table.race-table tbody tr:hover td.sticky-col,
table.race-table tbody tr.row-hover td.sticky-col{ background:#fff7d6; }
/* ======================================================
   ✅ STICKY COLUMN SIZES + Z-INDEX DANCE
   ====================================================== */
.race-table{
  --sticky-col-1:70px;    /* 馬號 */
  --sticky-col-2:180px;   /* 馬名 */
}
.race-table .sticky-col-1{
  left:0;
  width:var(--sticky-col-1);
  min-width:var(--sticky-col-1);
  max-width:var(--sticky-col-1);
  z-index:6;
  overflow:visible !important; /* ✅ never clip rank dot */
}
.race-table .sticky-col-2{
  left:var(--sticky-col-1);
  width:var(--sticky-col-2);
  min-width:var(--sticky-col-2);
  max-width:var(--sticky-col-2);
  z-index:5;
  box-shadow:6px 0 10px rgba(0,0,0,.10);
}
.race-table thead th.sticky-col-1{ z-index:12; }
.race-table thead th.sticky-col-2{ z-index:11; }
/* Name ellipsis */
.race-table td.sticky-col-2{ padding-right:10px; }
.race-table td.sticky-col-2 .name-cn,
.race-table td.sticky-col-2 .name-en{
  display:block;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
}
/* ======================================================
   Rank Movement — FINAL (CLEAN LOGIC)
   - Result 1–4: number colored, opacity 1
   - Result >4: opacity 0.5 (rm-not-hit)
   - No result: opacity 1
   ====================================================== */

/* ================= Section ================= */
#rankMovementSection{
  margin: 0;
  padding: 0;
}

/* ================= Track ================= */
#rankMovementTrack{
  position: relative;
  width: 100%;
  margin: 0;

  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 0;

  overflow: hidden;

  --rm-top: 16px;
  --rm-body-h: 92px;
  --rm-bottom-gap: 4px;
  --rm-gap-x: 8px;

  height: calc(var(--rm-top) + var(--rm-body-h) + var(--rm-bottom-gap));

  --rm-font-num: 18px;
  --rm-font-cn: 13px;
  --rm-font-en: 11px;
  --rm-shirt: 28px;
}

/* ================= Runner ================= */
#rankMovementTrack .rm-runner{
  position: absolute;
  top: var(--rm-top);

  width: calc(var(--seg) - var(--rm-gap-x));
  transform: translateX(calc(var(--rm-gap-x) / 2));

  box-sizing: border-box;
  padding: 0;
  margin: 0;

  background: transparent;
  border: 1px solid var(--c-border);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);

  display: flex;
  flex-direction: column;
  overflow: hidden;

  transition: left 800ms ease-in-out;

  /* ✅ DEFAULT */
  opacity: 1;
}

/* ================= Result > 4 (NOT HIT) ================= */
/* JS must add rm-not-hit */
#rankMovementTrack .rm-runner.rm-not-hit{
  opacity: 0.5;
}

/* ================= Result 1–4 (HIT) ================= */
#rankMovementTrack .rm-runner.rm-result-1,
#rankMovementTrack .rm-runner.rm-result-2,
#rankMovementTrack .rm-runner.rm-result-3,
#rankMovementTrack .rm-runner.rm-result-4{
  opacity: 1;
}

/* ================= Up / Down Flash ================= */
#rankMovementTrack .rm-runner.rm-flash-up,
#rankMovementTrack .rm-runner.rm-flash-down{
  opacity: 1;
}

#rankMovementTrack .rm-runner.rm-flash-up{ animation: rmFlashUp 3s ease-out; }
#rankMovementTrack .rm-runner.rm-flash-down{ animation: rmFlashDown 3s ease-out; }

/* ================= Flash Keyframes ================= */
@keyframes rmFlashUp{
  0%{
    border-color:#16a34a;
    box-shadow:0 0 0 2px rgba(22,163,74,.35),0 2px 8px rgba(0,0,0,.08);
  }
  20%{ box-shadow:0 0 0 4px rgba(22,163,74,.25),0 2px 8px rgba(0,0,0,.08); }
  100%{
    border-color:var(--c-border);
    box-shadow:0 2px 8px rgba(0,0,0,.08);
  }
}

@keyframes rmFlashDown{
  0%{
    border-color:#dc2626;
    box-shadow:0 0 0 2px rgba(220,38,38,.35),0 2px 8px rgba(0,0,0,.08);
  }
  20%{ box-shadow:0 0 0 4px rgba(220,38,38,.25),0 2px 8px rgba(0,0,0,.08); }
  100%{
    border-color:var(--c-border);
    box-shadow:0 2px 8px rgba(0,0,0,.08);
  }
}

/* ================= Line 1 ================= */
#rankMovementTrack .rm-line1{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 0 0;
}

/* ================= Horse Number ================= */
#rankMovementTrack .rm-num{
  width: 1.9em;
  height: 1.9em;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  background:#6b7280;
  color:#fff;

  font-size:var(--rm-font-num);
  font-weight:1000;
  line-height:1;
}

/* ================= Result Colors — NUMBER ONLY ================= */
#rankMovementTrack .rm-runner.rm-result-1 .rm-num{ background:#e53935; }
#rankMovementTrack .rm-runner.rm-result-2 .rm-num{ background:#fb8c00; }
#rankMovementTrack .rm-runner.rm-result-3 .rm-num{ background:#1e88e5; }
#rankMovementTrack .rm-runner.rm-result-4 .rm-num{ background:#43a047; }

/* ================= Shirt ================= */
#rankMovementTrack .rm-shirt{
  width:var(--rm-shirt);
  height:var(--rm-shirt);
  object-fit:contain;
}

/* ================= Names ================= */
#rankMovementTrack .rm-name-cn{
  padding: 3px 4px 3px 5px;
  background:var(--c-primary);
  color:#fff;
  font-size:var(--rm-font-cn);
  font-weight:900;
}

#rankMovementTrack .rm-name-en{
  padding: 4px 4px 4px 5px;
  background:#fff;
  color:var(--c-primary);
  font-size:var(--rm-font-en);
  font-weight:800;
  border-top:1px solid var(--c-primary);
}

/* ================= Delta ================= */
#rankMovementTrack .rm-delta{
  position:absolute;
  right:10px;
  bottom:0;
  padding:4px 6px;
  font-size:12px;
  font-weight:900;
  background:rgba(255,255,255,.85);
  border-radius:2px;
}

/* ================= Mobile ================= */
@media (max-width:1000px){
  #rankMovementTrack{ --rm-top:5px; --rm-body-h:58px; }
  #rankMovementTrack .rm-name-en{ display:none; }
}

/* ================= No animation ================= */
#rankMovementTrack.rm-no-anim .rm-runner{
  transition:none !important;
}

/* ======================================================
   ✅ Rank / Stable 背景顏色全 row 同步（含 sticky + 非 sticky）
   ====================================================== */
table.race-table tbody tr.rank-1 > td:not(.result-cell):not(.odds-capped){
  background-color:#ffe066 !important;
  background-image:none !important;
}
table.race-table tbody tr.rank-2 > td:not(.result-cell):not(.odds-capped){
  background-color:#dbeafe !important;
  background-image:none !important;
}
table.race-table tbody tr.rank-3 > td:not(.result-cell):not(.odds-capped){
  background-color:#eef2ff !important;
  background-image:none !important;
}
table.race-table tbody tr.stable-row > td:not(.result-cell):not(.odds-capped){
  background-color:#eafff5 !important;
  background-image:none !important;
}
/* hover must win */
table.race-table tbody tr:hover > td:not(.result-cell):not(.odds-capped),
table.race-table tbody tr.row-hover > td:not(.result-cell):not(.odds-capped){
  background-color:#fff7d6 !important;
  background-image:none !important;
}
/* sorted sticky columns must be opaque */
table.race-table td.sorted-cell.sticky-col{
  background-color: inherit !important;
  background-image: none !important;
}
/* keep result-cell color always */
table.race-table td.result-cell{ background-image:none !important; }
/* ===========================
   Countdown chip inside modal title
   =========================== */
#rankChartModalTitle,
#oddsSignalsModalTitle{
  display:flex;
  align-items:center;
  gap:10px;
}
#rankChartModalTitle .countdown-chip,
#oddsSignalsModalTitle .countdown-chip{
  display:inline-flex;
  align-items:center;
  padding:4px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:800;
  line-height:1;
  color:var(--c-primary);
  background:rgba(1,29,93,.10);
  border:1px solid rgba(1,29,93,.25);

  white-space:nowrap;
}
/* hidden compatible */
#navLoading[hidden]{ display:none !important; }
/* ======================================================
   ✅ POST RACE LAYOUT — FINAL (NO BLANK SPACE)
   Desktop:
   Left column: AI + Replay (stack)
   Right column: Payout (top aligned)
   Mobile: stack
   ====================================================== */
.postrace-two-col{
  display:flex !important;
  align-items:flex-start;
  gap:16px;
  margin-top:16px;
}
.postrace-left-col{
  flex:0 0 calc(50% - 8px);
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:16px;
}
.postrace-two-col .payout-box{
  flex:0 0 calc(50% - 8px);
  min-width:0;
}
#topBars .footer-credit{
  position: fixed !important;
  right: 16px !important;
  left: auto !important;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px)) !important;
  z-index: 10001 !important;
  pointer-events: auto !important;
}
#topBars{
  transform: none !important;
  filter: none !important;
  backdrop-filter: none !important;
}
@media (max-width:1000px){
  .postrace-two-col{
    flex-direction:column;
  }
  .postrace-left-col,
  .postrace-two-col .payout-box{
    flex:none;
    width:100%;
  }
}
@media (min-width: 1200px){
  #horseDetailModal .modal-card{
    width: 1400px;
    max-width: 1400px;
  }
}

@media (max-width: 1000px){
  #rankMovementTrack .rm-name-en{
    display: none;
  }
  #rankMovementTrack .rm-name-cn{
    padding-bottom: 6px;
  }
}
@media (max-width: 1000px){
  #rankMovementTrack .rm-line1{ padding: 3px 4px; }
  #rankMovementTrack .rm-name-cn{ padding: 3px 4px; }
  #rankMovementTrack .rm-num{
    min-width: 24px;
    height: 24px;
    font-size: 12px;
  }
}
/* Snapshot slider bar */
body.is-live #snapshotSliderBar{
  border: 1px solid #22c55e;
  background: #ffffff;
}
body.is-snapshot #snapshotSliderBar,
body.is-pre-snapshot #snapshotSliderBar{
  border: 1px solid #f59e0b;
  background: #fffbeb;
}
body.is-snapshot #snapshotSliderLabel{
  color: #b45309;
}
body.is-snapshot #snapshotSliderSub{
  color:#92400e;
  font-weight:600;
}
body.is-snapshot .race-status{
  background:#fffbeb;
  border:1px solid #f59e0b;
}
/* ✅ 只針對「投注數據」，唔影響派彩結果 */
.pool-data-box .payout-row {
  display: grid;
  grid-template-columns: 1fr auto;
}

.pool-data-box .payout-value {
  text-align: right;
}

#snapshotSliderBar{
  display:block;
}
body.is-rankchart-open #snapshotSliderBar{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0 !important;
  border-radius: 0;
  z-index: var(--snapbar-z, 10000);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  touch-action: pan-x;
}
body.is-rankchart-open #rankChartModal .modal-card{
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}
#snapshotSliderBar #snapshotSlider{
  width: min(320px, 70vw);
  accent-color: #2563eb;
}
#snapshotSliderBar #snapshotSliderLabel{
  font-weight: 700;
}
#snapshotSliderBar #snapshotSliderSub{
  line-height: 1.4;
  font-size:16px;
}
@media (max-width: 600px){
  #snapshotSliderBar{
    padding: 10px 12px;
  }
  #snapshotSliderBar #snapshotSlider{
    width: 100%;
  }
}
/* ===============================
   ✅ DealerPick 強制 100% 寬度（只影響 #dealerPickLine）
   =============================== */
#dealerPickLine.dealer-pick-split.dp-stacked .dp-grid{
  display:flex;
  flex-direction:column;
  gap:12px;
  width:100%;
}

#dealerPickLine.dealer-pick-split.dp-stacked .dp-left,
#dealerPickLine.dealer-pick-split.dp-stacked .dp-right{
  width:100%;
  flex:0 0 auto;
  min-width:0;
}

#dealerPickLine.dealer-pick-split.dp-stacked .dp-right{
  border-left:0;
  padding-left:0;
  border-top:1px solid rgba(0,0,0,.08);
  padding-top:10px;
}

/* 走勢盒一定用滿 */
#dealerPickLine.dealer-pick-split.dp-stacked .dp-compare-box{
  width:100%;
  display:block;
}