:root {
  --bg: #0b0f1a;
  --panel: #131a2b;
  --accent: #5ec2ff;
  --accent-2: #ffcf5e;
  --text: #e8edf7;
  --text-dim: #8b96ad;
  --danger: #ff6a6a;
}

* { box-sizing: border-box; }

/* Several elements below (.screen, .overlay) set `display` unconditionally
   at the same specificity as the browser's default `[hidden]` rule, and
   being an author stylesheet loaded after the UA one, they'd otherwise win
   -- silently defeating `hidden` and showing every screen/overlay stacked
   at once. This keeps `hidden` authoritative regardless of what else
   targets the element. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
  touch-action: none;
}

.screen {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  text-align: center;
}

h1 { font-size: 2rem; margin: 0 0 8px; }
h2 { margin: 0 0 8px; }

.tagline {
  color: var(--text-dim);
  max-width: 320px;
  margin: 0 0 28px;
  line-height: 1.4;
}

.btn {
  appearance: none;
  border: 1px solid #2a3550;
  background: var(--panel);
  color: var(--text);
  font-size: 1rem;
  padding: 14px 22px;
  border-radius: 12px;
  cursor: pointer;
  touch-action: manipulation;
  text-decoration: none;
  display: inline-block;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(180deg, var(--accent), #3a9bdb);
  color: #06121f;
  border: none;
  font-weight: 600;
}

.or {
  color: var(--text-dim);
  margin: 22px 0 14px;
  font-size: 0.9rem;
}

#form-join {
  display: flex;
  gap: 10px;
}

#input-code {
  width: 130px;
  font-size: 1.3rem;
  letter-spacing: 0.2em;
  text-align: center;
  text-transform: uppercase;
  background: var(--panel);
  border: 1px solid #2a3550;
  border-radius: 12px;
  color: var(--text);
  padding: 12px;
}

.error {
  color: var(--danger);
  margin-top: 16px;
}

.room-code {
  font-size: 3.2rem;
  letter-spacing: 0.25em;
  font-weight: 700;
  color: var(--accent);
  margin: 10px 0 24px;
}

.lobby-status {
  color: var(--text-dim);
  margin-top: 20px;
}

.copied {
  color: var(--accent);
  margin-top: 10px;
}

#screen-game {
  position: fixed;
  inset: 0;
  padding: 0;
  justify-content: flex-start;
}

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--text-dim);
  z-index: 5;
  pointer-events: none;
}

#hud-role { font-weight: 700; color: var(--accent-2); }

#canvas-wrap {
  position: absolute;
  inset: 0;
}

#scene { width: 100%; height: 100%; display: block; }

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(11, 15, 26, 0.72);
  z-index: 10;
  text-align: center;
  padding: 20px;
}

#countdown-num {
  font-size: 6rem;
  font-weight: 800;
  color: var(--accent);
}

.small { color: var(--text-dim); font-size: 0.9rem; }

.motion-btn {
  position: absolute;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
}

.drag-control {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 28px;
  height: 56px;
  border-radius: 28px;
  background: var(--panel);
  border: 1px solid #2a3550;
  z-index: 5;
  overflow: hidden;
}

#drag-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  background: var(--accent);
  border-radius: 2px;
  transition: none;
}

.control-hint {
  position: absolute;
  bottom: 92px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-dim);
  z-index: 5;
  pointer-events: none;
}

#replay-status {
  bottom: auto;
  top: 50%;
  transform: translateY(-50%);
}

.replay-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 28px;
  z-index: 5;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0 16px;
}
