:root {
  --panel-width: 880px;
  --panel-height: 250px;
  --neon: #33b6ff;
  --neon-strong: #65dcff;
  --digit: #78a6ff;
  --digit-bright: #b8d5ff;
  --glass: rgba(2, 9, 28, 0.88);
  --glass-deep: rgba(0, 3, 15, 0.96);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: transparent;
}

body {
  display: grid;
  place-items: center;
  font-family: "Segoe UI", "Arial Narrow", Arial, sans-serif;
  color: white;
}

.timer-root {
  width: var(--panel-width);
  height: var(--panel-height);
  display: grid;
  place-items: center;
  background: transparent;
}

.timer-panel {
  position: relative;
  width: 840px;
  height: 210px;
  display: grid;
  grid-template-rows: 52px 1fr;
  align-items: center;
  justify-items: center;
  padding: 18px 42px 22px;
  background:
    radial-gradient(circle at 50% 0%, rgba(51, 182, 255, 0.16), transparent 45%),
    linear-gradient(180deg, var(--glass), var(--glass-deep));
  border: 2px solid var(--neon);
  clip-path: polygon(4% 0%, 96% 0%, 100% 18%, 100% 82%, 96% 100%, 4% 100%, 0% 82%, 0% 18%);
  box-shadow:
    0 0 12px rgba(51, 182, 255, 0.95),
    0 0 34px rgba(31, 98, 255, 0.55),
    inset 0 0 26px rgba(34, 120, 255, 0.26),
    inset 0 0 3px rgba(255, 255, 255, 0.8);
}

.timer-panel::before,
.timer-panel::after {
  content: "";
  position: absolute;
  left: 46px;
  right: 46px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(101, 220, 255, 0.9), transparent);
  opacity: 0.5;
}

.timer-panel::before {
  top: 14px;
}

.timer-panel::after {
  bottom: 14px;
}

.panel-glow {
  position: absolute;
  inset: 10px 20px;
  background:
    linear-gradient(90deg, transparent 0%, rgba(84, 170, 255, 0.18) 50%, transparent 100%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.035) 0 1px, transparent 1px 36px);
  opacity: 0.35;
  pointer-events: none;
}

.subtitle {
  position: relative;
  z-index: 2;
  align-self: end;
  margin-bottom: 2px;
  font-size: 22px;
  line-height: 1;
  letter-spacing: 4px;
  font-weight: 700;
  color: var(--neon-strong);
  text-transform: uppercase;
  text-shadow:
    0 0 8px rgba(101, 220, 255, 0.9),
    0 0 18px rgba(40, 120, 255, 0.5);
}

.units {
  position: relative;
  z-index: 2;
  width: 100%;
  display: grid;
  align-items: end;
  justify-content: center;
  gap: 22px;
}

.units.mmss {
  grid-template-columns: minmax(210px, auto) auto minmax(210px, auto);
}

.units.dhms {
  grid-template-columns: repeat(4, minmax(130px, auto));
  gap: 18px;
}

.unit {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.label {
  font-size: 21px;
  letter-spacing: 3px;
  font-weight: 800;
  color: var(--neon-strong);
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(101, 220, 255, 0.8);
}

.value {
  font-family: Impact, Haettenschweiler, "Arial Black", "Segoe UI Black", sans-serif;
  font-size: 108px;
  line-height: 0.82;
  letter-spacing: 2px;
  color: var(--digit);
  -webkit-text-stroke: 1px var(--digit-bright);
  text-shadow:
    0 0 4px rgba(255, 255, 255, 0.75),
    0 0 16px rgba(86, 140, 255, 0.95),
    0 0 32px rgba(44, 90, 255, 0.65);
  font-variant-numeric: tabular-nums;
}

.divider {
  align-self: end;
  padding-bottom: 3px;
  font-family: Impact, Haettenschweiler, "Arial Black", "Segoe UI Black", sans-serif;
  font-size: 98px;
  line-height: 0.82;
  color: var(--digit);
  -webkit-text-stroke: 1px var(--digit-bright);
  text-shadow:
    0 0 4px rgba(255, 255, 255, 0.75),
    0 0 16px rgba(86, 140, 255, 0.95),
    0 0 32px rgba(44, 90, 255, 0.65);
}

.units.mmss .unit-days,
.units.mmss .unit-hours {
  display: none;
}

.units.dhms .divider {
  display: none;
}

.units.dhms .value {
  font-size: 72px;
}

.units.dhms .label {
  font-size: 16px;
  letter-spacing: 2px;
}

.done-message {
  position: relative;
  z-index: 2;
  grid-row: 1 / span 2;
  align-self: center;
  font-family: Impact, Haettenschweiler, "Arial Black", "Segoe UI Black", sans-serif;
  font-size: 92px;
  line-height: 0.95;
  letter-spacing: 4px;
  color: #ffffff;
  text-transform: uppercase;
  text-shadow:
    0 0 8px rgba(255,255,255,0.9),
    0 0 20px rgba(101, 220, 255, 0.95),
    0 0 44px rgba(44, 90, 255, 0.8);
}

.timer-panel.is-done {
  animation: doneFlash 1s ease-in-out infinite alternate;
}

.timer-root:not(.no-pulse) .timer-panel {
  animation: panelPulse 2.8s ease-in-out infinite alternate;
}

.timer-root.no-panel .timer-panel {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.timer-root.no-panel .timer-panel::before,
.timer-root.no-panel .timer-panel::after,
.timer-root.no-panel .panel-glow {
  display: none;
}

@keyframes panelPulse {
  from {
    filter: brightness(0.96);
  }
  to {
    filter: brightness(1.12);
  }
}

@keyframes doneFlash {
  from {
    box-shadow:
      0 0 12px rgba(51, 182, 255, 0.95),
      0 0 34px rgba(31, 98, 255, 0.55),
      inset 0 0 26px rgba(34, 120, 255, 0.26);
  }
  to {
    box-shadow:
      0 0 22px rgba(101, 220, 255, 1),
      0 0 62px rgba(31, 98, 255, 0.85),
      inset 0 0 38px rgba(34, 120, 255, 0.38);
  }
}

/* Website embed responsiveness. OBS at 880x250 still works because these only scale down. */
@media (max-width: 900px) {
  :root {
    --panel-width: 100vw;
    --panel-height: 250px;
  }

  .timer-root {
    width: 100vw;
  }

  .timer-panel {
    width: calc(100vw - 24px);
    max-width: 840px;
    padding-left: 22px;
    padding-right: 22px;
  }

  .units.dhms {
    grid-template-columns: repeat(4, minmax(70px, auto));
    gap: 10px;
  }

  .units.dhms .value {
    font-size: clamp(38px, 9vw, 72px);
  }

  .units.dhms .label {
    font-size: clamp(10px, 2vw, 16px);
    letter-spacing: 1px;
  }

  .units.mmss {
    grid-template-columns: minmax(120px, auto) auto minmax(120px, auto);
    gap: 12px;
  }

  .value {
    font-size: clamp(58px, 16vw, 108px);
  }

  .divider {
    font-size: clamp(52px, 14vw, 98px);
  }

  .subtitle {
    font-size: clamp(14px, 3.5vw, 22px);
    letter-spacing: 2px;
    text-align: center;
  }

  .done-message {
    font-size: clamp(46px, 14vw, 92px);
  }
}
