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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0b0b1a url('../assets/images/backgroud.jpg') center / cover no-repeat fixed;
  color: #fff;
  height: 100vh;
  overflow: hidden;
}

#app {
  width: 100%;
  max-width: 900px;
  height: 100vh;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

/* ===== Loading ===== */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 26, 0.95);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 100;
  gap: 20px;
}

#loading-overlay.hidden { display: none; }

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #6c63ff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

#loading-text {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.7);
}

#camera-error {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 26, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  text-align: center;
  padding: 20px;
  font-size: 18px;
  color: #ff6b6b;
}

/* ===== Header / Scoreboard ===== */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  flex-shrink: 0;
  height: 60px;
}

.score-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
}

.score-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.score-value {
  font-size: 56px;
  font-weight: 900;
  text-shadow: 0 0 30px currentColor;
}

.player-side .score-value { color: #8b83ff; }
.computer-side .score-value { color: #ff4589; }

.score-center {
  text-align: center;
}

.score-center h1 {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, #6c63ff, #e91e63);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#round-info {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 2px;
  height: 20px;
}

/* ===== Arena ===== */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}

.arena {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.fighter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.gesture-display {
  width: 260px;
  height: 260px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Computer display */
.fighter-computer .gesture-display {
  background: linear-gradient(145deg, #1a1a2e, #16213e);
  border: 2px solid rgba(233, 30, 99, 0.3);
  box-shadow: 0 0 40px rgba(233, 30, 99, 0.08), inset 0 0 60px rgba(233, 30, 99, 0.04);
}

.fighter-computer .gesture-emoji {
  font-size: 120px;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fighter-computer .gesture-emoji.pop {
  transform: scale(1.15);
}

/* Player display */
.fighter-player .gesture-display {
  background: radial-gradient(circle at 50% 50%, #12122a, #0a0a14);
  border: 2px solid rgba(108, 99, 255, 0.3);
  box-shadow: 0 0 40px rgba(108, 99, 255, 0.08), inset 0 0 60px rgba(108, 99, 255, 0.04);
}

#webcam {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
}

#overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transform: scaleX(-1);
}

.gesture-emoji-overlay {
  position: absolute;
  bottom: 10px;
  right: 10px;
  font-size: 36px;
  background: rgba(108, 99, 255, 0.15);
  border: 1px solid rgba(108, 99, 255, 0.3);
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  backdrop-filter: blur(8px);
}

.fighter-label {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
}

/* VS badge */
.vs-badge {
  font-size: 22px;
  font-weight: 900;
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.5), rgba(233, 30, 99, 0.5));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex-shrink: 0;
  text-shadow: none;
}

/* ===== Result banner ===== */
.result-banner {
  text-align: center;
  font-size: 28px;
  font-weight: 800;
  padding: 10px;
  margin-top: 10px;
  border-radius: 12px;
  height: 52px;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.result-banner.visible {
  visibility: visible;
  opacity: 1;
}

.result-banner.win {
  color: #00e676;
  background: rgba(0, 230, 118, 0.08);
  border: 1px solid rgba(0, 230, 118, 0.2);
}

.result-banner.lose {
  color: #ff5252;
  background: rgba(255, 82, 82, 0.08);
  border: 1px solid rgba(255, 82, 82, 0.2);
}

.result-banner.draw {
  color: #ffeb3b;
  background: rgba(255, 235, 59, 0.08);
  border: 1px solid rgba(255, 235, 59, 0.2);
}

/* ===== Inline model loading ===== */
.model-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(10, 10, 20, 0.85);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  z-index: 5;
}

.model-loading.hidden { display: none; }

.spinner-sm {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: #6c63ff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ===== Hint ===== */
.hint-text {
  text-align: center;
  margin-top: 10px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.35);
  height: 20px;
  flex-shrink: 0;
}

/* ===== Responsive ===== */
@media (max-width: 680px) {
  #app { padding: 8px; }
  .score-value { font-size: 40px; }
  .score-center h1 { font-size: 22px; }
  #round-info { font-size: 14px; }
  .gesture-display { width: 160px; height: 160px; border-radius: 18px; }
  .fighter-computer .gesture-emoji { font-size: 80px; }
  .result-banner { font-size: 22px; }
  .gesture-emoji-overlay { font-size: 28px; width: 44px; height: 44px; }
}
