/* Тема по умолчанию — тёмная (для обычного браузера).
   В Telegram значения переменных переопределяются из themeParams (см. конец app.js). */
:root {
  --bg: #0b1220;
  --bg-2: #16213a;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #2ea6ff;
  --accent-text: #ffffff;
  --ok: #34d399;
  --err: #f87171;
  --busy: #fbbf24;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(130% 130% at 50% 0%, var(--bg-2) 0%, var(--bg) 62%) fixed;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}

main {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100vh;      /* фолбэк для старых браузеров */
  height: 100dvh;     /* корректная высота в мобильных вьюпортах */
  padding: calc(14px + env(safe-area-inset-top)) 18px calc(14px + env(safe-area-inset-bottom));
}

header { display: flex; justify-content: center; }

.chip {
  font-size: 13px;
  color: var(--muted);
  background: color-mix(in srgb, var(--text) 8%, transparent);
  border-radius: 999px;
  padding: 6px 14px;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(28px, 6vh, 56px);
}

.counter { text-align: center; }

#count {
  display: block;
  font-size: clamp(56px, 18vw, 108px);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

#count-label {
  display: block;
  margin-top: 6px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

#tap {
  width: min(66vw, 280px);
  aspect-ratio: 1 / 1;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font: inherit;
  font-size: clamp(30px, 9vw, 44px);
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--accent-text);
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 65%, #000 35%));
  box-shadow:
    0 14px 38px color-mix(in srgb, var(--accent) 42%, transparent),
    inset 0 2px 0 rgba(255, 255, 255, 0.28),
    inset 0 -6px 14px color-mix(in srgb, #000 25%, transparent);
  transition: transform 90ms ease;
  touch-action: manipulation; /* без задержки и зума по двойному тапу */
}

#tap:active { transform: scale(0.93); }

#tap:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 60%, #fff);
  outline-offset: 4px;
}

footer { display: flex; justify-content: center; min-height: 20px; }

.status { font-size: 13px; color: var(--muted); transition: color 0.2s ease; }
.status.ok   { color: var(--ok); }
.status.busy { color: var(--busy); }
.status.err  { color: var(--err); }

/* Всплывающий «+1» в точке клика */
.plus-one {
  position: fixed;
  z-index: 5;
  pointer-events: none;
  font-size: 24px;
  font-weight: 800;
  color: var(--accent);
  animation: fly-up 700ms ease-out forwards;
}

@keyframes fly-up {
  from { opacity: 1; transform: translate(-50%, -120%) scale(0.9); }
  to   { opacity: 0; transform: translate(-50%, calc(-120% - 72px)) scale(1.3); }
}

@media (prefers-reduced-motion: reduce) {
  .plus-one { display: none; }
  #tap { transition: none; }
}
