/* The talk room on the 3D page (room3d.js, wu-fc6d99ab): the shared ../roomsession.js and ../roomview.js in the dashboard's glass.
   A column on the right where the drawer sits: the Session panel, then the room. Two people-colours as in Fable: the owner amber, a
   guest blue. Everything is scoped to #as-sessioncol (the dashboard has its own .empty, .key and .msg-free rows). */
#as-bar #as-session-key { position: relative; }
/* the room strip (roomstrip.js): under the bar, centred; who is in, the floor or who is typing, a badge and a "James said…" pill */
#as-roomstrip { position: fixed; z-index: 4; top: calc(66px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; max-width: min(92vw, 560px);
  padding: 5px 8px 5px 6px; border-radius: 999px; color: var(--text); background: rgba(18, 18, 22, 0.72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line-2); font: 500 0.78em/1.2 "Plex Sans", system-ui, sans-serif; cursor: pointer; }
#as-roomstrip[hidden] { display: none; }
#as-roomstrip .who { display: flex; align-items: center; }
#as-roomstrip .who .face.p { width: 22px; height: 22px; font-size: 0.6em; border-radius: 50%; margin-right: -6px; border: 1px solid #14151a; background: linear-gradient(135deg, #5b9bd5, #1a1c22 85%); color: #fff; }
#as-roomstrip .who .face.p.owner { background: linear-gradient(135deg, var(--amber-2, #ffb000), #1a1c22 85%); color: #1a1200; }
#as-roomstrip .who .face.p img { border-radius: 50%; }
#as-roomstrip .line { margin-left: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0.85; }
#as-roomstrip.live .line { color: var(--green); opacity: 1; }
#as-roomstrip .badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--amber-2, #ffb000); color: #1a1200; font-weight: 700; font-size: 0.85em; display: inline-grid; place-items: center; }
#as-roomstrip .badge[hidden], #as-roomstrip .pill[hidden] { display: none; }
#as-roomstrip .pill { border: 1px solid rgba(255, 176, 0, 0.5); background: rgba(255, 176, 0, 0.12); color: var(--amber-2, #ffb000); border-radius: 999px; padding: 2px 9px; font: inherit; cursor: pointer; white-space: nowrap; }
#as-roomstrip .aloud { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line-2); background: transparent; color: var(--text); display: grid; place-items: center; cursor: pointer; padding: 0; opacity: 0.8; }
#as-roomstrip .aloud svg { width: 15px; height: 15px; }
#as-roomstrip .aloud[aria-pressed="false"] .w, #as-roomstrip .aloud:disabled .w { display: none; }
#as-roomstrip .aloud[aria-pressed="false"], #as-roomstrip .aloud:disabled { opacity: 0.45; }
@media (max-aspect-ratio: 999/1000) and (max-width: 600px) { #as-roomstrip { top: calc(132px + env(safe-area-inset-top, 0px)); max-width: 94vw; } }
/* the bar is at its width on a 1280 px screen: with the Session key there, the key hints step aside below 1500 px (the labels stay) */
@media (max-width: 1500px) { #as-bar:has(#as-session-key) kbd { display: none; } }
/* a phone held up: the key is a compact icon in the top-right corner, beside the sign-in one (room3d.js moves it there) */
#as-session-key.corner {
  position: fixed; z-index: 5; top: calc(10px + env(safe-area-inset-top, 0px)); right: calc(10px + 52px + 8px); display: grid; place-items: center;
  width: 52px; height: 52px; padding: 0; border-radius: 14px; cursor: pointer; color: var(--text);
  background: rgba(18, 18, 22, 0.72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line-2);
}
#as-session-key.corner .lbl, #as-session-key.corner kbd { display: none; }
#as-session-key.corner svg { width: 22px; height: 22px; }
#as-session-key.corner.on { border-color: rgba(255, 176, 0, 0.6); color: var(--amber-2); }
#as-session-key .dot { position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px rgba(61, 214, 140, 0.7); display: none; }
#as-session-key.live .dot { display: block; }

#as-sessioncol {
  position: fixed; top: calc(12px + 3.4em); right: 12px; bottom: 12px; z-index: 5; width: min(440px, calc(100vw - 24px));
  display: flex; flex-direction: column; gap: 10px; opacity: 0; transform: translateY(-6px) scale(0.985); pointer-events: none;
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
}
#as-sessioncol.open { opacity: 1; transform: none; pointer-events: auto; }
#as-sessioncol > section { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
#as-sessioncol > section[hidden] { display: none; }
#as-sessioncol h2, #as-sessioncol h3 { margin: 0; font-weight: 600; }
#as-sessioncol .key { display: inline-flex; align-items: center; gap: 6px; min-height: 2.1em; padding: 0 0.85em; border-radius: 8px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.04); cursor: pointer; color: var(--text); font-size: 0.86em; }
#as-sessioncol .key:hover { border-color: rgba(255, 255, 255, 0.3); }
#as-sessioncol .key.primary { background: rgba(255, 176, 0, 0.18); border-color: rgba(255, 176, 0, 0.6); color: #ffe3a6; }
#as-sessioncol .key.danger { border-color: rgba(255, 90, 78, 0.55); color: #ffc4be; }
#as-sessioncol .key:disabled { opacity: 0.45; cursor: default; }
#as-sessioncol .key svg { width: 1.2em; height: 1.2em; }
#as-sessioncol .dim, #as-sessioncol .empty { color: var(--dim); font-size: 0.86em; }
#as-sessioncol .lamp { display: inline-block; width: 0.55em; height: 0.55em; border-radius: 50%; background: var(--faint); flex: none; }
#as-sessioncol .lamp[data-st="working"], #as-sessioncol .lamp[data-st="on"] { background: var(--green); box-shadow: 0 0 6px rgba(61, 214, 140, 0.6); }

/* the Session panel: the shared management */
#as-session { flex: none; max-height: 46%; }
#as-session header { display: flex; align-items: center; gap: 10px; padding: 12px 14px 8px; border-bottom: 1px solid var(--line); }
#as-session header h2 { font-size: 1.05em; flex: 1; }
#as-session .count { font: 500 0.72em/1 "Plex Mono", ui-monospace, monospace; text-transform: uppercase; letter-spacing: 0.12em; color: var(--green); }
#as-session .x { width: 2em; height: 2em; border-radius: 8px; border: 1px solid var(--line); background: transparent; cursor: pointer; color: var(--dim); }
#as-session .mgmt { padding: 10px 14px 12px; display: grid; gap: 10px; overflow: auto; }
#as-session .line1 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
#as-session .grow { flex: 1; }
#as-session .ends { font: 500 0.72em/1 "Plex Mono", ui-monospace, monospace; text-transform: uppercase; letter-spacing: 0.1em; color: var(--dim); }
#as-session .link { font: 400 0.78em/1.4 "Plex Mono", ui-monospace, monospace; color: var(--amber-2); overflow-wrap: anywhere; }
#as-session form { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; }
#as-session input { min-height: 2.2em; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, 0.3); color: var(--text); font: inherit; font-size: 0.9em; min-width: 0; }
#as-session input:focus { outline: none; border-color: rgba(255, 176, 0, 0.6); }
#as-session .invites { display: flex; flex-direction: column; gap: 6px; }
#as-session .invite { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 0.9em; }
#as-session .invite .em { font: 400 0.8em/1.4 "Plex Mono", ui-monospace, monospace; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#as-session .waiting { display: inline-flex; align-items: center; gap: 8px; color: var(--dim); font-size: 0.92em; }
#as-session .st { color: #ffb4ad; font-size: 0.86em; } #as-session .st:empty { display: none; } #as-session .st.ok { color: var(--green); }

/* faces: the agents' (painting, mini face or initials) and the people's portrait slot (initials today, an avatar later) */
#as-sessioncol .face { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; overflow: hidden; flex: none; background: #2a2d33; color: var(--text); font: 600 0.78em/1 "Plex Sans", sans-serif; }
#as-sessioncol .face img { width: 100%; height: 100%; object-fit: cover; display: block; }
#as-sessioncol .face.sm { width: 24px; height: 24px; font-size: 0.62em; border-radius: 50%; }
#as-sessioncol .face.p { border-radius: 50%; background: linear-gradient(135deg, var(--blue), #1d2230 85%); color: #fff; }
#as-sessioncol .face.p.owner { background: linear-gradient(135deg, var(--amber), #2b2416 85%); color: #261a00; }
#as-sessioncol .face.p img { border-radius: 50%; }

/* the room */
#as-room { flex: 1; }
#as-room .roster { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; padding: 8px 10px 6px; border-bottom: 1px solid var(--line); max-height: 30%; overflow: auto; }
#as-room .roster h3 { font: 500 0.66em/1 "Plex Mono", ui-monospace, monospace; text-transform: uppercase; letter-spacing: 0.14em; color: var(--faint); padding: 4px 4px 6px; }
#as-room .people, #as-room .agents { display: flex; flex-direction: column; gap: 2px; }
#as-room .person, #as-room .agent { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 4px 6px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: inherit; text-align: left; font: inherit; }
#as-room .agent { cursor: pointer; }
#as-room .agent:hover { background: rgba(255, 255, 255, 0.05); }
#as-room .agent.on { background: rgba(255, 176, 0, 0.1); border-color: rgba(255, 176, 0, 0.4); }
#as-room .nm { font-weight: 600; font-size: 0.9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#as-room .rl { font: 500 0.64em/1.4 "Plex Mono", ui-monospace, monospace; text-transform: uppercase; letter-spacing: 0.1em; color: var(--dim); }
#as-room .person.off { opacity: 0.55; }
#as-room .rh { display: flex; align-items: center; padding: 6px 12px; border-bottom: 1px solid var(--line); min-height: 2.2em; }
#as-room .floor { display: inline-flex; align-items: center; gap: 8px; font: 500 0.7em/1 "Plex Mono", ui-monospace, monospace; text-transform: uppercase; letter-spacing: 0.1em; color: var(--dim); }
#as-room .floor.on { color: var(--green); }
#as-room .floor small { color: var(--faint); }
#as-room .notice { display: grid; place-items: center; gap: 10px; padding: 22px 16px; text-align: center; }
#as-room .notice[hidden] { display: none; }
#as-room .notice .big { font-size: 1.05em; font-weight: 600; }
#as-room .msgs { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 10px 12px; }
#as-room .msgs .empty { align-self: center; padding: 18px 0; }
#as-room .msg { display: grid; gap: 4px; max-width: 92%; }
#as-room .bub { padding: 8px 11px; border-radius: 4px 10px 10px 10px; background: rgba(255, 255, 255, 0.06); border-left: 3px solid var(--blue); font-size: 0.92em; line-height: 1.4; overflow-wrap: anywhere; }
#as-room .bub.pending { color: var(--dim); font-style: italic; }
#as-room .meta { display: flex; gap: 8px; font: 400 0.68em/1.3 "Plex Mono", ui-monospace, monospace; color: var(--faint); }
#as-room .meta .st { color: var(--amber-2); }
#as-room .msg.turn { justify-items: start; }
#as-room .msg.turn.owner .bub { border-left-color: var(--amber); }
#as-room .msg.turn.me { align-self: flex-end; justify-items: end; }
#as-room .msg.turn.me .bub { border-left: 0; border-right: 3px solid var(--amber); border-radius: 10px 4px 10px 10px; background: rgba(255, 176, 0, 0.12); }
#as-room .msg.turn.me.guest .bub { border-right-color: var(--blue); background: rgba(106, 168, 255, 0.12); }
#as-room .chip.who { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px 2px 2px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 0.78em; max-width: 100%; }
#as-room .chip.who b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#as-room .chip.who i { font: 500 0.72em/1 "Plex Mono", ui-monospace, monospace; text-transform: uppercase; letter-spacing: 0.1em; color: var(--dim); font-style: normal; }
#as-room .chip.who.owner { border-color: rgba(255, 176, 0, 0.45); } #as-room .chip.who.owner i { color: var(--amber-2); }
#as-room .chip.who.guest { border-color: rgba(106, 168, 255, 0.45); } #as-room .chip.who.guest i { color: var(--blue); }
#as-room .msg.from-agent { grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: start; }
#as-room .msg.from-agent .body { display: grid; gap: 4px; }
#as-room .msg.from-agent .bub { border-left-color: var(--line-2); }
#as-room .reel { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
#as-room .reel .clip { display: inline-grid; place-items: center; min-width: 1.6em; height: 1.6em; padding: 0 5px; border-radius: 5px; border: 1px solid var(--line-2); font: 500 0.7em/1 "Plex Mono", ui-monospace, monospace; color: var(--dim); background: transparent; }
#as-room .reel .clip.play { cursor: pointer; color: var(--text); gap: 4px; display: inline-flex; }
#as-room .reel .clip.playing { border-color: var(--green); color: var(--green); }
#as-room .reel .more { font: 400 0.66em/1 "Plex Mono", ui-monospace, monospace; color: var(--faint); }
#as-room .composer { border-top: 1px solid var(--line); padding: 8px 10px 10px; }
#as-room .composer .to { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding-bottom: 6px; }
#as-room .composer .to .lbl { font: 500 0.64em/1 "Plex Mono", ui-monospace, monospace; text-transform: uppercase; letter-spacing: 0.12em; color: var(--faint); }
#as-room .composer .mode { padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--dim); font-size: 0.78em; cursor: pointer; }
#as-room .composer .mode.on { border-color: rgba(255, 176, 0, 0.6); color: #ffe3a6; background: rgba(255, 176, 0, 0.12); }
#as-room .composer .err { color: #ffb4ad; font-size: 0.82em; } #as-room .composer .err:empty { display: none; }
#as-room .composer .rec { font: 500 0.68em/1.4 "Plex Mono", ui-monospace, monospace; color: var(--red); text-transform: uppercase; letter-spacing: 0.1em; padding-bottom: 6px; }
#as-room .composer .rec[hidden] { display: none; }
#as-room .composer .row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px; align-items: end; }
#as-room .composer textarea { resize: none; min-height: 2.2em; max-height: 8em; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, 0.3); color: var(--text); font: inherit; font-size: 0.92em; }
#as-room .composer textarea:focus { outline: none; border-color: rgba(255, 176, 0, 0.6); }
#as-room .composer .mic.live { background: rgba(255, 90, 78, 0.22); border-color: rgba(255, 90, 78, 0.7); color: #ffd2cd; }
#as-room.closed .composer, #as-room.closed .rh .floor, #as-room.closed .roster, #as-room.closed .msgs { display: none; }
#as-room .composer.off .to, #as-room .composer.off .rec { display: none; }

/* portrait screens and phones: the column is a sheet over the bottom of the lot, under the toolbar */
@media (max-aspect-ratio: 999/1000) {
  #as-sessioncol { top: max(calc(var(--gap) + env(safe-area-inset-top, 0px) + 52px), var(--top-clear, 0px)); left: var(--gap); right: var(--gap); bottom: var(--above-bar); width: auto; }
  #as-sessioncol .key, #as-session .x { min-height: 44px; }
  #as-session { max-height: 40%; }
  #as-session form, #as-room .roster { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { #as-sessioncol { transition: none; } }
/* the guard held a reply back (roomview.js, the owner only): a muted line where the stand-in reply was */
#as-room .msg.withheld { justify-items: start; opacity: 0.72; }
#as-room .msg.withheld .bub { font-style: italic; background: none; border: 1px dashed var(--line-2); color: var(--dim); }
/* @mentions, guarded answers and the owner's Summon (roomview.js) in the dashboard's glass */
#as-room .composer .mention-pick { display: flex; flex-wrap: wrap; gap: 4px; padding-bottom: 6px; }
#as-room .composer .mention-pick[hidden] { display: none; }
#as-room .composer .mention-pick .pick, #as-room .agents .summon-one { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 4px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.04); color: var(--text); font: inherit; font-size: 0.8em; cursor: pointer; min-height: 30px; }
#as-room .composer .mention-pick .pick.on, #as-room .agents .summon-one:hover { border-color: rgba(255, 176, 0, 0.6); background: rgba(255, 176, 0, 0.12); }
#as-room .composer .mention-pick .pick i { font-style: normal; color: var(--dim); }
#as-room .msg .bub .at { font-weight: 600; color: #ffe3a6; white-space: nowrap; }   /* a mention never breaks mid-name */
#as-room .msg .bub .at.guest, #as-room .msg .meta .to-person { color: var(--blue); }
#as-room .msg .bub .at.me, #as-room .msg .meta .to-person.me { color: #ffe3a6; }
#as-room .msg.turn.shown .bub { border-style: dashed; }
#as-room .msg .meta .st.shown { color: var(--dim); font-style: italic; }
#as-room .msg .meta .st.voice { color: var(--blue); display: inline-flex; align-items: center; }   /* a guest's live voice, transcribed: the mic mark */
#as-room .agents .guard-note { font-size: 0.76em; color: var(--dim); padding: 6px 2px 2px; line-height: 1.4; }
#as-room .agents .summon { display: grid; gap: 6px; padding-top: 6px; }
#as-room .agents .summon-list { display: flex; flex-wrap: wrap; gap: 4px; max-height: 12em; overflow: auto; }
#as-room .agents .summon-st { font-size: 0.78em; color: #ffb4ad; }
#as-room .agents .summon-st.ok { color: var(--green); }
/* a guest's live mic (../roommic.js): "<name>'s mic is live" in the strip */
#as-roomstrip .mics { color: #ff7a70; white-space: nowrap; font-weight: 600; }
#as-roomstrip .mics::before { content: "●"; color: #ff3b30; margin-right: 4px; }
#as-roomstrip .mics[hidden] { display: none; }
/* the owner's live mic in the strip (../roommic.js): the key, and while live a red dot and Stop */
#as-roomstrip .micslot:empty { display: none; }
#as-roomstrip .livemic { display: flex; align-items: center; gap: 6px; }
#as-roomstrip .livemic[hidden], #as-roomstrip .livemic [hidden] { display: none; }
#as-roomstrip .livemic button { font: inherit; font-size: 0.95em; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.25); background: transparent; color: inherit; padding: 2px 9px; cursor: pointer; }
#as-roomstrip .livemic .mic-live { display: inline-flex; align-items: center; gap: 6px; padding: 1px 2px 1px 8px; border-radius: 999px; border: 1px solid #ff3b30; background: rgba(255, 59, 48, 0.16); white-space: nowrap; }
#as-roomstrip .livemic .dot { width: 9px; height: 9px; border-radius: 50%; background: #ff3b30; box-shadow: 0 0 8px #ff3b30; }
#as-roomstrip .livemic .mic-stop { border-color: #ff3b30; color: #ff7a70; }
