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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: #fff;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
}

#webcam {
  display: none;
}

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

.hud-panel {
  position: absolute;
  z-index: 10;
  padding: 14px 18px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

#hud-top {
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
}

#hud-bottom {
  bottom: 16px;
  left: 16px;
  max-width: 420px;
}

.hud-stat, .hud-gesture, .hud-effect {
  font-size: 14px;
  line-height: 1.4;
}

.label {
  color: rgba(255, 255, 255, 0.55);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 6px;
}

.hud-learning {
  margin-top: 10px;
  font-size: 15px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.92);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 10px;
}

.warning-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  padding: 16px 32px;
  background: rgba(120, 0, 180, 0.75);
  border: 2px solid rgba(200, 100, 255, 0.8);
  border-radius: 12px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-shadow: 0 0 12px rgba(180, 80, 255, 0.9);
  animation: pulse-warning 1s ease-in-out infinite alternate;
  pointer-events: none;
}

.warning-banner.hidden {
  display: none;
}

@keyframes pulse-warning {
  from { opacity: 0.85; transform: translate(-50%, -50%) scale(1); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1.03); }
}

.permission-prompt {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: radial-gradient(ellipse at center, #0a0a20 0%, #000 70%);
  text-align: center;
  padding: 24px;
}

.permission-prompt.hidden {
  display: none;
}

.permission-prompt h1 {
  font-size: 2.4rem;
  font-weight: 300;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, #ffd700, #ff6b35);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.permission-prompt p {
  color: rgba(255, 255, 255, 0.65);
  max-width: 400px;
  line-height: 1.6;
}

#start-btn {
  margin-top: 8px;
  padding: 14px 36px;
  font-size: 16px;
  font-weight: 600;
  color: #000;
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

#start-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 0 24px rgba(255, 180, 0, 0.5);
}

.input-mode-selector {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.input-mode-label {
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.input-mode-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 24px;
  min-width: 150px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.mode-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.mode-btn.selected {
  border-color: rgba(255, 180, 0, 0.8);
  background: rgba(255, 180, 0, 0.12);
  color: #fff;
}

.mode-icon {
  font-size: 28px;
  line-height: 1;
}

#hud-time.time-urgent {
  color: #ff6b6b;
  animation: pulse-time 0.6s ease-in-out infinite alternate;
}

@keyframes pulse-time {
  from { opacity: 0.7; }
  to { opacity: 1; }
}

.game-over {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(10px);
  text-align: center;
  padding: 24px;
}

.game-over.hidden {
  display: none;
}

.game-over h2 {
  font-size: 2.2rem;
  font-weight: 300;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.9);
}

.final-score-label {
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 8px;
}

.final-score {
  font-size: 4rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

.game-stats, .best-score {
  color: rgba(255, 255, 255, 0.65);
  font-size: 15px;
}

#replay-btn {
  margin-top: 16px;
  padding: 14px 36px;
  font-size: 16px;
  font-weight: 600;
  color: #000;
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

#replay-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 0 24px rgba(255, 180, 0, 0.5);
}
