:root {
  --bg: #07090f;
  --bg-soft: #101624;
  --ink: #eef3ff;
  --muted: #93a0c0;
  --accent: #6cf0c2;
  --accent-2: #ffb86b;
  --danger: #ff6b8a;
  --card: rgba(14, 18, 32, 0.92);
  --stroke: rgba(255, 255, 255, 0.1);
  --glow: 0 0 28px rgba(108, 240, 194, 0.35);
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(1200px 700px at 50% -10%, #1a2440 0%, var(--bg) 55%);
  color: var(--ink);
  font-family: var(--font);
}

body {
  min-height: 100dvh;
}

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 14px 18px;
  gap: 12px;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 140px;
}

.brand h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.logo {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent), #3aa0ff);
  color: #041018;
  font-weight: 800;
  font-size: 0.85rem;
  box-shadow: var(--glow);
}

.hud {
  display: flex;
  flex: 1;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.stat {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 6px 12px;
  min-width: 72px;
  text-align: center;
}

.stat .label {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.stat strong {
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.stage-wrap {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 0;
}

.stage {
  position: relative;
  width: min(100%, 920px);
  aspect-ratio: 4 / 3;
  border-radius: 20px;
  overflow: hidden;
  background: #05070d;
  border: 1px solid var(--stroke);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

#video,
#canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#video {
  transform: scaleX(-1);
  opacity: 0.82;
  filter: saturate(0.75) contrast(1.1) brightness(0.88);
}

#canvas {
  transform: scaleX(-1);
  pointer-events: none;
}

.track-chip {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(7, 9, 15, 0.82);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(10px);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.track-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 10px rgba(255, 107, 138, 0.7);
  flex-shrink: 0;
}

.track-chip.is-hand {
  color: var(--accent-2);
  border-color: rgba(255, 184, 107, 0.35);
}

.track-chip.is-hand .track-dot {
  background: var(--accent-2);
  box-shadow: 0 0 12px rgba(255, 184, 107, 0.8);
}

.track-chip.is-slash {
  color: var(--accent);
  border-color: rgba(108, 240, 194, 0.45);
  background: rgba(108, 240, 194, 0.12);
}

.track-chip.is-slash .track-dot {
  background: var(--accent);
  box-shadow: 0 0 14px rgba(108, 240, 194, 0.9);
  animation: pulse-dot 0.5s ease-in-out infinite;
}

.track-chip.is-none .track-dot {
  animation: pulse-dot 1.4s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.65; }
}

.action-hint {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(255, 184, 107, 0.18);
  border: 1px solid rgba(255, 184, 107, 0.45);
  color: var(--accent-2);
  font-weight: 700;
  font-size: 1rem;
  backdrop-filter: blur(8px);
  animation: hint-bounce 1.1s ease-in-out infinite;
  white-space: nowrap;
}

@keyframes hint-bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-6px); }
}

.celebrate {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  font-weight: 800;
  color: var(--accent);
  text-shadow: 0 0 24px rgba(108, 240, 194, 0.7);
  pointer-events: none;
  animation: pop-in 0.55s ease-out both;
}

.combo-banner {
  position: absolute;
  top: 56px;
  right: 14px;
  z-index: 3;
  padding: 8px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(108, 240, 194, 0.25), rgba(255, 184, 107, 0.2));
  border: 1px solid rgba(108, 240, 194, 0.4);
  font-weight: 800;
  font-size: 1.1rem;
  color: #fff;
  animation: pop-in 0.35s ease-out both;
}

@keyframes pop-in {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(0.6); }
  60% { opacity: 1; transform: translate(-50%, -50%) scale(1.12); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.combo-banner {
  animation: combo-pop 0.35s ease-out both;
}

@keyframes combo-pop {
  0% { opacity: 0; transform: scale(0.7) translateX(12px); }
  100% { opacity: 1; transform: scale(1) translateX(0); }
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(4, 6, 12, 0.72);
  backdrop-filter: blur(8px);
}

.overlay.hidden {
  display: none;
}

.card {
  width: min(440px, 100%);
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 22px;
  padding: 28px 24px 22px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  text-align: center;
}

.card-wide {
  width: min(560px, 100%);
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.card h2 {
  margin: 0 0 6px;
  font-size: 1.75rem;
}

.tagline {
  margin: 0 0 18px;
  color: var(--accent);
  font-weight: 600;
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  margin-bottom: 16px;
}

.step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--stroke);
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--accent), #3aa0ff);
  color: #041018;
  font-weight: 800;
  flex-shrink: 0;
}

.step-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.step-body strong {
  font-size: 0.98rem;
}

.step-body span {
  font-size: 0.82rem;
  color: var(--muted);
}

.demo {
  margin: 4px 0 14px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--stroke);
}

.demo-svg {
  width: 100%;
  height: auto;
  display: block;
}

.demo-trail {
  stroke-dasharray: 220;
  animation: draw-slash 1.6s ease-in-out infinite;
}

.demo-tip {
  animation: tip-pulse 1.6s ease-in-out infinite;
}

.demo-fruit {
  animation: fruit-bob 2s ease-in-out infinite;
}

@keyframes draw-slash {
  0% { stroke-dashoffset: 220; opacity: 0.3; }
  40% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0.4; }
}

@keyframes tip-pulse {
  0%, 100% { r: 8; opacity: 0.7; }
  40% { r: 12; opacity: 1; }
}

@keyframes fruit-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.demo-caption {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.hint {
  margin: 0 0 16px;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

.primary-btn,
.ghost-btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  border-radius: 999px;
  padding: 12px 22px;
  transition: transform 0.12s ease, filter 0.12s ease, background 0.12s ease;
}

.primary-btn {
  background: linear-gradient(145deg, var(--accent), #3aa0ff);
  color: #041018;
  box-shadow: var(--glow);
  min-width: 160px;
}

.primary-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.primary-btn:active {
  transform: translateY(1px);
}

.ghost-btn {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--stroke);
  padding: 8px 14px;
}

.ghost-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

.status {
  min-height: 1.3em;
  margin: 12px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.final-score,
.final-meta {
  margin: 8px 0;
  color: var(--muted);
}

.final-score strong {
  color: var(--accent);
  font-size: 1.6rem;
}

.final-meta strong {
  color: var(--accent-2);
}

@media (max-width: 640px) {
  .brand h1 { font-size: 1rem; }
  .stat { min-width: 58px; padding: 4px 8px; }
  .card { padding: 22px 16px 18px; }
  .stage { aspect-ratio: 3 / 4; border-radius: 16px; }
}
