* { box-sizing: border-box; }

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background: #020202;
  font-family: "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.is-loading .scene {
  visibility: hidden;
}

.app-loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #020202;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.app-loader.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.app-loader__inner {
  width: min(320px, 86vw);
  text-align: center;
}

.app-loader__logo {
  display: block;
  margin: 0 auto 28px;
  filter: brightness(0) invert(1) sepia(0.15) saturate(0.4);
  opacity: 0.9;
}

.app-loader__text {
  margin: 0 0 18px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 196, 100, 0.45);
}

.app-loader__bar {
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 210, 120, 0.12);
  overflow: hidden;
}

.app-loader__fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #c88a28, #ffe08a);
  transition: width 0.25s ease;
}

.app-loader__pct {
  margin: 10px 0 0;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 236, 200, 0.32);
}

.app-loader__tap {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin: 22px auto 0;
  padding: 12px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.app-loader__tap-ring {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px solid rgba(255, 210, 120, 0.38);
  box-shadow:
    0 0 28px rgba(255, 180, 60, 0.12),
    inset 0 0 12px rgba(255, 210, 120, 0.06);
  animation: loaderTapPulse 2.4s ease-in-out infinite;
}

.app-loader__tap-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 196, 100, 0.58);
}

@keyframes loaderTapPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.82;
  }

  50% {
    transform: scale(1.07);
    opacity: 1;
  }
}

.scene {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #020202;
}

.scene__static {
  position: absolute;
  inset: 0;
  background: url("/static/media/sofa-bg.png") var(--scene-focal-x, center) var(--scene-focal-y, center) / cover no-repeat;
  z-index: 0;
}

.scene__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--scene-focal-x, center) var(--scene-focal-y, center);
  opacity: 0;
  z-index: 1;
  pointer-events: none;
  transition: opacity 0.85s ease;
}

.scene__video.is-active {
  opacity: 1;
  transition: opacity 0.12s linear;
}

/* Esconde artefato da IA no canto direito — ativa com a luz (vídeo 1 e 2) */
.video-edge-mask {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.85s ease;
  background: linear-gradient(
    to left,
    #020202 0%,
    #020202 5%,
    rgba(2, 2, 2, 0.92) 12%,
    rgba(2, 2, 2, 0.55) 20%,
    rgba(2, 2, 2, 0.12) 30%,
    transparent 42%
  );
}

.video-edge-mask.is-active {
  opacity: 1;
}

.vignette {
  position: absolute;
  inset: 0;
  z-index: 4;
  background:
    radial-gradient(circle at 42% 48%, transparent 25%, rgba(0, 0, 0, 0.36) 72%),
    linear-gradient(to right, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0.62));
  pointer-events: none;
}

.hint {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  text-align: center;
  z-index: 6;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.45s ease;
  --hint-accent: rgba(255, 196, 100, 0.38);
}

.hint__logo {
  display: block;
  width: 110px;
  height: 35px;
  margin-bottom: 24px;
  background-color: var(--hint-accent);
  -webkit-mask-image: url("/static/img/logo_soller_marca.svg");
  mask-image: url("/static/img/logo_soller_marca.svg");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.hint__context {
  margin: 0 0 16px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--hint-accent);
  line-height: 1.65;
  text-align: center;
}

.hint__action {
  margin: 0;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.22);
}

.hint.is-hidden {
  opacity: 0;
}

.lamp-hotspot {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 50%;
  opacity: 0;
  background: radial-gradient(ellipse, rgba(255, 239, 145, 0.95), rgba(255, 204, 72, 0.48), transparent 72%);
  filter: blur(2px);
  transition: opacity 0.45s ease;
  pointer-events: none;
  z-index: 2;
}

.light-cone {
  position: absolute;
  left: 0;
  top: 0;
  clip-path: polygon(42% 0%, 58% 0%, 98% 100%, 2% 100%);
  background: linear-gradient(to bottom, rgba(255, 220, 95, 0.34), rgba(255, 187, 55, 0.15), rgba(255, 175, 45, 0.02));
  filter: blur(7px);
  opacity: 0;
  transition: opacity 0.45s ease;
  pointer-events: none;
  z-index: 1;
}

.sofa-glow {
  position: absolute;
  left: 0;
  top: 0;
  background: radial-gradient(ellipse, rgba(255, 198, 76, 0.16), transparent 72%);
  opacity: 0;
  filter: blur(30px);
  transition: opacity 0.45s ease;
  pointer-events: none;
  z-index: 2;
}

.floor-glow {
  position: absolute;
  left: 0;
  top: 0;
  background: radial-gradient(ellipse, rgba(255, 202, 78, 0.22), transparent 72%);
  opacity: 0;
  filter: blur(20px);
  transition: opacity 0.45s ease;
  pointer-events: none;
}

.on { opacity: 1; }

.cord-wrap {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
  pointer-events: none;
  z-index: 8;
}

.cord-svg {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
}

.cord-main {
  fill: none;
  stroke: rgba(205, 185, 135, 0.78);
  stroke-width: 1.45;
  stroke-linecap: round;
  stroke-dasharray: 2 3;
  filter:
    drop-shadow(0 0 1px rgba(255, 236, 180, 0.65))
    drop-shadow(0 0 3px rgba(0, 0, 0, 0.9));
}

.cord-highlight {
  fill: none;
  stroke: rgba(255, 245, 205, 0.35);
  stroke-width: 0.55;
  stroke-linecap: round;
  stroke-dasharray: 1 5;
}

.cord-svg.is-clipped {
  overflow: hidden;
}

.knob {
  position: absolute;
  z-index: 22;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  background: transparent;
  box-shadow: none;
}

.knob::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 35% 28%, #fff, #dedede 32%, #8d8d8d 72%, #555 100%);
  box-shadow:
    inset -2px -2px 4px rgba(0, 0, 0, 0.5),
    inset 1px 1px 3px rgba(255, 255, 255, 0.7),
    0 0 8px rgba(255, 255, 255, 0.9),
    0 0 20px rgba(255, 228, 160, 0.35);
}

.knob:active { cursor: grabbing; }

.knob::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.22);
  transform: translate(-50%, -50%);
}

.login-wrap {
  position: absolute;
  right: clamp(180px, 24vw, 320px);
  top: 50%;
  z-index: 10;
  opacity: 0;
  transform: translate(0, -50%);
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.login-wrap.show {
  opacity: 1;
  transform: translate(0, -50%);
  pointer-events: auto;
}

.login-wrap.leave-out {
  opacity: 0;
  transform: translate(64px, -50%) scale(0.95);
  transition: 0.4s cubic-bezier(0.4, 0, 0.9, 0.6);
  pointer-events: none;
}

.login-wrap.is-busy {
  pointer-events: none;
}

.login-wrap.is-busy .login__submit {
  opacity: 0.72;
  cursor: wait;
}

/* Desktop — card desliza da direita pro centro no fim do vídeo */
body:not(.is-mobile-portrait) .login-wrap.show.is-centered {
  left: 50%;
  right: auto;
  z-index: 12;
  transition: none;
  animation: loginCenterSlideIn var(--center-slide-dur, 0.55s)
    cubic-bezier(0.28, 0.92, 0.32, 1) forwards;
}

@keyframes loginCenterSlideIn {
  0% {
    opacity: 1;
    transform: translate(calc(-50% + min(22vw, 280px)), -50%) scale(1);
  }

  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Entrar durante o vídeo — desktop */
body:not(.is-mobile-portrait) .login-wrap.show.is-centered.is-centered-snap {
  animation: none;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Entrar — desktop: desliza pro centro e some ao mesmo tempo */
body:not(.is-mobile-portrait) .login-wrap.show.is-exit-center {
  left: 50%;
  right: auto;
  z-index: 15;
  pointer-events: none;
  transition: none;
  animation: loginExitCombined var(--exit-dur, 0.36s) cubic-bezier(0.32, 0.92, 0.38, 1) forwards;
}

@keyframes loginExitCombined {
  0% {
    opacity: 1;
    transform: translate(calc(-50% + min(22vw, 280px)), -50%) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.94);
  }
}

/* Card já no centro — só entra (fade) */
body:not(.is-mobile-portrait) .login-wrap.show.is-centered.is-centered-snap.is-exit-center {
  transition: none;
  animation: loginExitFromCenter var(--exit-dur, 0.32s) cubic-bezier(0.32, 0.92, 0.38, 1) forwards;
}

@keyframes loginExitFromCenter {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.94);
  }
}

.login-glow {
  position: absolute;
  inset: -40px -32px;
  border-radius: 28px;
  background: radial-gradient(
    ellipse at 50% 40%,
    rgba(255, 200, 90, 0.22) 0%,
    rgba(255, 175, 55, 0.1) 45%,
    transparent 72%
  );
  filter: blur(18px);
  opacity: 0.35;
  z-index: 0;
  pointer-events: none;
}

.login {
  position: relative;
  z-index: 1;
  width: min(320px, calc(100vw - 40px));
  padding: 24px 26px 22px;
  border-radius: 16px;
  background: rgba(10, 8, 6, 0.58);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  border: 1px solid rgba(255, 210, 120, 0.22);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 230, 180, 0.08);
}

.login__logo {
  position: relative;
  z-index: 2;
  display: block;
  width: 96px;
  height: auto;
  margin: 0 auto 10px;
  opacity: 0.9;
  filter: brightness(0) invert(1) sepia(0.15) saturate(0.4) hue-rotate(5deg);
}

.login__eyebrow {
  position: relative;
  z-index: 2;
  margin: 0 0 16px;
  text-align: center;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 196, 100, 0.42);
}

.login__field {
  margin-bottom: 14px;
}

.login__label {
  display: block;
  margin-bottom: 5px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 210, 140, 0.38);
}

.login input {
  width: 100%;
  margin: 0;
  padding: 8px 6px;
  border: none;
  border-bottom: 1px solid rgba(255, 210, 130, 0.16);
  border-radius: 4px 4px 0 0;
  background: rgba(0, 0, 0, 0.12);
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  color: rgba(255, 244, 228, 0.94);
  outline: none;
  transition: border-color 0.25s ease;
}

.login input::placeholder {
  color: rgba(255, 220, 170, 0.26);
}

.login input:focus {
  border-bottom-color: rgba(255, 204, 90, 0.55);
}

.login__forgot {
  display: block;
  margin: -2px 0 18px;
  text-align: right;
  font-size: 11px;
  font-weight: 400;
  color: rgba(255, 196, 110, 0.48);
  text-decoration: none;
  transition: color 0.2s ease;
}

.login__forgot:hover {
  color: rgba(255, 214, 130, 0.78);
}

.login__error {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.45;
  color: #ffd4c8;
  background: rgba(180, 60, 40, 0.22);
  border: 1px solid rgba(255, 120, 90, 0.28);
}

.login__hint {
  margin: 0 0 16px;
  font-size: 11px;
  line-height: 1.5;
  color: rgba(255, 210, 140, 0.52);
}

.login--change-pw {
  margin-top: 0;
}

.login button {
  width: 100%;
  padding: 11px 14px;
  border: 0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.login__submit {
  background: linear-gradient(135deg, #ffe08a 0%, #f0b840 52%, #c88a28 100%);
  color: #1a1208;
  font-weight: 600;
  letter-spacing: 0.04em;
  box-shadow: 0 6px 22px rgba(255, 175, 55, 0.18);
}

.login__submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 36px rgba(255, 175, 55, 0.3);
}

.login__submit:active {
  transform: translateY(0);
}

.scene.is-fading-out {
  opacity: 0;
  transition: opacity 0.5s ease;
}

.scene.is-hidden {
  visibility: hidden;
  pointer-events: none;
}

.client-panel[hidden] {
  display: none !important;
}

.client-panel {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: row;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #0a0908;
  color: rgba(255, 244, 228, 0.94);
  opacity: 0;
  transform: translateX(32px);
  pointer-events: none;
  transition: opacity 0.55s ease, transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.client-panel.is-visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.client-panel__header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid rgba(255, 210, 120, 0.1);
  background: rgba(12, 10, 8, 0.95);
}

.client-panel__brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.client-panel__logo {
  filter: brightness(0) invert(1) sepia(0.15) saturate(0.4) hue-rotate(5deg);
}

.client-panel__brand-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 210, 140, 0.72);
  white-space: nowrap;
}

.client-panel__logout {
  padding: 8px 14px;
  border: 1px solid rgba(255, 210, 120, 0.2);
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 214, 130, 0.82);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.client-panel__logout:hover {
  background: rgba(255, 200, 90, 0.08);
  border-color: rgba(255, 210, 120, 0.38);
}

.client-panel__main {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 36px 24px 48px 28px;
  width: 100%;
  max-width: none;
  margin: 0;
  scrollbar-gutter: stable;
}

body.is-in-panel {
  background: #0a0908;
}
