:root {
  --ball-size: 60px;
  --bg-color: #f0f2f5;
  --container-bg: #ffffff;
  --primary-color: #4CAF50;
  --text-color: #333;
  --sub-text-color: #7f8c8d;
  --border-color: #ecf0f1;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  --ball-shadow: 0 4px 6px rgba(0, 0, 0, 0.2), inset -2px -2px 10px rgba(0, 0, 0, 0.1);

  /* Lotto Ball Colors (Korean Standard) */
  --color-1-10: #fbc400;  /* Yellow */
  --color-11-20: #69c8f2; /* Blue */
  --color-21-30: #ff7272; /* Red */
  --color-31-40: #aaaaaa; /* Gray */
  --color-41-45: #b0d840; /* Green */
}

/* Dark Mode Overrides */
[data-theme='dark'] {
  --bg-color: #1a1a1a;
  --container-bg: #2d2d2d;
  --text-color: #f0f0f0;
  --sub-text-color: #aaaaaa;
  --border-color: #444;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  transition: background-color 0.3s, color 0.3s;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  /* 가독성을 위한 어두운 오버레이와 씨범 이미지 (로컬) */
  background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), 
              url('https://fitnessvolt.com/wp-content/uploads/2020/09/chris-bumstead-3.jpg.webp') center/cover no-repeat fixed;
  background-color: #1a1a1a; 
  color: var(--text-color);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.theme-toggle {
  display: flex;
  justify-content: flex-end;
  margin-bottom: -20px;
}

#theme-btn {
  background: none;
  border: 1px solid var(--border-color);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.2rem;
  transition: transform 0.2s;
  color: var(--text-color);
}

#theme-btn:hover {
  transform: scale(1.1);
  background-color: rgba(0,0,0,0.05);
}

[data-theme='dark'] #theme-btn:hover {
  background-color: rgba(255,255,255,0.05);
}

.container {
  background-color: var(--container-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background-color: rgba(255, 255, 255, 0.85); /* Default Light Mode transparency */
  padding: 40px;
  border-radius: 20px;
  box-shadow: var(--shadow);
  text-align: center;
  width: 100%;
  max-width: 600px;
  animation: fadeIn 0.5s ease-out;
}

[data-theme='dark'] .container {
  background-color: rgba(45, 45, 45, 0.85); /* Dark Mode transparency */
}

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

.hero h1 {
  font-size: 2rem;
  margin-bottom: 10px;
  color: var(--text-color);
}

.hero p {
  color: var(--sub-text-color);
  margin-bottom: 30px;
}

.ball-container {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 40px;
  flex-wrap: wrap;
  min-height: var(--ball-size); /* Prevent layout jump */
}

.placeholder-text {
  color: var(--sub-text-color);
  font-style: italic;
  font-size: 1.2rem;
}

.lotto-ball {
  width: var(--ball-size);
  height: var(--ball-size);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  font-weight: bold;
  color: white;
  background-color: #333; /* Default fallback */
  box-shadow: var(--ball-shadow);
  animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  opacity: 0;
  transform: scale(0.5);
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

@keyframes popIn {
  to { opacity: 1; transform: scale(1); }
}

/* Color Classes based on range */
.ball-1-10 { background-color: var(--color-1-10); color: #333; }
.ball-11-20 { background-color: var(--color-11-20); }
.ball-21-30 { background-color: var(--color-21-30); }
.ball-31-40 { background-color: var(--color-31-40); }
.ball-41-45 { background-color: var(--color-41-45); color: #333; }


.generate-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 15px 40px;
  font-size: 1.2rem;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  font-weight: bold;
}

.generate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.generate-btn:active {
  transform: translateY(1px);
}

.history-section {
  margin-top: 40px;
  text-align: left;
}

.history-section h2 {
  font-size: 1.2rem;
  color: var(--sub-text-color);
  margin-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

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

.history-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border-color);
  font-size: 0.9rem;
  color: var(--text-color);
  animation: slideDown 0.3s ease-out;
}

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

/* Scrollbar styling */
#history-list::-webkit-scrollbar {
  width: 6px;
}
#history-list::-webkit-scrollbar-thumb {
  background-color: #ccc;
  border-radius: 3px;
}

@media (max-width: 480px) {
  :root {
    --ball-size: 45px;
  }
  .container {
    padding: 20px;
  }
}
