.demo-intro {
    align-items: flex-start;
    display: flex;
    gap: 24px;
    justify-content: space-between;
}

.status {
    border: 1px solid var(--line);
    border-radius: 999px;
    flex: 0 0 auto;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    padding: 9px 13px;
}

.status.disconnected {
    background: #f6e9e5;
    color: #7d2d20;
}

.status.connected {
    background: #e7f0e9;
    color: #1f6d3a;
}

.status.connecting {
    background: #f7efd9;
    color: #7a5b12;
}

.demo-shell {
    margin-top: 28px;
}

.demo-toolbar,
.demo-bottom {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr) auto;
}

.demo-toolbar {
    align-items: center;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 16px;
}

.mode-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mode-option,
.check-option {
    align-items: center;
    cursor: pointer;
    display: inline-flex;
    gap: 7px;
}

.mode-option input {
    position: absolute;
    opacity: 0;
}

.mode-option span {
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    display: block;
    font-weight: 700;
    line-height: 1;
    padding: 9px 13px;
}

.mode-option input:checked + span {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
    color: #fff;
}

.action-buttons,
.controls,
.chat-input-container,
.video-controls,
.video-tuning {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn {
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    min-height: 40px;
    padding: 9px 14px;
}

.btn:disabled,
input:disabled,
textarea:disabled,
select:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.btn-primary,
.btn-success {
    background: var(--accent-dark);
    color: #fff;
}

.btn-danger {
    background: #7d2d20;
    color: #fff;
}

.btn-secondary {
    background: #eef1eb;
    border-color: var(--line);
    color: var(--ink);
}

.demo-panel,
.messages,
.stat-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
}

.demo-panel {
    margin-top: 18px;
    padding: 22px;
}

.panel-heading {
    border-bottom: 1px solid var(--line);
    margin-bottom: 18px;
    padding-bottom: 14px;
}

.panel-heading p {
    color: var(--muted);
    margin-bottom: 0;
}

input[type="text"],
textarea,
select {
    background: #fbfcf9;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--ink);
    font: inherit;
    min-height: 40px;
    padding: 9px 11px;
}

input[type="text"],
textarea {
    flex: 1 1 280px;
}

textarea {
    min-height: 74px;
    resize: vertical;
}

.echo-result {
    background: #fbfcf9;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    margin-top: 12px;
    min-height: 48px;
    overflow-wrap: anywhere;
    padding: 12px;
}

.calculator-shell {
    background: #17201d;
    border-radius: 6px;
    margin: 0 auto;
    max-width: 390px;
    padding: 16px;
}

.calculator-display {
    background: #0d1210;
    border: 1px solid #36423e;
    border-radius: 4px;
    margin-bottom: 12px;
    min-height: 94px;
    padding: 12px;
    text-align: right;
}

.calculator-expression {
    color: #9aa69f;
    font-size: 14px;
    min-height: 22px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calculator-value {
    color: #f9faf6;
    font-size: 40px;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calculator-keys {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.calc-key {
    aspect-ratio: 1 / 1;
    background: #33413d;
    border: 0;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    font-size: 22px;
    font-weight: 700;
}

.calc-key.utility {
    background: #5f6963;
}

.calc-key.operator,
.calc-key.equals {
    background: var(--wood);
}

.calc-key.zero {
    aspect-ratio: auto;
    grid-column: span 2;
}

.chat-history {
    background: #fbfcf9;
    border: 1px solid var(--line);
    border-radius: 4px;
    height: 300px;
    margin-bottom: 12px;
    overflow-y: auto;
    padding: 14px;
}

.chat-message {
    border-radius: 6px;
    margin-bottom: 12px;
    max-width: 82%;
    padding: 10px 12px;
}

.chat-message.user {
    background: #eef1eb;
    margin-left: auto;
    text-align: right;
}

.chat-message.assistant {
    background: #e7f0e9;
}

.chat-message.assistant.streaming {
    border-left: 3px solid var(--accent);
}

.video-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.video-grid video,
.video-grid canvas {
    aspect-ratio: 4 / 3;
    background: #0d1210;
    border: 1px solid var(--line);
    border-radius: 4px;
    display: block;
    width: 100%;
}

.video-controls,
.video-tuning {
    align-items: center;
    border-top: 1px solid var(--line);
    margin-top: 16px;
    padding-top: 16px;
}

#videoStats {
    color: var(--muted);
    font-size: 14px;
    margin-left: auto;
}

.demo-bottom {
    align-items: stretch;
    margin-top: 18px;
}

.messages {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 13px;
    height: 260px;
    overflow-y: auto;
    padding: 12px;
}

.message {
    border-left: 3px solid var(--line);
    margin-bottom: 8px;
    padding: 6px 8px;
}

.message.sent {
    border-left-color: var(--wood);
}

.message.received {
    border-left-color: var(--accent);
}

.message.error {
    border-left-color: #7d2d20;
    color: #7d2d20;
}

.timestamp {
    color: var(--muted);
    margin-right: 7px;
}

.stats {
    display: grid;
    gap: 10px;
    min-width: 170px;
}

.stat-card {
    padding: 14px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.1;
}

.stat-label {
    color: var(--muted);
    font-size: 12px;
    margin-top: 4px;
}

.hidden {
    display: none;
}

@media (max-width: 900px) {
    .demo-intro,
    .demo-toolbar,
    .demo-bottom,
    .video-grid {
        display: block;
    }

    .status,
    .action-buttons,
    .stats {
        margin-top: 14px;
    }

    .messages {
        height: 220px;
    }

    .btn {
        flex: 1 1 auto;
    }
}
