/* ============================================================
   ELNE 64 : STREET REVOLT 3D — STYLES & RETRO N64 HUD
   ============================================================ */

:root {
  --n64-blue: #002b7f;
  --n64-red: #e52521;
  --n64-green: #009b48;
  --n64-yellow: #fdb813;
  --gold: #ffcc00;
  --dark-bg: #090a10;
  --card-bg: rgba(18, 20, 32, 0.85);
  --neon-cyan: #00f0ff;
  --neon-magenta: #ff007f;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--dark-bg);
  font-family: 'Montserrat', sans-serif;
  color: #fff;
}

#canvas-container {
  width: 100vw;
  height: 100vh;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* --- OVERLAY CRT / N64 FILTER --- */
.crt-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 99;
  display: none;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
  background-size: 100% 3px, 6px 100%;
}
body.crt-active .crt-overlay {
  display: block;
}

/* --- HUD MARIO 64 OFFICIEL --- */
#mario64-hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

/* TOP LEFT : VIES & TÊTE D'ELNE */
.hud-lives-box {
  position: absolute;
  top: 24px;
  left: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.6);
  padding: 8px 16px;
  border-radius: 30px;
  border: 2px solid rgba(255, 204, 0, 0.6);
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.hud-lives-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: #111;
  object-fit: cover;
}

.hud-lives-count {
  font-family: 'Syne', sans-serif;
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  text-shadow: 2px 2px 0 #000, 0 0 10px rgba(255, 204, 0, 0.8);
  letter-spacing: 1px;
}

/* TOP CENTER : CIRCULAR POWER METER MARIO 64 */
.hud-power-meter {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.power-meter-label {
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 3px;
  color: var(--gold);
  text-shadow: 1px 1px 0 #000, 0 0 8px rgba(255, 204, 0, 0.8);
}

.power-wheel {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: radial-gradient(circle, #222 40%, #000 90%);
  border: 3px solid #ffcc00;
  box-shadow: 0 0 16px rgba(255, 204, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.power-pie {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  clip-path: polygon(50% 50%, 50% 0%, 100% 0%, 100% 100%, 0% 100%, 0% 0%, 50% 0%);
}

.power-center-num {
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  z-index: 2;
  text-shadow: 2px 2px 0 #000;
}

/* TOP RIGHT : ÉTOILES & PIÈCES D'OR */
.hud-counters-box {
  position: absolute;
  top: 24px;
  right: 28px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.counter-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.65);
  padding: 8px 18px;
  border-radius: 25px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

.counter-pill.gold {
  border-color: var(--gold);
}

.counter-icon {
  font-size: 24px;
  filter: drop-shadow(0 0 6px rgba(255, 204, 0, 0.8));
}

.counter-val {
  font-family: 'Syne', sans-serif;
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  text-shadow: 2px 2px 0 #000;
}

/* QUICK ACTIONS BAR (TOP CORNER) */
.quick-controls {
  position: absolute;
  top: 84px;
  right: 28px;
  display: flex;
  gap: 8px;
  pointer-events: auto;
  z-index: 20;
}

.btn-pill-hud {
  background: rgba(15, 17, 26, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #eee;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 1px;
  transition: all 0.2s ease;
  backdrop-filter: blur(6px);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.btn-pill-hud:hover {
  background: var(--gold);
  color: #000;
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 204, 0, 0.4);
}

/* FLOATING INTERACTION HINT */
#interaction-hint {
  position: absolute;
  bottom: 85px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(12, 14, 24, 0.94);
  border: 2px solid var(--gold);
  padding: 12px 30px;
  border-radius: 35px;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 1px;
  display: none;
  box-shadow: 0 0 25px rgba(255, 204, 0, 0.6);
  z-index: 50;
  pointer-events: auto;
  cursor: pointer;
  animation: pulseHint 1.2s infinite alternate;
}

#interaction-hint strong {
  color: var(--gold);
  text-shadow: 0 0 10px rgba(255, 204, 0, 0.8);
}

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

/* MISSION BANNER ANNOUNCER */
#mission-banner {
  position: absolute;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.9) 20%, rgba(0, 0, 0, 0.9) 80%, transparent);
  padding: 12px 60px;
  text-align: center;
  border-top: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
#mission-banner.show {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}
#mission-banner h2 {
  font-family: 'Syne', sans-serif;
  font-size: 26px;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 2px 2px 0 #000, 0 0 15px rgba(255, 204, 0, 0.6);
  letter-spacing: 2px;
}
#mission-banner p {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #fff;
  margin-top: 4px;
}

/* STAR CELEBRATION MODAL (STAR GET!) */
#star-celebration {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  pointer-events: auto;
  backdrop-filter: blur(8px);
}

.star-celebration-title {
  font-family: 'Syne', sans-serif;
  font-size: 48px;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 4px 4px 0 #000, 0 0 25px rgba(255, 204, 0, 0.8);
  letter-spacing: 4px;
  margin-bottom: 15px;
  text-align: center;
  animation: bounceTitle 0.6s ease;
}

.star-spin-icon {
  font-size: 96px;
  filter: drop-shadow(0 0 30px var(--gold));
  animation: spinStar 3s linear infinite;
  margin-bottom: 20px;
}

@keyframes spinStar {
  0% { transform: rotateY(0deg) scale(1); }
  50% { transform: rotateY(180deg) scale(1.15); }
  100% { transform: rotateY(360deg) scale(1); }
}

@keyframes bounceTitle {
  0% { transform: scale(0.4); opacity: 0; }
  80% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.star-celebration-sub {
  font-size: 18px;
  font-weight: 700;
  color: #eee;
  margin-bottom: 30px;
  letter-spacing: 2px;
  text-align: center;
}

.btn-continue-star {
  background: linear-gradient(135deg, #ffcc00, #ff9900);
  border: none;
  color: #000;
  padding: 16px 40px;
  font-size: 18px;
  font-weight: 900;
  font-family: 'Syne', sans-serif;
  border-radius: 40px;
  cursor: pointer;
  box-shadow: 0 0 25px rgba(255, 204, 0, 0.7);
  transition: transform 0.2s;
}
.btn-continue-star:hover {
  transform: scale(1.08);
}

/* BOTTOM CONTROLS GUIDE */
.controls-bottom-bar {
  position: absolute;
  bottom: 20px;
  left: 28px;
  display: flex;
  gap: 15px;
  background: rgba(0, 0, 0, 0.6);
  padding: 8px 18px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 11px;
  font-weight: 700;
  color: #ccc;
  letter-spacing: 1px;
}

.key-tag {
  background: #252836;
  color: var(--gold);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #444;
  margin-right: 4px;
}

/* VIRTUAL MOBILE CONTROLS */
#mobile-controls {
  position: absolute;
  bottom: 25px;
  left: 0;
  width: 100%;
  display: none;
  justify-content: space-between;
  padding: 0 30px;
  pointer-events: none;
  z-index: 30;
}

.mobile-dpad-area {
  width: 130px;
  height: 130px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  pointer-events: auto;
  position: relative;
}

.mobile-stick-thumb {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--gold);
  position: absolute;
  top: 40px;
  left: 40px;
  box-shadow: 0 0 15px rgba(255, 204, 0, 0.6);
}

.mobile-buttons-area {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  pointer-events: auto;
}

.btn-mobile-act {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  border: 3px solid var(--gold);
  color: #fff;
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.btn-mobile-act:active {
  transform: scale(0.9);
  background: var(--gold);
  color: #000;
}

/* DIALOG MODAL / NPC TALK */
#dialog-box {
  position: absolute;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 650px;
  background: rgba(10, 12, 20, 0.92);
  border: 3px solid var(--gold);
  border-radius: 12px;
  padding: 18px 24px;
  display: none;
  z-index: 50;
  box-shadow: 0 8px 30px rgba(0,0,0,0.8);
  pointer-events: auto;
}
.dialog-header {
  font-family: 'Syne', sans-serif;
  font-weight: 900;
  font-size: 16px;
  color: var(--gold);
  margin-bottom: 8px;
}
.dialog-body {
  font-size: 15px;
  line-height: 1.5;
  color: #eee;
}
.dialog-footer {
  text-align: right;
  margin-top: 10px;
  font-size: 12px;
  color: #aaa;
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
  #mobile-controls {
    display: flex;
  }
  .controls-bottom-bar {
    display: none;
  }
  .hud-lives-box {
    top: 12px;
    left: 12px;
    padding: 6px 12px;
  }
  .hud-counters-box {
    top: 12px;
    right: 12px;
    gap: 8px;
  }
  .counter-pill {
    padding: 6px 12px;
  }
  .quick-controls {
    top: 70px;
    right: 12px;
  }
}
