:root {
  --bg: #1b1f2a;
  --stripe-h: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  transition: background-color 0.6s ease;
  font-family: "Fredoka", "Segoe UI", sans-serif;
  color: #fff;
}

#root { width: 100%; height: 100%; }

.screen {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

/* Checkered-flag stripes top & bottom */
.screen::before,
.screen::after {
  content: "";
  display: block;
  height: var(--stripe-h);
  width: 100%;
  background-image: repeating-linear-gradient(
    90deg,
    #111 0 28px,
    #f4f4f4 28px 56px
  );
  flex-shrink: 0;
}

.topbar {
  position: absolute;
  top: calc(var(--stripe-h) + 18px);
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 16px;
  z-index: 2;
}

.badge {
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  padding: 8px 22px;
  font-size: clamp(14px, 1.6vw, 22px);
  font-weight: 600;
  letter-spacing: 0.03em;
  backdrop-filter: blur(2px);
}

.wallclock { opacity: 0.85; }

.center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.5vh;
  padding: 0 4vw;
}

.phase-emoji {
  font-size: clamp(48px, 8vw, 110px);
  line-height: 1;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.35));
}

.phase-name {
  font-family: "Bungee", "Fredoka", sans-serif;
  font-size: clamp(28px, 6vw, 72px);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-shadow: 0 4px 0 rgba(0,0,0,0.25), 0 8px 18px rgba(0,0,0,0.3);
  margin-top: 4px;
}

.clock {
  font-family: "Rubik Mono One", monospace;
  font-size: clamp(70px, 18vw, 260px);
  line-height: 1;
  margin: 1vh 0;
  text-shadow: 0 6px 0 rgba(0,0,0,0.25), 0 14px 30px rgba(0,0,0,0.35);
  font-variant-numeric: tabular-nums;
}

.clock.small {
  font-size: clamp(50px, 12vw, 160px);
}

.next-line {
  font-size: clamp(16px, 2.4vw, 30px);
  font-weight: 600;
  opacity: 0.9;
  background: rgba(0,0,0,0.25);
  padding: 8px 20px;
  border-radius: 999px;
}

.track {
  position: relative;
  height: 34px;
  margin: 0 6vw 4vh;
  background: repeating-linear-gradient(
    90deg,
    #2b2b2b 0 40px,
    #3a3a3a 40px 80px
  );
  border-radius: 999px;
  border: 3px solid rgba(255,255,255,0.5);
  overflow: visible;
  flex-shrink: 0;
}

.track-fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  background: linear-gradient(90deg, #fff8, #fff2);
  border-radius: 999px;
  transition: width 0.3s linear;
}

.kart {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -55%) scaleX(-1);
  font-size: 34px;
  transition: left 0.3s linear;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.4));
}

#fs-btn {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 10;
  background: rgba(0,0,0,0.4);
  color: #fff;
  border: 2px solid rgba(255,255,255,0.5);
  border-radius: 10px;
  font-size: 20px;
  padding: 8px 12px;
  cursor: pointer;
}
#fs-btn:hover { background: rgba(0,0,0,0.6); }

#snd-btn {
  position: fixed;
  bottom: 18px;
  right: 74px;
  z-index: 10;
  background: rgba(0,0,0,0.4);
  color: #fff;
  border: 2px solid rgba(255,255,255,0.5);
  border-radius: 10px;
  font-size: 20px;
  padding: 8px 12px;
  cursor: pointer;
}
#snd-btn:hover { background: rgba(0,0,0,0.6); }

/* Gentle pulse while sound is on but not yet armed (waiting for a user
   gesture — a browser requirement, not a bug). */
@keyframes snd-pulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}
#snd-btn.snd-pulse { animation: snd-pulse 1.4s ease-in-out infinite; }

.free-screen .center { gap: 1vh; }
