:root {
  --doom-green: #00ff41;
  --doom-silver: #c0c0c0;
  --bg-black: #050505;
}

body {
  background-color: var(--bg-black);
  color: var(--doom-green);
  font-family: 'JetBrains Mono', monospace;
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
}

/* Cinematic Overlays */
.scanline,
.vignette {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.scanline {
  background: linear-gradient(
    0deg,
    transparent 0%,
    rgba(0, 255, 65, 0.05) 50%,
    transparent 100%
  );
  height: 100px;
  animation: scan 4s linear infinite;
}

.vignette {
  background: radial-gradient(circle, transparent 40%, rgba(0, 0, 0, 0.9) 150%);
}

@keyframes scan {
  0% {
    top: -100px;
  }
  100% {
    top: 100%;
  }
}

/* Layout Structure */
.container {
  width: 95%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  z-index: 1;
  padding: 2rem 0;
}

.timer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: fit-content;
  margin: 0 auto;
}

.countdown-wrapper {
  display: flex;
  flex-wrap: nowrap; /* Forces everything onto one line */
  justify-content: center;
  gap: 2rem;       /* Reduced gap specifically for mobile */
  width: 100%;
  margin-bottom: 2rem;
  /* font-size: 2rem; */
}

.time-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 auto;    /* Allows items to shrink equally */
  min-width: 0;      /* Critical: allows flex items to shrink below content width */
}

.number {
  /* Use a slightly smaller font for mobile to ensure fit */
  font-size: clamp(2.5rem, 6vw, 3.5rem); 
  font-weight: 800;
}

.label {
  font-size: 0.6rem;
  letter-spacing: 1px;
}

/* Maintain your wide gaps only for desktop */
@media (min-width: 900px) {
  .countdown-wrapper {
    gap: 4rem;
    flex-wrap: nowrap; /* Still keep it one line on desktop */
  }
}

.progress-bg {
  width: 100%;
  height: 26px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--doom-green);
  position: relative;
  overflow: hidden;
  display: flex; /* Centers text horizontally */
  align-items: center; /* Centers text vertically */
  justify-content: center;
}

.progress-fill {
  height: 100%;
  background: var(--doom-green);
  box-shadow: 0 0 15px var(--doom-green);
  transition: width 1s linear;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1; /* Sits behind text */
}

.progress-text {
  position: relative; /* Keeps it centered in the .progress-bg flexbox */
  z-index: 2; /* Sits on top of the moving green fill */
  color: #fff;
  font-size: 0.75rem;
  font-weight: 900;
  text-shadow: 1px 1px 2px #000; /* Contrast for when the bar is green vs black */
  pointer-events: none;
}

/* Branding */
.logo {
  font-size: clamp(2.5rem, 10vw, 5.5rem);
  margin: 2.5rem 0;
  letter-spacing: 10px;
  color: var(--doom-silver);
  position: relative;
  text-shadow:
    0.05em 0 0 rgba(255, 0, 0, 0.75),
    -0.025em -0.05em 0 rgba(0, 255, 0, 0.75);
  animation: logo-glitch 500ms infinite;
}

.logo span {
  color: var(--doom-green);
}

.subtitle {
  letter-spacing: 5px;
  font-size: 0.9rem;
  opacity: 0.8;
  transition: opacity 0.5s;
}

/* FX & State */
@keyframes logo-glitch {
  0%,
  14% {
    text-shadow:
      0.05em 0 0 rgba(255, 0, 0, 0.75),
      -0.05em -0.025em 0 rgba(0, 255, 0, 0.75);
  }
  15%,
  49% {
    text-shadow:
      -0.05em -0.025em 0 rgba(255, 0, 0, 0.75),
      0.025em 0.025em 0 rgba(0, 255, 0, 0.75);
  }
  50%,
  99% {
    text-shadow:
      0.025em 0.05em 0 rgba(255, 0, 0, 0.75),
      0.05em 0 0 rgba(0, 255, 0, 0.75);
  }
}

.glitch-shake {
  animation: shake 0.2s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
@keyframes shake {
  10%,
  90% {
    transform: translate3d(-1px, 0, 0);
  }
  40%,
  60% {
    transform: translate3d(4px, 0, 0);
  }
}

.system-failure {
  background-color: #200000 !important;
  color: #ff0000 !important;
}
.system-failure .progress-fill {
  background: #ff0000 !important;
  box-shadow: 0 0 30px #ff0000;
}
.emergency-blink {
  animation: alert-blink 0.5s step-end infinite;
}
@keyframes alert-blink {
  50% {
    opacity: 0;
  }
}

/* Desktop Scaling */
@media (min-width: 900px) {
  .countdown-wrapper {
    gap: 4.5rem;
  }
}
@media (min-width: 1400px) {
  .countdown-wrapper {
    gap: 7rem;
  }
}
