:root,
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #10161c;
  --bg-2: #1a2733;
  --fg: #f4efe4;
  --lede: #c9c0b2;
  --paper: #f4efe4;
  --ink: #1b1a17;
  --muted: #6d6558;
  --gold: #c9a227;
  --gold-2: #f0d36a;
  --line: rgba(27, 26, 23, 0.12);
  --shadow: 0 24px 50px rgba(0, 0, 0, 0.35);
  --toggle-track: rgba(244, 239, 228, 0.12);
  --toggle-border: rgba(244, 239, 228, 0.2);
  --atmosphere:
    radial-gradient(900px 480px at 12% -10%, rgba(201, 162, 39, 0.22), transparent 55%),
    radial-gradient(700px 420px at 100% 8%, rgba(62, 120, 170, 0.18), transparent 50%),
    linear-gradient(180deg, #0c1218 0%, #18222c 100%);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f1e4;
  --bg-2: #efe6d4;
  --fg: #1b1a17;
  --lede: #5c564c;
  --paper: #fffdf8;
  --ink: #1b1a17;
  --muted: #6d6558;
  --gold: #b08912;
  --gold-2: #d4ae2c;
  --line: rgba(27, 26, 23, 0.12);
  --shadow: 0 18px 40px rgba(40, 32, 16, 0.12);
  --toggle-track: rgba(27, 26, 23, 0.08);
  --toggle-border: rgba(27, 26, 23, 0.14);
  --atmosphere:
    radial-gradient(900px 480px at 12% -10%, rgba(201, 162, 39, 0.28), transparent 55%),
    radial-gradient(700px 420px at 100% 8%, rgba(90, 150, 210, 0.14), transparent 50%),
    linear-gradient(180deg, #fffaf1 0%, #efe4d2 100%);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Noto Sans KR", sans-serif;
  color: var(--fg);
  background: var(--bg);
}

.atmosphere {
  position: fixed;
  inset: 0;
  background: var(--atmosphere);
  z-index: -1;
}

.page {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 80px;
}

.hero {
  text-align: center;
  margin-bottom: 28px;
}

.toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 18px;
}

.theme-toggle {
  display: inline-flex;
  padding: 4px;
  gap: 2px;
  border-radius: 999px;
  background: var(--toggle-track);
  border: 1px solid var(--toggle-border);
}

.theme-btn {
  border: 0;
  background: transparent;
  color: var(--fg);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  opacity: 0.72;
}

.theme-btn:hover {
  opacity: 1;
}

.theme-btn[aria-pressed="true"] {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #1b1506;
  opacity: 1;
  box-shadow: 0 4px 10px rgba(201, 162, 39, 0.28);
}

.theme-btn:focus-visible {
  outline: 2px solid var(--gold-2);
  outline-offset: 2px;
}

.kicker {
  margin: 0 0 10px;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  color: var(--gold-2);
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: "Black Han Sans", "Noto Sans KR", sans-serif;
  font-size: clamp(2.2rem, 7vw, 3.6rem);
  font-weight: 400;
  letter-spacing: -0.03em;
}

.lede {
  margin: 12px auto 0;
  max-width: 28em;
  color: var(--lede);
  line-height: 1.6;
}

.ticket,
.games-panel,
.history-panel {
  background: var(--paper);
  color: var(--ink);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.ticket {
  margin-top: 18px;
  padding: 22px 22px 24px;
  background-image: repeating-linear-gradient(
    90deg,
    transparent 0 14px,
    rgba(201, 162, 39, 0.12) 14px 15px
  );
  background-position: 0 0;
  background-size: 100% 8px;
  background-repeat: no-repeat;
}

.ticket-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 18px;
}

.ticket-label,
.games-panel h2,
.history-head h2 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

.stats {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.draw {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px 18px;
  min-height: 108px;
}

.balls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.bonus-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.plus {
  font-size: 1.6rem;
  color: var(--muted);
}

.bonus-caption {
  margin: 0 0 6px;
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
}

.ball {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.35rem;
  position: relative;
  box-shadow:
    inset -8px -10px 14px rgba(0, 0, 0, 0.22),
    inset 7px 8px 12px rgba(255, 255, 255, 0.38),
    0 8px 16px rgba(0, 0, 0, 0.2);
}

.ball::after {
  content: "";
  position: absolute;
  top: 11%;
  left: 20%;
  width: 30%;
  height: 18%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
}

.ball.empty {
  background: #ddd4c6;
  color: #8f867a;
}

.ball.band-1 { background: #f4c400; color: #1b1a17; }
.ball.band-2 { background: #3b88e0; color: #fff; }
.ball.band-3 { background: #e4453a; color: #fff; }
.ball.band-4 { background: #4d5561; color: #fff; }
.ball.band-5 { background: #2f9e57; color: #fff; }

.ball.pop {
  animation: pop 420ms cubic-bezier(0.2, 1.4, 0.3, 1);
}

@keyframes pop {
  from { transform: scale(0.4) rotate(-12deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

button {
  font-family: inherit;
  cursor: pointer;
}

.generate,
.ghost {
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  font-size: 1.05rem;
  font-weight: 800;
}

.generate {
  flex: 1 1 180px;
  color: #1b1506;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  box-shadow: 0 8px 18px rgba(201, 162, 39, 0.35);
}

.generate:hover {
  filter: brightness(1.05);
}

.generate:active {
  transform: translateY(1px);
}

.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.ghost:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.games-panel,
.history-panel {
  margin-top: 18px;
  padding: 20px 22px;
}

.games {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.games li,
.history li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.games .tag {
  width: 1.6rem;
  font-weight: 800;
  color: var(--gold);
}

.mini {
  width: 34px;
  height: 34px;
  font-size: 0.78rem;
}

.history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.text-btn {
  border: 0;
  background: none;
  color: var(--muted);
  padding: 0;
  font-size: 0.85rem;
}

.history {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.history-empty {
  margin: 12px 0 0;
  color: var(--muted);
}

@media (max-width: 640px) {
  .ticket-top {
    flex-direction: column;
  }

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

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--gold-2);
  color: #1b1506;
  padding: 8px 14px;
  border-radius: 999px;
  z-index: 20;
}

.skip:focus {
  left: 12px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--toggle-border);
}

.bar {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  color: var(--fg);
  text-decoration: none;
  font-family: "Black Han Sans", "Noto Sans KR", sans-serif;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.logo span {
  display: block;
  font-family: "Noto Sans KR", sans-serif;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--lede);
}

.nav-toggle {
  margin-left: auto;
  display: none;
  border: 1px solid var(--toggle-border);
  background: var(--toggle-track);
  color: var(--fg);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 2px;
  margin-left: auto;
}

.site-nav a {
  color: var(--fg);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 999px;
  opacity: 0.78;
}

.site-nav a:hover,
.site-nav a.is-current {
  opacity: 1;
  background: var(--toggle-track);
}

.site-header .theme-toggle {
  flex-shrink: 0;
}

.page-wide {
  width: min(1080px, calc(100% - 32px));
}

.hero-home {
  text-align: left;
  margin: 12px 0 28px;
}

.hero-home h1 {
  max-width: 14em;
}

.notice {
  margin: 0 0 22px;
  padding: 14px 16px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--gold) 16%, var(--paper));
  color: var(--ink);
  line-height: 1.55;
  font-size: 0.95rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin: 18px 0 28px;
}

.card-link {
  display: block;
  text-decoration: none;
  color: var(--ink);
  background: var(--paper);
  border-radius: 18px;
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
}

.card-link h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.card-link p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.92rem;
}

.article {
  background: var(--paper);
  color: var(--ink);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 28px 26px 36px;
  line-height: 1.75;
}

.crumb {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.85rem;
}

.crumb a {
  color: inherit;
}

.article h1 {
  font-size: clamp(1.8rem, 5vw, 2.4rem);
}

.article h2 {
  margin: 1.8em 0 0.5em;
  font-size: 1.25rem;
}

.article h3 {
  margin: 1.3em 0 0.4em;
  font-size: 1.05rem;
}

.article p,
.article li {
  color: #2a261f;
}

html[data-theme="dark"] .article p,
html[data-theme="dark"] .article li {
  color: #2a261f;
}

.article ul,
.article ol {
  padding-left: 1.2em;
}

.article a {
  color: #7a5b08;
}

.meta-line {
  margin: 8px 0 18px;
  color: var(--muted);
  font-size: 0.88rem;
}

.facts {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 8px;
  font-size: 0.95rem;
}

.facts th,
.facts td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 10px 8px;
  vertical-align: top;
}

.related {
  margin-top: 28px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.site-footer {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
  color: var(--lede);
  font-size: 0.88rem;
  line-height: 1.6;
}

.site-footer a {
  color: var(--gold-2);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 8px 0 12px;
}

.source-note {
  margin-top: 8px;
}

@media (max-width: 860px) {
  .nav-toggle {
    display: inline-flex;
  }

  .site-nav {
    display: none;
    position: absolute;
    left: 16px;
    right: 16px;
    top: 64px;
    background: var(--paper);
    color: var(--ink);
    border-radius: 16px;
    padding: 10px;
    flex-direction: column;
    box-shadow: var(--shadow);
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav a {
    color: var(--ink);
  }

  .bar {
    position: relative;
  }
}
