/* ── Reset & Base ── */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f6f8fa;
  --surface: #ffffff;
  --border: #d0d7de;
  --text: #1f2328;
  --text-sub: #656d76;
  --text-muted: #8b949e;
  --accent: #238636;
  --accent-hover: #2ea043;
  --btn-secondary-bg: #f3f4f6;
  --btn-secondary-border: #d0d7de;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);
  --ball-shadow: 0 3px 10px rgba(0,0,0,0.15);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg: #0d1117;
  --surface: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --text-sub: #7d8590;
  --text-muted: #484f58;
  --accent: #238636;
  --accent-hover: #2ea043;
  --btn-secondary-bg: #21262d;
  --btn-secondary-border: #30363d;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.4);
  --ball-shadow: 0 3px 10px rgba(0,0,0,0.5);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 40px 16px;
  transition: background var(--transition), color var(--transition);
}

.container {
  max-width: 520px;
  width: 100%;
}

/* ── Header ── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.theme-toggle {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: background var(--transition), border var(--transition), transform 0.2s;
  box-shadow: var(--shadow);
}

.theme-toggle:hover {
  transform: rotate(20deg) scale(1.05);
}

.icon-sun { display: none; }
.icon-moon { display: inline; }
[data-theme="dark"] .icon-sun { display: inline; }
[data-theme="dark"] .icon-moon { display: none; }

.subtitle {
  font-size: 0.9rem;
  color: var(--text-sub);
  margin-bottom: 28px;
}

/* ── Main Result ── */
.main-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 20px;
  margin-bottom: 16px;
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
  transition: background var(--transition), border var(--transition), box-shadow var(--transition);
}

.placeholder {
  color: var(--text-muted);
  font-size: 0.9rem;
}

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

.ball {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  box-shadow: var(--ball-shadow);
  position: relative;
  animation: ballDrop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.ball::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 11px;
  width: 15px;
  height: 8px;
  background: rgba(255,255,255,0.3);
  border-radius: 50%;
  transform: rotate(-30deg);
}

@keyframes ballDrop {
  0% { transform: translateY(-40px) scale(0); opacity: 0; }
  60% { transform: translateY(4px) scale(1.1); opacity: 1; }
  80% { transform: translateY(-2px) scale(0.97); }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes bonusPop {
  0% { transform: scale(0) rotate(-45deg); opacity: 0; }
  70% { transform: scale(1.15) rotate(5deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.ball.c1  { background: linear-gradient(135deg, #f5c842, #d4a017); }
.ball.c10 { background: linear-gradient(135deg, #42a5f5, #1976d2); }
.ball.c20 { background: linear-gradient(135deg, #ef5350, #d32f2f); }
.ball.c30 { background: linear-gradient(135deg, #9e9e9e, #616161); }
.ball.c40 { background: linear-gradient(135deg, #66bb6a, #388e3c); }

/* ── Bonus ── */
.bonus-section {
  display: none;
  align-items: center;
  gap: 10px;
}

.bonus-section.show { display: flex; }

.bonus-section .ball {
  animation: bonusPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.bonus-label {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 700;
}

/* ── Buttons ── */
.btn-group {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 36px;
}

.btn {
  padding: 12px 28px;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn:active { transform: scale(0.95); }

.btn-icon { font-size: 1rem; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(35,134,54,0.3);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(35,134,54,0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--btn-secondary-bg);
  color: var(--text);
  border: 1px solid var(--btn-secondary-border);
  box-shadow: var(--shadow);
  transition: background var(--transition), color var(--transition), border var(--transition);
}

.btn-secondary:hover {
  background: var(--border);
  transform: translateY(-1px);
}

/* ── Multi Draw ── */
.multi-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.multi-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
  animation: slideIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
  transition: background var(--transition), border var(--transition);
}

.multi-row .row-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 20px;
}

@keyframes slideIn {
  0% { opacity: 0; transform: translateX(-20px); }
  100% { opacity: 1; transform: translateX(0); }
}

/* ── History ── */
.history h2 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-sub);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.history ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
  animation: fadeUp 0.3s ease both;
  transition: background var(--transition), border var(--transition);
}

@keyframes fadeUp {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

.history .round {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 700;
  min-width: 32px;
  text-align: left;
}

.mini-ball {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0,0,0,0.3);
  transition: transform 0.15s;
}

.mini-ball:hover { transform: scale(1.2); }

.mini-ball.c1  { background: linear-gradient(135deg, #f5c842, #d4a017); }
.mini-ball.c10 { background: linear-gradient(135deg, #42a5f5, #1976d2); }
.mini-ball.c20 { background: linear-gradient(135deg, #ef5350, #d32f2f); }
.mini-ball.c30 { background: linear-gradient(135deg, #9e9e9e, #616161); }
.mini-ball.c40 { background: linear-gradient(135deg, #66bb6a, #388e3c); }

.sep {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  margin: 0 2px;
}
