/* MAX · Presence. The room is the canvas; the only type is a name, a state and three quiet controls. */
.presence { position: fixed; inset: 0; z-index: 60; overflow: hidden; background: #05060a; color: #eef2f8; font-family: "Archivo", system-ui, sans-serif; opacity: 0; transition: opacity .9s cubic-bezier(.2, .7, .2, 1); }
.presence[hidden] { display: none; }
.presence:focus { outline: none; }
.presence.on { opacity: 1; }
.presence[data-light="1"] { background: #e8e6e2; color: #2a2d33; }
.presence-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.presence-mark { position: absolute; top: max(22px, env(safe-area-inset-top)); left: 0; right: 0; margin: 0; text-align: center; font: 500 11px/1 "Archivo", system-ui, sans-serif; letter-spacing: .62em; text-indent: .62em; opacity: .62; pointer-events: none; }
.presence-state { position: absolute; left: 0; right: 0; bottom: calc(118px + env(safe-area-inset-bottom)); margin: 0; text-align: center; font: 400 11px/1.4 "Archivo", system-ui, sans-serif; letter-spacing: .34em; text-indent: .34em; text-transform: uppercase; opacity: .56; transition: opacity .6s ease; pointer-events: none; }
.presence-state:empty { opacity: 0; }
.presence-controls { position: absolute; left: 0; right: 0; bottom: calc(34px + env(safe-area-inset-bottom)); display: flex; justify-content: center; align-items: center; gap: clamp(28px, 9vw, 72px); }
.presence-controls button { appearance: none; border: 0; background: none; color: inherit; font: 400 12px/1 "Archivo", system-ui, sans-serif; letter-spacing: .18em; text-transform: uppercase; opacity: .62; padding: 14px 6px; min-width: 44px; min-height: 44px; cursor: pointer; transition: opacity .3s ease; }
.presence-controls button:hover, .presence-controls button:focus-visible { opacity: 1; }
.presence-controls button:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; }
/* The one primary control: a hairline ring you speak through. */
.presence-controls .presence-talk { width: 64px; height: 64px; padding: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px currentColor; opacity: .78; position: relative; }
.presence-talk::after { content: ""; position: absolute; inset: 27px; border-radius: 50%; background: currentColor; opacity: .85; transition: inset .35s cubic-bezier(.2, .7, .2, 1), border-radius .35s ease; }
.presence[data-state="listening"] .presence-talk::after { inset: 25px; border-radius: 3px; }
.presence[data-state="speaking"] .presence-talk::after { inset: 26px; border-radius: 2px; opacity: .6; }
.presence-close { position: absolute; top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); appearance: none; border: 0; background: none; color: inherit; width: 44px; height: 44px; opacity: .55; cursor: pointer; font-size: 22px; line-height: 1; }
.presence-close:hover, .presence-close:focus-visible { opacity: 1; }
.presence-caption { position: absolute; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(520px, 84vw); margin: 0; text-align: center; font: 300 15px/1.55 "Archivo", system-ui, sans-serif; opacity: .82; pointer-events: none; }
.presence-caption:empty { display: none; }
.presence-caption { transition: opacity .8s ease; }
.presence-caption.fade { opacity: 0; }
/* Still image when WebGL is missing: the canvas draws the face once over this room. */
.presence.presence-static { background: radial-gradient(60% 50% at 50% 46%, #3b2a8a, #0a0b18 70%); }
.presence[data-light="1"].presence-static { background: radial-gradient(60% 50% at 50% 46%, #fffdf8, #dedcd7 70%); }
@media (prefers-reduced-motion: reduce) { .presence { transition: none; } .presence-talk::after { transition: none; } }
@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  .presence-mark { top: 34px; font-size: 12px; }
  .presence-state { bottom: 132px; }
  .presence-controls { bottom: 46px; }
}

/* Review controls remain at the edge of the room. Home is always available via Back. */
.presence-review { position: absolute; z-index: 1; inset: max(4.5rem, calc(env(safe-area-inset-top) + 4rem)) 1.25rem auto auto;
  display: flex; flex-wrap: wrap; justify-content: end; gap: .25rem .55rem; color: inherit; max-width: calc(100% - 2.5rem); font-size: .74rem; }
.presence-review label { display: inline-flex; align-items: center; gap: .30rem; }
.presence-review select { max-width: 9rem; min-height: 36px; padding: .2rem; font: inherit; color: inherit; background: transparent; border: 1px solid currentColor; border-radius: .25rem; }
.presence-review option { color: CanvasText; background: Canvas; }
.presence-review [role="status"]:empty { display: none; }
#presence-room[data-environment="solar"] { background: #e2dfdd; }
#presence-room[data-environment="lunar"] { background: #151422; }
#presence-room[data-environment="aperture"] { background: #452354; }

/* Experience Integrity: the face is not a renderer configuration panel. Face/Room review controls live under
   Appearance → Presence renderer controls (advanced), off by default. */
body:not(.presence-advanced) .presence-review { display: none; }
