/* ==========================================================================
   Lotto Fortune 6/45 - Modern Premium Design System
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-primary: #0a0e17;
  --bg-secondary: #121826;
  --bg-card: rgba(22, 30, 49, 0.7);
  --bg-card-hover: rgba(28, 38, 62, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(255, 215, 0, 0.25);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-gold: #f59e0b;
  --accent-gold-glow: rgba(245, 158, 11, 0.4);
  --accent-purple: #8b5cf6;
  --accent-blue: #3b82f6;
  --accent-emerald: #10b981;
  --accent-red: #ef4444;

  /* Official-style Ball Gradients (3D Spherical Effect) */
  --ball-yellow: radial-gradient(circle at 35% 30%, #fff7a9 0%, #facc15 35%, #ca8a04 75%, #854d0e 100%);
  --ball-yellow-shadow: 0 10px 20px -3px rgba(234, 179, 8, 0.5), inset 0 -4px 6px rgba(0, 0, 0, 0.4);

  --ball-blue: radial-gradient(circle at 35% 30%, #bae6fd 0%, #38bdf8 35%, #0284c7 75%, #0369a1 100%);
  --ball-blue-shadow: 0 10px 20px -3px rgba(14, 165, 233, 0.5), inset 0 -4px 6px rgba(0, 0, 0, 0.4);

  --ball-red: radial-gradient(circle at 35% 30%, #fecaca 0%, #f87171 35%, #dc2626 75%, #991b1b 100%);
  --ball-red-shadow: 0 10px 20px -3px rgba(239, 68, 68, 0.5), inset 0 -4px 6px rgba(0, 0, 0, 0.4);

  --ball-gray: radial-gradient(circle at 35% 30%, #f1f5f9 0%, #94a3b8 35%, #475569 75%, #1e293b 100%);
  --ball-gray-shadow: 0 10px 20px -3px rgba(100, 116, 139, 0.5), inset 0 -4px 6px rgba(0, 0, 0, 0.4);

  --ball-green: radial-gradient(circle at 35% 30%, #bbf7d0 0%, #4ade80 35%, #16a34a 75%, #14532d 100%);
  --ball-green-shadow: 0 10px 20px -3px rgba(34, 197, 94, 0.5), inset 0 -4px 6px rgba(0, 0, 0, 0.4);

  /* Radius & Shadows */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --glass-shadow: 0 12px 36px 0 rgba(0, 0, 0, 0.4);

  /* Typography */
  --font-family: 'Outfit', 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 20% 15%, rgba(139, 92, 246, 0.15) 0%, transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(245, 158, 11, 0.12) 0%, transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(59, 130, 246, 0.08) 0%, transparent 60%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

/* Confetti Canvas Overlay */
#confettiCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 999;
}

/* Container */
.app-container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

/* ==========================================================================
   Header Section
   ========================================================================== */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 1rem;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-logo-icon {
  width: 46px;
  height: 46px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
  font-size: 1.5rem;
}

.brand-info h1 {
  font-size: 1.55rem;
  font-weight: 800;
  background: linear-gradient(to right, #ffffff, #fef08a, #f59e0b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.brand-info p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
  font-size: 1.1rem;
}

.icon-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  padding: 0.3rem 0.75rem;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.7; }
}

/* ==========================================================================
   Hero Stage (Main Draw Area)
   ========================================================================== */
.hero-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.75rem;
  box-shadow: var(--glass-shadow);
  text-align: center;
  position: relative;
  overflow: hidden;
  margin-bottom: 2.25rem;
}

.hero-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, rgba(245, 158, 11, 0.04) 0%, transparent 60%);
  pointer-events: none;
}

.hero-top-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.round-tag {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(239, 68, 68, 0.15));
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fde047;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.35rem 1rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.5px;
}

.stage-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Lottery Balls Display */
.balls-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 2rem 0;
  min-height: 90px;
}

.ball-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.slot-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 1px;
}

.lotto-ball {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  position: relative;
  user-select: none;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform: scale(0.9);
  animation: ballAppear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.lotto-ball.rolling {
  animation: ballRoll 0.15s infinite alternate ease-in-out;
  filter: blur(0.5px);
}

@keyframes ballRoll {
  0% { transform: translateY(-3px) scale(0.96) rotate(-8deg); }
  100% { transform: translateY(3px) scale(1.02) rotate(8deg); }
}

@keyframes ballAppear {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.4) rotate(-30deg);
  }
  60% {
    transform: translateY(-8px) scale(1.1) rotate(10deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
  }
}

/* Ball Colors by Range */
.ball-range-1 {
  background: var(--ball-yellow);
  box-shadow: var(--ball-yellow-shadow);
  color: #1a1500;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
}

.ball-range-2 {
  background: var(--ball-blue);
  box-shadow: var(--ball-blue-shadow);
}

.ball-range-3 {
  background: var(--ball-red);
  box-shadow: var(--ball-red-shadow);
}

.ball-range-4 {
  background: var(--ball-gray);
  box-shadow: var(--ball-gray-shadow);
}

.ball-range-5 {
  background: var(--ball-green);
  box-shadow: var(--ball-green-shadow);
}

.ball-empty {
  background: rgba(255, 255, 255, 0.05);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.25);
  box-shadow: none;
}

.plus-divider {
  font-size: 1.75rem;
  font-weight: 300;
  color: var(--text-dim);
  margin: 0 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Stage Actions */
.stage-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.btn-primary {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #ffffff;
  border: none;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.85rem 2rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
  transition: var(--transition-smooth);
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 25px rgba(245, 158, 11, 0.5);
}

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

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

.btn-secondary {
  background: rgba(255, 255, 255, 0.07);
  color: #f8fafc;
  border: 1px solid var(--border-color);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition-smooth);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

/* Quick Analysis Stat Chips under Hero */
.hero-stats-row {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  flex-wrap: wrap;
}

.stat-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.stat-chip strong {
  color: #fff;
  font-weight: 700;
}

/* ==========================================================================
   2-Column Dashboard Layout (Games & Custom Controls)
   ========================================================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.75rem;
  margin-bottom: 2.5rem;
}

@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* Card Common */
.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

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

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Multi-Game Slip (5 Games: A to E) */
.slip-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.game-row {
  background: rgba(10, 14, 23, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition-smooth);
}

.game-row:hover {
  border-color: rgba(255, 215, 0, 0.3);
  background: rgba(20, 27, 44, 0.7);
}

.game-row-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.game-index-badge {
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--accent-gold);
}

.game-balls {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.mini-ball {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease;
}

.mini-ball:hover {
  transform: scale(1.15);
}

.mini-ball.ball-range-1 {
  color: #1a1500;
  text-shadow: none;
}

.game-row-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sm-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.sm-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

/* ==========================================================================
   Customization & Filters (Sidebar)
   ========================================================================== */
.sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.option-group {
  margin-bottom: 1.2rem;
}

.option-group:last-child {
  margin-bottom: 0;
}

.option-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.option-badge {
  font-size: 0.75rem;
  color: var(--accent-gold);
  font-weight: 600;
}

/* Number Selector Modal / Dropdown Grid */
.number-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 0.25rem;
  background: rgba(10, 14, 23, 0.5);
  padding: 0.6rem;
  border-radius: var(--radius-sm);
  max-height: 180px;
  overflow-y: auto;
}

.grid-num-btn {
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  color: var(--text-muted);
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
}

.grid-num-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.grid-num-btn.selected-include {
  background: #10b981;
  color: #fff;
  border-color: #34d399;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.grid-num-btn.selected-exclude {
  background: #ef4444;
  color: #fff;
  border-color: #f87171;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 28px;
  margin-top: 0.4rem;
}

.filter-tag {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.filter-tag.inc {
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.filter-tag.exc {
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.tag-remove {
  cursor: pointer;
  opacity: 0.6;
}

.tag-remove:hover {
  opacity: 1;
}

/* Switch & Checkbox */
.switch-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text-main);
  padding: 0.4rem 0;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: 0.3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--accent-gold);
}

input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* ==========================================================================
   History Section
   ========================================================================== */
.history-section {
  margin-top: 1rem;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 350px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.history-item {
  background: rgba(10, 14, 23, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

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

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* ==========================================================================
   Footer Section & SEO Friendly Info
   ========================================================================== */
.site-footer {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-dim);
  font-size: 0.8rem;
  text-align: center;
  line-height: 1.8;
}

.footer-disclaimer {
  max-width: 680px;
  margin: 0.75rem auto 0;
  font-size: 0.75rem;
  color: var(--text-dim);
  opacity: 0.8;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(22, 30, 49, 0.95);
  border: 1px solid var(--accent-gold);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .app-container {
    padding: 1.25rem 0.85rem 3rem;
  }
  .lotto-ball {
    width: 48px;
    height: 48px;
    font-size: 1.2rem;
  }
  .balls-container {
    gap: 0.45rem;
  }
  .btn-primary, .btn-secondary {
    width: 100%;
    justify-content: center;
  }
  .game-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .game-row-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
