:root {
  --bg-light: linear-gradient(to top, #fbd786, #f7797d);
  --bg-dark: linear-gradient(to top, #0f2027, #2c5364);
  --text-light: #222;
  --text-dark: #f0f0f0;
}

html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg-light);
  color: var(--text-light);
  transition: background 1s ease, color 1s ease;
}

body.dark {
  background: var(--bg-dark);
  color: var(--text-dark);
}

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

h1 {
  margin-bottom: 2rem;
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.5px;
}

.toggle {
  width: 220px;
  height: 110px;
  border-radius: 999px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 24px rgba(0,0,0,0.2), 0 4px 12px rgba(0,0,0,0.1);
  transition: transform 200ms ease;
  z-index: 10;
}
.toggle:active { transform: scale(.97); }

svg { display: block; width: 100%; height: 100%; }

.scene-layer { transition: opacity 600ms ease; }
.scene-day { opacity: 1; }
.scene-night { opacity: 0; }
.toggle.active .scene-day { opacity: 0; }
.toggle.active .scene-night { opacity: 1; }

.knob {
  position: absolute;
  top: 19px;
  left: 10px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 10px 20px rgba(0,0,0,0.25), 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 500ms cubic-bezier(.4,.8,.3,1);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}
.toggle.active .knob { transform: translateX(128px); }
.knob:hover { transform: scale(1.05); }

.icon {
  position: absolute;
  width: 40px;
  height: 40px;
  transition: opacity 400ms ease;
}
.icon-sun { opacity: 1; }
.icon-moon { opacity: 0; }
.toggle.active .icon-sun { opacity: 0; }
.toggle.active .icon-moon { opacity: 1; }

.star { 
  animation: twinkle 3s infinite ease-in-out alternate;
  filter: drop-shadow(0 0 2px white);
}
.star:nth-child(2) { animation-duration: 2s; }
.star:nth-child(3) { animation-duration: 4s; }
.star:nth-child(4) { animation-duration: 3.5s; }
.star:nth-child(5) { animation-duration: 2.5s; }
.star:nth-child(6) { animation-duration: 3.2s; }
.star:nth-child(7) { animation-duration: 4.5s; }
.star:nth-child(8) { animation-duration: 2.8s; }

@keyframes twinkle { 
  from { opacity: 0.2; transform: scale(0.8); } 
  to { opacity: 1; transform: scale(1.2); } 
}

.rotate-sun { animation: rotate 10s linear infinite; transform-origin: center; }
@keyframes rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.cloud { 
  filter: blur(1.2px); 
  opacity: 0.85;
  animation: float 30s linear infinite;
}

.cloud:nth-child(2) { 
  animation-duration: 35s; 
  animation-delay: -5s; 
}

.cloud:nth-child(3) { 
  animation-duration: 40s; 
  animation-delay: -10s; 
}

@keyframes float { from { transform: translateX(-60px); } to { transform: translateX(260px); } }

footer {
  padding: 1rem 1.5rem;
  text-align: center;
  font-size: 0.95rem;
  width: 100%;
  color: inherit;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(4px);
  box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
  border-radius: 8px 8px 0 0;
}
body.dark footer {
  background: rgba(0,0,0,0.2);
}

/* Animate sun and moon movement across the toggle in a smooth arc */
/* SUN & MOON animation */
.move-sun {
  offset-rotate: 0deg;
  transform-box: fill-box;
  transform-origin: center;
  animation: sunArc 8s linear infinite;
  filter: url(#sunGlow);
}
.move-moon {
  offset-rotate: 0deg;
  animation: moonArc 8s linear infinite;
  filter: url(#moonGlow);
}

/* Smooth half-circle arc */
@keyframes sunArc {
  0%   { transform: translate(0, 30px); }
  20%  { transform: translate(48px, -5px); }
  25%  { transform: translate(60px, -10px); }
  40%  { transform: translate(96px, -15px); }
  60%  { transform: translate(144px, -15px); }
  75%  { transform: translate(180px, -10px); }
  80%  { transform: translate(192px, -5px); }
  100% { transform: translate(240px, 30px); }
}

@keyframes moonArc {
  0%   { transform: translate(0, 30px); }
  20%  { transform: translate(-48px, -5px); }
  25%  { transform: translate(-60px, -10px); }
  40%  { transform: translate(-96px, -15px); }
  60%  { transform: translate(-144px, -15px); }
  75%  { transform: translate(-180px, -10px); }
  80%  { transform: translate(-192px, -5px); }
  100% { transform: translate(-240px, 30px); }
}

.cloud {
  filter: blur(1px);
  opacity: 0.85;
  animation: float 18s linear infinite, drift 6s ease-in-out infinite alternate;
}

/* Each cloud with unique timing for natural variation */
.cloud:nth-child(2) { 
  animation-duration: 22s, 7s; 
  animation-delay: -4s, -2s;
}

.cloud:nth-child(3) { 
  animation-duration: 26s, 9s; 
  animation-delay: -8s, -3s;
}

@keyframes float {
  from { transform: translateX(-100px); }
  to   { transform: translateX(320px); }
}

@keyframes drift {
  0%   { transform: translateY(0) scale(1); opacity: 0.85; }
  50%  { transform: translateY(-4px) scale(1.05); opacity: 0.95; }
  100% { transform: translateY(0) scale(1); opacity: 0.85; }
}
