/* ==========================================================================
   Design Tokens & CSS Variables
   ========================================================================== */
:root {
  --font-primary: 'Outfit', 'Noto Sans KR', sans-serif;
  
  /* Color System */
  --bg-dark-base: #030712;
  --bg-dark-elevated: rgba(17, 24, 39, 0.65);
  --border-glow: rgba(255, 255, 255, 0.08);
  --border-active: rgba(99, 102, 241, 0.5);
  
  --primary-accent: #6366f1; /* Indigo */
  --primary-glow: rgba(99, 102, 241, 0.35);
  --secondary-accent: #06b6d4; /* Cyan */
  --accent-gold: #f59e0b; /* Amber */
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  /* Lotto Ball Colors (Official Korean Standard) */
  --lotto-yellow-light: #fbbf24;
  --lotto-yellow-dark: #d97706;
  --lotto-blue-light: #60a5fa;
  --lotto-blue-dark: #2563eb;
  --lotto-red-light: #f87171;
  --lotto-red-dark: #dc2626;
  --lotto-gray-light: #94a3b8;
  --lotto-gray-dark: #475569;
  --lotto-green-light: #4ade80;
  --lotto-green-dark: #16a34a;
  
  /* Interactive States */
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-premium: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
}

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

body {
  font-family: var(--font-primary);
  background-color: var(--bg-dark-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.6;
}

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

/* ==========================================================================
   Background Ambient Lights (Framer-like glows)
   ========================================================================== */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  opacity: 0.45;
  pointer-events: none;
}
.glow-1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(99,102,241,0.4) 0%, rgba(0,0,0,0) 70%);
  top: -100px;
  left: -100px;
}
.glow-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(6,182,212,0.3) 0%, rgba(0,0,0,0) 70%);
  bottom: -150px;
  right: -100px;
}
.glow-3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(236,72,153,0.2) 0%, rgba(0,0,0,0) 70%);
  top: 40%;
  left: 60%;
}

/* ==========================================================================
   Glassmorphism Utility
   ========================================================================== */
.glass-panel {
  background: var(--bg-dark-elevated);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glow);
  border-radius: 20px;
  box-shadow: var(--shadow-premium);
  transition: var(--transition-smooth);
}
.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

/* ==========================================================================
   App Container & Header
   ========================================================================== */
.app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 100vh;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-glow);
  border-radius: 18px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-icon-wrap {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary-accent), var(--secondary-accent));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.logo-icon {
  width: 22px;
  height: 22px;
  color: white;
  animation: logo-spin 6s linear infinite;
}

.logo-text h1 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

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

.logo-text p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn-icon {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glow);
  border-radius: 12px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--secondary-accent);
  border-color: rgba(6, 182, 212, 0.3);
}

.btn-text-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444;
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.btn-text-icon:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--primary-accent), #4f46e5);
  border: none;
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glow);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-accent-sm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid var(--primary-accent);
  color: #a5b4fc;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.btn-accent-sm:hover {
  background: var(--primary-accent);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 10px 20px;
  border-radius: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.btn-ghost-sm {
  background: transparent;
  border: 1px solid var(--border-glow);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.btn-ghost-sm:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger-sm {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.btn-danger-sm:hover {
  background: #ef4444;
  color: white;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* ==========================================================================
   Main Layout Structure
   ========================================================================== */
.app-main {
  display: grid;
  grid-template-columns: 1.1fr 1.3fr;
  gap: 24px;
}

@media (max-width: 992px) {
  .app-main {
    grid-template-columns: 1fr;
  }
}

.section-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--secondary-accent);
  background: rgba(6, 182, 212, 0.1);
  padding: 4px 10px;
  border-radius: 50px;
  margin-bottom: 20px;
}
.section-badge i {
  width: 12px;
  height: 12px;
}

/* ==========================================================================
   Left Panel: Lottery Draw Machine UI
   ========================================================================== */
.machine-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 32px 24px;
  min-height: 520px;
}

/* 3D-like Cage visualizer */
.lottery-cage-wrapper {
  position: relative;
  width: 100%;
  height: 220px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.lottery-cage {
  position: relative;
  width: 200px;
  height: 200px;
}

.cage-sphere {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3.5px dashed rgba(255, 255, 255, 0.25);
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.0) 70%);
  box-shadow: inset 0 0 25px rgba(255, 255, 255, 0.05), 0 0 30px rgba(99, 102, 241, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  animation: rotate-cage 40s linear infinite;
  z-index: 2;
}

.cage-sphere.shaking {
  animation: shake-cage 0.12s linear infinite, rotate-cage 4s linear infinite;
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: inset 0 0 35px rgba(255, 255, 255, 0.15), 0 0 40px rgba(99, 102, 241, 0.25);
}

.cage-axis {
  position: absolute;
  width: 112%;
  height: 6px;
  background: linear-gradient(to right, #334155, #64748b, #334155);
  border-radius: 3px;
  z-index: 1;
}

.cage-stand-left, .cage-stand-right {
  position: absolute;
  bottom: -15px;
  width: 8px;
  height: 120px;
  background: linear-gradient(to top, #1e293b, #475569);
  border-radius: 4px;
}
.cage-stand-left {
  left: -12px;
  transform: rotate(-15deg);
  transform-origin: top;
}
.cage-stand-right {
  right: -12px;
  transform: rotate(15deg);
  transform-origin: top;
}

.cage-tube {
  position: absolute;
  bottom: -22px;
  left: calc(50% - 18px);
  width: 36px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top: none;
  background: linear-gradient(to bottom, rgba(15, 23, 42, 0.8), rgba(30, 41, 59, 0.5));
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  z-index: 1;
}

/* Inner Shaking Balls */
.inner-balls {
  position: absolute;
  width: 90%;
  height: 90%;
  border-radius: 50%;
}

.inner-ball {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ball-color, #fbbf24);
  box-shadow: inset -2px -2px 4px rgba(0, 0, 0, 0.3), inset 2px 2px 4px rgba(255, 255, 255, 0.4);
  transition: transform 0.1s ease;
}

/* Primary Draw Button */
.action-trigger-wrap {
  width: 100%;
  margin-top: 24px;
}

.btn-primary-draw {
  position: relative;
  width: 100%;
  height: 56px;
  border-radius: 16px;
  border: none;
  background: linear-gradient(135deg, var(--primary-accent), var(--secondary-accent));
  color: white;
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.3);
  transition: var(--transition-smooth);
}

.btn-primary-draw:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 35px rgba(99, 102, 241, 0.5);
}

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

.btn-glow {
  position: absolute;
  width: 120px;
  height: 100%;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0) 100%);
  top: 0;
  left: -120px;
  animation: shine-btn 4s ease-in-out infinite;
}

.btn-draw-icon {
  width: 22px;
  height: 22px;
  animation: float-icon 2s ease-in-out infinite;
}

/* Drawn Balls Row */
.drawn-balls-container {
  width: 100%;
  margin: 32px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.balls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 58px;
}

.balls-row-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.balls-row-labels span {
  width: 48px;
  text-align: center;
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
}
.balls-row-labels span.bonus-label {
  color: var(--secondary-accent);
}

.ball-slot {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 800;
  color: white;
  text-shadow: 0 1.5px 3px rgba(0, 0, 0, 0.4);
  box-shadow: inset -3px -3px 8px rgba(0, 0, 0, 0.35), inset 3px 3px 8px rgba(255, 255, 255, 0.3), 0 4px 10px rgba(0, 0, 0, 0.3);
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.5s;
}

.ball-slot.placeholder {
  background: rgba(255, 255, 255, 0.03);
  border: 2px dashed rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-weight: 400;
  text-shadow: none;
  box-shadow: none;
}

/* Individual Ball Color Themes (Official standard colors) */
.lotto-ball-yellow {
  background: radial-gradient(circle at 32% 32%, var(--lotto-yellow-light) 0%, var(--lotto-yellow-dark) 80%);
}
.lotto-ball-blue {
  background: radial-gradient(circle at 32% 32%, var(--lotto-blue-light) 0%, var(--lotto-blue-dark) 80%);
}
.lotto-ball-red {
  background: radial-gradient(circle at 32% 32%, var(--lotto-red-light) 0%, var(--lotto-red-dark) 80%);
}
.lotto-ball-gray {
  background: radial-gradient(circle at 32% 32%, var(--lotto-gray-light) 0%, var(--lotto-gray-dark) 80%);
}
.lotto-ball-green {
  background: radial-gradient(circle at 32% 32%, var(--lotto-green-light) 0%, var(--lotto-green-dark) 80%);
}

.ball-slot.bonus-slot::before {
  content: '+';
  position: absolute;
  left: -14px;
  font-size: 1.2rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Ball Pop Up Animation */
.ball-pop {
  animation: pop-ball 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* ==========================================================================
   Right Panel: Control Panel & Modes UI
   ========================================================================== */
.control-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tabs-container {
  overflow: hidden;
}

.tabs-header {
  display: flex;
  border-bottom: 1px solid var(--border-glow);
  background: rgba(0, 0, 0, 0.15);
  overflow-x: auto;
}

.tab-btn {
  flex: 1;
  min-width: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tab-btn i {
  width: 18px;
  height: 18px;
}
.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.02);
}
.tab-btn.active {
  color: var(--primary-accent);
  background: rgba(99, 102, 241, 0.04);
  border-bottom-color: var(--primary-accent);
}

.tabs-content {
  padding: 24px;
}

.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
  animation: fade-in 0.3s ease;
}

.tab-pane h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.tab-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* Form Styles */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* Custom Select Styling */
.custom-select-wrapper {
  position: relative;
  width: 100%;
}
.custom-select-wrapper select {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-glow);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 12px;
  font-family: var(--font-primary);
  font-size: 0.9rem;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.custom-select-wrapper select:focus {
  outline: none;
  border-color: var(--primary-accent);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.25);
}
.custom-select-wrapper::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 18px;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--text-secondary);
  pointer-events: none;
}

/* Tab 2: Balanced Filters Grid */
.filters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 576px) {
  .filters-grid {
    grid-template-columns: 1fr;
  }
}

.filter-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-glow);
  border-radius: 14px;
  padding: 14px;
}

.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.filter-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.filter-detail {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Switch UI */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .3s;
  border-radius: 34px;
  border: 1px solid var(--border-glow);
}
.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--primary-accent);
  border-color: rgba(99, 102, 241, 0.5);
}
input:checked + .slider:before {
  transform: translateX(20px);
}

/* Tab 3: Dream Interpreter Styles */
.dream-search-box {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.input-with-icon {
  position: relative;
  flex: 1;
}

.input-with-icon input {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-glow);
  color: var(--text-primary);
  padding: 12px 16px 12px 44px;
  border-radius: 12px;
  font-family: var(--font-primary);
  font-size: 0.9rem;
  transition: var(--transition-smooth);
}
.input-with-icon input:focus {
  outline: none;
  border-color: var(--primary-accent);
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}

.dream-tags-container {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 12px;
}
.tag-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 4px;
  white-space: nowrap;
}
.dream-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.dream-tag {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glow);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.dream-tag:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--primary-accent);
  color: #a5b4fc;
}

.dream-result-card {
  margin-top: 24px;
  background: rgba(99, 102, 241, 0.05);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 14px;
  padding: 16px;
  animation: slide-up 0.3s ease;
}
.dream-match-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.dream-match-title i {
  width: 18px;
  height: 18px;
}
.dream-match-numbers {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.dream-info-text {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.hidden {
  display: none !important;
}

/* Tab 4: Zodiac / Horoscope Meter */
.zodiac-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.zodiac-form-grid input[type="date"] {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-glow);
  color: var(--text-primary);
  padding: 11px 16px;
  border-radius: 12px;
  font-family: var(--font-primary);
  font-size: 0.9rem;
  outline: none;
}
.zodiac-form-grid input[type="date"]:focus {
  border-color: var(--primary-accent);
}

.fortune-meter-box {
  background: rgba(245, 158, 11, 0.03);
  border: 1px solid rgba(245, 158, 11, 0.15);
  border-radius: 16px;
  padding: 16px;
}
.meter-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.score-highlight {
  color: var(--accent-gold);
  font-weight: 800;
  font-size: 1.1rem;
}
.meter-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}
.meter-bar-fill {
  height: 100%;
  background: linear-gradient(to right, var(--accent-gold), #f97316);
  border-radius: 4px;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
  transition: width 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.1);
}
.meter-summary-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Tab 5: Custom Panel Lotto Selector Grid */
.custom-selection-board {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
}
.board-indicator {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
}
.indicator-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--text-secondary);
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.legend-dot.fixed {
  background: var(--primary-accent);
  box-shadow: 0 0 8px var(--primary-accent);
}
.legend-dot.excluded {
  background: #334155;
  text-decoration: line-through;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.lotto-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 6px;
}
@media (max-width: 576px) {
  .lotto-grid {
    grid-template-columns: repeat(7, 1fr);
  }
}

.btn-grid-num {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
  font-family: var(--font-primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}
.btn-grid-num:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}
.btn-grid-num.state-fixed {
  background: var(--primary-accent);
  color: white;
  border-color: var(--primary-accent);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}
.btn-grid-num.state-excluded {
  background: #1e293b;
  color: var(--text-muted);
  border-color: transparent;
  text-decoration: line-through;
  opacity: 0.5;
}

.custom-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.summary-box {
  display: flex;
  font-size: 0.8rem;
}
.summary-box .label {
  width: 70px;
  color: var(--text-muted);
  font-weight: 600;
}
.summary-box .value {
  color: var(--text-primary);
  font-weight: 500;
}

/* ==========================================================================
   Statistics Panel Dashboard
   ========================================================================== */
.stats-panel {
  padding: 20px;
  animation: slide-up 0.4s ease;
}

.panel-header {
  margin-bottom: 16px;
}
.panel-header h3 {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-header h3 i {
  width: 18px;
  height: 18px;
  color: var(--secondary-accent);
}
.panel-sub-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
@media (max-width: 576px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.stat-card {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-glow);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-name {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.stat-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  align-self: flex-start;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
}

.stat-badge.good {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}
.stat-badge.warn {
  background: rgba(234, 179, 8, 0.15);
  color: #fde047;
}

.color-distribution-wrap {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dist-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}
.dist-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
}
.dist-part {
  height: 100%;
  transition: width 0.5s ease;
}
.dist-part.d-yellow { background: var(--lotto-yellow-light); }
.dist-part.d-blue { background: var(--lotto-blue-light); }
.dist-part.d-red { background: var(--lotto-red-light); }
.dist-part.d-gray { background: var(--lotto-gray-light); }
.dist-part.d-green { background: var(--lotto-green-light); }

/* ==========================================================================
   Bottom Section: History UI
   ========================================================================== */
.history-section {
  padding: 24px;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.title-with-count {
  display: flex;
  align-items: center;
  gap: 12px;
}
.title-with-count h2 {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.title-with-count h2 i {
  width: 20px;
  height: 20px;
  color: var(--primary-accent);
}
.badge {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glow);
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.history-list-wrapper {
  min-height: 180px;
  position: relative;
}

.empty-history {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.empty-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.empty-history p {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.empty-history span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* History Tickets Layout */
.history-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ticket-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glow);
  border-radius: 14px;
  padding: 12px 18px;
  animation: slide-in-ticket 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.ticket-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
}

.ticket-left-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ticket-num-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
}
.ticket-mode-tag {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  align-self: flex-start;
}

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

.small-ball {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  box-shadow: inset -2px -2px 5px rgba(0, 0, 0, 0.3), inset 2px 2px 5px rgba(255, 255, 255, 0.2), 0 2px 6px rgba(0, 0, 0, 0.2);
}

.ticket-right-actions {
  display: flex;
  gap: 8px;
}
.btn-ticket-action {
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glow);
  border-radius: 8px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.btn-ticket-action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}
.btn-ticket-action.fav.active {
  color: var(--accent-gold);
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.05);
}
.btn-ticket-action.fav.active i {
  fill: var(--accent-gold);
}
.btn-ticket-action.del:hover {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.05);
}

/* Responsive Ticket Item */
@media (max-width: 640px) {
  .ticket-item {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px;
  }
  .ticket-left-info {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  .ticket-balls-wrap {
    justify-content: center;
  }
  .ticket-right-actions {
    justify-content: flex-end;
  }
}

/* ==========================================================================
   Modals & Popups
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-content {
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-open 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-glow);
}
.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-icon {
  width: 20px;
  height: 20px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-smooth);
}
.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-glow);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: rgba(0, 0, 0, 0.1);
}

/* Mock Draw Simulator Inner Styles */
.mock-draw-result-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glow);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 20px;
}
.box-title {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.mock-balls-row {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.mock-match-list-wrapper {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 14px;
  padding: 16px;
  max-height: 240px;
  overflow-y: auto;
}

.mock-match-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mock-match-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
}
.mock-match-balls {
  display: flex;
  gap: 4px;
}
.mock-mini-ball {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 800;
  color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.05);
  box-shadow: inset -1px -1px 3px rgba(0,0,0,0.3);
}
.mock-mini-ball.matched {
  color: white;
  text-shadow: 0 1px 1px rgba(0,0,0,0.3);
  box-shadow: inset -1.5px -1.5px 4px rgba(0, 0, 0, 0.3), inset 1.5px 1.5px 4px rgba(255, 255, 255, 0.2);
}

.mock-match-rank {
  font-size: 0.78rem;
  font-weight: 700;
}
.mock-match-rank.rank-1 { color: #f59e0b; }
.mock-match-rank.rank-2 { color: #a855f7; }
.mock-match-rank.rank-3 { color: #3b82f6; }
.mock-match-rank.rank-4 { color: #10b981; }
.mock-match-rank.rank-5 { color: #14b8a6; }
.mock-match-rank.rank-none { color: var(--text-muted); }

/* Favorites List Styles */
.favorites-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 380px;
  overflow-y: auto;
}
.fav-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glow);
  border-radius: 10px;
}
.fav-balls {
  display: flex;
  gap: 6px;
}
.btn-fav-delete {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: var(--transition-smooth);
}
.btn-fav-delete:hover {
  color: #ef4444;
}

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes logo-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes rotate-cage {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes shake-cage {
  0% { transform: translate(1px, 1px) rotate(0deg); }
  10% { transform: translate(-1px, -2px) rotate(-1deg); }
  20% { transform: translate(-3px, 0px) rotate(1deg); }
  30% { transform: translate(0px, 2px) rotate(0deg); }
  40% { transform: translate(1px, -1px) rotate(1deg); }
  50% { transform: translate(-1px, 2px) rotate(-1deg); }
  60% { transform: translate(-3px, 1px) rotate(0deg); }
  70% { transform: translate(2px, 1px) rotate(-1deg); }
  80% { transform: translate(-1px, -1px) rotate(1deg); }
  90% { transform: translate(2px, 2px) rotate(0deg); }
  100% { transform: translate(1px, -2px) rotate(-1deg); }
}

@keyframes shine-btn {
  0% { left: -120px; }
  15% { left: 100%; }
  100% { left: 100%; }
}

@keyframes float-icon {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-3px) rotate(8deg); }
}

@keyframes pop-ball {
  0% { transform: scale(0) translateY(20px); opacity: 0; }
  70% { transform: scale(1.15) translateY(-5px); opacity: 1; }
  100% { transform: scale(1) translateY(0); }
}

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

@keyframes slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modal-open {
  from { opacity: 0; transform: scale(0.95) translateY(15px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes slide-in-ticket {
  from { opacity: 0; transform: translateX(-15px); }
  to { opacity: 1; transform: translateX(0); }
}

.animate-float {
  animation: element-float 3s ease-in-out infinite;
}

@keyframes element-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
