* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; font-family: 'Fredoka', sans-serif; color: #1a1a2e; }
#app { position: fixed; inset: 0; background: #87ceeb; }
#app canvas { display: block; width: 100%; height: 100%; }

.overlay {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; gap: 24px;
  background: radial-gradient(circle at 50% 0%, #ffe066 0%, #ff8c42 45%, #ff3c6b 100%);
  flex-wrap: wrap; overflow-y: auto; padding: 24px;
}
.card {
  background: #fffdf5; border: 6px solid #1a1a2e; border-radius: 28px; padding: 28px 32px;
  box-shadow: 10px 10px 0 rgba(0,0,0,0.25); max-width: 480px; width: 92vw;
}
.card.small { text-align: center; max-width: 360px; }
.card.highscores { max-width: 340px; }

.banner-wrap { text-align: center; margin-bottom: 4px; }
.banner-img { max-width: 100%; height: auto; max-height: 140px; }
.banner-fallback {
  font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 64px; margin: 0;
  color: #ffdd33; -webkit-text-stroke: 4px #1a1a2e; text-stroke: 4px #1a1a2e;
  text-shadow: 6px 6px 0 #ff3c6b, 10px 10px 0 rgba(0,0,0,0.25);
  transform: rotate(-2deg) scaleY(1.08); letter-spacing: 2px;
}
.sub { text-align: center; font-size: 15px; margin: 6px 0 18px; line-height: 1.4; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; font-weight: 700; font-size: 14px; }
.field input {
  font-family: inherit; font-size: 18px; padding: 10px 14px; border-radius: 14px; border: 4px solid #1a1a2e;
  outline: none; background: #fff;
}
.field input:focus { border-color: #ff3c6b; }

.picker h3 { margin: 0 0 8px; font-size: 15px; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.pick-card {
  border: 3px solid #1a1a2e; border-radius: 14px; padding: 8px 6px; text-align: center; cursor: pointer;
  background: #fff; font-size: 12px; font-weight: 700; user-select: none; transition: transform 0.08s;
}
.pick-card .emoji { font-size: 26px; display: block; }
.pick-card:hover { transform: translateY(-2px); }
.pick-card.selected { background: #ffdd33; box-shadow: 4px 4px 0 #1a1a2e; }

#joinBtn, #lockBtn, #resumeBtn, #leaveBtn {
  width: 100%; font-family: inherit; font-weight: 700; font-size: 20px; padding: 14px; border-radius: 16px;
  border: 5px solid #1a1a2e; background: #4ade80; cursor: pointer; box-shadow: 5px 5px 0 #1a1a2e; margin-top: 10px;
}
#joinBtn:disabled { background: #ccc; cursor: not-allowed; box-shadow: none; }
#joinBtn:not(:disabled):hover, #lockBtn:hover, #resumeBtn:hover, #leaveBtn:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 #1a1a2e; }
.btn-secondary { background: #ffdd33; }
.error { color: #c81e4b; font-weight: 700; font-size: 13px; margin-top: 8px; min-height: 1em; text-align: center; }

.hs-tabs { display: flex; gap: 4px; margin-bottom: 10px; flex-wrap: wrap; }
.hs-tab {
  border: 3px solid #1a1a2e; border-radius: 10px; padding: 4px; cursor: pointer; background: #fff;
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
}
.hs-tab img { width: 26px; height: 26px; }
.hs-tab.active { background: #ffdd33; }
.hs-list { list-style: none; margin: 0; padding: 0; font-weight: 700; font-size: 14px; min-height: 120px; }
.hs-list li { display: flex; justify-content: space-between; padding: 4px 6px; border-bottom: 2px dashed #ccc; }
.hs-list li:first-child { color: #c81e4b; }
.hs-empty { opacity: 0.6; font-weight: 600; text-align: center; padding: 20px 0; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; font-family: 'Fredoka', sans-serif; }
#scoreboard {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 14px;
  background: rgba(255,255,255,0.9); border: 4px solid #1a1a2e; border-radius: 16px; padding: 8px 18px;
  font-weight: 700; font-size: 16px;
}
#scoreboard .teamA { color: #1d4ed8; } #scoreboard .teamB { color: #c81e4b; }
#feed {
  position: absolute; top: 70px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column;
  gap: 4px; align-items: center; font-weight: 700; font-size: 15px; text-shadow: 2px 2px 0 #fff;
}
#boltbar {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); width: 160px; height: 14px;
  background: rgba(0,0,0,0.3); border: 3px solid #1a1a2e; border-radius: 8px; overflow: hidden;
}
#boltfill { height: 100%; width: 100%; background: #4ade80; transition: width 0.05s linear; }
#ch-dot { width: 10px; height: 10px; border: 2px solid #1a1a2e; border-radius: 50%; background: rgba(255,255,255,0.35); }
#hint {
  position: absolute; bottom: 48px; left: 50%; transform: translateX(-50%); font-size: 12px; font-weight: 700;
  background: rgba(255,255,255,0.8); padding: 4px 10px; border-radius: 10px;
}

/* The scope lens tracks the reticle's screen position (set via JS left/top each frame) — you move the
   sight, the view underneath stays put. See player.js LocalRig + main.js render loop. */
#scopeOverlay {
  position: absolute; width: 60vmin; height: 60vmin; border-radius: 50%; overflow: hidden;
  transform: translate(-50%, -50%);
}
#scopeVignette {
  position: absolute; inset: -20%; background: radial-gradient(circle, transparent 42%, #000 76%); opacity: 0.97;
}
#scopeReticle { position: absolute; top: 50%; left: 50%; width: 100%; height: 100%; transform: translate(-50%,-50%); }
#scopeTag {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -140px); font-weight: 700; font-size: 14px;
  background: rgba(255,255,255,0.9); border: 2px solid #1a1a2e; border-radius: 8px; padding: 2px 8px; display: none;
  white-space: nowrap;
}
#crosshair { position: absolute; transform: translate(-50%, -50%); }

.noscope-banner {
  position: fixed; top: 38%; left: 50%; transform: translate(-50%, -50%) scale(0.4) rotate(-6deg);
  font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 72px; color: #ffdd33;
  -webkit-text-stroke: 4px #1a1a2e; text-shadow: 6px 6px 0 #ff3c6b, 0 0 40px rgba(255,255,255,0.8);
  pointer-events: none; z-index: 50; animation: noscope-pop 1.4s cubic-bezier(.2,1.6,.4,1) forwards;
}
@keyframes noscope-pop {
  0% { transform: translate(-50%, -50%) scale(0.2) rotate(-10deg); opacity: 0; }
  15% { transform: translate(-50%, -50%) scale(1.2) rotate(4deg); opacity: 1; }
  30% { transform: translate(-50%, -50%) scale(1) rotate(-2deg); opacity: 1; }
  80% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
  100% { transform: translate(-50%, -60%) scale(0.9) rotate(0deg); opacity: 0; }
}

#countdown .card { background: #fffdf5; }
#bignum { font-family: 'Baloo 2', sans-serif; font-size: 120px; font-weight: 800; color: #ff3c6b; line-height: 1; }
#winnerLine { font-weight: 700; font-size: 18px; margin-bottom: 8px; min-height: 1.4em; }
