:root {
  --bg: #f6f2ea;
  --card: #fffaf2;
  --panel: #ffffff;
  --text: #2b2418;
  --muted: #544732;
  --accent: #c84f2f;
  --accent-dark: #9b3c24;
  --line: #e8dcc7;
  --button-text: #fff8ef;
  --shadow: rgba(89, 55, 8, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem 1rem 3rem;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  background:
    radial-gradient(circle at 20% 15%, #fff 0%, transparent 35%),
    radial-gradient(circle at 80% 20%, #f9dfb6 0%, transparent 30%),
    var(--bg);
  color: var(--text);
  transition: background 180ms ease, color 180ms ease;
}

body.dark {
  --bg: #101419;
  --card: #171d24;
  --panel: #0f141a;
  --text: #e9edf2;
  --muted: #b5bfcc;
  --accent: #ff7c4d;
  --accent-dark: #d46037;
  --line: #2b3642;
  --button-text: #fff3ea;
  --shadow: rgba(0, 0, 0, 0.45);
  background:
    radial-gradient(circle at 15% 15%, #1f2f42 0%, transparent 28%),
    radial-gradient(circle at 85% 18%, #2f273f 0%, transparent 24%),
    var(--bg);
}

.container {
  width: min(92vw, 640px);
  padding: 2rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 20px 50px var(--shadow);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

h1 {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
}

.description {
  margin: 0.7rem 0 1.6rem;
  color: var(--muted);
  line-height: 1.5;
}

.hidden {
  display: none;
}

.result-panel {
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.numbers-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.bonus-row {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.bonus-label {
  font-weight: 700;
}

.ball {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, #e07f1b, #c34a2b);
  box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.15);
}

.bonus-ball {
  background: linear-gradient(135deg, #3d6f8f, #345372);
}

.history-panel {
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--line);
}

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

.history-empty {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.history-list {
  margin: 0.65rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.55rem;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  line-height: 1.35;
}

.history-count {
  min-width: 2.2rem;
  font-weight: 700;
  color: var(--muted);
}

.history-numbers {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.history-ball {
  width: 1.9rem;
  height: 1.9rem;
  font-size: 0.85rem;
}

.history-plus {
  font-weight: 700;
  color: var(--muted);
}

#drawButton,
.theme-toggle {
  margin-top: 1.2rem;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: var(--button-text);
  font-size: 1rem;
  font-weight: 700;
  padding: 0.85rem 1.2rem;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}

.theme-toggle {
  margin-top: 0;
  font-size: 0.92rem;
  padding: 0.6rem 0.9rem;
}

#drawButton:hover,
.theme-toggle:hover {
  background: var(--accent-dark);
}

#drawButton:active,
.theme-toggle:active {
  transform: translateY(1px);
}
