:root {
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-strong: #eef1f8;
  --text: #172033;
  --muted: #6b7280;
  --border: #d9deea;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d111c;
  --surface: #151b2d;
  --surface-strong: #202840;
  --text: #f7f9ff;
  --muted: #a8b1c7;
  --border: #2d3856;
  --primary: #8b7dff;
  --primary-hover: #a69cff;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(79, 70, 229, 0.18), transparent 34rem),
    var(--bg);
  color: var(--text);
  transition: background 0.25s ease, color 0.25s ease;
}

button {
  font: inherit;
}

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

.hero,
.history-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.hero {
  padding: 32px;
}

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

.eyebrow {
  margin: 0;
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.theme-toggle,
.secondary-button,
.primary-button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface-strong);
  color: var(--text);
  border: 1px solid var(--border);
}

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

h1 {
  margin: 36px 0 12px;
  font-size: clamp(2.3rem, 8vw, 5.5rem);
  line-height: 0.95;
  letter-spacing: -0.08em;
}

.description {
  max-width: 680px;
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.card {
  padding: 28px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 24px;
}

.numbers,
.bonus {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  min-height: 64px;
}

.bonus {
  min-height: 52px;
  margin-top: 14px;
}

.placeholder,
.bonus-label,
.empty {
  color: var(--muted);
}

.bonus-label {
  font-size: 0.95rem;
  font-weight: 800;
}

.ball {
  display: inline-grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  font-size: 1.2rem;
  font-weight: 900;
  box-shadow: inset 0 -6px 12px rgba(0, 0, 0, 0.18), 0 10px 18px rgba(15, 23, 42, 0.16);
}

.yellow {
  background: #f6b73c;
}

.blue {
  background: #3b82f6;
}

.red {
  background: #ef4444;
}

.gray {
  background: #6b7280;
}

.green {
  background: #22c55e;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.primary-button,
.secondary-button {
  padding: 14px 20px;
}

.primary-button {
  background: var(--primary);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--primary-hover);
}

.secondary-button {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.history-section {
  margin-top: 24px;
  padding: 28px 32px;
}

h2 {
  margin: 0 0 18px;
  font-size: 1.4rem;
}

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

.history-item,
.empty {
  padding: 14px 16px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.history-item {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: var(--text);
}

.history-count {
  color: var(--primary);
  font-weight: 900;
}

@media (max-width: 640px) {
  .app {
    width: min(100% - 20px, 960px);
    padding: 20px 0;
  }

  .hero,
  .history-section {
    border-radius: 20px;
    padding: 22px;
  }

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

  .card {
    padding: 20px;
  }

  .ball {
    width: 48px;
    height: 48px;
    font-size: 1rem;
  }
}
