:root {
    --bg: #0a1018;
    --panel: #111927;
    --panel-2: #0e1724;
    --border: #213347;
    --text: #e6edf6;
    --muted: #9ba9bc;
    --accent: #18c9d8;
    --accent2: #747bff;
    --danger: #ef5350;
    --success: #36c690;
    --warning: #f2b84b;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.34);
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 10px;
    --grid-step: 7px;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    background:
        radial-gradient(circle at 100% -10%, rgba(24, 201, 216, 0.18), transparent 35%),
        radial-gradient(circle at -10% 100%, rgba(116, 123, 255, 0.15), transparent 30%),
        var(--bg);
    color: var(--text);
    line-height: 1.5;
}

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

input,
textarea {
    color: var(--text);
}

.app-shell {
    max-width: 1400px;
    margin: 0 auto;
    padding: calc(var(--grid-step) * 2.25);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: calc(var(--grid-step) * 0.85);
}

.guest-only {
    display: none;
}

.app-shell.is-guest .auth-only {
    display: none !important;
}

.app-shell.is-guest.guest-watch-active #pageWatch.auth-only {
    display: grid !important;
}

.app-shell.is-guest .guest-only {
    display: block;
}

.app-shell.is-guest .topbar {
    display: none;
}

.app-shell.is-guest .page-stack {
    display: block;
    min-height: calc(100vh - calc(var(--grid-step) * 6));
}

.panel {
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(17, 25, 39, 0.95), rgba(14, 23, 36, 0.95));
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(var(--grid-step) * 1.2) calc(var(--grid-step) * 1.6);
    gap: calc(var(--grid-step) * 1.25);
    position: sticky;
    top: calc(var(--grid-step) * 1.1);
    z-index: 30;
    backdrop-filter: blur(12px);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: calc(var(--grid-step) * 1.25);
    min-width: 0;
}

.topbar-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(106, 124, 146, 0.38);
    background: rgba(6, 12, 20, 0.52);
    padding: 6px 10px;
    transition: border-color 140ms ease, background-color 140ms ease;
}

.topbar-brand img {
    display: block;
    width: auto;
    height: 26px;
}

.topbar-brand:hover,
.topbar-brand:focus-visible {
    border-color: rgba(24, 201, 216, 0.5);
    background: rgba(10, 20, 33, 0.72);
}

.topbar-brand:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(24, 201, 216, 0.2);
}

.nav-group {
    display: flex;
    align-items: center;
    gap: var(--grid-step);
}

.page-stack {
    display: grid;
}

.page {
    display: none;
    gap: calc(var(--grid-step) * 0.85);
}

.page.is-visible {
    display: grid;
}

.guest-landing {
    display: none;
    min-height: calc(100vh - calc(var(--grid-step) * 6));
    padding: clamp(20px, 5vw, 44px);
    text-align: center;
}

.app-shell.is-guest .guest-landing {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: calc(var(--grid-step) * 1.3);
}

.app-shell.is-guest.guest-watch-active .guest-landing {
    display: none !important;
}

.css-logo-lockup {
    display: flex;
    align-items: center;
    gap: clamp(14px, 2.4vw, 30px);
    animation: logoDrift 6s ease-in-out infinite;
}

.css-logo-bubble {
    position: relative;
    width: clamp(170px, 20vw, 238px);
    aspect-ratio: 1.9 / 1;
    border-radius: 999px;
    padding: 8px;
    background: linear-gradient(118deg, #53e1ff 8%, #5d8eff 45%, #bd63ff 92%);
    box-shadow:
        0 0 0 2px rgba(109, 199, 255, 0.55),
        0 22px 52px rgba(73, 140, 255, 0.38),
        0 0 42px rgba(175, 94, 255, 0.55);
    isolation: isolate;
}

.css-logo-bubble::before {
    content: "";
    position: absolute;
    inset: -12px -10px -12px -10px;
    border-radius: 999px;
    background: conic-gradient(from 30deg, rgba(87, 232, 255, 0.35), rgba(162, 110, 255, 0.5), rgba(87, 232, 255, 0.35));
    filter: blur(14px);
    opacity: 0.65;
    z-index: -1;
    animation: haloSpin 10s linear infinite;
}

.css-logo-bubble::after {
    content: "";
    position: absolute;
    left: 16px;
    bottom: -11px;
    width: 34px;
    height: 24px;
    clip-path: polygon(14% 0, 100% 10%, 54% 100%, 0 100%);
    background: linear-gradient(120deg, #50dcff, #8d62ff);
    box-shadow: 0 8px 16px rgba(91, 152, 255, 0.45);
    transform: rotate(-11deg);
}

.css-logo-core {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 999px;
    border: 1px solid rgba(142, 225, 255, 0.75);
    background:
        radial-gradient(circle at 24% 24%, rgba(87, 165, 255, 0.5), transparent 35%),
        radial-gradient(circle at 76% 68%, rgba(170, 95, 255, 0.46), transparent 44%),
        linear-gradient(160deg, #03163c 6%, #07112a 58%, #17083c 100%);
    box-shadow:
        inset 0 0 32px rgba(100, 139, 255, 0.38),
        inset 0 0 56px rgba(114, 74, 255, 0.2);
    overflow: hidden;
}

.css-logo-star {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #d6f6ff;
    box-shadow: 0 0 8px rgba(146, 229, 255, 0.8);
    animation: starBlink 3.2s ease-in-out infinite;
}

.css-logo-star.star-1 {
    top: 21%;
    left: 20%;
    animation-delay: 0.1s;
}

.css-logo-star.star-2 {
    top: 65%;
    left: 30%;
    animation-delay: 1s;
}

.css-logo-star.star-3 {
    top: 33%;
    left: 72%;
    animation-delay: 1.8s;
}

.css-logo-star.star-4 {
    top: 58%;
    left: 80%;
    animation-delay: 2.4s;
}

.css-logo-play {
    position: absolute;
    left: 52%;
    top: 50%;
    width: 68px;
    height: 68px;
    transform: translate(-50%, -50%);
    clip-path: polygon(18% 10%, 88% 50%, 18% 90%);
    background: linear-gradient(140deg, #57edff 2%, #7ca2ff 48%, #c26cff 100%);
    filter: drop-shadow(0 0 22px rgba(126, 139, 255, 0.62));
    animation: playPulse 3.1s ease-in-out infinite;
}

.css-logo-play::after {
    content: "";
    position: absolute;
    inset: 0;
    clip-path: inherit;
    background: linear-gradient(206deg, rgba(255, 255, 255, 0.52), transparent 56%);
}

.css-logo-wordmark {
    margin: 0;
    font-size: clamp(2rem, 5.2vw, 4rem);
    font-weight: 800;
    letter-spacing: 0.01em;
    line-height: 1;
    background: linear-gradient(90deg, #43c7ff 0%, #69d6ff 34%, #778dff 60%, #6948f8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow:
        0 0 16px rgba(112, 157, 255, 0.45),
        0 0 32px rgba(109, 84, 255, 0.5);
    animation: wordmarkPulse 4.8s ease-in-out infinite alternate;
}

.guest-landing-copy {
    margin: 0;
    color: var(--muted);
    max-width: 680px;
}

.guest-landing-actions {
    display: flex;
    align-items: center;
    gap: var(--grid-step);
}

.guest-public-videos {
    width: min(1320px, 100%);
    padding: calc(var(--grid-step) * 1.5);
}

.guest-session-grid {
    padding: 0;
    display: grid;
    grid-template-columns: repeat(var(--guest-columns, 4), minmax(0, 1fr));
    gap: calc(var(--grid-step) * 1.2);
}

.guest-session-card .btn {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 38px;
    padding: 8px 14px;
}

.guest-session-card .session-card-badges {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
}

.guest-session-card .session-card-badges > * {
    flex: 0 0 auto;
    font-size: 0.64rem;
    letter-spacing: 0.04em;
    padding: 3px 7px;
    min-height: 24px;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.guest-session-card .session-card-badges > *:nth-child(n + 4) {
    display: none;
}

.guest-session-card .session-meta {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8rem;
}

@keyframes logoDrift {
    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-7px);
    }
}

@keyframes haloSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes starBlink {
    0%,
    100% {
        opacity: 0.42;
        transform: scale(0.85);
    }

    50% {
        opacity: 1;
        transform: scale(1.22);
    }
}

@keyframes playPulse {
    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.08);
    }
}

@keyframes wordmarkPulse {
    from {
        text-shadow:
            0 0 10px rgba(83, 168, 255, 0.42),
            0 0 20px rgba(107, 88, 255, 0.3);
    }

    to {
        text-shadow:
            0 0 18px rgba(86, 187, 255, 0.6),
            0 0 38px rgba(126, 90, 255, 0.65);
    }
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: calc(var(--grid-step) * 1);
    padding: calc(var(--grid-step) * 2.4);
}

/* Hard-disable legacy square logo block on Home page. */
.hero-logo-panel,
.hero-logo {
    display: none !important;
}

.hero-copy {
    width: 100%;
    max-width: none;
}

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

.hero-copy h2 {
    margin: 0;
    font-size: clamp(1.7rem, 2vw, 2.3rem);
    line-height: 1.2;
    max-width: none;
}

.hero-subtitle {
    margin: calc(var(--grid-step) * 1.5) 0 0;
    color: var(--muted);
    max-width: none;
}

.hero-form {
    grid-column: auto;
    display: grid;
    gap: var(--grid-step);
}

.field-label {
    font-size: 0.82rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--grid-step);
}

.field-hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.9rem;
    width: fit-content;
}

.checkbox-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.input,
.textarea {
    width: 100%;
    border: 1px solid var(--border);
    background: rgba(4, 9, 17, 0.65);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: calc(var(--grid-step) * 1.25) calc(var(--grid-step) * 1.5);
    outline: none;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

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

.input:focus,
.textarea:focus {
    border-color: rgba(24, 201, 216, 0.8);
    box-shadow: 0 0 0 3px rgba(24, 201, 216, 0.18);
}

.btn {
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: calc(var(--grid-step) * 1) calc(var(--grid-step) * 1.6);
    line-height: 1.1;
    font-weight: 600;
    cursor: pointer;
    transition: transform 140ms ease, background-color 140ms ease, border-color 140ms ease, opacity 140ms ease;
}

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

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(24, 201, 216, 0.2);
}

.btn-primary {
    color: #041019;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
}

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

.btn-secondary {
    color: var(--text);
    border-color: #35506f;
    background: rgba(24, 37, 55, 0.9);
}

.btn-secondary:hover {
    border-color: rgba(24, 201, 216, 0.6);
}

.btn-ghost {
    color: var(--muted);
    border-color: var(--border);
    background: transparent;
}

.btn-ghost:hover,
.btn-ghost.is-active,
.nav-btn.is-active {
    color: var(--text);
    border-color: rgba(24, 201, 216, 0.5);
    background: rgba(24, 201, 216, 0.1);
}

.btn-danger {
    color: #fff;
    background: rgba(239, 83, 80, 0.16);
    border-color: rgba(239, 83, 80, 0.45);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--grid-step);
    padding: calc(var(--grid-step) * 1.5) calc(var(--grid-step) * 1.5) calc(var(--grid-step) * 0.8);
}

.panel-header h2,
.panel-header h3 {
    margin: 0;
}

.session-grid {
    padding: 0 calc(var(--grid-step) * 1.5) calc(var(--grid-step) * 1.5);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: calc(var(--grid-step) * 1);
}

.session-grid.guest-session-grid {
    padding: 0;
    gap: calc(var(--grid-step) * 1.2);
    grid-template-columns: repeat(var(--guest-columns, 4), minmax(0, 1fr));
    grid-template-rows: 1fr;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
}

.session-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(10, 19, 32, 0.9);
    padding: calc(var(--grid-step) * 1.45);
    display: grid;
    gap: calc(var(--grid-step) * 0.85);
}

.session-card .btn {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.session-card-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.session-card-badges > * {
    min-height: 24px;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-thumb,
.library-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: calc(var(--radius-md) - 4px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    overflow: hidden;
    background: rgba(3, 8, 16, 0.92);
}

.session-preview-btn {
    appearance: none;
    display: block;
    padding: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.session-preview-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(24, 201, 216, 0.3);
}

.session-thumb img,
.library-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.session-thumb--fallback,
.library-thumb--fallback {
    display: grid;
    place-items: center;
    color: rgba(225, 236, 248, 0.65);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: radial-gradient(circle at 20% 15%, rgba(24, 201, 216, 0.3), transparent 42%),
    radial-gradient(circle at 85% 10%, rgba(124, 99, 255, 0.3), transparent 40%),
    linear-gradient(150deg, rgba(12, 20, 34, 0.95), rgba(5, 10, 18, 0.95));
}

.session-card h4 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.28;
    min-height: calc(1.28em * 2);
    max-height: calc(1.28em * 2);
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    text-overflow: ellipsis;
}

.session-meta {
    margin: 0;
    color: var(--muted);
    font-size: 0.86rem;
}

.session-folder-badge {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(24, 201, 216, 0.38);
    border-radius: 999px;
    background: rgba(24, 201, 216, 0.1);
    color: #99f6ff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 4px 9px;
    width: fit-content;
}

.session-folder-badge.is-empty {
    border-color: var(--border);
    color: var(--muted);
    background: transparent;
}

.session-scientific-badge {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(116, 123, 255, 0.42);
    border-radius: 999px;
    background: rgba(116, 123, 255, 0.14);
    color: #d6d9ff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 4px 9px;
    width: fit-content;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.badge-ready {
    color: var(--success);
    border-color: rgba(54, 198, 144, 0.38);
    background: rgba(54, 198, 144, 0.12);
}

.badge-processing {
    color: var(--warning);
    border-color: rgba(242, 184, 75, 0.38);
    background: rgba(242, 184, 75, 0.12);
}

.badge-failed {
    color: var(--danger);
    border-color: rgba(239, 83, 80, 0.4);
    background: rgba(239, 83, 80, 0.12);
}

.badge-muted {
    color: var(--muted);
}

.pill {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.pill.is-active {
    color: var(--text);
    border-color: rgba(24, 201, 216, 0.5);
    background: rgba(24, 201, 216, 0.12);
}

.library-toolbar {
    padding: 0 calc(var(--grid-step) * 1.5) calc(var(--grid-step) * 1.5);
    display: grid;
    gap: calc(var(--grid-step) * 0.8);
}

.library-folder-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--grid-step);
}

.folder-create-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--grid-step);
}

.filter-group {
    display: flex;
    gap: var(--grid-step);
    flex-wrap: wrap;
}

.library-list {
    padding: 0 calc(var(--grid-step) * 1.5) calc(var(--grid-step) * 1.5);
    display: grid;
    gap: var(--grid-step);
}

.library-row {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: calc(var(--grid-step) * 1.2);
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(140px, 0.75fr) auto auto auto;
    align-items: center;
    gap: calc(var(--grid-step) * 1);
    background: rgba(12, 21, 34, 0.9);
}

.library-row-main {
    min-width: 0;
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    align-items: center;
    gap: calc(var(--grid-step) * 0.9);
}

.library-row-main .muted-text,
.library-row-main .library-row-title {
    overflow-wrap: anywhere;
}

.library-thumb {
    max-width: 160px;
}

.library-row-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.library-row-detail {
    display: grid;
    gap: 6px;
}

.session-folder-label {
    display: grid;
    gap: 6px;
    max-width: 240px;
}

.session-folder-label .muted-text {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.session-folder-select {
    min-height: 38px;
    padding-top: 8px;
    padding-bottom: 8px;
    background: rgba(7, 13, 22, 0.92);
    color: var(--text);
    color-scheme: dark;
}

.session-folder-select option,
.session-folder-select optgroup {
    color: var(--text);
    background: #0f1826;
}

.library-row-status,
.library-row-folder-chip {
    display: inline-flex;
    align-items: center;
}

.muted-text {
    color: var(--muted);
    margin: 0;
}

.watch-topbar {
    padding: calc(var(--grid-step) * 1.5);
    display: flex;
    justify-content: space-between;
    gap: calc(var(--grid-step) * 0.85);
    align-items: flex-start;
}

.watch-title {
    margin: calc(var(--grid-step) * 0.75) 0 0;
    font-size: 1.5rem;
}

.watch-actions {
    display: grid;
    gap: calc(var(--grid-step) * 0.9);
    justify-items: end;
    min-width: min(520px, 100%);
}

.watch-actions-main {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: nowrap;
    justify-content: flex-end;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}

.watch-actions-main > .btn,
.watch-actions-main > .badge {
    flex: 0 0 auto;
    white-space: nowrap;
}

.watch-actions-main > .btn {
    min-height: 34px;
    padding: 7px 11px;
    font-size: 0.82rem;
}

.watch-actions-main > .badge {
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    padding: 4px 8px;
}

.processing-panel-compact {
    width: min(520px, 100%);
    padding: calc(var(--grid-step) * 1.05) calc(var(--grid-step) * 1.2);
    gap: calc(var(--grid-step) * 0.6);
}

.processing-panel-compact .progress-track {
    height: 6px;
}

.processing-title {
    margin: 0;
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.01em;
}

.processing-panel-compact .muted-text {
    font-size: 0.78rem;
    line-height: 1.4;
}

.processing-panel {
    padding: calc(var(--grid-step) * 1.5);
    display: grid;
    gap: var(--grid-step);
}

.progress-track {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    transition: width 240ms ease;
}

.watch-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    gap: calc(var(--grid-step) * 0.85);
    align-items: start;
}

.video-column {
    padding: calc(var(--grid-step) * 1.5);
    display: grid;
    gap: calc(var(--grid-step) * 0.9);
    align-content: start;
    grid-auto-rows: max-content;
}

.chat-column {
    padding: calc(var(--grid-step) * 1.5);
    display: grid;
    gap: calc(var(--grid-step) * 0.9);
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-height: 0;
    align-self: stretch;
    overflow: hidden;
    min-width: 0;
}

.video-wrap {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
    background: #05080f;
    aspect-ratio: 16 / 9;
    --overlay-inline-padding: calc(var(--grid-step) * 1.1);
    --overlay-gap: calc(var(--grid-step) * 0.75);
    --overlay-play-size: 40px;
}

.video-overlay-controls {
    position: absolute;
    z-index: 6;
    left: var(--overlay-inline-padding);
    bottom: calc(var(--grid-step) * 1);
    display: flex;
    align-items: center;
    gap: var(--overlay-gap);
    opacity: 1;
    transform: translateY(0);
    transition: opacity 140ms ease, transform 140ms ease;
}

.video-overlay-controls .btn {
    min-width: 0;
}

.video-overlay-controls .btn-player-toggle {
    min-width: var(--overlay-play-size);
    width: var(--overlay-play-size);
    height: var(--overlay-play-size);
    padding: 0;
    justify-content: center;
}

.watch-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.watch-video-frame {
    display: block;
    border: 0;
    background: #05080f;
}

.watch-video.is-hidden,
.watch-video-frame.is-hidden {
    display: none;
}

.video-action-bar {
    display: grid;
    gap: calc(var(--grid-step) * 0.6);
    padding: calc(var(--grid-step) * 0.75) calc(var(--grid-step) * 0.9);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(8, 14, 23, 0.82);
}

.video-action-group {
    display: flex;
    align-items: center;
    gap: calc(var(--grid-step) * 0.7);
    flex-wrap: wrap;
}

.video-status-cluster .badge {
    font-size: 0.72rem;
}

.video-controls-cluster {
    align-items: center;
    gap: calc(var(--grid-step) * 0.7);
}

.video-range-buttons {
    display: flex;
    align-items: center;
    gap: calc(var(--grid-step) * 0.5);
    flex-wrap: wrap;
    margin-right: calc(var(--grid-step) * 0.45);
}

.video-controls-cluster > .btn {
    min-width: 126px;
    white-space: nowrap;
    min-height: 36px;
}

.video-range-buttons .btn {
    min-width: 84px;
    min-height: 34px;
    padding: 7px 12px;
}

.ai-timeline-panel {
    padding: calc(var(--grid-step) * 1);
    gap: calc(var(--grid-step) * 0.7);
}

.ai-timeline-header {
    padding: 0;
}

.ai-timeline-header h3 {
    font-size: 0.92rem;
}

.ai-timeline-list {
    display: grid;
    gap: calc(var(--grid-step) * 0.55);
    max-height: 220px;
    overflow: auto;
    padding-right: 2px;
}

.ai-timeline-empty {
    font-size: 0.78rem;
}

.ai-timeline-item {
    appearance: none;
    width: 100%;
    border: 1px solid rgba(98, 114, 132, 0.25);
    border-radius: 10px;
    background: rgba(10, 17, 28, 0.9);
    color: var(--text);
    text-align: left;
    padding: 9px 11px;
    display: grid;
    gap: 5px;
    cursor: pointer;
    transition: border-color 140ms ease, background 140ms ease;
}

.ai-timeline-item:hover {
    border-color: rgba(24, 201, 216, 0.4);
    background: rgba(10, 22, 35, 0.95);
}

.ai-timeline-item.is-active {
    border-color: rgba(24, 201, 216, 0.58);
    background: rgba(14, 34, 52, 0.95);
    box-shadow: 0 0 0 1px rgba(24, 201, 216, 0.22) inset;
}

.ai-timeline-range {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #99f6ff;
}

.ai-timeline-summary {
    font-size: 0.82rem;
    line-height: 1.35;
    color: var(--text);
}

.btn-player {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #e8f6ff;
    border: 1px solid rgba(35, 212, 226, 0.42);
    background: linear-gradient(145deg, rgba(28, 172, 196, 0.24), rgba(65, 109, 255, 0.24));
    box-shadow: 0 8px 18px rgba(6, 15, 33, 0.45), inset 0 0 0 1px rgba(151, 244, 255, 0.08);
}

.btn-player:hover:not(:disabled) {
    border-color: rgba(111, 239, 255, 0.56);
    background: linear-gradient(145deg, rgba(35, 194, 218, 0.34), rgba(80, 125, 255, 0.32));
    box-shadow: 0 10px 20px rgba(6, 15, 33, 0.55), inset 0 0 0 1px rgba(172, 248, 255, 0.16);
}

.btn-player:active:not(:disabled) {
    transform: translateY(0);
    filter: saturate(0.92);
}

.btn-player-muted {
    border-color: rgba(172, 184, 198, 0.35);
    background: linear-gradient(145deg, rgba(111, 126, 146, 0.22), rgba(74, 88, 105, 0.2));
}

.btn-player-icon {
    font-size: 1rem;
    line-height: 1;
    width: auto;
    text-align: center;
    opacity: 0.92;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--grid-step);
    padding: calc(var(--grid-step) * 1);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(8, 14, 23, 0.82);
}

.time-readout,
.range-actions {
    display: flex;
    align-items: center;
    gap: var(--grid-step);
}

.timeline-track-wrap {
    position: relative;
    height: 30px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(8, 14, 23, 0.9);
    overflow: hidden;
}

.video-overlay-timeline {
    position: absolute;
    left: calc(var(--overlay-inline-padding) + var(--overlay-play-size) + var(--overlay-gap));
    right: var(--overlay-inline-padding);
    bottom: calc(var(--grid-step) * 1 + 6px);
    z-index: 5;
    height: 28px;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 170ms ease, transform 170ms ease;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.video-wrap.is-playing.is-idle .video-overlay-controls,
.video-wrap.is-playing.is-idle .video-overlay-timeline {
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
}

.video-wrap.is-playing.is-idle:focus-within .video-overlay-controls,
.video-wrap.is-playing.is-idle:focus-within .video-overlay-timeline {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.timeline-track-base {
    position: absolute;
    top: 50%;
    left: 14px;
    right: 14px;
    height: 4px;
    transform: translateY(-50%);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}

.timeline-progress {
    position: absolute;
    top: 50%;
    left: 14px;
    width: 0;
    height: 4px;
    transform: translateY(-50%);
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(24, 201, 216, 0.84), rgba(116, 123, 255, 0.84));
    pointer-events: none;
    z-index: 1;
}

.timeline-seek {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    z-index: 3;
    cursor: pointer;
}

.timeline-seek::-webkit-slider-runnable-track {
    height: 100%;
    background: transparent;
}

.timeline-seek::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    margin-top: 7px;
    border-radius: 50%;
    border: 1px solid rgba(151, 245, 255, 0.85);
    background: radial-gradient(circle at 35% 35%, rgba(225, 255, 255, 0.95), rgba(24, 201, 216, 0.9) 70%);
    box-shadow: 0 0 0 3px rgba(24, 201, 216, 0.2);
}

.timeline-seek::-moz-range-track {
    height: 100%;
    background: transparent;
    border: 0;
}

.timeline-seek::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: 1px solid rgba(151, 245, 255, 0.85);
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, rgba(225, 255, 255, 0.95), rgba(24, 201, 216, 0.9) 70%);
    box-shadow: 0 0 0 3px rgba(24, 201, 216, 0.2);
}

.timeline-seek:disabled {
    cursor: not-allowed;
}

.timeline-seek:disabled::-webkit-slider-thumb,
.timeline-seek:disabled::-moz-range-thumb {
    opacity: 0.45;
    box-shadow: none;
}

.timeline-markers {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
}

.timeline-marker {
    position: absolute;
    top: 3px;
    width: 10px;
    height: 18px;
    border-radius: 4px;
    border: none;
    transform: translateX(-50%);
    cursor: pointer;
    background: linear-gradient(180deg, var(--accent), var(--accent2));
    pointer-events: auto;
}

.timeline-marker.marker-bookmark {
    background: linear-gradient(180deg, #ffd36a, #ff995f);
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--grid-step);
    flex-wrap: wrap;
}

.chat-mode-tabs {
    display: flex;
    align-items: center;
    gap: calc(var(--grid-step) * 0.6);
    flex-wrap: wrap;
    min-width: 0;
}

.chat-mode-tabs .tab {
    white-space: nowrap;
}

.chat-main {
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    height: 100%;
}

.chat-main > [hidden] {
    display: none !important;
}

.chat-messages {
    border: 1px solid color-mix(in srgb, var(--border) 72%, rgba(24, 201, 216, 0.28) 28%);
    border-radius: var(--radius-md);
    background:
        radial-gradient(1200px 380px at -18% -28%, rgba(24, 201, 216, 0.06), transparent 62%),
        radial-gradient(1200px 420px at 116% 132%, rgba(116, 123, 255, 0.05), transparent 60%),
        rgba(6, 11, 19, 0.84);
    min-height: 0;
    height: 100%;
    max-height: none;
    overflow: auto;
    padding: calc(var(--grid-step) * 1.25);
    display: grid;
    gap: calc(var(--grid-step) * 0.95);
    align-content: start;
    grid-auto-rows: max-content;
    scrollbar-gutter: stable both-edges;
    overscroll-behavior: contain;
}

.message {
    display: grid;
    gap: calc(var(--grid-step) * 0.58);
    width: 100%;
    max-width: min(100%, 900px);
    border: none;
    background: transparent;
    padding: 0;
}

.message.role-assistant {
    margin-right: auto;
}

.message.role-user {
    margin-left: auto;
    max-width: min(100%, 84%);
}

.message.is-highlighted {
    isolation: auto;
}

.message-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--grid-step);
    color: var(--muted);
    font-size: 0.75rem;
    letter-spacing: 0.01em;
    text-transform: none;
}

.message.is-streaming .message-head > span:last-child {
    color: color-mix(in srgb, var(--accent) 72%, var(--text) 28%);
    font-style: italic;
}

.message.role-user .message-head {
    justify-content: flex-end;
}

.message.role-user .message-head > span:first-child {
    display: none;
}

.message-body {
    position: relative;
    color: var(--text);
    border: 1px solid rgba(98, 114, 132, 0.26);
    border-radius: 14px;
    padding: calc(var(--grid-step) * 1.05) calc(var(--grid-step) * 1.35);
    background: linear-gradient(180deg, rgba(14, 21, 33, 0.86), rgba(9, 15, 24, 0.84));
    backdrop-filter: blur(4px);
}

.message.role-assistant .message-body {
    border-color: transparent;
    background: transparent;
    border-radius: 0;
    padding: calc(var(--grid-step) * 0.25) 0;
}

.message.role-assistant.is-reveal .message-body {
    animation: assistantMessageReveal 520ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.message.role-assistant.is-reveal .message-body::after {
    content: none;
}

.message.role-user .message-body {
    border-color: rgba(24, 201, 216, 0.32);
    background: linear-gradient(180deg, rgba(10, 40, 54, 0.94), rgba(8, 27, 39, 0.94));
}

.message-body.is-typing {
    min-height: 0;
    display: flex;
    align-items: center;
    padding-top: calc(var(--grid-step) * 0.45);
    padding-bottom: calc(var(--grid-step) * 0.45);
}

.message.is-highlighted .message-body {
    box-shadow: none;
}

.message-body p {
    margin: 0;
}

.message-body h2,
.message-body h3,
.message-body h4 {
    margin: 0 0 calc(var(--grid-step) * 0.75);
    line-height: 1.25;
}

.message-body ul {
    margin: 0;
    padding-left: 1.2rem;
}

.assistant-reasoning {
    margin-top: calc(var(--grid-step) * 0.78);
    border: 0;
    background: transparent;
}

.assistant-reasoning summary {
    cursor: pointer;
    list-style: none;
    color: color-mix(in srgb, var(--muted) 84%, var(--text) 16%);
    font-size: 0.76rem;
    font-weight: 600;
    padding: calc(var(--grid-step) * 0.44) calc(var(--grid-step) * 0.95);
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(116, 123, 255, 0.3);
    border-radius: 999px;
    background: rgba(116, 123, 255, 0.08);
}

.assistant-reasoning summary::-webkit-details-marker {
    display: none;
}

.assistant-reasoning summary::before {
    content: "▸";
    display: inline-block;
    margin-right: 5px;
    transition: transform 140ms ease;
}

.assistant-reasoning[open] summary::before {
    transform: rotate(90deg);
}

.assistant-reasoning[open] summary {
    margin-bottom: calc(var(--grid-step) * 0.6);
}

.assistant-reasoning > *:not(summary) {
    margin: 0;
    padding-left: calc(var(--grid-step) * 1.05);
    padding-right: calc(var(--grid-step) * 1.05);
    border-left: 1px solid rgba(116, 123, 255, 0.24);
    margin-left: calc(var(--grid-step) * 0.58);
}

.assistant-reasoning > *:last-child {
    padding-bottom: calc(var(--grid-step) * 1);
}

.assistant-typing {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: color-mix(in srgb, var(--muted) 86%, var(--text) 14%);
    font-size: 0.84rem;
    border: 1px solid rgba(116, 123, 255, 0.28);
    border-radius: 999px;
    padding: 5px 10px 5px 8px;
    background: rgba(19, 27, 42, 0.62);
}

.assistant-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(24, 201, 216, 0.9);
    animation: typingPulse 1100ms ease-in-out infinite;
}

.assistant-typing-dot:nth-child(2) {
    animation-delay: 130ms;
}

.assistant-typing-dot:nth-child(3) {
    animation-delay: 260ms;
}

.message-footer {
    display: flex;
    flex-wrap: wrap;
    gap: calc(var(--grid-step) * 0.75);
    padding: 0 calc(var(--grid-step) * 0.2);
}

.message.role-user .message-footer {
    justify-content: flex-end;
}

.time-pill {
    border: 1px solid rgba(24, 201, 216, 0.36);
    border-radius: 999px;
    background: rgba(24, 201, 216, 0.09);
    color: #9ef6ff;
    padding: 4px 9px;
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
}

.context-chip {
    border: 1px solid rgba(116, 123, 255, 0.34);
    border-radius: 999px;
    color: #d5d7ff;
    font-size: 0.68rem;
    letter-spacing: 0.03em;
    padding: 4px 8px;
    background: rgba(116, 123, 255, 0.1);
}

.composer {
    display: flex;
    align-items: stretch;
    gap: calc(var(--grid-step) * 0.65);
    border: 1px solid color-mix(in srgb, var(--border) 78%, rgba(24, 201, 216, 0.22) 22%);
    border-radius: var(--radius-md);
    background: rgba(7, 13, 22, 0.92);
    padding: calc(var(--grid-step) * 0.75);
}

.context-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(8, 14, 23, 0.85);
    min-height: 0;
    height: 100%;
    overflow: auto;
    scrollbar-gutter: stable both-edges;
}

.tabs {
    display: flex;
    gap: var(--grid-step);
    padding: calc(var(--grid-step) * 1);
    border-bottom: 1px solid var(--border);
}

.tab {
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    padding: 6px 12px;
    cursor: pointer;
}

.tab.is-active {
    color: var(--text);
    border-color: rgba(24, 201, 216, 0.45);
    background: rgba(24, 201, 216, 0.12);
}

.tab-content {
    padding: calc(var(--grid-step) * 1.5);
    color: var(--muted);
    min-height: 100%;
    display: grid;
    gap: calc(var(--grid-step) * 0.9);
    align-content: start;
}

.composer-input {
    flex: 1 1 auto;
    min-height: 48px;
    max-height: 140px;
    resize: none;
    line-height: 1.35;
    background: rgba(8, 14, 23, 0.75);
    border: 1px solid rgba(66, 84, 104, 0.6);
    border-radius: calc(var(--radius-sm) - 2px);
}

.btn-send {
    flex: 0 0 auto;
    align-self: stretch;
    min-height: 0;
    height: auto;
    min-width: 48px;
    width: 48px;
    padding: 0;
    border-radius: calc(var(--radius-sm) - 2px);
    border-color: rgba(24, 201, 216, 0.45);
    background: linear-gradient(140deg, rgba(24, 201, 216, 0.2), rgba(116, 123, 255, 0.2));
    color: #b5faff;
    font-weight: 650;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-send:hover:not(:disabled) {
    border-color: rgba(24, 201, 216, 0.72);
    background: linear-gradient(140deg, rgba(24, 201, 216, 0.28), rgba(116, 123, 255, 0.28));
}

.btn-send-icon {
    display: inline-block;
    font-size: 1.08rem;
    line-height: 1;
    transform: translateX(1px);
}

.skeleton {
    border-radius: 10px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.05));
    background-size: 220% 100%;
    animation: shimmer 1.4s infinite linear;
}

.skeleton-card {
    height: 140px;
}

.skeleton-row {
    height: 70px;
}

.empty-state {
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    padding: calc(var(--grid-step) * 2);
    color: var(--muted);
    text-align: center;
}

.empty-state-chat {
    text-align: left;
    background: rgba(10, 16, 26, 0.78);
    border-style: solid;
    border-color: rgba(116, 123, 255, 0.24);
    display: grid;
    gap: calc(var(--grid-step) * 0.7);
}

.empty-state-chat-title {
    margin: 0;
    color: var(--text);
    font-size: 0.98rem;
    font-weight: 620;
}

.toast-stack {
    position: fixed;
    top: calc(var(--grid-step) * 2);
    right: calc(var(--grid-step) * 2);
    display: grid;
    gap: var(--grid-step);
    z-index: 100;
}

.toast {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(14, 23, 36, 0.95);
    color: var(--text);
    padding: calc(var(--grid-step) * 1.2) calc(var(--grid-step) * 1.5);
    min-width: 260px;
    box-shadow: var(--shadow);
}

.toast.toast-success {
    border-color: rgba(54, 198, 144, 0.45);
}

.toast.toast-error {
    border-color: rgba(239, 83, 80, 0.48);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(4, 9, 17, 0.7);
    display: grid;
    place-items: center;
    z-index: 120;
}

.modal-backdrop.is-hidden {
    display: none;
}

.modal {
    width: min(480px, calc(100vw - 32px));
    padding: calc(var(--grid-step) * 2);
    display: grid;
    gap: calc(var(--grid-step) * 1.5);
}

.modal h3,
.modal p {
    margin: 0;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
}

[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(100% + 8px);
    border-radius: 8px;
    background: rgba(7, 13, 22, 0.96);
    border: 1px solid var(--border);
    color: var(--muted);
    white-space: nowrap;
    font-size: 0.72rem;
    padding: 4px 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 140ms ease;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
    opacity: 1;
}

@keyframes shimmer {
    from {
        background-position: 200% 0;
    }

    to {
        background-position: -20% 0;
    }
}

@media (max-width: 1100px) {
    .watch-layout {
        grid-template-columns: 1fr;
    }

    .chat-messages {
        max-height: none;
    }
}

@media (max-width: 840px) {
    .app-shell {
        padding: calc(var(--grid-step) * 1.5);
    }

    .topbar {
        flex-wrap: wrap;
        top: calc(var(--grid-step) * 1);
    }

    .topbar-left {
        width: 100%;
        justify-content: space-between;
        gap: var(--grid-step);
    }

    .topbar-brand img {
        height: 22px;
    }

    .topbar-actions {
        width: 100%;
        justify-content: flex-end;
    }

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

    .hero-form {
        grid-column: auto;
    }

    .css-logo-lockup {
        flex-direction: column;
        gap: calc(var(--grid-step) * 1.25);
    }

    .css-logo-wordmark {
        font-size: clamp(2rem, 12vw, 2.9rem);
        text-align: center;
    }

    .guest-landing-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .field-row {
        grid-template-columns: 1fr;
    }

    .library-folder-controls,
    .folder-create-form {
        grid-template-columns: 1fr;
    }

    .watch-topbar {
        flex-direction: column;
    }

    .watch-actions {
        min-width: 0;
        width: 100%;
        justify-items: stretch;
    }

    .watch-actions-main {
        justify-content: flex-start;
    }

    .processing-panel-compact {
        width: 100%;
    }

    .library-row {
        grid-template-columns: 1fr;
    }

    .library-row-main {
        grid-template-columns: 1fr;
    }

    .library-thumb {
        max-width: 100%;
    }

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

    .video-action-group,
    .video-action-bar {
        width: 100%;
    }

    .video-controls-cluster > .btn {
        min-width: 0;
        flex: 1 1 150px;
    }

    .video-range-buttons {
        width: 100%;
        margin-right: 0;
    }

    .video-range-buttons .btn {
        min-width: 0;
        flex: 1 1 100px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 1ms !important;
        scroll-behavior: auto !important;
    }
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--grid-step);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--grid-step);
}

.auth-modal {
    width: min(540px, calc(100vw - 32px));
}

.auth-form {
    display: grid;
    gap: var(--grid-step);
}

.auth-form.is-hidden {
    display: none;
}

.split-actions {
    justify-content: space-between;
}

.markdown-content {
    color: var(--text);
    font-size: 0.96rem;
    line-height: 1.7;
    letter-spacing: 0.003em;
    word-break: break-word;
    -webkit-font-smoothing: antialiased;
}

.markdown-content > :first-child {
    margin-top: 0;
}

.markdown-content > :last-child {
    margin-bottom: 0;
}

.markdown-content p {
    margin: 0;
}

.markdown-content p + p {
    margin-top: calc(var(--grid-step) * 0.7);
}

.message.role-assistant .markdown-content {
    max-width: 72ch;
}

.message.role-user .markdown-content {
    max-width: none;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
    margin: calc(var(--grid-step) * 1.08) 0 calc(var(--grid-step) * 0.62);
    font-weight: 650;
    line-height: 1.35;
}

.markdown-content h1 {
    font-size: 1.12rem;
}

.markdown-content h2 {
    font-size: 1.04rem;
}

.markdown-content h3,
.markdown-content h4 {
    font-size: 0.98rem;
}

.markdown-content ul,
.markdown-content ol {
    margin: calc(var(--grid-step) * 0.65) 0;
    padding-left: 1.25rem;
}

.markdown-content li + li {
    margin-top: calc(var(--grid-step) * 0.45);
}

.markdown-content blockquote {
    margin: calc(var(--grid-step) * 0.9) 0;
    padding: calc(var(--grid-step) * 0.75) calc(var(--grid-step) * 1.05);
    border-left: 2px solid rgba(116, 123, 255, 0.45);
    border-radius: 0 10px 10px 0;
    background: rgba(116, 123, 255, 0.08);
    color: color-mix(in srgb, var(--text) 84%, var(--muted) 16%);
}

.markdown-content hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: calc(var(--grid-step) * 1.2) 0;
}

.markdown-content a {
    color: color-mix(in srgb, var(--accent) 70%, #d8fbff 30%);
    text-underline-offset: 2px;
}

.markdown-content pre {
    margin: calc(var(--grid-step) * 0.86) 0;
    padding: calc(var(--grid-step) * 1.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(8, 14, 23, 0.92);
    overflow: auto;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.markdown-content code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 0.9em;
}

.markdown-content :not(pre) > code {
    border: 1px solid rgba(116, 123, 255, 0.26);
    border-radius: 7px;
    background: rgba(116, 123, 255, 0.1);
    padding: 0.12em 0.42em;
}

.markdown-content pre code {
    border: 0;
    background: transparent;
    padding: 0;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: calc(var(--grid-step) * 0.9) 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: block;
    overflow-x: auto;
}

.markdown-content thead {
    background: rgba(116, 123, 255, 0.12);
}

.markdown-content th,
.markdown-content td {
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
    padding: calc(var(--grid-step) * 0.62) calc(var(--grid-step) * 0.9);
    white-space: nowrap;
}

.markdown-content tr:last-child td {
    border-bottom: 0;
}

.streaming-text {
    white-space: pre-wrap;
    margin: 0;
    line-height: 1.62;
    font-size: 0.94rem;
    color: color-mix(in srgb, var(--text) 92%, var(--muted) 8%);
}

.markdown-content .katex,
.katex-fence .katex {
    font-size: 1.1em;
    color: var(--text);
    line-height: 1.42;
    text-rendering: geometricPrecision;
}

.markdown-content .katex-display,
.katex-fence {
    margin: calc(var(--grid-step) * 0.95) 0;
    padding: 0.15rem 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow-x: auto;
    overflow-y: visible;
    position: relative;
    z-index: 1;
}

.markdown-content .katex-display > .katex,
.katex-fence > .katex {
    white-space: nowrap;
    min-width: min-content;
    display: inline-block;
    padding: 0.08em 0.02em;
    vertical-align: middle;
}

.markdown-content .katex-display > .katex {
    margin: 0 auto;
}

.katex-fence-empty {
    min-height: calc(var(--grid-step) * 2);
}

.katex-fence-error {
    margin: calc(var(--grid-step) * 1.1) 0;
    padding: calc(var(--grid-step) * 1.2);
    border: 1px solid rgba(242, 184, 75, 0.3);
    border-radius: var(--radius-sm);
    background: rgba(38, 31, 17, 0.32);
    color: #f2b84b;
    overflow-x: auto;
}

.markdown-content .katex-display,
.katex-fence,
.katex-fence-error {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.markdown-content .katex-display::-webkit-scrollbar,
.katex-fence::-webkit-scrollbar,
.katex-fence-error::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.katex-error {
    color: #f2b84b !important;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 0.92em;
}

@keyframes typingPulse {
    0%, 80%, 100% {
        transform: scale(0.75);
        opacity: 0.35;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes assistantMessageReveal {
    0% {
        opacity: 0;
        clip-path: inset(0 0 100% 0);
        filter: blur(1.5px);
    }

    60% {
        opacity: 0.9;
    }

    100% {
        opacity: 1;
        clip-path: inset(0 0 0 0);
        filter: blur(0);
    }
}

/* 2026 Redesign ---------------------------------------------------------- */
:root {
    --bg: #070910;
    --panel: rgba(14, 17, 27, 0.9);
    --panel-2: rgba(10, 14, 23, 0.92);
    --border: rgba(149, 170, 206, 0.14);
    --text: #eff4ff;
    --muted: #98a6be;
    --accent: #78e6ff;
    --accent2: #8e85ff;
    --danger: #ff6f7f;
    --success: #47d7a2;
    --warning: #ffcc73;
    --shadow: 0 26px 70px rgba(0, 0, 0, 0.34);
    --radius-lg: 26px;
    --radius-md: 20px;
    --radius-sm: 15px;
    --grid-step: 8px;
}

html {
    background:
        radial-gradient(circle at 18% -4%, rgba(120, 230, 255, 0.12), transparent 34%),
        radial-gradient(circle at 96% 10%, rgba(142, 133, 255, 0.12), transparent 30%),
        #070910;
}

body {
    font-family: "Manrope", "Segoe UI", Arial, sans-serif;
    letter-spacing: -0.012em;
    background:
        radial-gradient(circle at 0% 0%, rgba(120, 230, 255, 0.1), transparent 28%),
        radial-gradient(circle at 100% 0%, rgba(142, 133, 255, 0.11), transparent 24%),
        radial-gradient(circle at 50% 120%, rgba(86, 126, 255, 0.08), transparent 34%),
        linear-gradient(180deg, #080a12 0%, #05070c 100%);
    color: var(--text);
    line-height: 1.52;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.app-shell {
    max-width: 1720px;
    padding: clamp(14px, 1.6vw, 26px);
    gap: 10px;
}

.page,
.page-stack {
    gap: 10px;
}

.panel {
    border: 1px solid rgba(160, 181, 220, 0.13);
    background:
        linear-gradient(180deg, rgba(21, 25, 37, 0.86), rgba(12, 15, 24, 0.92)),
        rgba(14, 17, 27, 0.88);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.04) inset,
        0 26px 70px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(20px);
}

.topbar {
    padding: 12px 16px;
    gap: 12px;
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(20, 24, 34, 0.92), rgba(10, 13, 21, 0.94)),
        rgba(10, 12, 18, 0.9);
    border-color: rgba(169, 187, 224, 0.11);
}

.topbar-brand {
    padding: 8px 14px;
    border-radius: 999px;
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.topbar-brand img {
    height: 24px;
}

.nav-group {
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
}

.topbar-actions {
    gap: 8px;
}

h1,
h2,
h3,
h4,
.watch-title,
.panel-header h2,
.panel-header h3,
.session-card h4,
.library-row-title,
.css-logo-wordmark,
.hero-copy h2,
.empty-state-chat-title,
.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
    font-family: "Space Grotesk", "Manrope", sans-serif;
    letter-spacing: -0.04em;
}

.btn {
    min-height: 40px;
    border-radius: 14px;
    padding: 10px 15px;
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, color 160ms ease, opacity 160ms ease;
}

.btn-primary {
    border: 0;
    color: #08101a;
    background: linear-gradient(135deg, #7ee7ff 0%, #73b0ff 48%, #9f88ff 100%);
    box-shadow: 0 12px 28px rgba(78, 121, 255, 0.24);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 16px 34px rgba(78, 121, 255, 0.3);
}

.btn-secondary {
    color: var(--text);
    border-color: rgba(181, 196, 226, 0.12);
    background: rgba(255, 255, 255, 0.045);
}

.btn-secondary:hover:not(:disabled) {
    border-color: rgba(120, 230, 255, 0.28);
    background: rgba(120, 230, 255, 0.08);
}

.btn-ghost {
    color: color-mix(in srgb, var(--text) 74%, var(--muted) 26%);
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
}

.btn-ghost:hover:not(:disabled),
.btn-ghost.is-active,
.nav-btn.is-active {
    color: var(--text);
    border-color: rgba(120, 230, 255, 0.24);
    background: rgba(120, 230, 255, 0.09);
}

.btn-danger {
    background: rgba(255, 111, 127, 0.12);
    border-color: rgba(255, 111, 127, 0.26);
}

.badge,
.pill,
.session-folder-badge,
.session-scientific-badge,
.time-pill,
.context-chip,
.assistant-reasoning summary {
    min-height: 28px;
    padding: 4px 10px;
    font-size: 0.69rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    border-radius: 999px;
}

.badge {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.035);
}

.badge-ready {
    color: #73f1be;
    border-color: rgba(71, 215, 162, 0.32);
    background: rgba(71, 215, 162, 0.11);
}

.badge-processing {
    color: #ffd086;
    border-color: rgba(255, 204, 115, 0.3);
    background: rgba(255, 204, 115, 0.12);
}

.badge-failed {
    color: #ff9fab;
    border-color: rgba(255, 111, 127, 0.28);
    background: rgba(255, 111, 127, 0.11);
}

.pill {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.pill.is-active {
    background: rgba(120, 230, 255, 0.1);
    border-color: rgba(120, 230, 255, 0.3);
}

.guest-landing {
    padding: clamp(18px, 4vw, 38px);
    gap: 14px;
}

.guest-landing-copy {
    max-width: 760px;
    margin: 0;
    font-size: 1.02rem;
    line-height: 1.72;
    color: color-mix(in srgb, var(--text) 70%, var(--muted) 30%);
}

.guest-landing-actions {
    gap: 10px;
}

.guest-public-videos {
    width: 100%;
    padding: 18px;
    border-radius: 28px;
    background:
        radial-gradient(circle at 0% 0%, rgba(120, 230, 255, 0.07), transparent 36%),
        linear-gradient(180deg, rgba(18, 22, 33, 0.86), rgba(11, 14, 22, 0.92));
}

.hero {
    grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.92fr);
    gap: 22px;
    padding: clamp(22px, 2.5vw, 34px);
    border-radius: 30px;
    background:
        radial-gradient(circle at 0% 0%, rgba(120, 230, 255, 0.08), transparent 34%),
        radial-gradient(circle at 100% 0%, rgba(142, 133, 255, 0.08), transparent 32%),
        linear-gradient(180deg, rgba(20, 24, 35, 0.88), rgba(11, 14, 22, 0.94));
}

.hero-copy {
    display: grid;
    align-content: center;
    gap: 8px;
    min-height: 100%;
}

.eyebrow {
    margin: 0;
    font-size: 0.73rem;
    letter-spacing: 0.16em;
    color: color-mix(in srgb, var(--accent) 88%, white 12%);
}

.hero-copy h2 {
    font-size: clamp(2.7rem, 5vw, 5rem);
    line-height: 0.96;
    max-width: 14ch;
}

.hero-subtitle {
    margin: 8px 0 0;
    max-width: 70ch;
    font-size: 1.02rem;
    line-height: 1.78;
    color: color-mix(in srgb, var(--text) 67%, var(--muted) 33%);
}

.hero-form {
    align-self: stretch;
    gap: 10px;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.025);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.field-label {
    font-size: 0.72rem;
    letter-spacing: 0.13em;
    color: color-mix(in srgb, var(--text) 52%, var(--muted) 48%);
}

.field-hint,
.checkbox-row,
.muted-text,
.session-meta,
.library-row-main .muted-text,
.watch-topbar .muted-text,
.processing-panel-compact .muted-text,
.ai-timeline-empty,
.empty-state,
.tab-content,
.context-panel {
    color: color-mix(in srgb, var(--text) 56%, var(--muted) 44%);
}

.input,
.textarea,
.session-folder-select {
    border-color: rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.038);
    padding: 13px 15px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.input:focus,
.textarea:focus,
.session-folder-select:focus {
    border-color: rgba(120, 230, 255, 0.36);
    box-shadow: 0 0 0 3px rgba(120, 230, 255, 0.1);
}

.session-grid {
    gap: 14px;
    padding: 0 18px 18px;
}

.session-grid.guest-session-grid {
    gap: 14px;
}

.session-card {
    position: relative;
    grid-template-rows: auto auto minmax(0, auto) auto auto auto;
    gap: 10px;
    padding: 12px;
    min-height: 100%;
    border-radius: 24px;
    border-color: rgba(255, 255, 255, 0.08);
    background:
        linear-gradient(180deg, rgba(19, 23, 34, 0.9), rgba(10, 13, 21, 0.94));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.03),
        0 18px 40px rgba(0, 0, 0, 0.22);
    transition: transform 170ms ease, border-color 170ms ease, box-shadow 170ms ease;
}

.session-card:hover {
    transform: translateY(-2px);
    border-color: rgba(120, 230, 255, 0.18);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 22px 46px rgba(0, 0, 0, 0.28);
}

.session-thumb,
.library-thumb {
    border-radius: 18px;
    border-color: rgba(255, 255, 255, 0.06);
    background: #060910;
}

.session-card-badges {
    gap: 6px;
    flex-wrap: nowrap;
    overflow: hidden;
}

.session-card-badges > * {
    flex: 0 1 auto;
    min-width: 0;
}

.session-card h4 {
    margin-top: 2px;
    font-size: 1.06rem;
    line-height: 1.12;
    min-height: calc(1.12em * 2);
    max-height: calc(1.12em * 2);
}

.guest-session-card {
    gap: 12px;
    padding: 14px;
}

.guest-session-card .session-thumb {
    border-radius: 20px;
}

.guest-session-card h4 {
    font-size: 1rem;
}

.guest-session-card .session-meta {
    font-size: 0.78rem;
}

.guest-session-card .btn {
    min-height: 44px;
}

.session-card .btn {
    min-height: 42px;
    width: 100%;
}

.session-meta {
    font-size: 0.8rem;
    line-height: 1.55;
}

.library-toolbar,
.library-list {
    padding-left: 18px;
    padding-right: 18px;
    padding-bottom: 18px;
}

.library-row {
    grid-template-columns: minmax(0, 1.75fr) minmax(160px, 0.82fr) auto auto auto;
    gap: 14px;
    padding: 12px;
    border-radius: 22px;
    border-color: rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(17, 21, 31, 0.9), rgba(10, 13, 21, 0.94));
}

.library-row-main {
    gap: 14px;
}

.library-thumb {
    max-width: 176px;
}

.library-row-title {
    font-size: 1rem;
    line-height: 1.18;
}

.watch-topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 1.08fr);
    gap: 16px;
    align-items: start;
    padding: 16px 18px;
    border-radius: 26px;
}

.watch-title {
    margin: 10px 0 4px;
    font-size: clamp(1.65rem, 2.2vw, 2.3rem);
    line-height: 0.98;
}

#watchMeta {
    max-width: 78ch;
    line-height: 1.55;
}

.watch-actions {
    gap: 10px;
    min-width: 0;
}

.watch-actions-main {
    padding: 6px;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.03);
    scrollbar-width: none;
}

.watch-actions-main::-webkit-scrollbar {
    display: none;
}

.watch-actions-main > .btn,
.watch-actions-main > .badge {
    min-height: 34px;
}

.processing-panel-compact {
    width: 100%;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.025);
}

.progress-track {
    background: rgba(255, 255, 255, 0.06);
}

.progress-fill {
    background: linear-gradient(90deg, #7de7ff 0%, #73b0ff 46%, #9f88ff 100%);
}

.watch-layout {
    grid-template-columns: minmax(0, 1.46fr) minmax(400px, 0.94fr);
    gap: 10px;
    align-items: stretch;
}

.video-column,
.chat-column {
    padding: 14px;
    border-radius: 26px;
}

.video-column {
    gap: 10px;
}

.chat-column {
    gap: 12px;
    min-height: min(920px, calc(100vh - 188px));
    height: min(920px, calc(100vh - 188px));
}

.video-wrap {
    border-radius: 22px;
    border-color: rgba(255, 255, 255, 0.07);
    background: #04070e;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.035),
        0 28px 60px rgba(0, 0, 0, 0.26);
}

.video-overlay-controls {
    bottom: 10px;
    left: 10px;
}

.video-overlay-timeline {
    left: calc(var(--overlay-inline-padding) + var(--overlay-play-size) + var(--overlay-gap));
    right: 10px;
    bottom: 16px;
    height: 26px;
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(8, 11, 18, 0.76);
    backdrop-filter: blur(10px);
}

.btn-player {
    color: #eef8ff;
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(16, 20, 30, 0.74);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.32);
}

.btn-player:hover:not(:disabled) {
    border-color: rgba(120, 230, 255, 0.3);
    background: rgba(27, 33, 47, 0.88);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.38);
}

.video-action-bar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border-radius: 20px;
    border-color: rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.028);
}

.video-status-cluster {
    gap: 8px;
}

.video-controls-cluster {
    justify-content: flex-end;
    gap: 8px;
}

.video-range-buttons {
    gap: 6px;
    margin-right: 2px;
    padding: 4px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.028);
}

.video-controls-cluster > .btn,
.video-range-buttons .btn {
    min-height: 38px;
    min-width: auto;
}

.ai-timeline-panel {
    padding: 14px;
    border-radius: 22px;
    border-color: rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.024);
}

.ai-timeline-header h3 {
    font-size: 0.96rem;
}

.ai-timeline-list {
    max-height: 340px;
    gap: 8px;
}

.ai-timeline-item {
    gap: 7px;
    padding: 12px 13px;
    border-radius: 16px;
    border-color: rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.03);
}

.ai-timeline-item:hover {
    border-color: rgba(120, 230, 255, 0.18);
    background: rgba(120, 230, 255, 0.07);
}

.ai-timeline-item.is-active {
    border-color: rgba(120, 230, 255, 0.24);
    background: rgba(120, 230, 255, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.ai-timeline-range {
    color: #a5efff;
}

.ai-timeline-summary {
    font-size: 0.84rem;
    line-height: 1.5;
    color: color-mix(in srgb, var(--text) 82%, var(--muted) 18%);
}

.chat-header {
    align-items: flex-start;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-mode-tabs {
    gap: 6px;
    padding: 5px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 17px;
    background: rgba(255, 255, 255, 0.03);
}

.chat-mode-tabs .tab,
.tabs .tab {
    border-radius: 12px;
    padding: 9px 14px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: -0.015em;
}

.chat-main {
    min-height: 0;
}

.chat-messages,
.context-panel {
    border-radius: 22px;
    border-color: rgba(255, 255, 255, 0.07);
    background:
        radial-gradient(circle at 100% 0%, rgba(142, 133, 255, 0.05), transparent 26%),
        radial-gradient(circle at 0% 100%, rgba(120, 230, 255, 0.05), transparent 24%),
        rgba(9, 12, 19, 0.82);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.chat-messages {
    padding: 18px;
    gap: 14px;
}

.message {
    max-width: min(100%, 800px);
    gap: 7px;
}

.message-head {
    font-size: 0.72rem;
    color: color-mix(in srgb, var(--text) 44%, var(--muted) 56%);
}

.message-body {
    padding: 12px 15px;
    border-radius: 16px;
    border-color: rgba(255, 255, 255, 0.09);
    background: rgba(255, 255, 255, 0.03);
}

.message.role-assistant .message-body {
    padding: 2px 0;
    background: transparent;
    border-color: transparent;
}

.message.role-user {
    max-width: min(100%, 76%);
}

.message.role-user .message-body {
    border-color: rgba(120, 230, 255, 0.18);
    background: linear-gradient(180deg, rgba(15, 44, 59, 0.84), rgba(10, 28, 39, 0.9));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.message-body.is-typing {
    padding-top: 4px;
    padding-bottom: 4px;
}

.assistant-typing {
    border-color: rgba(255, 255, 255, 0.09);
    background: rgba(255, 255, 255, 0.035);
}

.time-pill {
    border-color: rgba(120, 230, 255, 0.22);
    background: rgba(120, 230, 255, 0.08);
}

.context-chip {
    border-color: rgba(142, 133, 255, 0.2);
    background: rgba(142, 133, 255, 0.09);
}

.empty-state,
.empty-state-chat {
    border-radius: 20px;
    padding: 18px;
    border-color: rgba(255, 255, 255, 0.09);
    background: rgba(255, 255, 255, 0.026);
}

.empty-state-chat {
    gap: 10px;
}

.composer {
    min-height: 68px;
    padding: 8px;
    border-radius: 20px;
    border-color: rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.03);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.composer-input {
    min-height: 52px;
    max-height: 160px;
    padding: 12px 14px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    box-shadow: none;
}

.composer-input:focus {
    box-shadow: none;
}

.btn-send {
    width: 52px;
    min-width: 52px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, #7ee7ff 0%, #73b0ff 48%, #9f88ff 100%);
    color: #06101a;
    box-shadow: 0 12px 28px rgba(78, 121, 255, 0.24);
}

.btn-send:hover:not(:disabled) {
    background: linear-gradient(135deg, #90ecff 0%, #84baff 48%, #ad99ff 100%);
}

.tab-content {
    padding: 16px;
    line-height: 1.68;
}

.toast {
    border-radius: 18px;
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(14, 17, 27, 0.94);
}

.modal,
.auth-modal {
    border-radius: 26px;
    background: linear-gradient(180deg, rgba(23, 28, 40, 0.95), rgba(12, 15, 24, 0.96));
}

.markdown-content {
    font-size: 0.99rem;
    line-height: 1.8;
    color: color-mix(in srgb, var(--text) 94%, var(--muted) 6%);
}

.message.role-assistant .markdown-content {
    max-width: 74ch;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
    line-height: 1.08;
    margin: 1.15rem 0 0.68rem;
}

.markdown-content h1 {
    font-size: 1.36rem;
}

.markdown-content h2 {
    font-size: 1.18rem;
}

.markdown-content h3,
.markdown-content h4 {
    font-size: 1.02rem;
}

.markdown-content p + p {
    margin-top: 0.82rem;
}

.markdown-content blockquote {
    border-left-width: 3px;
    border-left-color: rgba(120, 230, 255, 0.32);
    background: rgba(120, 230, 255, 0.06);
    color: color-mix(in srgb, var(--text) 86%, var(--muted) 14%);
}

.markdown-content pre {
    border-color: rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    background: rgba(6, 9, 15, 0.88);
}

.markdown-content :not(pre) > code {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.05);
}

.markdown-content table {
    border-color: rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.02);
}

.markdown-content thead {
    background: rgba(120, 230, 255, 0.08);
}

.markdown-content .katex,
.katex-fence .katex {
    color: var(--text);
}

.markdown-content .katex-display,
.katex-fence,
.katex-fence-error {
    margin: 1.05rem 0;
    padding: 0.12rem 0;
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: none;
    background: transparent;
}

.markdown-content .katex-display::-webkit-scrollbar,
.katex-fence::-webkit-scrollbar,
.katex-fence-error::-webkit-scrollbar {
    display: none;
}

.markdown-content .katex-display > .katex,
.katex-fence > .katex {
    margin-left: auto;
    margin-right: auto;
}

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

    .hero-copy h2 {
        max-width: none;
    }

    .watch-topbar {
        grid-template-columns: 1fr;
    }

    .watch-actions {
        justify-items: stretch;
    }

    .watch-layout {
        grid-template-columns: 1fr;
    }

    .chat-column {
        min-height: 720px;
        height: 720px;
    }
}

@media (max-width: 840px) {
    .app-shell {
        padding: 12px;
        gap: 8px;
    }

    .topbar {
        padding: 10px 12px;
    }

    .nav-group {
        width: auto;
    }

    .hero,
    .guest-public-videos,
    .video-column,
    .chat-column,
    .watch-topbar {
        border-radius: 22px;
    }

    .session-grid,
    .library-toolbar,
    .library-list {
        padding-left: 14px;
        padding-right: 14px;
        padding-bottom: 14px;
    }

    .session-card-badges {
        flex-wrap: wrap;
    }

    .library-row,
    .library-row-main,
    .hero,
    .watch-topbar,
    .video-action-bar {
        grid-template-columns: 1fr;
    }

    .video-controls-cluster {
        justify-content: flex-start;
    }

    .video-range-buttons {
        width: 100%;
    }

    .video-range-buttons .btn,
    .video-controls-cluster > .btn {
        flex: 1 1 120px;
    }

    .chat-column {
        min-height: 620px;
        height: 620px;
    }
}

/* 2026 Redesign, pass 2: Watch + Chat refinement ------------------------- */
.watch-topbar {
    grid-template-columns: minmax(0, 1.1fr) minmax(430px, 0.9fr);
    padding: 18px 20px;
}

.watch-topbar > div:first-child {
    display: grid;
    align-content: start;
    gap: 4px;
    min-width: 0;
}

#backToLibraryBtn {
    justify-self: start;
    min-height: 34px;
    padding: 8px 12px;
    font-size: 0.78rem;
}

.watch-title {
    max-width: 18ch;
    margin: 6px 0 2px;
    font-size: clamp(1.7rem, 2.4vw, 2.5rem);
    line-height: 0.94;
}

#watchMeta {
    font-size: 0.9rem;
    line-height: 1.6;
}

.watch-actions {
    align-content: start;
}

.watch-actions-main {
    justify-content: flex-end;
    padding: 7px;
    border-radius: 20px;
}

.watch-actions-main > .btn,
.watch-actions-main > .badge {
    min-height: 36px;
    padding-top: 8px;
    padding-bottom: 8px;
}

.watch-actions-main > .btn {
    font-size: 0.78rem;
}

.processing-panel-compact {
    padding: 12px 14px;
}

.processing-title {
    font-size: 0.9rem;
}

.watch-layout {
    gap: 12px;
}

.video-column {
    padding: 16px;
    gap: 12px;
}

.video-wrap {
    border-radius: 24px;
}

.video-overlay-controls {
    left: 12px;
    bottom: 12px;
}

.video-overlay-controls .btn-player-toggle {
    width: 44px;
    height: 44px;
}

.video-overlay-timeline {
    left: 66px;
    right: 12px;
    bottom: 18px;
    height: 30px;
}

.timeline-track-base,
.timeline-progress {
    left: 15px;
    right: 15px;
}

.timeline-seek::-webkit-slider-thumb {
    width: 15px;
    height: 15px;
    margin-top: 7px;
}

.timeline-seek::-moz-range-thumb {
    width: 15px;
    height: 15px;
}

.video-action-bar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    padding: 14px;
    border-radius: 22px;
}

.video-status-cluster {
    gap: 10px;
}

.video-status-cluster .badge {
    min-height: 32px;
    padding-inline: 12px;
    font-size: 0.7rem;
}

.video-controls-cluster {
    gap: 10px;
}

.video-range-buttons {
    gap: 6px;
    padding: 5px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.video-range-buttons .btn,
.video-controls-cluster > .btn {
    min-height: 40px;
    font-size: 0.8rem;
}

#askMomentBtn {
    min-width: 146px;
}

#bookmarkBtn {
    min-width: 110px;
}

.ai-timeline-panel {
    padding: 16px;
}

.ai-timeline-header {
    padding-bottom: 4px;
}

.ai-timeline-header h3 {
    font-size: 1rem;
}

.ai-timeline-list {
    max-height: 390px;
    gap: 9px;
}

.ai-timeline-item {
    padding: 13px 14px;
    border-radius: 18px;
}

.ai-timeline-summary {
    font-size: 0.85rem;
    line-height: 1.52;
}

.chat-column {
    min-height: min(940px, calc(100vh - 178px));
    height: min(940px, calc(100vh - 178px));
    padding: 16px;
    gap: 14px;
}

.chat-header {
    align-items: center;
    gap: 12px;
    padding-bottom: 14px;
}

.chat-mode-tabs {
    gap: 5px;
    padding: 6px;
    border-radius: 18px;
}

.chat-mode-tabs .tab {
    min-height: 38px;
    padding: 9px 14px;
}

#useCurrentTimeBtn {
    min-height: 38px;
    padding-inline: 14px;
}

.chat-main {
    min-height: 0;
}

.chat-messages {
    padding: 22px;
    gap: 16px;
    border-radius: 24px;
}

.chat-messages:has(.empty-state-chat) {
    align-content: stretch;
}

.chat-messages:has(.empty-state-chat) .empty-state-chat {
    min-height: 100%;
    display: grid;
    align-content: center;
    gap: 12px;
    padding: 22px;
}

.empty-state-chat-title {
    font-size: 1.08rem;
    line-height: 1.05;
}

.message {
    gap: 8px;
}

.message-head {
    font-size: 0.72rem;
    letter-spacing: 0.01em;
}

.message-body {
    padding: 13px 16px;
}

.message.role-assistant .message-body {
    padding: 4px 0 2px;
}

.message.role-user .message-body {
    padding: 12px 15px;
}

.assistant-typing {
    min-height: 32px;
    padding: 6px 10px 6px 9px;
}

.message-footer {
    gap: 8px;
    padding-inline: 0;
}

.composer {
    min-height: 74px;
    padding: 9px;
    border-radius: 22px;
}

.composer-input {
    min-height: 54px;
    padding: 13px 14px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.btn-send {
    width: 54px;
    min-width: 54px;
    border-radius: 16px;
}

.btn-send-icon {
    font-size: 1.14rem;
}

.context-panel {
    border-radius: 24px;
}

.tab-content {
    padding: 18px;
}

.transcript-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.transcript-cue {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(120, 146, 199, 0.16);
    border-radius: 16px;
    background: rgba(10, 17, 31, 0.68);
    color: inherit;
    text-align: left;
    transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.transcript-cue:hover {
    border-color: rgba(76, 201, 240, 0.34);
    background: rgba(13, 22, 38, 0.9);
    transform: translateY(-1px);
}

.transcript-cue-time {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: rgba(112, 209, 255, 0.92);
}

.transcript-cue-text {
    min-width: 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: rgba(231, 238, 255, 0.92);
}

.markdown-content {
    font-size: 1rem;
    line-height: 1.82;
}

.message.role-assistant .markdown-content {
    max-width: 76ch;
    font-size: 1.01rem;
}

.message.role-user .markdown-content {
    font-size: 0.96rem;
}

.markdown-content strong {
    font-weight: 780;
    color: #f7fbff;
}

.markdown-content em {
    color: color-mix(in srgb, var(--text) 86%, var(--muted) 14%);
}

.markdown-content ul,
.markdown-content ol {
    margin: 0.88rem 0;
    padding-left: 1.3rem;
}

.markdown-content li + li {
    margin-top: 0.34rem;
}

.markdown-content blockquote {
    margin: 1rem 0;
    padding: 0.92rem 1.05rem;
    border-radius: 0 16px 16px 0;
}

.markdown-content pre {
    margin: 1rem 0;
    padding: 1rem 1.06rem;
}

.markdown-content table {
    margin: 1rem 0;
}

.markdown-content > * {
    position: relative;
    z-index: 1;
}

.markdown-content .katex,
.katex-fence .katex {
    line-height: 1.25;
}

.markdown-content .katex-display,
.katex-fence,
.katex-fence-error {
    margin: 1.16rem 0;
    padding: 0.2rem 0 0.34rem;
    overflow-x: auto;
    overflow-y: hidden;
    isolation: isolate;
    position: relative;
    z-index: 2;
}

.markdown-content .katex-display > .katex,
.katex-fence > .katex {
    display: inline-block;
    min-width: min-content;
    max-width: none;
    padding: 0.12rem 0.05rem;
}

.markdown-content .katex-display > .katex {
    margin-left: auto;
    margin-right: auto;
}

.markdown-content .katex-display .base,
.katex-fence .base {
    line-height: 1.3;
}

.math-block-host {
    margin: 1.16rem 0;
    display: grid;
    justify-items: stretch;
}

.math-block-host .katex-display {
    margin: 0;
}

.app-shell.is-guest.guest-watch-active .guest-landing {
    display: none !important;
    visibility: hidden !important;
    max-height: 0 !important;
    overflow: hidden !important;
}

@media (max-width: 1280px) {
    .chat-column {
        min-height: 760px;
        height: 760px;
    }
}

@media (max-width: 840px) {
    .watch-topbar,
    .video-action-bar {
        grid-template-columns: 1fr;
    }

    .watch-title {
        max-width: none;
    }

    .watch-actions-main {
        justify-content: flex-start;
    }

    .video-controls-cluster {
        justify-content: flex-start;
        width: 100%;
    }

    #askMomentBtn,
    #bookmarkBtn {
        min-width: 0;
    }

    .chat-column {
        min-height: 640px;
        height: 640px;
    }
}
