:root {
  --bg: #f7f9fc;
  --bg-soft: #eef4ff;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #ffffff;
  --line: rgba(108, 132, 168, 0.18);
  --text: #17324d;
  --muted: #6d8198;
  --accent: #2f80ed;
  --accent-2: #4bb3a7;
  --accent-3: #ffd36e;
  --accent-soft: #eaf3ff;
  --shadow: 0 18px 44px rgba(69, 106, 154, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans KR", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 0% 0%, rgba(111, 183, 255, 0.16), transparent 22%),
    radial-gradient(circle at 100% 0%, rgba(75, 179, 167, 0.14), transparent 18%),
    linear-gradient(180deg, #f8fbff 0%, #f4f8fd 48%, #eff5fb 100%);
}

button,
input {
  font: inherit;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(38px);
  opacity: 0.4;
  pointer-events: none;
}

.orb-a {
  top: 4rem;
  right: -5rem;
  width: 18rem;
  height: 18rem;
  background: rgba(47, 128, 237, 0.16);
}

.orb-b {
  left: -4rem;
  bottom: 6rem;
  width: 15rem;
  height: 15rem;
  background: rgba(75, 179, 167, 0.14);
}

.page-shell {
  position: relative;
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 2.5rem;
}

.hero,
.panel,
.meta-card,
.stat-card,
.draw-row,
.freq-item,
.result-card,
.saved-card {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 1rem;
  padding: 1.6rem;
  border-radius: 2rem;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.97), rgba(239, 246, 255, 0.95)),
    linear-gradient(120deg, rgba(47, 128, 237, 0.05), rgba(75, 179, 167, 0.05));
}

.hero-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eyebrow,
.panel-kicker {
  margin: 0;
  letter-spacing: 0.18em;
  font-size: 0.74rem;
  color: var(--accent);
  font-family: "Montserrat", sans-serif;
  font-weight: 800;
}

.hero h1,
.panel-head h2 {
  margin: 0.45rem 0 0;
  font-family: "Do Hyeon", "Noto Sans KR", sans-serif;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.hero h1 {
  font-size: clamp(2.4rem, 5vw, 4.6rem);
  line-height: 1.06;
}

.hero-copy,
.subtle-copy,
.draw-date,
.stat-detail,
.result-note {
  color: var(--muted);
  line-height: 1.62;
}

.hero-copy {
  max-width: 44rem;
  margin: 0.9rem 0 0;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1.25rem;
}

.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner.hidden {
  display: none;
}

.hero-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
}

.meta-card,
.panel,
.stat-card,
.draw-row,
.freq-item,
.result-card,
.saved-card {
  border-radius: 1.4rem;
}

.meta-card {
  padding: 0.8rem 0.95rem;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

.meta-label,
.stat-label {
  color: var(--muted);
  font-size: 0.78rem;
}

.meta-card strong {
  display: block;
  margin-top: 0.35rem;
  font-family: "Do Hyeon", "Noto Sans KR", sans-serif;
  font-size: 1.02rem;
  font-weight: 400;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.panel {
  padding: 1.25rem;
}

.controls-panel {
  grid-column: span 12;
}

.ad-panel {
  grid-column: span 12;
  padding: 0.9rem;
}

.latest-panel,
.stats-panel {
  grid-column: span 6;
}

.generator-panel {
  grid-column: span 12;
}

.panel-head {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.panel-head h2 {
  font-size: 1.6rem;
}

.controls-stack {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.control-block {
  grid-column: span 4;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.control-block.input-block {
  grid-column: span 4;
}

.control-label,
.input-label {
  display: block;
  margin-bottom: 0.65rem;
  font-weight: 700;
  color: var(--text);
}

.window-switch,
.choice-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.exclude-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.5rem;
}

.chip,
.choice-btn,
.action-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.chip,
.choice-btn {
  padding: 0.72rem 0.95rem;
}

.chip.active,
.chip:hover,
.choice-btn.active,
.choice-btn:hover {
  background: var(--accent-soft);
  border-color: rgba(47, 128, 237, 0.34);
  color: var(--accent);
  transform: translateY(-1px);
}

#exclude-select {
  width: 100%;
  padding: 0.84rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #ffffff;
  color: var(--text);
}

.mini-btn {
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #ffffff;
  color: var(--text);
  padding: 0.8rem 0.9rem;
  cursor: pointer;
}

.mini-btn:hover {
  background: var(--accent-soft);
  border-color: rgba(47, 128, 237, 0.34);
  color: var(--accent);
}

.exclude-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.exclude-chip,
.exclude-empty {
  border-radius: 999px;
  padding: 0.42rem 0.72rem;
  font-size: 0.9rem;
}

.exclude-chip {
  border: 1px solid rgba(47, 128, 237, 0.2);
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
}

.exclude-empty {
  background: #f4f8fd;
  color: var(--muted);
}

.ad-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 92px;
  border: 1px dashed rgba(47, 128, 237, 0.28);
  border-radius: 1.1rem;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  color: var(--muted);
  text-align: center;
}

.ad-slot span {
  font-family: "Montserrat", sans-serif;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--accent);
}

.latest-list,
.generated-sets {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
}

.draw-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.7rem 1rem;
  padding: 1rem;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

.draw-title,
.result-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.ball-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 999px;
  color: white;
  font-size: 0.92rem;
  font-weight: 700;
  box-shadow: inset 0 -8px 14px rgba(0, 0, 0, 0.12);
}

.ball.bonus {
  outline: 2px dashed rgba(23, 50, 77, 0.2);
  outline-offset: 2px;
}

.ball.range-1 {
  background: #ffb020;
}

.ball.range-2 {
  background: #2f80ed;
}

.ball.range-3 {
  background: #ff6b6b;
}

.ball.range-4 {
  background: #4bb3a7;
}

.ball.range-5 {
  background: #8a63d2;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 0;
}

.stat-card {
  padding: 1rem;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

.stat-value {
  display: block;
  margin: 0.5rem 0 0.35rem;
  font-family: "Do Hyeon", "Noto Sans KR", sans-serif;
  font-size: 1.45rem;
  font-weight: 400;
}

.summary-split {
  display: grid;
  grid-template-columns: 1.25fr 0.9fr;
  gap: 1rem;
  margin-top: 1rem;
}

.frequency-inline-wrap {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.mini-head {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.mini-head strong {
  font-size: 1rem;
}

.frequency-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.generator-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.action-btn {
  padding: 0.8rem 1.05rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.action-btn.primary,
.action-btn:hover {
  background: var(--accent-soft);
  border-color: rgba(47, 128, 237, 0.34);
  color: var(--accent);
  transform: translateY(-1px);
}

.generated-sets {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.result-card {
  padding: 1rem;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .latest-panel,
  .stats-panel,
  .generator-panel {
    grid-column: span 12;
  }

  .controls-stack {
    grid-template-columns: 1fr 1fr;
  }

  .control-block,
  .control-block.input-block {
    grid-column: span 1;
  }

  .generated-sets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .page-shell {
    width: min(100% - 1rem, 100%);
    padding-top: 1rem;
  }

  .hero,
  .panel {
    padding: 1rem;
    border-radius: 1.2rem;
  }

  .hero-meta,
  .controls-stack,
  .stat-grid,
  .generated-sets {
    grid-template-columns: 1fr;
  }

  .draw-row {
    grid-template-columns: 1fr;
  }

  .exclude-controls {
    grid-template-columns: 1fr 1fr;
  }

  #exclude-select {
    grid-column: span 2;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
