/* TalAIot Demo — Dark theme, exam/security aesthetic */

:root {
    --bg: #0a0a0f;
    --bg-card: #12121a;
    --bg-elevated: #1a1a26;
    --border: #2a2a3a;
    --text: #e8e8f0;
    --text-dim: #8888a0;
    --text-muted: #555568;
    --accent: #4a9eff;
    --accent-glow: rgba(74, 158, 255, 0.3);
    --danger: #ff4a6a;
    --danger-glow: rgba(255, 74, 106, 0.3);
    --warning: #ffaa4a;
    --success: #4aff8a;
    --high: #ff4a6a;
    --medium: #ffaa4a;
    --low: #4a9eff;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
    --radius: 12px;
    --radius-sm: 8px;
    --ui-focus-label: "Enfoca";
    --ui-loading-label: "Carregant...";
    --ui-swap-label: "Substitueix";
    --ui-reset-label: "Reinicia";
}

html[data-lang="ca"] {
    --ui-focus-label: "Enfoca";
    --ui-loading-label: "Carregant...";
    --ui-swap-label: "Substitueix";
    --ui-reset-label: "Reinicia";
}

html[data-lang="en"] {
    --ui-focus-label: "Focus";
    --ui-loading-label: "Loading...";
    --ui-swap-label: "Swap In";
    --ui-reset-label: "Reset";
}

html[data-lang="es"] {
    --ui-focus-label: "Enfocar";
    --ui-loading-label: "Cargando...";
    --ui-swap-label: "Sustituir";
    --ui-reset-label: "Restablecer";
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    overflow-x: hidden;
    scroll-behavior: smooth;
}

.language-switcher {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1200;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px 10px 14px;
    border-radius: 999px;
    background:
        radial-gradient(circle at top left, rgba(74, 158, 255, 0.16), transparent 45%),
        rgba(10, 10, 15, 0.74);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(18px) saturate(1.18);
    box-shadow:
        0 18px 42px rgba(0, 0, 0, 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition:
        opacity 0.25s ease,
        transform 0.25s ease,
        visibility 0.25s ease;
}

body.screen-review-active .language-switcher,
body.screen-analysis-active .language-switcher {
    opacity: 0;
    transform: translateY(-10px) scale(0.96);
    pointer-events: none;
    visibility: hidden;
}

.language-switcher-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
}

.language-pills {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.language-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    font: inherit;
    transition:
        background 0.25s ease,
        color 0.25s ease,
        transform 0.25s ease,
        box-shadow 0.25s ease;
}

.language-pill:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-1px);
}

.language-pill.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.32), rgba(74, 158, 255, 0.18));
    box-shadow: 0 10px 24px rgba(74, 158, 255, 0.18);
}

.language-pill-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    padding: 0 6px;
    height: 24px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.language-pill-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

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

/* ===== SCREEN 1: THE CHALLENGE ===== */

#screen-intro {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

#screen-intro::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 50% 50%, rgba(74, 158, 255, 0.05) 0%, transparent 60%);
    animation: pulse-bg 8s ease-in-out infinite;
}

@keyframes pulse-bg {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

.intro-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dim);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 20px;
    opacity: 0;
    animation: fade-up 0.8s ease-out 0.3s forwards;
}

.intro-badge .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.intro-title {
    font-size: clamp(36px, 6vw, 72px);
    font-weight: 800;
    line-height: 1.1;
    text-align: center;
    max-width: 800px;
    margin-bottom: 24px;
    opacity: 0;
    animation: fade-up 0.8s ease-out 0.6s forwards;
}

.intro-title .highlight {
    background: linear-gradient(135deg, var(--accent), #8a6aff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.intro-subtitle {
    font-size: clamp(14px, 2vw, 18px);
    color: var(--text-dim);
    text-align: center;
    max-width: 560px;
    line-height: 1.6;
    margin-bottom: 32px;
    opacity: 0;
    animation: fade-up 0.8s ease-out 0.9s forwards;
}

.intro-stats {
    display: flex;
    gap: 40px;
    margin-bottom: 32px;
    opacity: 0;
    animation: fade-up 0.8s ease-out 1.1s forwards;
}

.intro-stat {
    text-align: center;
}

.intro-stat-value {
    font-size: 32px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent);
}

.intro-stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 36px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 100px;
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    animation: fade-up 0.8s ease-out 1.3s forwards;
    position: relative;
    z-index: 1;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px var(--accent-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

@keyframes fade-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== SCREEN 2: MANUAL REVIEW ===== */

#screen-review {
    display: none;
    min-height: 100dvh;
    padding: 12px 16px 16px;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
}

#screen-review::before,
#screen-review::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.28;
    pointer-events: none;
    z-index: 0;
}

#screen-review::before {
    top: -14vw;
    left: -10vw;
    width: 42vw;
    height: 42vw;
    background: radial-gradient(circle, rgba(74, 158, 255, 0.34) 0%, rgba(74, 158, 255, 0) 70%);
}

#screen-review::after {
    right: -12vw;
    bottom: 4vh;
    width: 38vw;
    height: 38vw;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0) 72%);
}

#screen-review.active {
    display: flex;
}

.review-stage-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 2px;
    position: absolute;
    top: 12px;
    left: 16px;
    right: 16px;
    z-index: 2;
    pointer-events: none;
    transition:
        transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.3s ease,
        filter 0.3s ease;
}

.review-stage-meta-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.review-title {
    font-size: 18px;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.review-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(20, 20, 32, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    backdrop-filter: blur(18px) saturate(1.25);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
}

.timer-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.timer-value {
    font-family: var(--font-mono);
    font-size: 17px;
    font-weight: 600;
    color: var(--warning);
    min-width: 58px;
}

.review-countdown-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
    z-index: 6;
    opacity: 0;
    transition: opacity 0.22s ease;
}

.review-countdown-overlay.visible {
    opacity: 1;
}

.review-countdown-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(6, 8, 14, 0.16), rgba(6, 8, 14, 0) 58%);
}

.review-countdown-number {
    position: relative;
    font-family: var(--font-mono);
    font-size: clamp(96px, 24vw, 220px);
    line-height: 0.9;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: #f0f7ff;
    text-shadow:
        0 0 26px rgba(122, 194, 255, 0.55),
        0 0 72px rgba(74, 158, 255, 0.28);
}

.review-countdown-subtitle {
    margin-top: 14px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(228, 239, 255, 0.92);
    background: rgba(20, 26, 38, 0.54);
    border: 1px solid rgba(122, 194, 255, 0.34);
    backdrop-filter: blur(16px);
    transition: opacity 0.2s ease;
}

.review-countdown-overlay.step-pop .review-countdown-number {
    animation: review-countdown-pop 0.62s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes review-countdown-pop {
    0% {
        opacity: 0;
        transform: translateY(24px) scale(0.72);
        filter: blur(7px);
    }
    35% {
        opacity: 1;
        transform: translateY(0) scale(1.05);
        filter: blur(0);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

.review-stage {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 8px;
    padding: 10px;
    border-radius: 32px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%),
        rgba(10, 10, 15, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(24px) saturate(1.15);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 30px 80px rgba(0, 0, 0, 0.3);
    transition:
        padding 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        border-color 0.45s ease,
        background 0.45s ease,
        box-shadow 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.review-stage::before {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    background:
        radial-gradient(circle at top center, rgba(74, 158, 255, 0.18), rgba(74, 158, 255, 0) 38%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0));
    pointer-events: none;
    opacity: 0.9;
}

.review-stage::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
        radial-gradient(circle at 50% 76%, rgba(74, 158, 255, 0.08), transparent 24%),
        radial-gradient(circle at 50% 56%, rgba(6, 10, 18, 0), rgba(6, 10, 18, 0.42) 64%, rgba(6, 10, 18, 0.74) 100%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.review-stage.has-focus {
    padding-top: 48px;
    padding-bottom: 12px;
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 42px 110px rgba(0, 0, 0, 0.42);
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    align-items: start;
    position: relative;
    z-index: 1;
    transition:
        gap 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        max-width 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        filter 0.3s ease,
        opacity 0.3s ease,
        transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.review-stage.has-focus .video-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 8px;
    max-width: min(1180px, 100%);
    margin: 0 auto;
}

.video-cell {
    position: relative;
    aspect-ratio: 16 / 10;
    max-height: 300px;
    background:
        radial-gradient(circle at top center, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0) 42%),
        linear-gradient(180deg, rgba(20, 22, 32, 0.94), rgba(8, 9, 14, 0.98));
    border-radius: 28px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    isolation: isolate;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 20px 48px rgba(0, 0, 0, 0.25);
    transition:
        transform 0.7s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        border-color 0.45s ease,
        opacity 0.45s ease,
        filter 0.45s ease,
        min-height 0.55s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}

.video-cell::before,
.video-cell::after {
    content: '';
    position: absolute;
    pointer-events: none;
    transition: opacity 0.45s ease, transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.video-cell::before {
    inset: 0;
    background: linear-gradient(180deg, rgba(5, 7, 12, 0.12), rgba(5, 7, 12, 0.65));
    z-index: 1;
    opacity: 0;
}

.video-cell::after {
    right: 18px;
    bottom: 18px;
    width: 88px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(18px);
    color: rgba(255, 255, 255, 0.78);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    content: var(--ui-focus-label);
    opacity: 0;
    transform: translateY(10px);
    z-index: 3;
}

.video-cell.loading::after {
    content: var(--ui-loading-label);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 13px;
    font-family: var(--font-mono);
    letter-spacing: 0.05em;
    z-index: 4;
    opacity: 1;
    transform: none;
    width: auto;
    height: auto;
    inset: 0;
    border: none;
    background: rgba(10, 10, 15, 0.62);
    backdrop-filter: blur(14px);
}

.video-cell video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transform: scale(1.01);
    filter: brightness(1.08) saturate(1.03) contrast(1.02);
    transition:
        transform 0.85s cubic-bezier(0.22, 1, 0.36, 1),
        filter 0.45s ease;
}

.video-freeze {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
    pointer-events: none;
}

.video-label {
    position: absolute;
    top: 14px;
    left: 14px;
    padding: 8px 14px;
    background: rgba(8, 10, 16, 0.64);
    backdrop-filter: blur(18px) saturate(1.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    z-index: 2;
}

.video-cell:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 24px 62px rgba(0, 0, 0, 0.34);
}

.video-cell:focus-visible {
    outline: none;
    border-color: rgba(122, 194, 255, 0.5);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 0 0 3px rgba(74, 158, 255, 0.18),
        0 24px 62px rgba(0, 0, 0, 0.34);
}

.video-cell:hover::after,
.video-cell.is-focused::after {
    opacity: 1;
    transform: translateY(0);
}

.video-cell:hover video {
    transform: scale(1.03);
    filter: brightness(1.1) saturate(1.05) contrast(1.03);
}

.review-stage.has-focus .video-cell {
    aspect-ratio: 16 / 10;
    max-height: 200px;
}

.review-stage.has-focus .video-cell.is-secondary {
    grid-column: span 4;
    aspect-ratio: 16 / 10;
    max-height: 120px;
    opacity: 0.6;
    filter: saturate(0.68) blur(0.8px) brightness(0.86);
    transform: scale(0.97);
}

.review-stage.has-focus .video-cell.is-secondary:nth-child(1) {
    grid-column: 1 / span 3;
}

.review-stage.has-focus .video-cell.is-secondary:nth-child(2) {
    grid-column: 10 / span 3;
}

.review-stage.has-focus .video-cell.is-secondary::after {
    content: var(--ui-swap-label);
}

.review-stage.has-focus .video-cell.is-secondary video {
    filter: blur(0.9px) saturate(0.74) brightness(0.86);
    transform: scale(1.05);
}

.review-stage.has-focus .video-cell.is-focused {
    grid-column: 3 / span 8;
    aspect-ratio: 16 / 10;
    max-height: min(42vh, 480px);
    opacity: 1;
    filter: none;
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 38px 90px rgba(0, 0, 0, 0.42),
        0 0 0 1px rgba(74, 158, 255, 0.16);
}

.review-stage.has-focus .video-cell.is-focused::before {
    opacity: 1;
    background:
        linear-gradient(180deg, rgba(5, 7, 12, 0.01), rgba(5, 7, 12, 0.3)),
        radial-gradient(circle at top center, rgba(74, 158, 255, 0.12), rgba(74, 158, 255, 0) 52%);
}

.review-stage.has-focus .video-cell.is-focused::after {
    content: var(--ui-reset-label);
}

.review-stage.has-focus .video-cell.is-focused video {
    transform: scale(1.015);
    filter: brightness(1.12) saturate(1.06) contrast(1.02);
}

.controls-shell {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    transition:
        max-width 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.controls-shell > * {
    transition:
        transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
        filter 0.3s ease,
        opacity 0.3s ease;
}

.review-stage.has-focus .controls-shell {
    max-width: min(980px, 84vw);
    margin: 0 auto;
}

.review-focus-status {
    align-self: center;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(232, 232, 240, 0.78);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    backdrop-filter: blur(18px);
    transition:
        transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.35s ease,
        background 0.35s ease,
        border-color 0.35s ease;
}

.review-focus-status strong {
    color: rgba(255, 255, 255, 0.96);
}

.controls-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025)),
        rgba(15, 16, 24, 0.76);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    backdrop-filter: blur(22px) saturate(1.16);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 24px 56px rgba(0, 0, 0, 0.26);
    transition:
        border-color 0.45s ease,
        box-shadow 0.45s ease,
        padding 0.45s ease;
}

.review-stage.has-focus .controls-bar {
    padding: 12px 14px;
    border-color: rgba(255, 255, 255, 0.1);
}

/* Flag button */
.btn-flag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 100px;
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition:
        transform 0.25s ease,
        background 0.25s ease,
        border-color 0.25s ease,
        color 0.25s ease,
        box-shadow 0.25s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-flag:hover {
    background: rgba(255, 74, 106, 0.1);
    border-color: var(--danger);
    color: var(--danger);
    box-shadow: 0 12px 28px rgba(255, 74, 106, 0.16);
}

.btn-flag.flash {
    background: rgba(255, 74, 106, 0.2);
    border-color: var(--danger);
    color: var(--danger);
    box-shadow: 0 0 0 1px rgba(255, 74, 106, 0.24);
    transform: scale(1.03);
}

.flag-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 10px;
    background: var(--danger);
    color: #fff;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    font-family: var(--font-mono);
    box-shadow: 0 10px 24px rgba(255, 74, 106, 0.28);
    flex-shrink: 0;
}

.flag-count:empty {
    display: none;
}

/* Flags list below controls */
.flags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    min-height: 0;
    position: relative;
    z-index: 1;
    transition:
        max-width 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        margin 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        filter 0.3s ease,
        opacity 0.3s ease;
}

#screen-review.review-focused .flags-list {
    max-width: min(980px, 84vw);
    margin: 8px auto 0;
}

#screen-review.cta-spotlight .review-stage::after {
    opacity: 1;
}

#screen-review.cta-spotlight .review-stage-meta,
#screen-review.cta-spotlight .video-grid,
#screen-review.cta-spotlight .controls-shell > :not(.review-actions),
#screen-review.cta-spotlight .flags-list {
    filter: blur(7px) saturate(0.72);
    opacity: 0.24;
    transform: scale(0.988);
    pointer-events: none;
}

#screen-review.cta-spotlight .review-actions {
    z-index: 3;
}

.flag-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 74, 106, 0.3);
    border-radius: 100px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--danger);
    cursor: pointer;
    transition: all 0.2s;
    animation: flag-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes flag-pop {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.flag-chip:hover {
    background: rgba(255, 74, 106, 0.1);
}

.flag-chip .flag-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 74, 106, 0.2);
    color: var(--danger);
    font-size: 11px;
    cursor: pointer;
    transition: background 0.2s;
}

.flag-chip .flag-remove:hover {
    background: var(--danger);
    color: #fff;
}

/* Seek bar marks (user flags on timeline) */
.seek-bar-marks {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.seek-mark {
    position: absolute;
    top: -4px;
    width: 3px;
    height: calc(100% + 8px);
    background: var(--danger);
    border-radius: 2px;
    opacity: 0.7;
    transform: translateX(-50%);
}

/* Comparison section */
.comparison-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    opacity: 0;
    animation: fade-up 0.6s ease-out 0.15s forwards;
}

.comparison-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.comparison-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 24px;
    align-items: start;
}

.comparison-col {
    text-align: center;
}

.comparison-col h4 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.comparison-divider {
    width: 1px;
    background: var(--border);
    align-self: stretch;
}

.comparison-flag-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 0;
    font-family: var(--font-mono);
    font-size: 14px;
}

.comparison-flag-item .match-icon {
    width: 20px;
    height: 20px;
}

.match-yes { color: var(--success); }
.match-no { color: var(--danger); }
.match-partial { color: var(--warning); }

.comparison-score {
    font-size: 32px;
    font-weight: 800;
    font-family: var(--font-mono);
    margin-top: 8px;
}

.comparison-score-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: var(--text);
    cursor: pointer;
    font-size: 16px;
    transition:
        transform 0.25s ease,
        background 0.25s ease,
        border-color 0.25s ease,
        box-shadow 0.25s ease;
    font-family: var(--font);
    flex-shrink: 0;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.14);
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.22);
}

.btn-icon:disabled {
    cursor: default;
    transform: none;
    box-shadow: none;
}

.btn-icon.countdown {
    width: 56px;
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 700;
    background: linear-gradient(135deg, rgba(122, 194, 255, 0.2), rgba(74, 158, 255, 0.14));
    border-color: rgba(122, 194, 255, 0.28);
    color: #eaf5ff;
}

.btn-icon.active {
    background: var(--accent);
    border-color: var(--accent);
}

.seek-bar-container {
    flex: 1;
    position: relative;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    cursor: pointer;
    min-width: 100px;
    touch-action: none;
    transition:
        height 0.35s ease,
        background 0.35s ease;
}

.seek-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #7ac2ff 0%, #4a9eff 46%, #7f8cff 100%);
    border-radius: 999px;
    transition: width 0.1s linear;
    position: relative;
    box-shadow: 0 0 16px rgba(74, 158, 255, 0.18);
}

.seek-bar-fill::after {
    content: '';
    position: absolute;
    right: -6px;
    top: -4px;
    width: 16px;
    height: 16px;
    background: #d8ecff;
    border-radius: 50%;
    box-shadow:
        0 0 0 4px rgba(74, 158, 255, 0.18),
        0 0 18px rgba(74, 158, 255, 0.34);
    opacity: 0;
    transition: opacity 0.2s;
}

.seek-bar-container:hover .seek-bar-fill::after {
    opacity: 1;
}

.time-display {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text-dim);
    white-space: nowrap;
}

.speed-btn {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: var(--text-dim);
    font-size: 13px;
    font-family: var(--font-mono);
    cursor: pointer;
    transition:
        transform 0.2s ease,
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        box-shadow 0.2s ease;
}

.speed-btn:hover {
    transform: translateY(-1px);
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.14);
}

.speed-btn.active {
    background: linear-gradient(135deg, rgba(122, 194, 255, 0.92), rgba(74, 158, 255, 0.96));
    border-color: rgba(122, 194, 255, 0.72);
    color: #fff;
    box-shadow: 0 10px 24px rgba(74, 158, 255, 0.22);
}

.btn-reveal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    border: none;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease,
        filter 0.25s ease,
        background 0.25s ease,
        border-color 0.25s ease;
}

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

.review-actions {
    position: relative;
    display: flex;
    justify-content: center;
    width: 100%;
    isolation: isolate;
    margin-top: -4px;
}

.review-action {
    position: relative;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 20px;
    min-height: 64px;
    padding: 12px 18px;
    text-align: left;
    border-radius: 22px;
    font-family: var(--font);
    cursor: pointer;
    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease,
        border-color 0.25s ease,
        background 0.25s ease,
        filter 0.25s ease,
        opacity 0.25s ease;
}

.review-action:hover {
    transform: translateY(-2px);
}

.review-action:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 3px rgba(255, 255, 255, 0.08),
        0 0 0 6px rgba(74, 158, 255, 0.2);
}

.review-action-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.1);
}

.review-action-copy {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
    max-width: 30rem;
}

.review-action-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.72;
}

.review-action-title {
    font-size: 19px;
    font-weight: 700;
    line-height: 1.05;
}

.review-action-subtitle {
    font-size: 13px;
    line-height: 1.5;
    opacity: 0.84;
}

/* === Reveal CTA button === */
.review-action.btn-reveal {
    width: min(1120px, 100%);
    overflow: hidden;
    isolation: isolate;
    flex-direction: column;
    gap: 0;
    padding: 0;
    border: 1px solid rgba(74, 158, 255, 0.18);
    background:
        linear-gradient(135deg, rgba(16, 28, 48, 0.97), rgba(10, 18, 34, 0.99) 60%, rgba(14, 12, 24, 0.97)),
        rgba(8, 14, 26, 1);
    color: #fff;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 16px 40px rgba(5, 16, 34, 0.35),
        0 0 0 1px rgba(74, 158, 255, 0.06);
}

.review-action.btn-reveal::before {
    content: '';
    position: absolute;
    inset: -10%;
    background:
        linear-gradient(118deg, transparent 30%, rgba(74, 158, 255, 0.05) 44%, rgba(74, 158, 255, 0.1) 50%, rgba(74, 158, 255, 0.03) 56%, transparent 70%);
    transform: translateX(-54%) scale(1.12);
    animation: review-cta-sheen 5.5s ease-in-out 2s infinite;
    pointer-events: none;
    opacity: 0.5;
    filter: blur(20px);
    z-index: 0;
}

.review-action.btn-reveal::after {
    content: '';
    display: none;
}

.review-action-large {
    width: min(1120px, 100%);
    min-height: auto;
    padding: 0;
    animation: review-cta-enter 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both;
}

.review-action.btn-reveal .review-action-copy {
    padding: 14px 20px 12px;
    z-index: 2;
}

.review-action-large .review-action-title {
    max-width: 100%;
    font-size: clamp(18px, 2.2vw, 24px);
    letter-spacing: -0.03em;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}

.review-action-large .review-action-subtitle {
    max-width: 60ch;
    font-size: 13px;
    color: rgba(220, 235, 255, 0.7);
}

.review-action-large .review-action-eyebrow {
    color: rgba(74, 158, 255, 0.9);
    opacity: 1;
}

/* Hover / spotlight: lift + glow */
.review-action.btn-reveal:hover,
.review-action.btn-reveal:focus-visible,
.review-action.btn-reveal.is-spotlit {
    transform: translateY(-3px);
    border-color: rgba(74, 158, 255, 0.32);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 24px 56px rgba(5, 16, 34, 0.45),
        0 0 0 1px rgba(74, 158, 255, 0.14),
        0 0 32px rgba(74, 158, 255, 0.1);
}

/* --- AI Analysis Animation inside button --- */
.reveal-ai-animation {
    position: relative;
    width: 100%;
    height: 0;
    overflow: hidden;
    border-top: 1px solid rgba(74, 158, 255, 0);
    transition:
        height 0.6s cubic-bezier(0.22, 1, 0.36, 1),
        border-color 0.4s ease,
        opacity 0.4s ease;
    z-index: 1;
    opacity: 0;
}

.reveal-ai-animation.active {
    height: 80px;
    border-top-color: rgba(74, 158, 255, 0.15);
    opacity: 1;
}

#reveal-ai-canvas {
    display: block;
    width: 100%;
    height: 56px;
}

.ai-scan-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 4px 16px 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: rgba(74, 158, 255, 0.8);
    letter-spacing: 0.02em;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.reveal-ai-animation.active .ai-scan-stats {
    opacity: 1;
}

.ai-stat {
    transition: color 0.3s ease;
}

.ai-stat-sep {
    opacity: 0.4;
}

/* Button disabled state during AI analysis */
.review-action.btn-reveal.is-analyzing {
    pointer-events: none;
    border-color: rgba(74, 158, 255, 0.35);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 16px 40px rgba(5, 16, 34, 0.4),
        0 0 48px rgba(74, 158, 255, 0.12),
        0 0 0 1px rgba(74, 158, 255, 0.12);
}

/* Button READY state after analysis */
.review-action.btn-reveal.is-ready {
    border-color: rgba(74, 255, 138, 0.4);
    background:
        linear-gradient(135deg, rgba(12, 36, 24, 0.97), rgba(8, 24, 18, 0.99) 60%, rgba(10, 14, 20, 0.97)),
        rgba(8, 14, 26, 1);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 24px 56px rgba(5, 34, 16, 0.45),
        0 0 0 1px rgba(74, 255, 138, 0.18),
        0 0 40px rgba(74, 255, 138, 0.15);
    animation: btn-ready-pulse 1.5s ease-in-out infinite;
    cursor: pointer;
    pointer-events: auto;
}

.review-action.btn-reveal.is-ready .review-action-eyebrow {
    color: rgba(74, 255, 138, 0.95);
}

.review-action.btn-reveal.is-ready .review-action-title {
    color: #fff;
}

@keyframes btn-ready-pulse {
    0%, 100% {
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.08),
            0 24px 56px rgba(5, 34, 16, 0.45),
            0 0 0 1px rgba(74, 255, 138, 0.18),
            0 0 40px rgba(74, 255, 138, 0.12);
    }
    50% {
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.1),
            0 24px 56px rgba(5, 34, 16, 0.5),
            0 0 0 1px rgba(74, 255, 138, 0.3),
            0 0 60px rgba(74, 255, 138, 0.2);
    }
}

@keyframes ai-ready-flash {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    50% {
        opacity: 1;
        transform: scale(1.02);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.reveal-ai-animation.done canvas {
    opacity: 0.4;
}

.reveal-ai-animation.done .ai-scan-stats {
    color: rgba(74, 255, 138, 0.9);
    font-weight: 600;
}

@keyframes review-cta-enter {
    0% {
        opacity: 0;
        transform: translate3d(0, 12px, 0) scale(0.97);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@keyframes review-cta-sheen {
    0%, 100% {
        transform: translateX(-54%) scale(1.12);
        opacity: 0;
    }
    20% {
        opacity: 0.8;
    }
    45% {
        transform: translateX(86%) scale(1.12);
        opacity: 0.85;
    }
    58% {
        opacity: 0;
    }
}


.review-stage.has-focus .review-focus-status {
    background: rgba(74, 158, 255, 0.1);
    border-color: rgba(74, 158, 255, 0.22);
    color: rgba(232, 240, 255, 0.9);
}

.review-stage.has-focus .seek-bar-container {
    order: 10;
    flex: 1 0 100%;
    margin-top: 2px;
    height: 10px;
}

/* ===== SCREEN 3: AI ANALYSIS ===== */

#screen-analysis {
    display: none;
    min-height: 100vh;
    padding: 24px;
    flex-direction: column;
}

#screen-analysis.active {
    display: flex;
}

.analysis-hero {
    text-align: center;
    padding: 24px 0 20px;
    opacity: 0;
    animation: fade-up 0.6s ease-out forwards;
}

.analysis-hero h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
}

.analysis-hero .ai-counter {
    font-family: var(--font-mono);
    font-size: 18px;
    color: var(--accent);
}

.analysis-hero .ai-counter .num {
    font-size: 28px;
    font-weight: 700;
}

/* Timeline */
.timeline-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    opacity: 0;
    animation: fade-up 0.6s ease-out 0.3s forwards;
}

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

.timeline-title {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
}

#timeline-canvas {
    width: 100%;
    height: 120px;
    cursor: crosshair;
    border-radius: var(--radius-sm);
}

/* Moment cards */
.moments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.moment-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
}

.moment-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.moment-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.moment-card.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), 0 8px 32px var(--accent-glow);
}

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

.moment-id {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-dim);
}

.severity-badge {
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.severity-badge.high {
    background: rgba(255, 74, 106, 0.15);
    color: var(--high);
}

.severity-badge.medium {
    background: rgba(255, 170, 74, 0.15);
    color: var(--medium);
}

.severity-badge.low {
    background: rgba(74, 158, 255, 0.15);
    color: var(--low);
}

.moment-time {
    font-size: 22px;
    font-weight: 700;
    font-family: var(--font-mono);
    margin-bottom: 4px;
}

.moment-duration {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.moment-prob-bar {
    height: 4px;
    background: var(--bg-elevated);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.moment-prob-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 1s ease-out;
}

.moment-prob-fill.high { background: var(--high); }
.moment-prob-fill.medium { background: var(--medium); }
.moment-prob-fill.low { background: var(--low); }

.moment-prob-text {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-dim);
}

/* Camera breakdown in moment */
.moment-cameras {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.cam-mini {
    flex: 1;
    text-align: center;
}

.cam-mini-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.cam-mini-bar {
    height: 3px;
    background: var(--bg-elevated);
    border-radius: 2px;
    overflow: hidden;
}

.cam-mini-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 1.2s ease-out;
}

/* ===== SCREEN 4: MOMENT DETAIL ===== */

#screen-detail {
    display: none;
    min-height: 100vh;
    padding: 24px;
    flex-direction: column;
}

#screen-detail.active {
    display: flex;
}

/* Inline detail panel (inside analysis screen) */
.inline-detail {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-top: 20px;
    animation: detail-slide-in 0.3s ease-out;
}

@keyframes detail-slide-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.inline-detail-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.inline-detail-bar .detail-header {
    margin-bottom: 0;
}

.inline-detail-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.inline-detail-close:hover {
    background: var(--bg-card);
    color: var(--text);
    border-color: var(--text-muted);
}

/* Selected moment card */
.moment-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), 0 8px 32px var(--accent-glow);
    transform: translateY(-2px);
}

.detail-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-size: 14px;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 20px;
    align-self: flex-start;
}

.detail-back:hover {
    background: var(--bg-card);
    color: var(--text);
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.detail-header h2 {
    font-size: 24px;
    font-weight: 700;
}

.detail-video-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.detail-video-cell {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.detail-video-cell video {
    width: 100%;
    display: block;
}

.detail-video-label {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 12px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.detail-prob-overlay {
    position: absolute;
    bottom: 10px;
    right: 10px;
    padding: 6px 14px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 600;
}

.detail-crops-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.detail-crop-cell {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

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

.crop-cam-label {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-dim);
}

.crop-images {
    display: flex;
    gap: 8px;
}

.crop-images img {
    flex: 1;
    max-width: 48%;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.crop-hand-label {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 4px;
}

/* Confidence bars */
.detail-confidence {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.confidence-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.confidence-row:last-child {
    margin-bottom: 0;
}

.confidence-label {
    font-size: 14px;
    font-weight: 500;
    min-width: 60px;
}

.confidence-bar {
    flex: 1;
    height: 24px;
    background: var(--bg-elevated);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.confidence-fill {
    height: 100%;
    border-radius: 12px;
    transition: width 1.5s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.confidence-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%);
    animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.confidence-value {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    min-width: 50px;
    text-align: right;
}

/* Playback mini-controls in detail */
.detail-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

/* ===== GLOBAL ANIMATIONS ===== */

.screen-transition {
    animation: screen-enter 0.6s ease-out;
}

@keyframes screen-enter {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Scanning animation for timeline reveal */
@keyframes scan-line {
    from { left: 0; }
    to { left: 100%; }
}

.timeline-scan-line {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background: var(--accent);
    box-shadow: 0 0 20px var(--accent), 0 0 60px var(--accent-glow);
    z-index: 10;
}

/* Privacy badge */
.privacy-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(74, 255, 138, 0.1);
    border: 1px solid rgba(74, 255, 138, 0.2);
    border-radius: 100px;
    font-size: 11px;
    font-weight: 500;
    color: var(--success);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Loading overlay */
#loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

#loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader {
    display: flex;
    gap: 8px;
}

.loader-dot {
    width: 10px;
    height: 10px;
    background: var(--accent);
    border-radius: 50%;
    animation: loader-bounce 1.4s ease-in-out infinite;
}

.loader-dot:nth-child(2) { animation-delay: 0.16s; }
.loader-dot:nth-child(3) { animation-delay: 0.32s; }

@keyframes loader-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Responsive */
@media (max-width: 900px) {
    #screen-review {
        height: auto;
        min-height: 100vh;
    }
    .language-switcher {
        top: 12px;
        right: 12px;
        gap: 8px;
        padding: 8px 10px;
        border-radius: 22px;
    }
    .language-switcher-label {
        font-size: 11px;
    }
    .language-pill {
        padding: 7px 10px;
        gap: 6px;
    }
    .language-pill-name {
        font-size: 12px;
    }
    .video-grid,
    .detail-video-grid,
    .detail-crops-row {
        grid-template-columns: 1fr;
    }
    .review-stage {
        padding: 16px;
        border-radius: 26px;
    }
    .review-stage.has-focus .video-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
    .review-stage.has-focus .video-cell.is-secondary {
        grid-column: span 1;
        aspect-ratio: 16 / 10;
        max-height: 100px;
    }
    .review-stage.has-focus .video-cell.is-secondary:nth-child(1),
    .review-stage.has-focus .video-cell.is-secondary:nth-child(2) {
        grid-column: span 1;
    }
    .review-stage.has-focus .video-cell.is-focused {
        grid-column: 1 / -1;
        aspect-ratio: 16 / 10;
        max-height: min(42vh, 400px);
    }
    .review-stage.has-focus .controls-shell,
    #screen-review.review-focused .flags-list {
        max-width: 100%;
    }
    .controls-bar {
        padding: 14px;
    }
    .review-action {
        gap: 18px;
    }
    .review-action-large .review-action-title {
        font-size: 23px;
    }
    .seek-bar-container {
        min-width: 100%;
        order: 10;
    }
    .moments-grid {
        grid-template-columns: 1fr;
    }
    .intro-stats {
        flex-direction: column;
        gap: 20px;
    }
}

@media (max-width: 640px) {
    #screen-review {
        padding: 16px;
    }
    .review-stage-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        left: 12px;
        right: 12px;
        top: 12px;
    }
    .review-stage-meta-main {
        width: 100%;
        justify-content: space-between;
    }
    .review-action-large .review-action-title {
        font-size: 21px;
    }
    .review-action-large .review-action-subtitle {
        font-size: 12px;
    }
    .review-timer {
        width: 100%;
        justify-content: space-between;
    }
    .review-focus-status {
        width: 100%;
        text-align: center;
        line-height: 1.45;
    }
    .review-stage.has-focus .video-cell.is-focused {
        aspect-ratio: 16 / 10;
        max-height: min(36vh, 300px);
    }
    .controls-bar {
        gap: 8px;
    }
    .time-display {
        width: 100%;
    }
    .review-action {
        width: 100%;
        min-height: 0;
        flex-direction: column;
        gap: 0;
    }
    .review-action.btn-reveal .review-action-copy {
        padding: 14px 16px 12px;
    }
}

