:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #100d10;
  color: #eee9df;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  min-width: 320px;
  margin: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(115, 24, 27, 0.13), transparent 32rem),
    #100d10;
}

button {
  font: inherit;
}

.game {
  width: min(92vw, 42rem);
  padding: 3rem 1.25rem;
  text-align: center;
}

.eyebrow {
  margin: 0 0 0.65rem;
  color: #b94949;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

h1 {
  max-width: 34rem;
  margin: 0 auto 2.75rem;
  color: #f3efe7;
  font-size: clamp(1.35rem, 4vw, 2rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.stopwatch {
  position: relative;
  width: min(100%, 29rem);
  margin: 0 auto 1rem;
  padding: 0.65rem;
  border: 1px solid #343033;
  border-radius: 1.8rem;
  background: linear-gradient(145deg, #322d30, #191719 48%, #272326);
  box-shadow:
    0 1.4rem 3rem rgba(0, 0, 0, 0.36),
    inset 0 1px rgba(255, 255, 255, 0.08);
}

.streak-dots {
  min-height: 1rem;
  margin: 0 auto 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.streak-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #f22e32;
  box-shadow:
    0 0 0.3rem rgba(255, 46, 50, 0.78),
    0 0 0.8rem rgba(238, 29, 33, 0.3);
  animation: dot-arrival 180ms ease-out both;
}

.streak-dot--exact {
  width: 0.88rem;
  height: 0.88rem;
  background: #ff363a;
  box-shadow:
    0 0 0 0.14rem rgba(143, 24, 28, 0.72),
    0 0 0.45rem rgba(255, 54, 58, 0.95),
    0 0 1.1rem rgba(238, 29, 33, 0.42);
}

@keyframes dot-arrival {
  from {
    opacity: 0;
    transform: scale(0.25);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.stopwatch__top {
  position: absolute;
  top: -1.12rem;
  right: 3.5rem;
  display: flex;
  gap: 0.45rem;
}

.stopwatch__top span {
  width: 1.7rem;
  height: 1.2rem;
  border: 1px solid #3a3538;
  border-bottom: 0;
  border-radius: 0.4rem 0.4rem 0 0;
  background: linear-gradient(#373235, #1a181a);
}

.stopwatch__face {
  padding: clamp(1.5rem, 7vw, 2.65rem) clamp(1rem, 5vw, 2.3rem) 1.15rem;
  border: 1px solid #090909;
  border-radius: 1.25rem;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.025), transparent 45%),
    #090909;
  box-shadow:
    inset 0 0 2rem rgba(0, 0, 0, 0.9),
    inset 0 0 0 0.25rem #111;
}

.display {
  --digit-width: clamp(3rem, 14vw, 5.25rem);
  --digit-height: calc(var(--digit-width) * 1.72);
  --segment: calc(var(--digit-width) * 0.13);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.25rem, 1.2vw, 0.5rem);
  filter: drop-shadow(0 0 0.4rem rgba(255, 38, 42, 0.23));
}

.digit {
  position: relative;
  width: var(--digit-width);
  height: var(--digit-height);
}

.segment {
  position: absolute;
  border-radius: 999px;
  background: #280b0c;
  opacity: 0.44;
  transition: opacity 45ms linear, background-color 45ms linear;
}

.segment.on {
  background: #f22e32;
  opacity: 1;
  box-shadow:
    0 0 0.28rem rgba(255, 46, 50, 0.85),
    0 0 0.85rem rgba(238, 29, 33, 0.28);
}

.segment.horizontal {
  left: var(--segment);
  width: calc(100% - var(--segment) * 2);
  height: var(--segment);
  clip-path: polygon(8% 0, 92% 0, 100% 50%, 92% 100%, 8% 100%, 0 50%);
}

.segment.vertical {
  width: var(--segment);
  height: calc(50% - var(--segment) * 1.5);
  clip-path: polygon(50% 0, 100% 9%, 100% 91%, 50% 100%, 0 91%, 0 9%);
}

.segment-a { top: 0; }
.segment-b { top: var(--segment); right: 0; }
.segment-c { right: 0; bottom: var(--segment); }
.segment-d { bottom: 0; }
.segment-e { bottom: var(--segment); left: 0; }
.segment-f { top: var(--segment); left: 0; }
.segment-g { top: calc(50% - var(--segment) / 2); }

.colon {
  width: clamp(0.8rem, 4vw, 1.4rem);
  height: var(--digit-height);
  position: relative;
}

.colon::before,
.colon::after {
  content: "";
  position: absolute;
  left: 50%;
  width: clamp(0.36rem, 1.8vw, 0.58rem);
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: #f22e32;
  box-shadow:
    0 0 0.3rem rgba(255, 46, 50, 0.8),
    0 0 0.85rem rgba(238, 29, 33, 0.25);
}

.colon::before { top: 36%; }
.colon::after { top: 64%; }

.display-labels {
  display: flex;
  justify-content: space-between;
  max-width: 9rem;
  margin: 1.2rem auto 0;
  color: #6e5a5b;
  font-family: "Courier New", monospace;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
}

.timer-button,
.share-button {
  min-width: 9.5rem;
  min-height: 3.25rem;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: transform 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}

.timer-button {
  border: 1px solid #d54346;
  background: #c92c31;
  color: #fff8f5;
  box-shadow: 0 0.55rem 1.4rem rgba(171, 26, 31, 0.18);
}

.timer-button:hover:not(:disabled) {
  background: #df373b;
  box-shadow: 0 0.65rem 1.6rem rgba(190, 28, 34, 0.28);
  transform: translateY(-1px);
}

.timer-button:active:not(:disabled) {
  transform: translateY(1px);
}

.timer-button:focus-visible {
  outline: 3px solid rgba(255, 91, 94, 0.38);
  outline-offset: 4px;
}

.share-button {
  border: 1px solid #4d4144;
  background: #1c181b;
  color: #bfb5b1;
}

.share-button:hover:not(:disabled) {
  border-color: #7b5558;
  background: #282023;
  color: #eee4df;
  transform: translateY(-1px);
}

.share-button:active:not(:disabled) {
  transform: translateY(1px);
}

.share-button:focus-visible {
  outline: 3px solid rgba(255, 91, 94, 0.25);
  outline-offset: 4px;
}

.timer-button:disabled,
.share-button:disabled {
  cursor: wait;
}

.timer-button:disabled {
  border-color: #5e3b3d;
  background: #4a2527;
  color: #b99091;
}

.share-button:disabled {
  border-color: #302b2d;
  background: #171416;
  color: #514a4c;
  cursor: not-allowed;
}

.feedback {
  min-height: 4.6rem;
  margin-top: 1.25rem;
}

#message {
  margin: 0;
  color: #d8d0c8;
  font-size: 1rem;
}

.streak {
  margin: 0.5rem 0 0;
  color: #81797a;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.keyboard-hint {
  margin: 1.3rem 0 0;
  color: #514b4e;
  font-size: 0.72rem;
}

.game.is-won .stopwatch {
  border-color: #713b3d;
}

.game.is-won #message {
  color: #ff6669;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 430px) {
  .game {
    padding-inline: 0.8rem;
  }

  .stopwatch {
    padding: 0.45rem;
    border-radius: 1.35rem;
  }

  .stopwatch__face {
    border-radius: 0.95rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
