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

:root {
  --bg-color: #ffffff;
  --text-color: #333333;
  --container-bg: #f5f5f5;
  --btn-bg: #4a90d9;
  --btn-hover: #357abd;
  --history-bg: #ffffff;
  --border-color: #e0e0e0;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
  --bg-color: #1a1a2e;
  --text-color: #ffffff;
  --container-bg: #16213e;
  --btn-bg: #e94560;
  --btn-hover: #c73e54;
  --history-bg: #0f3460;
  --border-color: #0f3460;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  transition: background-color 0.3s, color 0.3s;
}

.container {
  background-color: var(--container-bg);
  border-radius: 20px;
  padding: 40px;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow);
  transition: background-color 0.3s;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

h1 {
  font-size: 1.8rem;
}

.theme-btn {
  background: none;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  width: 45px;
  height: 45px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  transition: transform 0.3s, border-color 0.3s;
}

.theme-btn:hover {
  transform: scale(1.1);
}

.icon-moon {
  display: none;
}

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

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

.lotto-numbers {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

.ball {
  width: 55px;
  height: 55px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: bold;
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.2), 0 3px 6px rgba(0, 0, 0, 0.15);
  animation: pop 0.3s ease-out;
}

.ball.placeholder {
  background: linear-gradient(145deg, #cccccc, #999999);
  animation: none;
}

@keyframes pop {
  0% {
    transform: scale(0);
  }
  70% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

/* 로또 번호 색상 */
.ball.yellow { background: linear-gradient(145deg, #ffd700, #ffa500); }
.ball.blue { background: linear-gradient(145deg, #69b4ff, #1e90ff); }
.ball.red { background: linear-gradient(145deg, #ff6b6b, #dc143c); }
.ball.gray { background: linear-gradient(145deg, #a0a0a0, #696969); }
.ball.green { background: linear-gradient(145deg, #90ee90, #32cd32); }

.generate-btn {
  width: 100%;
  padding: 15px;
  font-size: 1.2rem;
  font-weight: bold;
  color: white;
  background-color: var(--btn-bg);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.1s;
}

.generate-btn:hover {
  background-color: var(--btn-hover);
}

.generate-btn:active {
  transform: scale(0.98);
}

.history {
  margin-top: 30px;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border-color);
}

.history h2 {
  font-size: 1.2rem;
}

.clear-btn {
  padding: 8px 15px;
  font-size: 0.85rem;
  color: white;
  background-color: #e74c3c;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.clear-btn:hover {
  background-color: #c0392b;
}

#history-list {
  list-style: none;
  max-height: 200px;
  overflow-y: auto;
}

#history-list li {
  background-color: var(--history-bg);
  padding: 12px 15px;
  margin-bottom: 8px;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: 1rem;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  transition: background-color 0.3s;
}

#history-list .mini-ball {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: bold;
  color: white;
}

#history-list .mini-ball.yellow { background: linear-gradient(145deg, #ffd700, #ffa500); }
#history-list .mini-ball.blue { background: linear-gradient(145deg, #69b4ff, #1e90ff); }
#history-list .mini-ball.red { background: linear-gradient(145deg, #ff6b6b, #dc143c); }
#history-list .mini-ball.gray { background: linear-gradient(145deg, #a0a0a0, #696969); }
#history-list .mini-ball.green { background: linear-gradient(145deg, #90ee90, #32cd32); }

.contact-form {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 2px solid var(--border-color);
}

.contact-form h2 {
  font-size: 1.2rem;
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  background-color: var(--history-bg);
  color: var(--text-color);
  transition: border-color 0.3s, background-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--btn-bg);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.submit-btn {
  width: 100%;
  padding: 15px;
  font-size: 1.1rem;
  font-weight: bold;
  color: white;
  background-color: #27ae60;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.1s;
}

.submit-btn:hover {
  background-color: #219a52;
}

.submit-btn:active {
  transform: scale(0.98);
}

@media (max-width: 480px) {
  .container {
    padding: 25px;
  }

  h1 {
    font-size: 1.4rem;
  }

  .ball {
    width: 45px;
    height: 45px;
    font-size: 1.1rem;
  }
}
