:root {
  --primary-color: #4a90e2;
  --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  --container-bg: #ffffff;
  --text-color: #333333;
  --secondary-text: #666666;
  --shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  --border-color: #eeeeee;
  --history-item-bg: #fafafa;
  --input-bg: #ffffff;
}

body.dark-mode {
  --bg-gradient: linear-gradient(135deg, #1a1a1a 0%, #2c3e50 100%);
  --container-bg: #2d2d2d;
  --text-color: #f5f7fa;
  --secondary-text: #b0b0b0;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  --border-color: #444444;
  --history-item-bg: #3a3a3a;
  --input-bg: #3d3d3d;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
}

body {
  background: var(--bg-gradient);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background 0.3s ease;
  padding: 20px 0;
}

.container {
  background: var(--container-bg);
  padding: 2rem;
  border-radius: 20px;
  box-shadow: var(--shadow);
  width: 90%;
  max-width: 500px;
  text-align: center;
  transition: background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

header { position: relative; }

.theme-switch-wrapper {
  position: absolute;
  top: -10px;
  right: -10px;
}

.theme-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  transition: transform 0.2s;
}

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

header h1 {
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

header p {
  color: var(--secondary-text);
  margin-bottom: 2rem;
}

.ball-container {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 2rem 0;
  min-height: 60px;
  align-items: center;
}

.placeholder {
  color: var(--secondary-text);
  font-style: italic;
}

.ball {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  color: white;
  font-size: 1.2rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  animation: bounce 0.5s ease;
}

.ball.color-1 { background: #fbc400; }
.ball.color-2 { background: #69c8f2; }
.ball.color-3 { background: #ff7272; }
.ball.color-4 { background: #aaaaaa; }
.ball.color-5 { background: #b0d840; }

.main-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
  width: 100%;
}

.main-btn:hover {
  background: #357abd;
  transform: scale(1.02);
}

.history-section {
  margin-top: 2rem;
  text-align: left;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

.history-section h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

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

.history-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
  color: var(--secondary-text);
  border-radius: 4px;
}

.contact-section {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  text-align: left;
}

.comment-section {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  text-align: left;
}

.comment-section h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text-color);
}

.contact-section h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text-color);
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.form-group textarea {
  height: 80px;
  resize: none;
}

.sub-btn {
  background: #6c757d;
  color: white;
  border: none;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.sub-btn:hover {
  background: #5a6268;
}

footer { margin-top: 2rem; }
footer p {
  font-size: 0.8rem;
  color: var(--secondary-text);
}

@keyframes bounce {
  0% { transform: scale(0); }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); }
}
