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

/* ===== 다크모드 (기본) ===== */
body {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #fff;
  transition: background 0.4s ease, color 0.4s ease;
}

.container {
  text-align: center;
  padding: 40px 30px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  max-width: 600px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

h1 {
  font-size: 2rem;
  margin-bottom: 40px;
  text-shadow: 0 0 20px rgba(255, 200, 0, 0.5);
  letter-spacing: 2px;
  transition: color 0.4s ease;
}

/* ===== 라이트모드 ===== */
body.light {
  background: linear-gradient(135deg, #e8f4fd 0%, #d6eaf8 50%, #c5d9f1 100%);
  color: #1a1a2e;
}

body.light .container {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

body.light h1 {
  text-shadow: 0 0 20px rgba(255, 140, 0, 0.3);
  color: #1a1a2e;
}

body.light .ball.placeholder {
  background: rgba(0, 0, 0, 0.06);
  border: 2px dashed rgba(0, 0, 0, 0.2);
  color: rgba(0, 0, 0, 0.3);
}

body.light #resetBtn {
  background: rgba(0, 0, 0, 0.08);
  color: #1a1a2e;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

body.light #resetBtn:hover {
  background: rgba(0, 0, 0, 0.15);
}

body.light .history h2 {
  color: rgba(0, 0, 0, 0.5);
  border-bottom-color: rgba(0, 0, 0, 0.1);
}

body.light .history-item {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

body.light .history-num {
  color: rgba(0, 0, 0, 0.3);
}

body.light .history-time {
  color: rgba(0, 0, 0, 0.35);
}

body.light .empty-history {
  color: rgba(0, 0, 0, 0.3);
}

body.light #historyList::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
}

/* ===== 테마 토글 버튼 ===== */
#themeToggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  font-size: 1.4rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 100;
}

#themeToggle:hover {
  transform: scale(1.1) rotate(15deg);
  background: rgba(255, 255, 255, 0.25);
}

body.light #themeToggle {
  background: rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

body.light #themeToggle:hover {
  background: rgba(0, 0, 0, 0.15);
}

/* ===== 공 ===== */
.balls-container {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.ball {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3), inset 0 -3px 6px rgba(0,0,0,0.2), inset 0 3px 6px rgba(255,255,255,0.3);
  transition: transform 0.3s ease;
  position: relative;
  overflow: hidden;
}

.ball::before {
  content: '';
  position: absolute;
  top: 12px;
  left: 14px;
  width: 20px;
  height: 12px;
  background: rgba(255,255,255,0.4);
  border-radius: 50%;
  transform: rotate(-30deg);
}

.ball.placeholder {
  background: rgba(255, 255, 255, 0.1);
  border: 2px dashed rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.4);
  box-shadow: none;
  font-size: 1.6rem;
}

.ball.placeholder::before {
  display: none;
}

.ball.range-1  { background: radial-gradient(circle at 35% 35%, #ffcc00, #e6b800); color: #333; }
.ball.range-2  { background: radial-gradient(circle at 35% 35%, #4da6ff, #1a7fe6); }
.ball.range-3  { background: radial-gradient(circle at 35% 35%, #ff6b6b, #e63030); }
.ball.range-4  { background: radial-gradient(circle at 35% 35%, #888, #555); }
.ball.range-5  { background: radial-gradient(circle at 35% 35%, #66bb6a, #388e3c); }

.ball.animate {
  animation: ballPop 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes ballPop {
  0%   { transform: scale(0) rotate(-180deg); opacity: 0; }
  60%  { transform: scale(1.2) rotate(10deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* ===== 버튼 ===== */
button {
  padding: 14px 40px;
  border: none;
  border-radius: 50px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 1px;
  margin: 5px;
}

#drawBtn {
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  color: #1a1a2e;
  box-shadow: 0 6px 20px rgba(255, 140, 0, 0.4);
}

#drawBtn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(255, 140, 0, 0.6);
}

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

#drawBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

#resetBtn {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
}

#resetBtn:hover {
  background: rgba(255,255,255,0.25);
  transform: translateY(-2px);
}

/* ===== 추첨 기록 ===== */
.history {
  margin-top: 40px;
  text-align: left;
}

.history h2 {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.6);
  margin-bottom: 15px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 10px;
  transition: color 0.4s ease, border-color 0.4s ease;
}

#historyList {
  list-style: none;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 4px;
}

#historyList::-webkit-scrollbar {
  width: 4px;
}

#historyList::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 0.9rem;
  animation: slideIn 0.3s ease;
  transition: background 0.4s ease, border-color 0.4s ease;
}

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

.history-num {
  color: rgba(255,255,255,0.4);
  min-width: 24px;
  font-size: 0.8rem;
  transition: color 0.4s ease;
}

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

.mini-ball {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.mini-ball.range-1 { background: radial-gradient(circle at 35% 35%, #ffcc00, #e6b800); color: #333; }
.mini-ball.range-2 { background: radial-gradient(circle at 35% 35%, #4da6ff, #1a7fe6); }
.mini-ball.range-3 { background: radial-gradient(circle at 35% 35%, #ff6b6b, #e63030); }
.mini-ball.range-4 { background: radial-gradient(circle at 35% 35%, #888, #555); }
.mini-ball.range-5 { background: radial-gradient(circle at 35% 35%, #66bb6a, #388e3c); }

.history-time {
  margin-left: auto;
  color: rgba(255,255,255,0.3);
  font-size: 0.75rem;
  white-space: nowrap;
  transition: color 0.4s ease;
}

.empty-history {
  color: rgba(255,255,255,0.3);
  font-size: 0.9rem;
  text-align: center;
  padding: 20px;
  transition: color 0.4s ease;
}
