:root {
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --bg-color: #f8fafc;
  --bg-gradient: linear-gradient(135deg, #e0e7ff 0%, #f8fafc 100%);
  --card-bg: rgba(255, 255, 255, 0.95);
  --nav-bg: rgba(255, 255, 255, 0.8);
  --text-main: #1e293b;
  --text-sub: #64748b;
  --set-bg: #f8fafc;
  --set-border: #f1f5f9;
  --empty-bg: #f1f5f9;
  --empty-border: #cbd5e1;
  
  /* Lotto Ball Colors */
  --ball-1: #fbbf24;
  --ball-11: #38bdf8;
  --ball-21: #fb7185;
  --ball-31: #94a3b8;
  --ball-41: #4ade80;
}

[data-theme="dark"] {
  --bg-color: #0f172a;
  --bg-gradient: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
  --card-bg: rgba(30, 41, 59, 0.9);
  --nav-bg: rgba(15, 23, 42, 0.8);
  --text-main: #f8fafc;
  --text-sub: #94a3b8;
  --set-bg: #1e293b;
  --set-border: #334155;
  --empty-bg: #1e293b;
  --empty-border: #334155;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.6;
}

/* Navbar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--set-border);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-logo {
  font-size: 1.5rem;
  font-weight: 900;
  text-decoration: none;
  color: var(--primary);
  background: linear-gradient(to right, #2563eb, #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-menu a {
  text-decoration: none;
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.nav-menu a:hover {
  color: var(--primary);
}

.nav-cta {
  background: var(--primary);
  color: white !important;
  padding: 0.5rem 1.25rem;
  border-radius: 50px;
  transition: transform 0.2s !important;
}

.nav-cta:hover {
  transform: translateY(-2px);
}

/* Theme Toggle */
#themeToggle {
  background: var(--set-bg);
  border: 1px solid var(--set-border);
  color: var(--text-main);
  padding: 8px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

#themeToggle:hover {
  transform: scale(1.05);
  background: var(--set-border);
}

.sun-icon { display: none; }
.moon-icon { display: block; }

[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }

/* Hero Section */
.hero {
  padding: 10rem 2rem 6rem;
  text-align: center;
  max-width: 1000px;
  margin: 0 auto;
}

.hero-title {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 1.5rem;
}

.highlight {
  background: linear-gradient(to right, #3b82f6, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: clamp(1rem, 3vw, 1.25rem);
  color: var(--text-sub);
  margin-bottom: 3rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.hero-btns {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.btn {
  padding: 1rem 2rem;
  border-radius: 14px;
  font-weight: 700;
  text-decoration: none;
  font-size: 1.1rem;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  transform: translateY(-3px);
  background: var(--primary-hover);
  box-shadow: 0 20px 25px -5px rgba(59, 130, 246, 0.4);
}

.btn-outline {
  border: 2px solid var(--set-border);
  color: var(--text-main);
  background: var(--card-bg);
}

.btn-outline:hover {
  background: var(--set-bg);
  border-color: var(--primary);
}

/* Features Section */
.features {
  padding: 6rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section-header {
  text-align: center;
  margin-bottom: 4rem;
}

.section-header h2 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
}

.section-header p {
  color: var(--text-sub);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.feature-card {
  background: var(--card-bg);
  padding: 3rem 2rem;
  border-radius: 24px;
  text-align: center;
  border: 1px solid var(--set-border);
  transition: transform 0.3s;
}

.feature-card:hover {
  transform: translateY(-10px);
}

.feature-icon {
  font-size: 3rem;
  margin-bottom: 1.5rem;
}

.feature-card h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.feature-card p {
  color: var(--text-sub);
}

/* Generator Section */
.generator-section {
  padding: 6rem 2rem;
  display: flex;
  justify-content: center;
}

.app-wrapper {
  width: 100%;
  max-width: 480px;
}

.container {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  padding: 2.5rem 2rem;
  border-radius: 24px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  text-align: center;
  border: 1px solid var(--set-border);
}

.container header {
  margin-bottom: 2rem;
}

.container h2 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.container header p {
  color: var(--text-sub);
  font-size: 0.95rem;
}

#generateBtn {
  width: 100%;
  background-color: var(--primary);
  color: white;
  border: none;
  padding: 1.1rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
  margin-bottom: 2rem;
}

#generateBtn:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.4);
}

#generateBtn.loading svg {
  animation: spin 1s infinite linear;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.empty-state {
  padding: 3rem 1rem;
  color: var(--text-sub);
  font-size: 0.9rem;
  background: var(--empty-bg);
  border-radius: 16px;
  border: 2px dashed var(--empty-border);
}

.lotto-set {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 1rem;
  padding: 1.25rem;
  background: var(--set-bg);
  border-radius: 16px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
  border: 1px solid var(--set-border);
  animation: slideIn 0.4s ease-out backwards;
}

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

.ball {
  width: 42px;
  height: 42px;
  line-height: 42px;
  border-radius: 50%;
  text-align: center;
  font-weight: 800;
  color: white;
  font-size: 1rem;
  position: relative;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  transition: transform 0.2s ease;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) backwards;
}

.ball-1 { background: radial-gradient(circle at 30% 30%, #ffd43b, var(--ball-1)); }
.ball-11 { background: radial-gradient(circle at 30% 30%, #7dd3fc, var(--ball-11)); }
.ball-21 { background: radial-gradient(circle at 30% 30%, #fda4af, var(--ball-21)); }
.ball-31 { background: radial-gradient(circle at 30% 30%, #cbd5e1, var(--ball-31)); }
.ball-41 { background: radial-gradient(circle at 30% 30%, #86efac, var(--ball-41)); }

@keyframes popIn {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Footer */
.main-footer {
  padding: 4rem 2rem;
  background: var(--card-bg);
  border-top: 1px solid var(--set-border);
  text-align: center;
}

.footer-logo {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 1rem;
  color: var(--primary);
}

.copyright {
  font-size: 0.9rem;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.disclaimer {
  font-size: 0.8rem;
  color: var(--text-sub);
}

/* Content & FAQ Sections */
.content-section, .faq-section {
  padding: 6rem 2rem;
  max-width: 900px;
  margin: 0 auto;
}

.content-container {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.info-article h3 {
  font-size: 1.75rem;
  margin-bottom: 1rem;
  color: var(--primary);
}

.info-article p {
  font-size: 1.1rem;
  color: var(--text-main);
  margin-bottom: 1.5rem;
  line-height: 1.8;
}

.faq-grid {
  display: grid;
  gap: 2rem;
  margin-top: 3rem;
}

.faq-item {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 16px;
  border: 1px solid var(--set-border);
}

.faq-item h4 {
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
  color: var(--primary);
}

/* Legal Pages Styling */
.legal-page {
  background: var(--bg-color);
}

.legal-content {
  max-width: 800px;
  margin: 8rem auto 4rem;
  padding: 4rem;
  background: var(--card-bg);
  border-radius: 24px;
  border: 1px solid var(--set-border);
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.legal-content h1 {
  margin-bottom: 2rem;
  font-size: 2.5rem;
}

.legal-content h3 {
  margin: 2.5rem 0 1rem;
  font-size: 1.5rem;
  color: var(--primary);
}

.legal-content p {
  margin-bottom: 1rem;
  color: var(--text-main);
  line-height: 1.7;
}

.back-link {
  margin-top: 4rem;
  text-align: center;
}

/* Footer Enhanced */
.footer-links {
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
  align-items: center;
}

.footer-links a {
  text-decoration: none;
  color: var(--text-sub);
  font-size: 0.9rem;
  font-weight: 600;
}

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

.separator {
  color: var(--set-border);
}

/* Responsive */
@media (max-width: 768px) {
  .legal-content {
    margin: 6rem 1rem 2rem;
    padding: 2rem;
  }
}

@media (max-width: 768px) {
  .nav-menu a:not(.nav-cta) {
    display: none;
  }
  .hero {
    padding: 8rem 1.5rem 4rem;
  }
}

@media (max-width: 400px) {
  .ball {
    width: 36px;
    height: 36px;
    line-height: 36px;
    font-size: 0.9rem;
  }
  .lotto-set {
    gap: 4px;
    padding: 1rem 0.5rem;
  }
}
