:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --ink: #18202c;
  --muted: #5d6878;
  --line: #dfe4ec;
  --accent: #2456d6;
  --accent-ink: #ffffff;
  /* 실제 로또 공 색 구간: 1-10 노랑, 11-20 파랑, 21-30 빨강, 31-40 회색, 41-45 초록 */
  --b1: #fbc400;
  --b2: #69c8f2;
  --b3: #ff7272;
  --b4: #aaaaaa;
  --b5: #b0d840;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11151c;
    --card: #1a202a;
    --ink: #e8edf4;
    --muted: #9aa6b6;
    --line: #2c3442;
    --accent: #6f9bff;
    --accent-ink: #0d1320;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11151c;
  --card: #1a202a;
  --ink: #e8edf4;
  --muted: #9aa6b6;
  --line: #2c3442;
  --accent: #6f9bff;
  --accent-ink: #0d1320;
  color-scheme: dark;
}

.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.theme { flex: none; padding: 8px 14px; font-size: 14px; }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  line-height: 1.6;
  word-break: keep-all;
}

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 40px 16px 56px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

h1 { margin: 0 0 6px; font-size: 30px; }
.sub { margin: 0; color: var(--muted); }

.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }

button {
  font: inherit;
  font-weight: 700;
  border: 0;
  border-radius: 10px;
  padding: 14px 26px;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
button:disabled { opacity: 0.45; cursor: default; filter: none; }
button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 10px 18px;
  font-weight: 500;
}

.check { display: flex; align-items: center; gap: 8px; color: var(--muted); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.games {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.games:empty::before {
  content: "아직 뽑은 번호가 없습니다. 위의 버튼을 눌러 보세요.";
  display: block;
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 12px;
}

.game {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.label {
  flex: none;
  width: 2.2em;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.balls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

.ball {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  font-variant-numeric: tabular-nums;
  animation: pop 0.25s ease-out both;
}
.ball.r1 { background: var(--b1); }
.ball.r2 { background: var(--b2); }
.ball.r3 { background: var(--b3); }
.ball.r4 { background: var(--b4); }
.ball.r5 { background: var(--b5); }
.plus { color: var(--muted); font-weight: 700; padding: 0 2px; }

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

.actions { display: flex; align-items: center; gap: 14px; }
.status { color: var(--muted); font-size: 14px; }

footer { color: var(--muted); font-size: 13px; }
footer p { margin: 0; }

@media (max-width: 420px) {
  .ball { width: 34px; height: 34px; font-size: 14px; }
  .game { gap: 8px; padding: 10px; }
}
