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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'Courier New', monospace;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

#camera {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}
#camera.active { display: block; }

#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  cursor: crosshair;
}

/* ---------- Écrans ---------- */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.screen.visible { display: flex; }

#screen-title, #screen-gameover, #screen-scores {
  background: linear-gradient(180deg, #1a237e 0%, #4fc3f7 70%, #7cb342 100%);
}

.title-box {
  text-align: center;
  padding: 24px;
  max-width: 420px;
  width: 92%;
}
.title-box.wide { max-width: 480px; }

.game-title {
  font-size: clamp(36px, 9vw, 64px);
  color: #fff;
  text-shadow: 4px 4px 0 #d32f2f, 8px 8px 0 rgba(0,0,0,.35);
  letter-spacing: 2px;
  margin-bottom: 12px;
}
.game-title.small { font-size: clamp(28px, 7vw, 44px); }

.ar-badge {
  display: inline-block;
  background: #d32f2f;
  color: #fff;
  font-size: .4em;
  padding: 4px 10px;
  border-radius: 8px;
  vertical-align: super;
  margin-left: 8px;
  text-shadow: none;
  animation: pulse 1.2s infinite;
}
@keyframes pulse { 50% { transform: scale(1.15); } }

.subtitle {
  color: #fff;
  font-size: 15px;
  margin-bottom: 20px;
  text-shadow: 1px 1px 2px rgba(0,0,0,.5);
}

#player-name {
  width: 100%;
  padding: 12px;
  font-size: 18px;
  font-family: inherit;
  text-align: center;
  border: 4px solid #263238;
  border-radius: 10px;
  margin-bottom: 14px;
  background: #fffde7;
  outline: none;
}

.btn {
  display: block;
  width: 100%;
  padding: 14px;
  margin-bottom: 10px;
  font-size: 17px;
  font-family: inherit;
  font-weight: bold;
  color: #fff;
  background: #37474f;
  border: 4px solid #263238;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 5px 0 #1c262b;
  transition: transform .05s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #1c262b; }
.btn-primary { background: #e53935; border-color: #b71c1c; box-shadow: 0 5px 0 #8e1414; }

.hint {
  color: rgba(255,255,255,.85);
  font-size: 12px;
  margin-top: 10px;
  text-shadow: 1px 1px 2px rgba(0,0,0,.5);
}

/* ---------- Analyse ---------- */
#screen-analysis { background: rgba(0, 10, 30, .72); flex-direction: column; }
.analysis-box { text-align: center; color: #4fc3f7; padding: 24px; max-width: 400px; }
.analysis-box h2 { margin-bottom: 12px; font-size: 20px; }
#analysis-step { color: #fff; font-size: 14px; min-height: 20px; margin-bottom: 16px; }

.scanner {
  width: 140px; height: 140px;
  margin: 0 auto 20px;
  border: 3px solid #4fc3f7;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}
.scanner::after {
  content: '';
  position: absolute;
  left: 0; right: 0; height: 3px;
  background: #00e5ff;
  box-shadow: 0 0 14px #00e5ff;
  animation: scan 1.4s ease-in-out infinite;
}
@keyframes scan { 0%,100% { top: 4%; } 50% { top: 92%; } }

.progress {
  width: 100%; height: 14px;
  border: 2px solid #4fc3f7;
  border-radius: 8px;
  overflow: hidden;
}
#analysis-bar { width: 0%; height: 100%; background: #00e5ff; transition: width .3s; }

/* ---------- HUD ---------- */
#hud { pointer-events: none; flex-direction: column; justify-content: space-between; align-items: stretch; }
.hud-top, .hud-bottom {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
}
.hud-item {
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 13px;
  font-weight: bold;
  padding: 6px 12px;
  border-radius: 10px;
  text-align: center;
  text-shadow: 1px 1px 0 #000;
}
.hud-item span { font-size: 17px; color: #ffeb3b; }

#hud-message {
  position: fixed;
  top: 38%;
  left: 0; right: 0;
  text-align: center;
  font-size: clamp(26px, 7vw, 48px);
  font-weight: bold;
  color: #ffeb3b;
  text-shadow: 3px 3px 0 #d32f2f, 5px 5px 0 rgba(0,0,0,.4);
  opacity: 0;
  transition: opacity .25s;
}
#hud-message.show { opacity: 1; }

/* Flèches indiquant les canards hors champ (mode AR 360°) */
#arrows { position: fixed; inset: 0; pointer-events: none; }
.duck-arrow {
  position: fixed;
  width: 44px; height: 44px;
  font-size: 34px;
  line-height: 44px;
  text-align: center;
  text-shadow: 2px 2px 0 rgba(0,0,0,.6);
  transition: left .15s linear, top .15s linear;
  animation: arrowPulse .7s infinite;
}
@keyframes arrowPulse { 50% { transform: scale(1.25) rotate(var(--rot, 0deg)); } }

/* ---------- Game over / scores ---------- */
.final-score { color: #fff; font-size: 24px; margin-bottom: 8px; text-shadow: 2px 2px 0 rgba(0,0,0,.4); }
.final-score span { color: #ffeb3b; }
#final-rank { color: #fff; font-size: 15px; margin-bottom: 20px; min-height: 20px; }

.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab {
  flex: 1;
  padding: 10px;
  font-family: inherit;
  font-weight: bold;
  border: 3px solid #263238;
  border-radius: 10px;
  background: #78909c;
  color: #fff;
  cursor: pointer;
}
.tab.active { background: #e53935; border-color: #b71c1c; }

.scores-list {
  background: rgba(255,255,255,.94);
  border: 4px solid #263238;
  border-radius: 12px;
  max-height: 46vh;
  overflow-y: auto;
  margin-bottom: 14px;
  padding: 8px;
}
.score-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 15px;
  font-weight: bold;
  border-bottom: 2px dashed #cfd8dc;
}
.score-row:last-child { border-bottom: none; }
.score-row .rank { color: #e53935; width: 44px; }
.score-row .name { flex: 1; text-align: left; color: #263238; }
.score-row .pts { color: #2e7d32; }
.score-row.me { background: #fff9c4; border-radius: 8px; }
