* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --cyan: #35e0ff;
  --magenta: #ff4d9d;
  --bg: #05060f;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  color: #dfe8ff;
  user-select: none;
}

#c { position: fixed; inset: 0; display: block; }

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

#top {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 26px;
}

.side { display: flex; align-items: center; gap: 12px; }

.pname {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 3px;
}
.pname.p0 { color: var(--cyan); text-shadow: 0 0 12px rgba(53,224,255,.7); }
.pname.p1 { color: var(--magenta); text-shadow: 0 0 12px rgba(255,77,157,.7); }

.pips { display: flex; gap: 7px; }
.pips i {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.06);
  transition: all .25s;
}
#pips0 i.on { background: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
#pips1 i.on { background: var(--magenta); border-color: var(--magenta); box-shadow: 0 0 10px var(--magenta); }
.pips.right { flex-direction: row-reverse; }

#roundLabel {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 5px;
  color: #9fb2e8;
}

#crumbleWarn {
  position: absolute;
  top: 62px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 6px;
  color: #ff5252;
  text-shadow: 0 0 14px rgba(255,60,60,.8);
  opacity: 0;
  transition: opacity .2s;
}
#crumbleWarn.show { opacity: 1; animation: blink .5s steps(2) infinite; }
@keyframes blink { 50% { opacity: .25; } }

#center {
  position: absolute;
  top: 34%;
  width: 100%;
  text-align: center;
  font-size: 74px;
  font-weight: 900;
  letter-spacing: 8px;
  color: #fff;
  text-shadow: 0 0 30px rgba(140,190,255,.9), 0 0 80px rgba(80,140,255,.5);
  opacity: 0;
  transition: opacity .15s;
}
#center.show { opacity: 1; }
#center.pop { animation: pop .35s ease-out; }
@keyframes pop {
  0% { transform: scale(1.6); }
  100% { transform: scale(1); }
}
#center.c0 { color: var(--cyan); text-shadow: 0 0 30px rgba(53,224,255,.9); }
#center.c1 { color: var(--magenta); text-shadow: 0 0 30px rgba(255,77,157,.9); }

#sub {
  position: absolute;
  top: calc(34% + 96px);
  width: 100%;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 4px;
  color: #aebbe8;
  opacity: 0;
  transition: opacity .2s;
}
#sub.show { opacity: 1; }

#toast {
  position: absolute;
  bottom: 130px;
  width: 100%;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #ffe27a;
  text-shadow: 0 0 14px rgba(255,210,90,.6);
  opacity: 0;
  transition: opacity .25s;
}
#toast.show { opacity: 1; }

#chargeWrap {
  position: absolute;
  bottom: 34px;
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  height: 14px;
  border: 1px solid rgba(150,180,255,.35);
  border-radius: 8px;
  background: rgba(10,14,30,.7);
  overflow: hidden;
}
#chargeBar {
  height: 100%;
  width: 0%;
  border-radius: 7px;
  background: linear-gradient(90deg, #2b7dff, #35e0ff);
  transition: width .05s linear;
}
#chargeBar.charging {
  background: linear-gradient(90deg, #ffb347, #ff5e7a);
  box-shadow: 0 0 16px rgba(255,120,90,.8);
}
#chargeBar.cooling { opacity: .35; }
#chargeBar.ready { box-shadow: 0 0 12px rgba(53,224,255,.7); }
#chargeLabel {
  position: absolute;
  inset: 0;
  text-align: center;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 4px;
  line-height: 14px;
  color: rgba(255,255,255,.75);
}

#help {
  position: absolute;
  bottom: 12px;
  left: 16px;
  font-size: 11px;
  letter-spacing: 1px;
  color: rgba(160,180,230,.55);
}

#status {
  position: absolute;
  bottom: 12px;
  right: 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: rgba(160,180,230,.7);
}

#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: radial-gradient(ellipse at center, rgba(8,10,24,.55), rgba(4,5,12,.92));
  transition: opacity .4s;
}
#overlay.hidden { opacity: 0; visibility: hidden; }
#overlay h1 {
  font-size: 64px;
  font-weight: 900;
  letter-spacing: 14px;
  background: linear-gradient(90deg, var(--cyan), #8f7bff, var(--magenta));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 26px rgba(100,140,255,.45));
}
#overlay .tagline {
  font-size: 14px;
  letter-spacing: 4px;
  color: #93a5d8;
}
#overlayMsg {
  margin-top: 18px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #e8eeff;
}
#invite {
  font-size: 14px;
  letter-spacing: 1px;
  color: #7fe8c0;
  text-shadow: 0 0 10px rgba(90,230,170,.4);
  white-space: pre-line;
  text-align: center;
  line-height: 1.8;
}
