/* =========================================================================
   NEXUS TRAVEL — 3D Office Visit
   Brand palette : Navy #1a2855 · Gold #c9a961 · Cream #f2ece1
   ========================================================================= */

:root {
  --navy: #1a2855;
  --navy-deep: #0f1830;
  --gold: #c9a961;
  --gold-light: #d4b97a;
  --cream: #f2ece1;
  --white: #ffffff;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--navy-deep);
  color: var(--cream);
  -webkit-font-smoothing: antialiased;
}

canvas { display: block; }

/* ---------- Loading screen ---------- */
#loader {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-deep) 100%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 100;
  transition: opacity 0.6s ease;
}
#loader.hidden { opacity: 0; pointer-events: none; }

.brand-mark {
  display: flex; align-items: center; gap: 18px;
  margin-bottom: 30px;
}
.brand-mark svg { width: 78px; height: 78px; }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-text .b1 { font-size: 42px; font-weight: 800; letter-spacing: 4px; color: var(--white); }
.brand-text .b2 { font-size: 22px; font-weight: 300; letter-spacing: 8px; color: var(--gold); margin-top: 6px; }

.bar { width: 240px; height: 2px; background: rgba(201,169,97,0.2); overflow: hidden; border-radius: 2px; }
.bar > span { display: block; height: 100%; width: 0%; background: var(--gold); transition: width 0.3s; }

.subtitle { margin-top: 22px; font-size: 13px; letter-spacing: 3px; color: rgba(255,255,255,0.55); text-transform: uppercase; }

/* ---------- Start prompt ---------- */
#start-screen {
  position: fixed; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(15,24,48,0.55) 0%, rgba(15,24,48,0.92) 100%);
  z-index: 50;
  cursor: pointer;
  transition: opacity 0.4s;
}
#start-screen.visible { display: flex; }
#start-screen.fading { opacity: 0; }

.panel {
  background: rgba(20,32,68,0.85);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(201,169,97,0.35);
  border-radius: 18px;
  padding: 46px 56px;
  max-width: 520px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}
.panel h1 {
  font-size: 26px; font-weight: 700; letter-spacing: 6px;
  color: var(--white); margin-bottom: 6px;
}
.panel .sub {
  font-size: 12px; letter-spacing: 4px; color: var(--gold);
  text-transform: uppercase; margin-bottom: 28px;
}
.panel p { font-size: 14px; line-height: 1.7; color: rgba(255,255,255,0.75); margin-bottom: 26px; }

.controls-grid {
  display: grid; grid-template-columns: auto 1fr; gap: 10px 16px;
  text-align: left; margin: 0 auto 26px; max-width: 320px;
  font-size: 13px; color: rgba(255,255,255,0.8);
}
.controls-grid kbd {
  background: rgba(201,169,97,0.15);
  border: 1px solid rgba(201,169,97,0.4);
  border-radius: 5px;
  padding: 3px 9px;
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 11px;
  color: var(--gold-light);
  min-width: 40px;
  text-align: center;
  display: inline-block;
}

.cta {
  display: inline-block;
  padding: 14px 44px;
  background: var(--gold);
  color: var(--navy-deep);
  font-size: 13px; font-weight: 700; letter-spacing: 3px;
  text-transform: uppercase;
  border-radius: 30px;
  border: none; cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 6px 24px rgba(201,169,97,0.35);
}
.cta:hover { background: var(--gold-light); transform: translateY(-2px); box-shadow: 0 10px 30px rgba(201,169,97,0.5); }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }

#crosshair {
  position: absolute; top: 50%; left: 50%;
  width: 10px; height: 10px;
  margin: -5px 0 0 -5px;
  border: 1.5px solid rgba(255,255,255,0.6);
  border-radius: 50%;
  mix-blend-mode: difference;
}

#zone-tag {
  position: absolute; top: 28px; left: 50%;
  transform: translateX(-50%);
  background: rgba(15,24,48,0.75);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(201,169,97,0.4);
  border-radius: 30px;
  padding: 8px 22px;
  font-size: 12px; letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--gold-light);
  transition: opacity 0.4s, transform 0.4s;
  opacity: 0;
}
#zone-tag.visible { opacity: 1; }

#minimap {
  position: absolute; bottom: 24px; right: 24px;
  width: 180px; height: 268px;
  background: rgba(15,24,48,0.78);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(201,169,97,0.35);
  border-radius: 14px;
  padding: 12px;
}
#minimap canvas { width: 100%; height: 100%; display: block; }

#hint {
  position: absolute; bottom: 24px; left: 24px;
  background: rgba(15,24,48,0.78);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(201,169,97,0.25);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 11px; letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
}
#hint kbd {
  background: rgba(201,169,97,0.2);
  border-radius: 3px;
  padding: 2px 6px;
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 10px;
  color: var(--gold-light);
  margin: 0 2px;
}

/* ---------- Brand watermark ---------- */
#mark {
  position: absolute; top: 22px; left: 24px;
  display: flex; align-items: center; gap: 10px;
}
#mark svg { width: 32px; height: 32px; }
#mark .t1 { font-size: 16px; font-weight: 800; letter-spacing: 3px; color: var(--white); }
#mark .t2 { font-size: 10px; font-weight: 300; letter-spacing: 5px; color: var(--gold); margin-top: 2px; }
#mark .tx { display: flex; flex-direction: column; line-height: 1; }

/* ---------- Joystick virtuel tactile ---------- */
#joystick {
  position: fixed;
  width: 120px; height: 120px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s;
  z-index: 20;
}
#joystick.visible { opacity: 1; }
#joy-base {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: rgba(15,24,48,0.40);
  border: 2px solid rgba(201,169,97,0.55);
  backdrop-filter: blur(8px);
}
#joy-knob {
  position: absolute;
  top: 50%; left: 50%;
  width: 50px; height: 50px;
  margin: -25px 0 0 -25px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  transition: transform 0.05s linear;
}

/* ---------- Affichage conditionnel desktop/mobile ---------- */
.mobile-only { display: none; }
body.touch .desktop-only { display: none; }
body.touch .mobile-only   { display: grid; }
body.touch #hint.mobile-only { display: block; }

/* Sur tactile : masquer le crosshair (gestion par drag) */
body.touch #crosshair { opacity: 0.3; }

/* ---------- Responsive mobile ---------- */
@media (max-width: 768px) {
  .panel { padding: 32px 28px; max-width: 90vw; }
  .panel h1 { font-size: 22px; letter-spacing: 4px; }
  .panel .sub { font-size: 11px; letter-spacing: 3px; }
  .panel p { font-size: 13px; }
  .controls-grid { font-size: 12px; max-width: 280px; }
  .cta { padding: 12px 32px; font-size: 12px; }

  #mark svg { width: 26px; height: 26px; }
  #mark .t1 { font-size: 13px; letter-spacing: 2px; }
  #mark .t2 { font-size: 9px; letter-spacing: 4px; }

  #minimap {
    width: 110px; height: 164px;
    padding: 8px;
    bottom: 16px; right: 16px;
  }
  #hint {
    font-size: 10px; letter-spacing: 1px;
    bottom: 16px; left: 16px;
    padding: 8px 12px;
    max-width: calc(100vw - 150px);
  }
  #zone-tag { font-size: 10px; letter-spacing: 3px; padding: 6px 14px; top: 14px; }
}

/* iPhone notch safe area */
@supports(padding: max(0px)) {
  #mark { top: max(22px, env(safe-area-inset-top, 22px)); left: max(24px, env(safe-area-inset-left, 24px)); }
  #minimap { bottom: max(24px, env(safe-area-inset-bottom, 24px)); right: max(24px, env(safe-area-inset-right, 24px)); }
}
