* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  background: #000000; overflow: hidden;
  font-family: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
}

.stage {
  position: relative; width: 100vw; height: 100vh; height: 100dvh;
  background: #000000; overflow: hidden;
}

/* Idle layer and .composite-frame are sized identically by app.js's fitFrame() so they
   sit exactly on top of each other — the crossfade only ever changes opacity, never
   position/size, so nothing jumps when one fades into the other. */
.idle-layer, .composite-frame {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  overflow: hidden;
}

.idle-layer {
  z-index: 2; opacity: 1;
  transition: opacity 550ms ease;
}
.idle-layer.hidden-layer { opacity: 0; pointer-events: none; }
/* left/top/transform are set inline from the avatar profile's idle_offset_x/y/idle_scale
   (see app.js's applyIdleTransform) — calibrated on device-client so the idle clip lines
   up with where the live avatar actually renders. Defaults (50/50/1) reproduce the same
   full-cover centered look as before this existed. */
.idle-video {
  position: absolute; width: 100%; height: 100%; object-fit: cover;
  left: 50%; top: 50%; transform: translate(-50%, -50%) scale(1);
}

.composite-frame {
  z-index: 1; opacity: 0;
  transition: opacity 550ms ease;
}
.composite-frame.visible-layer { opacity: 1; }

.avatar-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: center top; z-index: 1; }
.avatar-video-source { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; pointer-events: none; }

.legs-layer { position: absolute; z-index: 2; pointer-events: none; }
.legs-image { display: block; width: 100%; height: auto; }
.legs-video-source { display: block; width: 100%; height: auto; opacity: 0; pointer-events: none; }
.legs-video { position: absolute; inset: 0; width: 100%; height: 100%; }

.start-button {
  position: absolute; z-index: 5; left: 50%; bottom: 6%; transform: translateX(-50%);
  padding: 16px 48px; border-radius: 999px; border: none;
  background: #3cc7aa; color: #04241d; font-size: 1.15rem; font-weight: 700;
  cursor: pointer; box-shadow: 0 10px 30px rgba(60, 199, 170, 0.35);
  transition: opacity 400ms ease, transform 150ms ease;
}
.start-button:active { transform: translateX(-50%) scale(0.97); }
.start-button.hidden-layer { opacity: 0; pointer-events: none; }

.login-overlay {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center;
  background: #000000;
}
.login-overlay[hidden] { display: none; }
.login-card {
  width: min(360px, 90vw); display: grid; gap: 14px;
  background: #0b1620; border: 1px solid #1f2c38; border-radius: 16px; padding: 28px;
  color: #dbe4ee;
}
.login-card h1 { margin: 0 0 4px; font-size: 1.2rem; text-align: center; }
.login-card label { display: grid; gap: 6px; font-size: 0.9rem; }
.login-card input {
  background: #0f1c28; border: 1px solid #26343f; border-radius: 8px;
  color: #dbe4ee; padding: 10px 12px; font-size: 0.95rem;
}
.login-card button.primary {
  margin-top: 6px; padding: 12px; border-radius: 8px; border: none;
  background: #3cc7aa; color: #04241d; font-weight: 700; cursor: pointer;
}
.login-error { color: #f3a3a3; font-size: 0.85rem; margin: 0; }
