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

body {
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-family: monospace;
  overflow: hidden;
}

/* ── Password gate ── */
#password-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 24px;
}

#password-gate.hidden {
  display: none;
}

.gate-logo {
  width: 280px;
  max-width: 70vw;
}

#gate-form {
  display: flex;
  gap: 8px;
}

#gate-input {
  background: #111;
  border: 1px solid #444;
  border-radius: 4px;
  color: #e0e0e0;
  font-family: monospace;
  font-size: 14px;
  padding: 8px 14px;
  outline: none;
  width: 200px;
}

#gate-input:focus {
  border-color: #888;
}

.gate-btn {
  background: #222;
  border: 1px solid #444;
  border-radius: 4px;
  color: #e0e0e0;
  font-family: monospace;
  font-size: 14px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.gate-btn:hover {
  background: #333;
}

#gate-error {
  color: #ff4444;
  font-family: monospace;
  font-size: 13px;
  min-height: 1em;
}

/* ── Preloader ── */
#preloader {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: #000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 24px;
  transition: opacity 0.6s ease;
}

#preloader.done {
  opacity: 0;
  pointer-events: none;
}

.preloader-logo {
  width: 320px;
  max-width: 80vw;
  animation: logoPulse 1.5s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.03); }
}

.preloader-bar-track {
  width: 260px;
  max-width: 60vw;
  height: 12px;
  background: #222;
  border: 2px solid #444;
  image-rendering: pixelated;
}

.preloader-bar-fill {
  height: 100%;
  width: 0%;
  background: #fff;
  transition: width 0.3s steps(10);
}

.preloader-text {
  color: #666;
  font-family: monospace;
  font-size: 14px;
  letter-spacing: 2px;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ── Logo flottant ── */
#floating-logo {
  position: fixed;
  top: 16px;
  left: 16px;
  width: 120px;
  z-index: 20;
  opacity: 0.9;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.6));
  transition: opacity 0.2s;
  pointer-events: none;
}

/* ── Map container (plein écran) ── */
#map-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: #000;
  overflow: hidden;
}

/* ── Wrapper : zoomable, image+SVG calés ── */
#map-wrapper {
  position: relative;
  transform-origin: 0 0;
  will-change: transform;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  image-rendering: pixelated;
}

#map-image {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

/* ── Placeholder coloré (salles sans image) ── */
.map-placeholder {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 32px;
}

.placeholder-label {
  color: rgba(255, 255, 255, 0.3);
  font-family: monospace;
  font-size: 28px;
  letter-spacing: 4px;
  text-transform: uppercase;
}

/* ── SVG overlay : calé sur le wrapper ── */
#map-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* ── Zones cliquables ── */
.zone {
  fill: rgba(255, 255, 255, 0.08);
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 2;
  cursor: pointer;
  transition: fill 0.2s, stroke 0.2s;
}

.zone:hover {
  fill: rgba(255, 255, 100, 0.25);
  stroke: rgba(255, 255, 100, 0.7);
  stroke-width: 2.5;
}

/* ── Curseur personnalisé au survol des zones ── */
.zone { cursor: crosshair; }

/* ── Tooltip ── */
#tooltip {
  position: absolute;
  background: #0f0f23;
  color: #e0e0e0;
  padding: 6px 12px;
  border: 1px solid #444;
  border-radius: 4px;
  font-size: 14px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  white-space: nowrap;
}

#tooltip.visible {
  opacity: 1;
}

/* ── Bouton retour ── */
#back-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10;
  background: #0f0f23;
  color: #e0e0e0;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 6px 14px;
  font-family: monospace;
  font-size: 14px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, background 0.2s;
}

#back-btn.visible {
  opacity: 1;
  pointer-events: auto;
}

#back-btn:hover {
  background: #2a2a4e;
}

/* ── Transition RPG (overlay noir plein écran) ── */
#transition-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

#transition-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ── Panel d'informations ── */
#info-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  height: 100vh;
  background: #0f0f23;
  border-left: 1px solid #444;
  padding: 24px;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#info-panel.open {
  transform: translateX(0);
}

.panel-close {
  align-self: flex-end;
  background: none;
  border: 1px solid #444;
  border-radius: 4px;
  color: #e0e0e0;
  font-size: 20px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.panel-close:hover {
  background: #2a2a4e;
}

.panel-title {
  color: #fff;
  font-family: monospace;
  font-size: 20px;
  margin: 0;
}

.panel-desc {
  color: #b0b0b0;
  font-family: monospace;
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  #info-panel {
    width: 100%;
    height: auto;
    max-height: 50vh;
    top: auto;
    bottom: 0;
    right: 0;
    border-left: none;
    border-top: 1px solid #444;
    border-radius: 12px 12px 0 0;
    transform: translateY(100%);
  }

  #info-panel.open {
    transform: translateY(0);
  }

  #back-btn {
    font-size: 12px;
    padding: 5px 10px;
  }

  #tooltip {
    font-size: 12px;
  }

  .placeholder-label {
    font-size: 18px;
  }
}

@media (max-width: 400px) {
  .panel-title { font-size: 16px; }
  .panel-desc { font-size: 12px; }
}
