@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;600;700&display=swap');

/* ===== CSS Variables ===== */
:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-card: rgba(255, 255, 255, 0.06);
  --bg-card-hover: rgba(255, 255, 255, 0.1);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.5);
  --accent: #7c5cfc;
  --accent-hover: #6a48e8;
  --border: rgba(255, 255, 255, 0.1);
  --input-bg: rgba(255, 255, 255, 0.08);
  --input-border: rgba(255, 255, 255, 0.15);
  --input-text: #ffffff;
  --input-placeholder: rgba(255, 255, 255, 0.4);
  --header-bg: rgba(15, 15, 26, 0.9);
  --footer-bg: #0a0a14;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --font: 'Noto Sans KR', sans-serif;
}

[data-theme="light"] {
  --bg-primary: #f5f7fb;
  --bg-secondary: #e8ecf4;
  --bg-card: rgba(255, 255, 255, 0.8);
  --bg-card-hover: rgba(255, 255, 255, 1);
  --text-primary: #1a1a2e;
  --text-secondary: rgba(26, 26, 46, 0.7);
  --text-muted: rgba(26, 26, 46, 0.5);
  --accent: #6a11cb;
  --accent-hover: #5a0eb0;
  --border: rgba(0, 0, 0, 0.08);
  --input-bg: rgba(0, 0, 0, 0.04);
  --input-border: rgba(0, 0, 0, 0.12);
  --input-text: #1a1a2e;
  --input-placeholder: rgba(0, 0, 0, 0.4);
  --header-bg: rgba(245, 247, 251, 0.95);
  --footer-bg: #e0e4ec;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  transition: background-color 0.4s ease, color 0.4s ease;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

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

/* ===== Header ===== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.8rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.logo:hover {
  color: var(--accent);
}

.main-nav {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.main-nav a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.3rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.main-nav a:hover {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

.theme-toggle {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
  color: var(--text-primary);
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--bg-card-hover);
  transform: rotate(15deg);
}

/* ===== Sections ===== */
.section {
  padding: 5rem 1.5rem;
}

.section-alt {
  background-color: var(--bg-secondary);
}

.hero {
  padding: 8rem 1.5rem 4rem;
  text-align: center;
}

.hero h1 {
  font-size: 2.4rem;
  font-weight: 700;
  margin-bottom: 1rem;
  letter-spacing: -1px;
}

.hero-desc {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* ===== Container ===== */
.container {
  max-width: 1000px;
  margin: 0 auto;
}

.container-md {
  max-width: 760px;
  margin: 0 auto;
}

.container-sm {
  max-width: 520px;
  margin: 0 auto;
}

.section h2 {
  font-size: 1.8rem;
  text-align: center;
  margin-bottom: 0.8rem;
}

.section-desc {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
  max-width: 650px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== Lotto Generator ===== */
#generator {
  text-align: center;
  padding-top: 7rem;
}

#lotto-balls {
  display: flex;
  gap: 0.8rem;
  margin: 2rem auto;
  min-height: 70px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-primary {
  font-family: var(--font);
  background-color: var(--accent);
  color: #ffffff;
  border: none;
  padding: 0.9rem 2.2rem;
  border-radius: 50px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s, box-shadow 0.3s;
  box-shadow: 0 4px 16px rgba(124, 92, 252, 0.3);
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(124, 92, 252, 0.4);
}

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

.color-legend {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

/* ===== Cards ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.8rem;
  transition: background 0.3s, transform 0.2s, box-shadow 0.3s;
}

.card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.8rem;
  color: var(--accent);
}

.card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
}

/* ===== Stats Table ===== */
.stats-table-wrap {
  overflow-x: auto;
  margin-bottom: 2.5rem;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
}

.stats-table th,
.stats-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
}

.stats-table th {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stats-table td {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.stats-table tbody tr:hover {
  background: var(--bg-card);
}

/* ===== FAQ ===== */
.faq-list {
  max-width: 700px;
  margin: 0 auto;
}

.faq-item {
  border-bottom: 1px solid var(--border);
}

.faq-item summary {
  padding: 1.2rem 0;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text-primary);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-item summary::after {
  content: '+';
  font-size: 1.4rem;
  color: var(--accent);
  flex-shrink: 0;
  margin-left: 1rem;
  transition: transform 0.2s;
}

.faq-item[open] summary::after {
  content: '−';
}

.faq-item p {
  padding: 0 0 1.2rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* ===== Contact Form ===== */
#contact-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

#contact-form input,
#contact-form textarea,
#contact-form select {
  font-family: var(--font);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  color: var(--input-text);
  outline: none;
  transition: border-color 0.3s, background 0.3s;
  resize: vertical;
}

#contact-form input::placeholder,
#contact-form textarea::placeholder {
  color: var(--input-placeholder);
}

#contact-form select {
  cursor: pointer;
}

#contact-form select option {
  background: var(--bg-primary);
  color: var(--text-primary);
}

#contact-form input:focus,
#contact-form textarea:focus,
#contact-form select:focus {
  border-color: var(--accent);
}

#submit-btn {
  margin-top: 0.5rem;
}

.form-status {
  margin-top: 0.8rem;
  font-size: 0.95rem;
  text-align: center;
  min-height: 1.4em;
}

.form-status.success { color: #4caf50; }
.form-status.error { color: #ff5252; }

/* ===== Content Article (About, Privacy) ===== */
.content-article {
  margin-bottom: 2.5rem;
}

.content-article h2 {
  text-align: left;
  font-size: 1.3rem;
  margin-bottom: 0.8rem;
}

.content-article p {
  color: var(--text-secondary);
  margin-bottom: 0.8rem;
}

.feature-list {
  list-style: none;
  padding: 0;
}

.feature-list li {
  color: var(--text-secondary);
  padding: 0.4rem 0 0.4rem 1.2rem;
  position: relative;
}

.feature-list li::before {
  content: '•';
  color: var(--accent);
  position: absolute;
  left: 0;
  font-weight: 700;
}

/* ===== Footer ===== */
.site-footer {
  background: var(--footer-bg);
  border-top: 1px solid var(--border);
  padding: 2.5rem 1.5rem;
  text-align: center;
}

.footer-inner {
  max-width: 800px;
  margin: 0 auto;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

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

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

.footer-disclaimer {
  color: var(--text-muted);
  font-size: 0.8rem;
  max-width: 500px;
  margin: 0 auto;
}

/* ===== Lotto Ball Custom Element ===== */
lotto-ball {
  display: inline-flex;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  animation: appear 0.4s ease-out forwards;
}

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

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .hero h1 { font-size: 1.8rem; }
  .hero { padding: 7rem 1.2rem 3rem; }
  .section { padding: 3.5rem 1.2rem; }
  .section h2 { font-size: 1.5rem; }
  .card-grid { grid-template-columns: 1fr; }

  .main-nav {
    gap: 0.6rem;
  }

  .main-nav a {
    font-size: 0.8rem;
  }

  .header-inner {
    padding: 0.6rem 1rem;
  }

  #lotto-balls {
    gap: 0.5rem;
  }

  lotto-ball {
    width: 48px;
    height: 48px;
    font-size: 1.2rem;
  }

  .stats-table th,
  .stats-table td {
    padding: 0.6rem 0.5rem;
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .main-nav {
    display: none;
  }

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