*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: "Segoe UI", system-ui, sans-serif;
}

/* Race track background: asphalt with circuit feel */
.track-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    /* Asphalt base */
    linear-gradient(135deg, #1a1a1e 0%, #2d2d33 50%, #1f1f24 100%),
    /* Subtle track markings - white stripes suggestion */
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 120px,
      rgba(255, 255, 255, 0.03) 120px,
      rgba(255, 255, 255, 0.03) 122px
    ),
    /* Curbs / track edge */
    radial-gradient(
      ellipse 80% 50% at 50% 50%,
      transparent 30%,
      rgba(255, 200, 0, 0.08) 45%,
      transparent 55%
    );
  background-color: #1a1a1e;
}

/* Driver photos */
.driver {
  position: fixed;
  bottom: 0;
  width: clamp(140px, 18vw, 220px);
  height: auto;
  object-fit: cover;
  object-position: top center;
  border-radius: 8px 8px 0 0;
  /* box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5); */
  z-index: 1;
  /* border: 2px solid rgba(255, 255, 255, 0.1); */
}

.driver--lando {
  left: 24px;
}

.driver--lewis {
  right: 24px;
}

/* Centered countdown */
.countdown-wrapper {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  text-align: center;
  padding: 2rem;
}

.countdown-logo {
  display: block;
  margin: 0 auto 1rem;
  max-width: min(280px, 40vw);
  height: auto;
}

.countdown-title {
  margin: 0 0 1rem;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.countdown {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(0.75rem, 2vw, 1.5rem);
  margin-bottom: 1rem;
  cursor: url('favicon.png'), auto;
}

.countdown-block {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: clamp(0.75rem, 2vw, 1.25rem) clamp(1rem, 3vw, 1.75rem);
  min-width: 4.5rem;
  backdrop-filter: blur(8px);
}

.countdown-value {
  display: block;
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.countdown-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 0.25rem;
}

.countdown-target {
  margin: 0;
  font-size: clamp(0.85rem, 2vw, 1rem);
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.05em;
}

/* When no countdowns left */
.countdown-wrapper.no-next .countdown,
.countdown-wrapper.no-next .countdown-target {
  display: none !important;
}

.countdown-wrapper.no-next .no-next-time {
  display: block !important;
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.9);
}

.no-next-time {
  display: none;
}

/* Form panel */
.form-panel {
  position: fixed;
  top: 50%;
  right: 24px;
  transform: translateY(-50%);
  z-index: 3;
  width: 220px;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 1rem;
  backdrop-filter: blur(10px);
}

.form-panel-title {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.05em;
}

.countdown-form label {
  display: block;
  margin-bottom: 0.6rem;
}

.countdown-form label span {
  display: block;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 0.2rem;
}

.countdown-form input[type="text"],
.countdown-form input[type="date"],
.countdown-form input[type="time"],
.countdown-form select {
  width: 100%;
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.countdown-form button[type="submit"] {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #000;
  background: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.countdown-form button[type="submit"]:hover {
  background: #e0e0e0;
}

.form-actions {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.form-actions button,
.import-label {
  display: block;
  width: 100%;
  margin-bottom: 0.4rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.9);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  cursor: pointer;
}

.import-label {
  cursor: pointer;
  text-align: center;
}

.form-actions button:hover,
.import-label:hover {
  background: rgba(255, 255, 255, 0.1);
}

.countdown-list {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  max-height: 120px;
  overflow-y: auto;
}

.countdown-list li {
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.countdown-list li:first-child {
  font-weight: 600;
  color: #fff;
}

/* Timers page (timers.html) */
.timers-page {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.timers-title {
  margin: 0 0 1.5rem;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #fff;
}

.form-panel--center {
  position: static;
  transform: none;
  width: 100%;
  max-width: 280px;
}

.back-link {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
}

.back-link:hover {
  color: #fff;
}

.countdown-list li.past {
  opacity: 0.5;
}
