:root {
  color-scheme: dark;
  font-family: Inter, ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  background: #101522;
  color: #f7f8fc;
  --accent: #ff5c7a;
  --cyan: #58d6ff;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { min-height: 100%; margin: 0; overscroll-behavior: none; }
body {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 80% 10%, rgba(88, 214, 255, .17), transparent 30%),
    radial-gradient(circle at 10% 90%, rgba(255, 92, 122, .2), transparent 35%),
    #101522;
}
main { width: min(100%, 480px); min-height: 100dvh; margin: auto; padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom)); }
.card { padding-top: 7vh; }
.eyebrow { color: var(--cyan); font-weight: 900; letter-spacing: .18em; font-size: .72rem; }
h1 { margin: 12px 0 18px; font-size: clamp(3.5rem, 18vw, 5.8rem); line-height: .8; letter-spacing: -.08em; }
h1 span { color: var(--accent); }
.lede { max-width: 26ch; color: #aab3c5; font-size: 1.06rem; line-height: 1.5; margin-bottom: 36px; }
label { display: block; margin: 18px 0 8px; color: #c9cfdb; font-size: .82rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
input {
  width: 100%; border: 1px solid #303a50; background: #171e2e; color: white; border-radius: 14px;
  padding: 16px; font: inherit; font-size: 1.15rem; outline: none;
}
input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(88, 214, 255, .15); }
button {
  appearance: none; border: 1px solid #354059; border-radius: 14px; padding: 15px 18px; background: #1d2638;
  color: white; font: inherit; font-weight: 900; letter-spacing: .04em; touch-action: manipulation;
}
button:active { transform: translateY(2px) scale(.99); }
button.primary { border: 0; background: var(--accent); color: #101522; box-shadow: 0 8px 24px rgba(255, 92, 122, .25); }
.card > .primary { width: 100%; margin-top: 24px; }
.error { color: #ff8ba1; min-height: 1.4em; }
.hidden { display: none !important; }
header { display: flex; align-items: center; justify-content: space-between; color: #aab3c5; font-size: .82rem; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #8cf28a; margin-right: 8px; box-shadow: 0 0 12px #8cf28a; }
#roomBadge { color: white; background: #1d2638; border-radius: 999px; padding: 7px 11px; letter-spacing: .12em; }
.player-card { margin: 32px 0 20px; }
.player-card p { margin: 0; color: #78849a; font-size: .7rem; font-weight: 900; letter-spacing: .16em; }
.player-card h2 { margin: 4px 0; font-size: 2rem; }
.scoreline { display: flex; gap: 10px; margin-top: 10px; }
.scoreline span { padding: 6px 10px; border-radius: 999px; background: #1d2638; color: #aab3c5; font-size: .72rem; font-weight: 900; }
.scoreline b { color: white; }
.game-card { padding: 16px 18px; margin-bottom: 14px; border: 1px solid #303a50; border-radius: 18px; background: rgba(23,30,46,.8); }
.game-card > p:first-child { margin: 0; color: var(--cyan); font-size: .68rem; font-weight: 900; letter-spacing: .15em; }
.game-card h3 { margin: 5px 0 4px; font-size: 1.35rem; }
.game-card #gameInstruction { margin: 0; color: #aab3c5; line-height: 1.35; }
.motion-panel {
  position: relative; height: min(40vh, 330px); overflow: hidden; border: 1px solid #303a50; border-radius: 30px;
  background: radial-gradient(circle, #232e43, #151c2b 65%); touch-action: none;
}
.crosshair { position: absolute; background: rgba(255,255,255,.08); pointer-events: none; }
.crosshair.horizontal { height: 1px; left: 0; right: 0; top: 50%; }
.crosshair.vertical { width: 1px; top: 0; bottom: 0; left: 50%; }
.bubble {
  position: absolute; width: 74px; height: 74px; left: calc(50% - 37px); top: calc(50% - 37px); border-radius: 50%;
  background: var(--accent); box-shadow: 0 10px 40px color-mix(in srgb, var(--accent), transparent 55%); will-change: transform;
}
#motionHint { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: #8e99ad; font-size: .82rem; }
.motion-readout { position: absolute; left: 18px; right: 18px; top: 16px; display: grid; gap: 7px; }
.motion-readout div { display: grid; grid-template-columns: 58px 1fr; align-items: center; gap: 8px; }
.motion-readout span { color: #78849a; font-size: .62rem; font-weight: 900; letter-spacing: .1em; }
.motion-readout div::after { content: ""; grid-column: 2; grid-row: 1; height: 5px; border-radius: 9px; background: #303a50; }
.motion-readout i { position: relative; z-index: 1; grid-column: 2; grid-row: 1; display: block; width: 0%; height: 5px; border-radius: 9px; background: var(--accent); transition: width .08s linear; }
.actions { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 14px; }
.actions button { min-height: 58px; }
.leader-controls { margin-top: 14px; padding: 14px; border: 1px solid color-mix(in srgb, var(--accent), transparent 55%); border-radius: 18px; background: color-mix(in srgb, var(--accent), transparent 90%); }
.leader-controls p { margin: 0 0 9px; color: var(--accent); font-size: .65rem; font-weight: 900; letter-spacing: .15em; }
.leader-controls button { width: 100%; min-height: 58px; }
.motion-only { margin: 14px 8px 0; color: #78849a; text-align: center; font-size: .78rem; }
