:root {
    --bg: #eef3fb;
    --panel: rgba(255, 255, 255, 0.86);
    --panel-strong: #ffffff;
    --text: #12203d;
    --text-soft: #516180;
    --line: rgba(28, 42, 78, 0.12);
    --accent: #3f76ff;
    --accent-strong: #2658d8;
    --danger: #eb5d49;
    --shadow-lg: 0 24px 80px rgba(15, 31, 70, 0.16);
    --radius-xl: 2rem;
    --radius-lg: 1.35rem;
    --radius-md: 1rem;
    --font-sans: "Avenir Next", "Segoe UI", "SF Pro Display", "Helvetica Neue", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-sans);
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(63, 118, 255, 0.18), transparent 36%),
        radial-gradient(circle at bottom right, rgba(255, 182, 72, 0.22), transparent 32%),
        linear-gradient(180deg, #f6f8fd 0%, #eef3fb 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.primary-action,
.secondary-action,
.icon-button,
.pill-button,
.copy-button,
.danger-action,
.join-button {
    border: 0;
    border-radius: 999px;
    transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.primary-action,
.join-button,
.danger-action {
    padding: 0.95rem 1.35rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.primary-action,
.join-button {
    color: #fff;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    box-shadow: 0 16px 30px rgba(63, 118, 255, 0.26);
}

.primary-action:hover,
.join-button:hover,
.secondary-action:hover,
.icon-button:hover,
.pill-button:hover,
.copy-button:hover,
.danger-action:hover {
    transform: translateY(-1px);
}

.secondary-action,
.copy-button,
.pill-button {
    color: var(--text);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
}

.secondary-action {
    padding: 0.95rem 1.15rem;
}

.copy-button {
    padding: 0.75rem 1rem;
}

.danger-action {
    color: #fff;
    background: linear-gradient(135deg, #f06f5d 0%, #d94a42 100%);
    box-shadow: 0 16px 30px rgba(217, 74, 66, 0.22);
}

.landing-page,
.feedback-page {
    min-height: 100vh;
    display: grid;
    align-items: center;
    gap: 2rem;
    padding: 3rem;
}

.landing-page {
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
}

.landing-panel,
.feedback-card {
    position: relative;
    overflow: hidden;
    padding: 2.5rem;
    border-radius: var(--radius-xl);
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(24px);
}

.landing-panel::before,
.feedback-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.55), transparent 48%);
    pointer-events: none;
}

.brand-mark {
    width: 4rem;
    height: 4rem;
    display: grid;
    place-items: center;
    border-radius: 1.35rem;
    background: linear-gradient(135deg, #0f1830 0%, #304a8f 100%);
    color: #fff;
    font-weight: 800;
    letter-spacing: 0.04em;
    margin-bottom: 1.75rem;
}

.eyebrow {
    margin: 0 0 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--accent-strong);
}

.landing-copy h1,
.feedback-card h1,
.call-header-copy h1 {
    margin: 0;
    font-size: clamp(2.4rem, 4vw, 4.2rem);
    line-height: 0.95;
    letter-spacing: -0.045em;
}

.landing-body,
.feedback-card p,
.call-header-copy p,
.status-line,
.panel-note,
.message-meta {
    color: var(--text-soft);
}

.landing-actions {
    margin-top: 2rem;
    display: grid;
    gap: 0.9rem;
    max-width: 26rem;
}

.landing-input {
    width: 100%;
    padding: 0.95rem 1rem;
    border-radius: 1rem;
    border: 1px solid rgba(18, 32, 61, 0.12);
    background: rgba(255, 255, 255, 0.94);
    color: var(--text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.landing-input::placeholder {
    color: rgba(81, 97, 128, 0.75);
}

.status-line {
    margin: 0;
}

.landing-preview {
    display: flex;
    justify-content: center;
}

.preview-window {
    width: min(100%, 42rem);
    padding: 1.35rem;
    border-radius: 2.1rem;
    background: linear-gradient(180deg, rgba(23, 33, 58, 0.98), rgba(15, 25, 46, 0.98));
    box-shadow: 0 26px 90px rgba(15, 31, 70, 0.3);
    color: #f5f8ff;
}

.preview-toolbar,
.preview-controls {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.preview-dot {
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.24);
}

.preview-body {
    margin: 1.3rem 0;
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr) 15rem;
}

.preview-stage {
    min-height: 27rem;
    position: relative;
    border-radius: 1.75rem;
    padding: 1rem;
    background: linear-gradient(180deg, rgba(39, 54, 95, 0.96), rgba(28, 39, 69, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.preview-remote,
.stage-placeholder,
.video-surface {
    min-height: 100%;
    border-radius: 1.45rem;
}

.preview-remote,
.stage-placeholder {
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at top, rgba(79, 126, 255, 0.42), transparent 32%),
        linear-gradient(180deg, rgba(20, 30, 56, 0.96), rgba(12, 18, 34, 0.98));
}

.stage-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.55rem 0.85rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-weight: 600;
}

.preview-local,
.local-tile {
    position: absolute;
    left: 1.2rem;
    bottom: 1.2rem;
    width: 8rem;
    height: 5.6rem;
    display: grid;
    place-items: center;
    border-radius: 1.1rem;
    background: rgba(236, 242, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(16px);
    font-weight: 700;
}

.preview-sidebar {
    display: grid;
    gap: 1rem;
}

.sidebar-card,
.panel-card,
.call-panel,
.settings-card {
    padding: 1.15rem;
    border-radius: 1.4rem;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-card h2,
.panel-card h2,
.call-panel h2,
.settings-card h2 {
    margin: 0 0 0.45rem;
    font-size: 1rem;
}

.preview-controls {
    justify-content: center;
}

.preview-controls button,
.control-button {
    min-width: 5rem;
    padding: 0.85rem 1rem;
    border-radius: 999px;
    border: 0;
    background: rgba(255, 255, 255, 0.08);
    color: inherit;
}

.preview-controls .danger,
.control-button.danger {
    background: rgba(235, 93, 73, 0.88);
}

.feedback-page {
    place-items: center;
}

.feedback-card {
    max-width: 34rem;
    text-align: center;
}

.request-id code {
    padding: 0.15rem 0.4rem;
    border-radius: 0.5rem;
    background: rgba(18, 32, 61, 0.08);
}

.link-button {
    display: inline-flex;
    justify-content: center;
    margin-top: 1rem;
}

.call-page {
    height: 100dvh;
    padding: 15px;
    overflow: hidden;
}

.call-frame {
    height: calc(100dvh - 30px);
    display: grid;
    gap: 1rem;
    grid-template-rows: 1fr;
    padding: 1.35rem;
    border-radius: 2rem;
    background: rgba(17, 28, 52, 0.86);
    box-shadow: 0 26px 92px rgba(12, 20, 41, 0.28);
    color: #eef3ff;
    overflow: hidden;
    position: relative;
}

.call-header {
    position: absolute;
    top: 1.6rem;
    left: 1.6rem;
    right: 1.6rem;
    z-index: 4;
    pointer-events: none;
}

.call-header-copy h1 {
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    color: #fff;
}

.call-header-copy {
    display: inline-grid;
    gap: 0.05rem;
    max-width: min(32rem, calc(100% - 24rem));
    margin-left: 12px;
    margin-top: 12px;
    pointer-events: auto;
    text-shadow: 0 6px 24px rgba(3, 8, 19, 0.45);
}

.call-header-copy .eyebrow {
    margin-bottom: 0;
}

.call-badges {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.room-pill,
.connection-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.8rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #edf2ff;
    font-size: 0.92rem;
    font-weight: 600;
}

.connection-pill[data-tone="success"] {
    color: #d8ffef;
}

.connection-pill[data-tone="warning"] {
    color: #ffe5b8;
}

.connection-pill[data-tone="danger"] {
    color: #ffd5cd;
}

.call-body {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    height: 100%;
}

.meeting-main {
    display: grid;
    gap: 1rem;
    min-height: 0;
    overflow: hidden;
    position: relative;
    height: 100%;
}

.meeting-stage,
.prejoin-stage {
    position: relative;
    min-height: 0;
    border-radius: 1.75rem;
    background: linear-gradient(180deg, rgba(29, 43, 78, 0.96), rgba(16, 24, 45, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.meeting-stage {
    padding: 0;
}

.stage-toggle-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.75rem;
    height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(10, 17, 32, 0.42);
    color: #fff;
    backdrop-filter: blur(16px);
    z-index: 3;
    transition: background 180ms ease, border-color 180ms ease;
}

.stage-toggle-button:hover {
    background: rgba(18, 28, 52, 0.62);
    border-color: rgba(255, 255, 255, 0.16);
}

.prejoin-stage {
    padding: 1rem;
}

.video-surface {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #0d1427;
}

.meeting-stage > .video-surface {
    object-fit: contain;
    background: #050914;
}

.stage-placeholder {
    position: absolute;
    inset: 1rem;
    display: grid;
    place-items: center;
    text-align: center;
    color: rgba(238, 243, 255, 0.78);
    pointer-events: none;
}

.meeting-stage .stage-placeholder {
    inset: 0;
}

.remote-placeholder-state.hidden {
    display: none;
}

.remote-avatar-state {
    gap: 1rem;
}

.remote-avatar-circle {
    width: clamp(5.5rem, 10vw, 7.5rem);
    height: clamp(5.5rem, 10vw, 7.5rem);
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: hsl(var(--avatar-hue, 210) 64% 54%);
    color: #fff;
    box-shadow: 0 16px 36px rgba(4, 10, 24, 0.28);
}

.remote-avatar-circle span {
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 700;
}

.remote-avatar-name {
    margin: 0;
    font-size: clamp(1rem, 2vw, 1.35rem);
    font-weight: 600;
    color: #fff;
}

.meeting-stage .video-surface {
    border-radius: inherit;
}

.stage-placeholder.hidden,
.meeting-shell.hidden,
.prejoin-shell.hidden,
.panel-body.hidden,
.local-tile.hidden {
    display: none;
}

.local-tile {
    position: absolute;
    left: 20px;
    bottom: 20px;
    z-index: 3;
    overflow: hidden;
    width: clamp(8rem, 18vw, 12rem);
    height: clamp(5.8rem, 12vw, 8.2rem);
    border-radius: 1.1rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 18px 34px rgba(4, 10, 24, 0.34);
    color: #fff;
}

.local-tile video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stage-meta {
    display: none;
}

.media-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    background: rgba(10, 17, 32, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
}

.media-badge.off {
    background: rgba(235, 93, 73, 0.22);
    color: #ffd5cd;
}

.meeting-shell {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr) 20rem;
    min-height: 0;
    overflow: hidden;
    height: 100%;
    position: relative;
    transition: grid-template-columns 220ms ease;
}

.meeting-shell.panel-collapsed {
    grid-template-columns: minmax(0, 1fr) 0;
    gap: 0;
}

.prejoin-shell {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 2rem;
    background: rgba(4, 8, 18, 0.72);
    backdrop-filter: blur(26px);
    z-index: 100;
}

.prejoin-modal {
    width: min(100%, 920px);
    padding: 1rem;
    border-radius: 1.65rem;
    background: rgba(247, 250, 255, 0.94);
    border: 1px solid rgba(18, 32, 61, 0.08);
    box-shadow: 0 36px 90px rgba(5, 12, 26, 0.38);
    backdrop-filter: blur(28px);
    color: var(--text);
}

.prejoin-content {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr) 20rem;
    min-height: 0;
}

.prejoin-modal .prejoin-stage {
    min-height: 26rem;
}

.prejoin-modal .settings-card {
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(18, 32, 61, 0.08);
}

.prejoin-modal .settings-card h2 {
    color: var(--text);
}

.prejoin-modal .panel-note,
.prejoin-modal .setting-group label {
    color: var(--text-soft);
}

.prejoin-modal .eyebrow {
    color: var(--accent-strong);
}

.prejoin-modal .device-select,
.prejoin-modal .link-field {
    background: rgba(255, 255, 255, 0.96);
    color: var(--text);
    border: 1px solid rgba(18, 32, 61, 0.12);
}

.prejoin-modal .device-select option {
    color: var(--text);
}

.prejoin-modal .copy-button,
.prejoin-modal .secondary-action,
.prejoin-modal .pill-button {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(18, 32, 61, 0.12);
}

.settings-column,
.side-panel {
    display: grid;
    gap: 1rem;
    min-height: 0;
    overflow: hidden;
}

.side-panel {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    width: auto;
    z-index: 1;
    align-self: stretch;
    height: 100%;
    min-width: 0;
    transition: transform 220ms ease, opacity 220ms ease;
    transform: translateX(0);
    opacity: 1;
}

.meeting-shell.panel-collapsed .side-panel {
    transform: translateX(1.25rem);
    opacity: 0;
    pointer-events: none;
}

.panel-card,
.call-panel,
.settings-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.prejoin-actions,
.panel-tabs,
.control-bar,
.device-row,
.chat-composer {
    display: flex;
    gap: 0.75rem;
}

.prejoin-actions {
    flex-wrap: wrap;
}

.panel-tabs {
    padding-bottom: 0.25rem;
}

.call-panel {
    display: grid;
    gap: 1rem;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    height: 100%;
    padding: 1rem;
    border-radius: 1.75rem;
    background: linear-gradient(180deg, rgba(29, 43, 78, 0.96), rgba(16, 24, 45, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.panel-tab {
    flex: 1;
    padding: 0.7rem 0.9rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid transparent;
    color: #d5def5;
    font-weight: 700;
}

.panel-tab.active {
    background: rgba(63, 118, 255, 0.22);
    border-color: rgba(122, 159, 255, 0.28);
    color: #fff;
}

.panel-body {
    display: grid;
    gap: 1rem;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr) auto;
}

.message-list,
.file-list {
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.message-list {
    align-items: flex-start;
}

.message-item {
    padding: 0.5rem 0.75rem;
    border-radius: 1.15rem;
    background: #2f6df6;
    border: 0;
    max-width: 82%;
    width: fit-content;
}

.file-item {
    padding: 0.85rem 0.95rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.message-item.self {
    background: #ffffff;
    align-self: flex-end;
}

.message-body {
    margin: 0.15rem 0 0;
    color: inherit;
}

.message-item.self .message-body {
    color: #1a2744;
}

.chat-composer input,
.device-select,
.link-field {
    width: 100%;
    padding: 0.85rem 1rem;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(9, 16, 31, 0.32);
    color: #fff;
}

.chat-composer input::placeholder {
    color: rgba(237, 242, 255, 0.46);
}

.chat-composer button {
    padding: 0;
    min-width: 3rem;
    width: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chat-send-button i {
    font-size: 0.9rem;
}

.settings-grid {
    display: grid;
    gap: 1rem;
}

.setting-group {
    display: grid;
    gap: 0.45rem;
}

.setting-group label {
    font-size: 0.88rem;
    color: rgba(237, 242, 255, 0.72);
    font-weight: 600;
}

.panel-note {
    margin: 0;
    font-size: 0.9rem;
    color: rgba(237, 242, 255, 0.58);
}

.link-row {
    display: grid;
    gap: 0.75rem;
}

.device-row {
    flex-wrap: wrap;
}

.device-row .pill-button {
    padding: 0.75rem 1rem;
}

.control-rail {
    display: flex;
    justify-content: center;
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px));
    padding-bottom: 20px;
    z-index: 4;
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
}

.control-rail.controls-hidden {
    opacity: 0;
    transform: translateY(12px);
}

.control-bar {
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    padding: 0.6rem;
    border-radius: 999px;
    background: rgba(12, 18, 34, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 18px 34px rgba(4, 10, 24, 0.28);
    pointer-events: auto;
}

.icon-button,
.control-button {
    min-width: 2.625rem;
    min-height: 2.625rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.75rem;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.icon-button i,
.danger-action i {
    font-size: 0.82rem;
}

.control-bar .danger-action {
    min-width: 2.625rem;
    min-height: 2.625rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.75rem;
}

.icon-button.active,
.pill-button.active {
    background: rgba(63, 118, 255, 0.22);
    border-color: rgba(122, 159, 255, 0.28);
}

.icon-button.off {
    background: rgba(235, 93, 73, 0.2);
    border-color: rgba(255, 164, 150, 0.2);
}

.panel-screen {
    text-align: center;
    padding: 1rem;
}

.upload-input {
    width: 100%;
    color: rgba(237, 242, 255, 0.72);
}

.call-room-missing {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem;
}

.call-room-missing .feedback-card {
    max-width: 36rem;
}

@media (max-width: 1080px) {
    .landing-page,
    .meeting-shell,
    .call-body,
    .prejoin-content {
        grid-template-columns: 1fr;
    }

    .preview-body {
        grid-template-columns: 1fr;
    }

    .call-page {
        padding: 15px;
    }

    .call-frame {
        height: calc(100dvh - 30px);
    }

    .call-header {
        top: 1rem;
        left: 1rem;
        right: 1rem;
    }

    .call-header-copy {
        max-width: calc(100% - 1rem);
    }

    .side-panel {
        height: min(22rem, 42vh);
    }
}

@media (max-width: 720px) {
    .landing-page,
    .feedback-page {
        padding: 1rem;
    }

    .landing-panel,
    .feedback-card,
    .call-frame {
        padding: 1.2rem;
    }

    .call-header {
        flex-direction: column;
    }

    .landing-copy h1,
    .feedback-card h1,
    .call-header-copy h1 {
        font-size: clamp(2rem, 10vw, 3rem);
    }

    .local-tile {
        width: 7.4rem;
        height: 5rem;
    }

    .control-bar {
        border-radius: 1.25rem;
    }
}
