:root {
  --bg-color: #f8fafc;
  --text-color: #1e293b;
  --primary-color: #4f46e5;
  --primary-glow: rgba(79, 70, 229, 0.4);
  --secondary-color: #94a3b8;
  --card-bg: rgba(255, 255, 255, 0.8);
  --item-bg: white;
  --ball-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  --border-color: rgba(255, 255, 255, 0.3);
  
  /* Lotto Ball Colors */
  --ball-1: #fbc02d; /* Yellow */
  --ball-11: #1976d2; /* Blue */
  --ball-21: #d32f2f; /* Red */
  --ball-31: #757575; /* Grey */
  --ball-41: #388e3c; /* Green */

  --font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  --transition-speed: 0.3s;
}

[data-theme="dark"] {
  --bg-color: #0f172a;
  --text-color: #f1f5f9;
  --primary-color: #818cf8;
  --primary-glow: rgba(129, 140, 248, 0.3);
  --secondary-color: #64748b;
  --card-bg: rgba(30, 41, 59, 0.7);
  --item-bg: #1e293b;
  --border-color: rgba(255, 255, 255, 0.05);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition-speed), color var(--transition-speed);
}

.noise-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.05;
  z-index: 9999;
  background-image: url('data:image/svg+xml,%3Csvg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="noiseFilter"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.65" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noiseFilter)"/%3E%3C/svg%3E');
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 2rem;
  width: 100%;
  position: relative;
}

header {
  padding: 4rem 0 2rem;
  text-align: center;
}

header h1 {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

header .highlight {
  color: var(--primary-color);
  position: relative;
}

header .highlight::after {
  content: '';
  position: absolute;
  bottom: 0.1em;
  left: 0;
  width: 100%;
  height: 0.2em;
  background-color: var(--primary-glow);
  z-index: -1;
  border-radius: 4px;
}

header p {
  color: var(--secondary-color);
  font-size: 1.1rem;
}

/* Theme Toggle */
.theme-toggle {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  padding: 0.6rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.theme-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

main {
  flex: 1;
}

section {
  margin-bottom: 3rem;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 24px;
  padding: 2.5rem;
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.05),
              0 4px 6px -2px rgba(0, 0, 0, 0.05);
  transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* History Styles */
#history-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--item-bg);
  border-radius: 16px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  animation: slideIn 0.3s ease-out;
  transition: background-color var(--transition-speed);
}

.history-item .balls-small {
  display: flex;
  gap: 0.5rem;
}

.ball-small {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: white;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.history-item .timestamp {
  font-size: 0.85rem;
  color: var(--secondary-color);
}

.empty-msg {
  text-align: center;
  color: var(--secondary-color);
  padding: 2rem 0;
  font-style: italic;
}

button {
  cursor: pointer;
  border: none;
  font-family: inherit;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.secondary-btn {
  background: transparent;
  color: var(--secondary-color);
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
}

.secondary-btn:hover {
  background: rgba(0,0,0,0.05);
  color: var(--text-color);
}

footer {
  padding: 2rem 0;
  text-align: center;
  color: var(--secondary-color);
  font-size: 0.9rem;
}

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

/* Responsive Grid/Container Query for Mobile */
@container (max-width: 500px) {
  .history-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
}
