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

/* ========== CSS Variables ========== */
:root {
  /* Colors */
  --bg-primary: #0d1010;
  --bg-secondary: #151917;
  --bg-tertiary: #1d2421;
  --card-bg: rgba(255, 255, 255, 0.045);
  --card-bg-hover: rgba(255, 255, 255, 0.075);
  --card-border: rgba(238, 245, 239, 0.1);
  --card-border-hover: rgba(238, 245, 239, 0.18);

  --text-primary: #edf3ef;
  --text-secondary: #a7b3ad;
  --text-muted: #829089;

  --accent: #31d997;
  --accent-dim: rgba(49, 217, 151, 0.14);

  --front-start: #ff7a45;
  --front-end: #e7354f;
  --front-glow: rgba(231, 53, 79, 0.32);
  --back-start: #36c5f0;
  --back-end: #2776c7;
  --back-glow: rgba(54, 197, 240, 0.3);

  --hot: #ef4444;
  --cold: #3b82f6;
  --warm: #f59e0b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  /* 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: 8px;
  --radius-lg: 8px;
  --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 10px 30px rgba(0, 0, 0, 0.28);
  --shadow-ball: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-glow-front: 0 0 18px rgba(231, 53, 79, 0.26);
  --shadow-glow-back: 0 0 18px rgba(54, 197, 240, 0.24);

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

/* ========== 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:
    linear-gradient(180deg, rgba(49, 217, 151, 0.05), transparent 280px),
    var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ========== App Container ========== */
.app {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* ========== Header ========== */
.header {
  padding: var(--space-lg) 0;
  border-bottom: 1px solid var(--card-border);
  margin-bottom: var(--space-md);
}

.header-inner {
  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);
}

/* ========== Data Lag Tip ========== */
.data-lag-tip {
  font-size: 0.72rem;
  color: var(--text-muted);
  opacity: 0.7;
  text-align: center;
  padding-top: var(--space-xs);
  width: 100%;
  user-select: none;
  pointer-events: none;
}

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

/* ========== Cards ========== */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.card:hover {
  border-color: var(--card-border-hover);
  box-shadow: 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: 700;
  color: #fff;
  animation: ballBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  position: relative;
  cursor: default;
  user-select: none;
}

.ball.front {
  background: linear-gradient(145deg, var(--front-start), var(--front-end));
  box-shadow:
    inset 0 -3px 6px rgba(0, 0, 0, 0.2),
    inset 0 3px 6px rgba(255, 255, 255, 0.15),
    var(--shadow-glow-front);
}

.ball.back {
  background: linear-gradient(145deg, var(--back-start), var(--back-end));
  box-shadow:
    inset 0 -3px 6px rgba(0, 0, 0, 0.2),
    inset 0 3px 6px rgba(255, 255, 255, 0.15),
    var(--shadow-glow-back);
}

/* 3D highlight */
.ball::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 12px;
  width: 16px;
  height: 10px;
  background: radial-gradient(ellipse, rgba(255,255,255,0.45), transparent);
  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, 122, 69, 0.08), rgba(49, 217, 151, 0.05));
  border: 1px solid rgba(255, 122, 69, 0.16);
}

.draw-result {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  flex-wrap: wrap;
  padding: var(--space-xl) 0;
}

.zone-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0;
}

.zone-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--text-muted);
  font-size: 1.2rem;
  font-weight: 300;
}

.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;
}

.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-num {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  padding: 2px 10px;
  border-radius: 10px;
}

.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,
.history-evolution-advice {
  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);
}

.history-review-summary {
  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,
.history-evolution-advice span {
  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-evolution-advice {
  border-color: rgba(59, 130, 246, 0.18);
}

.history-evolution-advice.pending {
  border-color: rgba(255, 255, 255, 0.06);
}

.history-evolution-advice p,
.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);
}

.review-tag.evolution {
  border-color: rgba(59, 130, 246, 0.22);
  color: var(--accent);
  background: var(--accent-dim);
}

.history-ticket-reason {
  margin-top: var(--space-sm);
}

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

/* ========== Backtest ========== */
.backtest-summary {
  font-size: 0.9rem;
}

.backtest-summary p {
  margin-bottom: var(--space-md);
  color: var(--text-secondary);
}

.backtest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.backtest-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--space-md);
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
}

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

.bt-value {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.backtest-detail h4 {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

.backtest-bars {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

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

.bt-bar-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  min-width: 70px;
}

.bt-bar-value {
  font-size: 0.78rem;
  color: var(--text-muted);
  min-width: 180px;
  text-align: right;
  overflow-wrap: anywhere;
}

.bt-seed {
  margin-left: var(--space-xs);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 400;
}

.bt-seed-list {
  font-size: 0.76rem;
  overflow-wrap: anywhere;
}

/* ========== 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: 100dvh;
  background: var(--bg-primary);
  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;
}

/* ========== Animations ========== */
@keyframes ballBounce {
  0% {
    transform: scale(0) translateY(40px);
    opacity: 0;
  }
  60% {
    transform: scale(1.15) translateY(-5px);
    opacity: 1;
  }
  80% {
    transform: scale(0.95) translateY(2px);
  }
  100% {
    transform: scale(1) 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: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: var(--space-sm) var(--space-md);
    padding: var(--space-md) 0;
    justify-content: start;
  }

  .draw-result .zone-label {
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--text-muted);
    min-width: 32px;
  }

  .draw-result .zone-divider {
    display: none;
  }

  .draw-result .ball-row {
    justify-content: flex-start;
    flex-wrap: wrap;
    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;
  }

  .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 th,
  .rules-table td {
    padding: 8px 4px;
    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 {
  --front-start: #f59e0b;
  --front-end: #ef4444;
  --front-glow: rgba(245, 158, 11, 0.36);
  --shadow-glow-front: 0 0 18px rgba(245, 158, 11, 0.26);
  --accent: #fbbf24;
  --accent-dim: rgba(251, 191, 36, 0.14);
  --success: #fbbf24;
}

.theme-pl3 .logo-ball-red {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.28), 0 3px 6px rgba(0, 0, 0, 0.3);
}

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

.theme-worldcup {
  --front-start: #31d997;
  --front-end: #36c5f0;
  --front-glow: rgba(49, 217, 151, 0.34);
  --shadow-glow-front: 0 0 18px rgba(49, 217, 151, 0.26);
  --back-start: #36c5f0;
  --back-end: #31d997;
  --accent: #31d997;
  --accent-dim: rgba(49, 217, 151, 0.14);
}

.theme-worldcup .logo-ball-red {
  background: linear-gradient(135deg, #31d997, #36c5f0);
  box-shadow: 0 0 18px rgba(49, 217, 151, 0.28), 0 3px 6px rgba(0, 0, 0, 0.3);
}

.theme-worldcup .logo-ball-blue {
  background: linear-gradient(135deg, #36c5f0, #31d997);
  box-shadow: 0 0 18px rgba(54, 197, 240, 0.24), 0 3px 6px rgba(0, 0, 0, 0.3);
}

/* ========== Lottery Switcher ========== */
.lottery-selector {
  display: flex;
  position: relative;
  width: min(100%, 430px);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
  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: 600;
  font-size: 0.85rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  z-index: 2;
  transition: color var(--transition-normal), transform var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

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

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

.selector-slider {
  position: absolute;
  top: 3px;
  left: 3px;
  bottom: 3px;
  width: calc((100% - 6px) / 3);
  border-radius: var(--radius-sm);
  z-index: 1;
  background: linear-gradient(135deg, #31d997, #36c5f0);
  box-shadow: 0 2px 10px rgba(49, 217, 151, 0.28);
  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(100%);
  background: linear-gradient(135deg, #fbbf24, #ef4444);
  box-shadow: 0 2px 10px rgba(251, 191, 36, 0.32);
}

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

.theme-worldcup .selector-slider {
  transform: translateX(200%);
  background: linear-gradient(135deg, #31d997, #36c5f0);
  box-shadow: 0 2px 10px rgba(49, 217, 151, 0.28);
}

.theme-worldcup .nav-tabs {
  display: none;
}

/* ========== 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 #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 ========== */
.wc-hero {
  background:
    linear-gradient(135deg, rgba(49, 217, 151, 0.1), rgba(54, 197, 240, 0.05)),
    var(--card-bg);
  border-color: rgba(49, 217, 151, 0.18);
}

.wc-hero-main {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
  align-items: start;
}

.wc-kicker {
  display: inline-flex;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--space-sm);
}

.wc-hero h2 {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
  letter-spacing: 0;
  margin-bottom: var(--space-md);
}

.wc-hero p,
.wc-desc {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.7;
  max-width: 72ch;
}

.wc-countdown {
  margin-top: var(--space-lg);
}

.wc-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}

.wc-meta-item,
.wc-top-card,
.wc-h2h-metrics > div,
.wc-mystic-grid > div,
.wc-info-block,
.wc-value-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
}

.wc-meta-item {
  padding: var(--space-md);
  min-width: 0;
}

.wc-meta-item span,
.wc-h2h-metrics span,
.wc-mystic-grid span,
.wc-value-card small {
  display: block;
  color: var(--text-muted);
  font-size: 0.72rem;
  margin-bottom: 4px;
}

.wc-meta-item strong,
.wc-h2h-metrics strong,
.wc-mystic-grid strong {
  color: var(--text-primary);
  font-size: 1rem;
  word-break: break-word;
}

.wc-top-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

.wc-top-card {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: var(--space-sm);
  align-items: center;
  padding: 12px;
}

.wc-rank,
.wc-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-family: var(--font-heading);
}

.wc-rank {
  width: 28px;
  height: 28px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
}

.wc-rank.is-top-1 {
  color: #fbbf24;
}

.wc-rank.is-top-2 {
  color: #cbd5e1;
}

.wc-rank.is-top-3 {
  color: #d97706;
}

.wc-code {
  width: 34px;
  height: 28px;
  color: var(--bg-primary);
  background: linear-gradient(135deg, var(--accent), var(--back-start));
  font-size: 0.78rem;
  letter-spacing: 0;
}

.wc-name,
.wc-team-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.wc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
}

.wc-tab {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 600;
  min-height: 38px;
  padding: 8px 14px;
  transition: all var(--transition-fast);
}

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

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

.wc-panel {
  display: none;
}

.wc-panel.active {
  display: block;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.wc-board,
.wc-detail-list,
.wc-market-list {
  display: flex;
  flex-direction: column;
}

.wc-board-row {
  display: grid;
  grid-template-columns: 36px 42px minmax(0, 1fr) minmax(90px, auto);
  gap: var(--space-md);
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}

.wc-board-row:last-child,
.wc-detail-row:last-child,
.wc-market-row:last-child {
  border-bottom: none;
}

.wc-team-sub,
.wc-narrative,
.wc-source-line,
.wc-h2h-card p,
.wc-squad-head p,
.wc-squad-table td span {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.wc-progress {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}

.wc-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--back-start));
  border-radius: inherit;
}

.wc-prob {
  text-align: right;
}

.wc-prob strong {
  display: block;
  font-size: 1rem;
  color: var(--text-primary);
}

.wc-prob span,
.wc-market-row strong,
.wc-value-card strong {
  font-size: 0.78rem;
  font-weight: 800;
}

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

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

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

.wc-detail-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
  padding: 10px 0;
}

.wc-detail-row summary {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto auto;
  gap: var(--space-sm);
  align-items: center;
  cursor: pointer;
  list-style: none;
}

.wc-detail-row summary::-webkit-details-marker {
  display: none;
}

.wc-pill,
.wc-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  background: rgba(49, 217, 151, 0.1);
  border: 1px solid rgba(49, 217, 151, 0.16);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
}

.wc-factor-list {
  display: grid;
  gap: 8px;
  margin: var(--space-md) 0;
}

.wc-factor-bar,
.wc-h2h-factor {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) 58px;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.78rem;
}

.wc-factor-bar > span,
.wc-h2h-factor > span {
  color: var(--text-secondary);
}

.wc-factor-bar > div,
.wc-h2h-factor > div,
.wc-market-bars {
  position: relative;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.wc-factor-bar i,
.wc-h2h-factor i,
.wc-h2h-factor b,
.wc-market-bars span,
.wc-market-bars i {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.wc-h2h-factor > div {
  display: flex;
}

.wc-mystic-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  margin: var(--space-md) 0;
}

.wc-mystic-grid > div {
  padding: 10px 12px;
}

.wc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.wc-ucl-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.wc-ucl-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: var(--space-md);
  padding: var(--space-md);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
}

.wc-ucl-card h3 {
  font-size: 1rem;
}

.wc-ucl-card p {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin: 3px 0;
}

.wc-ucl-players {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
}

.wc-ucl-player {
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.wc-select {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  min-height: 42px;
  outline: none;
  padding: 9px 12px;
}

.wc-winbar {
  display: flex;
  height: 46px;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.06);
  margin-bottom: var(--space-md);
}

.wc-winbar span,
.wc-winbar i,
.wc-winbar b {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  color: #05110d;
  font-style: normal;
  font-size: 0.78rem;
  font-weight: 900;
}

.wc-winbar span {
  background: var(--back-start);
}

.wc-winbar i {
  background: var(--warning);
}

.wc-winbar b {
  background: var(--accent);
}

.wc-h2h-metrics,
.wc-h2h-split {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.wc-h2h-metrics > div {
  padding: var(--space-md);
}

.wc-score-card,
.wc-h2h-card {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}

.wc-expected {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin-bottom: var(--space-md);
}

.wc-expected strong {
  color: var(--text-primary);
}

.wc-score-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.wc-score-grid > div {
  min-height: 72px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid transparent;
}

.wc-score-grid .is-featured {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.1);
}

.wc-score-grid.is-high > div {
  border-color: rgba(245, 158, 11, 0.16);
}

.wc-score-grid strong {
  font-size: 1.1rem;
}

.wc-score-grid span {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.wc-score-card h3,
.wc-h2h-card h3 {
  font-size: 0.92rem;
  margin: var(--space-sm) 0;
}

.wc-h2h-split {
  grid-template-columns: repeat(2, 1fr);
}

.wc-record {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-xs);
  margin-bottom: var(--space-sm);
}

.wc-record div {
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  padding: var(--space-sm);
  text-align: center;
}

.wc-record strong {
  display: block;
  font-size: 1.1rem;
}

.wc-record span {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.wc-official-h2h-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.wc-official-h2h-list > div {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 3px 10px;
  padding: 9px 10px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
}

.wc-official-h2h-list span,
.wc-official-h2h-list small {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.wc-official-h2h-list strong {
  color: var(--text-primary);
  font-size: 0.8rem;
  min-width: 0;
}

.wc-official-h2h-list small {
  grid-column: 2;
}

.wc-player-group {
  margin-top: var(--space-sm);
}

.wc-player-group h4 {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.wc-player-vs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr);
  gap: var(--space-sm);
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.82rem;
}

.wc-player-vs span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wc-player-vs span:last-child {
  text-align: right;
}

.wc-player-vs i {
  color: var(--warning);
  font-style: normal;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
}

.wc-player-vs small {
  color: var(--warning);
  font-size: 0.72rem;
}

.wc-squad-head {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: var(--space-md);
  align-items: center;
  padding: var(--space-md);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: var(--space-md);
}

.wc-squad-head h3 {
  font-size: 1.1rem;
}

.wc-squad-head > strong {
  color: var(--accent);
  font-size: 1.2rem;
}

.wc-squad-table .wc-pos {
  display: inline-flex;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  color: var(--accent);
  background: var(--accent-dim);
  font-weight: 800;
}

.wc-market-row {
  display: grid;
  grid-template-columns: 42px minmax(110px, 1fr) minmax(160px, 1fr) 110px 58px;
  gap: var(--space-sm);
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
  font-size: 0.82rem;
}

.wc-market-bars {
  display: grid;
  gap: 3px;
  height: 16px;
  background: transparent;
}

.wc-market-bars span,
.wc-market-bars i {
  height: 6px;
}

.wc-market-bars span {
  background: var(--back-start);
}

.wc-market-bars i {
  background: var(--warning);
}

.wc-value-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.wc-value-card {
  display: grid;
  gap: 4px;
  padding: var(--space-md);
}

.wc-value-card span {
  font-weight: 800;
}

.wc-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

.wc-info-block {
  padding: var(--space-md);
}

.wc-info-block h3 {
  font-size: 1rem;
  margin-bottom: var(--space-sm);
}

.wc-info-block p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.7;
}

.wc-info-block code {
  color: var(--accent);
}

.wc-source-line {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  border-top: 1px solid var(--card-border);
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
}

.wc-source-line a {
  color: var(--accent);
}

@media (max-width: 900px) {
  .wc-hero-main,
  .wc-h2h-split,
  .wc-info-grid {
    grid-template-columns: 1fr;
  }

  .wc-top-strip,
  .wc-meta-grid,
  .wc-ucl-grid,
  .wc-value-grid {
    grid-template-columns: 1fr;
  }

  .wc-score-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .wc-market-row {
    grid-template-columns: 42px minmax(0, 1fr) 70px;
  }

  .wc-market-row .wc-market-bars,
  .wc-market-row > span:nth-child(4) {
    grid-column: 2 / -1;
  }
}

@media (max-width: 640px) {
  .wc-hero h2 {
    font-size: 2rem;
  }

  .wc-board-row {
    grid-template-columns: 30px 38px minmax(0, 1fr);
  }

  .wc-prob {
    grid-column: 3;
    text-align: left;
  }

  .wc-detail-row summary {
    grid-template-columns: 38px minmax(0, 1fr) auto;
  }

  .wc-detail-row summary .wc-pill {
    grid-column: 2 / -1;
    justify-self: start;
  }

  .wc-mystic-grid,
  .wc-h2h-controls,
  .wc-h2h-metrics,
  .wc-expected {
    grid-template-columns: 1fr;
  }

  .wc-vs {
    padding: 0;
    text-align: center;
  }

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

  .wc-player-vs {
    grid-template-columns: 1fr;
  }

  .wc-player-vs i,
  .wc-player-vs span:last-child {
    text-align: left;
  }
}

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

/* 1. Group Selector Tabs */
.wc-group-selector {
  display: flex;
  gap: var(--space-xs);
  overflow-x: auto;
  padding: 4px 16px 14px 16px;
  margin-bottom: var(--space-md);
  border-bottom: 1px solid var(--card-border);
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE 10+ */
}

.wc-group-selector::-webkit-scrollbar {
  display: none; /* Safari and Chrome */
}

.wc-group-tab {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.wc-group-tab:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.wc-group-tab.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(49, 217, 151, 0.2);
  font-weight: 700;
}

/* 2. Match Groups Details */
.wc-match-group {
  border-bottom: 1px solid var(--card-border);
  padding: 0;
  transition: all var(--transition-normal);
}

.wc-match-group.is-hidden {
  display: none !important;
}

.wc-match-group:last-child {
  border-bottom: none;
}

.wc-match-group summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  background: var(--bg-secondary);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  transition: background var(--transition-fast);
}

.wc-match-group summary:hover {
  background: var(--bg-tertiary);
}

.wc-match-group summary::-webkit-details-marker {
  display: none;
}

.wc-match-group summary::before {
  content: '▶';
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.wc-match-group[open] summary::before {
  transform: rotate(90deg);
}

.wc-group-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  width: auto;
  padding: 0 10px;
  white-space: nowrap;
  height: 28px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--front-start), var(--front-end));
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(231, 53, 79, 0.2);
}

.wc-group-teams {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 3. Double Column Cards Grid */
.wc-match-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  padding: var(--space-md);
  background: rgba(0, 0, 0, 0.15);
}

/* 4. Glassmorphic Match Card */
.wc-match-card {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.wc-match-card:hover {
  transform: translateY(-3px);
  background: var(--card-bg-hover);
  border-color: var(--card-border-hover);
  box-shadow: 
    0 10px 20px rgba(0, 0, 0, 0.2), 
    0 0 12px rgba(49, 217, 151, 0.05);
}

/* 5. Match Card Header */
.wc-match-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
}

.wc-match-time-badge {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  background: rgba(255, 255, 255, 0.04);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.wc-match-date {
  font-weight: 700;
  color: var(--text-primary);
}

.wc-match-day {
  color: var(--text-muted);
}

.wc-match-time {
  font-weight: 700;
  color: var(--accent);
  margin-left: 2px;
}

.wc-match-status {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 700;
  white-space: nowrap;
}

.wc-match-status.is-scheduled {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(49, 217, 151, 0.16);
}

.wc-match-status.is-final {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

/* 6. Match Card Body */
.wc-match-body {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin: var(--space-xs) 0 var(--space-sm) 0;
  min-width: 0;
}

.wc-match-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.wc-match-team.is-home {
  align-items: flex-end;
  text-align: right;
}

.wc-match-team.is-away {
  align-items: flex-start;
  text-align: left;
}

.wc-match-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.wc-match-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.95rem; /* Larger flag emoji */
}

.wc-match-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 6px;
  height: 18px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  font-family: var(--font-heading);
}

/* 7. Score Badge & VS Badge */
.wc-match-score-badge {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent);
  background: rgba(49, 217, 151, 0.1);
  border: 1px solid rgba(49, 217, 151, 0.2);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  min-width: 52px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-heading);
  box-shadow: 0 2px 8px rgba(49, 217, 151, 0.06);
}

.wc-match-vs-badge {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  min-width: 44px;
  text-align: center;
  letter-spacing: 0.05em;
}

/* 8. Match Card Footer */
.wc-match-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 10px;
  margin-top: auto;
  color: var(--text-muted);
}

.wc-venue-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: var(--text-muted);
  opacity: 0.7;
}

.wc-match-venue {
  font-size: 0.7rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-grow: 1;
}

.wc-update-badge {
  font-size: 0.72rem;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  padding: 4px 12px;
  border-radius: 99px;
  white-space: nowrap;
  flex-shrink: 0;
  border: 1px solid var(--card-border);
}

.wc-matches-header {
  margin-bottom: var(--space-sm) !important;
}

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

@media (max-width: 900px) {
  .wc-match-grid {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
    padding: var(--space-sm);
  }
}

@media (max-width: 640px) {
  .wc-group-selector {
    padding: 2px 12px 10px 12px;
  }

  .wc-group-tab {
    padding: 4px 10px;
    font-size: 0.75rem;
  }

  .wc-match-card {
    padding: 12px;
  }

  .wc-match-name {
    font-size: 0.8rem;
  }

  .wc-match-score-badge {
    font-size: 1rem;
    padding: 3px 8px;
    min-width: 46px;
  }

  .wc-match-body {
    gap: 8px;
  }
}

/* ========== WC H2H Modal ========== */
.wc-h2h-modal-card {
  max-width: min(820px, calc(100vw - 32px));
  max-height: 92dvh;
}

.wc-h2h-modal-header {
  border-bottom: 1px solid var(--card-border);
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-md);
}

.wc-modal-title-teams {
  display: flex;
  align-items: center;
  gap: 16px;
}

.wc-modal-flag-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
}

.wc-modal-vs {
  font-family: var(--font-heading);
  font-weight: 900;
  color: var(--warning);
  font-size: 1.05rem;
}

.wc-modal-prediction-title {
  margin-bottom: var(--space-md);
  text-align: center;
}

.wc-modal-prediction-title h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 4px;
}

.wc-modal-prediction-title p {
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.5;
}

.wc-h2h-modal-body {
  overflow-y: auto;
  padding-right: 6px;
  flex-grow: 1;
}

.wc-h2h-modal-body::-webkit-scrollbar {
  width: 5px;
}

.wc-h2h-modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.wc-match-card.is-clickable {
  cursor: pointer;
}

.wc-match-card.is-clickable::after {
  content: '分析 ➔';
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 0.62rem;
  color: var(--accent);
  opacity: 0;
  transform: translateX(-4px);
  transition: all var(--transition-fast);
  font-weight: 700;
}

.wc-match-card.is-clickable:hover::after {
  opacity: 0.85;
  transform: translateX(0);
}

/* 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) {
  .wc-modal-title-teams {
    gap: 8px;
  }
  
  .wc-modal-flag-badge {
    font-size: 0.95rem;
  }
  
  .wc-modal-vs {
    font-size: 0.85rem;
  }
}

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