:root {
    --bg: #0b0f14;
    --panel: #131a22;
    --panel-2: #18212c;
    --border: #243040;
    --text: #edf2f7;
    --muted: #9aabbd;
    --accent: #59c3ff;
    --accent-2: #7dd3fc;
    --success: #35d07f;
    --danger: #ff5d73;
    --shadow: 0 12px 40px rgba(0,0,0,0.28);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    font-family: Arial, Helvetica, sans-serif;
    background: linear-gradient(180deg, #091018 0%, #0b0f14 100%);
    color: var(--text);
}

body {
    min-height: 100vh;
}

.status {
    margin-bottom: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-weight: 600;
    background: #1a1a1a;
}

.status--idle { color: #aaa; }
.status--connecting { color: #facc15; }
.status--live { color: #22c55e; }
.status--error { color: #ef4444; }

.app-shell {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 22px;
    min-height: 100vh;
    padding: 22px;
}

.sidebar,
.panel,
.hero-panel,
.card {
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.sidebar {
    background: rgba(19, 26, 34, 0.92);
    border-radius: 22px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 8px;
}

.brand-mark {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #071019;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 18px;
}

.brand h1 {
    margin: 0;
    font-size: 24px;
}

.brand p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.card {
    background: rgba(24, 33, 44, 0.9);
    border-radius: 18px;
    padding: 18px;
}

.card h2 {
    margin: 0 0 16px;
    font-size: 18px;
}

.field {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 7px;
    font-size: 13px;
    color: var(--muted);
    letter-spacing: 0.02em;
}

input,
select,
button {
    width: 100%;
    border: 1px solid #314152;
    border-radius: 12px;
    background: #0d141c;
    color: var(--text);
    padding: 12px 14px;
    font-size: 15px;
    outline: none;
}

input:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(89, 195, 255, 0.12);
}

.button-stack {
    display: grid;
    gap: 10px;
    margin-top: 8px;
}

.btn {
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #2fb3ff, #76d8ff);
    color: #041019;
    border-color: transparent;
}

.btn-secondary {
    background: #101822;
}

.btn-danger {
    background: linear-gradient(135deg, #ff5d73, #ff8b9b);
    color: #22070c;
    border-color: transparent;
}

.stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.stat-row:first-of-type {
    border-top: none;
    padding-top: 0;
}

.stat-row span {
    color: var(--muted);
    font-size: 14px;
}

.status-pill {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #64748b;
    box-shadow: 0 0 0 6px rgba(255,255,255,0.03);
}

.status-dot.idle {
    background: #64748b;
}

.status-dot.connecting {
    background: #f5c451;
}

.status-dot.live {
    background: var(--success);
}

.status-dot.error {
    background: var(--danger);
}

.main-content {
    display: grid;
    grid-template-rows: auto auto 1fr;
    gap: 22px;
}

.hero-panel {
    background:
        radial-gradient(circle at top right, rgba(89, 195, 255, 0.18), transparent 35%),
        linear-gradient(135deg, rgba(24, 33, 44, 0.98), rgba(14, 19, 27, 0.98));
    border-radius: 22px;
    padding: 26px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent-2);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 12px;
    font-weight: 700;
}

.hero-panel h2 {
    margin: 0 0 10px;
    font-size: 32px;
}

.hero-copy {
    margin: 0;
    max-width: 720px;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.5;
}

.preview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
}

.panel {
    background: rgba(19, 26, 34, 0.95);
    border-radius: 22px;
    padding: 20px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.panel-header h3 {
    margin: 0;
    font-size: 18px;
}

.panel-badge {
    border: 1px solid rgba(89, 195, 255, 0.25);
    background: rgba(89, 195, 255, 0.1);
    color: var(--accent-2);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.panel-badge.muted {
    color: var(--muted);
    background: rgba(255,255,255,0.03);
    border-color: rgba(255,255,255,0.06);
}

.partial-preview {
    min-height: 200px;
    border-radius: 18px;
    background: linear-gradient(180deg, #0e151e, #0c1219);
    border: 1px solid rgba(255,255,255,0.05);
    padding: 22px;
    font-size: 30px;
    line-height: 1.35;
    color: #dce7f2;
    opacity: 0.9;
}

.audience-preview {
    min-height: 200px;
    border-radius: 18px;
    background: #05080d;
    border: 1px solid rgba(255,255,255,0.05);
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.audience-preview-previous {
    min-height: 56px;
    color: rgba(255,255,255,0.55);
    font-size: 20px;
    line-height: 1.35;
    margin-bottom: 12px;
}

.audience-preview-current {
    color: #ffffff;
    font-size: 34px;
    line-height: 1.2;
    font-weight: 700;
}

.audience-preview-partial {
    min-height: 36px;
    margin-top: 14px;
    color: rgba(255,255,255,0.35);
    font-size: 18px;
    line-height: 1.3;
}

.transcript-panel {
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.final-lines {
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-right: 6px;
}

.final-line {
    background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.015));
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 16px;
    padding: 16px 18px;
}

.final-line-number {
    display: inline-block;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--accent-2);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
}

.final-line-text {
    font-size: 22px;
    line-height: 1.45;
    color: #f6fbff;
}

/* display */
.display-body {
    background:
        radial-gradient(circle at top right, rgba(89, 195, 255, 0.12), transparent 25%),
        #000;
    color: #fff;
    overflow: hidden;
}

.display-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 42px 72px 54px;
}

.display-topbar {
    position: absolute;
    top: 24px;
    left: 28px;
    right: 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.display-live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    letter-spacing: 0.12em;
    color: rgba(255,255,255,0.7);
    font-weight: 700;
}

.display-live-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 20px rgba(53, 208, 127, 0.6);
}

.display-previous {
    min-height: 2.7em;
    font-size: clamp(22px, 2.2vw, 38px);
    line-height: 1.3;
    color: rgba(255,255,255,0.55);
    margin-bottom: 24px;
}

.display-current {
    font-size: var(--display-current-size, clamp(42px, 4.4vw, 84px));
    line-height: 1.16;
    font-weight: 800;
    color: #fff;
    text-wrap: balance;
}

.display-partial {
    min-height: 1.8em;
    margin-top: 22px;
    font-size: var(--display-partial-size, clamp(20px, 2vw, 34px));
    line-height: 1.3;
    color: rgba(255,255,255,0.35);
}

#summaryModal {
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.summary-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
}

.summary-modal-card {
    position: relative;
    width: min(900px, calc(100vw - 40px));
    max-height: calc(100vh - 60px);
    margin: 30px auto;
    background: #131a22;
    border: 1px solid #243040;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.45);
    overflow: hidden;
}

.summary-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.summary-modal-header h3 {
    margin: 0;
}

.summary-modal-header button {
    width: auto;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #314152;
    background: #0d141c;
    color: #edf2f7;
    cursor: pointer;
}

.summary-modal-content {
    margin: 0;
    padding: 20px;
    white-space: pre-wrap;
    overflow: auto;
    max-height: calc(100vh - 140px);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    color: #edf2f7;
}

@media (max-width: 1200px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 768px) {
    .app-shell {
        padding: 14px;
        gap: 14px;
    }

    .sidebar,
    .panel,
    .hero-panel,
    .card {
        border-radius: 16px;
    }

    .partial-preview {
        font-size: 24px;
    }

    .audience-preview-current {
        font-size: 28px;
    }

    .display-wrap {
        padding: 32px 24px 32px;
    }
}