/* Stream client styling: full-screen video, a calm kid-friendly overlay, a tiny HUD, and a small
   mode switch. Kept small and GPU-cheap so it never competes with video decode on a weak phone. */
:root {
  --sea-deep: #0b2233;
  --sea: #123a52;
  --foam: #eaf6ff;
  --sun: #ffd27a;
  --coral: #ff8a65;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; width: 100%;
  background: var(--sea-deep);
  color: var(--foam);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#stage {
  position: fixed; inset: 0;
  touch-action: none; /* we forward raw touch to the game */
  background: radial-gradient(120% 90% at 50% 10%, var(--sea) 0%, var(--sea-deep) 70%);
}
#stream {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain; /* letterbox; app.js maps input to the content box */
  background: var(--sea-deep);
  display: block;
}

/* Overlay card for connection states. */
#overlay {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 24px;
  background: rgba(7, 20, 30, 0.72);
  backdrop-filter: blur(2px);
}
#overlay[hidden] { display: none; }
#overlay-card {
  max-width: 320px; text-align: center;
  background: rgba(18, 58, 82, 0.85);
  border: 1px solid rgba(234, 246, 255, 0.15);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}
#overlay-title { margin: 8px 0 6px; font-size: 1.4rem; }
#overlay-text { margin: 0 0 4px; font-size: 1rem; line-height: 1.4; opacity: 0.9; }
#overlay-btn {
  margin-top: 18px; padding: 12px 22px;
  font-size: 1.05rem; font-weight: 600;
  color: var(--sea-deep); background: var(--sun);
  border: none; border-radius: 999px; cursor: pointer;
  min-height: 48px; min-width: 120px;
}
#overlay-btn[hidden] { display: none; }
#overlay-btn:active { transform: scale(0.97); }

/* Tiny spinner while the device benchmark runs. */
.spinner {
  width: 40px; height: 40px; margin: 0 auto 10px;
  border: 4px solid rgba(234, 246, 255, 0.25);
  border-top-color: var(--sun);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
.spinner[hidden] { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* HUD: unobtrusive stats, only visible while playing. */
#hud {
  position: absolute; top: calc(8px + env(safe-area-inset-top)); right: 10px;
  font-size: 11px; font-variant-numeric: tabular-nums;
  color: rgba(234, 246, 255, 0.55);
  pointer-events: none;
}
body:not([data-state="playing"]) #hud { display: none; }

/* The small always-present switch. */
#switch {
  position: absolute; left: 0; right: 0; bottom: calc(6px + env(safe-area-inset-bottom));
  display: flex; gap: 16px; justify-content: center;
  font-size: 12px;
}
#switch a {
  color: rgba(234, 246, 255, 0.75);
  text-decoration: none;
  padding: 8px 12px; border-radius: 999px;
  background: rgba(7, 20, 30, 0.45);
  min-height: 36px; display: inline-flex; align-items: center;
}
#switch a:active { background: rgba(7, 20, 30, 0.7); }
/* Hide the switch while actively playing so it doesn't cover the game; a tap on the HUD-free edges
   still reveals it on state change. */
body[data-state="playing"] #switch { opacity: 0.35; }

@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }
