@font-face {
  font-family: 'Geist';
  src: url('../fonts/Geist-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('../fonts/GeistMono-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

/* Mêmes repères que l'accueil */
:root {
  --bg: #071419;
  --surface: #0c1f27;
  --line: rgb(214 236 242 / 0.12);
  --text: #e4eef0;
  --muted: #92a8ae;
  --accent: #f2b544;
  --accent-ink: #231703;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
  font-family: 'Geist', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
#app canvas { display: block; touch-action: none; }

/* --- Interface pendant la visite --- */
#hud { position: fixed; inset: 0; pointer-events: none; text-shadow: 0 1px 3px rgb(0 0 0 / 0.7); }
#hud .top-left { position: absolute; top: max(16px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left)); }
#hud .bottom-left { position: absolute; bottom: max(16px, env(safe-area-inset-bottom)); left: max(16px, env(safe-area-inset-left)); }
#hud h1 { margin: 0; font-size: 16px; font-weight: 600; }
#hud p { margin: 2px 0; color: var(--muted); font-size: 13px; }
#hud #place { color: var(--text); font-size: 15px; font-weight: 550; }
#hud #depth { font-family: 'Geist Mono', monospace; color: var(--accent); }
#crosshair {
  position: absolute; top: 50%; left: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px;
  border-radius: 50%; background: rgb(255 255 255 / 0.7);
}
#look {
  position: absolute; top: calc(50% + 18px); left: 50%; transform: translateX(-50%);
  color: var(--text) !important; font-size: 15px !important; white-space: nowrap;
}
body.propre #hud, body.propre #touch { display: none; }

/* --- Écran de départ / pause --- */
#overlay {
  position: fixed; inset: 0; z-index: 3;
  display: grid; place-items: center;
  padding: 16px;
  overflow-y: auto;
  background: rgb(7 20 25 / 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
#overlay.hidden { display: none; }
/* Double bord : un liseré clair à 6 px autour de la carte */
.card {
  width: min(440px, 100%);
  padding: 22px 0 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 0 0 6px rgb(214 236 242 / 0.03), inset 0 1px 0 rgb(255 255 255 / 0.05);
}
.card > * { margin-left: 22px; margin-right: 22px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; text-decoration: none; }
.back:hover { color: var(--text); }
.card h2 { margin-top: 18px; margin-bottom: 18px; font-size: 32px; font-weight: 600; letter-spacing: -0.03em; }
.card label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.card select {
  display: block; width: calc(100% - 44px);
  padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text);
  font: inherit; font-size: 15px;
}
#start {
  display: block; width: calc(100% - 44px);
  margin-top: 14px; min-height: 50px;
  border: 0; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  font: inherit; font-size: 16px; font-weight: 600;
  cursor: pointer;
  transition: transform 0.3s var(--ease), background 0.3s var(--ease);
}
#start:hover { background: #f6c362; }
#start:active { transform: scale(0.98); }
#start:disabled { opacity: 0.5; cursor: wait; }
.status { margin-top: 10px; margin-bottom: 0; font-size: 13px; color: var(--muted); }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; align-items: center; margin-top: 22px; margin-bottom: 0; font-size: 14px; }
.keys dt { display: flex; gap: 4px; color: var(--muted); font-size: 20px; }
.keys dd { margin: 0; color: #c3d3d6; }
kbd {
  min-width: 26px; padding: 2px 7px;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px;
  background: var(--bg); color: var(--text);
  font-family: 'Geist Mono', monospace; font-size: 12px; text-align: center;
}
.hint { margin-top: 18px; margin-bottom: 0; font-size: 13px; color: var(--muted); }
.only-touch { display: none; }
@media (pointer: coarse) {
  .only-touch { display: grid; }
  .only-mouse { display: none; }
}

/* --- Commandes tactiles --- */
#touch { position: fixed; inset: 0; z-index: 2; touch-action: none; user-select: none; -webkit-user-select: none; }
#touch[hidden] { display: none; }
.touch-look { position: absolute; inset: 0; }
.touch-move {
  position: absolute; z-index: 1;
  left: max(24px, env(safe-area-inset-left)); bottom: max(40px, calc(env(safe-area-inset-bottom) + 24px));
  width: 128px; height: 128px;
  border: 1px solid rgb(214 236 242 / 0.25); border-radius: 50%;
  background: rgb(7 20 25 / 0.25);
}
.touch-move__knob {
  position: absolute; left: 50%; top: 50%;
  width: 56px; height: 56px; margin: -28px 0 0 -28px;
  border-radius: 50%;
  background: rgb(228 238 240 / 0.6);
  transition: transform 0.25s var(--ease);
}
.touch-move.is-active .touch-move__knob { transition: none; }
.touch-buttons {
  position: absolute; z-index: 1;
  right: max(20px, env(safe-area-inset-right)); bottom: max(40px, calc(env(safe-area-inset-bottom) + 24px));
  display: grid; gap: 14px;
}
.touch-buttons button, .touch-pause {
  display: grid; place-items: center;
  width: 60px; height: 60px;
  border: 1px solid rgb(214 236 242 / 0.25); border-radius: 50%;
  background: rgb(7 20 25 / 0.35); color: var(--text);
  font-size: 26px;
}
.touch-buttons button.is-active { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.touch-pause {
  position: absolute; z-index: 1;
  top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right));
  width: 44px; height: 44px; font-size: 20px;
}

@media (max-width: 767px) {
  #hud h1 { font-size: 14px; }
  #hud .top-left { max-width: calc(100% - 80px); }
  #look { font-size: 13px !important; }
}
