:root {
  --bg: #050505;
  --bg-soft: #0b0b0f;
  --card: rgba(255, 255, 255, 0.065);
  --card-strong: rgba(255, 255, 255, 0.095);
  --border: rgba(255, 255, 255, 0.13);
  --text: #f7f7f2;
  --muted: rgba(247, 247, 242, 0.68);
  --quiet: rgba(247, 247, 242, 0.46);
  --green: #60ee91;
  --yellow: #eafb4f;
  --pink: #ff5cc8;
  --violet: #9c6dff;
  --radius: 24px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  overflow-x: hidden;
}

body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% 18%, rgba(96, 238, 145, 0.15), transparent 31rem),
    radial-gradient(circle at 24% 78%, rgba(234, 251, 79, 0.11), transparent 24rem),
    linear-gradient(180deg, #09090c 0%, #050505 48%, #08080b 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.ambient {
  position: fixed;
  z-index: 0;
  pointer-events: none;
  filter: blur(18px);
  opacity: 0.55;
}

.ambient-a {
  width: 18rem;
  height: 18rem;
  left: calc(50% - 13rem);
  top: 4rem;
  background: radial-gradient(circle, rgba(96, 238, 145, 0.25), transparent 68%);
}

.ambient-b {
  width: 20rem;
  height: 20rem;
  right: calc(50% - 15rem);
  bottom: 2rem;
  background: radial-gradient(circle, rgba(255, 92, 200, 0.18), transparent 68%);
}

.phone-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 460px);
  min-height: 100svh;
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) clamp(14px, 4.5vw, 24px) calc(92px + env(safe-area-inset-bottom));
}

@media (min-width: 720px) {
  body {
    padding: 24px 0;
  }

  .phone-shell {
    min-height: calc(100svh - 48px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 38px;
    box-shadow: 0 35px 100px rgba(0, 0, 0, 0.54), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01));
  }
}

.glass {
  border: 1px solid var(--border);
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.095), rgba(255, 255, 255, 0.042));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px) saturate(150%);
}

.topbar,
.section-head,
.modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar {
  margin-bottom: 26px;
}

.status-stack {
  display: grid;
  gap: 8px;
}

.nonsense-pill,
.live-chip {
  width: fit-content;
  border: 1px solid rgba(96, 238, 145, 0.28);
  border-radius: 999px;
  padding: 8px 11px;
  background: rgba(96, 238, 145, 0.105);
  color: #dfffe8;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
}

.online {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(96, 238, 145, 0.5);
  animation: pulseDot 1.8s infinite;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease;
}

.icon-button:active {
  transform: scale(0.94);
}

.hero {
  margin-bottom: 18px;
}

.kicker {
  margin: 0 0 10px;
  color: var(--yellow);
  font-size: clamp(0.76rem, 3vw, 0.86rem);
  font-weight: 800;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 11ch;
  margin: 0;
  font-size: clamp(2.45rem, 14vw, 4.35rem);
  line-height: 0.88;
  font-weight: 900;
}

.subtitle {
  max-width: 31ch;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 4vw, 1.08rem);
  font-weight: 650;
  line-height: 1.42;
}

.counter-panel {
  position: relative;
  margin: 18px 0 20px;
  padding: 18px 16px 20px;
  border-radius: var(--radius);
  text-align: center;
  overflow: hidden;
}

.counter-panel::after {
  content: "";
  position: absolute;
  inset: auto 26px -42px;
  height: 78px;
  border-radius: 50%;
  background: rgba(96, 238, 145, 0.19);
  filter: blur(22px);
}

.counter-label,
.counter-subtitle,
.mini-card span,
.wide-card span,
.rank-card span,
.stats-list span {
  display: block;
  color: var(--quiet);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.counter-number {
  position: relative;
  z-index: 1;
  margin-top: 4px;
  font-size: clamp(2.25rem, 13vw, 4.1rem);
  line-height: 1;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 26px rgba(96, 238, 145, 0.18);
  transition: transform 220ms cubic-bezier(0.2, 1.5, 0.25, 1), color 220ms ease;
}

.counter-number.bump {
  color: #f5ffd8;
  transform: translateY(-3px) scale(1.035);
}

.counter-subtitle {
  position: relative;
  z-index: 1;
  margin-top: 8px;
  text-transform: none;
  color: var(--muted);
}

.tap-zone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 212px;
  margin: 8px 0 22px;
}

.tap-glow {
  position: absolute;
  width: min(78vw, 310px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(96, 238, 145, 0.28), rgba(234, 251, 79, 0.09) 43%, transparent 67%);
  filter: blur(10px);
  transform: scale(0.96);
  transition: transform 260ms ease, opacity 260ms ease;
  opacity: 0.8;
}

.tap-glow.flash {
  opacity: 1;
  transform: scale(1.08);
}

.tap-button {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: clamp(156px, 52vw, 210px);
  height: clamp(156px, 52vw, 210px);
  border: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 22%, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.16) 18%, transparent 27%),
    linear-gradient(145deg, #eafb4f 0%, #60ee91 46%, #1abf61 100%);
  box-shadow:
    0 24px 70px rgba(96, 238, 145, 0.27),
    0 12px 0 #109147,
    inset 0 1px 1px rgba(255, 255, 255, 0.74),
    inset 0 -18px 32px rgba(0, 0, 0, 0.24);
  color: #071208;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 110ms ease, box-shadow 110ms ease;
}

.tap-button span {
  font-size: clamp(2.1rem, 13vw, 3.8rem);
  font-weight: 900;
}

.tap-button:active,
.tap-button.pressed {
  transform: translateY(8px) scale(0.965);
  box-shadow:
    0 12px 42px rgba(96, 238, 145, 0.22),
    0 4px 0 #109147,
    inset 0 1px 1px rgba(255, 255, 255, 0.68),
    inset 0 -12px 26px rgba(0, 0, 0, 0.28);
}

.ripple,
.particle {
  position: absolute;
  pointer-events: none;
}

.ripple {
  z-index: -1;
  inset: 4px;
  border: 2px solid rgba(255, 255, 255, 0.52);
  border-radius: 50%;
  animation: ripple 620ms ease-out forwards;
}

.particle {
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--particle, var(--yellow));
  animation: particle 760ms cubic-bezier(0.18, 0.72, 0.18, 1) forwards;
}

.tap-message {
  min-height: 42px;
  max-width: 29ch;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: clamp(0.92rem, 3.6vw, 1rem);
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
}

.local-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mini-card,
.wide-card,
.rank-card,
.stats-panel,
.activity-card {
  border-radius: 22px;
}

.mini-card,
.wide-card {
  min-width: 0;
  padding: 15px;
}

.wide-card {
  grid-column: 1 / -1;
}

.mini-card strong,
.wide-card strong,
.rank-card strong,
.stats-list strong {
  display: block;
  margin-top: 7px;
  font-size: clamp(1.26rem, 5vw, 1.65rem);
  line-height: 1.05;
  font-weight: 900;
}

.rank-card,
.stats-panel,
.activity-card {
  margin-top: 10px;
  padding: 16px;
}

.rank-card {
  display: grid;
  gap: 14px;
}

.rank-meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.rank-meter span {
  display: block;
  width: 4%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--yellow), var(--pink));
  transition: width 260ms ease;
}

.section-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 900;
}

.sound-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 11px;
  background: rgba(255, 255, 255, 0.065);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  cursor: pointer;
}

.sound-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--quiet);
}

.sound-toggle[aria-pressed="true"] .sound-dot {
  background: var(--green);
  box-shadow: 0 0 12px rgba(96, 238, 145, 0.7);
}

.stats-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.stats-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 42px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 12px;
}

.stats-list div:first-child {
  border-top: 0;
  padding-top: 0;
}

.stats-list strong {
  margin-top: 0;
  text-align: right;
  font-size: 1rem;
}

.activity-feed {
  display: grid;
  gap: 9px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.activity-feed li {
  padding: 12px 13px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.16);
  color: rgba(247, 247, 242, 0.78);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.3;
  animation: slideIn 260ms ease both;
}

.footer {
  padding: 28px 8px 0;
  color: var(--quiet);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

.sticky-mini {
  position: fixed;
  z-index: 4;
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  bottom: calc(12px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(calc(100% - 24px), 420px);
  min-height: 54px;
  margin: 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  padding: 0 15px;
  background: rgba(12, 12, 16, 0.82);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(18px);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
  transform: translateY(92px);
  opacity: 0;
  transition: transform 220ms ease, opacity 220ms ease;
}

.sticky-mini.visible {
  transform: translateY(0);
  opacity: 1;
}

.sticky-mini strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.toast-stack {
  position: fixed;
  z-index: 8;
  left: 50%;
  top: calc(12px + env(safe-area-inset-top));
  display: grid;
  gap: 8px;
  width: min(calc(100% - 28px), 420px);
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(15, 15, 19, 0.86);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 850;
  backdrop-filter: blur(18px);
  animation: toastIn 2.4s ease forwards;
}

.modal-backdrop {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: grid;
  place-items: end center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  position: relative;
  width: min(100%, 420px);
  border-radius: 28px;
  padding: 20px;
  overflow: hidden;
  animation: modalIn 220ms ease both;
}

.modal h2 {
  margin: 4px 0 8px;
  font-size: clamp(1.85rem, 9vw, 2.8rem);
  line-height: 0.96;
  font-weight: 900;
}

.modal p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.45;
}

.modal-kicker {
  color: var(--yellow) !important;
  font-size: 0.76rem;
  font-weight: 900 !important;
  text-transform: uppercase;
}

.modal-actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.primary-action,
.danger-action {
  min-height: 52px;
  border-radius: 16px;
  padding: 0 16px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 150ms ease;
}

.primary-action {
  border: 0;
  background: linear-gradient(135deg, var(--yellow), var(--green));
  color: #061107;
}

.danger-action {
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.065);
  color: #ffd5e8;
}

.primary-action:active,
.danger-action:active {
  transform: scale(0.98);
}

.celebration {
  text-align: center;
}

.celebration .primary-action {
  width: 100%;
  margin-top: 18px;
}

.celebration-burst {
  width: 86px;
  height: 86px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff 0 8%, transparent 9%),
    conic-gradient(from 20deg, var(--green), var(--yellow), var(--pink), var(--violet), var(--green));
  box-shadow: 0 0 46px rgba(255, 92, 200, 0.34);
  animation: spinPop 900ms ease both;
}

@media (max-width: 340px) {
  .phone-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .nonsense-pill {
    font-size: 0.61rem;
    padding-inline: 9px;
  }

  .tap-zone {
    min-height: 194px;
  }

  .mini-card,
  .wide-card,
  .rank-card,
  .stats-panel,
  .activity-card {
    border-radius: 18px;
  }
}

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

@keyframes pulseDot {
  70% {
    box-shadow: 0 0 0 9px rgba(96, 238, 145, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(96, 238, 145, 0);
  }
}

@keyframes ripple {
  to {
    opacity: 0;
    transform: scale(1.55);
  }
}

@keyframes particle {
  to {
    opacity: 0;
    transform: translate(var(--x), var(--y)) rotate(160deg) scale(0.2);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}

@keyframes toastIn {
  0% {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
  }
  12%,
  86% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.98);
  }
}

@keyframes spinPop {
  from {
    transform: rotate(-22deg) scale(0.75);
  }
}
