/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: #0c0c0c;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #fff;
}

/* ── Viewer ──────────────────────────────────────────────────────────────── */
#viewer {
  position: fixed;
  inset: 0;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

#viewer.dragging {
  cursor: grabbing;
}

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

/* ── Écran de chargement ─────────────────────────────────────────────────── */
#loading {
  position: fixed;
  inset: 0;
  background: #0c0c0c;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  z-index: 200;
}

#loading-label {
  font-size: clamp(0.85rem, 2.5vw, 1.1rem);
  font-weight: 300;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

#loading-track {
  width: min(300px, 65vw);
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  position: relative;
}

#loading-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: #b8965a;
  transition: width 0.08s linear;
  transform-origin: left;
}

#loading-pct {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.3);
  font-variant-numeric: tabular-nums;
}

/* Transition pilotée par JS via style.transition */
#loading { transition: opacity 0.7s ease; }
#hint    { transition: opacity 0.5s ease; }

/* ── Indication de glissement ────────────────────────────────────────────── */
#hint {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 9px 18px 9px 14px;
  border-radius: 100px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.65);
  pointer-events: none;
  opacity: 0;
  white-space: nowrap;
  z-index: 10;
}

/* ── Scrubber ────────────────────────────────────────────────────────────── */
#scrubber {
  position: fixed;
  bottom: 56px;
  left: 50%;
  transform: translateX(-50%);
  width: min(440px, 78vw);
  height: 24px;
  display: flex;
  align-items: center;
  cursor: pointer;
  z-index: 10;
}

#scrub-track {
  position: relative;
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 1px;
}

#scrub-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  background: #b8965a;
  border-radius: 1px;
  transition: width 0.05s linear;
}

#scrub-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 10px;
  height: 10px;
  background: #b8965a;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: left 0.05s linear, transform 0.15s ease;
  box-shadow: 0 0 0 3px rgba(184, 150, 90, 0.2);
}

#scrubber:hover #scrub-thumb {
  transform: translate(-50%, -50%) scale(1.5);
}

/* ── Barre de contrôles ──────────────────────────────────────────────────── */
#controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 20px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, transparent 100%);
  z-index: 10;
}

.ctrl-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.75);
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
}

.ctrl-btn.active {
  background: rgba(184, 150, 90, 0.2);
  border-color: rgba(184, 150, 90, 0.7);
  color: #b8965a;
}

/* ── Sélecteur de vue ────────────────────────────────────────────────────── */
#view-selector {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 20;
}

.ctrl-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 14px 0 16px;
  border-radius: 100px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(15, 15, 15, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  color: rgba(255, 255, 255, 0.85);
  font-family: inherit;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.ctrl-pill:hover {
  background: rgba(30, 30, 30, 0.8);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

#view-selector.open .ctrl-pill {
  background: rgba(15, 15, 15, 0.7);
  border-color: rgba(184, 150, 90, 0.6);
  color: #d6b67d;
}

#view-chevron {
  transition: transform 0.25s ease;
  opacity: 0.7;
}

#view-selector.open #view-chevron {
  transform: rotate(180deg);
}

#view-options {
  position: absolute;
  top: 46px;
  left: 0;
  list-style: none;
  margin: 0;
  padding: 6px;
  min-width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(15, 15, 15, 0.7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 14px;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#view-selector.open #view-options {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.view-opt {
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.view-opt:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.view-opt.active {
  color: #d6b67d;
}

.view-opt.active::before {
  content: '· ';
  color: #d6b67d;
}

/* ── Étiquettes HUD ──────────────────────────────────────────────────────── */
#label-frame {
  position: fixed;
  bottom: 14px;
  right: 18px;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.25);
  font-variant-numeric: tabular-nums;
  z-index: 10;
}

#label-quality {
  position: fixed;
  top: 22px;
  right: 62px;
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  color: rgba(255, 255, 255, 0.2);
  z-index: 10;
  transition: color 0.5s;
}

#label-quality.hd {
  color: rgba(184, 150, 90, 0.5);
}

/* ── Bouton plein écran ───────────────────────────────────────────────────── */
#btn-fullscreen {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 10;
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(15, 15, 15, 0.7);
}

#btn-fullscreen:hover {
  background: rgba(30, 30, 30, 0.8);
  border-color: rgba(255, 255, 255, 0.35);
}
