:root {
  --ink: #0B0916;
  --paper: #FFF6EC;
  --peach: #FFB067;
  --peach-deep: #F4874A;
  --pink: #FF8FB1;
  --mint: #7FE3D4;
  --violet: #B79BFF;
  --dim: rgba(255, 246, 236, 0.55);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #0B0916;
  color: var(--paper);
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Inter, system-ui, sans-serif;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#game { position: fixed; inset: 0; display: block; }

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

.hud-left { position: absolute; top: max(14px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left)); }
.scorebox { line-height: 1; }
.score {
  font-size: clamp(38px, 9vw, 60px);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #fff;
  text-shadow: 0 4px 24px rgba(255, 140, 190, 0.28);
  font-variant-numeric: tabular-nums;
}
.bestline {
  margin-top: 4px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 600;
}
.lives { margin-top: 10px; display: flex; gap: 3px; flex-wrap: wrap; max-width: 150px; }
.paw { font-size: 13px; opacity: 1; filter: drop-shadow(0 0 6px rgba(255,150,190,0.5)); }
.paw.off { opacity: 0.13; filter: none; }

.hud-right { position: absolute; top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right)); width: 172px; }
.boardwrap {
  background: rgba(14, 10, 26, 0.66);
  border: 1px solid rgba(183, 155, 255, 0.16);
  border-radius: 14px;
  padding: 9px 10px 8px;
  backdrop-filter: blur(10px);
}
.boardtitle {
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(183, 155, 255, 0.7);
  margin-bottom: 6px;
  font-weight: 700;
}
#board { list-style: none; margin: 0; padding: 0; }
#board li {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  padding: 2px 0;
  color: rgba(255, 246, 236, 0.72);
}
#board li b { width: 10px; color: rgba(183,155,255,0.55); font-weight: 700; font-size: 10px; }
#board .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#board .sc { font-variant-numeric: tabular-nums; color: rgba(255,246,236,0.55); }
#board li.me { color: #fff; font-weight: 700; }
#board li.me .sc { color: var(--peach); }

#killfeed { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.feed-item {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(14, 10, 26, 0.75);
  border: 1px solid rgba(255,255,255,0.07);
  color: rgba(255,246,236,0.66);
  animation: popin 0.22s ease-out;
}
.feed-item.mine { color: var(--ink); background: var(--peach); border-color: transparent; font-weight: 800; }
.feed-item.die { color: rgba(255,143,177,0.9); }
@keyframes popin { from { transform: translateX(8px); opacity: 0; } }

.mute {
  position: absolute;
  bottom: max(26px, env(safe-area-inset-bottom));
  left: max(18px, env(safe-area-inset-left));
  width: 34px; height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(14,10,26,0.66);
  color: var(--paper);
  font-size: 14px;
  cursor: pointer;
  pointer-events: auto;
}

.pounce {
  position: absolute;
  bottom: max(52px, calc(env(safe-area-inset-bottom) + 40px));
  right: max(24px, env(safe-area-inset-right));
  width: 92px; height: 92px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.14);
  background: radial-gradient(circle at 35% 30%, rgba(255,183,120,0.28), rgba(20,14,34,0.9));
  color: rgba(255,246,236,0.6);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  cursor: pointer;
  pointer-events: auto;
  display: grid;
  place-items: center;
  transition: transform 0.08s, border-color 0.2s, color 0.2s;
}
.pounce:active { transform: scale(0.94); }
.pounce.ready { border-color: var(--peach); color: #fff; box-shadow: 0 0 30px rgba(255,176,103,0.28); }
.pring {
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: conic-gradient(var(--peach) calc(var(--p, 1) * 360deg), rgba(255,255,255,0.06) 0);
  mask: radial-gradient(circle, transparent 68%, #000 70%);
  -webkit-mask: radial-gradient(circle, transparent 68%, #000 70%);
  opacity: 0.85;
}
.plabel { position: relative; }

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: radial-gradient(circle at 50% 40%, rgba(40,26,70,0.72), rgba(8,6,16,0.94));
  backdrop-filter: blur(8px);
  z-index: 10;
}
.overlay.hidden { display: none; }

.card {
  width: min(420px, 100%);
  background: linear-gradient(170deg, rgba(30,22,50,0.96), rgba(16,12,28,0.98));
  border: 1px solid rgba(183,155,255,0.18);
  border-radius: 22px;
  padding: 26px 24px 22px;
  box-shadow: 0 30px 90px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.06);
  text-align: center;
}

.logo { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--peach); }
.logo svg { width: 42px; height: 26px; }
.logo h1 {
  margin: 0;
  font-size: clamp(30px, 8vw, 40px);
  letter-spacing: -0.035em;
  color: #fff;
  font-weight: 800;
}
.tag { margin: 8px 0 18px; color: rgba(255,246,236,0.62); font-size: 14px; }

.how { list-style: none; padding: 0; margin: 0 0 20px; text-align: left; }
.how li {
  font-size: 13.5px;
  line-height: 1.45;
  color: rgba(255,246,236,0.78);
  padding: 7px 0 7px 22px;
  position: relative;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.how li:last-child { border-bottom: 0; }
.how li::before { content: "🐾"; position: absolute; left: 0; top: 6px; font-size: 12px; opacity: 0.8; }
.how b { color: #fff; }

.cta {
  width: 100%;
  padding: 15px 20px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--peach), var(--peach-deep));
  color: #2A1508;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(244,135,74,0.32);
  transition: transform 0.08s, box-shadow 0.2s;
}
.cta:active { transform: translateY(1px) scale(0.99); box-shadow: 0 5px 16px rgba(244,135,74,0.28); }
.fine { margin: 12px 0 0; font-size: 11px; color: rgba(255,246,236,0.38); line-height: 1.5; }

.card h2 { margin: 0 0 6px; font-size: 15px; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(255,143,177,0.9); font-weight: 700; }
.finalscore { font-size: clamp(52px, 15vw, 76px); font-weight: 800; letter-spacing: -0.05em; line-height: 1; color: #fff; font-variant-numeric: tabular-nums; }
.finalline { margin-top: 8px; font-size: 13px; color: rgba(255,246,236,0.6); }
.finalbest { margin: 14px 0 20px; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); font-weight: 700; }
.finalbest span { color: var(--peach); }

@media (max-width: 420px) {
  .hud-right { width: 138px; }
  #board li { font-size: 10.5px; }
  .pounce { width: 78px; height: 78px; font-size: 9px; }
}
@media (max-height: 520px) {
  .how { display: none; }
  .card { padding: 18px; }
}
