﻿:root {
  --bg: #f5f7ff;
  --panel: #ffffff;
  --text: #182033;
  --muted: #5f6880;
  --line: #dce2f2;
  --primary: #2563eb;
  --danger: #dc2626;
  --bg-grad-a: #dbe8ff;
  --bg-grad-b: #e8fff4;
  --surface-soft: #fbfcff;
  --toast-bg: rgba(24, 32, 51, 0.9);
}

:root[data-theme="dark"] {
  --bg: #0b1220;
  --panel: #131c30;
  --text: #e6ecff;
  --muted: #9fb0d9;
  --line: #25314b;
  --primary: #4f8cff;
  --danger: #ff6b6b;
  --bg-grad-a: #1a2a4a;
  --bg-grad-b: #163530;
  --surface-soft: #111a2b;
  --toast-bg: rgba(12, 18, 32, 0.95);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans KR", "Malgun Gothic", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, var(--bg-grad-a) 0, transparent 36%),
    radial-gradient(circle at 90% 30%, var(--bg-grad-b) 0, transparent 32%),
    var(--bg);
  transition: background-color 0.25s ease, color 0.25s ease;
}

.container {
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 16px 48px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.header h1 {
  margin: 0 0 6px;
  font-size: 32px;
}

.header p {
  margin: 0;
  color: var(--muted);
}

.card {
  margin-top: 16px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

.controls {
  display: grid;
  gap: 12px;
}

.field-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--muted);
}

select,
input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  font-size: 15px;
  color: var(--text);
  background: var(--panel);
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 0 14px;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
}

.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn.danger {
  color: var(--danger);
}

.theme-btn {
  white-space: nowrap;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.section-head h2 {
  margin: 0;
  font-size: 18px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

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

.set {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.set-title {
  color: var(--muted);
  font-size: 13px;
  min-width: 54px;
}

.balls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ball {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.yellow { background: #f59e0b; }
.blue { background: #3b82f6; }
.red { background: #ef4444; }
.gray { background: #9ca3af; }
.green { background: #22c55e; }

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

.history li {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font-size: 14px;
  background: var(--surface-soft);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: var(--toast-bg);
  color: #fff;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.toast.show {
  opacity: 1;
}

@media (max-width: 600px) {
  .header-top {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .balls {
    justify-content: flex-start;
  }
}
