/* Retained Knock aperture and pose presentation for Monkey ID. */

:root {
  --radius: 8px;
  --bg-color: #000000;
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.65);
  --text-muted: rgba(255, 255, 255, 0.35);

  /* OKLCH Color Palette */
  --accent-cyan: oklch(0.78 0.16 200); /* Star's Voice */
  --accent-amber: oklch(0.82 0.15 75); /* Aggie's Brain */
  --signal-violet: oklch(0.72 0.12 302); /* Agent-authored narration */
  --border-color: rgba(255, 255, 255, 0.08);
  --glass-bg: rgba(12, 12, 12, 0.6);
  --glow-cyan: rgba(0, 240, 255, 0.15);
  --glow-amber: rgba(255, 200, 0, 0.12);
  --ios-reading-size: 18px;
  --ios-reading-meta-size: 13px;
  --ios-reading-pause-size: 14px;
  --work-metadata-color: rgba(255, 255, 255, 0.62);
  --work-correlation-color: rgba(255, 255, 255, 0.58);

  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  --text-scale: 1;
  font-size: calc(14px * var(--text-scale));
  background-color: var(--bg-color);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  height: 100vh;
  /* Phones: the visible viewport, so nothing hides under Safari's toolbar. */
  height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* App container */
body {
  margin: 0;
}
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  box-sizing: border-box;
  background: radial-gradient(circle at 50% -10%, rgba(20, 30, 45, 0.3) 0%, rgba(0, 0, 0, 0) 70%);
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  touch-action: pan-y;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: max(28px, env(safe-area-inset-top)) 28px max(28px, env(safe-area-inset-bottom));
  box-sizing: border-box;
  text-align: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(26, 108, 132, 0.18), transparent 28%),
    radial-gradient(circle at 50% 48%, #071017 0%, #020405 46%, #000 78%);
}

.auth-screen[hidden] {
  display: none;
}
.auth-required .app-container,
.auth-required .fleet-drawer,
.auth-required .fleet-scrim {
  visibility: hidden;
  pointer-events: none;
}

.auth-carrier {
  width: min(68vw, 280px);
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  position: relative;
  margin-bottom: 22px;
}

.auth-carrier::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(113, 230, 244, 0.18) 20%,
    rgba(113, 230, 244, 0.58) 50%,
    rgba(113, 230, 244, 0.18) 80%,
    transparent
  );
}

.auth-carrier span {
  width: 8px;
  height: 8px;
  border: 1px solid rgba(143, 238, 248, 0.62);
  border-radius: 50%;
  background: #061419;
  box-shadow: 0 0 18px rgba(69, 218, 236, 0.22);
}

.auth-carrier span:nth-child(2) {
  width: 18px;
  height: 18px;
  border-color: rgba(168, 244, 251, 0.9);
  box-shadow:
    0 0 30px rgba(69, 218, 236, 0.4),
    inset 0 0 8px rgba(69, 218, 236, 0.28);
}

.auth-carrier i {
  position: absolute;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(96, 225, 240, 0.16);
  border-radius: 50%;
  animation: carrier-lock 2.4s ease-out infinite;
}

.auth-kicker {
  margin: 0 0 10px;
  color: rgba(154, 231, 240, 0.58);
  font:
    500 0.68rem/1 'SF Mono',
    ui-monospace,
    monospace;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.auth-screen h1 {
  margin: 0;
  font:
    600 clamp(3rem, calc(12vw * var(--text-scale)), 5.5rem) / 0.92 system-ui,
    sans-serif;
  letter-spacing: 0.08em;
}

.auth-message {
  margin: 24px 0 28px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 1rem;
}

.auth-enter {
  min-width: 210px;
  min-height: 52px;
  padding: 0 28px;
  border: 1px solid rgba(133, 234, 245, 0.56);
  border-radius: var(--radius);
  color: #eaffff;
  background: radial-gradient(circle at 50% 0%, rgba(45, 198, 224, 0.28), rgba(11, 45, 53, 0.72));
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.16),
    0 0 28px rgba(72, 226, 244, 0.22),
    0 12px 38px rgba(0, 0, 0, 0.44);
  font:
    600 0.96rem/1 system-ui,
    sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    transform 120ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.auth-enter:hover {
  border-color: rgba(166, 244, 251, 0.92);
  background: radial-gradient(circle at 50% 0%, rgba(72, 226, 244, 0.38), rgba(15, 62, 72, 0.84));
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.22),
    0 0 38px rgba(72, 226, 244, 0.36),
    0 14px 42px rgba(0, 0, 0, 0.5);
}
.auth-enter:active {
  transform: scale(0.97);
}
.auth-enter:focus-visible {
  outline: 2px solid #9aedf5;
  outline-offset: 4px;
}
.auth-enter:disabled {
  opacity: 0.54;
  cursor: wait;
}

/* Star's secret knock: a quiet violet chip under Knock that hints a secret exists. */
.knock-secret-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-top: 12px;
  padding: 0 18px;
  border: 1px dashed color-mix(in oklch, var(--signal-violet) 70%, transparent);
  border-radius: 999px;
  color: var(--signal-violet);
  background: color-mix(in oklch, var(--signal-violet) 10%, transparent);
  font:
    600 0.88rem/1 system-ui,
    sans-serif;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 120ms ease;
}
.knock-secret-chip:hover {
  border-style: solid;
  background: color-mix(in oklch, var(--signal-violet) 18%, transparent);
}
.knock-secret-chip:active {
  transform: scale(0.97);
}
.knock-secret-chip:focus-visible {
  outline: 2px solid var(--signal-violet);
  outline-offset: 4px;
}
.knock-secret-chip:disabled {
  opacity: 0.54;
  cursor: wait;
}
.knock-secret-chip[hidden] {
  display: none;
}
.auth-screen[data-knock-state='secret'] .knock-instruction-banner {
  border-color: var(--signal-violet);
}

/* Chromatic Liveness Portal & Sacred Geometry Aperture */
.auth-screen[data-knock-state='pulsing'] {
  background: radial-gradient(
    circle at 50% 48%,
    var(--knock-pulse-color, #00f5d4) 0%,
    rgba(6, 12, 18, 0.92) 64%,
    #000 100%
  );
  box-shadow: inset 0 0 140px var(--knock-pulse-color, #00f5d4);
  transition:
    background 140ms ease,
    box-shadow 140ms ease;
}

.knock-portal-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 14px 0 12px;
  width: min(92vw, 340px);
}

.knock-portal-stage[hidden] {
  display: none;
}

.knock-instruction-banner {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: rgba(6, 18, 24, 0.88);
  border: 1.5px solid var(--knock-border-color, #ff2a3c);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.48),
    0 0 26px var(--knock-border-glow, rgba(255, 42, 60, 0.34));
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition:
    border-color 110ms ease,
    box-shadow 110ms ease,
    background 110ms ease;
}

.knock-instruction-banner[data-tone='warning'] {
  border-color: var(--knock-border-color, #ff6c22);
  background: rgba(20, 12, 10, 0.9);
}

.knock-instruction-banner[data-tone='ready'],
.knock-instruction-banner[data-tone='circling'] {
  border-color: var(--knock-pulse-color, var(--knock-border-color, #30d158));
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.5),
    0 0 32px var(--knock-pulse-color, var(--knock-border-glow, rgba(48, 209, 88, 0.42)));
}

.knock-instruction-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.12);
  color: #f4ffff;
  font:
    600 0.62rem/1.2 'SF Mono',
    ui-monospace,
    monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.knock-instruction-banner[data-tone='warning'] .knock-instruction-badge {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.knock-instruction-text {
  margin: 0;
  color: #f5ffff;
  font:
    600 0.96rem/1.3 system-ui,
    sans-serif;
  letter-spacing: 0.01em;
}

.knock-circle-shell {
  position: relative;
  width: 268px;
  height: 268px;
  display: grid;
  place-items: center;
}

.knock-orbital-rings {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.knock-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid var(--knock-pulse-color, var(--knock-border-color, #ff2a3c));
  transition:
    border-color 110ms ease,
    box-shadow 110ms ease,
    transform 240ms ease;
}

.knock-ring.ring-outer {
  width: 264px;
  height: 264px;
  border-style: dashed;
  opacity: 0.42;
}

.auth-screen[data-knock-state='pulsing'] .knock-ring.ring-outer {
  opacity: 0.85;
  animation: knock-orbit-spin 18s linear infinite reverse;
}

.knock-progress-ring,
.knock-wireframe-lead-dot,
.knock-wireframe-orbit {
  opacity: 0;
  pointer-events: none;
  display: none;
}

.knock-wireframe-ccw-arrow {
  fill: none;
  stroke: rgba(255, 255, 255, 0.88);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.knock-ring.ring-middle {
  width: 244px;
  height: 244px;
  border-color: var(--knock-pulse-color, var(--knock-border-color, #ff2a3c));
  opacity: 0.62;
}

.knock-ring.ring-inner {
  width: 218px;
  height: 218px;
  border-width: 2.5px;
  border-color: var(--knock-pulse-color, var(--knock-border-color, #ff2a3c));
  box-shadow: 0 0 38px var(--knock-pulse-color, var(--knock-border-glow, rgba(255, 42, 60, 0.45)));
}

.auth-screen[data-knock-state='pulsing'] .knock-ring {
  border-color: var(--knock-pulse-color, #00f5d4);
  box-shadow: 0 0 58px var(--knock-pulse-color, #00f5d4);
}

.knock-aperture {
  position: relative;
  width: 204px;
  height: 204px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(6, 16, 22, 0.78);
  border: 4px solid var(--knock-pulse-color, var(--knock-border-color, #ff2a3c));
  box-shadow:
    0 0 52px var(--knock-pulse-color, var(--knock-border-glow, rgba(255, 42, 60, 0.56))),
    inset 0 0 28px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(12px);
  transition:
    border-color 100ms ease,
    box-shadow 100ms ease;
}

.knock-video,
.knock-snapshot {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  display: block;
}

.knock-video[hidden],
.knock-snapshot[hidden] {
  display: none;
}

.knock-wireframe-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.55));
}

.knock-wireframe-head,
.knock-wireframe-features,
.knock-wireframe-meridian-v {
  transform-origin: 100px 100px;
  transition:
    transform 180ms cubic-bezier(0.22, 1, 0.36, 1),
    d 180ms ease;
}

.knock-wireframe-face {
  fill: rgba(255, 255, 255, 0.03);
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 2.1;
  stroke-dasharray: 6 3;
}

.knock-wireframe-jaw-ear {
  fill: none;
  stroke: rgba(255, 255, 255, 0.82);
  stroke-width: 1.85;
  stroke-linecap: round;
}

.knock-wireframe-meridian-v,
.knock-wireframe-meridian-h {
  fill: none;
  stroke: rgba(255, 255, 255, 0.34);
  stroke-width: 1.15;
  stroke-dasharray: 3 4;
}

.knock-wireframe-brow {
  fill: none;
  stroke: rgba(255, 255, 255, 0.82);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.knock-wireframe-eye {
  fill: rgba(255, 255, 255, 0.08);
  stroke: #ffffff;
  stroke-width: 2.2;
}

.knock-wireframe-pupil {
  fill: #ffffff;
}

.knock-wireframe-nose,
.knock-wireframe-mouth {
  fill: none;
  stroke: rgba(255, 255, 255, 0.86);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.knock-reticle {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 1.5px solid var(--knock-pulse-color, var(--knock-border-color, rgba(255, 42, 60, 0.45)));
  box-shadow: inset 0 0 28px
    var(--knock-pulse-color, var(--knock-border-glow, rgba(255, 42, 60, 0.24)));
  pointer-events: none;
  transition:
    border-color 100ms ease,
    box-shadow 100ms ease,
    background 100ms ease;
}

.auth-screen[data-knock-state='pulsing'] .knock-reticle {
  inset: 0;
  border-width: 4px;
  box-shadow: inset 0 0 64px var(--knock-pulse-color, #00f5d4);
}

.knock-microcopy {
  margin: 0;
  color: #eaffff;
  font:
    500 0.76rem/1.3 'SF Mono',
    ui-monospace,
    monospace;
  letter-spacing: 0.1em;
  text-transform: lowercase;
  text-shadow: 0 0 16px
    var(--knock-pulse-color, var(--knock-border-color, rgba(133, 234, 245, 0.6)));
}

.knock-welcome {
  margin: 24px 0 18px;
  padding: 24px 28px;
  border-radius: var(--radius);
  background: rgba(10, 38, 44, 0.62);
  border: 1px solid rgba(138, 236, 248, 0.48);
  box-shadow: 0 0 52px rgba(0, 245, 212, 0.24);
  backdrop-filter: blur(14px);
}

.knock-welcome-halo {
  font-size: 1.6rem;
  color: #00f5d4;
  margin-bottom: 10px;
  text-shadow: 0 0 20px #00f5d4;
}

.knock-welcome-title {
  margin: 0;
  font:
    500 clamp(1.25rem, calc(4vw * var(--text-scale)), 1.65rem) / 1.3 system-ui,
    sans-serif;
  color: #f2ffff;
  letter-spacing: 0.02em;
}

.knock-rejection {
  margin: 22px 0 12px;
  padding: 24px 28px;
  max-width: 360px;
  border-radius: var(--radius);
  background: rgba(24, 12, 18, 0.68);
  border: 1px solid rgba(255, 90, 120, 0.34);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.54);
  backdrop-filter: blur(14px);
}

.knock-name {
  margin: 22px 0 12px;
  padding: 24px 28px;
  max-width: 360px;
  border-radius: var(--radius);
  background: rgba(10, 22, 28, 0.7);
  border: 1px solid rgba(120, 255, 236, 0.34);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.54);
  backdrop-filter: blur(14px);
}

.knock-name-title {
  margin: 0 0 8px;
  font:
    600 1.25rem/1.25 system-ui,
    sans-serif;
  color: #f2ffff;
}

.knock-name-sub {
  margin: 0 0 16px;
  color: rgba(224, 255, 250, 0.7);
  font-size: 0.88rem;
  line-height: 1.45;
}

.knock-name-input {
  box-sizing: border-box;
  width: 100%;
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(120, 255, 236, 0.4);
  background: rgba(0, 0, 0, 0.35);
  color: #f2ffff;
  font: inherit;
  font-size: 1.05rem;
}

.knock-name-input:focus-visible {
  outline: 2px solid rgba(120, 255, 236, 0.9);
  outline-offset: 2px;
}

.knock-rejection-title {
  margin: 0 0 8px;
  font:
    600 1.25rem/1.25 system-ui,
    sans-serif;
  color: #fff2f5;
}

.knock-rejection-sub {
  margin: 0 0 20px;
  color: rgba(255, 224, 232, 0.68);
  font-size: 0.88rem;
  line-height: 1.45;
}

@keyframes knock-orbit-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.auth-status {
  min-height: 1.4em;
  max-width: 320px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.44);
  font:
    0.75rem/1.45 'SF Mono',
    ui-monospace,
    monospace;
}

@keyframes carrier-lock {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  36% {
    opacity: 0.6;
  }
  100% {
    opacity: 0;
    transform: scale(1.8);
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-carrier i {
    animation: none;
    opacity: 0.35;
  }
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Keep the primary control reachable on short and zoomed viewports. */
.auth-screen {
  position: relative;
  min-height: 100dvh;
  overflow-y: auto;
}
:root {
  overflow: auto;
}
body {
  min-width: 0;
}
.auth-enter {
  min-height: 44px;
}

.knock-cancel {
  min-width: 140px;
  color: var(--text-secondary);
  border-color: rgba(255, 255, 255, 0.3);
  background: transparent;
  box-shadow: none;
}

.enrollment {
  width: min(100%, 360px);
  color: var(--text-secondary, #a9c7d0);
  font-size: calc(13px * var(--text-scale));
  line-height: 1.6;
  text-align: left;
}
.enrollment summary {
  cursor: pointer;
  text-align: center;
  padding: 12px;
}
.enrollment form {
  display: grid;
  gap: 14px;
}
.enrollment p {
  margin: 8px 0;
}
.enrollment input {
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  border: 1px solid #467482;
  border-radius: 8px;
  background: #081319;
  color: #edf9fc;
  padding: 10px 12px;
  font: inherit;
  /* 16px or larger, or iPhone zooms the whole page when the phrase field gets focus. */
  font-size: max(16px, 1em);
}
.enrollment button {
  margin-inline: auto;
}
.auth-screen:not([data-knock-state='idle']) .enrollment {
  display: none;
}
.auth-status {
  overflow-wrap: anywhere;
  max-width: 420px;
  color: #b4cbd5;
  font:
    1rem/1.6 system-ui,
    sans-serif;
}

/* Actual page accessibility controls; native system preferences still apply above. */
:root[data-text-size='large'] {
  --text-scale: 2;
}
:root[data-motion='reduce'] *,
:root[data-motion='reduce'] *::before,
:root[data-motion='reduce'] *::after {
  scroll-behavior: auto !important;
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}
.auth-screen {
  width: 100%;
  grid-template-columns: minmax(0, 1fr);
}
.auth-screen h1,
.knock-welcome,
.knock-rejection {
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
}
:root[data-text-size='large'] .auth-screen h1 {
  letter-spacing: 0.02em;
}
.display-options {
  width: min(100%, 360px);
  color: var(--text-secondary);
  font-size: calc(13px * var(--text-scale));
  line-height: 1.6;
  margin-top: 8px;
}
.display-options summary {
  min-height: 44px;
  box-sizing: border-box;
  padding: 12px;
  cursor: pointer;
}
.display-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.display-toggle {
  min-height: 44px;
  max-width: 100%;
  border: 1px solid #467482;
  border-radius: var(--radius);
  padding: 10px 14px;
  background: transparent;
  color: #edf9fc;
  font: inherit;
  cursor: pointer;
}
.display-toggle[aria-pressed='true'] {
  background: #12313b;
  border-color: #9aedf5;
}
.display-toggle:focus-visible,
.display-options summary:focus-visible {
  outline: 2px solid #9aedf5;
  outline-offset: 3px;
}
.display-options p {
  margin: 8px 0 0;
}

@media (max-width: 480px) {
  :root[data-text-size='large'] .auth-screen {
    padding-inline: 14px;
  }
}

.auth-status a {
  color: #8ee1e8;
  text-underline-offset: 0.2em;
}

/* The illustrated Star World entrance keeps the existing live challenge intact. */
.monkey-theme {
  background: #1c1029;
  color: #fff4dc;
}
.monkey-login {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 100dvh;
  max-width: 1440px;
  margin: auto;
  background: radial-gradient(ellipse at 20% 45%, #49224d 0%, #1c1029 62%);
}
.monkey-welcome {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 24px;
  text-align: center;
}
.monkey-world {
  margin: 0;
  color: #e5cbdc;
  font:
    700 0.85rem/1.4 ui-monospace,
    monospace;
  letter-spacing: 0.22em;
}
.monkey-mascot {
  display: block;
  width: min(100%, 460px);
  height: auto;
  object-fit: contain;
  margin: 16px 0 0;
}
.monkey-motto {
  margin: 12px 0 0;
  color: #fff0cb;
  font:
    700 clamp(1.5rem, 3vw, 2.6rem) / 1.12 ui-rounded,
    system-ui,
    sans-serif;
  letter-spacing: -0.04em;
}
.monkey-motto strong {
  color: #ffd05a;
}
.monkey-theme .auth-screen {
  min-height: 100dvh;
  padding: 48px 32px;
  background: transparent;
  border-left: 1px solid #ffdcac24;
}
.monkey-theme .auth-kicker {
  color: #e7bfd9;
  line-height: 1.5;
  letter-spacing: 0.13em;
}
.monkey-theme .auth-screen h1 {
  color: #ffd05a;
  font-family: ui-rounded, system-ui, sans-serif;
  font-weight: 900;
  letter-spacing: -0.06em;
  line-height: 1.03;
  text-shadow: 0 4px 0 #381335;
}
.monkey-theme .auth-message {
  color: #f0deeb;
  font-size: 1.15rem;
}
.monkey-theme .auth-enter {
  border: 2px solid #ffe3a1;
  border-radius: 16px;
  color: #321348;
  background: #ffd05a;
  box-shadow: 0 5px 0 #8b4d3d;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.monkey-theme .auth-enter:hover {
  background: #ffe39b;
  border-color: #fff1ca;
}
.monkey-theme .auth-enter:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 #8b4d3d;
}
.monkey-theme .auth-enter:focus-visible,
.monkey-theme summary:focus-visible,
.monkey-theme .display-toggle:focus-visible,
.monkey-theme a:focus-visible {
  outline: 3px solid #fff2c9;
  outline-offset: 4px;
}
.monkey-theme .auth-status,
.monkey-theme .enrollment,
.monkey-theme .display-options {
  color: #e8d7e5;
}
.monkey-theme .auth-status a {
  color: #ffdb83;
}
.monkey-theme .display-toggle {
  border-color: #a477aa;
  color: #fff0e6;
}
.monkey-theme .display-toggle[aria-pressed='true'] {
  background: #4f2b5e;
  border-color: #ffdb83;
}
.monkey-theme .enrollment input {
  background: #251632;
  color: #fff4dc;
  border-color: #a477aa;
}
.monkey-theme .knock-cancel {
  background: transparent;
  color: #fff4dc;
  border-color: #a477aa;
  box-shadow: none;
}
.monkey-login:has(.auth-screen:not([data-knock-state='idle'])) {
  grid-template-columns: minmax(0, 1fr);
}
.monkey-login:has(.auth-screen:not([data-knock-state='idle'])) .monkey-welcome {
  display: none;
}
.monkey-login:has(.auth-screen:not([data-knock-state='idle'])) .auth-screen {
  border: 0;
}
@media (max-width: 760px) {
  .monkey-login {
    grid-template-columns: minmax(0, 1fr);
  }
  .monkey-welcome {
    padding: 24px 20px 0;
  }
  .monkey-mascot {
    width: min(52vw, 220px);
    margin-top: 8px;
  }
  .monkey-motto {
    display: none;
  }
  .monkey-theme .auth-screen {
    min-height: auto;
    border: 0;
    padding: 24px 20px 36px;
  }
  .monkey-theme .auth-screen h1 {
    font-size: clamp(3rem, calc(14vw * var(--text-scale)), 5.5rem);
  }
  .monkey-theme .auth-message {
    margin: 18px 0 24px;
  }
}

/* Royal's door (Star, Nov 16 2026): velvet curtains onto each site's own palace, a line
   of characters waiting, and Royal at the door. No frame, no instructions. */
body.royal-open {
  overflow: hidden;
}

.royal {
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow: hidden;
  color: #fff;
  font-family: 'Didot', 'Bodoni 72', 'Bodoni MT', ui-serif, Georgia, serif;
  background: var(--royal-sky-0);
}

.royal-sky {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(120% 70% at 50% 100%, var(--royal-sky-2) 0%, transparent 58%),
    linear-gradient(180deg, var(--royal-sky-0) 0%, var(--royal-sky-1) 72%, var(--royal-sky-2) 140%);
}

.royal-stars {
  position: absolute;
  inset: 0 0 45% 0;
  background-image:
    radial-gradient(1.6px 1.6px at 8% 22%, #fff 60%, transparent),
    radial-gradient(1.2px 1.2px at 21% 9%, #fff 60%, transparent),
    radial-gradient(1.8px 1.8px at 34% 31%, #fff 60%, transparent),
    radial-gradient(1.2px 1.2px at 47% 14%, #fff 60%, transparent),
    radial-gradient(1.6px 1.6px at 62% 27%, #fff 60%, transparent),
    radial-gradient(1.2px 1.2px at 74% 8%, #fff 60%, transparent),
    radial-gradient(1.8px 1.8px at 88% 24%, #fff 60%, transparent),
    radial-gradient(1.2px 1.2px at 95% 40%, #fff 60%, transparent);
  opacity: 0.75;
  animation: royal-twinkle 5s ease-in-out infinite alternate;
}

@keyframes royal-twinkle {
  to {
    opacity: 0.35;
  }
}

.royal-skyline {
  position: absolute;
  z-index: 0;
  left: 0;
  right: 0;
  bottom: 21vh;
  width: 100%;
  height: 48vh;
}

.royal-ground {
  position: absolute;
  z-index: 0;
  left: 0;
  right: 0;
  bottom: 0;
  height: 22vh;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.35), #000 92%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 84px);
  border-top: 2px solid color-mix(in oklab, var(--royal-trim) 60%, transparent);
}

.royal-light {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  background: var(--knock-pulse-color, transparent);
  transition: opacity 110ms ease;
}

.auth-screen[data-knock-state='pulsing'] .royal-light {
  opacity: 0.9;
}

.royal-sign {
  position: absolute;
  z-index: 3;
  top: calc(6.4vh + 18px);
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
  font-size: clamp(0.7rem, 1.6vw, 0.95rem);
  letter-spacing: 0.55em;
  text-transform: uppercase;
  color: var(--royal-trim);
  opacity: 0.9;
}

.royal-line {
  position: absolute;
  z-index: 3;
  top: calc(6.4vh + 46px);
  left: 16px;
  right: 16px;
  max-width: 16ch;
  margin: 0 auto;
  text-align: center;
  font-size: clamp(2.1rem, 6.6vw, 4.8rem);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.01em;
  text-wrap: balance;
  text-shadow:
    0 4px 30px rgba(0, 0, 0, 0.8),
    0 0 2px #000;
}

.royal-line-in {
  animation: royal-line-in 420ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes royal-line-in {
  from {
    opacity: 0.45;
    transform: translateY(14px) scale(0.98);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

.royal-stage {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 8vh;
  width: min(1100px, 100vw);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(4px, 2vw, 24px);
  transform: translateX(-50%);
  transform-origin: 50% 80%;
  transition: transform 1.2s cubic-bezier(0.7, 0, 0.2, 1);
}

.royal-queue,
.royal-man {
  flex: 1 1 0;
  min-width: 0;
  max-width: 420px;
  display: flex;
}

.royal-queue {
  justify-content: flex-end;
}

.royal-man {
  justify-content: flex-start;
}

.royal-crowd {
  width: 100%;
  height: auto;
  max-height: 34vh;
}

.royal-guest {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: royal-sway 3.6s ease-in-out infinite;
}

@keyframes royal-sway {
  0%,
  100% {
    transform: rotate(-1.4deg);
  }
  50% {
    transform: rotate(1.4deg) translateY(-2px);
  }
}

.royal-door {
  position: relative;
  flex: 0 0 auto;
  width: clamp(180px, 30vw, 330px);
  aspect-ratio: 3 / 4.1;
  overflow: hidden;
  border-radius: 50% 50% 14px 14px / 34% 34% 14px 14px;
  background: radial-gradient(circle at 50% 30%, #1a1a1a, #000);
  box-shadow:
    0 0 0 6px color-mix(in oklab, var(--royal-trim) 78%, #000),
    0 0 0 10px rgba(0, 0, 0, 0.6),
    0 30px 80px rgba(0, 0, 0, 0.8),
    0 0 110px color-mix(in oklab, var(--knock-pulse-color, var(--royal-trim)) 55%, transparent);
  transition: box-shadow 140ms ease;
}

.royal-door video,
.royal-door canvas {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  object-fit: cover;
  transform: scaleX(-1);
  border: 0 !important;
  border-radius: 0 !important;
  clip-path: none !important;
}

.royal-door-glow {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(80% 55% at 50% 0%, rgba(255, 255, 255, 0.16), transparent 62%);
}

.royal-bouncer {
  width: auto;
  height: clamp(200px, 42vh, 440px);
  filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.65));
  transform-origin: 50% 100%;
  animation: royal-breathe 4.2s ease-in-out infinite;
}

@keyframes royal-breathe {
  50% {
    transform: scaleY(1.012);
  }
}

.royal-actions {
  position: absolute;
  z-index: 4;
  left: 0;
  right: 0;
  bottom: 2.4vh;
  display: flex;
  justify-content: center;
}

.royal-button {
  font: inherit;
  font-size: 1.15rem;
  letter-spacing: 0.1em;
  padding: 0.8em 2.4em;
  border: 1.5px solid var(--royal-trim);
  border-radius: 999px;
  color: #140b00;
  background: linear-gradient(
    180deg,
    color-mix(in oklab, var(--royal-trim) 80%, #fff),
    var(--royal-trim)
  );
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.6),
    0 0 30px color-mix(in oklab, var(--royal-trim) 40%, transparent);
  cursor: pointer;
}

.royal .knock-name {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 12vh;
  width: min(420px, calc(100vw - 32px));
  margin: 0;
  padding: 18px;
  transform: translateX(-50%);
  border: 1px solid var(--royal-trim);
  border-radius: 22px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.royal .knock-name-title,
.royal .knock-name-sub {
  display: none;
}

.royal-curtain {
  position: absolute;
  z-index: 10;
  top: 0;
  bottom: 0;
  width: 51%;
  background:
    repeating-linear-gradient(
      90deg,
      var(--royal-velvet-1) 0,
      var(--royal-velvet-0) 2.2%,
      color-mix(in oklab, var(--royal-velvet-0) 72%, #fff) 3%,
      var(--royal-velvet-0) 3.8%,
      var(--royal-velvet-1) 6%
    ),
    var(--royal-velvet-0);
  box-shadow: inset 0 -60px 80px rgba(0, 0, 0, 0.55);
  transition: transform 1.6s cubic-bezier(0.7, 0, 0.2, 1);
}

.royal-curtain::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 18px;
  background: repeating-linear-gradient(90deg, var(--royal-trim) 0 3px, transparent 3px 7px);
  opacity: 0.9;
}

.royal-curtain-left {
  left: 0;
}

.royal-curtain-right {
  right: 0;
}

.royal[data-curtains='open'] .royal-curtain-left {
  transform: translateX(-82%);
}

.royal[data-curtains='open'] .royal-curtain-right {
  transform: translateX(82%);
}

.royal-valance {
  position: absolute;
  z-index: 11;
  top: 0;
  left: 0;
  right: 0;
  height: 6.4vh;
  background: linear-gradient(180deg, var(--royal-velvet-1), var(--royal-velvet-0));
  border-bottom: 3px solid var(--royal-trim);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.royal-valance::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 16px;
  background: radial-gradient(circle at 50% 0, var(--royal-velvet-0) 0 62%, transparent 64%) 0 0 /
    64px 32px repeat-x;
}

.royal[data-entering='true'] .royal-stage {
  transform: translateX(-50%) scale(1.3);
}

.royal[data-entering='true']::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 9;
  background: radial-gradient(circle at 50% 70%, #fff8e1, var(--royal-trim) 40%, transparent 75%);
  animation: royal-enter 1.3s ease-in forwards;
}

@keyframes royal-enter {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 640px) {
  .royal-stage {
    bottom: 10vh;
  }
  .royal-queue {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 36vw;
    max-width: none;
    opacity: 0.85;
  }
  .royal-man {
    position: absolute;
    right: 0;
    bottom: 0;
    justify-content: flex-end;
  }
  .royal-bouncer {
    height: min(22vh, 48vw);
  }
  .royal-door {
    width: min(56vw, 34vh);
  }
  .royal-line {
    top: calc(6.4vh + 40px);
    font-size: clamp(2rem, 10vw, 3rem);
  }
}

@media (max-height: 560px) {
  .royal-door {
    width: min(30vw, 40vh);
  }
  .royal-bouncer {
    height: 46vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .royal *,
  .royal::after,
  .royal-curtain {
    animation: none !important;
    transition: none !important;
  }
}

/* A site's door shows nothing but Royal, even in the instant before he arrives. */
.auth-screen[data-site] > :not(.royal) {
  visibility: hidden;
}
.auth-screen[data-site] .royal .knock-name {
  visibility: visible;
}

/* Hot or cold: how close the way in came, only for a face Royal knows. */
.royal-heat {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 2.6vh;
  width: min(560px, 82vw);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  pointer-events: none;
}
.royal-heat[hidden] {
  display: none;
}
.royal-heat-track {
  position: relative;
  flex: 1 1 auto;
  height: 18px;
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(90deg, rgba(120, 190, 255, 0.18), rgba(255, 80, 40, 0.18));
  box-shadow:
    inset 0 0 0 1.5px color-mix(in oklab, var(--royal-trim) 70%, transparent),
    0 0 30px rgba(0, 0, 0, 0.6);
}
.royal-heat-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--royal-heat, 0) * 100%);
  min-width: 18px;
  border-radius: inherit;
  background: linear-gradient(90deg, hsl(205 95% 60%), var(--royal-heat-color, hsl(205 95% 60%)));
  box-shadow: 0 0 calc(10px + var(--royal-heat, 0) * 40px) var(--royal-heat-color, transparent);
  transition:
    width 900ms cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 900ms ease;
  animation: royal-heat-breathe 1.6s ease-in-out infinite;
}
.royal[data-listening='true'] .royal-heat-fill {
  animation: royal-heat-listen 0.5s ease-in-out infinite alternate;
}
@keyframes royal-heat-breathe {
  50% {
    filter: brightness(1.25);
  }
}
@keyframes royal-heat-listen {
  from {
    filter: brightness(0.9);
    transform: scaleY(0.86);
  }
  to {
    filter: brightness(1.45);
    transform: scaleY(1.08);
  }
}
.royal-heat-word {
  flex: 0 0 auto;
  min-width: 4.6em;
  font-size: clamp(1.3rem, 3.4vw, 2.2rem);
  font-weight: 600;
  color: var(--royal-heat-color, #fff);
  text-shadow: 0 0 18px var(--royal-heat-color, transparent), 0 2px 10px #000;
  transition: color 600ms ease;
}
.royal[data-heat] .royal-door {
  box-shadow:
    0 0 0 6px color-mix(in oklab, var(--royal-heat-color) 70%, var(--royal-trim)),
    0 0 0 10px rgba(0, 0, 0, 0.6),
    0 30px 80px rgba(0, 0, 0, 0.8),
    0 0 calc(60px + var(--royal-heat, 0) * 120px) var(--royal-heat-color);
}
.royal[data-heat='hot'] .royal-door {
  animation: royal-door-hot 0.9s ease-in-out infinite alternate;
}
@keyframes royal-door-hot {
  to {
    filter: brightness(1.12) saturate(1.2);
  }
}
@media (max-width: 640px) {
  .royal-heat {
    bottom: 3vh;
    gap: 10px;
  }
}
