:root {
    --demo-bg: #08131f;
    --demo-surface: rgba(11, 27, 42, 0.82);
    --demo-card: rgba(255, 255, 255, 0.04);
    --demo-border: rgba(151, 183, 204, 0.14);
    --demo-text: #eff7fb;
    --demo-muted: #a8bfd2;
    --demo-primary: #1bb5b5;
    --demo-primary-dark: #0b8e8e;
    --demo-accent: #efb25d;
}

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

body.demo-body {
    margin: 0;
    min-height: 100vh;
    font-family: "Manrope", sans-serif;
    background:
        radial-gradient(circle at top right, rgba(27, 181, 181, 0.13), transparent 30%),
        linear-gradient(160deg, #08131f, #0c1e31);
    color: var(--demo-text);
    line-height: 1.5;
}

img {
    display: block;
    max-width: 100%;
}

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

.demo-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.demo-page {
    padding: 1.5rem 0 2.5rem;
}

.demo-topbar,
.demo-banner,
.demo-hero,
.demo-panel,
.demo-sidebar,
.demo-output,
.demo-quiz-card {
    border: 1px solid var(--demo-border);
    background: var(--demo-surface);
    border-radius: 24px;
    backdrop-filter: blur(18px);
}

.demo-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.15rem;
    margin-bottom: 1rem;
}

.demo-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
}

.demo-brand img {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    padding: 0.3rem;
}

.demo-brand strong {
    display: block;
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: 1rem;
}

.demo-brand span {
    display: block;
    margin-top: 0.15rem;
    color: var(--demo-muted);
    font-size: 0.84rem;
}

.demo-actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.demo-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.75rem 1.05rem;
    border-radius: 14px;
    border: 1px solid transparent;
    font-weight: 700;
    font-size: 0.94rem;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.demo-btn:hover,
.demo-btn:focus-visible {
    transform: translateY(-1px);
}

.demo-btn-primary {
    background: linear-gradient(135deg, var(--demo-primary), var(--demo-primary-dark));
    color: #07131f;
}

.demo-btn-secondary {
    background: linear-gradient(135deg, var(--demo-accent), #e59a39);
    color: #241302;
}

.demo-btn-ghost {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: var(--demo-text);
}

.demo-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.15rem;
    margin-bottom: 1rem;
    background: linear-gradient(145deg, rgba(239, 178, 93, 0.12), rgba(255, 255, 255, 0.03));
}

.demo-banner strong {
    display: block;
    font-size: 0.98rem;
}

.demo-banner p {
    margin: 0.3rem 0 0;
    color: var(--demo-muted);
    font-size: 0.92rem;
}

.demo-hero {
    padding: 1.35rem;
    margin-bottom: 1rem;
}

.demo-hero h1 {
    margin: 0;
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.05;
}

.demo-hero p {
    margin: 0.9rem 0 0;
    max-width: 780px;
    color: var(--demo-muted);
}

.demo-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
    gap: 1rem;
}

.demo-panel,
.demo-sidebar,
.demo-output,
.demo-quiz-card {
    padding: 1.15rem;
}

.demo-panel h2,
.demo-sidebar h2,
.demo-output h2,
.demo-quiz-card h2 {
    margin: 0 0 1rem;
    font-size: 1rem;
}

.demo-field {
    display: grid;
    gap: 0.45rem;
}

.demo-field label,
.demo-label {
    color: var(--demo-muted);
    font-size: 0.86rem;
}

.demo-input,
.demo-select,
.demo-textarea {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--demo-text);
    font: inherit;
    padding: 0.8rem 0.9rem;
}

.demo-textarea {
    min-height: 90px;
    resize: vertical;
}

.demo-inline-actions,
.demo-toolbar,
.demo-room-meta,
.demo-chat-input {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.demo-room-meta {
    margin-top: 1rem;
}

.meta-chip,
.demo-chip {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0.55rem 0.85rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.88rem;
    color: var(--demo-muted);
}

.demo-video-shell {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(27, 181, 181, 0.08));
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.demo-video-shell iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.demo-divider {
    height: 1px;
    margin: 1rem 0;
    background: rgba(255, 255, 255, 0.06);
}

.demo-chat-feed,
.demo-note-feed {
    display: grid;
    gap: 0.7rem;
    max-height: 320px;
    overflow-y: auto;
}

.chat-message,
.note-message {
    padding: 0.8rem 0.9rem;
    border-radius: 16px;
    background: var(--demo-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-message strong,
.note-message strong {
    display: block;
    font-size: 0.9rem;
}

.chat-message span,
.note-message span {
    display: block;
    margin-top: 0.3rem;
    color: var(--demo-muted);
    font-size: 0.9rem;
}

.demo-chat-input input,
.demo-chat-input textarea {
    flex: 1 1 180px;
}

.status-line {
    margin-top: 0.9rem;
    color: #cfe8e8;
    font-size: 0.9rem;
}

.board-wrap,
.note-pad-wrap {
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
}

.demo-panel-whiteboard {
    min-height: clamp(460px, 72vh, 960px);
}

.board-wrap.board-wrap-resizable {
    position: relative;
    width: 100%;
    min-width: 320px;
    min-height: 320px;
    height: clamp(340px, 58vh, 780px);
    max-width: 100%;
    max-height: 82vh;
}

.draw-surface {
    display: block;
    width: 100%;
    min-height: 260px;
    background:
        linear-gradient(transparent 31px, rgba(255, 255, 255, 0.04) 32px),
        linear-gradient(90deg, transparent 31px, rgba(255, 255, 255, 0.04) 32px);
    background-size: 32px 32px;
    cursor: crosshair;
}

.board-wrap.board-wrap-resizable .draw-surface {
    width: 100%;
    height: 100%;
    min-height: 100%;
}

.board-resize-handle {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 28px;
    height: 28px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(7, 12, 19, 0.65);
    cursor: nwse-resize;
    z-index: 4;
    touch-action: none;
}

.board-resize-handle::before,
.board-resize-handle::after {
    content: "";
    position: absolute;
    right: 6px;
    bottom: 6px;
    border-right: 2px solid rgba(239, 247, 251, 0.88);
    border-bottom: 2px solid rgba(239, 247, 251, 0.88);
    border-bottom-right-radius: 2px;
}

.board-resize-handle::before {
    width: 12px;
    height: 12px;
}

.board-resize-handle::after {
    width: 7px;
    height: 7px;
    right: 10px;
    bottom: 10px;
}

body.board-resizing,
body.board-resizing * {
    cursor: nwse-resize !important;
    user-select: none !important;
}

.demo-toolbar {
    margin-top: 1rem;
}

.limit-note {
    margin-top: 0.8rem;
    color: var(--demo-muted);
    font-size: 0.86rem;
}

.quiz-progress {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    color: var(--demo-muted);
    font-size: 0.92rem;
}

.quiz-options {
    display: grid;
    gap: 0.75rem;
    margin-top: 1rem;
}

.quiz-option {
    width: 100%;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--demo-text);
    padding: 0.9rem;
    font: inherit;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.quiz-option:hover,
.quiz-option:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(27, 181, 181, 0.38);
}

.quiz-option.is-correct {
    border-color: rgba(27, 181, 181, 0.55);
    background: rgba(27, 181, 181, 0.1);
}

.quiz-option.is-wrong {
    border-color: rgba(239, 108, 85, 0.45);
    background: rgba(239, 108, 85, 0.08);
}

.result-banner {
    margin-top: 1rem;
    padding: 0.95rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.demo-sidebar ul {
    margin: 0;
    padding-left: 1rem;
    color: var(--demo-muted);
}

.demo-sidebar li + li {
    margin-top: 0.5rem;
}

@media (max-width: 900px) {
    .demo-topbar,
    .demo-banner,
    .demo-layout {
        grid-template-columns: 1fr;
    }

    .demo-topbar,
    .demo-banner {
        display: grid;
    }
}

@media (max-width: 760px) {
    .demo-shell {
        width: min(100%, calc(100% - 24px));
    }

    .demo-page {
        padding: 1rem 0 2rem;
    }

    .demo-actions,
    .demo-inline-actions,
    .demo-toolbar,
    .demo-room-meta,
    .demo-chat-input {
        width: 100%;
    }

    .demo-actions .demo-btn,
    .demo-inline-actions .demo-btn,
    .demo-toolbar .demo-btn {
        flex: 1 1 auto;
    }

    .demo-panel-whiteboard {
        min-height: auto;
    }

    .board-wrap.board-wrap-resizable {
        min-width: 100%;
        width: 100% !important;
        min-height: 280px;
    }

    .board-resize-handle {
        width: 24px;
        height: 24px;
        right: 8px;
        bottom: 8px;
    }
}
