:root {
  --bg-top: #fcf1d5;
  --bg-middle: #efd5a8;
  --bg-bottom: #d5b06e;
  --panel: rgba(255, 250, 242, 0.86);
  --panel-strong: rgba(255, 252, 247, 0.94);
  --text: #24160c;
  --muted: #715742;
  --accent: #c7501a;
  --accent-strong: #913410;
  --ink-soft: rgba(36, 22, 12, 0.08);
  --line: rgba(80, 49, 23, 0.12);
  --shadow: 0 24px 60px rgba(94, 48, 7, 0.16);
}

body[data-theme="dark"] {
  --bg-top: #1f1a16;
  --bg-middle: #241e19;
  --bg-bottom: #32271e;
  --panel: rgba(34, 28, 23, 0.86);
  --panel-strong: rgba(41, 34, 28, 0.96);
  --text: #f7ecdf;
  --muted: #c8b39c;
  --accent: #ff8d42;
  --accent-strong: #d76721;
  --ink-soft: rgba(255, 240, 226, 0.08);
  --line: rgba(255, 229, 203, 0.12);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "SUIT", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.58), transparent 24%),
    radial-gradient(circle at right 8% top 16%, rgba(199, 80, 26, 0.22), transparent 20%),
    radial-gradient(circle at left 18% bottom 14%, rgba(122, 73, 24, 0.16), transparent 20%),
    linear-gradient(160deg, var(--bg-top), var(--bg-middle) 55%, var(--bg-bottom));
}

body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(18px);
}

body::before {
  top: 5rem;
  right: -3rem;
  width: 18rem;
  height: 18rem;
  background: rgba(255, 209, 114, 0.28);
}

body::after {
  left: -5rem;
  bottom: 2rem;
  width: 16rem;
  height: 16rem;
  background: rgba(159, 77, 28, 0.2);
}

.page {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 44px 0 72px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr);
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
}

.hero-copy,
.hero-board,
.panel,
.info-card,
.results-section {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero-copy {
  padding: 34px;
  border-radius: 32px;
  background:
    linear-gradient(135deg, rgba(255, 251, 246, 0.9), rgba(255, 243, 223, 0.86)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent);
}

.hero-topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-strong);
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.theme-toggle {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 248, 238, 0.72);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.hero h1 {
  margin: 0;
  font-family: "Black Han Sans", sans-serif;
  font-size: clamp(3rem, 7vw, 5.2rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.lead {
  max-width: 640px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.75;
}

.hero-board {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100%;
  padding: 28px;
  border-radius: 32px;
  color: #fff8ee;
  background:
    linear-gradient(180deg, rgba(43, 24, 11, 0.12), rgba(43, 24, 11, 0.02)),
    linear-gradient(145deg, #cf5d1f, #7e3011 76%);
}

.board-badge {
  display: inline-flex;
  align-self: flex-start;
  min-height: 36px;
  align-items: center;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 800;
  background: rgba(255, 245, 228, 0.16);
  border: 1px solid rgba(255, 240, 220, 0.18);
}

.hero-stats {
  display: grid;
  gap: 16px;
  margin: 28px 0 0;
}

.hero-stats div {
  padding-top: 14px;
  border-top: 1px solid rgba(255, 240, 220, 0.18);
}

.hero-stats dt {
  margin-bottom: 6px;
  font-size: 0.9rem;
  opacity: 0.8;
}

.hero-stats dd {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
}

.panel,
.info-card,
.results-section {
  background: var(--panel);
  border-radius: 28px;
}

.panel {
  padding: 24px;
}

.controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px 180px;
  gap: 14px;
  align-items: end;
}

.field {
  display: grid;
  gap: 10px;
}

.field span {
  font-weight: 700;
}

select,
.generate-button,
.secondary-button {
  height: 56px;
  border-radius: 18px;
  border: 1px solid transparent;
  font: inherit;
}

select {
  width: 100%;
  padding: 0 18px;
  color: var(--text);
  background: var(--panel-strong);
  border-color: var(--line);
  outline: none;
}

select:focus-visible,
.generate-button:focus-visible,
.secondary-button:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(199, 80, 26, 0.14);
}

.generate-button,
.secondary-button {
  padding: 0 24px;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease,
    opacity 160ms ease;
}

.generate-button {
  color: #fffaf4;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 14px 28px rgba(145, 52, 16, 0.26);
}

.secondary-button {
  color: var(--text);
  background: rgba(255, 248, 238, 0.92);
  border-color: var(--line);
}

.generate-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.generate-button:active,
.secondary-button:active {
  transform: translateY(1px) scale(0.99);
}

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.summary strong,
.summary span {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 248, 238, 0.9);
  border: 1px solid var(--line);
}

.filter-panel {
  margin-top: 18px;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(255, 248, 238, 0.56);
}

.filter-copy h2 {
  margin: 0;
  font-size: 1.08rem;
}

.filter-copy p {
  margin: 8px 0 0;
  color: var(--muted);
}

.inline-sample {
  font-weight: 700;
  color: var(--accent-strong);
}

.filter-inputs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 12px;
  margin-top: 14px;
}

.number-input {
  width: 100%;
  height: 56px;
  padding: 0 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--text);
  font: inherit;
  outline: none;
}

.number-input:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(199, 80, 26, 0.14);
}

.filter-status {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.dashboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.info-card {
  padding: 22px 24px;
}

.info-card h2 {
  margin: 0;
  font-size: 1.22rem;
}

.info-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.history-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.history-item {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 251, 246, 0.76);
}

.history-item strong {
  display: block;
  font-size: 0.98rem;
}

.history-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.range-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.range-chip {
  padding: 14px 10px;
  text-align: center;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 251, 246, 0.85);
}

.range-chip strong {
  display: block;
  font-size: 1.15rem;
}

.range-chip span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

.results-section {
  margin-top: 20px;
  padding: 24px;
}

.results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.result-card {
  padding: 18px;
  border-radius: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background:
    linear-gradient(180deg, rgba(255, 252, 247, 0.98), rgba(249, 238, 219, 0.9));
  border: 1px solid rgba(103, 63, 29, 0.1);
}

.result-card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 14px;
  width: 100%;
}

.result-card-header strong {
  display: block;
  font-size: 1.08rem;
}

.result-card-header span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.92rem;
}

.result-meta {
  min-width: 88px;
  text-align: right;
  color: var(--accent-strong);
  font-size: 0.84rem;
  font-weight: 800;
}

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

.ball {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff;
  box-shadow:
    inset 0 -7px 12px rgba(0, 0, 0, 0.12),
    0 10px 18px rgba(56, 39, 25, 0.12);
  animation: pop 340ms ease both;
}

.ball.range-1 {
  background: linear-gradient(180deg, #f6c046, #df8c00);
}

.ball.range-2 {
  background: linear-gradient(180deg, #60a7ff, #2f6bd6);
}

.ball.range-3 {
  background: linear-gradient(180deg, #f16d68, #cb3d3d);
}

.ball.range-4 {
  background: linear-gradient(180deg, #8e8e96, #5e5e66);
}

.ball.range-5 {
  background: linear-gradient(180deg, #8fd36f, #4b9e2f);
}

body[data-theme="dark"] .theme-toggle,
body[data-theme="dark"] .secondary-button,
body[data-theme="dark"] .summary strong,
body[data-theme="dark"] .summary span,
body[data-theme="dark"] .range-chip,
body[data-theme="dark"] .history-item,
body[data-theme="dark"] .filter-panel {
  background: rgba(255, 250, 243, 0.06);
}

body[data-theme="dark"] .hero-copy {
  background:
    linear-gradient(135deg, rgba(45, 36, 29, 0.88), rgba(33, 27, 23, 0.92)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent);
}

body[data-theme="dark"] .result-card {
  background:
    linear-gradient(180deg, rgba(51, 42, 35, 0.95), rgba(37, 31, 26, 0.92));
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.88);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 900px) {
  .hero,
  .dashboard,
  .results {
    grid-template-columns: 1fr;
  }

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

  .filter-inputs {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  .page {
    width: min(100% - 18px, 1100px);
    padding: 20px 0 42px;
  }

  .hero-copy,
  .hero-board,
  .panel,
  .info-card,
  .results-section {
    padding-left: 18px;
    padding-right: 18px;
    border-radius: 24px;
  }

  .hero h1 {
    font-size: clamp(2.5rem, 13vw, 3.5rem);
  }

  .hero-topbar {
    flex-direction: column;
    align-items: start;
  }

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

  .result-card-header {
    flex-direction: column;
  }

  .result-meta {
    text-align: left;
  }

  .ball {
    width: 48px;
    height: 48px;
  }
}
