:root {
  --clock-scale: 2.4;
  --bg-color: #121212;
  --text-color: #ffffff;
  --card-bg: #2b2b2b;
  --card-shadow: rgba(0, 0, 0, 0.7);
  --line-color: rgba(0, 0, 0, 0.3);
  --accent: #ff4757;
}

[data-theme="light"] {
  --bg-color: #f0f2f5;
  --text-color: #333333;
  --card-bg: #ffffff;
  --card-shadow: rgba(0, 0, 0, 0.15);
  --line-color: rgba(0, 0, 0, 0.05);
  --accent: #ff4757;
}

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

body {
  font-family: 'Oswald', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  transition: all 0.3s ease;
  overflow: hidden;
  position: relative;
}

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  padding-bottom: 120px; /* Space for the absolute quote */
  box-sizing: border-box;
}

.title {
  font-size: 2rem;
  letter-spacing: 5px;
  text-transform: uppercase;
  font-weight: 700;
  opacity: 0.8;
  margin-bottom: 20px;
}

.clock {
  display: flex;
  align-items: center;
  gap: 15px;
  background: var(--line-color);
  padding: 30px 40px;
  border-radius: 20px;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.1), 0 20px 50px var(--card-shadow);
  transform: scale(var(--clock-scale));
  transform-origin: center;
}

.quote-display {
  margin-top: 40px;
  width: 90%;
  font-size: var(--quote-size, 32px);
  color: var(--quote-color, #ffffff);
  text-align: center;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  transition: opacity 0.3s ease, font-size 0.3s ease, color 0.3s ease;
  z-index: 1;
  opacity: 1;
}

/* Ensure quote stays at bottom if there is space */
@media (min-height: 600px) {
  .quote-display {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
  }
}

.quote-display.hidden {
  opacity: 0;
  pointer-events: none;
}

.flip-group {
  display: flex;
  gap: 5px;
}

.colon {
  font-size: 80px;
  font-weight: 700;
  color: var(--text-color);
  animation: blink 1s infinite alternate;
  padding-bottom: 20px;
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.3; }
}

.flip-card {
  position: relative;
  width: 90px;
  height: 140px;
  background-color: var(--card-bg);
  border-radius: 12px;
  font-size: 100px;
  font-weight: 700;
  line-height: 140px;
  text-align: center;
  perspective: 1000px;
  box-shadow: 0 5px 15px var(--card-shadow);
  color: var(--text-color);
}

.flip-card::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--line-color);
  z-index: 5;
}

.top, .bottom, .front, .back {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  background-color: var(--card-bg);
  color: var(--text-color);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
}

.top, .front {
  clip-path: inset(0 0 50% 0);
  -webkit-clip-path: inset(0 0 50% 0);
  transform-origin: center;
}

.bottom, .back {
  clip-path: inset(50% 0 0 0);
  -webkit-clip-path: inset(50% 0 0 0);
  transform-origin: center;
}

.top { z-index: 1; }
.bottom { z-index: 1; }
.front { z-index: 2; }
.back { z-index: 2; transform: rotateX(90deg); }

.flip-card.flipping .front {
  transform: rotateX(-90deg);
  transition: transform 0.3s ease-in;
}

.flip-card.flipping .back {
  transform: rotateX(0deg);
  transition: transform 0.3s ease-out;
  transition-delay: 0.3s;
}

.controls {
  display: flex;
  gap: 20px;
  margin-top: 20px;
}

button {
  padding: 12px 24px;
  border: none;
  background: var(--card-bg);
  color: var(--text-color);
  font-family: 'Oswald', sans-serif;
  font-size: 16px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 10px var(--card-shadow);
  transition: transform 0.2s, background 0.3s;
  letter-spacing: 1px;
}

button:hover {
  transform: translateY(-2px);
  background: var(--accent);
  color: white;
}

button:active {
  transform: translateY(0);
}

.settings-panel {
  position: fixed;
  bottom: 80px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  background: var(--line-color);
  padding: 20px;
  border-radius: 15px;
  box-shadow: 0 10px 30px var(--card-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transform-origin: bottom right;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
}

.settings-panel.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.settings-panel .controls {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.settings-panel .controls button {
  width: 100%;
}

.settings {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(0,0,0,0.1);
  padding: 15px;
  border-radius: 10px;
  width: 100%;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.settings label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-color);
  margin-right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-width: 130px;
}

.settings label span {
  color: var(--accent);
  font-weight: 700;
  margin-left: 5px;
}

.settings select, .settings input {
  font-family: 'Oswald', sans-serif;
  background: var(--card-bg);
  color: var(--text-color);
  border: none;
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  flex: 1;
  max-width: 120px;
}

.settings input[type="range"] {
  padding: 0;
  accent-color: var(--accent);
}

.floating-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--card-bg);
  color: var(--text-color);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  z-index: 10;
  border: 1px solid rgba(255,255,255,0.1);
}

.floating-btn:hover {
  transform: scale(1.1) rotate(45deg);
}

#particle-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 100;
  overflow: hidden;
}

.particle {
  position: absolute;
  top: 0;
  left: 0;
  user-select: none;
  will-change: transform;
}

.particle.snow {
  color: #fff;
  opacity: 0.8;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.particle.petal {
  color: #ffb7c5;
  opacity: 0.9;
  text-shadow: 0 0 5px rgba(255, 183, 197, 0.5);
}

@media (max-width: 768px) {
  .clock {
    flex-direction: column;
    padding: 20px 40px;
    gap: 20px;
  }
  .colon {
    display: none;
  }
  .quote-display {
    bottom: 20px;
  }
}
