html, body {
  margin: 0; padding: 0; overflow: hidden; width: 100%; height: 100%;
  background: #05040a;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  touch-action: none;
}
canvas { display: block; cursor: none; }
.hidden { display: none !important; }

.screen, #restartWrap, #disconnectWrap {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; text-align: center; z-index: 10;
  background: radial-gradient(ellipse at center, rgba(20,10,40,0.75) 0%, rgba(5,4,10,0.92) 70%);
}
.screen h1 {
  font-size: clamp(32px, 7vw, 64px);
  margin: 0 0 8px 0;
  background: linear-gradient(90deg, #ff2fd6, #7b2fff, #2fd6ff, #2fff9d, #fff62f, #ff2f2f);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: hue 6s linear infinite;
  letter-spacing: 2px;
}
@keyframes hue { 0% { background-position: 0% 50%; } 100% { background-position: 300% 50%; } }
.screen h2, #restartWrap h2, #disconnectWrap h2 { font-size: clamp(26px, 5vw, 40px); margin: 0 0 10px 0; }
.screen p, #restartWrap p, #disconnectWrap p { opacity: 0.85; max-width: 480px; line-height: 1.5; font-size: 15px; margin: 4px 0; }
.legend { display: flex; gap: 18px; margin: 18px 0; flex-wrap: wrap; justify-content: center; max-width: 520px; }
.legend div { font-size: 13px; opacity: 0.9; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 90px; }
.legend .swatch { width: 34px; height: 34px; border-radius: 50%; box-shadow: 0 0 18px currentColor; }

.menuBtns { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; align-items: center; }

.bigBtn {
  padding: 14px 42px; font-size: 18px; font-weight: 700; min-width: 260px;
  border-radius: 40px; border: none; cursor: pointer; color: #05040a;
  background: linear-gradient(90deg, #2fffe0, #7b2fff);
  box-shadow: 0 0 30px rgba(123, 47, 255, 0.7);
  transition: transform 0.15s ease;
}
.bigBtn.alt {
  background: transparent; color: #fff;
  box-shadow: none; border: 2px solid rgba(255,255,255,0.35);
}
.bigBtn:hover { transform: scale(1.05); }
.bigBtn:active { transform: scale(0.97); }

.roomCode {
  font-size: clamp(48px, 12vw, 90px); font-weight: 800; letter-spacing: 12px;
  color: #ffe22f; text-shadow: 0 0 30px rgba(255,226,47,0.8);
  margin: 18px 0; padding: 10px 30px; border: 2px solid rgba(255,226,47,0.5); border-radius: 16px;
}
.statusText { opacity: 0.75; font-size: 14px; margin-top: 14px; min-height: 18px; }

.codeInput {
  font-size: 36px; letter-spacing: 14px; text-align: center; text-transform: uppercase;
  width: 220px; padding: 12px 10px 12px 24px; margin-top: 16px;
  border-radius: 14px; border: 2px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.06); color: #fff; font-weight: 700;
}
.codeInput:focus { outline: none; border-color: #4ee1ff; }

#hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 18px 30px; pointer-events: none;
}
.scoreBox { text-align: center; }
.scoreBox .label { font-size: 12px; letter-spacing: 3px; opacity: 0.6; color: #fff; }
.scoreBox .value { font-size: 46px; font-weight: 800; text-shadow: 0 0 20px currentColor; }
#playerScore { color: #4ee1ff; }
#cpuScore { color: #ff5ec4; }

#centerMsg {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  color: #fff; font-size: 28px; font-weight: 700; opacity: 0; z-index: 6;
  text-shadow: 0 0 20px rgba(255,255,255,0.8); pointer-events: none;
  transition: opacity 0.3s ease;
}

#restartWrap, #disconnectWrap { z-index: 20; background: rgba(5,4,10,0.9); }
.resultSub { opacity: 0.8; margin-bottom: 12px; font-size: 20px; }
