/* ==========================================
   超级大乐透 · 数据分析与智能预测
   Design System & Component Styles
   ========================================== */

/* ========== CSS Variables ========== */
:root {
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 50%;

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 0.5s cubic-bezier(0.16, 1, 0.3, 1);

  /* Shadows */
  --shadow-card: 0 12px 40px rgba(0, 0, 0, 0.35);
  --shadow-ball: 0 6px 16px rgba(0, 0, 0, 0.35);

  /* Font */
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ========== Theme Configurations ========== */
/* 1. Super Lotto Theme (Emerald Dark Green) */
/* ========== Theme Configurations ========== */
/* 1. Default & Super Lotto Theme (Emerald Dark Green) */
:root,
body,
body.theme-dlt {
  --bg-primary: #060a08;
  --bg-secondary: #0c120f;
  --bg-tertiary: #131d18;
  --card-bg: rgba(12, 18, 15, 0.5);
  --card-bg-hover: rgba(19, 29, 24, 0.65);
  --card-border: rgba(0, 255, 157, 0.08);
  --card-border-hover: rgba(0, 255, 157, 0.22);

  --text-primary: #f0f7f4;
  --text-secondary: #a4b8ad;
  --text-muted: #728a7e;

  --accent: #00ff9d;
  --accent-dim: rgba(0, 255, 157, 0.12);

  --front-start: #ff4d4f;
  --front-end: #cf1322;
  --front-glow: rgba(255, 77, 79, 0.3);
  --back-start: #1890ff;
  --back-end: #096dd9;
  --back-glow: rgba(24, 144, 255, 0.3);

  --hot: #ff4d4f;
  --cold: #1890ff;
  --warm: #faad14;
  --success: #52c41a;
  --warning: #faad14;
  --danger: #ff4d4f;

  --shadow-glow-front: 0 0 16px rgba(255, 77, 79, 0.22);
  --shadow-glow-back: 0 0 16px rgba(24, 144, 255, 0.22);
}

/* 2. PL3 Theme (Amber Wealth Gold) */
body.theme-pl3 {
  --bg-primary: #0f0c08;
  --bg-secondary: #17120c;
  --bg-tertiary: #221a11;
  --card-bg: rgba(23, 18, 12, 0.55);
  --card-bg-hover: rgba(34, 26, 17, 0.7);
  --card-border: rgba(251, 191, 36, 0.08);
  --card-border-hover: rgba(251, 191, 36, 0.22);

  --text-primary: #fbf9f5;
  --text-secondary: #c9bfb1;
  --text-muted: #8c8273;

  --accent: #ffb700;
  --accent-dim: rgba(255, 183, 0, 0.12);

  --front-start: #ffb700;
  --front-end: #e65c00;
  --front-glow: rgba(255, 183, 0, 0.3);
  --back-start: #facc15;
  --back-end: #ca8a04;
  --back-glow: rgba(250, 204, 21, 0.25);

  --hot: #ff3b30;
  --cold: #007aff;
  --warm: #ffb700;
  --success: #ffacc8;
  --warning: #ffb700;
  --danger: #ff3b30;

  --shadow-glow-front: 0 0 16px rgba(255, 183, 0, 0.22);
  --shadow-glow-back: 0 0 16px rgba(250, 204, 21, 0.2);
}

/* 3. World Cup Theme (Tri-Nation Fusion - US Blue, Canada Red, Mexico Green) */


/* ========== Reset & Base ========== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary); /* Use theme-specific bg-primary by default */
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--transition-slow);
}

body.theme-dlt {
  background:
    linear-gradient(180deg, rgba(0, 255, 157, 0.04), transparent 400px),
    var(--bg-primary);
}

body.theme-pl3 {
  background:
    linear-gradient(180deg, rgba(255, 183, 0, 0.03), transparent 400px),
    var(--bg-primary);
}


/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* ========== App Container ========== */
.app {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 var(--space-md) var(--space-2xl) var(--space-md);
  min-height: 100vh;
  background: transparent; /* Inherits body background */
}

/* ========== Header ========== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(6, 10, 8, 0.65);
  border-bottom: 1px solid var(--card-border);
  margin-bottom: var(--space-lg);
  padding: var(--space-md) 0;
  transition: background var(--transition-slow), border-color var(--transition-slow);
  width: 100%;
}

body.theme-dlt .header {
  background: rgba(6, 10, 8, 0.65);
}

body.theme-pl3 .header {
  background: rgba(15, 12, 8, 0.65);
}


.header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.logo-icon {
  display: flex;
  align-items: center;
  position: relative;
  width: 50px;
  height: 34px;
  animation: pulse 3s ease-in-out infinite;
}

.logo-ball-red,
.logo-ball-blue {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 800;
  color: #fff;
  position: absolute;
}

.logo-ball-red {
  background: linear-gradient(135deg, var(--front-start), var(--front-end));
  left: 0;
  top: 4px;
  z-index: 2;
  box-shadow: var(--shadow-glow-front), 0 3px 6px rgba(0, 0, 0, 0.3);
}

.logo-ball-blue {
  background: linear-gradient(135deg, var(--back-start), var(--back-end));
  right: 0;
  top: 4px;
  z-index: 1;
  box-shadow: var(--shadow-glow-back), 0 3px 6px rgba(0, 0, 0, 0.3);
}

.logo-text h1 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--accent), var(--front-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0;
}

.logo-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.data-badge {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.8rem;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

.badge-dot.error {
  background: var(--danger);
}

.update-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}


/* ========== Navigation Tabs ========== */
.nav-tabs {
  display: flex;
  gap: var(--space-xs);
  padding: var(--space-sm) 0;
  margin-bottom: var(--space-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-normal);
  white-space: nowrap;
  min-height: 42px;
}

.nav-tab svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-tab:hover {
  background: var(--card-bg-hover);
  color: var(--text-primary);
  border-color: var(--card-border);
}

.nav-tab.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(49, 217, 151, 0.25);
}

/* ========== Sections ========== */
.section {
  display: none;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.section.active {
  display: block;
}

/* Home Section Column Layouts */
.home-left-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.home-left-col .card {
  margin-bottom: 0;
}

/* Desktop Grid Layout for Home Section */
@media (min-width: 1024px) {
  #sectionHome.section.active {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: var(--space-lg);
    align-items: stretch;
  }

  .home-left-col {
    grid-column: 1;
    height: 100%;
    justify-content: space-between;
    margin-bottom: 0;
  }

  #sectionHome.section.active .recent-draws.card {
    grid-column: 2;
    height: 100%;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
  }

  #sectionHome.section.active .recent-draws.card .draws-list {
    flex-grow: 1;
    justify-content: space-between;
  }

  #sectionHome.section.active .prize-rules.card {
    grid-column: 1 / span 2;
    margin-bottom: 0;
  }
}

/* ========== Cards ========== */
.card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.05), 0 8px 32px rgba(0, 0, 0, 0.24);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal), background var(--transition-normal);
}

.card:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border-color: var(--card-border-hover);
  box-shadow: inset 0 1px 1.5px rgba(255, 255, 255, 0.08), var(--shadow-card);
}

.empty-state,
.error-state {
  border: 1px dashed var(--card-border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.9rem;
  padding: var(--space-lg);
  text-align: center;
}

.error-state {
  border-color: rgba(239, 68, 68, 0.32);
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.06);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.card-header h2 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card-header h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ========== Lottery Balls ========== */
.ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  position: relative;
  cursor: pointer;
  user-select: none;
  border: none;
  transition: box-shadow var(--transition-fast), filter var(--transition-fast);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
}

.ball.front {
  background: radial-gradient(circle at 35% 35%, var(--front-start) 4%, var(--front-end) 85%);
  box-shadow:
    inset -3px -3px 8px rgba(0, 0, 0, 0.4),
    inset 3px 3px 8px rgba(255, 255, 255, 0.25),
    var(--shadow-glow-front);
}

.ball.front:hover {
  box-shadow:
    inset -3px -3px 8px rgba(0, 0, 0, 0.4),
    inset 3px 3px 8px rgba(255, 255, 255, 0.35),
    0 0 20px var(--front-start);
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.45));
}

.ball.back {
  background: radial-gradient(circle at 35% 35%, var(--back-start) 4%, var(--back-end) 85%);
  box-shadow:
    inset -3px -3px 8px rgba(0, 0, 0, 0.4),
    inset 3px 3px 8px rgba(255, 255, 255, 0.25),
    var(--shadow-glow-back);
}

.ball.back:hover {
  box-shadow:
    inset -3px -3px 8px rgba(0, 0, 0, 0.4),
    inset 3px 3px 8px rgba(255, 255, 255, 0.35),
    0 0 20px var(--back-start);
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.45));
}

/* 3D highlight */
.ball::before {
  content: '';
  position: absolute;
  top: 5px;
  left: 10px;
  width: 14px;
  height: 8px;
  background: radial-gradient(ellipse, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.05) 80%);
  border-radius: 50%;
}

.ball.small {
  width: 36px;
  height: 36px;
  font-size: 0.85rem;
}

.ball.small::before {
  top: 4px;
  left: 8px;
  width: 12px;
  height: 7px;
}

.ball.mini {
  width: 30px;
  height: 30px;
  font-size: 0.75rem;
  animation: none;
}

.ball.mini::before {
  top: 3px;
  left: 7px;
  width: 10px;
  height: 6px;
}

.ball-row {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  flex-wrap: wrap;
}

.table-balls {
  gap: 4px;
}

/* ========== Latest Draw (Hero) ========== */
.latest-draw {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--card-border);
  position: relative;
  overflow: hidden;
  box-shadow: 
    inset 0 1px 1px rgba(255, 255, 255, 0.05),
    0 8px 32px rgba(0, 0, 0, 0.24);
  transition: all var(--transition-normal);
}

.latest-draw::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, var(--accent-dim) 0%, transparent 70%);
  z-index: 0;
  pointer-events: none;
  opacity: 0.8;
  transition: opacity var(--transition-normal);
}

.latest-draw:hover::before {
  opacity: 1.0;
}

.draw-result {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-lg) 0;
  position: relative;
  z-index: 1;
}

.draw-result-row {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: 16px 24px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.03);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal), background var(--transition-normal);
}

.draw-result-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.draw-result-row.front-row {
  border-left: 4px solid var(--front-start);
  background: linear-gradient(90deg, rgba(255, 77, 79, 0.04) 0%, rgba(255, 77, 79, 0.005) 100%);
  border-color: rgba(255, 77, 79, 0.1) rgba(255, 77, 79, 0.06) rgba(255, 77, 79, 0.06) var(--front-start);
}

.draw-result-row.front-row:hover {
  border-color: rgba(255, 77, 79, 0.22) rgba(255, 77, 79, 0.12) rgba(255, 77, 79, 0.12) var(--front-start);
  box-shadow: 0 6px 16px rgba(255, 77, 79, 0.08);
}

.draw-result-row.back-row {
  border-left: 4px solid var(--back-start);
  background: linear-gradient(90deg, rgba(24, 144, 255, 0.04) 0%, rgba(24, 144, 255, 0.005) 100%);
  border-color: rgba(24, 144, 255, 0.1) rgba(24, 144, 255, 0.06) rgba(24, 144, 255, 0.06) var(--back-start);
}

.draw-result-row.back-row:hover {
  border-color: rgba(24, 144, 255, 0.22) rgba(24, 144, 255, 0.12) rgba(24, 144, 255, 0.12) var(--back-start);
  box-shadow: 0 6px 16px rgba(24, 144, 255, 0.08);
}

.theme-pl3 .draw-result-row.front-row {
  border-left: 4px solid var(--accent);
  background: linear-gradient(90deg, rgba(255, 183, 0, 0.04) 0%, rgba(255, 183, 0, 0.005) 100%);
  border-color: rgba(255, 183, 0, 0.1) rgba(255, 183, 0, 0.06) rgba(255, 183, 0, 0.06) var(--accent);
}

.theme-pl3 .draw-result-row.front-row:hover {
  border-color: rgba(255, 183, 0, 0.22) rgba(255, 183, 0, 0.12) rgba(255, 183, 0, 0.12) var(--accent);
  box-shadow: 0 6px 16px rgba(255, 183, 0, 0.08);
}

.zone-label {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  min-width: 60px;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}

.zone-label.front-zone {
  color: #fff;
  background: rgba(255, 77, 79, 0.18);
  border: 1px solid rgba(255, 77, 79, 0.35);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.zone-label.back-zone {
  color: #fff;
  background: rgba(24, 144, 255, 0.18);
  border: 1px solid rgba(24, 144, 255, 0.35);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.zone-divider {
  display: none;
}

.draw-info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.draw-issue {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
}

.draw-date {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.draw-meta-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--card-border);
  padding-top: var(--space-md);
  margin-top: var(--space-md);
}

.draw-extra {
  display: flex;
  gap: var(--space-xl);
}

.extra-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.extra-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.extra-value {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
}

/* ========== Countdown ========== */
.countdown {
  background: linear-gradient(135deg, rgba(49, 217, 151, 0.06), rgba(54, 197, 240, 0.04));
}

.countdown-timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

.countdown-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 68px;
}

.countdown-value {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-primary);
  background: linear-gradient(180deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

.countdown-text {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.countdown-sep {
  font-family: var(--font-heading);
  font-size: 2rem;
  color: var(--text-muted);
  margin-top: -12px;
  animation: pulse 1s ease-in-out infinite;
}

.countdown-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: var(--accent-dim);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
}

.countdown-live {
  font-size: 1.5rem;
  color: var(--danger);
  font-weight: 600;
  animation: pulse 1s ease-in-out infinite;
}

.theme-pl3 .draw-result {
  justify-content: flex-start;
}

.theme-pl3 #latestFront {
  justify-content: flex-start;
}

/* ========== Recent Draws List ========== */
.draws-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.draw-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

.draw-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--card-border);
}

.draw-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 120px;
}

.draw-item-issue {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.draw-item-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.draw-item-balls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.draw-item-plus {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 0 2px;
}

/* ========== Data Table ========== */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table thead {
  border-bottom: 2px solid var(--card-border);
}

.data-table th {
  padding: var(--space-md);
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.data-table td {
  padding: var(--space-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.issue-num {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--accent);
}

/* ========== Pagination ========== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding-top: var(--space-lg);
  flex-wrap: wrap;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.page-btn:hover:not(.disabled):not(.active) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.page-btn.active {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
  font-weight: 600;
}

.page-btn.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.page-ellipsis {
  color: var(--text-muted);
  padding: 0 4px;
}

/* ========== Search Bar ========== */
.search-bar {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.search-input,
.search-select {
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  transition: border-color var(--transition-fast);
  outline: none;
}

.search-input:focus,
.search-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-select {
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.search-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* ========== Stats Overview ========== */
.stats-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.stat-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
}

.stat-icon {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 800;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.stat-icon.hot {
  background: rgba(239, 68, 68, 0.15);
  color: var(--hot);
}

.stat-icon.cold {
  background: rgba(59, 130, 246, 0.15);
  color: var(--cold);
}

.stat-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

/* ========== Sub Tabs ========== */
.sub-tabs {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--space-xs);
}

.sub-tab {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.sub-tab:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.sub-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-primary);
  font-weight: 600;
}

.sub-note {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ========== Stat Panels ========== */
.stat-panel {
  display: none;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.stat-panel.active {
  display: block;
}

.frequency-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-sm);
  margin: calc(-1 * var(--space-sm)) 0 var(--space-md);
}

.frequency-chip {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-sm);
  min-height: 42px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.035);
  padding: 8px 10px;
  font-size: 0.78rem;
  min-width: 0;
}

.frequency-chip span {
  color: var(--text-muted);
}

.frequency-chip strong {
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.frequency-chip em {
  color: var(--text-secondary);
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.frequency-chip.hot {
  border-color: rgba(239, 68, 68, 0.2);
}

.frequency-chip.cold {
  border-color: rgba(59, 130, 246, 0.2);
}

.frequency-chip.avg {
  border-color: rgba(49, 217, 151, 0.22);
}

/* ========== Chart Container ========== */
.chart-container {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.2);
  padding: var(--space-md);
  min-height: 240px;
}

.chart-container canvas {
  width: 100% !important;
  height: auto !important;
}

.chart-pie-container {
  max-width: 450px;
  margin: 0 auto;
}

/* ========== Hot/Cold Grid ========== */
.hotcold-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: var(--space-sm);
}

.heatmap-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: var(--space-md) var(--space-sm);
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  transition: all var(--transition-fast);
  cursor: default;
}

.heatmap-cell.hot {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
}

.heatmap-cell.cold {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
}

.heatmap-cell.warm {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.2);
}

.heatmap-cell:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.cell-num {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
}

.heatmap-cell.hot .cell-num { color: var(--hot); }
.heatmap-cell.cold .cell-num { color: var(--cold); }
.heatmap-cell.warm .cell-num { color: var(--warm); }

/* ========== Tags ========== */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tag.hot {
  background: rgba(239, 68, 68, 0.2);
  color: var(--hot);
}

.tag.cold {
  background: rgba(59, 130, 246, 0.2);
  color: var(--cold);
}

.tag.warm {
  background: rgba(245, 158, 11, 0.2);
  color: var(--warm);
}

/* ========== Sum Stats ========== */
.sum-stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-md);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--card-border);
  margin-top: var(--space-lg);
}

.sum-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.sum-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sum-stat-value {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
}

/* ========== Trend Number Selector ========== */
.trend-nums {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--space-lg);
}

.trend-num-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.trend-num-btn:hover {
  border-color: var(--front-end);
  color: var(--front-end);
}

.trend-num-btn.active {
  background: linear-gradient(145deg, var(--front-start), var(--front-end));
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-glow-front);
}

/* ========== Prediction Section ========== */
.predict-header {
  background: linear-gradient(135deg, rgba(49, 217, 151, 0.08), rgba(54, 197, 240, 0.04));
}

.predict-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: -var(--space-sm);
}

.predict-actions {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  flex-wrap: wrap;
}

.strategy-selector {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.predictions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.prediction-card {
  animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.prediction-card.pred-high {
  border-color: rgba(34, 197, 94, 0.35);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.12);
}

.prediction-card.pred-balanced {
  border-color: rgba(251, 191, 36, 0.30);
}

.prediction-card.pred-aggressive {
  border-color: rgba(249, 115, 22, 0.30);
}

.pred-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.pred-label {
  font-size: 0.9rem;
  font-weight: 600;
  min-width: 0;
}

.pred-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.pred-confidence {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 8px;
  color: var(--conf-color, #fff);
  background: color-mix(in srgb, var(--conf-color) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--conf-color) 35%, transparent);
  white-space: nowrap;
}

.pred-num {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  padding: 2px 10px;
  border-radius: 10px;
}

.ball.ball-warn {
  position: relative;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.55), 0 0 12px rgba(249, 115, 22, 0.35);
  animation: warnPulse 2.4s ease-in-out infinite;
}

.warn-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f97316;
  box-shadow: 0 0 4px rgba(249, 115, 22, 0.9);
}

@keyframes warnPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.45), 0 0 8px rgba(249, 115, 22, 0.25); }
  50% { box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.85), 0 0 18px rgba(249, 115, 22, 0.55); }
}

.pred-overkill-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: var(--space-md);
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(249, 115, 22, 0.08);
  border: 1px solid rgba(249, 115, 22, 0.25);
  font-size: 0.78rem;
  color: #fdba74;
  line-height: 1.5;
}

.overkill-icon {
  color: #f97316;
  font-size: 0.95rem;
}

.pred-balls {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.pred-zone {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-width: 0;
}

.zone-tag {
  font-size: 0.7rem;
  color: var(--text-muted);
  min-width: 32px;
  flex: 0 0 auto;
}

.pred-reasoning {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--card-border);
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.prediction-card .ball-row {
  flex-wrap: wrap;
  min-width: 0;
}

.prediction-card .ball {
  width: 42px;
  height: 42px;
  font-size: 1rem;
}

.prediction-card .ball::before {
  top: 5px;
  left: 10px;
  width: 13px;
  height: 8px;
}

.prediction-history {
  margin-bottom: var(--space-lg);
}

.prediction-history-list {
  display: grid;
  gap: var(--space-md);
}

.prediction-history-item {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.035);
  padding: var(--space-md);
}

.history-record-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.history-record-head h3 {
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.history-record-head p {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.history-status {
  flex: 0 0 auto;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  color: var(--text-secondary);
  font-size: 0.72rem;
}

.history-status.reviewed {
  border-color: rgba(16, 185, 129, 0.35);
  color: var(--success);
  background: rgba(16, 185, 129, 0.08);
}

.history-record-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
  flex: 0 0 auto;
  flex-wrap: wrap;
}

.history-copy-btn {
  min-height: 28px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.72rem;
  padding: 4px 9px;
  transition: all var(--transition-fast);
}

.history-copy-btn:hover,
.history-copy-btn.copied {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.prediction-history-tickets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: var(--space-sm);
}

.prediction-history-ticket {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  background: rgba(10, 14, 26, 0.36);
  padding: var(--space-sm);
}

.history-ticket-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  color: var(--text-secondary);
  font-size: 0.75rem;
  min-width: 0;
}

.history-ticket-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-ticket-meta strong {
  color: var(--text-primary);
  font-weight: 600;
  white-space: nowrap;
}

.history-ticket-meta strong.win {
  color: var(--success);
}

.history-ticket-balls {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.history-ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  box-shadow: var(--shadow-ball);
}

.history-ball.front {
  background: linear-gradient(135deg, var(--front-start), var(--front-end));
}

.history-ball.back {
  background: linear-gradient(135deg, var(--back-start), var(--back-end));
}

.history-ball.match {
  outline: 2px solid var(--success);
  outline-offset: 2px;
}

.history-plus {
  color: var(--text-muted);
  font-weight: 700;
  margin: 0 2px;
}

.history-review-summary {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  background: rgba(10, 14, 26, 0.28);
  margin-bottom: var(--space-sm);
  padding: var(--space-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.history-review-summary strong {
  display: block;
  font-size: 0.86rem;
}

.review-kicker {
  color: var(--text-muted);
  display: block;
  font-size: 0.72rem;
  margin-bottom: 3px;
}

.review-draw-balls {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.history-ticket-reason {
  color: var(--text-secondary);
  font-size: 0.76rem;
  line-height: 1.55;
  margin: 0;
}

.history-ticket-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--space-sm);
}

.review-tag {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.68rem;
  line-height: 1;
  padding: 4px 6px;
}

.review-tag.win {
  border-color: rgba(16, 185, 129, 0.32);
  color: var(--success);
  background: rgba(16, 185, 129, 0.08);
}
.history-ticket-reason {
  margin-top: var(--space-sm);
}

.history-overkill-review {
  margin: var(--space-md) 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(249, 115, 22, 0.05);
  border: 1px solid rgba(249, 115, 22, 0.22);
}

.overkill-review-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fdba74;
  margin-bottom: 8px;
}

.overkill-rate {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  padding: 2px 8px;
  border-radius: 8px;
}

.overkill-review-balls {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.overkill-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.78rem;
}

.overkill-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.overkill-tag.hit {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.overkill-tag.miss {
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  border: 1px solid rgba(255,255,255,0.1);
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  min-height: 42px;
  justify-content: center;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
}

.btn-primary:hover {
  box-shadow: 0 0 24px rgba(0, 245, 212, 0.3);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--card-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--card-border-hover);
}

.btn-generate {
  background: linear-gradient(135deg, var(--accent), #36c5f0);
  color: var(--bg-primary);
  font-size: 1rem;
  padding: 14px 32px;
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}

.btn-generate::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: shimmer 3s ease-in-out infinite;
}

.btn-generate:hover {
  box-shadow: 0 0 30px rgba(49, 217, 151, 0.24), 0 0 44px rgba(54, 197, 240, 0.16);
  transform: translateY(-2px);
}

.btn-generate:active {
  transform: translateY(0);
}

/* ========== Progress Bar ========== */
.progress-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
  flex: 1;
  min-width: 80px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #36c5f0);
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}


/* ========== Disclaimer ========== */
.disclaimer {
  background: rgba(245, 158, 11, 0.05);
  border-color: rgba(245, 158, 11, 0.2);
}

.disclaimer p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ========== Footer ========== */
.footer {
  margin-top: var(--space-2xl);
  padding: var(--space-xl) 0;
  border-top: 1px solid var(--card-border);
  text-align: center;
}

.footer p {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.footer-small {
  font-size: 0.7rem !important;
  margin-top: var(--space-xs);
  opacity: 0.6;
}

/* ========== Loading Overlay ========== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: rgba(6, 10, 8, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.5s ease;
}

.loading-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading {
  text-align: center;
}

.loading p {
  margin-top: var(--space-md);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

/* ========== App Toast ========== */
.app-toast {
  position: fixed;
  top: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(-15px);
  z-index: 9999;
  padding: 12px 28px;
  background: rgba(13, 18, 34, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text-primary);
  border: 1px solid var(--accent);
  border-radius: 99px;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: 
    0 12px 36px rgba(0, 0, 0, 0.4), 
    0 0 20px var(--accent-dim);
  opacity: 0;
  pointer-events: none;
  transition: 
    opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
    transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

body.theme-dlt .app-toast {
  background: rgba(12, 18, 15, 0.88);
}

body.theme-pl3 .app-toast {
  background: rgba(23, 18, 12, 0.88);
}


.app-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ========== Animations ========== */
@keyframes ballFadeIn {
  0% {
    transform: translateY(8px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  0% { left: -100%; }
  50%, 100% { left: 100%; }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .logo-text h1 {
    font-size: 1.25rem;
  }

  .nav-tabs {
    gap: 4px;
    overflow-x: auto;
  }

  .nav-tab {
    flex: 1;
    justify-content: center;
    padding: 8px 4px;
    font-size: 0.8rem;
    gap: 4px;
  }

  .nav-tab svg {
    width: 14px;
    height: 14px;
  }

  .ball {
    width: 42px;
    height: 42px;
    font-size: 1rem;
  }

  .ball::before {
    top: 5px;
    left: 10px;
    width: 13px;
    height: 8px;
  }

  .countdown-value {
    font-size: 1.8rem;
  }

  .countdown-unit {
    min-width: 52px;
  }

  .draw-result {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: var(--space-md) 0;
  }

  .draw-result-row {
    padding: 10px 14px;
    gap: var(--space-md);
  }

  .draw-result-row:hover {
    transform: none;
  }

  .draw-result .zone-label {
    min-width: 50px;
    font-size: 0.72rem;
    padding: 3px 6px;
  }

  .draw-result .ball-row {
    gap: 6px;
  }

  .draw-meta-bar {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-md);
  }

  .draw-extra {
    flex-direction: row;
    justify-content: space-around;
    border-top: none;
    padding-top: 0;
  }

  .draw-extra .extra-item {
    align-items: center;
  }

  .draw-actions {
    display: flex;
    justify-content: center;
    width: 100%;
  }

  .draw-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .stats-overview {
    grid-template-columns: repeat(2, 1fr);
  }

  .predictions-grid {
    grid-template-columns: 1fr;
  }

  .history-record-head {
    flex-direction: column;
    align-items: stretch;
  }

  .history-status {
    width: fit-content;
  }

  .history-record-actions {
    justify-content: flex-start;
  }

  .search-bar {
    flex-direction: column;
    width: 100%;
  }

  .search-input,
  .search-select {
    width: 100%;
  }

  .card {
    padding: var(--space-md);
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .latest-draw .card-header,
  .countdown .card-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: var(--space-sm);
  }

  .latest-draw .card-header h2,
  .countdown .card-header h2 {
    font-size: 1.05rem;
    white-space: nowrap;
  }

  .latest-draw .draw-info {
    font-size: 0.75rem;
    gap: 8px;
  }

  .latest-draw .draw-issue {
    font-size: 0.8rem;
  }

  .countdown-label {
    font-size: 0.72rem;
    padding: 2px 8px;
    white-space: nowrap;
  }

  .predict-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-generate {
    text-align: center;
    justify-content: center;
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions .btn {
    width: 100%;
  }

  .hotcold-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
  }

  .heatmap-cell {
    padding: 8px 4px;
    gap: 2px;
  }

  .cell-num {
    font-size: 0.95rem;
  }

  .cell-tag {
    font-size: 0.6rem;
    padding: 1px 4px;
  }

  .data-table th,
  .data-table td {
    padding: var(--space-sm);
    font-size: 0.8rem;
  }

  .draw-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  /* ========== Rules Table Mobile Overrides ========== */
  .rules-table {
    min-width: 580px;
  }

  .rules-table th {
    white-space: nowrap;
  }

  .rules-table th,
  .rules-table td {
    padding: 10px 8px;
    font-size: 0.72rem;
  }

  .prize-badge {
    min-width: 48px;
    padding: 2px 4px;
    font-size: 0.65rem;
  }

  .mini-balls-row {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex-wrap: nowrap; /* 不折行，保持在一行显示，更加整洁 */
  }

  /* 仅缩放实际的球点，不缩放 + 号和文本，防止 + 号和文本高度宽度被写死挤压变形 */
  .ball-dot:not(.plus):not(.text-muted) {
    width: 10px;
    height: 10px;
  }

  .ball-dot.plus {
    font-size: 0.7rem;
    line-height: 1;
  }

  .ball-dot.text-muted {
    font-size: 0.68rem;
    white-space: nowrap;
    line-height: 1;
  }

  .bt-bar-row {
    flex-wrap: wrap;
    row-gap: var(--space-xs);
  }

  .bt-bar-label {
    min-width: 86px;
  }

  .bt-bar-value {
    min-width: 100%;
    text-align: left;
    white-space: normal;
  }

  .frequency-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .app {
    padding: 0 var(--space-sm);
  }

  .nav-tabs {
    gap: 3px;
  }

  .nav-tab {
    padding: 6px 8px;
    font-size: 0.72rem;
    gap: 3px;
    flex: 0 0 auto;
  }

  .nav-tab svg {
    width: 12px;
    height: 12px;
  }

  .stats-overview {
    grid-template-columns: 1fr;
  }

  .hotcold-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }

  .ball {
    width: 38px;
    height: 38px;
    font-size: 0.9rem;
  }

  /* 预测卡片在超窄手机屏下的彩球微调，防止和前后区标签挤压 */
  .prediction-card .ball {
    width: 34px;
    height: 34px;
    font-size: 0.8rem;
  }

  .prediction-card .zone-tag {
    min-width: 26px;
    font-size: 0.65rem;
  }

  .pred-zone {
    gap: var(--space-xs);
    align-items: flex-start;
  }

  .prediction-card .ball-row {
    gap: 5px;
  }

  .countdown-timer {
    gap: 3px;
  }

  .countdown-unit {
    min-width: 44px;
  }

  .countdown-value {
    font-size: 1.45rem;
  }

  .countdown-sep {
    font-size: 1.4rem;
  }

  .prediction-history-tickets {
    grid-template-columns: 1fr;
  }

  .history-ball {
    width: 24px;
    height: 24px;
    font-size: 0.68rem;
  }

  .checker-item {
    align-items: flex-start;
  }

  .data-table th.col-sales,
  .data-table td.col-sales,
  .data-table th.col-pool,
  .data-table td.col-pool {
    display: none;
  }

  .data-table th,
  .data-table td {
    padding: 8px 6px;
    font-size: 0.8rem;
  }
}

@media (min-width: 1024px) {
  .draw-result {
    gap: var(--space-lg);
  }

  .ball {
    width: 58px;
    height: 58px;
    font-size: 1.3rem;
  }
}

/* ========== Focus / Accessibility ========== */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ========== Prize Rules ========== */
.rules-table-wrapper {
  overflow-x: auto;
  margin-top: var(--space-md);
}

.rules-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.rules-table th,
.rules-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.rules-table th {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(255, 255, 255, 0.02);
}

.rules-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.prize-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--card-border);
  text-align: center;
  min-width: 72px;
}

.prize-badge.gold {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warm);
  border-color: rgba(245, 158, 11, 0.3);
}

.prize-badge.silver {
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  border-color: rgba(255, 255, 255, 0.2);
}

.prize-badge.bronze {
  background: rgba(180, 83, 9, 0.15);
  color: #d97706;
  border-color: rgba(180, 83, 9, 0.3);
}

.mini-balls-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ball-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.ball-dot.front {
  background: linear-gradient(135deg, var(--front-start), var(--front-end));
  box-shadow: var(--shadow-glow-front);
}

.ball-dot.front.muted {
  opacity: 0.45;
}

.ball-dot.front.variant-a {
  background: #ff7a45;
}

.ball-dot.front.variant-b {
  background: #e7354f;
}

.ball-dot.front.variant-c {
  background: #ffbf69;
}

.ball-dot.back {
  background: linear-gradient(135deg, var(--back-start), var(--back-end));
  box-shadow: var(--shadow-glow-back);
}

.ball-dot.plus {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
}

.ball-dot.text-muted {
  font-size: 0.75rem;
  color: var(--text-muted);
  width: auto;
  height: auto;
}

/* ========== Modal Overlay ========== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100dvh;
  background: rgba(10, 14, 26, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
  padding: var(--space-md);
}

.modal-card {
  width: 100%;
  max-width: 580px;
  margin-bottom: 0;
  animation: modalFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
}

.history-modal-card {
  max-width: min(1080px, calc(100vw - 32px));
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-md);
}

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
  transition: color var(--transition-fast);
  line-height: 1;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
}

.modal-close:hover {
  color: var(--hot);
  background: rgba(239, 68, 68, 0.08);
}

.modal-body {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.history-modal-body {
  padding-right: 4px;
}

.modal-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.modal-textarea {
  width: 100%;
  height: 120px;
  padding: var(--space-md);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  color: #fff;
  font-family: 'Outfit', monospace;
  font-size: 0.95rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color var(--transition-fast);
}

.modal-textarea:focus {
  border-color: var(--accent);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  border-bottom: 1px solid var(--card-border);
  padding-bottom: var(--space-md);
}

/* ========== Checker Results ========== */
.checker-results {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding-top: var(--space-sm);
}

.checker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.checker-item.win {
  background: rgba(49, 217, 151, 0.05);
  border-color: rgba(49, 217, 151, 0.22);
}

.checker-item.error {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.28);
}

.checker-item-balls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.checker-ball {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.02);
}

.checker-ball.front.match {
  color: #fff;
  background: linear-gradient(145deg, var(--front-start), var(--front-end));
  border-color: transparent;
  box-shadow: var(--shadow-glow-front);
}

.checker-ball.back.match {
  color: #fff;
  background: linear-gradient(145deg, var(--back-start), var(--back-end));
  border-color: transparent;
  box-shadow: var(--shadow-glow-back);
}

.checker-ball.plus {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: bold;
  border: none;
  background: transparent;
  width: auto;
  height: auto;
}

.checker-item-verdict {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.checker-message {
  color: #fca5a5;
  font-size: 0.8rem;
}

.match-count {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.prize-result-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.prize-result-badge.win {
  background: var(--accent);
  color: var(--bg-primary);
}

.prize-result-badge.lose {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

/* ========== Print ========== */
@media print {
  .nav-tabs,
  .loading-overlay,
  .btn,
  .search-bar,
  .countdown {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .card {
    background: #fff;
    border: 1px solid #ccc;
    box-shadow: none;
    backdrop-filter: none;
  }

  .ball {
    border: 2px solid #333;
    color: #333;
    box-shadow: none;
  }

  .ball.front {
    background: #ffccbc;
  }

  .ball.back {
    background: #bbdefb;
  }
}

/* ========== PL3 Theme & Dynamic Display Adaptations ========== */
.theme-pl3 .logo-ball-red {
  background: linear-gradient(135deg, #ffb700, #e65c00);
  box-shadow: 0 0 18px rgba(255, 183, 0, 0.28), 0 3px 6px rgba(0, 0, 0, 0.3);
}

.theme-pl3 .logo-ball-blue {
  background: linear-gradient(135deg, #facc15, #ca8a04);
  box-shadow: 0 0 18px rgba(250, 204, 21, 0.24), 0 3px 6px rgba(0, 0, 0, 0.3);
}


/* ========== Lottery Switcher ========== */
.lottery-selector {
  display: flex;
  position: relative;
  width: min(100%, 460px);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 99px;
  padding: 4px;
  gap: 4px;
  z-index: 5;
  margin: 0 auto;
}

@media (max-width: 900px) {
  .lottery-selector {
    order: 3;
    width: 100%;
    margin-top: var(--space-sm);
  }
}

.selector-tab {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 10px 16px;
  border-radius: 99px;
  cursor: pointer;
  z-index: 2;
  transition: color var(--transition-normal);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.tab-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .selector-tab {
    flex: 1;
    padding: 12px 0;
  }
}

.selector-tab:hover {
  color: var(--text-primary);
}

.selector-tab.active {
  color: #000;
}

.selector-slider {
  position: absolute;
  top: 4px;
  left: 4px;
  bottom: 4px;
  width: calc((100% - 8px) / 3);
  border-radius: 99px;
  z-index: 1;
  background: linear-gradient(135deg, #00ff9d, #1890ff);
  box-shadow: 0 4px 15px rgba(0, 255, 157, 0.25);
  transition: transform var(--transition-normal), background var(--transition-normal), box-shadow var(--transition-normal);
}

.theme-pl3 .selector-tab.active {
  color: #fff;
}

.theme-pl3 .selector-slider {
  transform: translateX(calc(100% + 4px));
  background: linear-gradient(135deg, #ffb700, #ff4d4f);
  box-shadow: 0 4px 15px rgba(255, 183, 0, 0.3);
}


/* ========== Rule table selectors ========== */
.theme-dlt .dlt-rules-table { display: block !important; }
.theme-dlt .pl3-rules-table { display: none !important; }
.theme-pl3 .dlt-rules-table { display: none !important; }
.theme-pl3 .pl3-rules-table { display: block !important; }

/* ========== Display Adapters for PL3 ========== */
.theme-pl3 .zone-divider,
.theme-pl3 .zone-label,
.theme-pl3 .back-row,
.theme-pl3 #latestBack,
.theme-pl3 .draw-extra .extra-item:nth-child(2) {
  display: none !important;
}

.theme-pl3 #historyTable th:nth-child(4),
.theme-pl3 #historyTable td:nth-child(4),
.theme-pl3 #historyTable th:nth-child(6),
.theme-pl3 #historyTable td:nth-child(6) {
  display: none !important;
}

.theme-pl3 .stats-overview .stat-card:nth-child(3),
.theme-pl3 .stats-overview .stat-card:nth-child(4) {
  display: none !important;
}

.theme-pl3 #panelFrequency .card:nth-child(2),
.theme-pl3 #panelGap .card:nth-child(2),
.theme-pl3 #panelHotcold .card:nth-child(2) {
  display: none !important;
}

/* ========== World Cup Predictor ========== */


.is-positive {
  color: var(--success) !important;
}

.is-negative {
  color: var(--danger) !important;
}

.is-neutral {
  color: var(--text-muted) !important;
}


/* 进度条太窄时隐藏文字（避免溢出） */


/* Conformal 校正卡片的推荐文字：用 set_size 颜色（绿/黄/红）
   避免和 4 维融合的 --accent（红色）混淆 */


/* Conformal 校正 winbar：文字小一号 */
.cp-calibrated-bar span,
.cp-calibrated-bar i,
.cp-calibrated-bar b {
  font-size: 0.82rem;
  padding: 0 4px;
}

/* delta 单独成行（放在 winbar 下面）— 避免压住 winbar 段内文字 */
.cp-delta-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-family: 'SF Mono', Menlo, monospace;
  font-weight: 700;
  color: var(--text-muted, rgba(255, 255, 255, 0.55));
  margin: 6px 4px 0;
  min-height: 14px;
}
.cp-delta-row span:empty {
  /* 保留占位避免布局抖动，但内容为空时不显示 */
}
.cp-delta-row .cp-delta {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 10px;
}
.cp-delta-row .cp-delta.is-pos {
  color: var(--front-start, #00a86b);
}
.cp-delta-row .cp-delta.is-neg {
  color: var(--danger, #ff4757);
}


/* 胜平负概率卡片组（3 卡片，跟精选比分 6 卡片风格一致） */


@media (max-width: 900px) {
  

  

  

  

  

  
}

@media (max-width: 640px) {
  

  

  

  

  

  

  

  

  

  
}

/* ========== Match Schedule & Group Tabs ========== */

/* 1. Group Selector Tabs */


/* 2. Match Groups Details */


/* 3. Double Column Cards Grid */


/* 4. Glassmorphic Match Card */


/* 5. Match Card Header */


/* 赔率趋势段（modal 详情） */


/* modal 底部 footer（已移除） */

/* LLM AI 视角对比面板（冠军概率 tab 底部） */


@media (max-width: 768px) {
  
}

/* 6. Match Card Body */


/* 7. Score Badge & VS Badge */


/* 8. Match Card Footer */


/* ========== Responsive Breakpoints ========== */

@media (max-width: 900px) {
  
}

@media (max-width: 640px) {
  

  

  

  

  

  
}

/* ========== WC H2H Modal ========== */


/* Fade out animation for closing the modal smoothly */
.modal-overlay.fade-out {
  animation: fadeOut 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@media (max-width: 640px) {
  
  
  
  
  
}

/* ========== A11y: visually hidden but accessible to screen readers ========== */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* A11y: 球号视觉提示：角落小圆点区分前/后区，对色盲用户更友好 */
.ball.front::after,
.ball-dot.front {
  /* 已有红色区分 */
}

.ball.back::after,
.ball-dot.back {
  /* 已有蓝色区分 */
}

/* A11y: 焦点态增强 - 模态框内元素 */
.modal-card *:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}


/* A11y: 让开奖记录行支持键盘聚焦 */
.draw-item,
.checker-item {
  outline: none;
}

.draw-item:focus-visible,
.checker-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: rgba(49, 217, 151, 0.04);
}

/* ==================== 设备管理面板（云端同步）==================== */
.device-panel-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  height: 32px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-normal);
  white-space: nowrap;
}

.device-panel-btn:hover {
  background: rgba(0, 245, 212, 0.08);
  border-color: var(--accent);
  color: var(--accent);
}

.device-panel-btn:active {
  transform: scale(0.97);
}

.device-panel-btn svg {
  width: 16px;
  height: 16px;
}

.device-panel-btn-label {
  letter-spacing: 0.02em;
}

@media (max-width: 640px) {
  .device-panel-btn-label {
    display: none;
  }
  .device-panel-btn {
    padding: 6px 8px;
  }
}

.device-panel-overlay {
  align-items: center;
  justify-content: center;
}

.device-panel-card {
  max-width: 460px;
  width: calc(100% - 32px);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.device-panel-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 8px 4px 0;
}

.device-panel-desc {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.6;
}

.device-panel-desc strong {
  color: var(--text-primary);
}

.device-panel-id-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(0, 245, 212, 0.06);
  border: 1px solid rgba(0, 245, 212, 0.2);
  border-radius: var(--radius-md);
}

.device-panel-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.device-panel-id {
  flex: 1;
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
  font-size: 0.82rem;
  color: var(--accent);
  word-break: break-all;
  user-select: all;
}

.btn-icon {
  flex-shrink: 0;
  padding: 4px 10px;
  height: 28px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--transition-normal);
}

.btn-icon:hover {
  background: rgba(0, 245, 212, 0.12);
  border-color: var(--accent);
  color: var(--accent);
}

.device-panel-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--card-border);
  border-radius: var(--radius-md);
}

.device-panel-qr {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background: #ffffff;
  border-radius: var(--radius-sm);
  min-height: 220px;
  min-width: 220px;
}

.device-panel-qr img,
.device-panel-qr canvas {
  display: block;
  width: 200px !important;
  height: 200px !important;
}

.device-panel-qr-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-align: center;
}

.device-panel-details {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 0;
  background: rgba(255, 255, 255, 0.02);
}

.device-panel-details summary {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 0.86rem;
  color: var(--text-primary);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.device-panel-details summary::-webkit-details-marker {
  display: none;
}

.device-panel-details summary::before {
  content: '▸';
  color: var(--accent);
  font-size: 0.7rem;
  transition: transform var(--transition-normal);
}

.device-panel-details[open] summary::before {
  transform: rotate(90deg);
}

.device-panel-details[open] {
  padding-bottom: 12px;
}

.device-panel-manual-row {
  display: flex;
  gap: 8px;
  padding: 0 16px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.device-panel-manual-row input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
  font-size: 0.82rem;
}

.device-panel-manual-row input:focus {
  outline: none;
  border-color: var(--accent);
}

.device-panel-manual-row .btn {
  padding: 8px 16px;
  min-height: 36px;
  font-size: 0.82rem;
}

.btn-danger {
  background: rgba(255, 80, 80, 0.12);
  color: #ff7a7a;
  border: 1px solid rgba(255, 80, 80, 0.3);
}

.btn-danger:hover {
  background: rgba(255, 80, 80, 0.2);
  border-color: rgba(255, 80, 80, 0.6);
  color: #ff5252;
}

.device-panel-danger {
  border-color: rgba(255, 80, 80, 0.2);
}

.device-panel-danger-hint {
  margin: 8px 16px 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.device-panel-danger .btn {
  margin: 12px 16px 4px;
  padding: 8px 16px;
  min-height: 36px;
  font-size: 0.82rem;
}

.device-panel-status {
  margin: 0;
  min-height: 1.4em;
  font-size: 0.82rem;
  color: var(--accent);
  text-align: center;
  transition: color var(--transition-normal);
}

/* ========== World Cup Theme Option 3 Overrides ========== */


/* ========== Today Match Panel (大卡片 + 轮播) ========== */


/* 已结束比赛: 真实比分 (FIFA 官方) — 高亮但降饱和 */


/* 已结束卡片整体: 略降 opacity, 标明状态 */


/* 已结束角标 (右上) */


/* 北京时间 - 跟 AI 预测比分同列竖排, 在比分下面 */


/* footer 一行布局: 左下 3 个胜率 + 当地 + 天气 chip */


/* 小屏: 主队居左,客队居右,比分居中(保留现布局) — 卡片已经够紧凑,无需特殊断点 */

/* ========== H2H Modal: 4-source Ensemble Card ========== */


@media (max-width: 720px) {
  
}


/* ========== H2H Modal: 缺源提示 ========== */


.unc-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.unc-low {
  color: var(--front-start, #00a86b);
  background: var(--accent-dim, rgba(48, 209, 88, 0.12));
}
.unc-med {
  color: var(--warning, #faad14);
  background: rgba(250, 173, 20, 0.12);
}
.unc-high {
  color: var(--danger, #ff4d4f);
  background: rgba(255, 77, 79, 0.12);
}


.attr-block {
  margin-top: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  border: 0.5px solid var(--card-border, rgba(255, 255, 255, 0.08));
}
.attr-hd {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted, rgba(255, 255, 255, 0.55));
  margin-bottom: 6px;
}
.attr-base {
  font-size: 12px;
  color: var(--text-secondary, rgba(255, 255, 255, 0.7));
  margin-bottom: 8px;
  font-family: 'SF Mono', Menlo, monospace;
}
.attr-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.attr-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
}
.attr-lbl {
  flex: 0 0 64px;
  font-weight: 600;
  color: var(--text-secondary, rgba(255, 255, 255, 0.7));
}
.attr-bar {
  flex: 1;
  height: 12px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
  min-width: 80px;
}
.attr-seg {
  height: 100%;
  transition: width 0.3s ease;
}
.attr-val {
  flex: 0 0 72px;
  font-size: 11px;
  font-weight: 700;
  text-align: right;
  font-family: 'SF Mono', Menlo, monospace;
}
.attr-val.is-pos { color: var(--front-start, #00a86b); }
.attr-val.is-neg { color: var(--danger, #ff4757); }

/* H2H 弹窗：Conformal Prediction Set 卡片 */
.cp-set-box {
  /* 颜色由内联 style 根据 set_size 1/2/3 控制 */
}
.cp-set-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.cp-set-lbl {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted, rgba(255, 255, 255, 0.55));
}
.cp-set-badge {
  font-size: 12px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 6px;
  letter-spacing: 0.4px;
}
.cp-set-exp {
  font-size: 12px;
  color: var(--text-secondary, rgba(255, 255, 255, 0.8));
  margin-bottom: 4px;
  line-height: 1.4;
}
.cp-set-conf {
  font-size: 10.5px;
  color: var(--text-muted, rgba(255, 255, 255, 0.5));
  font-family: 'SF Mono', Menlo, monospace;
}

/* H2H 弹窗：Conformal 校正后的"安全边际"卡片
   - 上方一行 raw → adj 对比
   - 概率柱带 delta（+1.2 / -3.4）
   - 底部说明为什么这步是合理的 */
.cp-calibrated {
  border: 1px dashed rgba(0, 168, 107, 0.35);
  background: linear-gradient(180deg, rgba(0,168,107,0.04) 0%, transparent 100%);
  margin-bottom: 14px;
}
.cp-raw-compare {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--text-muted, rgba(255, 255, 255, 0.55));
  margin: 10px 0 6px;
  font-family: 'SF Mono', Menlo, monospace;
  letter-spacing: 0.2px;
}
.cp-raw-compare span:last-child {
  color: var(--text-secondary, rgba(255, 255, 255, 0.8));
  font-weight: 600;
}
.cp-arrow {
  color: var(--front-start, #00a86b);
  font-weight: 800;
  font-size: 14px;
}
.cp-calibrated-bar {
  margin-top: 4px;
}
.cp-delta {
  font-size: 10px;
  font-weight: 700;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: 'SF Mono', Menlo, monospace;
  background: rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}
.cp-delta.is-pos {
  color: var(--front-start, #00a86b);
}
.cp-delta.is-neg {
  color: var(--danger, #ff4757);
}
.cp-delta.is-neutral {
  color: var(--text-muted, rgba(255, 255, 255, 0.45));
}
.cp-calibrate-note {
  font-size: 11px;
  color: var(--text-muted, rgba(255, 255, 255, 0.5));
  line-height: 1.45;
  margin-top: 8px;
  font-style: italic;
}

/* ============================================================
 * v3.4.3: 4 源融合 + Conformal 校正增强样式
 * - 源完整性 / 一致度 / CI 反馈
 * ============================================================ */


/* 冠军价值 picks: CI 半宽 badge */


