:root {
  --bg: #080812;
  --panel: rgba(255,255,255,.09);
  --panel2: rgba(255,255,255,.13);
  --text: #fff;
  --muted: rgba(255,255,255,.66);
  --accent: #8fffd2;
  --danger: #ff6b9a;
  --gold: #ffd166;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 10%, rgba(143,255,210,.25), transparent 28%),
    radial-gradient(circle at 80% 20%, rgba(255,107,154,.25), transparent 30%),
    linear-gradient(145deg, #05050b, #111126 65%, #070716);
}

.app {
  width: min(1180px, 96vw);
  margin: 0 auto;
  padding: 28px 0;
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow {
  letter-spacing: .18em;
  font-size: 12px;
  color: var(--accent);
  margin: 0 0 6px;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(40px, 7vw, 88px);
  line-height: .9;
  margin: 0;
  text-shadow: 0 0 24px rgba(143,255,210,.25);
}

.subtitle {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.statusCard {
  min-width: 170px;
  padding: 18px 20px;
  border: 1px solid rgba(255,255,255,.16);
  background: var(--panel);
  border-radius: 24px;
  backdrop-filter: blur(20px);
  text-align: center;
}

.label, .meterLabel {
  font-size: 12px;
  letter-spacing: .15em;
  color: var(--muted);
}

.combo {
  font-size: 64px;
  font-weight: 900;
  line-height: .9;
  color: var(--gold);
}

.phase {
  color: var(--accent);
  font-weight: 700;
  margin-top: 8px;
}

.stage {
  display: grid;
  grid-template-columns: 1.45fr .85fr;
  gap: 18px;
}

.cameraWrap {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 30px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 30px 80px rgba(0,0,0,.45);
}

video, canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

video {
  object-fit: cover;
  transform: scaleX(-1);
  opacity: .82;
}

#fxCanvas {
  pointer-events: none;
}

.countdown {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(70px, 17vw, 210px);
  font-weight: 1000;
  color: #fff;
  text-shadow: 0 0 30px rgba(143,255,210,.8);
  pointer-events: none;
}

.panel {
  border: 1px solid rgba(255,255,255,.14);
  background: var(--panel);
  border-radius: 30px;
  padding: 22px;
  backdrop-filter: blur(20px);
}

.turn {
  background: var(--panel2);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 14px;
}

.turnTitle {
  color: var(--muted);
  font-weight: 800;
  letter-spacing: .13em;
  font-size: 12px;
  margin-bottom: 8px;
}

.pattern {
  min-height: 48px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.dot {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255,255,255,.22);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.2);
}

.dot.on {
  background: var(--accent);
  box-shadow: 0 0 20px rgba(143,255,210,.85);
}

.dot.you {
  background: var(--gold);
  box-shadow: 0 0 20px rgba(255,209,102,.7);
}

.meterBlock { margin: 18px 0; }
.meter {
  width: 100%;
  height: 18px;
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  overflow: hidden;
  margin-top: 8px;
}
#levelBar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--gold), var(--danger));
  border-radius: inherit;
  transition: width .05s linear;
}

.message {
  min-height: 74px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(0,0,0,.22);
  color: rgba(255,255,255,.86);
  line-height: 1.55;
  font-weight: 700;
}

.buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

button {
  border: 0;
  border-radius: 16px;
  padding: 16px 18px;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  color: #07120f;
  background: var(--accent);
  box-shadow: 0 0 30px rgba(143,255,210,.2);
}

button.ghost {
  color: #fff;
  background: rgba(255,255,255,.13);
}

.details {
  color: var(--muted);
  margin-top: 14px;
  font-size: 14px;
}

.flash {
  animation: flash .18s ease-out;
}

@keyframes flash {
  0% { filter: brightness(1); }
  50% { filter: brightness(2.1); }
  100% { filter: brightness(1); }
}

@media (max-width: 900px) {
  .hero, .stage { grid-template-columns: 1fr; display: grid; }
  .hero { align-items: start; }
  .statusCard { width: 100%; }
}

.bgmBox {
  margin: 16px 0;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,.08);
}

.bgmName {
  margin: 8px 0 10px;
  color: var(--accent);
  font-weight: 900;
}

.fileLabel {
  display: inline-block;
  width: 100%;
  text-align: center;
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.fileLabel input {
  display: none;
}
