:root {
  --bg: #0f0f0f;
  --panel: #181818;
  --text: #f1f1f1;
  --muted: #aaaaaa;
  --accent: #ff0033;
  --ok: #2ecc71;
  --digit-h: 1em;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  height: 100%;
}
body {
  background: radial-gradient(ellipse at top, #1c1c1c 0%, var(--bg) 60%);
  color: var(--text);
  font-family: 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: none;
  user-select: none;
}
header {
  display: flex;
  align-items: center;
  gap: 1.2vw;
  margin-bottom: 3vh;
}
.logo {
  width: 7vw;
  height: 7vw;
  border-radius: 50%;
  background: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 2.4vw;
  letter-spacing: 0.05em;
  box-shadow: 0 0 4vw rgba(255, 0, 51, 0.35);
}
.title h1 {
  font-size: 3.4vw;
  font-weight: 700;
}
.title p {
  font-size: 1.5vw;
  color: var(--muted);
  margin-top: 0.4vh;
}

.counter {
  font-size: 15vw;
  font-weight: 800;
  line-height: 1;
  display: flex;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0.03em 0.08em rgba(0, 0, 0, 0.6);
}
.digit {
  height: var(--digit-h);
  overflow: hidden;
  width: 0.62em;
  text-align: center;
}
.digit .strip {
  display: flex;
  flex-direction: column;
  transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.digit .strip span {
  height: var(--digit-h);
}
.sep {
  width: 0.28em;
  text-align: center;
  color: #cfcfcf;
}

.label {
  margin-top: 2vh;
  font-size: 2.2vw;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 1vw;
}
.live {
  display: inline-flex;
  align-items: center;
  gap: 0.5vw;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.15em;
}
.live::before {
  content: '';
  width: 1vw;
  height: 1vw;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.6s infinite;
}
.live.stale {
  color: #f5a623;
}
.live.stale::before {
  background: #f5a623;
  animation: none;
}
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 0, 51, 0.7);
  }
  70% {
    box-shadow: 0 0 0 1.2vw rgba(255, 0, 51, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 0, 51, 0);
  }
}

.stats {
  display: flex;
  gap: 2vw;
  margin-top: 6vh;
}
.stat {
  background: var(--panel);
  border-radius: 1vw;
  padding: 1.6vh 2.4vw;
  min-width: 16vw;
  text-align: center;
}
.stat .v {
  font-size: 2.8vw;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.stat .k {
  font-size: 1.1vw;
  color: var(--muted);
  margin-top: 0.4vh;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

footer {
  position: fixed;
  bottom: 2vh;
  font-size: 1vw;
  color: #666;
  text-align: center;
}
.credit {
  margin-bottom: 0.6vh;
  font-size: 1.3vw;
  color: #999;
}
.heart {
  display: inline-block;
  color: var(--accent);
  animation: heartbeat 1.2s ease-in-out infinite;
}
@keyframes heartbeat {
  0%, 40%, 100% { transform: scale(1); }
  10%, 30% { transform: scale(1.3); }
  20% { transform: scale(1.1); }
}
@media (prefers-reduced-motion: reduce) {
  .heart { animation: none; }
}

.milestone {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  font-size: 6vw;
  font-weight: 900;
  color: var(--accent);
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.6s, transform 0.6s;
  text-shadow: 0 0 3vw rgba(255, 0, 51, 0.6);
}
.milestone.show {
  opacity: 1;
  transform: scale(1);
}

.notice {
  position: fixed;
  top: 3vh;
  left: 50%;
  transform: translateX(-50%);
  background: #2a1a00;
  color: #f5a623;
  border: 1px solid #f5a623;
  border-radius: 0.8vw;
  padding: 1.2vh 2vw;
  font-size: 1.4vw;
  max-width: 80vw;
  text-align: center;
}

.pairing {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2vh;
  background: rgba(10, 10, 10, 0.94);
  text-align: center;
}
.pairing[hidden] {
  display: none;
}
.pairing h2 {
  margin: 0;
  font-size: 4vw;
}
.pairing p {
  margin: 0;
  font-size: 1.8vw;
  color: #aaa;
}
.pairing input {
  width: 22vw;
  padding: 1.5vh 1vw;
  font: 700 3.5vw ui-monospace, Menlo, monospace;
  letter-spacing: 0.3vw;
  text-align: center;
  text-transform: uppercase;
  color: #fff;
  background: #1c1c1c;
  border: 2px solid #444;
  border-radius: 0.8vw;
}
.pairing input:focus,
.pairing button:focus {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.pairing button {
  padding: 1.2vh 3vw;
  font-size: 2vw;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 0.8vw;
  cursor: pointer;
}
.pairing .error {
  min-height: 1.2em;
  color: #f5a623;
}
