/* 학교안심 둥근미소 폰트 (OFL 라이선스 - 상업적 무료) */
@font-face {
  font-family: 'SchoolSafetyRoundedSmile';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2408-5@1.0/HakgyoansimDunggeunmisoTTF-R.woff2') format('woff2');
  font-weight: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SchoolSafetyRoundedSmile';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2408-5@1.0/HakgyoansimDunggeunmisoTTF-B.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LIGHT MODE (기본값)
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  color-scheme: light;

  /* Light Mode Color System */
  --bg: #f8fafc;
  --bg-alt: #f1f5f9;
  --panel: #ffffff;
  --panel-soft: rgba(255, 255, 255, 0.9);
  --text: #1e293b;
  --muted: #64748b;
  --accent: #7c3aed;
  --accent-strong: #6d28d9;
  --accent-secondary: #059669;
  --accent-gold: #d97706;
  --line: rgba(0, 0, 0, 0.08);
  --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
  --radius: 20px;
  --radius-lg: 28px;

  /* Light Mode Gradients */
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-accent: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  --gradient-gold: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);

  /* Light Mode Glass Effect */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-blur: blur(20px);

  /* Lotto Ball Gradients - 3D Effect */
  --ball-yellow: linear-gradient(145deg, #fcd34d 0%, #f59e0b 100%);
  --ball-blue: linear-gradient(145deg, #60a5fa 0%, #3b82f6 100%);
  --ball-red: linear-gradient(145deg, #f87171 0%, #ef4444 100%);
  --ball-gray: linear-gradient(145deg, #9ca3af 0%, #6b7280 100%);
  --ball-green: linear-gradient(145deg, #34d399 0%, #10b981 100%);

  /* Animation Timing */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   DARK MODE (.dark-mode 클래스로 토글)
   ═══════════════════════════════════════════════════════════════════════════ */
.dark-mode {
  color-scheme: dark;

  /* Dark Mode Color System */
  --bg: #0a0b0f;
  --bg-alt: #12141a;
  --panel: #181b24;
  --panel-soft: rgba(24, 27, 36, 0.85);
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #a78bfa;
  --accent-strong: #8b5cf6;
  --accent-secondary: #10b981;
  --accent-gold: #fbbf24;
  --line: rgba(255, 255, 255, 0.06);
  --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);

  /* Dark Mode Gradients */
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-accent: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
  --gradient-gold: linear-gradient(135deg, #fcd34d 0%, #f59e0b 100%);
  --gradient-success: linear-gradient(135deg, #34d399 0%, #10b981 100%);

  /* Dark Mode Glass Effect */
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "SchoolSafetyRoundedSmile", "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(120, 119, 198, 0.3), transparent),
    radial-gradient(ellipse 60% 40% at 85% 30%, rgba(139, 92, 246, 0.15), transparent),
    radial-gradient(ellipse 50% 30% at 10% 60%, rgba(16, 185, 129, 0.1), transparent),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-alt) 100%);
  background-attachment: fixed;
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 48px 20px 64px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 40px;
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow:
    var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(167, 139, 250, 0.5), transparent);
}

/* Latest Draw Banner */
.latest-draw-banner {
  margin-top: 24px;
  padding: 20px 28px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.latest-draw-info {
  font-size: 1rem;
  color: var(--muted);
}

.latest-draw-info span {
  font-weight: 500;
}

.latest-draw-numbers {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.bonus-separator {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 4px;
}

.hero h1 {
  font-family: "Fraunces", serif;
  font-size: clamp(2.4rem, 3vw, 3.2rem);
  margin: 6px 0 12px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 0.72rem;
  color: var(--accent);
  margin: 0;
}

.lede {
  max-width: 520px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.hero-card {
  display: grid;
  gap: 14px;
  padding: 18px 22px;
  border-radius: 16px;
  background: rgba(9, 10, 16, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-width: 220px;
}

.hero-metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  color: var(--muted);
}

.hero-metric strong {
  color: var(--text);
  font-size: 1.2rem;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 28px;
  margin-top: 32px;
}

.panel {
  padding: 28px;
  border-radius: var(--radius);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
  position: relative;
}

.panel::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.panel.full-width {
  grid-column: 1 / -1;
}

.panel h2 {
  margin: 0 0 16px;
  font-size: 1.4rem;
}

.panel h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  color: var(--muted);
}

.button-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  border: 1px solid transparent;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.8);
}

.button.primary {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow:
    0 4px 15px rgba(102, 126, 234, 0.4),
    0 1px 3px rgba(0, 0, 0, 0.2);
  border: none;
  font-weight: 600;
  letter-spacing: 0.02em;
  position: relative;
  overflow: hidden;
}

.button.primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.button.primary:hover::before {
  left: 100%;
}

.button.ghost {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.button.ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.button:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.button:not(:disabled):active {
  transform: translateY(0);
}

.status {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(15, 16, 22, 0.7);
  font-size: 0.92rem;
}

.status[data-tone="success"] {
  border-color: rgba(243, 199, 106, 0.6);
  color: #f5deae;
}

.status[data-tone="error"] {
  border-color: rgba(232, 125, 79, 0.7);
  color: #ffb49b;
}

.strategy {
  margin-top: 24px;
}

.strategy-title {
  font-size: 1rem;
  color: var(--muted);
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.strategy-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.step-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.step-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateX(4px);
}

.step-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--muted);
  opacity: 0.3;
  transition: opacity 0.2s;
}

.step-card:hover::before {
  background: var(--accent);
  opacity: 1;
}

.step-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.step-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.step-card:hover .step-badge {
  background: rgba(243, 199, 106, 0.2);
  color: var(--accent);
}

.step-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.step-desc {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
  padding-left: 2px;
}

/* Stats Section */
.stats-section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.output {
  display: grid;
  gap: 8px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: -8px;
}

.draw {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(14, 16, 25, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Lotto Ball Styles - Premium 3D */
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 48px;
  padding: 8px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 1.05rem;
  color: #1a1a1a;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.4);
  position: relative;
  transform-style: preserve-3d;
  box-shadow:
    inset -4px -4px 12px rgba(0, 0, 0, 0.25),
    inset 4px 4px 12px rgba(255, 255, 255, 0.35),
    0 8px 24px rgba(0, 0, 0, 0.35),
    0 2px 8px rgba(0, 0, 0, 0.2);
}

.chip::after {
  content: '';
  position: absolute;
  top: 12%;
  left: 22%;
  width: 35%;
  height: 25%;
  background: radial-gradient(ellipse, rgba(255, 255, 255, 0.7) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.chip.ball-yellow {
  background: var(--ball-yellow);
}

.chip.ball-blue {
  background: var(--ball-blue);
}

.chip.ball-red {
  background: var(--ball-red);
}

.chip.ball-gray {
  background: var(--ball-gray);
}

.chip.ball-green {
  background: var(--ball-green);
}

/* Ball Animation */
@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: translateY(-60px) scale(0.3) rotateX(90deg);
  }

  50% {
    opacity: 0.8;
    transform: translateY(8px) scale(1.15) rotateX(-5deg);
  }

  70% {
    transform: translateY(-4px) scale(0.95) rotateX(3deg);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotateX(0);
  }
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

.chip.bounce-in {
  animation: bounceIn 0.6s var(--ease-spring) forwards;
  opacity: 0;
}

.results {
  display: grid;
  gap: 14px;
  margin-top: 8px;
}

.result-card {
  padding: 20px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--glass-border);
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  transition: all 0.5s var(--ease-out-expo);
  position: relative;
  overflow: hidden;
}

.result-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(167, 139, 250, 0.3), transparent);
}

.result-card.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.result-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

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

.result-score {
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--gradient-accent);
  color: #fff;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
}

.result-report {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.result-report span {
  font-size: 0.75rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 8px;
  border-radius: 6px;
  cursor: help;
  border-bottom: 1px dotted rgba(255, 255, 255, 0.3);
  transition: all 0.15s ease;
}

.result-report span:hover {
  background: rgba(243, 199, 106, 0.15);
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.empty {
  padding: 18px;
  border-radius: 14px;
  background: rgba(12, 14, 22, 0.7);
  color: var(--muted);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  text-align: center;
}

/* Saved Numbers Panel */
.saved-panel {
  max-height: 500px;
  overflow-y: auto;
}

.saved-list {
  display: grid;
  gap: 12px;
}

.saved-card {
  position: relative;
  padding: 14px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--glass-border);
}

.saved-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.saved-date {
  font-size: 0.85rem;
  color: var(--muted);
}

.badge {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  color: var(--muted);
}

.badge.win {
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  color: #1a1a1a;
  font-weight: 600;
}

.delete-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s, color 0.2s;
}

.delete-btn:hover {
  background: rgba(232, 125, 79, 0.3);
  color: var(--accent-strong);
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 14px 24px;
  border-radius: 12px;
  background: rgba(27, 31, 43, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text);
  font-size: 0.95rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  z-index: 1000;
}

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

.toast.success {
  border-color: rgba(176, 216, 64, 0.5);
}

.toast.error {
  border-color: rgba(232, 125, 79, 0.5);
}

.toast.info {
  border-color: rgba(105, 200, 242, 0.5);
}

.footer {
  margin-top: 26px;
  text-align: center;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.85rem;
}

.footer p {
  margin: 0 0 12px;
}

.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.8rem;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-links .divider {
  color: rgba(255, 255, 255, 0.25);
}

/* Scrollbar */
.saved-panel::-webkit-scrollbar {
  width: 6px;
}

.saved-panel::-webkit-scrollbar-track {
  background: transparent;
}

.saved-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

/* Responsive */
@media (max-width: 980px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
    padding: 32px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .panel.full-width {
    grid-column: 1;
  }
}

@media (max-width: 620px) {
  .page {
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .hero {
    padding: 24px;
    gap: 20px;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .panel {
    padding: 20px;
    border-radius: 16px;
  }

  .panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .button-group {
    width: 100%;
    gap: 10px;
  }

  .button {
    flex: 1;
    min-height: 52px;
    font-size: 1rem;
    justify-content: center;
    display: flex;
    align-items: center;
  }

  .hero-card {
    width: 100%;
  }

  .chip {
    min-width: 40px;
    height: 40px;
    font-size: 0.95rem;
  }

  .chip-row {
    gap: 6px;
  }

  .bonus-separator {
    margin: 0 2px;
  }

  .result-card {
    padding: 16px;
  }

  .latest-draw-banner {
    padding: 16px 20px;
  }
}

/* Enhanced Interactions */
.chip {
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.27);
  cursor: default;
}

.chip:hover {
  transform: translateY(-4px) scale(1.1);
  z-index: 10;
}

.result-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.result-card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow:
    var(--shadow),
    0 0 0 1px rgba(167, 139, 250, 0.3),
    0 0 60px -10px rgba(139, 92, 246, 0.2);
  background: var(--panel);
  border-color: rgba(167, 139, 250, 0.4);
}

.button.primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  position: relative;
  overflow: hidden;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.button.primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(rgba(255, 255, 255, 0.2), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}

.button.primary:hover::after {
  opacity: 1;
}

.button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Loading State for Generate Button */
.button.loading {
  color: transparent !important;
  pointer-events: none;
  position: relative;
}

.button.loading::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: button-spin 0.8s infinite linear;
}

@keyframes button-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   NEW LAYOUT: Action-First Design System
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Compact Hero ─── */
.hero-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 28px;
  border-radius: var(--radius);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}

.hero-compact h1 {
  font-family: "Fraunces", serif;
  font-size: clamp(1.6rem, 2.5vw, 2rem);
  margin: 0;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-main {
  display: flex;
  align-items: center;
  gap: 16px;
}

.badge-system {
  background: var(--gradient-accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  white-space: nowrap;
}

.hero-stats {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.latest-draw-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--bg-alt);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.draw-label {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}

.chip-row-mini {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chip-row-mini .chip-row {
  gap: 4px;
}

.chip-row-mini .chip {
  min-width: 28px;
  height: 28px;
  font-size: 0.75rem;
  padding: 4px;
}

.bonus-separator-mini {
  font-size: 1rem;
  color: var(--muted);
  margin: 0 2px;
}

.chip.chip-mini {
  min-width: 28px;
  height: 28px;
  font-size: 0.75rem;
  padding: 4px;
}

.data-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.data-badge strong {
  color: var(--text);
}

/* ─── Main Action Section ─── */
.action-section {
  margin-top: 28px;
  padding: 32px;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.action-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(167, 139, 250, 0.5), transparent);
}

.action-layout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 32px;
  align-items: start;
}

.action-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* ─── Mega CTA Button ─── */
.button-mega {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 180px;
  height: 180px;
  border: none;
  border-radius: 24px;
  background: var(--gradient-primary);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  box-shadow:
    0 20px 50px rgba(102, 126, 234, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset,
    0 2px 0 rgba(255, 255, 255, 0.15) inset;
  transition: all 0.3s var(--ease-spring);
  position: relative;
  overflow: hidden;
}

.button-mega::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.6s;
}

.button-mega:hover::before {
  left: 100%;
}

.button-mega:hover {
  transform: translateY(-6px) scale(1.03);
  box-shadow:
    0 30px 60px rgba(102, 126, 234, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.15) inset,
    0 0 80px -10px rgba(167, 139, 250, 0.4);
}

.button-mega:active {
  transform: translateY(-2px) scale(1);
}

.cta-icon {
  font-size: 2.5rem;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.cta-text {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.cta-sub {
  font-size: 0.75rem;
  opacity: 0.8;
  font-weight: 400;
}

.status-mini {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  max-width: 180px;
  padding: 8px 12px;
  background: var(--bg-alt);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.status-mini[data-tone="success"] {
  border-color: rgba(76, 175, 80, 0.4);
  color: #a5d6a7;
}

.status-mini[data-tone="error"] {
  border-color: rgba(244, 67, 54, 0.4);
  color: #ef9a9a;
}

/* ─── Results Area ─── */
.results-area {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.results-header h2 {
  margin: 0;
  font-size: 1.3rem;
}

.action-buttons {
  display: flex;
  gap: 8px;
}

.results-grid {
  display: grid;
  gap: 12px;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  border-radius: 16px;
  background: var(--bg-alt);
  border: 2px dashed rgba(255, 255, 255, 0.1);
  color: var(--muted);
  text-align: center;
}

.empty-icon {
  font-size: 3rem;
  opacity: 0.6;
}

.empty p {
  margin: 0;
  font-size: 1rem;
}

/* ─── Tab System ─── */
.info-tabs {
  margin-top: 28px;
  border-radius: var(--radius);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.tab-nav {
  display: flex;
  gap: 0;
  background: var(--bg-alt);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0;
  overflow-x: auto;
}

.tab-btn {
  flex: 1;
  min-width: 120px;
  padding: 16px 24px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: rgba(167, 139, 250, 0.08);
}

.tab-content {
  padding: 24px;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

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

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

.tab-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.tab-desc {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0 0 20px;
}

/* ─── Pipeline Grid (for Process tab) ─── */
.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

/* ─── Stats Grid (for Stats tab) ─── */
.stats-grid {
  display: grid;
  gap: 16px;
}

.stat-card {
  padding: 20px;
  background: var(--bg-alt);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.stat-card h4 {
  margin: 0 0 16px;
  font-size: 1rem;
  color: var(--text);
}

/* ─── Responsive: Action-First Layout ─── */
@media (max-width: 768px) {
  .hero-compact {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
  }

  .hero-main {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .hero-stats {
    width: 100%;
    flex-direction: column;
    gap: 12px;
  }

  .latest-draw-inline {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .action-section {
    padding: 24px 20px;
  }

  .action-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .action-cta {
    width: 100%;
  }

  .button-mega {
    width: 100%;
    height: 140px;
    flex-direction: row;
    gap: 16px;
    border-radius: 20px;
  }

  .cta-icon {
    font-size: 2rem;
  }

  .cta-text {
    font-size: 1.2rem;
  }

  .status-mini {
    max-width: 100%;
  }

  .results-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .action-buttons {
    width: 100%;
  }

  .action-buttons .button {
    flex: 1;
  }

  .tab-nav {
    justify-content: stretch;
  }

  .tab-btn {
    padding: 14px 16px;
    font-size: 0.85rem;
  }

  .tab-content {
    padding: 20px 16px;
  }

  .pipeline-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .hero-compact h1 {
    font-size: 1.5rem;
  }

  .badge-system {
    font-size: 0.7rem;
    padding: 5px 10px;
  }

  .chip-row-mini .chip {
    min-width: 24px;
    height: 24px;
    font-size: 0.65rem;
  }

  .button-mega {
    height: 120px;
  }

  .cta-icon {
    font-size: 1.8rem;
  }

  .cta-text {
    font-size: 1rem;
  }

  .cta-sub {
    font-size: 0.7rem;
  }

  .tab-btn {
    flex: 1;
    min-width: auto;
    padding: 12px 8px;
    font-size: 0.8rem;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   THEME TOGGLE BUTTON
   ═══════════════════════════════════════════════════════════════════════════ */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  font-size: 1.3rem;
  transition: all 0.3s ease;
  position: relative;
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

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

/* 라이트 모드: 달 아이콘 표시 (다크 모드로 전환 유도) */
.theme-icon-light {
  display: none;
}

.theme-icon-dark {
  display: inline;
}

/* 다크 모드: 해 아이콘 표시 (라이트 모드로 전환 유도) */
.dark-mode .theme-icon-light {
  display: inline;
}

.dark-mode .theme-icon-dark {
  display: none;
}

/* 테마 전환 애니메이션 */
body {
  transition: background 0.3s ease, color 0.3s ease;
}

.hero-compact,
.action-section,
.info-tabs,
.panel,
.tab-nav,
.tab-content,
.result-card,
.step-card,
.stat-card,
.saved-card,
.empty,
.status-mini,
.latest-draw-inline,
.data-badge {
  border-color: rgba(167, 139, 250, 0.4);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CUSTOM TOOLTIP (Mobile Friendly)
   ═══════════════════════════════════════════════════════════════════════════ */
.tooltip-trigger {
  position: relative;
  cursor: help;
  text-decoration: underline dotted;
  text-underline-offset: 4px;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  /* 모바일 탭 하이라이트 제거 */
}

/* 툴팁 본문 (말풍선) */
.tooltip-trigger::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  /* 초기 상태: 약간 작게 */
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.95);
  color: #fff;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.4;
  white-space: pre-wrap;
  /* 줄바꿈 허용 */
  width: max-content;
  max-width: 240px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  z-index: 100;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 툴팁 화살표 */
.tooltip-trigger::before {
  content: '';
  position: absolute;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: rgba(15, 23, 42, 0.95) transparent transparent transparent;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 100;
}

/* Hover 및 Active 상태에서 표시 */
.tooltip-trigger:hover::after,
.tooltip-trigger:hover::before,
.tooltip-trigger.active::after,
.tooltip-trigger.active::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) scale(1);
  /* 원래 크기로 */
  bottom: 130%;
  /* 살짝 위로 이동 효과 */
}

.tooltip-trigger:hover::before,
.tooltip-trigger.active::before {
  bottom: 120%;
}

/* 라이트 모드일 때 툴팁 색상 조정 (어두운 배경 유지) */
.tooltip-trigger::after {
  background: rgba(30, 41, 59, 0.95);
}

/* 모바일 등 작은 화면에서 툴팁 위치 조정 */
@media (max-width: 480px) {
  .tooltip-trigger::after {
    max-width: 200px;
    font-size: 0.8rem;
  }
}