:root {
  color-scheme: dark;
  --bg: #030303;
  --text: #f6f6f6;
  --muted: #a7a7a7;
  --line: #292929;
  --accent: #f14141;
  --accent-dark: #8f1717;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background:
    radial-gradient(circle at 50% 24%, rgba(241, 65, 65, 0.14), transparent 32rem),
    linear-gradient(180deg, #0a0a0a 0%, var(--bg) 68%);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

button {
  font: inherit;
}

.app {
  width: min(100%, 34rem);
  min-height: 100svh;
  margin: 0 auto;
  padding: 1.5rem 1rem max(1.25rem, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.8rem;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}

h1 {
  margin: 0;
  font-size: clamp(1.45rem, 7vw, 2.45rem);
  line-height: 1.15;
}

.counter-area {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 0.2rem;
}

.count {
  font-size: clamp(5.2rem, 30vw, 10rem);
  font-weight: 900;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 2rem rgba(255, 255, 255, 0.15);
}

.goal {
  color: var(--muted);
  font-size: clamp(1.25rem, 5vw, 1.8rem);
  font-weight: 700;
}

.timer {
  color: #d9d9d9;
  font-size: clamp(1rem, 4.5vw, 1.25rem);
  font-variant-numeric: tabular-nums;
}

.message {
  width: 100%;
  min-height: 4.6rem;
  margin: 0.25rem 0 0.4rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.035);
  color: #fff;
  font-size: clamp(1rem, 4.7vw, 1.35rem);
  font-weight: 800;
  line-height: 1.45;
}

.message.is-special {
  border-color: rgba(241, 65, 65, 0.82);
  background: rgba(241, 65, 65, 0.12);
  box-shadow: 0 0 2.4rem rgba(241, 65, 65, 0.18);
  animation: pulse 420ms ease-out;
}

.press-button {
  width: min(100%, 22rem);
  min-height: 8.8rem;
  border: 2px solid #fff;
  border-radius: 999px;
  background:
    linear-gradient(180deg, #f8f8f8 0%, #d8d8d8 100%);
  color: #050505;
  font-size: clamp(2.4rem, 13vw, 4.6rem);
  font-weight: 900;
  cursor: pointer;
  box-shadow:
    0 1rem 0 var(--accent-dark),
    0 1.35rem 2.8rem rgba(0, 0, 0, 0.5),
    0 0 3.5rem rgba(241, 65, 65, 0.18);
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 70ms ease, box-shadow 70ms ease, filter 160ms ease;
}

.press-button:active {
  transform: translateY(0.55rem);
  box-shadow:
    0 0.45rem 0 var(--accent-dark),
    0 0.8rem 1.8rem rgba(0, 0, 0, 0.5),
    0 0 2.5rem rgba(241, 65, 65, 0.2);
}

.press-button:focus-visible,
.ending-actions button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 5px;
}

.press-button:disabled {
  cursor: not-allowed;
  filter: grayscale(1) brightness(0.62);
  transform: translateY(0.55rem);
  box-shadow:
    0 0.45rem 0 #333,
    0 0.8rem 1.8rem rgba(0, 0, 0, 0.5);
}

.blackout {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 110ms linear;
}

.blackout.is-active {
  opacity: 1;
}

.ending {
  position: fixed;
  inset: 0;
  z-index: 20;
  padding: 1rem;
  display: none;
  align-items: center;
  justify-content: center;
  background: #000;
}

.ending.is-visible {
  display: flex;
}

.ending-panel {
  width: min(100%, 34rem);
  padding: 1.5rem 1rem;
  border: 1px solid #333;
  border-radius: 8px;
  background: #080808;
  text-align: center;
  box-shadow: 0 0 4rem rgba(241, 65, 65, 0.12);
}

.ending-kicker {
  margin: 0 0 0.55rem;
  color: var(--accent);
  font-weight: 800;
}

.ending h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.85rem, 8vw, 3rem);
}

.ending p {
  margin: 0.75rem 0;
  color: #ededed;
  font-size: clamp(1rem, 4.6vw, 1.25rem);
  line-height: 1.55;
}

.ending .lost-time {
  color: #fff;
  font-size: clamp(1.22rem, 5.7vw, 1.65rem);
  font-weight: 900;
}

.ending-actions {
  margin-top: 1.25rem;
  display: grid;
  gap: 0.75rem;
}

.ending-actions button {
  width: 100%;
  min-height: 3.25rem;
  border: 1px solid #fff;
  border-radius: 8px;
  background: #f4f4f4;
  color: #060606;
  font-weight: 900;
  cursor: pointer;
}

.ending-actions button:first-child {
  background: #121212;
  color: #fff;
}

.copy-status {
  min-height: 1.5rem;
  color: var(--muted);
}

@keyframes pulse {
  0% {
    transform: scale(0.98);
  }
  60% {
    transform: scale(1.02);
  }
  100% {
    transform: scale(1);
  }
}

@media (min-width: 520px) {
  .ending-actions {
    grid-template-columns: 1fr 1fr;
  }
}

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