@font-face {
    font-family: 'Cinzel';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/fonts/cinzel.woff2') format('woff2');
}
@font-face {
    font-family: 'Cormorant Garamond';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/cormorant-garamond.woff2') format('woff2');
}
@font-face {
    font-family: 'Orbitron';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/fonts/orbitron.woff2') format('woff2');
}
@font-face {
    font-family: 'Exo 2';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/exo2.woff2') format('woff2');
}
@font-face {
    font-family: 'Spectral';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/fonts/spectral.woff2') format('woff2');
}
@font-face {
    font-family: 'Cabin';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/cabin.woff2') format('woff2');
}
@font-face {
    font-family: 'Dancing Script';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/fonts/dancing-script.woff2') format('woff2');
}
@font-face {
    font-family: 'Quicksand';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/quicksand.woff2') format('woff2');
}
html, body {
    height: 100%;
}
body {
    font-family: system-ui, sans-serif;
    margin: 0;
    padding: 1em 2em;
    box-sizing: border-box;
}
*, *::before, *::after {
    box-sizing: inherit;
}
h1 {
    font-size: 1.15rem;
    margin: 0 0 0.5rem 0;
}
.title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.5rem 0;
}
.title-row h1 {
    margin: 0;
}

h1 a,
h1 a:link,
h1 a:visited,
h1 a:hover,
h1 a:active {
    color: inherit;
    text-decoration: none;
}
#collapse-toggle {
    display: none;
    width: 0;
    height: 0;
    padding: 0;
    border-left: 0.45rem solid transparent;
    border-right: 0.45rem solid transparent;
    border-top: 0.55rem solid #555;
    background: transparent;
    cursor: pointer;
    transition: transform 0.15s ease;
}
body.in-room #collapse-toggle {
    display: inline-block;
}
body.rows-collapsed #collapse-toggle {
    transform: rotate(-90deg);
}
body.rows-collapsed #name-row,
body.rows-collapsed #room-row {
    display: none;
}
.page {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1em;
    height: calc(100vh - 2em);
}

body.viewer-open .page {
    grid-template-columns:
        var(--pane-a, 1fr) 0.7rem var(--pane-b, 1fr);
    gap: 0;
}

body.viewer-open.viewer-maximized .page {
    grid-template-columns: 1fr;
}
body.viewer-open.viewer-maximized #left-panel,
body.viewer-open.viewer-maximized #split-gutter {
    display: none;
}
#right-panel {
    display: none;
}
body.viewer-open #right-panel {
    display: flex;
}

#split-gutter {
    display: none;
    position: relative;
    background: #ccc;
    border-radius: 0.35rem;
    cursor: col-resize;
    touch-action: none;
}
body.viewer-open #split-gutter {
    display: block;
}
#split-gutter:hover,
#split-gutter:focus-visible {
    background: #4a90d9;
    outline: none;
}
#split-gutter::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -0.4rem;
    right: -0.4rem;
}

#gltf-file-row .maximize-btn,
#pdf-file-row .maximize-btn,
#screen-toolbar .maximize-btn {
    margin-left: auto;
}

#left-panel, #right-panel {
    min-height: 9rem;
}
#gltf-ui, #pdf-ui, #screen-ui {
    flex: 1;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    display: none;
}
body.viewer-mode-gltf #gltf-ui {
    display: flex;
}
body.viewer-mode-pdf #pdf-ui {
    display: flex;
}
body.viewer-mode-screen #screen-ui {
    display: flex;
}

#screen-video {
    flex: 1;
    min-height: 0;
    width: 100%;
    background: #222;
    object-fit: contain;
}

#video-layer {

    --video-scale: 1;
    position: fixed;
    z-index: 50;
    bottom: 12px;
    right: 12px;
    display: none;
    flex-direction: column;
    gap: 0.25rem;
    max-width: 80vw;
    padding: 0.35rem;
    background: rgba(20, 20, 20, 0.82);
    border-radius: 0.5rem;
    box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.4);
    cursor: grab;
    touch-action: none;
}
#video-layer:active {
    cursor: grabbing;
}

#video-toolbar {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

#video-layer.minimized #video-body {
    display: none;
}
#video-body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.video-ctl {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0.25rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.45);
    border: none;
    border-radius: 0.3rem;
    cursor: pointer;
    line-height: 1;
}
.video-ctl:hover {
    background: rgba(0, 0, 0, 0.7);
}
.video-ctl.active {
    color: #fff;
    background: rgba(185, 28, 28, 0.85);
}

.video-ctl.video-close {
    color: #fff;
    background: rgba(185, 28, 28, 0.7);
}
.video-ctl.video-close:hover {
    background: rgba(185, 28, 28, 0.95);
}
.video-ctl svg {
    display: block;
    width: 100%;
    height: 100%;
}

.video-ctl.video-size-down {
    margin-left: auto;
}

.video-tile-ctl {
    position: absolute;
    top: 0.2rem;
    right: 0.2rem;
    z-index: 1;
}
#video-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    max-width: 100%;
}
.video-tile {
    position: relative;
    width: calc(14rem * var(--video-scale));
    background: #111;
    border-radius: 0.35rem;
    overflow: hidden;
}
.video-tile-el {
    display: block;
    width: 100%;
    background: #111;
    object-fit: cover;
}
.video-tile-label {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.1rem 0.3rem;
    color: #fff;
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: rgba(0, 0, 0, 0.45);
}
#video-self {
    position: relative;
    display: none;
    align-self: flex-end;
    width: calc(8rem * var(--video-scale));
}

.video-mute-badge {
    position: absolute;
    top: 0.2rem;
    left: 0.2rem;
    display: none;
    width: 1.25rem;
    height: 1.25rem;
    padding: 0.18rem;
    color: #fff;
    background: rgba(185, 28, 28, 0.85);
    border-radius: 50%;
}
.video-mute-badge.show {
    display: block;
}
.video-mute-badge svg {
    display: block;
    width: 100%;
    height: 100%;
}

.video-self-el {
    display: block;
    width: 100%;
    background: #111;
    border-radius: 0.35rem;
    object-fit: cover;
    transform: scaleX(-1);
}

.video-resize-grip {
    position: absolute;
    right: 0.1rem;
    bottom: 0.1rem;
    z-index: 2;
    width: 1.1rem;
    height: 1.1rem;
    color: rgba(255, 255, 255, 0.85);
    cursor: nwse-resize;
    touch-action: none;
}
.video-resize-grip svg {
    display: block;
    width: 100%;
    height: 100%;
}

#video-layer.minimized .video-resize-grip {
    display: none;
}

@media (max-width: 640px) {
    #video-layer {
        top: auto !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        max-width: 100%;
        border-radius: 0;
        cursor: default;
    }

    .video-resize-grip {
        display: none;
    }
}

#call2-panel {
    position: fixed;
    z-index: 60;
    top: 12px;
    right: 12px;
    display: none;
    flex-direction: column;
    gap: 0.4rem;
    width: 16rem;
    max-width: 80vw;
    padding: 0.5rem;
    color: #fff;
    background: rgba(20, 20, 20, 0.9);
    border-radius: 0.5rem;
    box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.4);
    font-size: 0.8rem;
}

.call2-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.call2-title {
    font-weight: 600;
}
.call2-ctl {
    width: 1.4rem;
    height: 1.4rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.45);
    border: none;
    border-radius: 0.3rem;
    line-height: 1;
    cursor: pointer;
}
.call2-ctl:hover {
    background: rgba(0, 0, 0, 0.7);
}

.call2-master {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
.call2-auto {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
}
.call2-rows {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.call2-row {
    position: relative;
    display: grid;
    grid-template-columns: 4.5rem 1fr 2.4rem;
    align-items: center;
    gap: 0.35rem;
}
.call2-row-label {
    position: relative;
    z-index: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.call2-row-value {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.call2-slider {
    width: 100%;
}

.call2-level {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4.5rem;
    border-radius: 0.2rem;
    overflow: hidden;
    pointer-events: none;
}
.call2-level-fill {
    width: 0;
    height: 100%;
    background: rgba(34, 197, 94, 0.35);
    transition: width 0.08s linear;
}
@media (max-width: 640px) {
    #call2-panel {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: auto;
        max-width: 100%;
        border-radius: 0;
    }
}
#pdf-scroll {
    flex: 1;
    min-height: 0;
    min-width: 0;
    overflow: auto;
    background: #222;
}
#pdf-canvas {
    display: block;
    margin: 0 auto;
    background: #222;
}
#pdf-page-indicator {
    margin-left: auto;
}
.panel {

    padding: 0.25em;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}
.row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin: 0.25rem 0;
    flex-wrap: wrap;
}
.grow {
    flex: 1;
    min-width: 0;
}
input, button {
    font-size: 1rem;
}
input {
    padding: 0.35rem 0.5rem;
}
button {
    padding: 0.35rem 0.8rem;
    cursor: pointer;
}
#chat {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
#messages {
    flex: 1;
    overflow-y: auto;
    border: 1px solid #ccc;
    background: #fafafa;
    padding: 0.5rem;
    margin: 0.5rem 0;
    min-height: 0;
}
.msg {
    margin: 0.15rem 0;
    word-wrap: break-word;
}
.msg .who {
    font-weight: 600;
    margin-right: 0.25rem;
}
.msg img {
    max-width: 320px;
    max-height: 200px;
    vertical-align: middle;
}
.msg code {
    font-family: monospace;
    font-size: 0.85em;
    background: #eee;
    padding: 0.05rem 0.3rem;
    border-radius: 3px;
}

.msg a {
    color: #06c;
    text-decoration: underline;
    word-break: break-word;
}
.msg a:hover {
    text-decoration: none;
}

.spoiler {
    background: #222;
    color: transparent;
    border-radius: 3px;
    cursor: pointer;
}
.spoiler.revealed {
    background: rgba(0, 0, 0, 0.08);
    color: inherit;
    cursor: text;
}
.me .who {
    color: #06c;
}
.them .who {
    color: #060;
}
.peer1 .who {
    color: #060;
}
.peer2 .who {
    color: #b5651d;
}
.peer3 .who {
    color: #7a1fa2;
}
.peer4 .who {
    color: #0a7d7d;
}
.peer5 .who {
    color: #b00050;
}
.sys {
    color: #888;
    font-style: italic;
}
.subtle {
    color: #888;
    font-size: 0.9rem;
    min-height: 1.2em;
}
.code-pill {
    font-family: monospace;
    font-size: 0.8rem;
    background: #eee;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
}
hr {
    margin: 0.75rem 0;
    border: none;
    border-top: 1px solid #eee;
    width: 100%;
}
#viewer-canvas {
    flex: 1;
    width: 100%;
    background: #111;
    display: block;
    min-height: 0;
}
.list-box {
    max-height: 8em;
    overflow-y: auto;
    border: 1px solid #ccc;
    background: #fafafa;
    padding: 0.25rem;
    margin: 0.25rem 0;
}
.list-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.15rem 0.25rem;
    border-radius: 3px;
}
.list-row.selected {
    background: #def;
}
.list-row .name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}
.toggle-btn.active {
    background: #def;
    border-color: #6ab;
}
.list-empty {
    color: #888;
    font-style: italic;
    padding: 0.25rem;
}
.emoji-input-wrap {
    position: relative;
    display: flex;
}
#emoji-btn {
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.3rem 0.5rem;
    border: 1px solid #ccc;
    background: #fafafa;
    border-radius: 3px;
    cursor: pointer;
}
#emoji-btn:hover {
    background: #eee;
}
#call-btn {
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.3rem 0.5rem;
    border: 1px solid #ccc;
    background: #fafafa;
    border-radius: 3px;
    cursor: pointer;
}
#call-btn:hover {
    background: #eee;
}
#call-btn.in-call {
    border-color: #b91c1c;
    background: #fee2e2;
    color: #b91c1c;
}
#call-btn.in-call:hover {
    background: #fecaca;
}

#call-btn.call-disabled {
    color: #aaa;
    background: #f0f0f0;
    border-color: #ddd;
    cursor: not-allowed;
}
#call-btn.call-disabled:hover {
    background: #f0f0f0;
}

#video-btn {
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.3rem 0.5rem;
    border: 1px solid #ccc;
    background: #fafafa;
    border-radius: 3px;
    cursor: pointer;
}
#video-btn:hover {
    background: #eee;
}
#video-btn.in-call {
    border-color: #b91c1c;
    background: #fee2e2;
    color: #b91c1c;
}
#video-btn.in-call:hover {
    background: #fecaca;
}
#video-btn.call-disabled {
    color: #aaa;
    background: #f0f0f0;
    border-color: #ddd;
    cursor: not-allowed;
}
#video-btn.call-disabled:hover {
    background: #f0f0f0;
}

#msg-input.metering {
    background-image:
        linear-gradient(rgba(34, 197, 94, 0.35),
                        rgba(34, 197, 94, 0.35)),
        linear-gradient(rgba(59, 130, 246, 0.35),
                        rgba(59, 130, 246, 0.35));
    background-repeat: no-repeat, no-repeat;
    background-position: left top, left bottom;
    background-size:
        calc(var(--in-level, 0) * 100%) 50%,
        calc(var(--out-level, 0) * 100%) 50%;
    transition: background-size 0.08s linear;
}
#emoji-popover {
    position: absolute;
    left: 0;
    bottom: calc(100% + 0.25rem);
    z-index: 10;
    display: none;
}
#emoji-popover.open {
    display: block;
}
#emoji-popover emoji-picker {
    --background: #fff;
    --border-color: #ccc;
    height: 22rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

:root {
    --landing-accent: #6366f1;
    --landing-accent-hover: #4f46e5;
    --landing-accent-soft: #eef2ff;
    --landing-bg-from: #312e81;
    --landing-bg-mid: #6366f1;
    --landing-bg-to: #a78bfa;
    --landing-text: #111827;
    --landing-muted: #6b7280;
    --landing-on-bg: #f8fafc;
    --landing-on-bg-muted: #c7d2fe;
    --landing-card-bg: #ffffff;
    --landing-card-border: #e5e7eb;
    --landing-card-shadow:
        0 20px 50px -10px rgba(49, 46, 129, 0.55),
        0 8px 20px rgba(167, 139, 250, 0.25);
}
.tagline {
    display: none;
}
body:not(.in-room) {
    background: linear-gradient(
        135deg,
        var(--landing-bg-from) 0%,
        var(--landing-bg-mid) 50%,
        var(--landing-bg-to) 100%);

    background-attachment: fixed;
    background-repeat: no-repeat;
    color: var(--landing-on-bg);
}
body:not(.in-room) .page {
    display: block;
    height: auto;
    max-width: 36rem;
    margin: 0 auto;
    padding: 2rem 0 3rem 0;
}
body:not(.in-room) .title-row {
    justify-content: center;
    margin: 0;
}
body:not(.in-room) h1 {
    font-size: 2.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--landing-on-bg);
}
body:not(.in-room) .tagline {
    display: block;
    text-align: center;
    color: var(--landing-on-bg-muted);
    font-size: 1.05rem;
    margin: 0.4rem 0 1.75rem 0;
}
body:not(.in-room) #setup {
    color: var(--landing-text);
}
body:not(.in-room) #name-row {
    justify-content: center;
    max-width: 24rem;
    margin: 0 auto 1rem auto;
}
body:not(.in-room) #setup {
    background: var(--landing-card-bg);
    border: 1px solid var(--landing-card-border);
    border-radius: 0.85rem;
    box-shadow: var(--landing-card-shadow);
    padding: 1.75rem;
}
body:not(.in-room) .setup-actions {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
body:not(.in-room) .setup-actions .row {
    justify-content: center;
    margin: 0;
}
body:not(.in-room) #create-btn,
body:not(.in-room) #join-btn {
    background: var(--landing-accent);
    color: #ffffff;
    border: 1px solid transparent;
    border-radius: 0.55rem;
    font-weight: 600;
    padding: 0.55rem 1.5rem;
    transition: background 0.15s ease,
                transform 0.05s ease;
}
body:not(.in-room) #create-btn:hover,
body:not(.in-room) #join-btn:hover {
    background: var(--landing-accent-hover);
}
body:not(.in-room) #create-btn:active,
body:not(.in-room) #join-btn:active {
    transform: translateY(1px);
}
body:not(.in-room) #create-btn {
    font-size: 1.05rem;
    padding: 0.65rem 2rem;
}
body:not(.in-room) input#name-input,
body:not(.in-room) input#join-input {
    border: 1px solid var(--landing-card-border);
    border-radius: 0.55rem;
    padding: 0.5rem 0.75rem;
    background: #ffffff;
    color: var(--landing-text);
}
body:not(.in-room) input#name-input:focus,
body:not(.in-room) input#join-input:focus {
    outline: none;
    border-color: var(--landing-accent);
    box-shadow: 0 0 0 3px var(--landing-accent-soft);
}
body:not(.in-room) .or-divider {
    display: flex;
    align-items: center;
    color: var(--landing-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    gap: 0.75rem;
    margin: 0.25rem 0;
}
body:not(.in-room) .or-divider::before,
body:not(.in-room) .or-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--landing-card-border);
}
body:not(.in-room) .setup-intro {
    color: var(--landing-muted);
    line-height: 1.55;
    margin: 1.25rem 0 0.5rem 0;
}
body:not(.in-room) .setup-details {
    border-top: 1px solid var(--landing-card-border);
    padding-top: 0.5rem;
    margin-top: 0.75rem;
}
body:not(.in-room) .setup-details summary {
    cursor: pointer;
    color: var(--landing-accent);
    font-weight: 600;
    padding: 0.4rem 0;
    list-style: none;
    user-select: none;
}
body:not(.in-room)
    .setup-details summary::-webkit-details-marker {
    display: none;
}
body:not(.in-room) .setup-details summary::before {
    content: "\25B8";
    display: inline-block;
    width: 1.1rem;
    color: var(--landing-muted);
    transition: transform 0.15s ease;
}
body:not(.in-room)
    .setup-details[open] summary::before {
    transform: rotate(90deg);
}

body:not(.in-room) a.setup-link {
    display: block;
    color: var(--landing-accent);
    font-weight: 600;

    padding: 0.9rem 0 0.4rem;
    text-decoration: none;
    cursor: pointer;
}
body:not(.in-room) a.setup-link::before {
    content: "\25B8";
    display: inline-block;
    width: 1.1rem;
    color: var(--landing-muted);
}

body:not(.in-room) #status {
    min-height: 0;
    margin: 0.25rem 0;
}
body:not(.in-room) .setup-details p,
body:not(.in-room) .setup-details ul {
    color: var(--landing-muted);
    line-height: 1.55;
}
body:not(.in-room) .setup-details ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}
body:not(.in-room) .setup-details ul li {
    margin: 0.2rem 0;
}
body:not(.in-room) #setup .code-pill {
    background: var(--landing-accent-soft);
    color: var(--landing-accent-hover);
}
@media (max-width: 800px) {

    body.viewer-open .page {
        grid-template-columns: 1fr;
        grid-template-rows:
            var(--pane-a, 1fr) 0.7rem var(--pane-b, 1fr);
    }
    body.viewer-open.viewer-maximized .page {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
    }
    #split-gutter {
        cursor: row-resize;
    }
    #split-gutter::after {
        left: 0;
        right: 0;
        top: -0.4rem;
        bottom: -0.4rem;
    }
}
@media (max-width: 600px) {
    html {
        font-size: 100%;
    }
    body:not(.in-room) h1 {
        font-size: 2.1rem;
    }
    body:not(.in-room) #setup {
        padding: 1.25rem;
    }
}
