* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ── 다크 모드 (기본) ── */
:root, [data-theme="dark"] {
  --bg: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
  --card-bg: rgba(255, 255, 255, 0.06);
  --title-color: #ffffff;
  --subtitle-color: #aaaaaa;
  --label-color: #e94560;
  --toggle-bg: rgba(255, 255, 255, 0.12);
  --toggle-color: #ffffff;
  --toggle-border: rgba(255, 255, 255, 0.2);
}

/* ── 라이트 모드 ── */
[data-theme="light"] {
  --bg: linear-gradient(135deg, #f0f4ff, #dce8ff, #c8d8f8);
  --card-bg: rgba(255, 255, 255, 0.75);
  --title-color: #1a1a2e;
  --subtitle-color: #555555;
  --label-color: #c0392b;
  --toggle-bg: rgba(0, 0, 0, 0.08);
  --toggle-color: #1a1a2e;
  --toggle-border: rgba(0, 0, 0, 0.15);
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  font-family: 'Segoe UI', sans-serif;
  transition: background 0.4s;
}

.container {
  text-align: center;
  padding: 40px 20px;
  width: 100%;
  max-width: 640px;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 12px;
}

h1 {
  font-size: 2rem;
  color: var(--title-color);
  transition: color 0.4s;
}

#theme-toggle {
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--toggle-color);
  background: var(--toggle-bg);
  border: 1px solid var(--toggle-border);
  border-radius: 50px;
  cursor: pointer;
  transition: background 0.3s, color 0.3s, border 0.3s;
  box-shadow: none;
}

#theme-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0,0,0,0.15);
}

.subtitle {
  color: var(--subtitle-color);
  margin-bottom: 32px;
  font-size: 0.9rem;
  transition: color 0.4s;
}

.result {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 36px;
  min-height: 20px;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-bg);
  border-radius: 16px;
  padding: 14px 20px;
  animation: slideIn 0.4s ease backwards;
  backdrop-filter: blur(6px);
  transition: background 0.4s;
}

@keyframes slideIn {
  from { transform: translateX(-30px); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

.label {
  color: var(--label-color);
  font-weight: bold;
  font-size: 1rem;
  width: 30px;
  flex-shrink: 0;
  transition: color 0.4s;
}

.balls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.ball {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: bold;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  animation: pop 0.35s ease backwards;
}

@keyframes pop {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.ball.yellow { background: radial-gradient(circle at 35% 35%, #ffe066, #f0a500); }
.ball.blue   { background: radial-gradient(circle at 35% 35%, #66b3ff, #1a6fcc); }
.ball.red    { background: radial-gradient(circle at 35% 35%, #ff6666, #cc1a1a); }
.ball.gray   { background: radial-gradient(circle at 35% 35%, #bbb,    #666);    }
.ball.green  { background: radial-gradient(circle at 35% 35%, #66ee99, #1a8c4e); }

#btn {
  padding: 14px 52px;
  font-size: 1.1rem;
  font-weight: bold;
  color: #fff;
  background: linear-gradient(135deg, #e94560, #c0392b);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(233, 69, 96, 0.5);
}

#btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(233, 69, 96, 0.7);
}

#btn:active {
  transform: translateY(0);
}
