/* A quiet arrival: a welcome on the left, one clear way into the room. */
.room-app:has(.lobby-view:not([hidden])) {
    background: radial-gradient(ellipse at 12% 38%, #e9ecdf70, transparent 55%), radial-gradient(ellipse at 88% 85%, #f1ecdc60, transparent 50%), var(--paper);
}
.room-app:has(.lobby-view:not([hidden])) .room-header { width: 100%; max-width: 1140px; height: 80px; padding-inline: 40px; border: 0; }
.room-app:has(.lobby-view:not([hidden])) .room-footer { display: none; }
.room-app:has(.lobby-view:not([hidden])) main { display: grid; align-items: center; min-height: 0; }
.lobby-view { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); align-items: center; gap: clamp(40px, 6vw, 80px); width: 100%; max-width: 1140px; margin: auto; padding: 24px 40px 40px; }
.lobby-story { min-width: 0; padding-block: 8px; }
.lobby-story > .eyebrow { color: #728166; font-size: 10px; letter-spacing: .15em; }
.lobby-story h1 { margin-top: 20px; font-size: clamp(52px, 4.8vw, 68px); line-height: 1.03; letter-spacing: -.035em; }
.lobby-story h1 em { color: #819071; }
.lobby-introduction { max-width: 320px; margin-top: 22px; font-size: 14px; line-height: 1.8; color: #687361; text-wrap: pretty; }
.arrival-details { max-width: 390px; margin-top: 30px; padding: 22px; border: 1px solid #dde3d4; border-radius: 22px; background: linear-gradient(140deg, #f5f7ed, #eef2e5); box-shadow: inset 0 1px 0 #ffffffe0; }
.arrival-therapist { display: flex; align-items: center; gap: 13px; padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid #dce3d2; }
.arrival-avatar { position: relative; display: grid; place-items: center; flex: 0 0 46px; width: 46px; height: 46px; border: 1px solid #d5dfc9; border-radius: 50%; background: #e5ecda; color: #596f4b; font-size: 14px; overflow: hidden; }
.arrival-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.arrival-therapist > div { min-width: 0; }
.arrival-therapist strong { display: block; color: #3f5946; font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.arrival-therapist > div > span { display: block; margin-top: 4px; color: #6d7964; font-size: 12px; }
.appointment-summary { display: flex; align-items: flex-start; gap: 12px; }
.summary-icon { display: grid; place-items: center; flex: 0 0 22px; width: 22px; height: 22px; color: #829274; }
.summary-icon .icon { width: 16px; height: 16px; font-size: 16px; }
.appointment-summary > div { min-width: 0; }
.appointment-summary strong { display: block; margin-bottom: 6px; font-size: 13px; line-height: 1.45; }
.appointment-summary span:not(.summary-icon) { display: block; color: #6a7562; font-size: 12px; line-height: 1.75; }

/* Settings have their own space; the preview and Join action stay in view. */
.preflight-card { min-width: 0; border: 1px solid #dfe3d6; border-radius: 28px; background: var(--surface); box-shadow: 0 4px 8px #34483d03, 0 24px 64px -20px #34483d14; }
.preflight-preview { padding: 24px 24px 0; }
.preflight-topline { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.preflight-topline h2 { font: 400 28px/1.1 var(--serif); letter-spacing: -.025em; }
.preflight-step { display: inline-flex; align-items: center; gap: 6px; color: #7a8572; font-size: 11px; white-space: nowrap; }
.preflight-step .icon { width: 10px; height: 10px; font-size: 10px; }
.preview-stage { position: relative; isolation: isolate; overflow: hidden; aspect-ratio: 16 / 10; min-height: 180px; max-height: clamp(180px, calc(100dvh - 470px), 310px); margin-top: 18px; border: 1px solid #dfe4d5; border-radius: 19px; background: #27342b; }
.preview-stage video { display: block; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.room-app[data-device="art"] .preview-stage video { transform: none; object-fit: contain; }
.preview-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 24px 24px 68px; background: radial-gradient(ellipse at 50% 15%, #f7f7ed, #e6eadd); text-align: center; }
.preview-placeholder-icon { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 3px; border-radius: 14px; background: #dce3d350; color: #78866a; }
.preview-placeholder-icon .icon { width: 19px; height: 19px; font-size: 19px; }
.preview-placeholder strong { color: var(--ink); font-size: 14px; }
.preview-placeholder small { max-width: 290px; color: #63735a; font-size: 12px; line-height: 1.5; }
.preview-label { position: absolute; left: 13px; top: 13px; padding: 4px 8px; border: 1px solid #ffffff24; border-radius: 8px; background: #21362c80; color: #fffef9; font-size: 10px; backdrop-filter: blur(12px); }
.preview-stage:has(.preview-placeholder:not([hidden])) .preview-label { background: transparent; border-color: transparent; color: #63735a; backdrop-filter: none; }
.preview-controls { position: absolute; left: 50%; bottom: 14px; display: flex; gap: 4px; padding: 4px; border: 1px solid #fffefa90; border-radius: 17px; background: #fdfcf8eb; box-shadow: 0 4px 20px #15281e20; backdrop-filter: blur(14px); transform: translateX(-50%); }
.circle-control { display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; padding: 0; border: 1px solid transparent; border-radius: 12px; background: transparent; color: #51644c; transition: background 160ms ease; }
.circle-control:hover { background: #e9eddf; }
.circle-control[aria-pressed="true"] { border-color: #dedfcf; background: #eaeade; color: #696450; }
.circle-control .icon { width: 17px; height: 17px; font-size: 17px; }
.preview-dock { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 12px; }
.preview-feedback { flex: 1; min-width: 0; color: #728069; font-size: 11px; line-height: 1.6; }
.preflight-settings-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex-shrink: 0; min-height: 44px; padding: 10px 13px; border: 1px solid #e0e5d8; border-radius: 12px; background: #f5f7ee; color: #52654a; font-size: 12px; transition: background 160ms ease, border-color 160ms ease; }
.preflight-settings-button:hover { background: #eaf0e0; border-color: #cfd9c2; }
.preflight-settings-button .icon { width: 13px; height: 13px; font-size: 13px; }
.preview-retry { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; margin-top: 8px; padding: 7px 10px; border: 1px solid #dce2d1; border-radius: 10px; background: #f4f6ec; color: var(--green); font-size: 12px; }
.preview-retry .icon { width: 12px; height: 12px; font-size: 12px; }
.preflight-join { margin-top: 18px; padding: 20px 24px 24px; border-top: 1px solid #e7e9df; border-radius: 0 0 28px 28px; background: linear-gradient(180deg, #f6f8f060, #f3f6ea90); }
.arrival-presence { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.arrival-presence-mark { display: grid; place-items: center; flex: 0 0 34px; height: 34px; border: 1px solid #e0e6d7; border-radius: 12px; background: #f1f4e9; color: #778969; font-size: 13px; transition: background 250ms ease, color 250ms ease; }
.arrival-presence[data-arrival-state="ready"] .arrival-presence-mark { background: #e6eeda; border-color: #d9e3ce; color: #557549; }
.arrival-presence strong { display: block; color: #455d3f; font-size: 13px; font-weight: 500; line-height: 1.5; }
.arrival-presence p { margin-top: 4px; color: #748069; font-size: 12px; line-height: 1.6; }

/* A welcome within the room, with space for preparation and one clear invitation. */
.arrival-waiting { display: flex; flex-direction: column; align-items: center; width: min(100%, 430px); }
.arrival-welcome-symbol { display: grid; place-items: center; width: 70px; height: 78px; margin-bottom: 22px; border: 1px solid #ced7c380; border-radius: 32px 32px 26px 26px; background: linear-gradient(145deg, #fafbf3c0, #dce5d360); color: #778a6a; box-shadow: 0 10px 35px #60715308, inset 0 1px 0 #ffffff80; }
.arrival-welcome-symbol .brand-mark { width: 33px; height: 42px; }
.arrival-welcome-eyebrow { margin-bottom: 12px; color: #637459; font-size: 10px; font-weight: 500; letter-spacing: .09em; text-transform: uppercase; }
.call-view[data-role] .arrival-waiting strong { display: block; font: 400 clamp(28px, 3vw, 38px)/1.15 var(--serif); letter-spacing: -.02em; text-wrap: balance; }
.call-view[data-role] .arrival-waiting .arrival-message p { max-width: 350px; margin: 12px auto 0; font-size: 13px; line-height: 1.75; text-wrap: pretty; }
.arrival-open-button { min-height: 44px; margin-top: 26px; padding: 11px 18px; gap: 14px; border-radius: 13px; background: #45633f; font-size: 12px; box-shadow: 0 3px 8px #34483d0a; }
.arrival-open-button .icon { width: 13px; height: 13px; font-size: 13px; }
.arrival-open-button:hover:not(:disabled) { transform: none; background: #385733; }
.arrival-open-button:disabled { opacity: .65; cursor: wait; }
.arrival-welcome-note { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; color: #64715d; font-size: 10px; line-height: 1.5; }
.arrival-welcome-note .icon { width: 9px; height: 9px; font-size: 9px; }
.call-view[data-role] .arrival-error { margin-top: 12px; color: #875d49; font-size: 12px; }
.arrival-message strong:focus { outline: none; }
.arrival-waiting[data-arrival-state="ready"] .arrival-welcome-symbol { background: linear-gradient(145deg, #fafbf3, #e2ecd8); }
.arrival-connection-note { margin: 4px 0 0; font-size: 12px; }
.arrival-waiting .arrival-connection-note { flex-direction: column; }
html:is([data-conversation-connection="reconnecting"], [data-conversation-connection="unavailable"]) .room-arrival :is(.arrival-message, .arrival-open-button, .arrival-welcome-note) { display: none; }
@media (max-height: 680px) {
    .arrival-welcome-symbol { width: 52px; height: 58px; margin-bottom: 14px; }
    .arrival-open-button { margin-top: 18px; }
}
@media (max-width: 600px) {
    .arrival-waiting { max-width: 310px; }
}
@media (prefers-reduced-motion: reduce) {
    .arrival-presence-mark { transition: none; }
}
.preflight-actions { display: flex; gap: 10px; margin-top: 18px; }
.preflight-actions .button { flex: 1; min-height: 48px; padding: 12px 20px; border-radius: 14px; font-size: 14px; background: #466344; border-color: #466344; }
.preflight-actions .button:hover:not(:disabled) { transform: none; background: #3b573a; box-shadow: 0 4px 12px #34483d15; }
.preflight-actions .button:disabled { opacity: 1; background: #e7ebdf; border-color: #e0e5d7; color: #6b7861; }
.preflight-actions .button .icon { width: 15px; height: 15px; font-size: 15px; }
.preflight-footnote { margin-top: 12px; color: #7a8371; font-size: 11px; line-height: 1.6; text-align: center; text-wrap: pretty; }
.connection-retry { display: block; min-height: 36px; margin: 6px auto 0; padding: 6px 8px; border: 0; background: transparent; color: var(--green); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.therapist-prep { max-width: 420px; margin-top: 24px; padding: 20px 0 0; border-top: 1px solid #dfe3d5; }
.therapist-prep > .eyebrow { font-size: 10px; }
.therapist-prep > strong { display: block; margin-top: 7px; font-size: 14px; }
.therapist-prep > div { display: grid; gap: 9px; margin-top: 13px; }
.therapist-prep > div p { padding-left: 11px; border-left: 2px solid #c5d2b7; color: #62705f; font-size: 12px; line-height: 1.6; }
.room-app[data-role="therapist"] .lobby-story h1 { font-size: clamp(44px, 4.5vw, 64px); }

/* Camera selection and privacy preferences can breathe without lengthening the lobby. */
.preflight-settings { width: min(570px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); margin: auto; padding: 0; border: 1px solid #dde3d3; border-radius: 26px; background: #fcfdf7; color: var(--ink); box-shadow: 0 24px 80px #23392c26; overflow: hidden; }
.preflight-settings[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.preflight-settings::backdrop { background: #2e3c3040; backdrop-filter: blur(5px); }
.preflight-settings-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 28px 28px 16px; }
.preflight-settings-heading .eyebrow { font-size: 10px; letter-spacing: .12em; }
.preflight-settings-heading h2 { margin-top: 9px; font-size: 34px; line-height: 1.12; }
.preflight-settings-close { display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; padding: 0; border: 1px solid #e3e7dc; border-radius: 50%; background: #f0f3e8; color: #728166; }
.preflight-settings-close:hover { background: #e6edda; }
.preflight-settings-close .icon { width: 15px; height: 15px; font-size: 15px; }
.preflight-settings-body { min-height: 0; padding: 0 28px 24px; overflow-y: auto; overscroll-behavior: contain; }
.preflight-settings-body > p:first-child { color: #6e7a64; font-size: 13px; line-height: 1.7; }
.device-selectors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 22px; }
.device-selectors:has(#microphone-field[hidden]) { grid-template-columns: 1fr; }
.device-selectors > div { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.device-selectors label { color: #52664a; font-size: 12px; font-weight: 500; }
.device-selectors select { width: 100%; min-height: 46px; padding: 11px 13px; border: 1px solid #d7dfcd; border-radius: 13px; background: #fffefa; color: var(--ink); font-size: 13px; text-overflow: ellipsis; }
.preflight-settings-feedback { margin-top: 14px; color: #718263; font-size: 11px; line-height: 1.6; }
.preflight-settings-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 24px; border-top: 1px solid #e2e7d9; background: #f3f6ec; }
.preflight-settings-footer > span { display: flex; align-items: center; gap: 8px; color: #75826b; font-size: 11px; line-height: 1.6; }
.preflight-settings-footer > span .icon { width: 10px; height: 10px; font-size: 10px; }
.preflight-settings-footer .button { flex-shrink: 0; min-height: 44px; padding: 10px 18px; border-radius: 12px; font-size: 12px; }
.preflight-settings-footer .button .icon { width: 12px; height: 12px; font-size: 12px; }

@media (min-width: 901px) and (max-height: 820px) {
    .room-app:has(.lobby-view:not([hidden])) .room-header { height: 68px; }
    .lobby-view { padding-block: 16px 24px; }
    .lobby-story h1 { margin-top: 16px; font-size: clamp(48px, 4.2vw, 58px); }
    .lobby-introduction { margin-top: 18px; }
    .arrival-details { margin-top: 24px; padding: 20px; }
}
@media (min-width: 901px) and (max-height: 640px) {
    .room-app:has(.lobby-view:not([hidden])) .room-header { height: 60px; }
    .lobby-view { padding-block: 8px 16px; }
    .lobby-story h1 { font-size: 46px; }
    .arrival-details { margin-top: 20px; padding: 16px 20px; }
    .arrival-therapist { padding-bottom: 12px; margin-bottom: 12px; }
    .preflight-preview { padding-top: 20px; }
    .preflight-join { padding-block: 16px 20px; }
}
@media (max-width: 1100px) {
    .lobby-view { gap: 36px; padding-inline: 30px; }
    .preflight-preview { padding-inline: 20px; }
    .preflight-join { padding-inline: 20px; }
}
@media (max-width: 900px) {
    .room-app:has(.lobby-view:not([hidden])) .room-header { height: 76px; max-width: 640px; padding-inline: 24px; }
    .lobby-view { grid-template-columns: 1fr; gap: 28px; max-width: 640px; padding: 18px 24px 32px; }
    .lobby-story { padding: 0; }
    .lobby-story h1, .room-app[data-role="therapist"] .lobby-story h1 { margin-top: 13px; font-size: 46px; }
    .lobby-story h1 br { display: none; }
    .lobby-story h1 em::before { content: " "; }
    .lobby-introduction { max-width: none; margin-top: 16px; }
    .arrival-details { display: flex; align-items: center; gap: 20px; max-width: none; margin-top: 22px; padding: 20px; border-radius: 18px; }
    .arrival-therapist { flex: 0 1 42%; min-width: 0; gap: 10px; margin: 0; padding: 0 20px 0 0; border-bottom: 0; border-right: 1px solid #dde2d3; }
    .appointment-summary .summary-icon { display: none; }
    .arrival-avatar { width: 40px; height: 40px; flex-basis: 40px; font-size: 13px; }
    .preview-stage { min-height: 200px; max-height: 310px; }
    .therapist-prep { max-width: none; }
}
@media (max-width: 540px) {
    .room-app:has(.lobby-view:not([hidden])) .room-header { height: 70px; padding-inline: 20px; }
    .room-app:has(.lobby-view:not([hidden])) .brand-mark { width: 28px; height: 34px; }
    .room-app:has(.lobby-view:not([hidden])) .header-note { gap: 6px; font-size: 11px; }
    .room-app:has(.lobby-view:not([hidden])) .header-note .icon { width: 11px; height: 11px; font-size: 11px; }
    .lobby-view { gap: 24px; padding: 16px 16px max(24px, env(safe-area-inset-bottom)); }
    .lobby-story { padding-inline: 4px; }
    .lobby-story > .eyebrow { display: none; }
    .lobby-story h1, .room-app[data-role="therapist"] .lobby-story h1 { margin-top: 0; font-size: 38px; line-height: 1.1; }
    .lobby-introduction { margin-top: 12px; font-size: 13px; }
    .arrival-details { display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: start; gap: 8px 12px; margin-top: 20px; padding: 18px; }
    .arrival-therapist { display: contents; }
    .arrival-avatar { grid-column: 1; grid-row: 1 / 3; }
    .arrival-therapist > div { grid-column: 2; display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 7px; }
    .arrival-therapist strong { font-size: 13px; }
    .arrival-therapist > div > span { margin: 0; font-size: 11px; }
    .appointment-summary { grid-column: 2; display: block; }
    .appointment-summary strong { margin-bottom: 4px; font-size: 13px; }
    .arrival-details:has(.arrival-therapist[hidden]) { grid-template-columns: 1fr; }
    .arrival-details:has(.arrival-therapist[hidden]) .appointment-summary { grid-column: 1; }
    .preflight-card { border-radius: 23px; }
    .preflight-preview { padding: 20px 16px 0; }
    .preflight-topline { gap: 10px; }
    .preflight-topline h2 { font-size: 26px; }
    .preflight-step { font-size: 10px; }
    .preview-stage { aspect-ratio: 4 / 3; min-height: 180px; margin-top: 16px; }
    .circle-control { width: 44px; height: 44px; flex-basis: 44px; }
    .preflight-join { padding: 20px 16px; border-radius: 0 0 23px 23px; }
    .preflight-footnote { font-size: 10px; }
    .preflight-settings { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); border-radius: 22px; }
    .preflight-settings-heading { padding: 24px 20px 16px; }
    .preflight-settings-heading h2 { font-size: 30px; }
    .preflight-settings-body { padding: 0 20px 20px; }
    .device-selectors { grid-template-columns: 1fr; gap: 20px; }
    .device-selectors select { font-size: 16px; }
    .preflight-settings-footer { padding: 16px 20px; gap: 14px; }
}
@media (prefers-reduced-motion: reduce) { .lobby-view *, .lobby-view *::after { transition: none !important; } }

/* A scanned invitation has a dedicated camera setup. */
.room-app[data-device="art"] .lobby-view { grid-template-columns: minmax(0, 1fr); max-width: 520px; gap: 24px; padding: 16px 24px 28px; }
.room-app[data-device="art"] .lobby-story { padding: 0; text-align: center; }
.room-app[data-device="art"] .lobby-story h1 { margin-top: 10px; font-size: 40px; line-height: 1.05; }
.room-app[data-device="art"] .lobby-introduction { max-width: 380px; margin: 14px auto 0; font-size: 13px; line-height: 1.65; }
.room-app[data-device="art"] .arrival-details { display: none; }
.room-app[data-device="art"] .preflight-footnote { display: none; }
@media (max-width: 540px) {
    .room-app[data-device="art"] .lobby-view { padding: 10px 16px max(24px, env(safe-area-inset-bottom)); gap: 22px; }
    .room-app[data-device="art"] .lobby-story h1 { font-size: 34px; }
}
