:root {
  --bg-color: #ffffff;
  --text-color: #333333;
  --card-bg: #f9f9f9;
  --primary-color: #4a90e2;
  --primary-hover: #357abd;
  --border-color: #eeeeee;
  --ball-shadow: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
  --bg-color: #1a1a1a;
  --text-color: #f0f0f0;
  --card-bg: #2d2d2d;
  --primary-color: #357abd;
  --primary-hover: #4a90e2;
  --border-color: #444444;
  --ball-shadow: rgba(0, 0, 0, 0.3);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-color: #1a1a1a;
    --text-color: #f0f0f0;
    --card-bg: #2d2d2d;
    --primary-color: #357abd;
    --primary-hover: #4a90e2;
    --border-color: #444444;
    --ball-shadow: rgba(0, 0, 0, 0.3);
  }
}

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

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  transition: background-color 0.3s, color 0.3s;
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
}

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

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

.btn-icon {
  background: none;
  border: 1px solid var(--border-color);
  padding: 0.5rem;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--text-color);
}

.controls {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.bonus-toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 500;
}

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

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

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

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Switch styling */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
}

input:checked + .slider {
  background-color: var(--primary-color);
}

input:checked + .slider:before {
  transform: translateX(24px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Animation Container */
.animation-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 2rem;
}

.machine {
  width: 200px;
  height: 200px;
  border: 4px solid var(--border-color);
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  background: var(--card-bg);
}

.ball {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  position: absolute;
}

.ball-1 { background-color: #fbc02d; top: 50%; left: 50%; animation: bounce 0.6s infinite alternate ease-in-out; }
.ball-2 { background-color: #1976d2; top: 30%; left: 20%; animation: bounce 0.8s infinite alternate-reverse ease-in-out; }
.ball-3 { background-color: #d32f2f; top: 70%; left: 30%; animation: bounce 0.5s infinite alternate ease-in-out; }
.ball-4 { background-color: #757575; top: 20%; left: 60%; animation: bounce 0.7s infinite alternate-reverse ease-in-out; }
.ball-5 { background-color: #388e3c; top: 60%; left: 70%; animation: bounce 0.9s infinite alternate ease-in-out; }

@keyframes bounce {
  0% { transform: translate(0, 0); }
  100% { transform: translate(40px, 40px); }
}

.hidden {
  display: none;
}

.status-text {
  font-weight: 500;
  color: var(--primary-color);
}

/* Results Container */
.results-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.result-row {
  background: var(--card-bg);
  padding: 1rem;
  border-radius: 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  animation: fadeIn 0.5s ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.lotto-ball {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 1rem;
  box-shadow: 0 2px 4px var(--ball-shadow);
}

.bonus-plus {
  font-size: 1.5rem;
  font-weight: bold;
  margin: 0 0.25rem;
}

/* Ball colors by range */
.ball-yellow { background-color: #fbc02d; color: #333; } /* 1-10 */
.ball-blue { background-color: #1976d2; } /* 11-20 */
.ball-red { background-color: #d32f2f; } /* 21-30 */
.ball-gray { background-color: #757575; } /* 31-40 */
.ball-green { background-color: #388e3c; } /* 41-45 */

/* Inquiry Form Styling */
.inquiry-section {
  margin-top: 3rem;
  padding-bottom: 2rem;
}

.divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin-bottom: 2rem;
}

.inquiry-section h2 {
  margin-bottom: 1.5rem;
  text-align: center;
  font-size: 1.5rem;
}

.inquiry-form {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-weight: 600;
  font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: inherit;
  font-size: 1rem;
}

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

.btn-secondary {
  background-color: var(--text-color);
  color: var(--bg-color);
  border: none;
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-secondary:hover {
  opacity: 0.9;
}

.form-notice {
  font-size: 0.8rem;
  color: #888;
  text-align: center;
}
