.room-page {
    width: 100%;
    max-width: none;
    height: 100dvh;
    min-height: 0;
    margin: 0;
}

.room-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 24px;
}

.kicker {
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.6px;
    text-transform: uppercase;
}

.kicker-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 6px;
    border-radius: 50%;
    background: var(--accent);
}

.room-heading h1 {
    margin: 12px 0 0;
    font-size: 46px;
    line-height: 1;
    letter-spacing: -2px;
}

.room-heading h1 em {
    color: var(--accent);
    font-style: normal;
}

.room-status {
    color: #429d79;
    font-size: 12px;
}

.room-status i {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 6px;
    border-radius: 50%;
    background: #3ac58a;
}

.room-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 390px;
    padding: 30px;
    border-radius: 22px;
    background: var(--dark);
    color: #fff;
    text-align: center;
    box-shadow: 0 25px 45px #25273230;
}

.stage-icon {
    display: grid;
    place-items: center;
    width: 68px;
    height: 68px;
    margin-bottom: 20px;
    border: 1px solid #ffffff1f;
    border-radius: 20px;
    background: #353846;
    color: #aaa5ff;
    font-size: 30px;
}

.room-stage strong {
    font-size: 26px;
}

.room-stage small {
    margin: 12px 0 26px;
    color: #aeb1bd;
    font-size: 13px;
}

.room-stage .primary-button {
    background: #fff;
    color: var(--accent);
    box-shadow: none;
}

.room-meta {
    display: flex;
    justify-content: space-between;
    padding-top: 18px;
    color: var(--muted);
    font-size: 11px;
}

.name-modal {
    position: fixed;
    z-index: 10;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(25, 25, 36, 0.38);
    backdrop-filter: blur(8px);
}

.name-modal[hidden] {
    display: none;
}

.name-modal.is-loading::after {
    position: absolute;
    width: 34px;
    height: 34px;
    border: 3px solid #ffffff66;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: room-join-spin .8s linear infinite;
    content: '';
}

.name-modal.is-loading .name-dialog {
    pointer-events: none;
    opacity: .72;
}

.join-error {
    margin-top: 12px;
    color: #c92f4f;
    font-size: 13px;
    line-height: 1.4;
    text-align: center;
}

@keyframes room-join-spin {
    to { transform: rotate(360deg); }
}

.name-dialog {
    display: flex;
    flex-direction: column;
    width: min(100%, 420px);
    padding: 36px;
    border: 1px solid #e8e7f0;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 30px 90px rgba(25, 25, 45, 0.28);
}

.name-dialog h2 {
    margin: 18px 0 8px;
    font-size: 28px;
    letter-spacing: -1px;
}

.name-dialog p {
    margin: 0 0 24px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.name-dialog input {
    width: 100%;
    margin-bottom: 12px;
    padding: 14px 15px;
    border: 1px solid var(--line);
    border-radius: 10px;
    outline: none;
    color: var(--ink);
    font-size: 14px;
}

.name-dialog input:focus {
    border-color: var(--accent);
}

.name-dialog .primary-button {
    width: 100%;
}

.room-card {
    --room-content-inset: 14px;
    --room-sidebar-width: 230px;
    position: relative;
    display: flex;
    height: 100dvh;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: #242631;
}

.room-card.participants-collapsed {
    --room-sidebar-width: 56px;
}

.room-card-header {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: stretch;
    flex-direction: column;
    padding: 22px var(--room-content-inset) 7px;
    background: #242631;
    color: #f1f1f4;
}

.room-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 16px;
    gap: 16px;
    transform: translateY(6px);
}

.connection-status-right {
    text-align: right;
}

.room-card-header h1 {
    margin: 4px 0 0;
    font-size: 34px;
    letter-spacing: -1.4px;
}

.room-card-header h1 strong {
    color: var(--accent);
}

.room-lock-button {
    display: inline-grid;
    width: 34px;
    height: 34px;
    margin-left: 8px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    vertical-align: middle;
    cursor: pointer;
}

.room-lock-button:disabled {
    cursor: default;
}

.room-lock-button img {
    width: 34px;
    height: 34px;
    object-fit: cover;
    border-radius: 50%;
}

.room-lock-button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.room-password-dialog {
    width: min(92vw, 380px);
    padding: 24px;
    border: 1px solid #ffffff1f;
    border-radius: 18px;
    background: #2f3240;
    color: #fff;
    box-shadow: 0 24px 70px #0008;
}

.room-password-dialog::backdrop {
    background: #10111a99;
    backdrop-filter: blur(4px);
}

.room-password-dialog h2 {
    margin: 0 0 8px;
    font-size: 20px;
}

.room-password-dialog p {
    margin: 0 0 14px;
    color: #aeb1bd;
    font-size: 12px;
}

.room-password-dialog input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ffffff22;
    border-radius: 9px;
    background: #20222d;
    color: #fff;
}

.room-password-actions {
    display: flex;
    justify-content: stretch;
    gap: 10px;
    margin-top: 16px;
}

.room-password-button {
    display: inline-flex;
    flex: 1 1 0;
    min-width: 0;
    min-height: 38px;
    padding: 8px 10px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    white-space: nowrap;
}

.room-password-button img {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 26px;
}

.room-label {
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.6px;
    line-height: 16px;
    text-transform: uppercase;
}

.room-label span {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 6px;
    border-radius: 50%;
    background: var(--accent);
}

.room-copy-link {
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    text-align: left;
    text-transform: inherit;
    cursor: pointer;
}

.room-copy-link:hover {
    color: #d0cbff;
}

.room-copy-link:focus-visible {
    outline: 2px solid #a9a4ff;
    outline-offset: 3px;
}

.room-copy-status {
    position: absolute;
    top: 100%;
    left: var(--room-content-inset);
    padding: 5px 8px;
    border-radius: 6px;
    background: #303342;
    color: #f1f1f4;
    font-size: 11px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 150ms ease;
}

.room-copy-status.is-visible {
    opacity: 1;
}

.connection-status {
    position: relative;
    z-index: 4;
    display: inline-block;
    min-height: 16px;
    line-height: 16px;
    white-space: nowrap;
    color: #a6a8b2;
    font-size: 12px;
}

.connection-status[hidden] {
    display: none !important;
}

.connection-status.connected {
    color: #3ca77e;
}
.connection-status.unstable {
    color: #f0b84b;
}

.connection-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 7px;
    border-radius: 50%;
    background: #f0b84b;
    box-shadow: 0 0 0 0 rgba(240, 184, 75, 0.55);
    animation: connection-pulse 1.6s infinite;
    vertical-align: middle;
}

.connection-label {
    vertical-align: middle;
}

.connection-status.connected .connection-dot {
    background: #3ed39a;
    box-shadow: 0 0 0 0 rgba(62, 211, 154, 0.55);
}
.connection-status.offline {
    color: #ef7185;
}
.connection-status.offline .connection-dot {
    background: #ef7185;
    box-shadow: 0 0 0 0 rgba(239, 113, 133, 0.55);
}

.connection-metrics {
    position: absolute;
    bottom: calc(100% + 4px);
    right: 0;
    z-index: 5;
    width: max-content;
    max-width: min(230px, calc(100vw - 24px));
    padding: 8px 10px;
    border: 1px solid #ffffff14;
    border-radius: 8px;
    background: #1f202a;
    color: #d7d9e2;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition:
        opacity 0.16s ease,
        transform 0.16s ease;
}

.connection-status:hover .connection-metrics,
.connection-status:focus-within .connection-metrics {
    opacity: 1;
    transform: translateY(0);
}

@keyframes connection-pulse {
    0% {
        box-shadow: 0 0 0 0 currentColor;
        opacity: 0.9;
    }
    70% {
        box-shadow: 0 0 0 7px transparent;
        opacity: 0.55;
    }
    100% {
        box-shadow: 0 0 0 0 transparent;
        opacity: 0.9;
    }
}

.call-surface {
    display: flex;
    flex: 1;
    height: 0;
    min-height: 0;
    flex-direction: column;
    padding: 7px var(--room-content-inset) 8px;
    background: #242631;
}

.call-layout {
    flex: 1;
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-columns: var(--room-sidebar-width) minmax(0, 1fr);
    gap: 10px;
    transition: grid-template-columns 200ms ease;
}

.changing-video-focus .call-layout {
    transition: none;
}

.room-card.video-maximized .call-surface {
    position: relative;
    padding: 0;
}

.room-card.video-maximized .call-layout {
    display: block;
}

.room-card.video-maximized .participants-panel {
    position: absolute;
    z-index: 2;
    inset: 10px auto 48px var(--room-content-inset);
    width: var(--room-sidebar-width);
    height: auto;
    max-height: none;
    background: #1f202aed;
}

.room-card.video-maximized .room-card-footer {
    position: absolute;
    z-index: 2;
    inset: auto auto 0 0;
    padding-inline-start: var(--room-content-inset);
    background: transparent;
}

.video-maximized .room-card-footer > :not(.room-footer-actions) {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    .room-copy-status,
    .call-layout,
    .room-card .room-footer-actions {
        transition: none;
    }
}
