:root {
  color-scheme: dark;
  --bg: #07100e;
  --surface: rgba(14, 29, 25, 0.74);
  --surface-strong: #10231e;
  --border: rgba(174, 255, 216, 0.12);
  --text: #f4fbf7;
  --muted: #91a59e;
  --green: #48e29a;
  --green-bright: #70f5b6;
  --danger: #ff655f;
  --font-body: "DM Sans", system-ui, sans-serif;
  --font-display: "Space Grotesk", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 40%, rgba(33, 117, 83, 0.13), transparent 36rem),
    linear-gradient(145deg, #07100e 0%, #091512 55%, #050b09 100%);
  font-family: var(--font-body);
}

button,
a {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(112, 245, 182, 0.65);
  outline-offset: 3px;
}

.ambient {
  position: fixed;
  z-index: 0;
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  opacity: 0.12;
}

.ambient--one {
  top: -12rem;
  right: -10rem;
  background: #46eba0;
}

.ambient--two {
  bottom: -16rem;
  left: -12rem;
  background: #1b8060;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: min(100%, 1440px);
  min-height: 100svh;
  margin: 0 auto;
  padding: 1.5rem clamp(1.25rem, 4vw, 4rem);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  text-decoration: none;
}

.brand__mark {
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  place-items: center;
  border: 1px solid rgba(112, 245, 182, 0.22);
  border-radius: 0.7rem;
  color: var(--green-bright);
  background: rgba(72, 226, 154, 0.08);
}

.brand__mark svg {
  width: 1.45rem;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.connection {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  font-size: 0.76rem;
  font-weight: 600;
}

.connection__dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(72, 226, 154, 0.09);
}

.connection--error .connection__dot {
  background: #ffb84d;
  box-shadow: 0 0 0 4px rgba(255, 184, 77, 0.09);
}

.counter-card {
  align-self: center;
  width: min(100%, 70rem);
  margin: 3rem auto;
  text-align: center;
}

.eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  color: var(--green-bright);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.19em;
  text-transform: uppercase;
}

.eyebrow__line {
  width: 1.8rem;
  height: 1px;
  background: rgba(112, 245, 182, 0.45);
}

h1 {
  margin: 1rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.subtitle {
  margin: 0.9rem 0 0;
  color: var(--muted);
  font-size: clamp(0.95rem, 2vw, 1.1rem);
}

.timer {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(0.35rem, 1.6vw, 1.5rem);
  margin: clamp(2.7rem, 7vw, 5rem) auto clamp(2rem, 5vw, 3.3rem);
}

.time-unit {
  display: flex;
  min-width: clamp(3.8rem, 13vw, 10rem);
  flex-direction: column;
  align-items: center;
}

.time-unit__value {
  font-family: var(--font-display);
  font-size: clamp(3.1rem, 11vw, 9rem);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  line-height: 0.82;
  letter-spacing: -0.075em;
  text-shadow: 0 0 2rem rgba(244, 251, 247, 0.035);
}

.time-unit--featured .time-unit__value {
  color: var(--green-bright);
  text-shadow: 0 0 2.7rem rgba(72, 226, 154, 0.16);
}

.time-unit__label {
  margin-top: clamp(1rem, 2vw, 1.5rem);
  color: var(--muted);
  font-size: clamp(0.58rem, 1.2vw, 0.78rem);
  font-weight: 700;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.timer__separator {
  margin-top: -0.12em;
  color: rgba(244, 251, 247, 0.25);
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 9vw, 7.3rem);
  line-height: 0.82;
}

.since {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.since svg {
  width: 1.15rem;
  stroke: var(--green);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.since strong {
  color: #c2d2cc;
  font-weight: 600;
}

.reset-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  margin-top: 2rem;
  padding: 0.8rem 1.2rem;
  border: 1px solid rgba(255, 101, 95, 0.19);
  border-radius: 0.8rem;
  color: #d6a3a0;
  background: rgba(255, 101, 95, 0.045);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 600;
  transition: 180ms ease;
}

.reset-button:hover {
  border-color: rgba(255, 101, 95, 0.4);
  color: #ffc5c2;
  background: rgba(255, 101, 95, 0.09);
  transform: translateY(-1px);
}

.reset-button svg {
  width: 1.05rem;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  padding-top: 1rem;
  color: #62736d;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.footer__divider {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #62736d;
}

.reset-dialog {
  width: min(calc(100% - 2rem), 29rem);
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1.25rem;
  color: var(--text);
  background: #10201c;
  box-shadow: 0 2rem 6rem rgba(0, 0, 0, 0.55);
}

.reset-dialog::backdrop {
  background: rgba(1, 7, 5, 0.74);
  backdrop-filter: blur(6px);
}

.reset-dialog[open] {
  animation: dialog-in 180ms ease-out;
}

.reset-dialog__content {
  position: relative;
  padding: 2rem;
  text-align: center;
}

.dialog-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: grid;
  width: 2rem;
  height: 2rem;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 0.5rem;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.dialog-close:hover {
  background: rgba(255, 255, 255, 0.06);
}

.dialog-close svg,
.dialog-icon svg {
  width: 1.2rem;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.dialog-icon {
  display: grid;
  width: 3.2rem;
  height: 3.2rem;
  margin: 0 auto 1.2rem;
  place-items: center;
  border-radius: 50%;
  color: #ff9893;
  background: rgba(255, 101, 95, 0.11);
}

.reset-dialog h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
}

.reset-dialog p {
  margin: 0.8rem auto 1.6rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.button {
  padding: 0.8rem 1rem;
  border: 1px solid transparent;
  border-radius: 0.7rem;
  cursor: pointer;
  font-weight: 700;
}

.button--secondary {
  border-color: rgba(255, 255, 255, 0.09);
  color: #bccbc6;
  background: rgba(255, 255, 255, 0.04);
}

.button--danger {
  color: #fff;
  background: #d94f4a;
}

.button:hover {
  filter: brightness(1.12);
}

.toast {
  position: fixed;
  z-index: 10;
  bottom: 1.5rem;
  left: 50%;
  max-width: calc(100% - 2rem);
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  color: #dff8eb;
  background: #17382d;
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.32);
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 1rem);
  transition: 220ms ease;
}

.toast--visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(0.6rem) scale(0.98);
  }
}

@media (max-width: 600px) {
  .app-shell {
    padding: 1rem;
  }

  .brand {
    font-size: 0.85rem;
  }

  .connection {
    padding: 0.5rem;
  }

  .connection #connectionText {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .counter-card {
    margin: 2.5rem auto;
  }

  .timer {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1fr;
    gap: 0.5rem;
    width: min(100%, 24rem);
  }

  .time-unit {
    min-width: 0;
  }

  .time-unit--featured {
    grid-column: 1 / -1;
    margin-bottom: 1.25rem;
  }

  .time-unit--featured + .timer__separator {
    display: none;
  }

  .time-unit__value {
    font-size: clamp(3rem, 16vw, 4.5rem);
  }

  .time-unit--featured .time-unit__value {
    font-size: clamp(5.4rem, 29vw, 7.5rem);
  }

  .timer__separator {
    margin-top: 0;
    font-size: clamp(2.4rem, 13vw, 3.5rem);
  }

  .time-unit__label {
    letter-spacing: 0.1em;
  }

  footer {
    font-size: 0.58rem;
  }
}

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