:root {
  --bg-canvas: #050811;
  --bg-surface: rgba(13, 19, 33, 0.78);
  --bg-surface-solid: #0d1321;
  --bg-elev: rgba(22, 32, 52, 0.74);
  --bg-elev-solid: #162034;
  --bg-hover: rgba(34, 48, 76, 0.82);
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.26);
  --text-main: #f8fafc;
  --text-soft: #cbd5e1;
  --text-muted: #8b9bb4;
  --emerald: #10b981;
  --emerald-bright: #34d399;
  --emerald-dim: rgba(16, 185, 129, 0.15);
  --cyan: #38bdf8;
  --cyan-dim: rgba(56, 189, 248, 0.15);
  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, 0.15);
  --rose: #fb7185;
  --rose-dim: rgba(251, 113, 133, 0.15);
  --radius-lg: 18px;
  --radius-md: 13px;
  --radius-sm: 9px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-canvas);
  color: var(--text-main);
  font-family: "Inter", "Noto Sans TC", -apple-system, BlinkMacSystemFont, "PingFang HK", "Microsoft JhengHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Custom thin scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.22); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.38); }

.hidden { display: none !important; }
.muted { color: var(--text-muted); font-size: 0.82rem; margin: 3px 0 0; line-height: 1.45; }

/* Unified Minimalist Stroke Icon System (Scheme A) */
.ui-ico {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: -2px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ui-ico-sm {
  width: 13px;
  height: 13px;
  stroke-width: 1.9;
}

.ui-ico-lg {
  width: 20px;
  height: 20px;
  stroke-width: 1.7;
  vertical-align: middle;
}

.micro-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  background: currentColor;
}
.micro-dot.emerald { background: var(--emerald-bright); box-shadow: 0 0 6px rgba(52, 211, 153, 0.7); }
.micro-dot.cyan { background: var(--cyan); box-shadow: 0 0 6px rgba(56, 189, 248, 0.7); }
.micro-dot.amber { background: var(--amber); box-shadow: 0 0 6px rgba(245, 158, 11, 0.75); }
.micro-dot.rose { background: var(--rose); box-shadow: 0 0 7px rgba(251, 113, 133, 0.85); }

.watch-star {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color 0.16s var(--ease), transform 0.14s var(--ease);
}
.watch-star:hover { color: var(--amber); }
.watch-star.active { color: var(--amber); }
.watch-star.active svg { fill: currentColor; }
.mono-val {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

/* Ambient Background */
.ambient-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.28;
}

.glow-1 {
  width: 560px;
  height: 560px;
  top: -180px;
  left: -120px;
  background: radial-gradient(circle, #10b981 0%, transparent 70%);
}

.glow-2 {
  width: 620px;
  height: 620px;
  top: -160px;
  right: -140px;
  background: radial-gradient(circle, #0284c7 0%, transparent 70%);
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.03) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at top center, black 25%, transparent 80%);
}

/* BenLin Subtle Watermark */
.watermark-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  z-index: 5;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='180' viewBox='0 0 240 180'%3E%3Cg transform='rotate(-26 120 90)'%3E%3Ctext x='120' y='92' text-anchor='middle' fill='%2394a3b8' font-family='Inter,sans-serif' font-weight='800' font-size='22' letter-spacing='3'%3EBenLin%3C/text%3E%3Ctext x='120' y='110' text-anchor='middle' fill='%2338bdf8' font-family='monospace' font-weight='600' font-size='9' letter-spacing='2'%3EHKJC QUANT%3C/text%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat;
}

.watermark-corner {
  position: fixed;
  bottom: 12px;
  left: 16px;
  z-index: 45;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: rgba(203, 213, 225, 0.42);
  background: rgba(6, 9, 17, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.16);
  padding: 4px 10px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
}

/* Glass Surface */
.glass-panel {
  background: linear-gradient(165deg, rgba(17, 25, 43, 0.84) 0%, rgba(10, 15, 27, 0.76) 100%);
  backdrop-filter: blur(20px) saturate(130%);
  -webkit-backdrop-filter: blur(20px) saturate(130%);
  border: 1px solid var(--border);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.065),
    0 16px 38px -14px rgba(0, 0, 0, 0.65);
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 13px 28px;
  background: rgba(5, 8, 17, 0.84);
  backdrop-filter: blur(22px) saturate(135%);
  -webkit-backdrop-filter: blur(22px) saturate(135%);
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent 5%, rgba(16, 185, 129, 0.35) 35%, rgba(56, 189, 248, 0.35) 65%, transparent 95%);
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.24), 0 0 18px rgba(14, 165, 233, 0.14);
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand h1 {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 58%, #6ee7b7 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.badge-hkjc {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--emerald-dim);
  color: var(--emerald-bright);
  border: 1px solid rgba(16, 185, 129, 0.32);
}

.subtitle {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 0.77rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-soft);
}

.status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22);
  animation: pulse-dot 2.2s infinite;
}

.status-pill.error .dot {
  background: var(--rose);
  box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.25);
  animation: none;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.22); }
  50% { box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.08); }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 10px;
  padding: 8px 15px;
  font-weight: 600;
  font-size: 0.84rem;
  cursor: pointer;
  transition: transform 0.16s var(--ease), filter 0.16s var(--ease), background 0.16s var(--ease), border-color 0.16s var(--ease);
  color: var(--text-main);
}

.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.52; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, #34d399 0%, #10b981 52%, #059669 100%);
  color: #032217;
  font-weight: 700;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 6px 20px -4px rgba(16, 185, 129, 0.42);
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 10px 24px -4px rgba(16, 185, 129, 0.5);
}

.btn-secondary {
  background: rgba(20, 29, 48, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.22);
  color: var(--text-main);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(30, 43, 70, 0.92);
  border-color: rgba(56, 189, 248, 0.42);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-ghost:hover:not(:disabled) { color: var(--text-main); border-color: var(--border-strong); }

.btn-sm { padding: 5px 11px; font-size: 0.77rem; border-radius: 8px; }
.btn-block { width: 100%; margin-top: 14px; padding: 11px; font-size: 0.9rem; }
.btn-block-sm { width: 100%; padding: 9px 14px; }

/* Inputs */
.input-field, .select-field, .select-compact {
  width: 100%;
  background: rgba(6, 9, 17, 0.72);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 11px;
  font-size: 0.84rem;
  outline: none;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

.input-field:focus, .select-field:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

/* Range Slider */
.modern-range {
  -webkit-appearance: none;
  appearance: none;
  width: 96px;
  height: 5px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.22);
  outline: none;
}

.modern-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--emerald-bright);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.55);
}

/* Subnav */
.nav-tabs {
  position: relative;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 15, 27, 0.65);
  backdrop-filter: blur(12px);
}

.nav-tabs-inner {
  max-width: 1560px;
  margin: 0 auto;
  padding: 10px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.tab-rail {
  display: inline-flex;
  background: rgba(6, 9, 17, 0.7);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 3px;
  gap: 3px;
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 7px 15px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.16s var(--ease);
}

.nav-tab:hover { color: var(--text-main); }
.nav-tab.active {
  background: var(--bg-elev-solid);
  color: var(--text-main);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.ctrl-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.ctrl-sep { width: 1px; height: 18px; background: var(--border); }
.select-compact { width: auto; padding: 5px 10px; font-size: 0.79rem; border-radius: 8px; }
.select-compact-w { width: auto; min-width: 210px; }

/* Page Container */
.page-container {
  position: relative;
  z-index: 10;
  max-width: 1560px;
  margin: 0 auto;
  padding: 20px 28px 40px;
}

.view-section { display: none; animation: fadeIn 0.22s var(--ease); }
.view-section.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.workspace-grid {
  display: grid;
  grid-template-columns: 356px 1fr;
  gap: 20px;
  align-items: start;
}

/* Sidebar */
.sidebar {
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 106px);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-wrap { position: relative; }
.search-ico {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.95rem;
  pointer-events: none;
}
.search-input { padding-left: 30px; }

.filter-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.sidebar .filter-row {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.sidebar .pill-group {
  width: 100%;
  justify-content: space-between;
}

.sidebar .pill {
  flex: 1;
  text-align: center;
}

.select-league { flex: 1; min-width: 0; width: 100%; padding: 7px 10px; font-size: 0.78rem; }

.pill-group {
  display: inline-flex;
  background: rgba(6, 9, 17, 0.72);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px;
  gap: 2px;
  flex-wrap: wrap;
}

.pill {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.77rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s var(--ease);
}

.pill:hover { color: var(--text-main); }
.pill.active {
  background: var(--bg-elev-solid);
  color: var(--text-main);
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.match-list {
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.match-item {
  background: rgba(7, 11, 21, 0.64);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 13px;
  cursor: pointer;
  transition: transform 0.16s var(--ease), border-color 0.16s var(--ease), background 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

.match-item:hover {
  border-color: rgba(56, 189, 248, 0.46);
  background: rgba(20, 30, 50, 0.72);
  transform: translateX(2px);
}

.match-item.active {
  border-color: rgba(16, 185, 129, 0.65);
  background: linear-gradient(95deg, rgba(16, 185, 129, 0.14) 0%, rgba(14, 22, 38, 0.88) 70%);
  box-shadow:
    inset 3px 0 0 var(--emerald-bright),
    0 6px 18px -8px rgba(16, 185, 129, 0.35);
}

.mi-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.mi-meta-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  min-width: 0;
  flex: 1;
}

.mi-time-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  white-space: nowrap;
  padding-top: 1px;
}

.mi-id { color: var(--cyan); font-weight: 700; }

.mi-teams {
  font-weight: 700;
  font-size: 0.89rem;
  margin-bottom: 9px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.mi-odds {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.mini-chip {
  font-size: 0.71rem;
  color: var(--text-soft);
  background: rgba(24, 34, 54, 0.75);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
}

/* Main Panel & Cards */
.main-panel { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.workspace-mode-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  flex-wrap: wrap;
}

.mode-tabs {
  display: inline-flex;
  background: rgba(6, 9, 17, 0.75);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 4px;
}

.mode-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s var(--ease);
}

.mode-tab:hover { color: var(--text-main); }
.mode-tab.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.22), rgba(56, 189, 248, 0.16));
  color: var(--text-main);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 0 1px rgba(16, 185, 129, 0.35);
}

.mode-badge {
  font-size: 0.7rem;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  color: var(--text-soft);
}

.mode-tab.active .mode-badge {
  background: rgba(16, 185, 129, 0.25);
  color: var(--emerald-bright);
}

.detail-back-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.card {
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.section-kicker {
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--cyan);
  margin-bottom: 3px;
}

.card-header h2, .card-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Scanner Grid */
.scanner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
  gap: 12px;
}

.scan-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(170deg, rgba(11, 16, 30, 0.85) 0%, rgba(6, 10, 19, 0.78) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 15px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: transform 0.18s var(--ease), border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.scan-card:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 14px 28px -12px rgba(0, 0, 0, 0.72), 0 0 20px -10px rgba(56, 189, 248, 0.25);
}

.scan-card.is-ev {
  border-color: rgba(16, 185, 129, 0.52);
  background: linear-gradient(165deg, rgba(16, 185, 129, 0.13) 0%, rgba(8, 13, 24, 0.86) 68%);
  box-shadow:
    inset 0 2px 0 rgba(52, 211, 153, 0.55),
    0 10px 26px -14px rgba(16, 185, 129, 0.32);
}

.sc-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.73rem;
  color: var(--text-muted);
}

.sc-rank {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 6px;
  min-width: 0;
  flex: 1;
}

.sc-time {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  white-space: nowrap;
  padding-top: 1px;
}

.sc-match {
  font-weight: 700;
  font-size: 0.94rem;
  letter-spacing: -0.01em;
}

.sc-tip {
  background: rgba(24, 34, 54, 0.65);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 11px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.sc-tip-sel { font-size: 0.84rem; font-weight: 600; }
.sc-tip-odds { font-size: 1rem; font-weight: 700; color: var(--amber); white-space: nowrap; }

.sc-metrics {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  font-size: 0.77rem;
  padding-top: 3px;
}

.sc-metrics-left {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  min-width: 0;
}

.match-hero {
  background:
    radial-gradient(ellipse at top right, rgba(16, 185, 129, 0.10), transparent 55%),
    radial-gradient(ellipse at bottom left, rgba(56, 189, 248, 0.08), transparent 55%),
    linear-gradient(165deg, rgba(17, 25, 43, 0.86) 0%, rgba(9, 14, 26, 0.82) 100%);
}

/* Match Hero */
.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.hero-left { flex: 1; min-width: 260px; }

.hero-badges {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.badge {
  font-size: 0.72rem;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 600;
  background: var(--bg-elev);
  border: 1px solid var(--border);
}

.badge-code { color: var(--cyan); background: var(--cyan-dim); border-color: rgba(56, 189, 248, 0.35); }
.badge-league { color: var(--amber); background: var(--amber-dim); border-color: rgba(245, 158, 11, 0.32); }
.badge-live { color: var(--rose); background: var(--rose-dim); border-color: rgba(251, 113, 133, 0.42); }
.badge-pre { color: var(--emerald-bright); background: var(--emerald-dim); border-color: rgba(16, 185, 129, 0.32); }

.hero-matchup {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.team-crest {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: inline-grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.95rem;
  flex-shrink: 0;
  overflow: hidden;
  padding: 5px;
  background: rgba(15, 23, 42, 0.85);
}

.team-crest.has-img {
  background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.14), rgba(10, 15, 28, 0.92));
  border-color: rgba(148, 163, 184, 0.28);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.team-crest-sm {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  padding: 2px;
  font-size: 0.65rem;
}

.team-crest-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.45));
}

.team-crest-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  line-height: 1;
}

.team-name-inline {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 7px;
  vertical-align: middle;
  min-width: 0;
  line-height: 1.35;
}

.team-unit,
.hero-team-unit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.hero-team-unit {
  gap: 10px;
}

.crest-home {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(16, 185, 129, 0.08));
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: var(--emerald-bright);
}

.crest-away {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(56, 189, 248, 0.08));
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: var(--cyan);
}

.hero-teams {
  margin: 0;
  font-size: 1.38rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.vs-pill {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.1);
}

.xg-summary-box {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(6, 9, 17, 0.72);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 18px;
}

.xg-item { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.xg-lbl { font-size: 0.71rem; color: var(--text-muted); }
.xg-item strong { font-size: 1.45rem; font-weight: 800; color: var(--cyan); }
.xg-tot-accent { color: var(--emerald-bright) !important; }
.xg-sep { font-size: 1.15rem; color: var(--text-muted); font-weight: 600; }
.xg-divider { width: 1px; height: 34px; background: var(--border); }

.inplay-banner {
  margin-top: 10px;
  padding: 7px 12px;
  border-radius: 9px;
  background: var(--rose-dim);
  border: 1px solid rgba(251, 113, 133, 0.35);
  color: #fecdd3;
  font-size: 0.82rem;
}

.situational-drawer {
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 11px;
}

.situational-drawer summary {
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  list-style: none;
}

.situational-drawer summary::-webkit-details-marker { display: none; }
.situational-drawer summary:hover { color: var(--text-main); }

.situational-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 10px;
  align-items: end;
}

.situational-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Recommendation Hero Cards with SVG Donut Gauge */
.picks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 14px;
}

.pick-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(165deg, rgba(17, 25, 43, 0.86) 0%, rgba(9, 14, 26, 0.82) 100%);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 17px 19px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.065),
    0 14px 30px -14px rgba(0, 0, 0, 0.65);
  transition: transform 0.18s var(--ease), border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.pick-card:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    0 18px 34px -14px rgba(0, 0, 0, 0.78);
}

.pick-card.primary-ev {
  border-color: rgba(16, 185, 129, 0.55);
  background: linear-gradient(155deg, rgba(16, 185, 129, 0.16) 0%, rgba(11, 17, 31, 0.88) 65%);
  box-shadow: inset 0 2px 0 rgba(52, 211, 153, 0.65), 0 14px 30px -14px rgba(16, 185, 129, 0.25);
}

.pick-card.steady {
  border-color: rgba(56, 189, 248, 0.48);
  background: linear-gradient(155deg, rgba(56, 189, 248, 0.12) 0%, rgba(11, 17, 31, 0.88) 65%);
  box-shadow: inset 0 2px 0 rgba(56, 189, 248, 0.6), 0 14px 30px -14px rgba(56, 189, 248, 0.22);
}

.pick-card.crs {
  border-color: rgba(245, 158, 11, 0.45);
  background: linear-gradient(155deg, rgba(245, 158, 11, 0.11) 0%, rgba(11, 17, 31, 0.88) 65%);
  box-shadow: inset 0 2px 0 rgba(245, 158, 11, 0.55), 0 14px 30px -14px rgba(245, 158, 11, 0.2);
}

.pick-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.pick-label {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--emerald-bright);
}
.pick-card.steady .pick-label { color: var(--cyan); }
.pick-card.crs .pick-label { color: var(--amber); }

.ev-pill {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
}
.ev-pill.pos { background: var(--emerald-dim); color: var(--emerald-bright); border: 1px solid rgba(16, 185, 129, 0.35); }
.ev-pill.warn { background: var(--amber-dim); color: var(--amber); border: 1px solid rgba(245, 158, 11, 0.35); }
.ev-pill.neg { background: var(--rose-dim); color: var(--rose); border: 1px solid rgba(251, 113, 133, 0.32); }

.pick-body-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.pick-main-info { flex: 1; min-width: 0; }
.pick-mkt-name { font-size: 0.76rem; color: var(--text-muted); margin-bottom: 3px; }
.pick-sel { font-size: 1.06rem; font-weight: 700; line-height: 1.3; margin-bottom: 6px; }
.odds-big { font-size: 1.38rem; font-weight: 800; color: var(--amber); }
.fair-sub { font-size: 0.75rem; color: var(--text-muted); margin-left: 6px; }

/* Circular SVG Gauge */
.gauge-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.gauge-svg {
  width: 72px;
  height: 72px;
  transform: rotate(-90deg);
}

.gauge-track {
  fill: none;
  stroke: rgba(148, 163, 184, 0.12);
  stroke-width: 4.2;
}

.gauge-progress {
  fill: none;
  stroke-width: 4.2;
  stroke-linecap: round;
  filter: drop-shadow(0 0 5px rgba(56, 189, 248, 0.25));
  transition: stroke-dashoffset 0.55s var(--ease);
}

.gauge-center {
  position: absolute;
  text-align: center;
  line-height: 1.1;
}

.gauge-pct { font-size: 0.85rem; font-weight: 800; color: var(--text-main); display: block; }
.gauge-lbl { font-size: 0.58rem; color: var(--text-muted); letter-spacing: 0.04em; }

.pick-breakdown {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(6, 9, 17, 0.52);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
}

.pick-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  font-size: 0.79rem;
  color: var(--text-muted);
}

.ev-pos { color: var(--emerald-bright); font-weight: 700; }
.ev-warn { color: var(--amber); font-weight: 700; }
.ev-neg { color: var(--rose); font-weight: 700; }

/* Two Col & Forms */
.two-col-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 18px;
}

.custom-grid {
  display: grid;
  grid-template-columns: 470px 1fr;
  gap: 20px;
  align-items: start;
}

.team-box, .odds-input-box {
  background: rgba(6, 9, 17, 0.45);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.odds-input-box { margin-top: 12px; }
.custom-form h4 { margin: 0 0 8px; font-size: 0.84rem; color: var(--cyan); }
.custom-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.75rem; color: var(--text-muted); margin-bottom: 8px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

/* Unified 1X2 Segmented Bar + Detailed Bars */
.segmented-1x2 {
  display: flex;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(6, 9, 17, 0.8);
  margin-bottom: 14px;
  gap: 2px;
}

.seg-part { height: 100%; transition: width 0.4s var(--ease); }

.prob-bar-item { margin-bottom: 10px; }
.prob-bar-head { display: flex; justify-content: space-between; font-size: 0.83rem; margin-bottom: 5px; }
.prob-bar-track { height: 7px; background: rgba(6, 9, 17, 0.8); border-radius: 999px; overflow: hidden; }
.prob-bar-val { height: 100%; border-radius: 999px; transition: width 0.4s var(--ease); }

.blend-compare {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(6, 9, 17, 0.56);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.8rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  text-align: center;
}

.exec-summary {
  margin: 12px 0 0;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-soft);
  background: rgba(6, 9, 17, 0.56);
  border-left: 3px solid var(--emerald);
  padding: 11px 13px;
  border-radius: 8px;
}

/* Team Form Blocks */
.team-form-block {
  background: rgba(6, 9, 17, 0.54);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px 13px;
  margin-bottom: 10px;
}

.tf-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.form-chips { display: inline-flex; gap: 4px; }
.fc {
  width: 22px; height: 22px; border-radius: 6px;
  display: inline-grid; place-items: center;
  font-size: 0.72rem; font-weight: 700;
}
.fc-W { background: var(--emerald-dim); color: var(--emerald-bright); border: 1px solid rgba(16, 185, 129, 0.25); }
.fc-D { background: var(--amber-dim); color: var(--amber); border: 1px solid rgba(245, 158, 11, 0.25); }
.fc-L { background: var(--rose-dim); color: var(--rose); border: 1px solid rgba(251, 113, 133, 0.25); }

.recent-mini-list {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 0.77rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Tables */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
.data-table th, .data-table td { padding: 10px 11px; border-bottom: 1px solid var(--border); text-align: left; }
.data-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  background: rgba(6, 9, 17, 0.35);
}
.data-table tbody tr { transition: background 0.12s var(--ease); }
.data-table tbody tr:hover td { background: rgba(56, 189, 248, 0.04); }

/* Heatmap Matrix */
.matrix-table { border-collapse: collapse; width: 100%; margin-top: 12px; font-size: 0.79rem; }
.matrix-table th, .matrix-table td { border: 1px solid var(--border); padding: 8px; text-align: center; }
.matrix-table th { background: rgba(6, 9, 17, 0.65); color: var(--text-muted); }

/* KPI Row */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.kpi-box {
  background: linear-gradient(175deg, rgba(13, 20, 36, 0.82) 0%, rgba(6, 10, 19, 0.72) 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 10px;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 0.16s var(--ease), transform 0.16s var(--ease);
}
.kpi-box:hover {
  border-color: rgba(56, 189, 248, 0.3);
  transform: translateY(-1px);
}
.kpi-box span { font-size: 0.72rem; color: var(--text-muted); display: block; margin-bottom: 3px; }
.kpi-box strong { font-size: 1.15rem; font-weight: 800; }

.pos-ev-banner {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 0.81rem;
  color: var(--text-soft);
  margin-bottom: 12px;
}

.equity-curve-box {
  background: rgba(6, 9, 17, 0.62);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.equity-svg { width: 100%; height: 130px; display: block; }

/* Animated Loading & Shimmer Skeletons */
.loading-hero-card {
  border-color: rgba(56, 189, 248, 0.35);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(14, 20, 34, 0.85));
}

.loading-spinner-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

.quant-spinner {
  position: relative;
  width: 54px;
  height: 54px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.quant-spinner .ring-outer,
.quant-spinner .ring-inner {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2.5px solid transparent;
}

.quant-spinner .ring-outer {
  border-top-color: var(--emerald-bright);
  border-right-color: rgba(16, 185, 129, 0.3);
  animation: spin-cw 0.95s linear infinite;
}

.quant-spinner .ring-inner {
  inset: 7px;
  border-bottom-color: var(--cyan);
  border-left-color: rgba(56, 189, 248, 0.3);
  animation: spin-ccw 1.25s linear infinite;
}

.quant-spinner .ring-core {
  font-size: 1.05rem;
  animation: pulse-scale 1.4s ease-in-out infinite;
}

.loading-copy h3 { margin: 2px 0 4px; font-size: 1.08rem; }

.loading-progress-track {
  margin-top: 14px;
  height: 5px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  overflow: hidden;
}

.loading-progress-bar {
  width: 42%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--emerald), var(--cyan), var(--emerald-bright));
  animation: slide-progress 1.35s ease-in-out infinite;
}

.skeleton-card {
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton-card.tall { min-height: 180px; }

.sk-line {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.10) 25%, rgba(148, 163, 184, 0.24) 50%, rgba(148, 163, 184, 0.10) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
}
.sk-line.lg { height: 22px; }
.sk-line.w-40 { width: 40%; }
.sk-line.w-50 { width: 50%; }
.sk-line.w-60 { width: 60%; }
.sk-line.w-65 { width: 65%; }
.sk-line.w-70 { width: 70%; }
.sk-line.w-75 { width: 75%; }
.sk-line.w-80 { width: 80%; }
.sk-line.w-85 { width: 85%; }
.sk-line.w-90 { width: 90%; }

.reveal-fade {
  animation: fadeIn 0.26s var(--ease);
}

@keyframes spin-cw { to { transform: rotate(360deg); } }
@keyframes spin-ccw { to { transform: rotate(-360deg); } }
@keyframes pulse-scale {
  0%, 100% { transform: scale(0.92); opacity: 0.85; }
  50% { transform: scale(1.1); opacity: 1; }
}
@keyframes slide-progress {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(260%); }
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.empty-state { padding: 34px 20px; text-align: center; color: var(--text-muted); font-size: 0.88rem; }

.toast {
  position: fixed;
  bottom: 22px;
  right: 26px;
  background: rgba(14, 20, 34, 0.94);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(16, 185, 129, 0.55);
  color: var(--text-main);
  padding: 11px 18px;
  border-radius: 11px;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 99;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
}

@media (max-width: 1040px) {
  .workspace-grid, .custom-grid { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: 440px; }
  .topbar, .nav-tabs-inner, .page-container { padding-left: 16px; padding-right: 16px; }
}

/* Mobile-only elements hidden by default on desktop */
.mobile-only-inline,
.btn-icon-mobile,
.mobile-param-bar,
.mobile-bottom-nav {
  display: none;
}

button,
.pill,
.nav-tab,
.mode-tab,
.match-item,
.scan-card,
.mobile-sheet-tile,
.mnav-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Mobile Action Sheet & Bottom Nav Base Styles */
.mobile-sheet-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.mobile-sheet-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 13px 8px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.72);
  color: var(--text-main);
  cursor: pointer;
  text-align: center;
  transition: transform 0.14s var(--ease), border-color 0.16s var(--ease), background 0.16s var(--ease);
}

.mobile-sheet-tile:active {
  transform: scale(0.96);
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.45);
}

.mobile-sheet-tile .tile-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.14);
  color: var(--cyan);
  margin-bottom: 2px;
}

.mobile-sheet-tile .tile-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
}

.mobile-sheet-tile .tile-sub {
  font-size: 0.67rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.mobile-sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mobile-sheet-actions .btn {
  justify-content: center;
  padding: 11px 12px;
}

@keyframes slideUpSheet {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
  /* 1. Compact Sticky Single-Row Topbar */
  .topbar {
    padding: 10px 14px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .brand { gap: 10px; min-width: 0; }
  .brand-icon { width: 36px; height: 36px; border-radius: 10px; }
  .brand h1 { font-size: 1rem; white-space: nowrap; }
  .badge-hkjc, .subtitle { display: none; }
  .badge-ver { font-size: 0.62rem; padding: 2px 6px; }

  .topbar-actions {
    width: auto;
    flex-wrap: nowrap;
    gap: 6px;
    justify-content: flex-end;
    align-items: center;
  }

  .status-pill {
    width: auto;
    padding: 6px 8px;
    border-radius: 999px;
    gap: 0;
  }

  #live-status-text,
  #btn-auto-refresh,
  #btn-scan-all,
  .btn-lbl-alerts,
  .btn-lbl-refresh {
    display: none;
  }

  #btn-open-alerts,
  #btn-refresh-live,
  .btn-icon-mobile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 7px 10px;
    min-height: 36px;
    font-size: 0.85rem;
    border-radius: 10px;
  }

  #btn-open-alerts .mini-count {
    font-size: 0.68rem;
    padding: 1px 5px;
  }

  /* 2. Replace top tab rail with bottom bar + collapsible model param bar */
  .nav-tabs { position: static; }
  .nav-tabs-inner { padding: 8px 12px; gap: 8px; }
  .tab-rail { display: none; }

  .mobile-param-bar {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 11px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(11, 16, 30, 0.78);
    color: var(--text-main);
    font-size: 0.75rem;
    cursor: pointer;
  }

  .mobile-param-chevron {
    color: var(--emerald-bright);
    font-weight: 700;
    font-size: 0.72rem;
    flex-shrink: 0;
  }

  .nav-controls {
    display: none;
    width: 100%;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(11, 16, 30, 0.9);
    border: 1px solid rgba(56, 189, 248, 0.22);
  }

  .nav-controls.mobile-open {
    display: grid;
  }

  .nav-controls .ctrl-sep { display: none; }
  .nav-controls .ctrl-inline {
    justify-content: space-between;
    background: rgba(6, 9, 17, 0.55);
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.12);
  }
  .nav-controls .risk-pill {
    grid-column: 1 / -1;
    text-align: center;
    justify-content: center;
  }

  /* 3. Single-Pane Live Workspace Switching on Mobile */
  .workspace-mode-bar,
  .mode-hint {
    display: none;
  }

  .mobile-only-inline {
    display: inline-flex;
  }

  #view-live[data-mobile-pane="matches"] #live-main-panel {
    display: none;
  }

  #view-live[data-mobile-pane="matches"] #live-sidebar {
    display: flex;
    max-height: none;
    position: static;
  }

  #view-live[data-mobile-pane="scanner"] #live-sidebar,
  #view-live[data-mobile-pane="parlays"] #live-sidebar,
  #view-live[data-mobile-pane="detail"] #live-sidebar {
    display: none;
  }

  .match-list {
    max-height: none;
    overflow-y: visible;
  }

  /* 4. Page & Content Spacing (Leave Safe Space for Bottom Bar) */
  .page-container {
    padding: 12px 12px calc(90px + env(safe-area-inset-bottom));
  }

  .dev-footer {
    padding: 10px 14px calc(90px + env(safe-area-inset-bottom));
    font-size: 0.72rem;
    text-align: center;
  }

  .watermark-corner {
    bottom: calc(76px + env(safe-area-inset-bottom));
    left: 10px;
    font-size: 0.64rem;
  }

  .toast {
    bottom: calc(84px + env(safe-area-inset-bottom));
    left: 14px;
    right: 14px;
    transform: none;
    text-align: center;
  }

  .card { padding: 14px; border-radius: 14px; }
  .card-header { flex-direction: column; align-items: stretch; gap: 10px; }
  .two-col-grid, .picks-grid, .scanner-grid, .featured-parlays-grid { grid-template-columns: 1fr; }
  .hero-teams { font-size: 1.08rem; }
  .team-crest { width: 34px; height: 34px; font-size: 0.85rem; }
  .team-crest-sm { width: 18px; height: 18px; padding: 2px; border-radius: 5px; font-size: 0.62rem; }
  .xg-summary-box { width: 100%; justify-content: space-around; padding: 10px 12px; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .parlay-metrics-strip { grid-template-columns: 1fr 1fr; }
  .parlay-metrics-strip .parlay-metric-box:last-child { grid-column: 1 / -1; }
  .form-row-2 { grid-template-columns: 1fr; }
  .pill-group { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .blend-compare { grid-template-columns: 1fr; gap: 6px; text-align: left; }
  .detail-back-bar { flex-wrap: wrap; gap: 8px; }

  /* Horizontal scroll safety for tables on small screens */
  #all-pools-body,
  #hist-table-wrap,
  #bets-table-wrap,
  #backtest-results,
  .breakdown-card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Prevent iOS Safari input auto-zoom */
  .input-field,
  .select-field,
  .input-compact,
  .select-compact,
  .search-input {
    font-size: 16px;
  }

  /* 5. Native Bottom Sheet Modals on Mobile */
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal-panel {
    width: 100% !important;
    max-width: 100%;
    max-height: 90dvh;
    border-radius: 22px 22px 0 0;
    padding: 14px 16px calc(22px + env(safe-area-inset-bottom));
    animation: slideUpSheet 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .modal-panel::before {
    content: "";
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.36);
    margin: 0 auto 12px;
  }

  /* 6. Fixed Frosted Bottom Navigation Bar */
  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 95;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: stretch;
    background: rgba(7, 11, 22, 0.92);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border-top: 1px solid rgba(148, 163, 184, 0.16);
    padding: 6px 6px calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.45);
  }

  .mnav-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 4px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.16s var(--ease), background 0.16s var(--ease), transform 0.12s var(--ease);
  }

  .mnav-btn:active {
    transform: scale(0.93);
  }

  .mnav-btn.active {
    color: var(--emerald-bright);
    background: rgba(16, 185, 129, 0.10);
  }

  .mnav-btn.active::before {
    content: "";
    position: absolute;
    top: -6px;
    width: 26px;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--emerald-bright), var(--cyan));
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.65);
  }

  .mnav-ico-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
  }

  .mnav-ico {
    font-size: 1.2rem;
    line-height: 1;
  }

  .mnav-lbl {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.1;
  }

  .mnav-badge {
    position: absolute;
    top: -5px;
    right: -13px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: linear-gradient(135deg, #10b981, #0ea5e9);
    color: #04130e;
    font-size: 0.6rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  }

  .mnav-dot {
    position: absolute;
    top: -2px;
    right: -6px;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--amber);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.85);
  }
}

@media (max-width: 400px) {
  .mobile-sheet-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- v2.4.0-dev Quantitative Expansion Styles --- */
.badge-ver {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--cyan);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.mini-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.22);
  color: var(--amber);
  font-size: 0.7rem;
  font-weight: 700;
}

.input-compact {
  width: 82px;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(6, 9, 17, 0.72);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 600;
}

.risk-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.12);
  color: var(--emerald-bright);
  border: 1px solid rgba(16, 185, 129, 0.28);
}

.risk-pill.warn {
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber);
  border-color: rgba(245, 158, 11, 0.4);
}

.risk-pill.over {
  background: rgba(251, 113, 133, 0.16);
  color: #fb7185;
  border-color: rgba(251, 113, 133, 0.45);
}

.btn-auto-on {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: rgba(16, 185, 129, 0.6) !important;
  color: var(--emerald-bright) !important;
}

.watch-star {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  padding: 0 3px;
  color: var(--text-muted);
  transition: transform 0.14s ease, color 0.14s ease;
}

.watch-star:hover { transform: scale(1.15); color: var(--amber); }
.watch-star.active { color: var(--amber); }

.steam-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.66rem;
  font-weight: 700;
  background: rgba(251, 146, 60, 0.18);
  color: #fdba74;
  border: 1px solid rgba(251, 146, 60, 0.4);
}

.steam-banner {
  margin-top: 8px;
  padding: 7px 12px;
  border-radius: 9px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fde68a;
  font-size: 0.8rem;
}

.prematch-archive-card {
  border-color: rgba(56, 189, 248, 0.48) !important;
  background: linear-gradient(145deg, rgba(56, 189, 248, 0.10) 0%, rgba(14, 20, 34, 0.88) 70%) !important;
  padding: 16px 18px !important;
  margin-bottom: 14px;
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.archive-slot {
  background: rgba(6, 9, 17, 0.55);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 10px 12px;
}

.hkd-stake {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.74rem;
  color: var(--emerald-bright);
  font-weight: 600;
}

.corr-warn-chip {
  margin-top: 4px;
  padding: 4px 8px;
  border-radius: 7px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.32);
  color: #fde68a;
  font-size: 0.72rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 14, 0.74);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 120;
}

.modal-panel {
  width: min(720px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.alert-form-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.alert-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.alert-form-grid .chk-row {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
  font-size: 0.84rem;
  cursor: pointer;
}

.tunnel-tip-box {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  font-size: 0.76rem;
  line-height: 1.5;
}

.parlay-leg-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(6, 9, 17, 0.55);
  border: 1px solid var(--border);
  margin-bottom: 8px;
}

.breakdown-panel {
  margin: 14px 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}

.breakdown-card {
  background: rgba(6, 9, 17, 0.45);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}

.breakdown-card h4 {
  margin: 0 0 8px 0;
  font-size: 0.85rem;
  color: var(--text-main);
}

.dev-footer {
  max-width: 1440px;
  margin: 0 auto;
  padding: 12px 26px 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  font-size: 0.74rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(148, 163, 184, 0.08);
}

/* Featured Parlays Panel */
.featured-parlays-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 14px;
}

.featured-parlay-card {
  background: rgba(6, 9, 17, 0.56);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.featured-parlay-card.is-ev {
  border-color: rgba(16, 185, 129, 0.52);
  background: linear-gradient(155deg, rgba(16, 185, 129, 0.11) 0%, rgba(10, 15, 28, 0.88) 70%);
}

.parlay-metrics-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.parlay-metric-box {
  background: rgba(14, 20, 34, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 9px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.parlay-metric-box span {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.parlay-metric-box strong {
  font-size: 0.95rem;
}

.parlay-leg-pill {
  width: 100%;
  text-align: left;
  background: rgba(14, 20, 34, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 10px;
  padding: 9px 11px;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.parlay-leg-pill:hover {
  border-color: rgba(56, 189, 248, 0.55);
  transform: translateY(-1px);
}

.parlay-risk-bar {
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.10);
  border: 1px solid rgba(245, 158, 11, 0.28);
  color: #fde68a;
  font-size: 0.74rem;
  line-height: 1.4;
}

.chk-inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(6, 9, 17, 0.45);
}

.chk-inline:hover { color: var(--text-main); border-color: rgba(56, 189, 248, 0.45); }

/* Custom Multi-Match Parlay Builder */
.cpb-section {
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
  border-color: rgba(56, 189, 248, 0.25);
  background: linear-gradient(165deg, rgba(16, 25, 44, 0.85) 0%, rgba(8, 12, 24, 0.82) 100%);
}

.cpb-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.cpb-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.cpb-match-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 8px;
  max-height: 235px;
  overflow-y: auto;
  padding: 2px 2px 6px;
}

.cpb-match-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(6, 9, 17, 0.6);
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), transform 0.12s var(--ease);
}

.cpb-match-item:hover {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(20, 30, 50, 0.72);
}

.cpb-match-item.selected {
  border-color: rgba(16, 185, 129, 0.65);
  background: linear-gradient(100deg, rgba(16, 185, 129, 0.16) 0%, rgba(14, 22, 38, 0.86) 80%);
  box-shadow: inset 3px 0 0 var(--emerald-bright);
}

.cpb-check-box {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid rgba(148, 163, 184, 0.45);
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 800;
  color: #032217;
}

.cpb-match-item.selected .cpb-check-box {
  background: var(--emerald-bright);
  border-color: var(--emerald-bright);
}

.cpb-controls {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cpb-divider-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 12px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.cpb-divider-label::before,
.cpb-divider-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.cpb-leg-block {
  background: rgba(14, 20, 34, 0.76);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 10px;
  padding: 10px 12px;
}

.cpb-alt-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px dashed rgba(148, 163, 184, 0.14);
}

.cpb-alt-pill {
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(6, 9, 17, 0.55);
  color: var(--text-soft);
  border-radius: 7px;
  padding: 3px 8px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.14s var(--ease);
}

.cpb-alt-pill:hover {
  border-color: rgba(56, 189, 248, 0.55);
  color: var(--text-main);
}

.cpb-alt-pill.active {
  border-color: rgba(16, 185, 129, 0.65);
  background: rgba(16, 185, 129, 0.16);
  color: var(--emerald-bright);
  font-weight: 700;
}

.scan-card.is-edge {
  border-color: rgba(56, 189, 248, 0.5) !important;
  background: linear-gradient(155deg, rgba(56, 189, 248, 0.10) 0%, rgba(14, 20, 34, 0.85) 70%);
}

.edge-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(56, 189, 248, 0.16);
  color: var(--cyan);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.timeline-card {
  margin-bottom: 14px;
  border-color: rgba(16, 185, 129, 0.35) !important;
  background: linear-gradient(150deg, rgba(16, 185, 129, 0.06) 0%, rgba(14, 20, 34, 0.88) 70%) !important;
  padding: 16px 18px !important;
}

.timeline-compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.timeline-list {
  margin-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 170px;
  overflow-y: auto;
}

.timeline-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  padding: 5px 8px;
  border-radius: 7px;
  background: rgba(6, 9, 17, 0.48);
}
