:root {
    --bg-1: #06111f;
    --bg-2: #0b1e35;
    --panel: rgba(8, 18, 33, 0.82);
    --panel-border: rgba(94, 168, 255, 0.16);
    --text-main: #ecf4ff;
    --text-muted: #90a9c8;
    --accent: #49a8ff;
    --accent-strong: #268dff;
    --accent-soft: rgba(73, 168, 255, 0.08);
    --success: #4ad295;
    --danger: #ff6b81;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text-main);
    background:
        radial-gradient(circle at top left, rgba(73, 168, 255, 0.18), transparent 28%),
        radial-gradient(circle at right center, rgba(35, 94, 184, 0.22), transparent 24%),
        linear-gradient(160deg, var(--bg-1), var(--bg-2));
    font-family: "Segoe UI", "Helvetica Neue", sans-serif;
}

a {
    color: inherit;
}

.shell {
    width: min(1180px, calc(100% - 32px));
    margin: 28px auto 40px;
    display: grid;
    gap: 24px;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 4px 0 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text-main);
    text-decoration: none;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid var(--panel-border);
    background: linear-gradient(135deg, rgba(21, 100, 206, 0.9), rgba(69, 175, 255, 0.9));
    box-shadow: 0 12px 24px rgba(27, 95, 192, 0.28);
    font-weight: 800;
    letter-spacing: 0.02em;
}

.brand-text {
    font-size: 1.08rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.site-nav a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.site-nav a:hover {
    color: var(--accent);
}

.hero-panel {
    display: grid;
    gap: 12px;
}

.eyebrow {
    display: inline-flex;
    width: fit-content;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--panel-border);
    background: var(--accent-soft);
    color: #8fcdff;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.72rem;
}

.hero-title {
    margin: 0;
    max-width: 780px;
    font-size: clamp(2.2rem, 5vw, 4.6rem);
    line-height: 0.96;
    letter-spacing: -0.04em;
}

.hero-copy {
    margin: 0;
    max-width: 720px;
    color: var(--text-muted);
    line-height: 1.7;
    font-size: 1rem;
}

.top-grid {
    display: grid;
    grid-template-columns: minmax(340px, 1.15fr) minmax(280px, 0.85fr);
    gap: 24px;
    align-items: stretch;
}

.upload-card,
.glass-card {
    padding: 24px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.upload-card,
.status-card {
    height: 100%;
}

.upload-card {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 24px;
}

.upload-card-main {
    display: grid;
    gap: 16px;
}

.upload-card-actions {
    display: grid;
    gap: 8px;
    align-content: start;
}

.upload-button-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: stretch;
}

.upload-button-row.has-secondary {
    grid-template-columns: 1fr auto;
}

.form-label {
    margin: 0;
    color: var(--text-main);
    font-weight: 600;
}

.form-control {
    min-height: 54px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    border: 1px solid rgba(120, 194, 255, 0.18);
}

.form-control:focus {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(73, 168, 255, 0.55);
    box-shadow: 0 0 0 0.2rem rgba(73, 168, 255, 0.14);
}

.form-control[type="file"] {
    display: block;
    width: 100%;
    min-height: 54px;
    padding: 0 14px;
    line-height: 54px;
}

.form-control[type="file"]::file-selector-button {
    margin: -1px 14px -1px -15px;
    padding: 0 14px;
    height: 54px;
    border: 0;
    border-right: 1px solid rgba(120, 194, 255, 0.18);
    background: rgba(73, 168, 255, 0.08);
    color: var(--text-main);
}

.btn-primary {
    min-height: 52px;
    border: none;
    border-radius: 14px;
    font-weight: 700;
    letter-spacing: 0.03em;
    background: linear-gradient(135deg, #1564ce, #45afff);
    box-shadow: 0 14px 28px rgba(28, 111, 211, 0.28);
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, #1f74e7, #69c0ff);
}

.btn-outline-secondary {
    min-height: 52px;
    padding: 0 18px;
    border-radius: 14px;
    border: 1px solid rgba(120, 194, 255, 0.18);
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
    color: var(--text-main);
    border-color: rgba(120, 194, 255, 0.35);
    background: rgba(73, 168, 255, 0.08);
}

.btn-outline-secondary.hidden-action {
    display: none;
}

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.card-header-row h2 {
    margin: 0;
    font-size: 1.05rem;
}

.meta-pill,
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(120, 194, 255, 0.16);
    background: rgba(255, 255, 255, 0.04);
    color: #9ad4ff;
    font-size: 0.82rem;
}

.status-badge.done {
    color: var(--success);
}

.status-badge.failed {
    color: var(--danger);
}

.progress-shell {
    width: 100%;
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    margin-bottom: 12px;
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2277ff, #63c7ff);
    box-shadow: 0 0 24px rgba(73, 168, 255, 0.34);
    transition: width 0.25s ease;
}

.status-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-muted);
    margin-bottom: 18px;
    font-size: 0.95rem;
}

.status-card {
    display: flex;
    flex-direction: column;
}

.status-feedback-slot {
    height: 96px;
    min-height: 96px;
    display: grid;
    overflow: hidden;
}

.result-panel,
.error-panel {
    grid-area: 1 / 1;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    align-self: stretch;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid rgba(120, 194, 255, 0.12);
    background: rgba(255, 255, 255, 0.035);
}

.result-label {
    margin-bottom: 4px;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.result-verdict {
    margin-bottom: 4px;
    font-size: 1.05rem;
    line-height: 1.2;
    font-weight: 700;
}

.result-summary {
    min-height: 0;
    line-height: 1.35;
    font-size: 0.9rem;
    color: var(--text-muted);
    overflow: hidden;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.error-panel {
    color: var(--danger);
    display: flex;
    align-items: center;
}

.hidden {
    display: none;
}

.preview-card,
.frames-card {
    padding: 24px;
}

.preview-stage {
    display: grid;
}

.video-preview {
    display: none;
    width: 100%;
    height: min(52vw, 400px);
    max-height: 400px;
    border-radius: 20px;
    border: 1px solid rgba(120, 194, 255, 0.14);
    background: #020814;
    object-fit: contain;
}

.empty-state {
    display: grid;
    place-items: center;
    min-height: 280px;
    border-radius: 20px;
    border: 1px dashed rgba(120, 194, 255, 0.2);
    color: var(--text-muted);
    text-align: center;
    padding: 24px;
}

.frames-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}

.frame-tile {
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid rgba(120, 194, 255, 0.12);
    background: rgba(255, 255, 255, 0.035);
}

.frame-image {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: #04101b;
}

.frame-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    font-size: 0.82rem;
}

.frame-flag {
    color: var(--danger);
}

.frame-clean {
    color: var(--success);
}

.site-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    padding-top: 4px;
    color: var(--text-muted);
    border-top: 1px solid rgba(120, 194, 255, 0.1);
}

.footer-brand {
    color: var(--text-main);
    font-weight: 700;
    letter-spacing: 0.04em;
}

.footer-copy {
    font-size: 0.92rem;
}

.footer-link {
    color: var(--text-muted);
    text-decoration: none;
}

.footer-link:hover {
    color: var(--accent);
}

@media (max-width: 900px) {
    .top-grid {
        grid-template-columns: 1fr;
    }

    .shell {
        width: min(100% - 20px, 1180px);
        margin: 20px auto 32px;
    }

    .hero-title {
        font-size: clamp(2rem, 9vw, 3.4rem);
    }

    .upload-card,
    .glass-card {
        padding: 18px;
        border-radius: 20px;
    }

    .upload-button-row,
    .upload-button-row.has-secondary {
        grid-template-columns: 1fr;
    }

    .video-preview {
        height: min(70vw, 340px);
    }

    .empty-state {
        min-height: 220px;
    }

    .site-header,
    .site-footer {
        align-items: flex-start;
        flex-direction: column;
    }
}