/* ============================================================
   双色球选号工坊 — 选号工坊主题
   Design System: Deep dark + Aurora purple + Neon green
   Adapted from AI-Glow Intelligence theme
   ============================================================ */

/* ── CSS Variables ── */
:root {
  --bg-primary: #0a0a12;
  --bg-secondary: #0f0f1a;
  --bg-card: #12121e;
  --bg-card-hover: #16162a;
  --bg-input: #0e0e1a;
  --bg-nav: rgba(10, 10, 18, 0.85);

  --purple: #A855F7;
  --purple-dim: rgba(168, 85, 247, 0.15);
  --purple-glow: rgba(168, 85, 247, 0.4);
  --blue: #3B82F6;
  --blue-dim: rgba(59, 130, 246, 0.15);
  --blue-glow: rgba(59, 130, 246, 0.35);
  --green: #00FFC2;
  --green-dim: rgba(0, 255, 194, 0.12);
  --green-glow: rgba(0, 255, 194, 0.3);
  --gold: #FFD700;
  --gold-dim: rgba(255, 215, 0, 0.12);
  --red: #e74c3c;
  --red-bright: #FF4757;
  --orange: #FF6B35;

  --text: #e0e0e8;
  --text-secondary: #9090a8;
  --text-dim: #606078;
  --text-bright: #ffffff;

  --border: rgba(255, 255, 255, 0.06);
  --border-glow: rgba(168, 85, 247, 0.2);
  --border-input: rgba(255, 255, 255, 0.1);

  --radius: 12px;
  --radius-lg: 16px;
  --radius-sm: 8px;
  --radius-pill: 99px;

  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(168, 85, 247, 0.15);
  --shadow-hover: 0 8px 40px rgba(0, 0, 0, 0.4);

  --font-sans: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  --nav-height: 64px;
  --bottom-nav-height: 64px;
  --container-max: 1200px;

  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--purple); text-decoration: none; transition: color var(--transition); }
a:hover { color: #c084fc; }
img { max-width: 100%; height: auto; }
table { border-collapse: collapse; width: 100%; }
::selection { background: var(--purple); color: #fff; }

/* ── Layout ── */
.main-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: calc(var(--nav-height) + 1.5rem) 1.25rem 6rem;
  min-height: 100vh;
}

/* ── Background Mesh ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 20% 10%, rgba(168, 85, 247, 0.08), transparent 60%),
    radial-gradient(ellipse 50% 40% at 80% 60%, rgba(59, 130, 246, 0.06), transparent 50%),
    radial-gradient(ellipse 40% 30% at 50% 90%, rgba(0, 255, 194, 0.04), transparent 50%);
  pointer-events: none;
  z-index: 0;
}
body > * { position: relative; z-index: 1; }

/* ══════════════════════════════════════
   NAVIGATION
   ══════════════════════════════════════ */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--bg-nav);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  transition: background var(--transition), box-shadow var(--transition);
}
.navbar.scrolled {
  background: rgba(10, 10, 18, 0.95);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
}
.nav-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  flex-shrink: 0;
}
.brand-icon {
  font-size: 1.5rem;
  filter: drop-shadow(0 0 8px var(--purple-glow));
}
.brand-text {
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(135deg, #fff 40%, var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 0.25rem;
  align-items: center;
}
.nav-links li a {
  display: block;
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  white-space: nowrap;
}
.nav-links li a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}
.nav-links li a.active {
  color: var(--green);
  background: var(--green-dim);
  box-shadow: 0 0 12px var(--green-glow);
}

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1001;
}
.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.3s;
}
.menu-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
  display: none;
  position: fixed;
  top: var(--nav-height);
  left: 0; right: 0; bottom: 0;
  background: rgba(10, 10, 18, 0.97);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  flex-direction: column;
  padding: 1.5rem 1.25rem;
  gap: 0.4rem;
  z-index: 999;
  overflow-y: auto;
  transform: translateY(-10px);
  opacity: 0;
  transition: all 0.3s;
}
.mobile-menu.active {
  display: flex;
  transform: translateY(0);
  opacity: 1;
}
.mobile-menu a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius);
  transition: all var(--transition);
}
.mobile-menu a:hover,
.mobile-menu a.active {
  color: var(--green);
  background: var(--green-dim);
}

/* ── User Dropdown ── */
.nav-user-dropdown { position: relative; }
.nav-user-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-dim);
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.nav-user-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
}
.nav-user-btn svg { transition: transform 0.2s; }
.nav-user-dropdown.open .nav-user-btn svg { transform: rotate(180deg); }
.nav-user-icon { font-size: 1rem; }
.user-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius);
  padding: 0.4rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), var(--shadow-glow);
  z-index: 1100;
  animation: dropdownIn 0.2s ease-out;
}
.nav-user-dropdown.open .user-dropdown-menu { display: block; }
@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.user-dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  text-decoration: none;
}
.user-dropdown-menu a:hover {
  color: var(--text-bright);
  background: rgba(255, 255, 255, 0.06);
}
.dropdown-info {
  padding: 0.4rem 0.8rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}
.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 0.3rem 0;
}

/* ── Bottom Mobile Nav ── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-height);
  background: rgba(10, 10, 18, 0.95);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  z-index: 998;
  justify-content: space-around;
  align-items: center;
  padding: 0 0.5rem;
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  min-width: 52px;
}
.bottom-nav a .nav-icon { font-size: 1.2rem; }
.bottom-nav a:hover,
.bottom-nav a.active {
  color: var(--green);
  background: var(--green-dim);
}

/* ══════════════════════════════════════
   CARDS
   ══════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-hover);
}

/* ══════════════════════════════════════
   PAGE HEADER
   ══════════════════════════════════════ */
.page-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.page-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 40%, var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.3rem;
}
.page-subtitle {
  color: var(--text-secondary);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* ══════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
}
.btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-bright);
  transform: translateY(-1px);
}
.btn-primary {
  background: linear-gradient(135deg, var(--purple), #7c3aed);
  border: none;
  color: #fff;
  box-shadow: 0 4px 16px var(--purple-glow);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #c084fc, var(--purple));
  box-shadow: 0 6px 24px rgba(168, 85, 247, 0.5);
  color: #fff;
}
.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-input);
  color: var(--text-secondary);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}
.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
}
.btn-block {
  width: 100%;
  justify-content: center;
}
.btn-danger {
  background: rgba(231, 76, 60, 0.1);
  color: #FF6B6B;
  border-color: rgba(231, 76, 60, 0.2);
}
.btn-danger:hover {
  background: rgba(231, 76, 60, 0.2);
}
.btn-success {
  background: var(--green-dim);
  color: var(--green);
  border-color: rgba(0, 255, 194, 0.2);
}
.btn-success:hover {
  background: rgba(0, 255, 194, 0.2);
  color: #00ffda;
}
.btn:disabled, .btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ══════════════════════════════════════
   BALL NUMBERS
   ══════════════════════════════════════ */
.balls-inline {
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
  flex-wrap: wrap;
}
.ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  border-radius: 50%;
  line-height: 1;
  flex-shrink: 0;
}
.ball-red {
  width: 36px; height: 36px;
  font-size: 0.8rem;
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: #fff;
  box-shadow: 0 0 10px rgba(231, 76, 60, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}
.ball-blue {
  width: 36px; height: 36px;
  font-size: 0.8rem;
  background: linear-gradient(135deg, #3B82F6, #2563EB);
  color: #fff;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}
.ball-sm {
  width: 28px; height: 28px;
  font-size: 0.7rem;
}
.ball-lg {
  width: 44px; height: 44px;
  font-size: 0.9rem;
}
.ball-hit {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  box-shadow: 0 0 16px var(--gold), inset 0 1px 0 rgba(255,255,255,0.2) !important;
}

/* ══════════════════════════════════════
   FORMS
   ══════════════════════════════════════ */
.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}
.form-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.form-row .form-group {
  flex: 1;
  min-width: 80px;
}
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  font-size: 0.88rem;
  font-family: inherit;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: all var(--transition);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-dim);
}
input::placeholder, textarea::placeholder {
  color: var(--text-dim);
}
.input-full { width: 100%; }
.form-check {
  margin: 0.75rem 0;
}
.form-check label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
}
.form-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--purple);
  cursor: pointer;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--purple);
  cursor: pointer;
}

/* ══════════════════════════════════════
   SELECT STYLING
   ══════════════════════════════════════ */
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%239090a8' stroke-width='1.5'%3E%3Cpath d='M3 5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 2rem;
  cursor: pointer;
}
.select-mode, .select-count {
  min-width: 130px;
}

/* ══════════════════════════════════════
   GENERATE PANEL
   ══════════════════════════════════════ */
.generate-panel {
  padding: 1.25rem;
}
.generate-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}
.generate-controls .control-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.generate-controls .control-group label {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ══════════════════════════════════════
   TABS
   ══════════════════════════════════════ */
.tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  overflow-x: auto;
}
.tab {
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dim);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}
.tab.active {
  color: var(--green);
  background: var(--green-dim);
  box-shadow: 0 0 12px var(--green-glow);
}
.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-pill);
  color: var(--text-dim);
}
.tab.active .tab-count {
  background: var(--green-dim);
  color: var(--green);
}

.tab-content { display: block; }
.tab-content.hidden { display: none; }

/* ══════════════════════════════════════
   TICKET CARD
   ══════════════════════════════════════ */
.ticket-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.ticket-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  transition: all var(--transition);
  animation: fadeInUp 0.3s ease-out;
}
.ticket-card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-glow);
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.ticket-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.ticket-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-dim);
}
.ticket-id {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--purple);
}
.ticket-mode {
  padding: 0.15rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--purple-dim);
  color: var(--purple);
  border-radius: var(--radius-sm);
}
.ticket-addon {
  padding: 0.15rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--gold-dim);
  color: var(--gold);
  border-radius: var(--radius-sm);
}
.ticket-target {
  font-size: 0.75rem;
  color: var(--text-dim);
}
.ticket-balls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.5rem 0;
  flex-wrap: wrap;
}
.ticket-balls .ball-separator {
  font-size: 1rem;
  color: var(--text-dim);
  margin: 0 0.3rem;
}
.ticket-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.ticket-actions .btn {
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
}
.ticket-hit-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
}
.hit-win {
  background: var(--green-dim);
  color: var(--green);
}
.hit-miss {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
}

.list-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

/* ══════════════════════════════════════
   MODALS
   ══════════════════════════════════════ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal.hidden { display: none; }
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.modal-content {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), var(--shadow-glow);
  animation: modalIn 0.25s ease-out;
}
.modal-large {
  max-width: 850px;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-bright);
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  line-height: 1;
}
.modal-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}
.modal-body {
  padding: 1.5rem;
}
.modal-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

/* ══════════════════════════════════════
   MANUAL SELECTION MODAL
   ══════════════════════════════════════ */
.manual-body {
  display: flex;
  gap: 1.25rem;
  padding: 0;
}
.manual-left {
  flex: 1;
  min-width: 0;
  padding: 1.25rem;
}
.manual-right {
  width: 280px;
  flex-shrink: 0;
  padding: 1.25rem;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  max-height: 70vh;
  overflow-y: auto;
}
.ball-section {
  margin-bottom: 1.25rem;
}
.ball-section h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.6rem;
}
.ball-counter {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 400;
}
.ball-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 0.4rem;
}
.ball-grid-blue {
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
}
.ball-cell {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
  user-select: none;
}
.ball-cell.red {
  background: rgba(231, 76, 60, 0.1);
  color: #e74c3c;
  border-color: rgba(231, 76, 60, 0.2);
}
.ball-cell.red:hover {
  background: rgba(231, 76, 60, 0.2);
  border-color: rgba(231, 76, 60, 0.4);
}
.ball-cell.red.selected {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: #fff;
  border-color: #e74c3c;
  box-shadow: 0 0 12px rgba(231, 76, 60, 0.5);
}
.ball-cell.blue {
  background: rgba(59, 130, 246, 0.1);
  color: #3B82F6;
  border-color: rgba(59, 130, 246, 0.2);
}
.ball-cell.blue:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
}
.ball-cell.blue.selected {
  background: linear-gradient(135deg, #3B82F6, #2563EB);
  color: #fff;
  border-color: #3B82F6;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.5);
}
.manual-preview {
  padding: 0.75rem;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0.75rem 0;
  min-height: 48px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem;
}

/* ── Assist Panel ── */
.assist-controls {
  margin-bottom: 0.75rem;
}
.assist-controls select {
  width: auto;
  display: inline-block;
  margin-left: 0.4rem;
}
.assist-section {
  margin-bottom: 1rem;
}
.assist-section h5 {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}
.assist-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.assist-ball {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}
.assist-ball:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-color: var(--border-input);
}
.assist-ball .assist-count {
  font-size: 0.68rem;
  color: var(--text-dim);
}
.recent-draws {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.recent-draw-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  flex-wrap: wrap;
}
.recent-draw-issue {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-dim);
  font-size: 0.7rem;
  min-width: 48px;
}
.recent-draw-balls {
  display: flex;
  gap: 0.2rem;
  align-items: center;
  flex-wrap: wrap;
}
.recent-draw-ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  font-size: 0.62rem;
  font-family: var(--font-mono);
  font-weight: 700;
  border-radius: 50%;
}
.recent-draw-ball.red {
  background: rgba(231, 76, 60, 0.2);
  color: #e74c3c;
}
.recent-draw-ball.blue {
  background: rgba(59, 130, 246, 0.2);
  color: #3B82F6;
}

/* ══════════════════════════════════════
   COMPARE RESULT
   ══════════════════════════════════════ */
.compare-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.compare-stat {
  text-align: center;
  padding: 0.75rem;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.compare-stat .stat-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
}
.compare-stat .stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-bright);
}
.compare-dist {
  margin-bottom: 1rem;
}
.compare-dist-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}
.compare-dist-row:last-child { border-bottom: none; }
.dist-level {
  width: 60px;
  font-weight: 600;
  color: var(--text-secondary);
}
.dist-count {
  font-family: var(--font-mono);
  color: var(--text);
  font-weight: 600;
  min-width: 30px;
}
.dist-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 3px;
  overflow: hidden;
}
.dist-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--blue));
  border-radius: 3px;
  transition: width 0.5s ease-out;
}
.compare-top {
  margin-top: 1rem;
}
.compare-top-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
}
.compare-top-item .level-badge {
  padding: 0.1rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
}
.level-1 { background: rgba(255, 215, 0, 0.15); color: var(--gold); }
.level-2 { background: rgba(192, 192, 192, 0.15); color: #c0c0c0; }
.level-3 { background: rgba(205, 127, 50, 0.15); color: #cd7f32; }
.level-4 { background: rgba(168, 85, 247, 0.15); color: var(--purple); }
.level-5 { background: rgba(59, 130, 246, 0.15); color: var(--blue); }
.level-6 { background: rgba(0, 255, 194, 0.15); color: var(--green); }
.level-7 { background: rgba(255, 107, 53, 0.15); color: var(--orange); }
.level-0 { background: rgba(255, 255, 255, 0.04); color: var(--text-dim); }

/* ══════════════════════════════════════
   PROFIT PAGE
   ══════════════════════════════════════ */
.profit-filters {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}
.profit-filters select {
  width: auto;
  min-width: 110px;
}
.profit-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  padding: 1.25rem;
}
.profit-overview .stat-card {
  text-align: center;
  padding: 1.25rem 1rem;
}
.profit-overview .stat-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}
.profit-overview .stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  font-family: var(--font-mono);
}
.profit-overview .stat-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 0.3rem;
}
.profit-section {
  padding: 1.25rem;
}
.profit-section h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-bright);
}

/* ── Data Table ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.data-table th {
  text-align: left;
  padding: 0.6rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}
.data-table .text-center { text-align: center; }
.data-table .text-right { text-align: right; }
.data-table .text-muted { color: var(--text-dim); }
.profit-positive { color: var(--green) !important; font-weight: 600; }
.profit-negative { color: #FF6B6B !important; font-weight: 600; }
.profit-zero { color: var(--text-dim); }

/* ── Prize Distribution ── */
.prize-dist {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.prize-dist-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.prize-dist-level {
  width: 70px;
  font-weight: 600;
  font-size: 0.82rem;
}
.prize-dist-count {
  font-family: var(--font-mono);
  font-weight: 700;
  min-width: 40px;
}
.prize-dist-amount {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-left: auto;
}

/* ── Pagination ── */
.pagination {
  display: flex;
  gap: 0.3rem;
  justify-content: center;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.pagination button {
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.pagination button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}
.pagination button.active {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}
.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ══════════════════════════════════════
   SETTINGS PAGE
   ══════════════════════════════════════ */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}
.settings-section h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-bright);
}
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.settings-row:last-of-type { border-bottom: none; }
.settings-label {
  color: var(--text-dim);
  font-size: 0.82rem;
}
.settings-value {
  color: var(--text);
  font-weight: 500;
}
.settings-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  padding: 1rem 0;
}

/* ══════════════════════════════════════
   AUTH PAGES
   ══════════════════════════════════════ */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-primary);
}
.auth-body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 50% 30%, rgba(168, 85, 247, 0.12), transparent 60%),
    radial-gradient(ellipse 50% 30% at 50% 80%, rgba(59, 130, 246, 0.08), transparent 50%);
  pointer-events: none;
}
.auth-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 1rem;
}
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), var(--shadow-glow);
}
.auth-header {
  text-align: center;
  margin-bottom: 1.5rem;
}
.auth-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 12px var(--purple-glow));
}
.auth-header h1 {
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 40%, var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.25rem;
}
.auth-header p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.auth-form .form-group {
  margin-bottom: 1rem;
}
.auth-form label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 0.35rem;
}
.auth-footer {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.82rem;
  color: var(--text-dim);
}
.auth-footer a {
  color: var(--green);
  font-weight: 600;
}
.auth-alert {
  padding: 0.75rem 1rem;
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.2);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: #FF6B6B;
  margin-bottom: 1rem;
  text-align: center;
}

/* ══════════════════════════════════════
   ADMIN PAGE
   ══════════════════════════════════════ */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.admin-stat {
  text-align: center;
  padding: 1.25rem;
}
.admin-stat .stat-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
}
.admin-stat .stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  font-family: var(--font-mono);
}

.role-badge {
  display: inline-flex;
  padding: 0.15rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
}
.role-admin {
  background: var(--purple-dim);
  color: var(--purple);
}
.role-user {
  background: rgba(59, 130, 246, 0.15);
  color: var(--blue);
}
.status-active {
  color: var(--green);
  font-weight: 600;
}
.status-inactive {
  color: #FF6B6B;
  font-weight: 600;
}

/* ══════════════════════════════════════
   TOAST
   ══════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  padding: 0.7rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-bright);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), var(--shadow-glow);
  z-index: 3000;
  transition: all 0.3s;
  max-width: 90%;
  text-align: center;
}
.toast.toast-success { border-color: var(--green); color: var(--green); }
.toast.toast-error { border-color: #FF6B6B; color: #FF6B6B; }

/* ══════════════════════════════════════
   UTILITY
   ══════════════════════════════════════ */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-dim); }
.text-success { color: var(--green); }
.text-danger { color: #FF6B6B; }
.text-gold { color: var(--gold); }
.text-sm { font-size: 0.78rem; }
.text-xs { font-size: 0.7rem; }
.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-1 { gap: 0.5rem; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.loading-placeholder {
  text-align: center;
  padding: 2rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-dim);
}
.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

/* ── Back to top ── */
.back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  transition: all var(--transition);
  z-index: 900;
}
.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}
.back-to-top:hover {
  background: var(--purple-dim);
  color: var(--purple);
  border-color: var(--purple);
}

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 2rem 1rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}
.footer-content p {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin: 0.2rem 0;
}
.footer-disclaimer {
  font-size: 0.72rem !important;
  color: var(--text-dim);
}
.footer-copy {
  font-size: 0.7rem !important;
  opacity: 0.6;
}

/* ══════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════ */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .menu-toggle { display: flex; }
  .bottom-nav { display: flex; }
  .main-container {
    padding-bottom: calc(var(--bottom-nav-height) + 1.5rem);
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .admin-grid {
    grid-template-columns: 1fr;
  }
  .compare-summary {
    grid-template-columns: repeat(2, 1fr);
  }
  .manual-body {
    flex-direction: column;
  }
  .manual-right {
    width: 100%;
    max-height: none;
  }
}

@media (max-width: 600px) {
  .main-container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  .page-header h2 {
    font-size: 1.25rem;
  }
  .profit-overview {
    grid-template-columns: 1fr;
  }
  .compare-summary {
    grid-template-columns: 1fr;
  }
  .generate-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .generate-controls .control-group {
    width: 100%;
  }
  .generate-controls .btn {
    width: 100%;
    justify-content: center;
  }
  .ticket-actions {
    justify-content: center;
  }
  .profit-filters {
    flex-direction: column;
    align-items: stretch;
  }
  .profit-filters select {
    width: 100%;
  }
  .data-table {
    font-size: 0.75rem;
  }
  .data-table th, .data-table td {
    padding: 0.4rem 0.3rem;
  }
  .ball-grid {
    grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
  }
  .ball-cell {
    width: 34px;
    height: 34px;
    font-size: 0.72rem;
  }
  .back-to-top {
    bottom: calc(var(--bottom-nav-height) + 1rem);
  }
}

/* ══════════════════════════════════════
   COMPACT VIEW — 精简视图（大号码无按钮）
   ══════════════════════════════════════ */
.ball-xl {
  width: 42px; height: 42px;
  font-size: 1.3rem;
  font-weight: 700;
}
.ball-separator-lg {
  font-size: 1.4rem;
  font-weight: 700;
}
.ticket-compact {
  padding: 0.6rem 0.8rem;
  text-align: center;
}
.ticket-compact .ticket-balls-lg {
  justify-content: center;
  gap: 0.5rem;
  padding: 0.3rem 0;
}
body.compact-view .ticket-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 0.5rem;
}
body.compact-view .list-actions {
  display: none;
}

/* ── 命中号码圈出（比对结果） ── */
.ball-hit-circle {
  outline: 3px solid var(--gold);
  outline-offset: 1px;
  box-shadow: 0 0 12px rgba(255,215,0,0.5), inset 0 1px 0 rgba(255,255,255,0.2);
  animation: ballHitPulse 1.5s ease-in-out infinite;
}
@keyframes ballHitPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(255,215,0,0.4), inset 0 1px 0 rgba(255,255,255,0.2); }
  50% { box-shadow: 0 0 18px rgba(255,215,0,0.7), inset 0 1px 0 rgba(255,255,255,0.2); }
}

/* ── 弹窗层级（比对弹窗浮于手动选号弹窗之上） ── */
.modal-top {
  z-index: 2100 !important;
}

/* ── 自定义确认弹窗 ── */
.modal-small {
  max-width: 400px;
  width: 90%;
}
.confirm-message {
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.6;
  margin: 0;
  padding: 0.5rem 0;
}

/* ══════════════════════════════════════
   SERVER酱 SCKEY 引导
   ══════════════════════════════════════ */
.sckey-guide {
  margin-top: 0.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
}
.sckey-guide details {
  cursor: pointer;
}
.sckey-guide summary {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  user-select: none;
}
.sckey-guide summary:hover {
  color: var(--purple);
}
.sckey-guide ol {
  margin: 0.6rem 0 0.4rem 1.2rem;
  padding: 0;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.8;
}
.sckey-guide ol a {
  color: var(--green);
  text-decoration: none;
  font-weight: 500;
}
.sckey-guide ol a:hover {
  text-decoration: underline;
}
.sckey-guide code {
  background: var(--bg-card);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.75rem;
  color: var(--gold);
}
.sckey-guide .text-xs {
  font-size: 0.72rem;
  margin-top: 0.3rem;
}

/* ── 自动保存标签 ── */
.auto-save-tag {
  display: inline;
  font-size: 0.7rem;
  color: var(--green);
  font-weight: 500;
  margin-left: 0.4rem;
}

/* ══════════════════════════════════════
   HISTORY TABLE — 历史开奖表格
   ══════════════════════════════════════ */
.history-table {
  width: 100%;
}
.history-table .balls-inline {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
}
.input-search {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  padding: 0.4rem 0.7rem;
  font-size: 0.82rem;
  outline: none;
}
.input-search:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 2px var(--purple-dim);
}
