/* ==========================================================================
   Design Tokens & Root Variables
   ========================================================================== */
:root {
  /* Color Palette */
  --bg-space: #06040f;
  --bg-card: rgba(18, 14, 38, 0.45);
  --bg-card-hover: rgba(26, 20, 54, 0.6);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-focus: rgba(138, 43, 226, 0.4);
  
  --color-primary: #8a2be2;      /* Neon Violet */
  --color-primary-light: #b57cff;
  --color-secondary: #00f2fe;    /* Neon Cyan */
  --color-accent: #ff007a;       /* Cyber Pink */
  --color-accent-gold: #ffbe0b;  /* Cosmic Gold */
  
  --color-text-main: #f3f0ff;
  --color-text-muted: #9f9bad;
  --color-text-dark: #0e0a24;
  
  --shadow-neon: 0 0 20px rgba(138, 43, 226, 0.35);
  --shadow-neon-cyan: 0 0 20px rgba(0, 242, 254, 0.35);
  --shadow-card: 0 20px 50px rgba(0, 0, 0, 0.3);
  
  /* Lotto Ball Gradients */
  --ball-gradient-yellow: radial-gradient(circle at 35% 35%, #ffe600 0%, #ff9900 60%, #b35900 100%);
  --ball-gradient-blue: radial-gradient(circle at 35% 35%, #00f0ff 0%, #0072ff 60%, #0033aa 100%);
  --ball-gradient-red: radial-gradient(circle at 35% 35%, #ff4d4d 0%, #e60000 60%, #800000 100%);
  --ball-gradient-gray: radial-gradient(circle at 35% 35%, #e0e0e0 0%, #888888 60%, #444444 100%);
  --ball-gradient-green: radial-gradient(circle at 35% 35%, #5af27f 0%, #00a82d 60%, #005916 100%);
  
  /* Fonts */
  --font-display: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Fira Code', monospace;
  
  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==========================================================================
   Light Theme Tokens (White Mode)
   ========================================================================== */
[data-theme="light"] {
  /* Color Palette */
  --bg-space: #f0edf8;
  --bg-card: rgba(255, 255, 255, 0.65);
  --bg-card-hover: rgba(255, 255, 255, 0.85);
  --border-glass: rgba(138, 43, 226, 0.12);
  --border-glass-focus: rgba(138, 43, 226, 0.5);
  
  --color-primary: #701ebf;      /* Deep Violet */
  --color-primary-light: #8e42ff;
  --color-secondary: #009db8;    /* Darker Cyan for legibility */
  --color-accent: #e6006f;       /* Deep Pink */
  --color-accent-gold: #e59b00;  /* Gold */
  
  --color-text-main: #1b1733;
  --color-text-muted: #6f6b85;
  --color-text-dark: #f0edf8;
  
  --shadow-neon: 0 0 15px rgba(138, 43, 226, 0.15);
  --shadow-neon-cyan: 0 0 15px rgba(0, 157, 184, 0.15);
  --shadow-card: 0 20px 40px rgba(138, 43, 226, 0.08);
}


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

body {
  font-family: var(--font-body);
  background-color: var(--bg-space);
  color: var(--color-text-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(6, 4, 15, 0.5);
}
::-webkit-scrollbar-thumb {
  background: rgba(138, 43, 226, 0.3);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(138, 43, 226, 0.6);
}

/* ==========================================================================
   Nebula Space Background
   ========================================================================== */
.space-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -2;
  overflow: hidden;
  background: radial-gradient(circle at center, #0f0a2a 0%, #05030d 100%);
}

.nebula {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.45;
  mix-blend-mode: screen;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.nebula-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(138, 43, 226, 0.5) 0%, rgba(138, 43, 226, 0) 70%);
  top: 20%;
  left: 30%;
  animation: floatNebula 25s infinite alternate ease-in-out;
}

.nebula-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(0, 242, 254, 0.4) 0%, rgba(0, 242, 254, 0) 70%);
  top: 70%;
  left: 80%;
  animation: floatNebula 30s infinite alternate-reverse ease-in-out;
}

.nebula-3 {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, rgba(255, 0, 122, 0.3) 0%, rgba(255, 0, 122, 0) 70%);
  top: 50%;
  left: 10%;
  animation: floatNebula 28s infinite alternate ease-in-out 5s;
}

@keyframes floatNebula {
  0% { transform: translate(-50%, -50%) scale(1) translate(0, 0); }
  50% { transform: translate(-50%, -50%) scale(1.1) translate(30px, -50px); }
  100% { transform: translate(-50%, -50%) scale(0.9) translate(-40px, 40px); }
}

/* ==========================================================================
   Layout Containers
   ========================================================================== */
.app-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

/* Header */
.app-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.logo-icon {
  font-size: 2.75rem;
  color: var(--color-secondary);
  animation: rotateLogo 8s linear infinite;
  text-shadow: 0 0 15px rgba(0, 242, 254, 0.6);
}

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

.logo h1 {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: 2px;
  background: linear-gradient(to right, var(--color-text-main), var(--color-primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo h1 span {
  background: linear-gradient(to right, var(--color-primary-light), var(--color-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 1rem;
  color: var(--color-text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 2rem;
}

/* Tab Navigation */
.tab-navigation {
  display: inline-flex;
  background: rgba(18, 14, 38, 0.6);
  padding: 0.35rem;
  border-radius: 100px;
  border: 1px border-glass;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  padding: 0.75rem 1.5rem;
  border-radius: 100px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
}

.tab-btn:hover {
  color: var(--color-text-main);
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--color-primary), rgba(138, 43, 226, 0.5));
  color: var(--color-text-main);
  box-shadow: 0 4px 15px rgba(138, 43, 226, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.tab-btn span.material-symbols-rounded {
  font-size: 1.25rem;
  transition: transform var(--transition-normal);
}

.tab-btn:hover span.material-symbols-rounded {
  transform: translateY(-1px);
}

/* ==========================================================================
   Tab Panel Structure
   ========================================================================== */
.tab-panel {
  display: none;
  animation: fadeIn var(--transition-normal) forwards;
}

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

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

.panel-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 900px) {
  .panel-layout {
    grid-template-columns: 360px 1fr;
  }
}

.panel-layout-centered {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
}

/* ==========================================================================
   Component UI - Glassmorphic Cards
   ========================================================================== */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  padding: 2rem;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0) 100%);
  pointer-events: none;
  z-index: 1;
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.glass-card.full-width {
  width: 100%;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text-main);
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 0.75rem;
}

.title-icon {
  color: var(--color-primary-light);
}

.card-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.card-header-actions .card-title {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.card-desc {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

/* ==========================================================================
   Inputs & Controls
   ========================================================================== */
.control-group {
  margin-bottom: 1.75rem;
}

.control-group label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--color-text-main);
}

.field-desc {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: -0.25rem;
  margin-bottom: 0.5rem;
}

/* Inputs styling */
input[type="text"],
select,
input[type="date"] {
  width: 100%;
  background: rgba(6, 4, 15, 0.5);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  color: var(--color-text-main);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: all var(--transition-normal);
}

input[type="text"]:focus,
select:focus,
input[type="date"]:focus {
  border-color: var(--color-primary-light);
  box-shadow: 0 0 10px rgba(138, 43, 226, 0.2);
  background: rgba(6, 4, 15, 0.8);
}

/* Range Selector */
.range-selector {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

input[type="range"] {
  flex-grow: 1;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.1);
  height: 6px;
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-secondary));
  cursor: pointer;
  box-shadow: 0 0 8px rgba(0, 242, 254, 0.5);
  transition: transform var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.badge {
  background: rgba(138, 43, 226, 0.2);
  color: var(--color-primary-light);
  border: 1px solid rgba(138, 43, 226, 0.3);
  padding: 0.35rem 0.85rem;
  border-radius: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  min-width: 65px;
  text-align: center;
}

/* Badge tags inside input container */
.badge-input-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.badge-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.input-badge {
  background: rgba(0, 242, 254, 0.15);
  border: 1px solid rgba(0, 242, 254, 0.3);
  color: var(--color-secondary);
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.input-badge.badge-exclude {
  background: rgba(255, 0, 122, 0.15);
  border: 1px solid rgba(255, 0, 122, 0.3);
  color: var(--color-accent);
}

.input-badge .badge-close {
  cursor: pointer;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background var(--transition-fast);
}

.input-badge .badge-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 12px;
  font-family: var(--font-display);
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: all var(--transition-normal);
  padding: 0.8rem 1.5rem;
  font-size: 0.95rem;
  border: none;
}

.btn-lg {
  padding: 1.1rem 2.2rem;
  font-size: 1.1rem;
  border-radius: 16px;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  border-radius: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, #681cbd 100%);
  color: var(--color-text-main);
  box-shadow: 0 8px 25px rgba(138, 43, 226, 0.4);
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -50%;
  width: 200%;
  height: 100%;
  background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0) 100%);
  transform: skewX(-25deg);
  transition: 0.75s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(138, 43, 226, 0.6);
}

.btn-primary:hover::after {
  left: 125%;
}

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

.btn-accent {
  background: linear-gradient(135deg, var(--color-accent) 0%, #cc005f 100%);
  color: var(--color-text-main);
  box-shadow: 0 8px 25px rgba(255, 0, 122, 0.4);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(255, 0, 122, 0.6);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-glass);
  color: var(--color-text-main);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--color-text-muted);
}

.btn-danger {
  background: rgba(255, 0, 122, 0.15);
  border: 1px solid rgba(255, 0, 122, 0.3);
  color: var(--color-accent);
}

.btn-danger:hover {
  background: rgba(255, 0, 122, 0.3);
  border-color: var(--color-accent);
}

.full-width {
  width: 100%;
}

/* ==========================================================================
   Lotto Drawing Machine (Nebula Machine)
   ========================================================================== */
.panel-machine {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, rgba(30, 20, 70, 0.5) 0%, var(--bg-card) 100%);
}

.nebula-machine {
  margin-bottom: 2rem;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.machine-glass {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.02) 60%, rgba(0, 242, 254, 0.05) 100%);
  border: 2px solid rgba(255, 255, 255, 0.15);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 20px 30px rgba(255, 255, 255, 0.05), inset 0 -20px 30px rgba(0, 0, 0, 0.8), 0 15px 35px rgba(0, 0, 0, 0.5), 0 0 50px rgba(0, 242, 254, 0.15);
  overflow: hidden;
}

.core-globe {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(138, 43, 226, 0.4) 0%, rgba(138, 43, 226, 0) 70%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.machine-spark {
  font-size: 2.25rem;
  color: var(--color-secondary);
  animation: glowSpark 2s infinite ease-in-out;
}

@keyframes glowSpark {
  0%, 100% { opacity: 0.5; transform: scale(1); filter: drop-shadow(0 0 2px var(--color-secondary)); }
  50% { opacity: 1; transform: scale(1.2); filter: drop-shadow(0 0 15px var(--color-secondary)); }
}

.orbit-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px dashed rgba(255,255,255,0.08);
  pointer-events: none;
}

.orbit-1 {
  width: 160px;
  height: 160px;
  border-color: rgba(138, 43, 226, 0.15);
  animation: spinOrbit 15s linear infinite;
}

.orbit-2 {
  width: 120px;
  height: 120px;
  border-color: rgba(0, 242, 254, 0.15);
  animation: spinOrbit 10s linear infinite reverse;
}

.orbit-3 {
  width: 80px;
  height: 80px;
  border-color: rgba(255, 0, 122, 0.15);
  animation: spinOrbit 6s linear infinite;
}

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

/* Particles/Balls inside machine */
.particles-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.machine-particle {
  position: absolute;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  opacity: 0.75;
  filter: blur(0.5px);
}

.machine-status {
  margin-top: 1rem;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--color-secondary);
  text-transform: uppercase;
}

/* Machine Drawing Animation Mode */
.machine-glass.drawing {
  animation: vibrateMachine 0.15s infinite linear;
  box-shadow: inset 0 20px 30px rgba(255, 255, 255, 0.05), inset 0 -20px 30px rgba(0, 0, 0, 0.8), 0 15px 35px rgba(0, 0, 0, 0.5), 0 0 60px rgba(138, 43, 226, 0.4);
}

@keyframes vibrateMachine {
  0% { transform: translate(1px, 1px) rotate(0deg); }
  10% { transform: translate(-1px, -2px) rotate(-0.5deg); }
  20% { transform: translate(-3px, 0px) rotate(0.5deg); }
  30% { transform: translate(0px, 2px) rotate(0deg); }
  40% { transform: translate(1px, -1px) rotate(0.5deg); }
  50% { transform: translate(-1px, 2px) rotate(-0.5deg); }
  60% { transform: translate(-3px, 1px) rotate(0deg); }
  75% { transform: translate(2px, 1px) rotate(-0.5deg); }
  90% { transform: translate(-1px, -1px) rotate(0.5deg); }
}

/* ==========================================================================
   Lotto Balls Rendering
   ========================================================================== */
.draw-results {
  width: 100%;
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-height: 120px;
}

.results-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 120px;
  color: var(--color-text-muted);
  gap: 0.75rem;
  font-size: 0.95rem;
}

.results-placeholder span {
  font-size: 2.5rem;
  opacity: 0.3;
}

/* Individual Game Set Card */
.game-result-row {
  background: rgba(6, 4, 15, 0.4);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: slideInResult 0.4s var(--transition-bounce) forwards;
}

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

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.game-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-primary-light);
}

.game-stats-quick {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  display: flex;
  gap: 0.75rem;
  font-family: var(--font-mono);
}

.balls-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
  align-items: center;
  padding: 0.25rem 0;
}

/* Premium 3D Ball Styling */
.lotto-ball {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.3);
  position: relative;
  user-select: none;
  opacity: 0;
  transform: scale(0.3) rotate(-180deg);
  animation: popBall 0.5s var(--transition-bounce) forwards;
}

/* Sequential Reveal Delays */
.lotto-ball:nth-child(1) { animation-delay: 0.1s; }
.lotto-ball:nth-child(2) { animation-delay: 0.25s; }
.lotto-ball:nth-child(3) { animation-delay: 0.4s; }
.lotto-ball:nth-child(4) { animation-delay: 0.55s; }
.lotto-ball:nth-child(5) { animation-delay: 0.7s; }
.lotto-ball:nth-child(6) { animation-delay: 0.85s; }

@keyframes popBall {
  to {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* Ball Color Mapping based on Ranges */
.lotto-ball.range-10 { background: var(--ball-gradient-yellow); }
.lotto-ball.range-20 { background: var(--ball-gradient-blue); }
.lotto-ball.range-30 { background: var(--ball-gradient-red); }
.lotto-ball.range-40 { background: var(--ball-gradient-gray); }
.lotto-ball.range-45 { background: var(--ball-gradient-green); }

/* Ring Glow for Inclusion Numbers (Custom visual cue) */
.lotto-ball.ball-included::after {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  border-radius: 50%;
  border: 2px solid var(--color-secondary);
  animation: pulseIncluded 1.5s infinite;
  box-shadow: 0 0 8px var(--color-secondary);
}

@keyframes pulseIncluded {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.08); opacity: 0.3; }
  100% { transform: scale(1); opacity: 0.8; }
}

/* ==========================================================================
   History Section
   ========================================================================== */
.history-list-wrapper {
  overflow-x: auto;
  margin-top: 1rem;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.history-table th {
  padding: 1rem;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--border-glass);
  font-size: 0.9rem;
}

.history-table td {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border-glass);
  vertical-align: middle;
}

.history-table tbody tr {
  transition: background var(--transition-fast);
}

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

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

.history-time {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  display: block;
}

.history-time-relative {
  font-size: 0.75rem;
  color: var(--color-primary-light);
  display: block;
  margin-top: 0.2rem;
}

.history-sum {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.95rem;
}

.history-ratio {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.history-table .balls-container {
  justify-content: flex-start;
  padding: 0;
}

/* Compact Lotty Balls for History Table */
.history-table .lotto-ball {
  width: 32px;
  height: 32px;
  font-size: 0.85rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
  opacity: 1;
  transform: none;
  animation: none;
}

.action-buttons {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1rem;
  color: var(--color-text-muted);
  text-align: center;
  gap: 1rem;
}

.history-empty span {
  font-size: 3rem;
  opacity: 0.2;
}

/* ==========================================================================
   Stats Dashboard
   ========================================================================== */
.panel-stats-summary {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.stats-card {
  background: rgba(6, 4, 15, 0.3);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 1.25rem;
}

.stats-card h3 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-text-muted);
  margin-bottom: 0.85rem;
  letter-spacing: 0.5px;
}

.stats-card .number-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.stats-card .lotto-ball {
  width: 36px;
  height: 36px;
  font-size: 0.95rem;
  opacity: 1;
  transform: none;
  animation: none;
}

.stat-empty-text {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-style: italic;
  padding: 0.5rem 0;
}

/* Odd Even Gauge */
.ratio-gauge-wrapper {
  margin-top: 0.5rem;
}

.ratio-bar {
  height: 12px;
  width: 100%;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  background: rgba(255,255,255,0.05);
}

.ratio-segment {
  height: 100%;
  transition: width var(--transition-slow) ease-in-out;
}

.ratio-odd {
  background: linear-gradient(to right, var(--color-accent), #d100c4);
}

.ratio-even {
  background: linear-gradient(to right, #00c6ff, var(--color-secondary));
}

.ratio-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

#label-ratio-odd {
  color: var(--color-accent);
}

#label-ratio-even {
  color: var(--color-secondary);
}

/* Stats Chart - Frequency Bars */
.panel-stats-chart {
  display: flex;
  flex-direction: column;
}

.chart-container {
  display: grid;
  grid-template-columns: 40px 1fr;
  height: 300px;
  margin-top: 1.5rem;
  position: relative;
  gap: 0.75rem;
}

.chart-y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-align: right;
  padding-bottom: 20px; /* offset bar labels */
}

.chart-bars-wrapper {
  display: grid;
  grid-template-columns: repeat(45, 1fr);
  gap: 2px;
  height: 100%;
  align-items: flex-end;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 600px) {
  .chart-bars-wrapper {
    gap: 1px;
  }
}

.chart-bar-col {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  position: relative;
}

.chart-bar-active {
  width: 100%;
  background: linear-gradient(to top, var(--color-primary), var(--color-secondary));
  border-radius: 2px 2px 0 0;
  min-height: 1px;
  transition: height var(--transition-slow) ease-out;
  cursor: pointer;
}

.chart-bar-active:hover {
  background: linear-gradient(to top, var(--color-accent), var(--color-secondary));
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.6);
}

.chart-bar-label {
  position: absolute;
  bottom: -20px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--color-text-muted);
  transform: scale(0.9);
}

/* Tooltip on chart hover */
.chart-bar-active::after {
  content: attr(data-count) '회';
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%) scale(0.8);
  background: #0e0a24;
  border: 1px solid var(--color-secondary);
  color: var(--color-text-main);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast) ease-in-out, transform var(--transition-fast) ease-in-out;
  white-space: nowrap;
  z-index: 10;
}

.chart-bar-active:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.chart-x-axis-label {
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 1rem;
}

/* ==========================================================================
   Fortune Section
   ========================================================================== */
.panel-fortune-card {
  max-width: 550px;
  width: 100%;
}

.fortune-form {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 500px) {
  .form-row {
    grid-template-columns: 1fr 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
}

.divider {
  border: none;
  border-top: 1px solid var(--border-glass);
  margin: 2rem 0;
}

/* Fortune Result Card */
.fortune-result-box {
  display: none;
  animation: fadeIn var(--transition-normal) forwards;
}

.fortune-result-box.active {
  display: block;
}

.fortune-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.fortune-score-container {
  display: flex;
  flex-direction: column;
}

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

.score-value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--color-accent-gold);
  text-shadow: 0 0 10px rgba(255, 190, 11, 0.4);
}

.fortune-badge {
  background: rgba(255, 190, 11, 0.15);
  border: 1px solid rgba(255, 190, 11, 0.3);
  color: var(--color-accent-gold);
  padding: 0.4rem 1rem;
  border-radius: 100px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
}

.fortune-desc {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--color-text-main);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 1rem;
  border-left: 3px solid var(--color-accent-gold);
  margin-bottom: 1.5rem;
}

.fortune-balls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin: 2rem 0;
}

.fortune-actions {
  display: flex;
  justify-content: center;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.app-footer {
  text-align: center;
  padding: 2.5rem 1rem 0;
  border-top: 1px solid var(--border-glass);
  margin-top: 4rem;
}

.app-footer p {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.app-footer .disclaimer {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   Toast Notification System
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 320px;
  width: 100%;
}

.toast {
  background: rgba(18, 14, 38, 0.9);
  border: 1px solid var(--color-primary-light);
  color: var(--color-text-main);
  padding: 1rem 1.25rem;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(138, 43, 226, 0.2);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  backdrop-filter: blur(10px);
  transform: translateY(20px);
  opacity: 0;
  animation: slideInToast 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: auto;
}

.toast.toast-success {
  border-color: var(--color-secondary);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(0, 242, 254, 0.2);
}

.toast.toast-warning {
  border-color: var(--color-accent);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(255, 0, 122, 0.2);
}

.toast-icon {
  font-size: 1.25rem;
}

.toast-icon.success { color: var(--color-secondary); }
.toast-icon.warning { color: var(--color-accent); }
.toast-icon.info { color: var(--color-primary-light); }

@keyframes slideInToast {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.toast.toast-exit {
  animation: slideOutToast 0.3s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}

@keyframes slideOutToast {
  to {
    transform: translateY(10px) scale(0.95);
    opacity: 0;
  }
}

/* ==========================================================================
   Theme Toggle & Theme Specific Styles
   ========================================================================== */
.theme-toggle-btn {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  color: var(--color-text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-card);
  transition: all var(--transition-normal);
}

.theme-toggle-btn:hover {
  transform: scale(1.1) rotate(15deg);
  border-color: var(--color-secondary);
  color: var(--color-secondary);
  box-shadow: var(--shadow-neon-cyan);
}

.theme-toggle-btn:active {
  transform: scale(0.95);
}

.theme-toggle-btn span {
  font-size: 1.5rem;
}

/* Light Theme Override Tweaks */
[data-theme="light"] ::-webkit-scrollbar-track {
  background: rgba(240, 237, 248, 0.5);
}
[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(138, 43, 226, 0.2);
}
[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(138, 43, 226, 0.4);
}

[data-theme="light"] .space-bg {
  background: radial-gradient(circle at center, #fcfbfe 0%, #ece9f6 100%);
}

[data-theme="light"] .nebula {
  opacity: 0.2;
}

[data-theme="light"] .nebula-1 {
  background: radial-gradient(circle, rgba(138, 43, 226, 0.15) 0%, rgba(138, 43, 226, 0) 70%);
}

[data-theme="light"] .nebula-2 {
  background: radial-gradient(circle, rgba(0, 242, 254, 0.12) 0%, rgba(0, 242, 254, 0) 70%);
}

[data-theme="light"] .nebula-3 {
  background: radial-gradient(circle, rgba(255, 0, 122, 0.1) 0%, rgba(255, 0, 122, 0) 70%);
}

[data-theme="light"] .machine-glass {
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0.2) 60%, rgba(0, 242, 254, 0.1) 100%);
  border: 2px solid rgba(138, 43, 226, 0.2);
  box-shadow: inset 0 20px 30px rgba(255, 255, 255, 0.4), inset 0 -20px 30px rgba(0, 0, 0, 0.1), 0 15px 35px rgba(138, 43, 226, 0.08), 0 0 30px rgba(0, 242, 254, 0.1);
}

[data-theme="light"] .machine-glass.drawing {
  box-shadow: inset 0 20px 30px rgba(255, 255, 255, 0.4), inset 0 -20px 30px rgba(0, 0, 0, 0.1), 0 15px 35px rgba(138, 43, 226, 0.08), 0 0 40px rgba(138, 43, 226, 0.25);
}

[data-theme="light"] input[type="text"],
[data-theme="light"] select,
[data-theme="light"] input[type="date"] {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(138, 43, 226, 0.15);
}

[data-theme="light"] input[type="text"]:focus,
[data-theme="light"] select:focus,
[data-theme="light"] input[type="date"]:focus {
  background: #ffffff;
  border-color: var(--color-primary);
}

[data-theme="light"] .game-result-row {
  background: rgba(255, 255, 255, 0.5);
}

[data-theme="light"] .tab-navigation {
  background: rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 2px 4px rgba(138, 43, 226, 0.05);
}

[data-theme="light"] .tab-btn:hover {
  color: var(--color-primary);
}

[data-theme="light"] .tab-btn.active {
  background: linear-gradient(135deg, var(--color-primary), rgba(138, 43, 226, 0.7));
  color: #ffffff;
}

[data-theme="light"] .toast {
  background: rgba(255, 255, 255, 0.95);
  color: var(--color-text-main);
  box-shadow: 0 10px 30px rgba(138, 43, 226, 0.08);
}

[data-theme="light"] .app-footer .disclaimer {
  color: rgba(0, 0, 0, 0.4);
}

