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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: white;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.container {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  text-align: center;
  padding: 15px 20px;
  background: linear-gradient(180deg, rgba(26, 26, 46, 0.95) 0%, rgba(26, 26, 46, 0) 100%);
  backdrop-filter: blur(10px);
}

h1 {
  font-size: 1.8rem;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.stats {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.stat {
  background: rgba(255, 255, 255, 0.15);
  padding: 8px 16px;
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

.stat .label {
  color: #aaa;
  margin-right: 6px;
  font-size: 0.9rem;
}

.stat .value {
  font-weight: bold;
  font-size: 1.1rem;
  color: #4caf50;
}

/* Stamina Bar */
.stamina-container {
  max-width: 350px;
  margin: 0 auto;
  padding: 10px 15px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  backdrop-filter: blur(10px);
}

.stamina-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.9rem;
  font-weight: bold;
}

.stamina-value {
  color: #4caf50;
}

.stamina-bar {
  width: 100%;
  height: 20px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.stamina-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #66bb6a, #4caf50);
  transition: width 0.1s linear, background 0.3s ease;
  border-radius: 8px;
}

/* Game Container (Full Screen) */
.game-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  background: #0a0e27;
}

/* Camera Panel (Ground Area - Bottom Center) */
.camera-panel {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  flex-direction: row;
  gap: 15px;
  width: 90%;
  max-width: 800px;
  background: rgba(0, 0, 0, 0.85);
  padding: 20px;
  border-radius: 15px 15px 0 0;
  backdrop-filter: blur(15px);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-bottom: none;
  align-items: center;
  transition: transform 0.3s ease;
}

.camera-panel.hidden {
  transform: translateX(-50%) translateY(100%);
}

.camera-panel-content {
  display: flex;
  flex-direction: row;
  gap: 15px;
  align-items: center;
  flex: 1;
}

.video-container {
  position: relative;
  width: 320px;
  height: 240px;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

#video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* Mirror video */
}

#pose-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: scaleX(-1); /* Mirror canvas */
}

/* Gesture Indicators - Vertical Layout */
.indicators {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  max-width: 400px;
}

.indicator {
  height: 50px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.15s ease;
}

.indicator .label {
  font-size: 0.9rem;
  font-weight: bold;
  opacity: 0.5;
  transition: all 0.15s ease;
}

.indicator.active {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3);
}

.indicator.active .label {
  opacity: 1;
}

#neutral-indicator.active {
  background: rgba(158, 158, 158, 0.6);
  border-color: #9e9e9e;
}

#jump-indicator.active {
  background: rgba(255, 193, 7, 0.8);
  border-color: #ffc107;
}

#crouch-indicator.active {
  background: rgba(33, 150, 243, 0.8);
  border-color: #2196f3;
}

#hands-indicator.active {
  background: rgba(76, 175, 80, 0.8);
  border-color: #4caf50;
}

.status-text {
  text-align: center;
  font-size: 0.85rem;
  color: #aaa;
  padding: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  margin-top: 5px;
}

/* Toggle Button - Fixed position so it's always accessible */
.toggle-feed-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 60;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: bold;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.toggle-feed-btn:hover {
  background: rgba(0, 0, 0, 0.85);
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.toggle-feed-btn:active {
  transform: scale(0.95);
}

/* Game Overlays */
.start-screen,
.game-over {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

.game-over.hidden,
.start-screen.hidden {
  display: none;
}

.start-screen h2,
.game-over h2 {
  font-size: 2.5rem;
  margin-bottom: 30px;
  color: #ffc107;
}

.game-over h2 {
  color: #f44336;
}

.controls {
  background: rgba(255, 255, 255, 0.1);
  padding: 30px;
  border-radius: 15px;
  margin-bottom: 30px;
}

.control-item {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
  font-size: 1.1rem;
}

.control-item:last-child {
  margin-bottom: 0;
}

.gesture-icon {
  font-size: 2rem;
  width: 50px;
  text-align: center;
}

.start-text,
.instruction {
  font-size: 1.3rem;
  color: #4caf50;
  animation: pulse 2s infinite;
}

.final-score {
  font-size: 1.8rem;
  margin-bottom: 30px;
  color: #ffc107;
}

/* Arm Extension Indicator */
.magnet-indicator {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #66bb6a, #4caf50);
  color: white;
  padding: 10px 25px;
  border-radius: 25px;
  font-weight: bold;
  font-size: 1.1rem;
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.5);
  z-index: 5;
  animation: armPulse 0.5s infinite alternate;
}

.magnet-indicator.hidden {
  display: none;
}

@keyframes armPulse {
  from {
    transform: translateX(-50%) scale(1);
  }
  to {
    transform: translateX(-50%) scale(1.05);
  }
}

/* Instructions */
.instructions {
  text-align: center;
  margin-top: 20px;
  color: #aaa;
  font-size: 0.9rem;
}

.instructions p {
  margin-bottom: 5px;
}

/* Calibration Screen */
.calibration-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.calibration-screen.hidden {
  display: none;
}

.calibration-content {
  background: rgba(255, 255, 255, 0.1);
  padding: 50px;
  border-radius: 20px;
  text-align: center;
  min-width: 400px;
  backdrop-filter: blur(10px);
}

.calibration-content h2 {
  font-size: 2.5rem;
  margin-bottom: 20px;
  color: #ffc107;
}

.calibration-instruction {
  font-size: 1.2rem;
  margin-bottom: 30px;
  color: #aaa;
}

.calibration-progress {
  margin-bottom: 30px;
}

.progress-bar {
  width: 100%;
  height: 30px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 15px;
  overflow: hidden;
  margin-bottom: 15px;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #66bb6a, #4caf50);
  transition: width 0.3s ease;
}

#calibration-message {
  font-size: 1.1rem;
  color: #4caf50;
}

.calibration-countdown {
  font-size: 6rem;
  font-weight: bold;
  color: #ffc107;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Animations */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Calibration Screen (Full Screen Overlay) */
.calibration-content {
  max-width: 900px;
  padding: 60px 40px;
}

.calibration-content h2 {
  font-size: 3.5rem;
  margin-bottom: 25px;
  font-weight: bold;
}

.calibration-instruction {
  font-size: 2rem;
  margin-bottom: 40px;
  line-height: 1.6;
  font-weight: 500;
}

#calibration-message {
  font-size: 1.8rem;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
}

.calibration-steps {
  text-align: left;
  margin: 30px 0;
  font-size: 1.5rem;
  line-height: 2;
}

.calibration-steps li {
  margin-bottom: 20px;
  list-style-position: inside;
}

.calibration-steps strong {
  color: #ffc107;
  font-size: 1.6rem;
}

.start-calibration-btn {
  background: linear-gradient(90deg, #66bb6a, #4caf50);
  color: white;
  border: none;
  padding: 20px 50px;
  font-size: 1.8rem;
  font-weight: bold;
  border-radius: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
  margin-top: 30px;
}

.start-calibration-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.start-calibration-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.6);
}

.start-calibration-btn:active {
  transform: scale(0.98);
}

/* Responsive */
@media (max-width: 768px) {
  h1 {
    font-size: 1.3rem;
  }

  .stats {
    gap: 8px;
  }

  .stat {
    padding: 5px 10px;
  }

  .stat .label {
    font-size: 0.75rem;
  }

  .stat .value {
    font-size: 0.9rem;
  }

  .camera-panel {
    width: 95%;
    padding: 12px;
    flex-direction: column;
  }

  .camera-panel-content {
    flex-direction: column;
  }

  .video-container {
    width: 100%;
    height: auto;
    aspect-ratio: 4/3;
  }

  .indicators {
    flex-direction: row;
    max-width: 100%;
    gap: 6px;
  }

  .indicator {
    height: 40px;
    flex: 1;
  }

  .indicator .label {
    font-size: 0.7rem;
  }

  .toggle-feed-btn {
    top: -35px;
    right: 10px;
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  .control-item {
    font-size: 0.95rem;
  }

  .gesture-icon {
    font-size: 1.3rem;
    width: 35px;
  }

  .calibration-content {
    padding: 40px 20px;
    max-width: 95%;
  }

  .calibration-content h2 {
    font-size: 2.5rem;
  }

  .calibration-instruction {
    font-size: 1.5rem;
  }

  #calibration-message {
    font-size: 1.4rem;
  }

  .calibration-steps {
    font-size: 1.2rem;
  }

  .calibration-steps strong {
    font-size: 1.3rem;
  }

  .start-calibration-btn {
    padding: 15px 35px;
    font-size: 1.5rem;
  }

  .calibration-countdown {
    font-size: 5rem;
  }
}
