:root {
  --bg: #0B0F1A;
  --bg-glow-1: rgba(255, 197, 61, 0.16);
  --bg-glow-2: rgba(79, 187, 238, 0.10);
  --surface: #131A2B;
  --surface-2: #1B233A;
  --border: rgba(255, 255, 255, 0.08);
  --text: #EEF1F8;
  --text-dim: #8E96AC;
  --text-faint: #5B6280;
  --accent: #FFC53D;
  --accent-ink: #23180A;
  --shadow: rgba(0, 0, 0, 0.45);

  --ball1-bg: #FBC400; --ball1-fg: #4A3600;
  --ball2-bg: #4FBBEE; --ball2-fg: #06283A;
  --ball3-bg: #FF7272; --ball3-fg: #4A0A0A;
  --ball4-bg: #4B5164; --ball4-fg: #F2F4F8;
  --ball5-bg: #AED138; --ball5-fg: #2A3706;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #F2F3F8;
    --bg-glow-1: rgba(255, 197, 61, 0.22);
    --bg-glow-2: rgba(79, 187, 238, 0.16);
    --surface: #FFFFFF;
    --surface-2: #E9EBF3;
    --border: rgba(16, 19, 28, 0.08);
    --text: #12141F;
    --text-dim: #565D74;
    --text-faint: #8890A6;
    --accent: #C9860C;
    --accent-ink: #FFF7E4;
    --shadow: rgba(30, 34, 54, 0.14);
  }
}

:root[data-theme="dark"] {
  --bg: #0B0F1A;
  --bg-glow-1: rgba(255, 197, 61, 0.16);
  --bg-glow-2: rgba(79, 187, 238, 0.10);
  --surface: #131A2B;
  --surface-2: #1B233A;
  --border: rgba(255, 255, 255, 0.08);
  --text: #EEF1F8;
  --text-dim: #8E96AC;
  --text-faint: #5B6280;
  --accent: #FFC53D;
  --accent-ink: #23180A;
  --shadow: rgba(0, 0, 0, 0.45);
}

:root[data-theme="light"] {
  --bg: #F2F3F8;
  --bg-glow-1: rgba(255, 197, 61, 0.22);
  --bg-glow-2: rgba(79, 187, 238, 0.16);
  --surface: #FFFFFF;
  --surface-2: #E9EBF3;
  --border: rgba(16, 19, 28, 0.08);
  --text: #12141F;
  --text-dim: #565D74;
  --text-faint: #8890A6;
  --accent: #C9860C;
  --accent-ink: #FFF7E4;
  --shadow: rgba(30, 34, 54, 0.14);
}

body {
  transition: background-color 0.25s ease, color 0.25s ease;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(680px 420px at 18% -8%, var(--bg-glow-1), transparent 60%),
    radial-gradient(620px 460px at 88% 6%, var(--bg-glow-2), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Malgun Gothic", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: 64px 20px 80px;
  overflow-x: hidden;
}

.page {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

header {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
}

.theme-toggle {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  position: absolute;
  top: 0;
  right: 0;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.theme-toggle:hover { color: var(--text); border-color: var(--text-faint); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="dark"]) .theme-toggle .icon-moon { display: none; }
}

.eyebrow {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--accent);
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 40px);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.sub {
  margin: 0 auto;
  max-width: 46ch;
  color: var(--text-dim);
  font-size: 15.5px;
  line-height: 1.6;
}

.draw-btn {
  appearance: none;
  border: none;
  cursor: pointer;
  align-self: center;
  padding: 15px 34px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
  box-shadow: 0 10px 24px -8px var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.draw-btn:hover { transform: translateY(-1px); box-shadow: 0 14px 28px -8px var(--shadow); }
.draw-btn:active { transform: translateY(0); }
.draw-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

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

.game-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px;
}

.game-tag {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

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

.ball {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.14), 0 3px 8px -3px var(--shadow);
  opacity: 0;
  transform: scale(0.4);
  animation: pop 0.38s cubic-bezier(0.2, 0.9, 0.35, 1.2) forwards;
}
.ball.r1 { background: var(--ball1-bg); color: var(--ball1-fg); }
.ball.r2 { background: var(--ball2-bg); color: var(--ball2-fg); }
.ball.r3 { background: var(--ball3-bg); color: var(--ball3-fg); }
.ball.r4 { background: var(--ball4-bg); color: var(--ball4-fg); }
.ball.r5 { background: var(--ball5-bg); color: var(--ball5-fg); }

@keyframes pop {
  to { opacity: 1; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .ball { animation: none; opacity: 1; transform: none; }
}

.copy-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.copy-btn:hover { color: var(--text); border-color: var(--text-faint); }
.copy-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.copy-btn svg { width: 16px; height: 16px; }

.lotto-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.section-divider {
  height: 1px;
  background: var(--border);
}

.contact-section {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.contact-heading {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
}

h2 {
  margin: 0;
  font-size: clamp(24px, 4vw, 30px);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.comments-section {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.comments-section noscript {
  display: block;
  text-align: center;
  font-size: 13.5px;
  color: var(--text-faint);
}
.comments-section noscript a { color: var(--text-dim); }

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
}
.legend-item:nth-child(1) .legend-dot { background: var(--ball1-bg); }
.legend-item:nth-child(2) .legend-dot { background: var(--ball2-bg); }
.legend-item:nth-child(3) .legend-dot { background: var(--ball3-bg); }
.legend-item:nth-child(4) .legend-dot { background: var(--ball4-bg); }
.legend-item:nth-child(5) .legend-dot { background: var(--ball5-bg); }

.disclaimer {
  margin: 0;
  max-width: 42ch;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-faint);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 10px 24px -8px var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
}

.field input,
.field select,
.field textarea {
  appearance: none;
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.15s ease;
}

.field textarea {
  resize: vertical;
  min-height: 110px;
  line-height: 1.55;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--text-faint);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.contact-form .draw-btn {
  width: 100%;
  margin-top: 4px;
}

.contact-form .draw-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.form-status {
  margin: 0;
  min-height: 18px;
  text-align: center;
  font-size: 13.5px;
  font-weight: 600;
}
.form-status.ok { color: var(--ball5-bg); }
.form-status.error { color: var(--ball3-bg); }

.back-link {
  color: var(--text-faint);
  text-decoration: none;
}
.back-link:hover { color: var(--text-dim); text-decoration: underline; }
