:root {
  /* Dark Mode (Default) */
  --primary-color: #6366f1;
  --accent-color: #f59e0b;
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  --card-bg: rgba(255, 255, 255, 0.05);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --ball-gradient: radial-gradient(circle at 30% 30%, #ffffff 0%, #e2e8f0 100%);
  --ball-text: #1e293b;
  --card-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
  --card-border: rgba(255, 255, 255, 0.1);
  --btn-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
}

body.light-mode {
  --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  --card-bg: rgba(255, 255, 255, 0.8);
  --text-main: #1e293b;
  --text-muted: #64748b;
  --ball-gradient: radial-gradient(circle at 30% 30%, #6366f1 0%, #4338ca 100%);
  --ball-text: #ffffff;
  --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --card-border: rgba(99, 102, 241, 0.1);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3%3Ffilter 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");
  opacity: 0.03;
  pointer-events: none;
  z-index: 1;
}

.app-container {
  width: 100%;
  max-width: 600px;
  padding: 2rem;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

header {
  text-align: center;
  position: relative;
}

.theme-toggle-container {
  position: absolute;
  top: 0;
  right: 0;
}

#theme-toggle {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  padding: 0.5rem;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.25rem;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  backdrop-filter: blur(10px);
}

#theme-toggle:hover {
  transform: rotate(15deg) scale(1.1);
}

.icon-sun { display: none; }
body.light-mode .icon-sun { display: inline; }
body.light-mode .icon-moon { display: none; }

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

.highlight {
  background: linear-gradient(to right, #818cf8, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

#lotto-display {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.game-placeholder {
  text-align: center;
  padding: 3rem;
  border: 2px dashed var(--card-border);
  border-radius: 1rem;
  color: var(--text-muted);
}

.lotto-card, .form-card {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  padding: 1.5rem;
  border-radius: 1.25rem;
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease, border 0.3s ease;
}

.lotto-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: slideIn 0.5s ease out both;
}

.form-card h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.form-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: left;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group input,
.form-group textarea {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

body.light-mode .form-group input,
body.light-mode .form-group textarea {
  background: rgba(0, 0, 0, 0.02);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.submit-btn {
  width: 100%;
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 1rem;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
  box-shadow: var(--btn-shadow);
}

.submit-btn:hover {
  background: #4f46e5;
  transform: translateY(-2px);
}

.submit-btn:active {
  transform: translateY(0);
}

.lotto-card:hover {
  transform: translateY(-4px);
}

.game-label {
  font-weight: 700;
  color: var(--primary-color);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  width: 40px;
}

.balls-container {
  display: flex;
  gap: 0.75rem;
}

.ball {
  width: 45px;
  height: 45px;
  background: var(--ball-gradient);
  color: var(--ball-text);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: inset -4px -4px 8px rgba(0, 0, 0, 0.1), 0 4px 6px -1px rgba(0, 0, 0, 0.2);
  animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
  transition: background 0.3s ease, color 0.3s ease;
}

.ball:nth-child(1) { animation-delay: 0.1s; }
.ball:nth-child(2) { animation-delay: 0.2s; }
.ball:nth-child(3) { animation-delay: 0.3s; }
.ball:nth-child(4) { animation-delay: 0.4s; }
.ball:nth-child(5) { animation-delay: 0.5s; }
.ball:nth-child(6) { animation-delay: 0.6s; }

.actions {
  display: flex;
  justify-content: center;
}

#generate-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 1rem 2.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  border-radius: 9999px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  box-shadow: var(--btn-shadow);
}

#generate-btn:hover {
  background: #4f46e5;
  transform: scale(1.05);
}

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

.btn-glow {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    120deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transition: all 0.6s;
}

#generate-btn:hover .btn-glow {
  left: 100%;
}

footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

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

@media (max-width: 480px) {
  .app-container {
    padding: 1rem;
  }
  
  header h1 {
    font-size: 2.25rem;
  }
  
  .theme-toggle-container {
    top: -0.5rem;
  }
  
  .ball {
    width: 38px;
    height: 38px;
    font-size: 0.9rem;
  }
  
  .balls-container {
    gap: 0.4rem;
  }
}
