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

body {
  background: #111;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  font-family: monospace;
  color: #eee;
}

h1 {
  padding: 12px 0 8px;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  color: #0ff;
}

#stage {
  display: flex;
  align-items: flex-start;
  gap: 0;
  position: relative;
}

#cam-wrap {
  position: relative;
  flex-shrink: 0;
}

#cam-canvas {
  display: block;
  max-width: 100%;
}

#gesture-label {
  position: absolute;
  top: 10px;
  left: 12px;
  font-size: 1.3rem;
  color: #0ff;
  font-weight: bold;
  text-shadow: 1px 1px 4px #000;
  pointer-events: none;
}

#debug-overlay {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 0.65rem;
  color: #aaa;
  line-height: 1.5;
  pointer-events: none;
  white-space: pre;
}

#panel-canvas {
  display: block;
  background: #000;
}

/* ── Mobile: layout vertical ─────────────────────────────────────────────── */
@media (max-width: 768px), (orientation: portrait) {
  body {
    align-items: stretch;
  }

  h1 {
    text-align: center;
  }

  #stage {
    flex-direction: column;
  }

  #cam-canvas,
  #panel-canvas {
    width: 100vw !important;
    height: auto !important;
    display: block;
  }

  #gesture-label {
    font-size: 1rem;
  }

  #debug-overlay {
    font-size: 0.55rem;
  }
}

#loading {
  position: fixed;
  inset: 0;
  background: #111;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  z-index: 10;
}

#loading-spinner {
  width: 56px;
  height: 56px;
  border: 4px solid #1a1a1a;
  border-top-color: #0ff;
  border-right-color: #0ff;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#loading-text {
  font-size: 0.95rem;
  color: #0ff;
  letter-spacing: 0.08em;
  animation: pulse 1.6s ease-in-out infinite;
}

#loading-steps {
  font-size: 0.7rem;
  color: #555;
  letter-spacing: 0.05em;
  text-align: center;
  line-height: 2;
}

#loading-steps span.done  { color: #0f8; }
#loading-steps span.active { color: #0ff; animation: pulse 1s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}
