/* Fullscreen 16:9 widescreen arena layout with edge-overlaid HUD and no bottom card deck */
:root {
  --bg: #05070e;
  --panel: rgba(9, 14, 26, 0.78);
  --border: rgba(148, 178, 228, 0.24);
  --text: #f3f7ff;
  --muted: #9eb0cf;
  --fire: #ff9f43;
  --beam: #5ce1ff;
  --finger: #7ce8ff;
  --clap: #ffdf6b;
  --danger: #ff4d6d;
}

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

html, body {
  width: 100%;
  height: 100%;
  background: #000;
  color: var(--text);
  font-family: "PingFang SC", "Noto Sans SC", -apple-system, BlinkMacSystemFont, sans-serif;
  overflow: hidden;
  user-select: none;
}

[hidden] {
  display: none !important;
}

.viewport {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.stage {
  position: relative;
  width: min(100vw, 177.78vh);
  height: min(56.25vw, 100vh);
  background: var(--bg);
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.9);
}

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

/* Top edge: health + energy (left), wave (centre), score + buttons (right). No boxes, no labels: bars and numbers only. */
.hud-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 20px 26px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
  z-index: 15;
  background: linear-gradient(180deg, rgba(4, 7, 15, 0.55) 0%, transparent 100%);
}

.stage[data-mode="idle"] .hud-top,
.stage[data-mode="idle"] .hud-moves,
.stage[data-mode="idle"] .status-hint,
.stage:not([data-mode]) .hud-top,
.stage:not([data-mode]) .hud-moves,
.stage:not([data-mode]) .status-hint { display: none; }

.stage[data-play="practice"] .hud-hp,
.stage[data-play="practice"] .hud-wave,
.stage[data-play="practice"] .score-group { visibility: hidden; }

.hud-hp { width: 240px; }

.hp-bar, .mp-bar {
  background: rgba(255, 255, 255, 0.13);
  border-radius: 99px;
  overflow: hidden;
}

.hp-bar { height: 9px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); }
.mp-bar { height: 3px; width: 62%; margin-top: 6px; }

.hp-bar i, .mp-bar i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 99px;
  transition: width 0.18s ease, background 0.3s ease;
}

.hp-bar i { background: #58deff; box-shadow: 0 0 10px rgba(88, 222, 255, 0.55); }
.mp-bar i { background: #8fb4ff; }

.hud-wave {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.wave-badge {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  color: rgba(243, 247, 255, 0.72);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}

.boss-hud {
  width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.boss-hud small {
  font-size: 12px;
  letter-spacing: 0.2em;
  color: #ff9bb0;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}

.boss-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.13);
  border-radius: 99px;
  overflow: hidden;
}

.boss-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #ff3b6b, #ff8a5c);
  box-shadow: 0 0 10px rgba(255, 59, 107, 0.6);
  transition: width 0.18s ease;
}

.hud-right {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  pointer-events: auto;
}

.score-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.score-group b {
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
}

.combo-badge {
  font-size: 17px;
  font-weight: 700;
  color: #ffcf6b;
  text-shadow: 0 0 12px rgba(255, 190, 90, 0.6);
}

.icon-actions {
  display: flex;
  gap: 2px;
  opacity: 0.38;
  transition: opacity 0.2s ease;
}

.icon-actions:hover { opacity: 1; }

.icon-btn {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #e6eefb;
  font-size: 14px;
  cursor: pointer;
}

.icon-btn:hover { background: rgba(255, 255, 255, 0.14); }

/* Wave banner: a title that fades over the scene, no box */
.wave-banner {
  position: absolute;
  top: 24%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 18;
  pointer-events: none;
  animation: bannerIn 0.35s ease-out;
}

.wave-banner h2 {
  font-size: 44px;
  font-weight: 700;
  color: #fff4e0;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  text-shadow: 0 0 26px rgba(255, 170, 90, 0.75), 0 2px 8px rgba(0, 0, 0, 0.9);
  margin-bottom: 8px;
}

.wave-banner p {
  font-size: 15px;
  color: #ffdcae;
  text-shadow: 0 1px 3px #000, 0 0 12px rgba(0, 0, 0, 0.9);
}

@keyframes bannerIn {
  from { opacity: 0; transform: translateX(-50%) scale(1.12); }
}

/* Practice: a slim card at the top centre (which lesson, how many done, what to do now), a demo panel when a lesson opens. */
.practice-card {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: min(460px, calc(100% - 32px));
  padding: 12px 18px 14px;
  background: rgba(8, 13, 24, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  backdrop-filter: blur(10px);
  z-index: 20;
  text-align: center;
}

.practice-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.practice-strip { display: flex; gap: 6px; }

.strip-item {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.07);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.45;
}

.strip-item.done { opacity: 0.9; border-color: rgba(143, 240, 176, 0.7); }
.strip-item.current { opacity: 1; border-color: #ffcf6b; background: rgba(255, 207, 107, 0.16); }

.practice-buttons { display: flex; gap: 4px; }

.skip-btn {
  border: 0;
  background: transparent;
  color: rgba(203, 213, 225, 0.7);
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
}

.skip-btn:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

.practice-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 8px;
}

.practice-head h3 { font-size: 22px; letter-spacing: 0.1em; color: #fff; }

.practice-count { display: inline-flex; gap: 5px; }
.practice-count i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, 0.2); }
.practice-count i.on { background: #8ff0b0; box-shadow: 0 0 8px rgba(143, 240, 176, 0.7); }

.practice-steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}

.step-chip {
  font-size: 13px;
  padding: 4px 11px;
  border-radius: 99px;
  color: rgba(203, 213, 225, 0.75);
  background: rgba(255, 255, 255, 0.07);
}

.step-chip.now { color: #1a1205; background: #ffcf6b; font-weight: 600; }
.step-chip.done { color: #8ff0b0; background: rgba(143, 240, 176, 0.12); }
.step-arrow { color: rgba(158, 176, 207, 0.45); font-size: 12px; }
.step-detail { flex-basis: 100%; font-size: 12px; color: var(--muted); }

.practice-hint {
  min-height: 21px;
  margin-top: 8px;
  font-size: 14px;
  color: #e6eefb;
}

.practice-hint.warn { color: #ffcf6b; }
.practice-hint.good { color: #8ff0b0; }

.practice-intro {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100% - 32px));
  max-height: calc(100% - 24px);
  overflow: auto;
  text-align: center;
  background: rgba(8, 13, 24, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  padding: 20px 26px 18px;
  z-index: 30;
  backdrop-filter: blur(12px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

.practice-intro .eyebrow { margin-bottom: 2px; }
.practice-intro h2 { font-size: 28px; letter-spacing: 0.08em; color: #fff; margin-bottom: 10px; }

.intro-demo {
  display: block;
  width: 100%;
  aspect-ratio: 840 / 520;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  margin-bottom: 12px;
}

.intro-steps { margin: 0 0 10px; }
.intro-how { font-size: 14px; line-height: 1.6; color: #cbd5e1; margin-bottom: 14px; }
.practice-intro .entry-actions { margin-bottom: 0; }

.summary-card { width: min(620px, 92%); padding: 28px 28px 22px; }

.summary-list {
  list-style: none;
  text-align: left;
  margin: 4px 0 20px;
  display: grid;
  gap: 8px;
}

.summary-list li {
  display: grid;
  grid-template-columns: 28px 80px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 14px;
  color: #e6eefb;
}

.summary-list li b { color: #fff; }
.summary-list li small { color: var(--muted); font-size: 12px; line-height: 1.5; }
.summary-list li .sum-gesture { color: #e6eefb; font-size: 14px; }
.summary-list .res-done { color: #8ff0b0; font-size: 12px; white-space: nowrap; }
.summary-list .res-skipped, .summary-list .res-todo { color: #94a3b8; font-size: 12px; white-space: nowrap; }

@media (max-width: 720px) {
  .summary-list li { grid-template-columns: 24px 1fr auto; }
  .summary-list li small, .summary-list li .res-done, .summary-list li .res-skipped, .summary-list li .res-todo { display: none; }
}

/* One teaching sentence above the move icons (first waves only) */
.tutorial-prompt {
  position: absolute;
  bottom: 98px;
  left: 50%;
  transform: translateX(-50%);
  color: #ffecd2;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 3px #000, 0 0 14px rgba(0, 0, 0, 0.9);
  z-index: 15;
  pointer-events: none;
  white-space: nowrap;
}

/* Bottom centre: five round move icons. Lit = in use, dim = not available, ring = fireball charge / thunder rage. */
.hud-moves {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
  z-index: 15;
  pointer-events: none;
}

.move-slot {
  --p: 0;
  --c: #cbd5e1;
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 360deg), rgba(255, 255, 255, 0.14) 0);
  opacity: 0.62;
  transition: opacity 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.move-slot::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: rgba(8, 13, 24, 0.86);
}

.move-slot.punch { --c: #9fd8ff; }
.move-slot.fire { --c: var(--fire); }
.move-slot.beam { --c: var(--beam); }
.move-slot.finger { --c: var(--finger); }
.move-slot.clap { --c: var(--clap); }
.move-slot.ice { --c: #9be8ff; }

.move-icon-glyph { position: relative; font-size: 22px; line-height: 1; }

.move-slot.active {
  opacity: 1;
  transform: scale(1.14);
  box-shadow: 0 0 0 2px var(--c), 0 0 22px var(--c);
}

.move-slot.disabled { opacity: 0.25; filter: grayscale(0.8); }
.move-slot.locked { opacity: 0.16; filter: grayscale(1); }
.move-slot.lesson { opacity: 1; box-shadow: 0 0 0 2px #ffcf6b, 0 0 18px rgba(255, 207, 107, 0.45); }
.move-slot.clap.ready, .move-slot.ice.ready { animation: movePulse 0.9s ease-in-out infinite; }

@keyframes movePulse {
  50% { transform: scale(1.22); box-shadow: 0 0 0 2px var(--c), 0 0 30px var(--c); }
}

/* Thunder ready: the whole frame glows gold until it is used (the icon and the text line alone went unnoticed) */
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 14;
  opacity: 0;
  box-shadow: inset 0 0 90px 18px rgba(255, 205, 90, 0.55);
  transition: opacity 0.4s ease;
}

.stage[data-rage="1"]::after { opacity: 1; animation: ragePulse 1.1s ease-in-out infinite; }

@keyframes ragePulse {
  50% { box-shadow: inset 0 0 130px 30px rgba(255, 205, 90, 0.8); }
}

/* Words over an icon: only when there is something to do about it */
.move-slot em {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  font-style: normal;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  color: #ffe3a3;
  text-shadow: 0 1px 3px #000, 0 0 10px rgba(0, 0, 0, 0.9);
}

.move-slot em:empty { display: none; }

/* Mouse play only: which key or button does it */
.move-slot kbd {
  display: none;
  position: absolute;
  top: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  font: 600 10px/1 -apple-system, "PingFang SC", sans-serif;
  color: rgba(203, 213, 225, 0.7);
  white-space: nowrap;
}

.stage[data-mode="demo"] .move-slot kbd { display: block; }
.stage[data-mode="demo"] .hud-moves { bottom: 30px; }

/* Bottom-left: only messages that matter (checks, replays); the mouse key list lives under the icons */
.status-hint {
  position: absolute;
  bottom: 14px;
  left: 22px;
  font-size: 11px;
  color: rgba(203, 213, 225, 0.5);
  z-index: 15;
  pointer-events: none;
}

.pip-wrap {
  position: absolute;
  bottom: 18px;
  right: 22px;
  width: 176px;
  height: 99px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: #050811;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  opacity: 0.85;
  z-index: 16;
  pointer-events: none;
}

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

/* Welcome & Result Semi-Transparent Overlay Panels */
.overlay-panel {
  position: absolute;
  inset: 0;
  background: rgba(4, 7, 15, 0.78);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

.panel-card {
  width: min(520px, 90%);
  background: rgba(11, 18, 34, 0.92);
  border: 1px solid rgba(148, 178, 228, 0.3);
  border-radius: 20px;
  padding: 36px 32px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75);
}

.eyebrow {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: #7ce8ff;
  font-weight: 700;
  margin-bottom: 10px;
}

.panel-card h1, .panel-card h2 {
  font-size: 30px;
  color: #fff;
  margin-bottom: 12px;
}

.panel-card .lead {
  font-size: 15px;
  line-height: 1.6;
  color: #cbd5e1;
  margin-bottom: 24px;
}

.entry-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 14px;
}

.btn {
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.12s, opacity 0.15s;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn.primary {
  background: linear-gradient(135deg, #ff9f43, #ff6b4a);
  color: #fff;
}

.btn.secondary {
  background: rgba(92, 225, 255, 0.16);
  border-color: rgba(92, 225, 255, 0.5);
  color: #d8f8ff;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border);
  color: var(--text);
}

.btn.text {
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.error-msg {
  color: #ff6b8b;
  font-size: 13px;
  min-height: 18px;
  margin-bottom: 6px;
}

.privacy {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

/* Motion capture (?capture=…): the cue is the only thing that matters, so it is big and in the upper middle */
.stage[data-capture] .tutorial-prompt { top: 16%; bottom: auto; font-size: 30px; }
.stage[data-capture] .hud-wave, .stage[data-capture] .score-group, .stage[data-capture] .hud-hp { visibility: hidden; }
