:root {
  --clock-scale: 0.5;
  --clock-max-width: calc(100vw * var(--clock-scale));
  --clock-max-height: calc(100vh * var(--clock-scale));
  --digit-height: calc(var(--clock-max-height) / 1.3);
  --digit-width: calc(var(--clock-max-width) / 8);
  --digit-font-size: clamp(1rem, calc(min(var(--digit-width), var(--digit-height)) * 0.9), 8vw);
  --separator-font-size: var(--digit-font-size);
  --transition-duration: 0.2s;
  --animation-duration: 0.7s;
}

.clock-wrapper {
  width: var(--clock-max-width);
  height: var(--clock-max-height);
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 8 / 2;
  max-width: 100vw;
  max-height: 100vh;
  background: none;
  box-shadow: none;
  border: none;
  padding: 0;
  overflow: hidden;
}

.container {
  display: grid;
  gap: 0.8rem;
  position: relative;
  width: 100vw;
  height: 100vh;
  place-items: center;
}

[data-theme="dark"] {
  --bg: linear-gradient(135deg, #10141a 0%, #232b38 100%);
  --fg: #00ffe7;
  --frame-bg: linear-gradient(135deg, rgba(30, 40, 50, 0.7), rgba(40, 60, 80, 0.5));
  --digit-bg: rgba(30, 40, 50, 0.4);
  --info-bg: linear-gradient(135deg, rgba(30, 40, 50, 0.6), rgba(40, 60, 80, 0.4));
}

[data-theme="light"] {
  --bg: linear-gradient(135deg, #f8fafc 0%, #e3eaf2 100%);
  --fg: #232b38;
  --frame-bg: linear-gradient(135deg, rgba(255,255,255,0.7), rgba(220,230,240,0.5));
  --digit-bg: rgba(255,255,255,0.4);
  --info-bg: linear-gradient(135deg, rgba(255,255,255,0.6), rgba(220,230,240,0.4));
}

body {
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  margin: 0;
  font-family: 'Inter', 'SF Pro Display', -apple-system, sans-serif;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
  animation: bg-shift 60s linear infinite;
}

@keyframes bg-shift {
  0% { background-position: 0% 0%; }
  100% { background-position: 100% 100%; }
}

.clock {
  display: flex;
  gap: 0.1rem;
  width: 100%;
  height: 100%;
  background: none !important;
  box-shadow: none !important;
  border: none !important;
  padding: 0 !important;
  justify-content: center;
  align-items: center;
}

.clock.glow::after {
  display: none !important;
}

.column {
  overflow: hidden;
  width: var(--digit-width);
  height: var(--digit-height);
  background: none !important;
  box-shadow: none !important;
  border: none !important;
  border-radius: 0;
  padding: 0;
}

.digit, .separator {
  font-size: var(--digit-font-size);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--digit-height);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.digits {
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-duration) cubic-bezier(.4,2,.6,1);
  will-change: transform;
}

.no-transition {
  transition: none;
}

.digit {
  height: var(--digit-height);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: var(--digit-font-size);
  background: none !important;
  color: var(--fg);
  font-weight: 600;
  letter-spacing: 0.02em;
  border: none;
  box-shadow: none;
  padding: 0;
}

.separator {
  font-size: var(--separator-font-size);
  line-height: var(--digit-height);
  color: var(--fg);
  background: none !important;
  padding: 0 0.12rem;
  font-weight: 700;
  border: none;
  box-shadow: none;
}

.theme-toggle {
  position: fixed;
  bottom: 1.2rem;
  right: 1.2rem;
  padding: 0;
  background: var(--info-bg);
  color: var(--fg);
  font-size: 1.2rem;
  width: 2.2rem;
  height: 2.2rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: color var(--transition-duration), transform 0.3s;
  backdrop-filter: blur(12px);
  border-radius: 50%;
  opacity: 0.92;
  border: none;
  box-shadow: 0 2px 8px 0 rgba(0,0,0,0.07);
}

.theme-toggle:hover {
  color: #00ffe7;
  transform: scale(1.12);
  opacity: 1;
}

.info {
  position: fixed;
  top: 1.2rem;
  right: 1.2rem;
  background: var(--info-bg);
  color: var(--fg);
  padding: 0.5rem 1.1rem;
  font-size: 0.95rem;
  line-height: 1.4;
  text-align: right;
  max-width: 13rem;
  backdrop-filter: blur(12px);
  border-radius: 1.2rem;
  letter-spacing: 0.02em;
  border: none;
  box-shadow: 0 2px 8px 0 rgba(0,0,0,0.07);
}

@media (max-width: 600px) {
  :root {
    --clock-scale: 0.95;
    --clock-max-width: calc(100vw * var(--clock-scale));
    --clock-max-height: calc(100vh * var(--clock-scale));
    --digit-height: calc(var(--clock-max-height) / 1.3);
    --digit-width: calc(var(--clock-max-width) / 8);
    --digit-font-size: clamp(0.7rem, calc(min(var(--digit-width), var(--digit-height)) * 0.9), 12vw);
    --separator-font-size: var(--digit-font-size);
  }
  .clock-wrapper {
    width: var(--clock-max-width);
    height: var(--clock-max-height);
    aspect-ratio: 8 / 2;
    max-width: 100vw;
    max-height: 100vh;
    background: none;
    box-shadow: none;
    border: none;
    padding: 0;
    overflow: hidden;
  }
  .clock {
    padding: 0 !important;
    gap: 0.05rem;
  }
  .digit, .separator {
    font-size: var(--digit-font-size);
    line-height: 1;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
  }
}

.corner {
  position: fixed;
  top: 1.2rem;
  left: 1.2rem;
  z-index: 10;
  font-size: 1.1rem;
  color: var(--fg);
  font-weight: 600;
  letter-spacing: 0.02em;
  user-select: none;
  pointer-events: none;
}

.fact-corner {
  position: fixed;
  bottom: 1.2rem;
  left: 1.2rem;
  background: var(--info-bg);
  color: var(--fg);
  padding: 0.7rem 1.1rem 0.7rem 1.1rem;
  font-size: 1.02rem;
  line-height: 1.4;
  max-width: 20rem;
  min-width: 13rem;
  border-radius: 1.2rem;
  box-shadow: 0 2px 8px 0 rgba(0,0,0,0.07);
  backdrop-filter: blur(12px);
  z-index: 20;
  letter-spacing: 0.01em;
  opacity: 0.97;
  transition: opacity 0.3s;
}