:root {
    --bg: #eef3f8;
    --card: rgba(255, 255, 255, 0.86);
    --card-strong: #ffffff;
    --line: #d6dfeb;
    --text: #10233f;
    --muted: #56677f;
    --brand: #0f6cbd;
    --brand-deep: #0a4f8a;
    --danger: #c53c2f;
    --success: #13795b;
    --shadow: 0 22px 60px rgba(27, 52, 94, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(15, 108, 189, 0.14), transparent 30%),
        radial-gradient(circle at top right, rgba(64, 162, 227, 0.18), transparent 24%),
        linear-gradient(180deg, #f7fbff 0%, var(--bg) 100%);
}

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

.landing-shell,
.room-layout,
.topbar {
    width: min(1600px, calc(100% - 24px));
    margin: 0 auto;
}

.landing-page {
    min-height: 100vh;
}

.hero-card,
.room-card,
.video-panel,
.topbar,
.form-card {
    background: var(--card);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(214, 223, 235, 0.7);
    box-shadow: var(--shadow);
    border-radius: 24px;
}

.hero-card {
    margin: 40px auto 24px;
    padding: 28px;
    display: grid;
    grid-template-columns: 1.2fr 0.9fr;
    gap: 24px;
}

.hero-copy h1,
.topbar h1 {
    margin: 10px 0 12px;
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1.05;
}

.hero-text,
.panel-head p,
.topbar p,
.room-card p,
.tips-box p {
    color: var(--muted);
    line-height: 1.7;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(15, 108, 189, 0.1);
    color: var(--brand);
    font-size: 0.88rem;
    font-weight: 700;
}

.feature-list {
    padding-left: 20px;
    line-height: 1.9;
}

.form-card {
    padding: 24px;
    background: var(--card-strong);
}

.form-card h2,
.panel-head h2 {
    margin: 0 0 14px;
    font-size: 1.3rem;
}

.enter-form,
.enter-form label {
    display: grid;
    gap: 10px;
}

.enter-form {
    gap: 16px;
}

.auth-card-stack {
    display: grid;
    gap: 18px;
}

.enter-form span {
    font-size: 0.95rem;
    font-weight: 700;
}

input,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px 15px;
    font-size: 1rem;
    outline: none;
    background: #fff;
}

input:focus,
select:focus {
    border-color: rgba(15, 108, 189, 0.8);
    box-shadow: 0 0 0 4px rgba(15, 108, 189, 0.12);
}

.primary-btn,
.ghost-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 18px;
    border-radius: 14px;
    font-weight: 700;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.primary-btn {
    border: none;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
    color: #fff;
    cursor: pointer;
}

.ghost-btn {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.72);
    cursor: pointer;
}

.primary-btn:hover,
.ghost-btn:hover {
    transform: translateY(-1px);
}

.tips-box,
.alert {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 0.95rem;
}

.tips-box {
    background: rgba(15, 108, 189, 0.08);
}

.alert-error {
    background: rgba(197, 60, 47, 0.12);
    color: var(--danger);
}

.alert-success {
    background: rgba(19, 121, 91, 0.12);
    color: var(--success);
}

.user-summary {
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(15, 108, 189, 0.08);
    color: var(--muted);
    line-height: 1.7;
}

.user-summary p {
    margin: 0;
}

.split-line {
    position: relative;
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
}

.split-line::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    border-top: 1px solid var(--line);
    transform: translateY(-50%);
}

.split-line span {
    position: relative;
    display: inline-block;
    padding: 0 10px;
    background: var(--card-strong);
}

.secondary-actions {
    margin-top: 14px;
}

.full-width-btn {
    width: 100%;
}

.room-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    padding-bottom: 40px;
}

.room-card {
    padding: 22px;
}

.room-card h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.room-meta {
    margin-top: 16px;
    font-size: 0.92rem;
    color: var(--brand);
}

.room-page {
    min-height: 100vh;
    padding: 20px 0 32px;
}

.topbar {
    margin-top: 10px;
    margin-bottom: 18px;
    padding: 22px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.topbar h1 {
    font-size: clamp(1.8rem, 3vw, 2.7rem);
}

.topbar-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.room-layout {
    display: block;
}

.video-panel {
    padding: 18px;
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.status-pill {
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(15, 108, 189, 0.1);
    color: var(--brand);
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
}

.compact-btn {
    min-height: 40px;
    padding: 0 14px;
    cursor: pointer;
}

.iframe-shell {
    overflow: hidden;
    border-radius: 22px;
    border: 1px solid var(--line);
    background: #f5f7fb;
}

.stream-stage {
    position: relative;
}

.has-chat-overlay {
    position: relative;
}

.video-shell:fullscreen {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    border: none;
    background: #000;
}

.video-shell:fullscreen iframe {
    height: 100vh;
}

.iframe-shell iframe {
    width: 100%;
    border: none;
    display: block;
}

.video-shell iframe {
    min-height: 860px;
}

.chat-overlay {
    position: absolute !important;
    top: 18px;
    right: 18px;
    z-index: 3;
    width: min(360px, calc(100% - 36px));
    max-height: calc(100% - 36px);
    display: flex;
    flex-direction: column;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(18px);
    box-shadow: 0 24px 70px rgba(10, 27, 56, 0.24);
    overflow: hidden;
    transition: width 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.chat-overlay-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(15, 108, 189, 0.14) 0%, rgba(255, 255, 255, 0.64) 100%);
    border-bottom: 1px solid rgba(214, 223, 235, 0.8);
    cursor: move;
    user-select: none;
}

.chat-overlay-head h2 {
    margin: 0 0 4px;
    font-size: 1.05rem;
}

.chat-overlay-head p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.chat-overlay-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

.chat-overlay.is-collapsed {
    width: 210px;
    background: rgba(255, 255, 255, 0.92);
}

.chat-overlay.is-collapsed .chat-overlay-head {
    border-bottom: none;
}

.chat-overlay.is-collapsed .chat-overlay-body {
    display: none;
}

.chat-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.92rem;
    background: rgba(15, 108, 189, 0.05);
}

.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 220px;
    max-height: 320px;
}

.chat-empty {
    margin: auto;
    padding: 18px;
    border: 1px dashed var(--line);
    border-radius: 16px;
    color: var(--muted);
    text-align: center;
    max-width: 320px;
}

.chat-message {
    padding: 12px 14px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid rgba(214, 223, 235, 0.9);
    box-shadow: 0 8px 24px rgba(27, 52, 94, 0.05);
}

.chat-message.is-self {
    background: rgba(15, 108, 189, 0.08);
    border-color: rgba(15, 108, 189, 0.18);
}

.chat-message-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
    font-size: 0.88rem;
    color: var(--muted);
}

.chat-message-head strong {
    color: var(--text);
}

.chat-message-body {
    line-height: 1.7;
    color: var(--text);
    word-break: break-word;
}

.chat-form {
    padding: 14px;
    border-top: 1px solid var(--line);
    background: #fff;
}

.chat-form textarea {
    width: 100%;
    min-height: 100px;
    resize: vertical;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    font: inherit;
    color: var(--text);
    outline: none;
}

.chat-form textarea:focus {
    border-color: rgba(15, 108, 189, 0.8);
    box-shadow: 0 0 0 4px rgba(15, 108, 189, 0.12);
}

.chat-form-actions {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.chat-tip {
    color: var(--muted);
    font-size: 0.9rem;
}

@media (max-width: 980px) {
    .room-grid {
        grid-template-columns: 1fr;
    }

    .video-shell iframe {
        min-height: 620px;
    }

    .chat-overlay {
        top: auto;
        right: 12px;
        bottom: 12px;
        width: min(400px, calc(100% - 24px));
        max-height: min(62vh, 540px);
    }
}

@media (max-width: 720px) {
    .landing-shell,
    .room-layout,
    .topbar {
        width: min(100% - 20px, 1180px);
    }

    .hero-card,
    .form-card,
    .video-panel,
    .room-card,
    .topbar {
        border-radius: 18px;
    }

    .hero-card,
    .topbar,
    .video-panel {
        padding: 16px;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .panel-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .video-shell iframe {
        min-height: 420px;
    }

    .chat-overlay {
        left: 10px;
        right: 10px;
        bottom: 10px;
        top: auto;
        width: auto;
        max-height: min(68vh, 500px);
        border-radius: 18px;
    }

    .chat-overlay.is-collapsed {
        width: calc(100% - 20px);
    }

    .chat-meta,
    .chat-form-actions,
    .chat-message-head,
    .chat-overlay-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .chat-messages {
        max-height: 240px;
    }
}
