:root {
  --gaston-green: #0a7d5b;
  --gaston-green-light: #22c55e;
  --gaston-end-green: #064e3b;
  --gaston-end-green-light: #0a7d5b;
  --gaston-ink: #080d11;
  --gaston-white: #f8faf9;
  --gaston-muted: #d7dfdc;
  --gaston-reference-width: 718;
  --gaston-reference-height: 1280;
  --gaston-control-width: 75vw;
}

body {
  background: var(--gaston-ink);
}

#start-gate {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  box-sizing: border-box;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  padding: 0;
  text-align: center;
}

#idle-video {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  background: var(--gaston-ink);
}

#start-conv-btn {
  position: absolute;
  top: 64.53vh;
  left: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--gaston-control-width);
  height: 7.9vh;
  min-height: 0;
  box-sizing: border-box;
  padding: 1.33vh 2.8vw;
  transform: translateX(-50%);
  border: 2px solid rgba(255, 255, 255, .82);
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--gaston-green), var(--gaston-green-light));
  box-shadow: 0 10px 30px rgba(0, 0, 0, .42);
  font: inherit;
  font-size: 4.8vw;
  font-weight: 800;
  line-height: 1.15;
  white-space: nowrap;
  cursor: pointer;
  animation: none;
  -webkit-tap-highlight-color: transparent;
}

#start-conv-btn svg {
  flex: 0 0 auto;
  width: 8.5vw;
  height: 8.5vw;
  margin-right: 2.23vw;
}

#start-conv-btn:hover,
#start-conv-btn:active {
  transform: translateX(-50%) scale(1.025);
}

#start-conv-btn:focus-visible,
.lang-flag:focus-visible {
  outline: 4px solid rgba(255, 255, 255, .95);
  outline-offset: 4px;
}

#start-gate .gate-hint {
  position: absolute;
  top: 76.25vh;
  left: 50%;
  width: 72.4vw;
  max-width: none;
  box-sizing: border-box;
  padding: 1.25vh 2.8vw;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 2.6vw;
  color: var(--gaston-white) !important;
  background: rgba(3, 8, 12, .82);
  box-shadow: 0 .45vh 1.5vh rgba(0, 0, 0, .3);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  transform: translateX(-50%);
  font-size: 2.79vw;
  font-weight: 600;
  line-height: 1.35;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .82) !important;
}

#lang-picker {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: none;
  box-sizing: border-box;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  padding: 0;
  overflow: hidden;
  text-align: center;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#lang-picker .lp-title {
  position: absolute;
  isolation: isolate;
  top: 11.1vh;
  left: 51.25%;
  width: 82vw;
  transform: translateX(-50%);
  color: var(--gaston-white);
  font-size: 5.57vw;
  font-weight: 800;
  line-height: 1.25;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .58);
}

#lang-picker .lp-title span {
  position: relative;
  top: .39vh;
  color: var(--gaston-green-light);
  font-size: 4.18vw;
  font-weight: 700;
  opacity: 1;
}

#lang-row {
  position: absolute;
  top: 24.2vh;
  left: 50.85%;
  display: grid;
  grid-template-columns: repeat(4, 15.6vw);
  gap: 1.35vh 1.25vw;
  max-width: none;
  transform: translateX(-50%);
}

.lang-flag {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .48vh;
  width: 15.6vw;
  height: 7.63vh;
  min-height: 0;
  box-sizing: border-box;
  padding: .82vh .9vw .68vh;
  border: 1px solid rgba(255, 255, 255, .85);
  border-radius: 1.65vw;
  color: #0b1220;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .38);
  font: inherit;
  font-size: clamp(10px, 1.48vw, 16px);
  font-weight: 800;
  line-height: 1.15;
  cursor: pointer;
  animation: none;
  transition: transform .12s ease, box-shadow .12s ease;
  -webkit-tap-highlight-color: transparent;
}

.lang-flag img {
  display: block;
  width: 7.1vw;
  height: 2.82vh;
  object-fit: cover;
  border-radius: .55vw;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .32);
}

.lang-flag:hover,
.lang-flag:active {
  transform: scale(1.035);
  box-shadow: 0 15px 38px rgba(0, 0, 0, .45);
}

#lang-picker .lp-pilot-note {
  position: absolute;
  top: 47.7vh;
  left: 50%;
  width: 82vw;
  box-sizing: border-box;
  transform: translateX(-50%);
  color: var(--gaston-white);
  text-align: center;
  pointer-events: none;
}

#lang-picker .lp-pilot-title {
  margin: 0;
  /* MEME VERT QUE « Choose your language ». Le #1aa37a precedent tirait vers le
     turquoise et rompait la charte : sur la reference de design, les deux textes
     portent exactement la meme teinte (mesuree #18c354 / #19b855 = --gaston-green-light). */
  color: var(--gaston-green-light);
  font-size: clamp(30px, 4.3vw, 47px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -.015em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .45);
}

#lang-picker .lp-pilot-title span {
  display: block;
}

#lang-picker .lp-pilot-rule {
  width: 44vw;
  height: clamp(2px, .18vh, 3px);
  margin: 1.6vh auto 3.2vh;
  border-radius: 999px;
  background: var(--gaston-green-light);
}

#lang-picker .lp-pilot-copy {
  width: 66vw;
  margin: 0 auto;
  color: #fff;
  font-size: clamp(23px, 3.45vw, 38px);
  font-weight: 400;
  line-height: 1.32;
  letter-spacing: .005em;
}

#lang-picker .lp-pilot-copy p {
  margin: 0;
}

#lang-picker .lp-pilot-copy p + p {
  margin-top: 2.15vh;
}

#lang-picker .lp-pilot-copy strong {
  font-weight: 600;
}

body[data-gaston-state="languages"] #lang-picker .humanova-signature {
  display: none;
}

.humanova-signature {
  position: absolute;
  top: 88.28vh;
  left: 50%;
  width: 36.25vw;
  height: auto;
  margin: 0;
  transform: translateX(-50%);
}

#connection-promo-layer {
  position: fixed;
  inset: 0;
  z-index: 48;
  display: none;
  overflow: hidden;
  background: #03070b;
}

#connection-promo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#avatar-video.gaston-live-prepared {
  display: block !important;
  opacity: 0;
}

#avatar-video.gaston-live-visible {
  opacity: 1;
}

.loading {
  position: fixed;
  top: 70.16vh;
  left: 48.3%;
  bottom: auto;
  z-index: 50;
  display: none;
  width: 65.5vw;
  height: 7.81vh;
  min-width: 0;
  min-height: 0;
  max-width: none;
  box-sizing: border-box;
  padding: 1.33vh 4.18vw;
  transform: translateX(-50%);
  border: 2px solid rgba(255, 255, 255, .76);
  border-radius: 2.51vw;
  color: #fff;
  background: linear-gradient(135deg, var(--gaston-green), var(--gaston-green-light));
  box-shadow: 0 8px 26px rgba(0, 0, 0, .42);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  font-size: 4.6vw;
  font-weight: 800;
  letter-spacing: .035em;
  line-height: 1.05;
  text-align: center;
}

.loading .loading-sub {
  display: block;
  margin-top: 2px;
  font-size: 3vw;
  font-weight: 600;
  letter-spacing: .03em;
  line-height: 1.1;
  opacity: .92;
}

body[data-gaston-state="idle"] #start-gate,
body[data-gaston-state="languages"] #start-gate,
body[data-gaston-state="waiting"] #start-gate,
body[data-gaston-state="error"] #start-gate {
  display: flex;
}

body[data-gaston-state="languages"] #lang-picker {
  display: flex;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body[data-gaston-state="languages"] #start-conv-btn,
body[data-gaston-state="languages"] #start-gate .gate-hint {
  display: none;
}

/* CE QUI ECLAIRE REELLEMENT L'ECRAN DES LANGUES, c'est #bg-blur : une copie
   floutee de la video idle posee en z-index 0, donc DEVANT #idle-video (z-index
   -1), a opacite .85. Baisser #idle-video seul ne changeait quasiment rien —
   mesure a l'appui : luma mediane 65 -> 61 pour un passage de .22 a .08. Le fond
   ambiant est le seul levier efficace. */
body[data-gaston-state="languages"] #bg-blur {
  opacity: .18;
}

body[data-gaston-state="languages"] #idle-video {
  /* L'avatar doit rester une PRESENCE, pas une image lisible : le texte du
     selecteur passe devant lui. A .22 il ressortait environ trois fois trop
     (luma mediane mesuree 53-75 contre 13-25 sur la reference de design) et le
     beret, le visage et le manteau restaient parfaitement identifiables. */
  opacity: .05;
}

body[data-gaston-state="promo"] #connection-promo-layer,
body[data-gaston-transition^="promo-to-"] #connection-promo-layer {
  display: block;
}

body[data-gaston-transition^="promo-to-"] #connection-promo-layer {
  z-index: 60;
  opacity: 0;
  transition: opacity 700ms cubic-bezier(.22, .61, .36, 1);
}

@media (prefers-reduced-motion: reduce) {
  body[data-gaston-transition^="promo-to-"] #connection-promo-layer {
    transition-duration: 0ms;
  }
}

body[data-gaston-state="waiting"] #loading-msg,
body[data-gaston-state="error"] #loading-msg {
  display: block;
}

body[data-gaston-state="waiting"] #start-conv-btn,
body[data-gaston-state="waiting"] #start-gate .gate-hint,
body[data-gaston-state="error"] #start-conv-btn,
body[data-gaston-state="error"] #start-gate .gate-hint {
  display: none;
}

body[data-gaston-state="promo"] #start-gate,
body[data-gaston-state="live"] #start-gate,
body[data-gaston-state="live"] #lang-picker,
body[data-gaston-state="live"] #loading-msg {
  display: none;
}

body[data-gaston-state="live"]:not([data-gaston-transition]) #connection-promo-layer {
  display: none;
}

#vda-dock {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: 8.98vh;
  z-index: 9999;
  display: flex;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  flex-direction: column;
  align-items: center;
  gap: 1.25vh;
  padding: 0;
  transform: translateX(-50%);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#vda-dock .interrupt-btn,
#vda-dock #hmnv-end-btn {
  position: static;
  width: auto;
  min-width: 0;
  min-height: 0;
  height: 5.08vh;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  gap: 1vw;
  margin: 0;
  padding: .94vh 3.06vw;
  transform: none;
  border: 2px solid rgba(255, 255, 255, .78) !important;
  border-radius: 999px;
  color: #fff !important;
  box-shadow: 0 7px 22px rgba(0, 0, 0, .38);
  font-size: 3.5vw;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: .01em;
  text-transform: uppercase;
  animation: none;
}

#vda-dock .interrupt-btn {
  position: relative;
  top: auto !important;
  bottom: auto !important;
  left: -.85vw;
  width: 61.7vw;
  background: linear-gradient(135deg, var(--gaston-green), var(--gaston-green-light)) !important;
  font-size: 3.58vw;
}

#vda-dock #hmnv-end-btn {
  width: 74.4vw;
  background: linear-gradient(135deg, var(--gaston-end-green), var(--gaston-end-green-light)) !important;
}

#vda-dock .interrupt-btn:hover,
#vda-dock .interrupt-btn:active,
#vda-dock #hmnv-end-btn:hover,
#vda-dock #hmnv-end-btn:active {
  transform: scale(1.02);
}

#vda-dock .interrupt-btn svg,
#vda-dock #hmnv-end-btn svg {
  flex: 0 0 auto;
  width: 4.18vw;
  height: 4.18vw;
}

#vda-dock .interrupt-btn svg {
  width: 6.46vw;
  height: 6.46vw;
}

#vda-dock #hmnv-end-btn svg {
  width: 5.14vw;
  height: 5.14vw;
}

#vda-dock #vda-subtitle {
  width: 74.4vw;
  box-sizing: border-box;
  margin-bottom: 4px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 14px;
  background: rgba(3, 8, 12, .82);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  box-shadow: 0 7px 22px rgba(0, 0, 0, .38);
  min-height: calc(4.05em + 22px);
  max-height: calc(4.05em + 22px);
}

@media (max-width: 520px) {
  #vda-dock #vda-subtitle {
    padding: 9px 12px !important;
    min-height: calc(4.05em + 20px) !important;
    max-height: calc(4.05em + 20px) !important;
  }
}

body[data-gaston-state="idle"] #vda-dock,
body[data-gaston-state="languages"] #vda-dock,
body[data-gaston-state="promo"] #vda-dock,
body[data-gaston-state="waiting"] #vda-dock,
body[data-gaston-state="error"] #vda-dock {
  display: none !important;
}

body[data-gaston-state="live"]:has(#vda-band.on):not(.vda-band-off) #vda-dock,
body[data-gaston-state="live"].vda-band-off:has(#vda-pin.on) #vda-dock {
  bottom: calc(var(--vda-band-h, 400px) + 2vh);
  padding-bottom: 0;
}

body.gaston-preview-mode .standalone-only,
body.gaston-preview-mode #admin-hotspot,
body.gaston-preview-mode #admin-ring,
body.gaston-preview-mode #admin-close,
body.gaston-preview-mode #admin-exitfs,
body.gaston-preview-mode #vda-band,
body.gaston-preview-mode #thinking-msg,
body.gaston-preview-mode #born-chrono,
body.gaston-preview-mode #vda-cc-btn,
body.gaston-preview-mode #vda-band-btn {
  display: none !important;
}

body.gaston-preview-mode.gaston-preview-live[data-gaston-state="live"] #start-gate {
  display: flex !important;
}

body.gaston-preview-mode.gaston-preview-live #start-conv-btn,
body.gaston-preview-mode.gaston-preview-live #start-gate .gate-hint {
  display: none !important;
}

body.gaston-preview-mode[data-gaston-state="live"] #vda-dock #hmnv-end-btn {
  display: inline-flex !important;
}

body #hmnv-survey h2 {
  font-size: clamp(24px, 4vw, 64px);
}

body #hmnv-survey .opts {
  display: flex;
  width: 86vw;
  max-width: none;
  flex-flow: row nowrap;
  justify-content: center;
  gap: 2vw;
}

body #hmnv-survey .opt {
  display: flex;
  box-sizing: border-box;
  flex: 0 0 26vw;
  width: 26vw;
  min-height: 14vh;
  padding: 2.1vh 1.2vw;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2vh;
  border-radius: clamp(18px, 2.5vw, 40px);
  font-size: clamp(20px, 3vw, 48px);
}

body #hmnv-survey .emoji {
  font-size: clamp(48px, 7.5vw, 120px);
}

body #hmnv-survey .skip {
  font-size: clamp(17px, 2.2vw, 36px);
}

@media (max-width: 560px), (max-height: 760px) {
  :root {
    --gaston-control-width: min(90vw, 540px);
  }

  #start-gate {
    gap: clamp(10px, 1.8vh, 15px);
    padding-bottom: clamp(92px, 22vh, 282px);
  }

  #start-conv-btn {
    min-height: clamp(68px, 7.5vh, 96px);
    padding: 13px 22px;
    font-size: clamp(20px, 4.5vw, 30px);
  }

  #start-gate .gate-hint {
    padding: clamp(10px, 1.25vh, 16px) clamp(14px, 2.8vw, 22px);
    border-radius: clamp(14px, 2.6vw, 22px);
    font-size: clamp(13px, 2.8vw, 18px);
  }

  #lang-picker {
    gap: clamp(16px, 2.65vh, 34px);
    padding: clamp(38px, 11.7vh, 150px) 18px clamp(30px, 9.2vh, 118px);
  }

  #lang-picker .lp-title {
    top: 0;
    font-size: clamp(21px, 4.2vw, 28px);
  }

  #lang-picker .lp-title span {
    font-size: clamp(15px, 3vw, 20px);
  }

  #lang-row {
    top: 0;
    grid-template-columns: repeat(3, minmax(90px, 150px));
    gap: clamp(9px, 1.4vh, 18px) clamp(8px, 2.2vw, 16px);
  }

  .lang-flag {
    width: min(27vw, 150px);
    min-height: clamp(78px, 9.2vh, 118px);
    padding: 9px 6px;
    border-radius: clamp(12px, 2.4vw, 17px);
    font-size: clamp(11px, 2.2vw, 15px);
  }

  .lang-flag img {
    width: clamp(42px, 8.9vw, 64px);
    height: clamp(28px, 5.8vw, 42px);
  }

  .humanova-signature {
    top: 0;
    width: clamp(170px, 34.7vw, 250px);
    height: auto;
    margin-top: clamp(6px, 2.2vh, 28px);
  }

  .loading {
    bottom: clamp(110px, 22vh, 282px);
    min-width: min(82vw, 470px);
    min-height: clamp(78px, 7.5vh, 96px);
    padding: 14px 24px;
    font-size: clamp(18px, 3.8vw, 24px);
  }

  .loading .loading-sub {
    font-size: clamp(14px, 2.8vw, 18px);
  }

  #vda-dock {
    bottom: clamp(52px, 8vh, 102px);
    width: var(--gaston-control-width);
    gap: 8px;
  }

  #vda-dock .interrupt-btn,
  #vda-dock #hmnv-end-btn {
    min-height: clamp(54px, 5.55vh, 71px);
    gap: 8px;
    padding: 9px 12px;
    font-size: clamp(12px, 2.65vw, 19px);
  }
}

@media (max-width: 520px) {
  body #hmnv-survey h2 {
    font-size: clamp(22px, 6vw, 28px);
  }

  body #hmnv-survey .opts {
    width: 86vw;
    max-width: 86vw;
    flex-flow: column nowrap;
    align-items: center;
    gap: 12px;
  }

  body #hmnv-survey .opt {
    flex: 0 0 auto;
    width: 86vw;
    min-height: 86px;
    padding: 14px 20px;
    flex-direction: row;
    gap: 18px;
    border-radius: 20px;
    font-size: clamp(18px, 5.2vw, 22px);
  }

  body #hmnv-survey .emoji {
    font-size: clamp(42px, 11vw, 54px);
  }

  body #hmnv-survey .skip {
    font-size: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #start-conv-btn,
  .lang-flag {
    animation: none;
    transition: none;
  }
}
