:root {
  --bg: #0f172a;
  --panel: #111827;
  --accent: #f59e0b;
  --text: #f8fafc;
  --muted: #94a3b8;
  --surface: rgba(17, 24, 39, 0.95);
  --surface-strong: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.08);
  --shadow: rgba(0, 0, 0, 0.35);
  color-scheme: light;
}

:root[data-theme="light"] {
  --bg: #f8fafc;
  --panel: #ffffff;
  --accent: #f59e0b;
  --text: #111827;
  --muted: #64748b;
  --surface: rgba(255, 255, 255, 0.95);
  --surface-strong: rgba(15, 23, 42, 0.04);
  --border: rgba(15, 23, 42, 0.08);
  --shadow: rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Pretendard", "Noto Sans KR", sans-serif;
  background: linear-gradient(135deg, var(--bg), #1e293b);
  color: var(--text);
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  transition: background 0.25s ease, color 0.25s ease;
}

.card {
  width: min(100%, 760px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 20px 60px var(--shadow);
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 8px;
}

h1 {
  margin: 0 0 8px;
  font-size: 2rem;
}

.subtitle {
  margin: 0 0 24px;
  color: var(--muted);
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 700;
}

.controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.footer-row {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

.menu-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  transition: transform 0.2s ease, background 0.2s ease;
}

.menu-link:hover {
  transform: translateY(-1px);
  background: rgba(245, 158, 11, 0.12);
}

button {
  border: 0;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
}

.draw-btn {
  background: var(--accent);
  color: #111827;
}

.reset-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.balls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.ball {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  font-weight: 800;
  color: #111827;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.16);
}

.ball-1-10 {
  background: linear-gradient(135deg, #fde68a, #f59e0b);
  color: #111827;
}

.ball-11-20 {
  background: linear-gradient(135deg, #bfdbfe, #2563eb);
  color: white;
}

.ball-21-30 {
  background: linear-gradient(135deg, #fecaca, #ef4444);
  color: white;
}

.ball-31-40 {
  background: linear-gradient(135deg, #bbf7d0, #16a34a);
  color: #111827;
}

.ball-41-45 {
  background: linear-gradient(135deg, #e9d5ff, #8b5cf6);
  color: white;
}

.history {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 20px;
}

.history h2 {
  font-size: 1rem;
  margin: 0 0 12px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface-strong);
  color: var(--muted);
}

.history-numbers {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tiny-ball {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: #111827;
  background: #fbbf24;
}

.tiny-ball-1-10 {
  background: linear-gradient(135deg, #fde68a, #f59e0b);
  color: #111827;
}

.tiny-ball-11-20 {
  background: linear-gradient(135deg, #bfdbfe, #2563eb);
  color: white;
}

.tiny-ball-21-30 {
  background: linear-gradient(135deg, #fecaca, #ef4444);
  color: white;
}

.tiny-ball-31-40 {
  background: linear-gradient(135deg, #bbf7d0, #16a34a);
  color: #111827;
}

.tiny-ball-41-45 {
  background: linear-gradient(135deg, #e9d5ff, #8b5cf6);
  color: white;
}

.font-display-lg {
  font-family: "Playfair Display", serif;
}

.font-headline-md {
  font-family: "Playfair Display", serif;
}

.font-label-caps {
  font-family: "Inter", sans-serif;
  letter-spacing: 0.2em;
}

@media (max-width: 600px) {
  .card {
    padding: 24px;
  }

  .ball {
    width: 54px;
    height: 54px;
    font-size: 1.1rem;
  }
}
