:root {
  --bg-base: #f3f8ff;
  --bg-grad-start: #dfeaff;
  --bg-grad-end: #edf3ff;
  --card: #ffffff;
  --text: #1b2230;
  --muted: #5f6f88;
  --primary: #1f6feb;
  --line: #d8e2f1;
  --button-text: #ffffff;
  --shadow: rgba(17, 35, 69, 0.08);
}

body.dark {
  --bg-base: #0e1525;
  --bg-grad-start: #1a2640;
  --bg-grad-end: #111b2f;
  --card: #18233a;
  --text: #e8eefc;
  --muted: #a6b6d4;
  --primary: #5b9dff;
  --line: #2c3c5a;
  --button-text: #0e1525;
  --shadow: rgba(4, 10, 22, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  font-family: "Noto Sans KR", sans-serif;
  background: radial-gradient(circle at top right, var(--bg-grad-start) 0%, var(--bg-base) 45%, var(--bg-grad-end) 100%);
  color: var(--text);
  transition: background 0.25s ease, color 0.25s ease;
}

.container {
  width: min(860px, 92vw);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 12px 28px var(--shadow);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

h1 {
  margin: 0;
  font-size: clamp(1.3rem, 2.3vw, 1.8rem);
}

.desc {
  margin-top: 8px;
  color: var(--muted);
}

.controls {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

select,
button {
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 0.95rem;
}

button {
  border: none;
  background: var(--primary);
  color: var(--button-text);
  font-weight: 700;
  cursor: pointer;
}

.theme-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}

.result {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

.ticket {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.ticket h2 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: var(--muted);
}

.numbers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.ball {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
}

.bonus-label {
  color: var(--muted);
  margin-left: 2px;
  margin-right: 2px;
}

.range-1-10 { background: #f0a000; }
.range-11-20 { background: #2f80ed; }
.range-21-30 { background: #e63946; }
.range-31-40 { background: #7b6ef6; }
.range-41-45 { background: #1e9e5a; }

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .theme-btn {
    width: 100%;
  }
}
