@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600&family=Inter:wght@300;400;500&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:         #0a0a0f;
  --surface:    #111118;
  --surface2:   #1a1a2e;
  --border:     #2a2a4a;
  --gold:       #c8a96e;
  --gold-dim:   #7a6340;
  --text:       #f0f0f0;
  --text-muted: #7a7a9a;
  --text-dim:   #4a4a6a;
  --radius:     10px;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* ── Layout ── */

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

/* ── Header ── */

#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#header-logo {
  height: 36px;
  width: auto;
  /* logo noir sur fond sombre : inversion pour lisibilité */
  filter: invert(1) brightness(0.85) sepia(0.2) hue-rotate(10deg);
}

#header-meta {
  display: flex;
  align-items: center;
  gap: 20px;
}

#product-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text);
}

#build-version {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
}

/* ── Canvas zone ── */

#unity-container {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #000;
  container-type: size; /* ← active les container queries */
}

#unity-canvas {
  display: block;
  aspect-ratio: 16 / 9;
  /* S'étire au max sans dépasser le conteneur */
  max-width: min(100cqw, 100cqh * (16/9));
  max-height: min(100cqh, 100cqw * (9/16));
  width:  min(100cqw, 100cqh * (16/9));
  height: min(100cqh, 100cqw * (9/16));
}

/* ── Loading overlay ── */

#loading-overlay {
  position: absolute;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  transition: opacity 0.5s ease;
  z-index: 10;
}

#loading-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

#loading-logo {
  height: 52px;
  width: auto;
  filter: invert(1) brightness(0.85) sepia(0.2) hue-rotate(10deg);
  opacity: 0.9;
}

#loading-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

#progress-track {
  width: 260px;
  height: 2px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

#progress-fill {
  height: 100%;
  width: 0%;
  background: var(--gold);
  border-radius: 2px;
  transition: width 0.25s ease;
  position: relative;
}

/* Scanline animé — signature visuelle */
#progress-fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: -3px;
  width: 3px;
  height: 8px;
  background: #fff;
  border-radius: 2px;
  opacity: 0.9;
  box-shadow: 0 0 6px rgba(200, 169, 110, 0.8);
}

#progress-percent {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--gold);
  letter-spacing: 0.06em;
  min-width: 36px;
  text-align: center;
}

/* Scanline canvas overlay (VR init effect) */
#scanline {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0,0,0,0.08) 3px,
    rgba(0,0,0,0.08) 4px
  );
  animation: scanline-fade 2s ease forwards;
}

@keyframes scanline-fade {
  0%   { opacity: 0.6; }
  100% { opacity: 0; }
}

/* ── Footer ── */

#footer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 32px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  gap: 6px;
}

#footer span {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

#footer .sep {
  color: var(--border);
}

/* ── Erreur ── */

#unity-error {
  display: none;
  position: absolute;
  inset: 0;
  background: var(--bg);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  z-index: 20;
  text-align: center;
  padding: 32px;
}

#unity-error.visible {
  display: flex;
}

#unity-error h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
}

#unity-error p {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 420px;
}

#unity-error code {
  font-size: 12px;
  color: #e06c6c;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 14px;
  display: block;
  max-width: 500px;
  word-break: break-all;
}

/* ── Responsive ── */

@media (max-width: 600px) {
  #header {
    padding: 14px 20px;
  }
  #footer {
    padding: 10px 20px;
  }
  #progress-track {
    width: 200px;
  }
}
