:root {
    color-scheme: light;
    --page: #f3f7f6;
    --surface: #ffffff;
    --ink: #193235;
    --muted: #607579;
    --teal: #147a73;
    --teal-dark: #0e5f5a;
    --line: #d9e4e2;
    --soft: #e8f0ee;
    --alert: #a94235;
    --alert-soft: #fff0ed;
    --warning: #88601d;
    --warning-soft: #fff7e7;
    font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
    color: var(--ink);
    background: var(--page);
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 320px;
    background: var(--page);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.55;
}

button,
input {
    font: inherit;
}

button,
input[type="file"]::file-selector-button {
    cursor: pointer;
}

:focus-visible {
    outline: 3px solid #56aaa2;
    outline-offset: 3px;
}

.topbar {
    min-height: 68px;
    padding: 0 clamp(20px, 4vw, 64px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--ink);
    font-size: 15px;
    font-weight: 680;
    text-decoration: none;
    letter-spacing: -0.02em;
}

.brand-mark {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border: 1.5px solid var(--teal);
    border-radius: 9px;
}

.brand-mark span {
    width: 9px;
    height: 9px;
    border: 2px solid var(--teal);
    border-radius: 50%;
    position: relative;
}

.brand-mark span::after {
    content: "";
    width: 4px;
    height: 4px;
    position: absolute;
    top: 0.5px;
    right: -5px;
    border-radius: 50%;
    background: var(--alert);
}

.demo-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.demo-chip__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--teal);
}

.page-shell {
    width: min(1500px, calc(100% - 2 * clamp(20px, 4vw, 64px)));
    margin: 0 auto;
}

.page-intro {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 36px;
    padding: 42px 0 30px;
}

.section-kicker {
    margin: 0 0 8px;
    color: var(--teal-dark);
    font-size: 13px;
    font-weight: 650;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    max-width: 760px;
    margin-bottom: 8px;
    font-size: clamp(30px, 3.4vw, 46px);
    line-height: 1.12;
    font-weight: 590;
    letter-spacing: -0.045em;
}

.intro-copy {
    max-width: 620px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 16px;
}

.demo-notice {
    max-width: 390px;
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 12px 14px;
    border: 1px solid #d8e5e1;
    border-radius: 10px;
    background: #ebf3f0;
    color: #405d5e;
    font-size: 12px;
    line-height: 1.45;
}

.demo-notice strong {
    display: block;
    margin-bottom: 2px;
    color: var(--ink);
    font-size: 13px;
}

.demo-notice__icon {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    border: 1px solid #9bb9b3;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(350px, 5fr);
    align-items: start;
    gap: 18px;
    padding-bottom: 28px;
}

.workspace-main {
    display: grid;
    gap: 18px;
    min-width: 0;
}

.panel {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.panel-heading {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
}

.panel-heading h2 {
    margin: 0;
    font-size: 16px;
    line-height: 1.3;
    font-weight: 660;
    letter-spacing: -0.015em;
}

.panel-heading p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.local-badge {
    padding: 5px 9px;
    border-radius: 6px;
    background: var(--soft);
    color: #466765;
    font-size: 11px;
    font-weight: 620;
    white-space: nowrap;
}

.source-controls {
    display: grid;
    grid-template-columns: minmax(190px, 0.85fr) minmax(280px, 1.5fr);
    gap: 18px;
    padding: 18px 20px 16px;
}

.field-group {
    min-width: 0;
}

.field-group label {
    display: block;
    margin-bottom: 7px;
    color: var(--ink);
    font-size: 12px;
    font-weight: 650;
}

.field-group input[type="password"] {
    width: 100%;
    height: 40px;
    padding: 0 11px;
    border: 1px solid #bdcecb;
    border-radius: 7px;
    background: #fff;
    color: var(--ink);
    font-size: 13px;
}

.field-group input[type="password"]::placeholder {
    color: #829391;
}

.field-group input[type="file"] {
    width: 100%;
    min-height: 40px;
    color: var(--muted);
    font-size: 12px;
}

.field-group input[type="file"]::file-selector-button {
    height: 38px;
    margin: 0 10px 0 0;
    padding: 0 12px;
    border: 1px solid #b9ceca;
    border-radius: 7px;
    background: #f4f8f7;
    color: var(--teal-dark);
    font-size: 12px;
    font-weight: 650;
}

.field-help {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
}

.video-stage {
    position: relative;
    display: grid;
    place-items: center;
    margin: 0 20px 20px;
    overflow: hidden;
    border-radius: 9px;
    background: #182b2e;
    aspect-ratio: 16 / 9;
}

.video-stage video {
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
    object-fit: contain;
    background: #182b2e;
}

.video-placeholder {
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 24px;
    color: #f3f8f7;
    text-align: center;
}

.video-placeholder[hidden] {
    display: none;
}

.video-placeholder strong {
    font-size: 14px;
    font-weight: 620;
}

.video-placeholder > span:last-child {
    color: #b7c8c6;
    font-size: 12px;
}

.placeholder-mark {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    margin-bottom: 5px;
    border: 1px solid #526d6d;
    border-radius: 50%;
    color: #d9eeea;
}

.placeholder-mark svg {
    width: 19px;
    fill: currentColor;
}

.panel-heading--compact {
    min-height: 62px;
    padding-top: 12px;
    padding-bottom: 12px;
}

.analysis-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.spinner-border {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid #bfdbd6;
    border-top-color: var(--teal);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.status-copy {
    color: var(--muted);
    font-size: 11px;
    text-align: right;
}

.status-copy--danger {
    color: var(--alert);
}

.status-copy--warning {
    color: var(--warning);
}

.status-copy--muted {
    color: var(--muted);
}

.frame-stage {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 130px;
    padding: 12px 20px 18px;
    background: #f7faf9;
}

.frame-stage canvas {
    display: block;
    width: 100%;
    height: auto;
    min-height: 80px;
    aspect-ratio: 16 / 9;
    object-fit: contain;
}

.frame-empty {
    position: absolute;
    color: #788d8b;
    font-size: 11px;
    pointer-events: none;
}

.findings-panel {
    position: sticky;
    top: 18px;
}

.findings-heading {
    min-height: 72px;
}

.findings-count {
    min-width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    padding: 0 7px;
    border-radius: 8px;
    background: var(--soft);
    color: var(--teal-dark);
    font-size: 12px;
    font-weight: 700;
}

.findings-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--line);
}

.button {
    min-height: 37px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 7px 12px;
    border: 1px solid transparent;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 650;
    transition: background-color 120ms ease, border-color 120ms ease;
}

.button-primary {
    background: var(--teal);
    color: #fff;
}

.button-primary:hover {
    background: var(--teal-dark);
}

.button-primary:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

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

.button-quiet {
    border-color: var(--line);
    background: #fff;
    color: var(--muted);
}

.button-quiet:hover {
    border-color: #b4c9c5;
    background: #f5f9f8;
    color: var(--ink);
}

.button svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.findings-list {
    height: min(620px, 64vh);
    min-height: 340px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 14px;
    scrollbar-color: #b8cbc7 transparent;
    scrollbar-width: thin;
}

.empty-state {
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 24px;
    color: var(--muted);
    text-align: center;
}

.empty-state strong {
    color: var(--ink);
    font-size: 13px;
    font-weight: 650;
}

.empty-state > span:last-child {
    max-width: 230px;
    font-size: 11px;
    line-height: 1.45;
}

.empty-state__mark {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    margin-bottom: 5px;
    border-radius: 12px;
    background: var(--soft);
}

.empty-state__mark::before {
    content: "";
    width: 10px;
    height: 10px;
    border: 2px solid #75a39b;
    border-radius: 3px;
}

.finding {
    margin-bottom: 10px;
    padding: 14px 15px;
    border: 1px solid #f0ccc5;
    border-left: 3px solid var(--alert);
    border-radius: 8px;
    background: var(--alert-soft);
}

.finding__time {
    display: inline-block;
    margin-bottom: 7px;
    color: #87392f;
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.finding__detail {
    margin: 0;
    color: #573d3a;
    font-size: 12px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

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

.findings-footnote {
    margin: 0;
    padding: 12px 18px 15px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.page-footer {
    width: min(1500px, calc(100% - 2 * clamp(20px, 4vw, 64px)));
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin: 0 auto;
    padding: 18px 0 26px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 11px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 1050px) {
    .workspace {
        grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr);
    }

    .source-controls {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .findings-panel {
        position: static;
    }
}

@media (max-width: 760px) {
    .topbar {
        min-height: 60px;
    }

    .page-intro {
        align-items: stretch;
        flex-direction: column;
        gap: 18px;
        padding: 30px 0 22px;
    }

    h1 {
        font-size: clamp(29px, 8vw, 38px);
    }

    .intro-copy {
        font-size: 14px;
    }

    .demo-notice {
        max-width: none;
    }

    .workspace {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .workspace-main {
        gap: 14px;
    }

    .source-controls {
        padding: 15px 16px 12px;
    }

    .video-stage {
        min-height: 0;
        margin: 0 16px 16px;
    }

    .panel-heading {
        padding-right: 16px;
        padding-left: 16px;
    }

    .local-badge {
        max-width: 115px;
        white-space: normal;
        text-align: right;
    }

    .findings-list {
        height: 430px;
        min-height: 260px;
    }

    .page-footer {
        flex-direction: column;
        gap: 4px;
    }
}

@media (max-width: 400px) {
    .brand {
        gap: 6px;
        font-size: 12px;
    }

    .demo-chip {
        gap: 5px;
        padding: 4px 7px;
        font-size: 9px;
    }

    .topbar {
        gap: 8px;
    }

    .panel-heading p {
        max-width: 190px;
    }

    .status-copy {
        max-width: 125px;
    }
}

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