:root {
  --bg: #0b0a10;
  --bg-hi: #1d1a26;
  --text: #f4ecd8;
  --muted: #9a92a8;
  --accent: #ffd02e;
  --live: #58e07b;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: ui-rounded, 'SF Pro Rounded', 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(ellipse 70% 60% at 50% 42%, var(--bg-hi) 0%, transparent 70%),
    radial-gradient(ellipse 120% 90% at 50% 100%, #15121c 0%, var(--bg) 60%);
  transition: background-color 0.4s;
}

/* A faint grain, so the dark background doesn't band. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

main {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
}

#stage {
  width: 100%;
  height: 100%;
  overflow: visible;
  touch-action: none;
  outline: none;
}

.chicken .hit,
.chicken .leg,
.chicken use,
.chicken path,
.chicken circle {
  cursor: grab;
}

body.squeezing .chicken * {
  cursor: grabbing;
}

.hud {
  position: fixed;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left));
  pointer-events: none;
  font-size: 14px;
  letter-spacing: 0.01em;
}

.hud.top {
  top: 0;
  padding-top: max(16px, env(safe-area-inset-top));
}

.hud.bottom {
  bottom: 0;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  justify-content: center;
}

.brand {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--text);
}

.brand span {
  color: var(--accent);
}

.stats {
  display: flex;
  gap: 14px;
  align-items: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

#online::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 10px var(--live);
  vertical-align: 1px;
}

#online.offline::before {
  background: var(--muted);
  box-shadow: none;
}

#screams:empty {
  display: none;
}

#hint {
  margin: 0;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--text);
  text-align: center;
  max-width: calc(100vw - 110px);
  transition: background 0.3s, color 0.3s;
}

body.squeezing #hint {
  background: rgba(255, 208, 46, 0.14);
  border-color: rgba(255, 208, 46, 0.3);
  color: #ffe68a;
}

#hint.pulse {
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.55;
  }
}

#sound {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.2s;
}

#sound:hover {
  background: rgba(255, 255, 255, 0.12);
}

#sound:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  font-size: 20px;
}

@media (max-width: 480px) {
  .hud {
    font-size: 13px;
  }
  .brand {
    font-size: 15px;
  }
  .stats {
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #hint.pulse {
    animation: none;
  }
}
