/* =========================================================
   FFmpeg Lab — tema oscuro
   Todos los id y clases que usa index.js se mantienen.
   Las secciones "OTRAS PÁGINAS" conservan los selectores de
   Bitrate Analyzer, Resolutions, etc.
   ========================================================= */

/* ----------------------------- */
/* TOKENS                        */
/* ----------------------------- */

:root {
    --bg: hsl(0 0% 0%);
    --bg-2: hsl(0 0% 6%);
    --bg-3: hsl(0 0% 10%);
    --border: hsl(0 0% 20%);
    --border-soft: hsl(0 0% 13%);
    --fg: hsl(0 0% 100%);
    --fg-2: hsl(0 0% 60%);
    --fg-3: hsl(0 0% 42%);
    --primary: hsl(161 100% 42%);
    --primary-10: hsl(161 100% 42% / 0.1);
    --primary-20: hsl(161 100% 42% / 0.2);
    --primary-40: hsl(161 100% 42% / 0.4);
    --danger: #ff5c5c;

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-2xl: 16px;

    --frame: 72rem;
    --gutter: 56px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ----------------------------- */
/* BASE                          */
/* ----------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    color-scheme: dark;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Páginas que no usan el marco .lab-frame (herramientas) */
body:not(.lab) {
    padding: 32px 40px;
}

h1,
h2,
h3 {
    font-family: var(--font-mono);
    font-weight: 400;
    letter-spacing: -0.01em;
    color: var(--fg);
}

h2 {
    font-size: 30px;
    line-height: 1.2;
    margin: 0 0 10px;
}

a {
    color: inherit;
}

::selection {
    background: var(--primary-40);
}

/* ----------------------------- */
/* CONTROLES GENERALES           */
/* ----------------------------- */

button {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 16px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--fg);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 18px;
    cursor: pointer;
    transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease), color 0.15s var(--ease), box-shadow 0.2s var(--ease);
}

button:hover:not(:disabled) {
    border-color: var(--primary);
    background: var(--primary-10);
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

button:disabled {
    color: var(--fg-3);
    border-color: var(--border-soft);
    background: var(--bg-2);
    cursor: not-allowed;
}

label {
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 16px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--fg-2);
}

select {
    appearance: none;
    -webkit-appearance: none;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--fg);
    background-color: var(--bg);
    background-image:
        linear-gradient(45deg, transparent 50%, var(--fg-2) 50%),
        linear-gradient(135deg, var(--fg-2) 50%, transparent 50%);
    background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 36px 10px 12px;
    cursor: pointer;
    transition: border-color 0.15s var(--ease);
}

select:hover {
    border-color: hsl(0 0% 32%);
}

select option {
    background: var(--bg-3);
    color: var(--fg);
}

input[type="file"] {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--fg-2);
    max-width: 100%;
}

input[type="file"]::file-selector-button {
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--fg);
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 8px 14px;
    margin-right: 14px;
    cursor: pointer;
    transition: border-color 0.15s var(--ease);
}

input[type="file"]::file-selector-button:hover {
    border-color: var(--primary);
}

/* Sliders (seekBar, volume y cualquier otro) */
input[type="range"] {
    appearance: none;
    -webkit-appearance: none;
    height: 4px;
    background: var(--border);
    border-radius: 999px;
    outline-offset: 6px;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-20);
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: none;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-20);
    cursor: pointer;
}

/* ----------------------------- */
/* MARCO DE PÁGINA               */
/* ----------------------------- */

.lab-frame {
    max-width: var(--frame);
    margin: 0 auto;
    min-height: 100vh;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
}

/* ----------------------------- */
/* TOP BAR                       */
/* ----------------------------- */

.lab-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 32px;
    height: 76px;
    padding: 0 var(--gutter);
    border-bottom: 1px solid var(--border);
    background: hsl(0 0% 0% / 0.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.lab-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-decoration: none;
    white-space: nowrap;
}

.lab-logo-mark {
    display: grid;
    grid-template-columns: repeat(2, 7px);
    gap: 2px;
}

.lab-logo-mark i {
    width: 7px;
    height: 7px;
    background: var(--fg);
}

.lab-logo-mark i:nth-child(2) {
    background: var(--primary);
}

.lab-logo-mark i:nth-child(3) {
    opacity: 0.35;
}

.lab-topbar-cta {
    margin-left: auto;
}

/* ----------------------------- */
/* MENÚ                          */
/* ----------------------------- */

.menu {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 28px;
    margin: 20px 0;
}

.lab-topbar .menu {
    margin: 0;
    flex-wrap: nowrap;
}

.menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 16px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--fg-2);
    text-decoration: none;
    white-space: nowrap;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.15s var(--ease);
}

.menu-btn::before {
    content: "";
    width: 6px;
    height: 6px;
    background: var(--primary);
    opacity: 0.55;
    transition: opacity 0.15s var(--ease);
}

.menu-btn:hover {
    color: var(--fg);
}

.menu-btn:hover::before {
    opacity: 1;
}

/* Desplegables (menú comentado en el HTML original) */
.dropdown {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 60;
    min-width: 200px;
    padding: 6px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.dropdown-content a {
    display: block;
    padding: 9px 10px;
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--fg-2);
    text-decoration: none;
}

.dropdown-content a:hover {
    background: var(--bg-3);
    color: var(--fg);
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* ----------------------------- */
/* BOTONES DE ENLACE             */
/* ----------------------------- */

.lab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 20px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--fg);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease);
}

.lab-btn:hover {
    border-color: hsl(0 0% 36%);
}

.lab-btn-primary {
    border-color: var(--primary);
    background: var(--primary-10);
}

.lab-btn-primary:hover {
    border-color: var(--primary);
    background: var(--primary-20);
}

.lab-topbar-cta {
    padding: 6px 14px;
    font-size: 12px;
    line-height: 16px;
}

/* ----------------------------- */
/* HERO                          */
/* ----------------------------- */

.hero {
    text-align: center;
    padding: 35px 20px;
    margin-bottom: 25px;
}

.hero h1 {
    font-size: 42px;
    line-height: 1.1;
    margin: 0 0 12px;
}

.subtitle {
    font-size: 18px;
    line-height: 28px;
    color: var(--fg-2);
    margin: 0;
}

.lab .hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    text-align: left;
    padding: 0;
    margin: 0;
    border-bottom: 1px solid var(--border);
}

.hero-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 120px var(--gutter);
    background:
        radial-gradient(ellipse 70% 60% at 0% 0%, var(--primary-10), transparent 70%);
}

.lab .hero h1 {
    font-size: 56px;
    line-height: 1.05;
    margin: 22px 0 18px;
}

.lab .subtitle {
    max-width: 30ch;
    color: var(--fg);
    opacity: 0.8;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 36px;
}

.hero-visual {
    position: relative;
    display: flex;
    align-items: flex-end;
    padding: 56px;
    border-left: 1px solid var(--border);
    background-image:
        linear-gradient(var(--border-soft) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
    background-size: 36px 36px;
    background-position: -1px -1px;
    overflow: hidden;
}

.hero-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, transparent 55%, var(--bg));
    pointer-events: none;
}

/* Escalera de resoluciones (decorativa) */
.ladder {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
}

.rung {
    position: absolute;
    left: 0;
    bottom: 0;
    border: 1px solid var(--primary-40);
    border-radius: 2px;
    background: hsl(161 100% 42% / 0.03);
    transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.rung span {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 3px 6px;
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 14px;
    color: var(--primary);
    background: var(--primary-10);
    border: 1px solid var(--primary-20);
    border-radius: 4px;
}

.rung-1080 { width: 100%;  height: 100%; }
.rung-720  { width: 66.7%; height: 66.7%; }
.rung-480  { width: 44.5%; height: 44.4%; }
.rung-360  {
    width: 33.3%;
    height: 33.3%;
    border-color: var(--primary);
    background: var(--primary-20);
    box-shadow: 0 0 40px var(--primary-20);
}

.hero-visual:hover .rung {
    border-color: var(--primary);
}

/* ----------------------------- */
/* SECCIONES                     */
/* ----------------------------- */

.lab-section {
    border-bottom: 1px solid var(--border);
    scroll-margin-top: 76px;
}

.lab-intro {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 1px solid var(--border);
}

.lab-intro > * {
    padding: 72px var(--gutter);
}

.lab-intro > div {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.lab-intro h2 {
    margin: 22px 0 0;
    font-size: 30px;
}

.lab-lead {
    margin: 0;
    display: flex;
    align-items: center;
    font-size: 18px;
    line-height: 28px;
    color: hsl(0 0% 100% / 0.8);
    border-left: 1px solid var(--border);
}

.lab-accent {
    color: var(--primary);
}

.lab-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 16px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.lab-eyebrow::before {
    content: "";
    width: 7px;
    height: 7px;
    background: var(--primary);
}

/* Fondos del escenario */
.lab-stage {
    display: grid;
    gap: 24px;
    padding: 56px var(--gutter);
}

.lab-grid-bg {
    background-image:
        linear-gradient(var(--border-soft) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
    background-size: 36px 36px;
    background-position: -1px -1px;
}

.lab-dots-bg {
    background-image: radial-gradient(hsl(0 0% 24%) 1px, transparent 1px);
    background-size: 18px 18px;
}

/* ----------------------------- */
/* PANELES                       */
/* ----------------------------- */

.lab-panel {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    overflow: hidden;
}

.lab-panel-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-2);
}

.lab-dots {
    display: inline-flex;
    gap: 6px;
}

.lab-dots i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: hsl(0 0% 30%);
}

.lab-panel-title {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--fg-2);
}

/* ----------------------------- */
/* SUBIDA DE VÍDEO               */
/* ----------------------------- */

.video-upload {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 18px;
}

.lab .video-upload {
    padding: 22px 18px;
}

.video-upload input[type="file"] {
    flex: 1 1 280px;
    padding: 10px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-2);
    transition: border-color 0.15s var(--ease);
}

.video-upload input[type="file"]:hover {
    border-color: var(--primary-40);
}

#currentVideo {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--primary);
}

#currentVideo:empty {
    display: none;
}

/* ----------------------------- */
/* AJUSTES DE CODIFICACIÓN       */
/* ----------------------------- */

.lab-fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}

/* Las líneas las dibuja cada celda: sin huecos grises en la última fila */
.lab-field {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px;
    background: var(--bg);
    box-shadow: 1px 0 0 var(--border), 0 1px 0 var(--border);
}

.lab-field select {
    width: 100%;
}

.lab-run {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 18px;
}

#convertButton:not(:disabled) {
    color: var(--bg);
    background: var(--primary);
    border-color: var(--primary);
    font-weight: 500;
    box-shadow: 0 0 24px var(--primary-40);
}

#convertButton:not(:disabled):hover {
    background: hsl(161 100% 48%);
    box-shadow: 0 0 34px var(--primary-40);
}

/* ----------------------------- */
/* PROGRESO                      */
/* ----------------------------- */

#progress {
    width: 100%;
    height: 6px;
    margin-top: 10px;
    background: var(--bg-3);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    overflow: hidden;
}

.lab-run #progress {
    flex: 1;
    margin-top: 0;
}

#bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, hsl(161 100% 30%), var(--primary));
    box-shadow: 0 0 12px var(--primary);
    border-radius: 999px;
    transition: width 0.2s;
}

/* ----------------------------- */
/* COMPARADOR DE VÍDEO           */
/* ----------------------------- */

#slider {
    width: 640px;
    max-width: 100%;
    margin-top: 10px;
}

.video-container {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    position: relative;
    margin-top: 20px;
    margin-bottom: 10px;
}

.lab .video-container {
    margin: 0;
    padding: 18px;
}

.video-box {
    position: relative;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: #000;
}

.video-label {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 14px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: hsl(0 0% 0% / 0.65);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.video-label::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--fg-2);
}

.video-box + .video-box .video-label {
    color: var(--primary);
    border-color: var(--primary-40);
}

.video-box + .video-box .video-label::before {
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary);
}

.video-box video {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    background: #000;
}

.video-box:fullscreen {
    display: flex;
    justify-content: center;
    align-items: center;
    background: black;
    border: none;
    border-radius: 0;
}

.video-box:fullscreen video {
    width: 100vw;
    height: 100vh;
    aspect-ratio: auto;
    object-fit: contain;
}

/* ----------------------------- */
/* REPRODUCTOR                   */
/* ----------------------------- */

.player {
    width: 100%;
    margin-top: 10px;
}

.lab .player {
    margin: 0;
    padding: 18px;
    border-top: 1px solid var(--border);
    background: var(--bg-2);
}

#seekBar {
    display: block;
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 999px;
}

.controls {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.controls button {
    padding: 8px 14px;
    font-size: 12px;
}

.volume {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    color: var(--fg-2);
}

.volume-icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
}

#volume {
    width: 110px;
}

/* ----------------------------- */
/* DESCARGA                      */
/* ----------------------------- */

.lab-download {
    display: flex;
    justify-content: center;
    padding: 72px var(--gutter);
    border-top: 1px solid var(--border);
    background-image:
        linear-gradient(var(--border-soft) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
    background-size: 18px 18px;
}

#downloadBtn {
    margin-top: 25px;
    padding: 12px 22px;
    font-size: 14px;
}

.lab #downloadBtn {
    margin: 0;
    padding: 20px 36px;
    font-family: var(--font-sans);
    font-size: 24px;
    line-height: 32px;
    text-transform: none;
    letter-spacing: -0.01em;
    background: var(--bg);
    border: 2px solid var(--primary);
    border-radius: 999px;
    box-shadow: 0 0 28px var(--primary-40), inset 0 0 18px var(--primary-20);
}

.lab #downloadBtn:hover {
    background: var(--primary-10);
    box-shadow: 0 0 44px var(--primary-40), inset 0 0 22px var(--primary-20);
}

.lab #downloadBtn::after {
    content: " \2192";
    color: var(--primary);
}

/* ----------------------------- */
/* BOTÓN FULLSCREEN              */
/* ----------------------------- */

.fullscreen-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 2;
    padding: 4px 9px;
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 20px;
    text-transform: none;
    color: white;
    background: hsl(0 0% 0% / 0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
}

.fullscreen-btn:hover {
    background: hsl(0 0% 0% / 0.85);
}

/* ----------------------------- */
/* FOOTER                        */
/* ----------------------------- */

.lab-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 24px;
    padding: 22px var(--gutter);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--fg-2);
}

.lab-credit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.lab-credit::before {
    content: "";
    width: 6px;
    height: 6px;
    background: var(--primary);
}

.lab-credit strong {
    font-weight: 500;
    color: var(--fg);
}

@media (max-width: 640px) {
    .lab-footer {
        flex-direction: column;
        text-align: center;
    }
}

/* =============================================
   ANIMACIONES (solo CSS, decorativas)
   ============================================= */

/* ---------- utilidades comunes ---------- */

/* Rota 4 elementos apilados: se muestra uno cada 2s (ciclo de 8s) */
.lab-cycle {
    display: inline-grid;
}

.lab-cycle > * {
    grid-area: 1 / 1;
    font-weight: inherit;
    opacity: 0;
    animation: lab-cycle4 8s infinite;
}

.lab-cycle > :nth-child(2) { animation-delay: -6s; }
.lab-cycle > :nth-child(3) { animation-delay: -4s; }
.lab-cycle > :nth-child(4) { animation-delay: -2s; }

@keyframes lab-cycle4 {
    0%, 23%   { opacity: 1; }
    25%, 98%  { opacity: 0; }
    100%      { opacity: 1; }
}

.lab-status {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary);
}

.lab-status::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary);
    animation: lab-blink 1.6s ease-in-out infinite;
}

.lab-status-idle {
    color: var(--fg-2);
}

.lab-status-idle::before {
    background: var(--fg-2);
    box-shadow: none;
    animation-duration: 3s;
}

@keyframes lab-blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.25; }
}

/* ---------- HERO: monitor de reescalado ---------- */

.hero-visual {
    align-items: center;
    justify-content: center;
    padding: 56px 48px;
}

.hero-visual::after {
    display: none;
}

.lab-monitor {
    position: relative;
    z-index: 1;
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    box-shadow: 0 30px 80px -30px var(--primary-20);
}

.lab-screen {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #000;
    border-bottom: 1px solid var(--border);
}

.lab-scene-svg {
    display: block;
    width: 100%;
    height: 100%;
}

.lab-shot {
    opacity: 0;
    animation: lab-cycle4 8s infinite;
}

.lab-shot:nth-of-type(2) { animation-delay: -6s; }
.lab-shot:nth-of-type(3) { animation-delay: -4s; }
.lab-shot:nth-of-type(4) { animation-delay: -2s; }

.lab-scan {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 30%;
    background: linear-gradient(to bottom, transparent, hsl(161 100% 42% / 0.14) 85%, hsl(161 100% 60% / 0.5));
    border-bottom: 1px solid hsl(161 100% 60% / 0.7);
    animation: lab-scan 2s linear infinite;
    pointer-events: none;
}

@keyframes lab-scan {
    from { transform: translateY(-100%); }
    to   { transform: translateY(340%); }
}

.lab-hud {
    position: absolute;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 14px;
    color: var(--fg);
    background: hsl(0 0% 0% / 0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.lab-hud-tl { top: 12px; left: 12px; color: var(--primary); border-color: var(--primary-40); }
.lab-hud-tr { top: 12px; right: 12px; }
.lab-hud-bl { bottom: 12px; left: 12px; }

.lab-rec {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--danger);
    animation: lab-blink 1s steps(2, jump-none) infinite;
}

/* Barra de tiempo del monitor */
.lab-timecode {
    position: relative;
    width: 90px;
    height: 3px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
}

.lab-timecode i {
    position: absolute;
    inset: 0;
    background: var(--primary);
    transform-origin: left;
    animation: lab-fill 8s linear infinite;
}

@keyframes lab-fill {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

/* Pipeline: entrada -> FFmpeg -> salida */
.lab-pipe {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--bg-2);
}

.lab-chip {
    flex: none;
    padding: 5px 9px;
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 14px;
    color: var(--fg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg);
}

.lab-chip-out {
    min-width: 56px;
    text-align: center;
    color: var(--primary);
    background: var(--primary-10);
    border-color: var(--primary-40);
}

.lab-flow {
    flex: 1;
    height: 2px;
    background-image: linear-gradient(90deg, var(--primary) 0 6px, transparent 6px 14px);
    background-size: 14px 2px;
    opacity: 0.7;
    animation: lab-flow 0.7s linear infinite;
}

@keyframes lab-flow {
    from { background-position: 0 0; }
    to   { background-position: 14px 0; }
}

.lab-node {
    position: relative;
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border: 1px solid var(--primary);
    border-radius: 999px;
    box-shadow: 0 0 18px var(--primary-20);
}

.lab-node i {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--primary-20);
    border-top-color: var(--primary);
    animation: lab-spin 0.9s linear infinite;
}

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

/* ---------- CÓMO FUNCIONA ---------- */

.lab-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

.lab-step {
    padding: 48px var(--gutter) 52px;
}

.lab-step + .lab-step {
    border-left: 1px solid var(--border);
}

.lab-step h3 {
    margin: 24px 0 8px;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 24px;
    color: var(--primary);
}

.lab-step p {
    margin: 0;
    font-size: 14px;
    line-height: 20px;
    color: hsl(0 0% 100% / 0.6);
}

.lab-step-icon {
    position: relative;
    width: 72px;
    height: 72px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--bg-2);
    overflow: hidden;
}

/* 01 · subir: archivo que baja a la bandeja */
.u-file {
    position: absolute;
    left: 50%;
    top: 12px;
    width: 22px;
    height: 28px;
    margin-left: -11px;
    border: 1.5px solid var(--primary);
    border-radius: 3px;
    background: linear-gradient(135deg, transparent 70%, var(--primary) 70%);
    animation: lab-upload 2.2s cubic-bezier(0.6, 0, 0.3, 1) infinite;
}

.u-file::after {
    content: "";
    position: absolute;
    left: 4px;
    right: 4px;
    top: 8px;
    height: 8px;
    border-top: 1.5px solid var(--primary-40);
    border-bottom: 1.5px solid var(--primary-40);
}

.u-tray {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 12px;
    height: 10px;
    border: 1.5px solid var(--fg-2);
    border-top: none;
    border-radius: 0 0 4px 4px;
}

@keyframes lab-upload {
    0%   { transform: translateY(-40px); opacity: 0; }
    25%  { opacity: 1; }
    60%  { transform: translateY(12px); opacity: 1; }
    75%, 100% { transform: translateY(18px); opacity: 0; }
}

/* 02 · convertir: anillo de progreso */
.e-ring {
    position: absolute;
    inset: 14px;
    border-radius: 50%;
    background: conic-gradient(var(--primary) 0 72%, var(--border) 72% 100%);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
    animation: lab-spin 1.6s linear infinite;
}

.e-core {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
}

/* 03 · comparar: nítido vs pixelado con divisor */
.c-sharp {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 68% 44%, #eafff7 0 9px, #00d692 10px 13px, transparent 14px),
        linear-gradient(to bottom, #02140f, #0f6b51);
}

.c-pixel {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 50%;
    border-right: 2px solid var(--fg);
    background:
        repeating-linear-gradient(90deg, hsl(0 0% 0% / 0.35) 0 1px, transparent 1px 9px),
        repeating-linear-gradient(0deg, hsl(0 0% 0% / 0.35) 0 1px, transparent 1px 9px),
        linear-gradient(to bottom, #04201a 0 33%, #0a4636 33% 66%, #117a5d 66%);
    animation: lab-split 3.4s ease-in-out infinite alternate;
}

@keyframes lab-split {
    from { width: 22%; }
    to   { width: 78%; }
}

/* ---------- CONVERSOR: brillo en la barra ---------- */

#bar {
    position: relative;
    overflow: hidden;
}

#bar::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, hsl(0 0% 100% / 0.55), transparent);
    transform: translateX(-100%);
    animation: lab-shine 1.4s ease-in-out infinite;
}

@keyframes lab-shine {
    to { transform: translateX(100%); }
}

/* ---------- COMPARADOR: "sin señal" hasta que haya vídeo ---------- */

.lab .video-box video {
    position: relative;
    z-index: 1;
    background: transparent;
}

.lab .video-box::before,
.lab .video-box::after {
    position: absolute;
    z-index: 0;
    pointer-events: none;
}

/* Carta de ajuste (queda detrás del vídeo) */
.lab .video-box::before {
    content: "";
    inset: 0;
    opacity: 0.32;
    background:
        linear-gradient(to bottom, transparent 0 72%, #000 72% 74%, transparent 74%),
        linear-gradient(90deg, #d9d9d9 0 14.28%, #d8d23a 14.28% 28.56%, #2fc9c9 28.56% 42.84%, #22b04b 42.84% 57.12%, #c43fc4 57.12% 71.4%, #c9372c 71.4% 85.68%, #2d3fc4 85.68%);
    animation: lab-flicker 3s steps(1) infinite;
}

.lab .video-box::after {
    content: "Sin señal \00B7  sube un vídeo";
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 6px 12px;
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    white-space: nowrap;
    color: var(--fg);
    background: hsl(0 0% 0% / 0.8);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    animation: lab-blink 2.4s ease-in-out infinite;
}

/* En cuanto index.js asigna el vídeo, desaparece */
.lab .video-box:has(video[src])::before,
.lab .video-box:has(video[src])::after,
.lab .video-box:fullscreen::before,
.lab .video-box:fullscreen::after {
    display: none;
}

.lab .video-box:has(video[src]) video {
    background: #000;
}

@keyframes lab-flicker {
    0%, 100% { opacity: 0.32; }
    48%      { opacity: 0.26; }
    50%      { opacity: 0.36; }
    52%      { opacity: 0.3; }
}

/* ---------- DESCARGA: latido ---------- */

.lab #downloadBtn {
    animation: lab-glow 2.6s ease-in-out infinite;
}

@keyframes lab-glow {
    0%, 100% { box-shadow: 0 0 22px var(--primary-20), inset 0 0 14px var(--primary-20); }
    50%      { box-shadow: 0 0 48px var(--primary-40), inset 0 0 22px var(--primary-40); }
}

/* ---------- HERRAMIENTAS ---------- */

.lab-tools {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
}

.lab-tool {
    display: flex;
    flex-direction: column;
    padding: 40px var(--gutter) 44px;
    text-decoration: none;
    transition: background-color 0.2s var(--ease);
}

.lab-tool:nth-child(even) {
    border-left: 1px solid var(--border);
}

.lab-tool:nth-child(n + 3) {
    border-top: 1px solid var(--border);
}

.lab-tool:hover {
    background: var(--bg-2);
}

.lab-tool h3 {
    margin: 24px 0 6px;
    font-size: 18px;
}

.lab-tool p {
    margin: 0;
    font-size: 14px;
    line-height: 20px;
    color: hsl(0 0% 100% / 0.6);
}

.lab-tool-go {
    margin-top: 18px;
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--primary);
    transition: transform 0.2s var(--ease);
}

.lab-tool:hover .lab-tool-go {
    transform: translateX(4px);
}

.lab-tool-visual {
    position: relative;
    height: 170px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background-color: var(--bg);
    background-image:
        linear-gradient(var(--border-soft) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
    background-size: 24px 24px;
    background-position: -1px -1px;
    overflow: hidden;
    transition: border-color 0.2s var(--ease);
}

.lab-tool:hover .lab-tool-visual {
    border-color: var(--primary-40);
}

/* Bitrate: barras + cursor */
.lab-bars {
    position: absolute;
    inset: 18px 18px 18px;
    display: flex;
    align-items: flex-end;
    gap: 4px;
}

.lab-bars i {
    flex: 1;
    height: 100%;
    border-radius: 2px 2px 0 0;
    background: linear-gradient(to top, hsl(161 100% 42% / 0.25), var(--primary));
    transform-origin: bottom;
    animation: lab-bar 1.9s ease-in-out infinite alternate;
}

.lab-bars i:nth-child(2n)    { animation-duration: 1.4s; }
.lab-bars i:nth-child(3n)    { animation-duration: 2.3s; }
.lab-bars i:nth-child(5n)    { animation-duration: 1.1s; }
.lab-bars i:nth-child(odd)   { animation-delay: -0.6s; }
.lab-bars i:nth-child(4n)    { animation-delay: -1.3s; }
.lab-bars i:nth-child(3n+1)  { animation-delay: -0.9s; }
.lab-bars i:nth-child(7n)    { animation-delay: -1.7s; }

@keyframes lab-bar {
    from { transform: scaleY(0.18); }
    to   { transform: scaleY(0.95); }
}

.lab-cursor {
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 0;
    width: 2px;
    background: var(--danger);
    box-shadow: 0 0 10px var(--danger);
    animation: lab-sweep 4s linear infinite;
}

@keyframes lab-sweep {
    from { left: 4%; }
    to   { left: 96%; }
}

/* Motion vectors: objeto en movimiento + campo de flechas en onda */
.mv-obj {
    position: absolute;
    top: 50%;
    width: 64px;
    height: 64px;
    margin-top: -32px;
    border-radius: 10px;
    background: radial-gradient(circle, var(--primary-40), transparent 70%);
    animation: lab-drift 4s ease-in-out infinite alternate;
}

@keyframes lab-drift {
    from { left: 4%; }
    to   { left: calc(96% - 64px); }
}

.mv-grid {
    position: absolute;
    inset: 16px 20px;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(4, 1fr);
    place-items: center;
}

.mv-grid i {
    position: relative;
    width: 20px;
    height: 1.5px;
    background: var(--fg-2);
    transform-origin: left center;
    animation: lab-vector 2s ease-in-out infinite;
}

.mv-grid i::after {
    content: "";
    position: absolute;
    right: -1px;
    top: -3px;
    width: 6px;
    height: 6px;
    border-top: 1.5px solid currentColor;
    border-right: 1.5px solid currentColor;
    color: var(--fg-2);
    transform: rotate(45deg);
}

.mv-grid i:nth-child(8n+2) { animation-delay: -0.25s; }
.mv-grid i:nth-child(8n+3) { animation-delay: -0.5s; }
.mv-grid i:nth-child(8n+4) { animation-delay: -0.75s; }
.mv-grid i:nth-child(8n+5) { animation-delay: -1s; }
.mv-grid i:nth-child(8n+6) { animation-delay: -1.25s; }
.mv-grid i:nth-child(8n+7) { animation-delay: -1.5s; }
.mv-grid i:nth-child(8n)   { animation-delay: -1.75s; }
.mv-grid i:nth-child(n+9):nth-child(-n+16)  { animation-direction: reverse; }
.mv-grid i:nth-child(n+25)                  { animation-direction: reverse; }

@keyframes lab-vector {
    0%, 100% { transform: rotate(-24deg) scaleX(0.55); background: var(--fg-3); }
    50%      { transform: rotate(18deg) scaleX(1.1); background: var(--primary); }
}

/* Frame types: tira GOP desplazándose bajo un cabezal */
.gop-track {
    position: absolute;
    left: 0;
    bottom: 26px;
    display: flex;
    width: max-content;
    animation: lab-marquee 9s linear infinite;
}

.gop-set {
    display: flex;
    align-items: flex-end;
    gap: 5px;
    padding-right: 5px;
}

.gop-set i {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    width: 24px;
    padding-top: 5px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-style: normal;
    border-radius: 3px;
}

.gop-set .fi { height: 110px; color: #000; background: var(--primary); }
.gop-set .fp { height: 72px;  color: var(--fg); background: hsl(0 0% 100% / 0.22); border: 1px solid hsl(0 0% 100% / 0.35); }
.gop-set .fb { height: 44px;  color: var(--fg-2); background: var(--bg-3); border: 1px solid var(--border); }

.gop-head {
    position: absolute;
    left: 50%;
    top: 12px;
    bottom: 12px;
    width: 2px;
    background: var(--fg);
    box-shadow: 0 0 10px hsl(0 0% 100% / 0.6);
}

/* Resolutions: escalera iluminándose por turnos */
.lab-anim-ladder {
    display: flex;
    align-items: flex-end;
    padding: 18px;
}

.lab-anim-ladder .ladder {
    height: 100%;
    width: auto;
    aspect-ratio: 16 / 9;
}

.lab-anim-ladder .rung,
.lab-anim-ladder .rung-360 {
    border-color: var(--primary-20);
    background: transparent;
    box-shadow: none;
    animation: lab-rung 4s ease-in-out infinite;
}

.lab-anim-ladder .rung-720  { animation-delay: 1s; }
.lab-anim-ladder .rung-480  { animation-delay: 2s; }
.lab-anim-ladder .rung-360  { animation-delay: 3s; }

.lab-anim-ladder .rung span {
    top: 5px;
    right: 5px;
    font-size: 9px;
    padding: 1px 5px;
}

@keyframes lab-rung {
    0%, 30%, 100% { border-color: var(--primary-20); background: transparent; }
    10%           { border-color: var(--primary); background: var(--primary-10); box-shadow: 0 0 24px var(--primary-20); }
}

/* ---------- CINTA DE FORMATOS ---------- */

.lab-marquee {
    overflow: hidden;
    border-bottom: 1px solid var(--border);
    padding: 18px 0;
    -webkit-mask: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
    mask: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.lab-marquee-track {
    display: flex;
    width: max-content;
    animation: lab-marquee 28s linear infinite;
}

.lab-marquee-set {
    display: flex;
    gap: 12px;
    padding-right: 12px;
}

.lab-marquee-set span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--fg-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    white-space: nowrap;
}

.lab-marquee-set span::before {
    content: "";
    width: 5px;
    height: 5px;
    background: var(--primary);
}

@keyframes lab-marquee {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

/* ---------- MENOS MOVIMIENTO ---------- */

@media (prefers-reduced-motion: reduce) {
    .lab *,
    .lab *::before,
    .lab *::after {
        animation: none !important;
    }

    .lab-cycle > :first-child,
    .lab-shot:first-of-type {
        opacity: 1;
    }
}

/* ---------- RESPONSIVE (animaciones) ---------- */

@media (max-width: 960px) {
    .lab-steps,
    .lab-tools {
        grid-template-columns: 1fr;
    }

    .lab-step + .lab-step,
    .lab-tool:nth-child(even) {
        border-left: none;
    }

    .lab-step + .lab-step,
    .lab-tool + .lab-tool {
        border-top: 1px solid var(--border);
    }

    .lab-step {
        display: grid;
        grid-template-columns: 72px 1fr;
        column-gap: 20px;
        align-items: center;
        padding: 28px var(--gutter);
    }

    .lab-step-icon {
        grid-row: span 2;
    }

    .lab-step h3 {
        margin: 0 0 4px;
    }

    .hero-visual {
        padding: 32px var(--gutter);
    }
}

@media (max-width: 640px) {
    .lab-pipe {
        gap: 6px;
        padding: 12px;
    }

    .lab-chip,
    .lab-node {
        font-size: 10px;
    }

    .lab-hud {
        font-size: 10px;
    }

    .lab-timecode {
        width: 56px;
    }
}

/* =============================================
   OTRAS PÁGINAS — BITRATE ANALYZER
   ============================================= */

#videoPreview {
    width: 1024px;
    max-width: 100%;
    height: 576px;
    background: black;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
}

#chartWrapper {
    position: relative;
    width: 2000px;   /* ancho grande */
    height: 576px;
    margin-top: 10px;
}

#bitrateChart {
    width: 100%;
    height: 400px;
}

canvas#bitrateChart {
    margin-top: 20px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

#chartCursor {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--danger);
    box-shadow: 0 0 8px var(--danger);
    pointer-events: none;
}

#chartContainer {
    position: relative;
    width: 1024px;
    height: 576px;
}

#barContainer {
    width: 100%;
    overflow-x: auto;
    margin-top: 20px;
    scrollbar-color: var(--border) transparent;
}

/* =============================================
   OTRAS PÁGINAS — RESOLUTION GUIDE
   ============================================= */

.resolution-stage {
    position: relative;
    width: 95vw;
    aspect-ratio: 16/9;
    max-height: 95vh;
    background-color: var(--bg);
    background-image:
        linear-gradient(var(--border-soft) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
    background-size: 36px 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.res {
    position: absolute;
    border: 2px solid;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    color: white;

    bottom: 0;
    left: 0;

    transition: all 0.2s ease;
}

.res:hover {
    border-width: 4px;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 15px currentColor;
}

.res span {
    position: absolute;
    top: 5px;
    right: 5px;

    font-family: var(--font-mono);
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--border);
    padding: 5px 7px;
    border-radius: 4px;
    font-size: 12px;
}

.resolution-stage:hover .res {
    opacity: 0.3;
}

.resolution-stage .res:hover {
    opacity: 1;
}

/* --- RESOLUCIONES (base: 8K = 100%) --- */

.res-8k    { width: 100%;  height: 100%;  z-index: 1; }
.res-5k    { width: 66.7%; height: 66.7%; z-index: 2; }
.res-dci4k { width: 53.3%; height: 50%;   z-index: 3; }
.res-4k    { width: 50%;   height: 50%;   z-index: 4; }
.res-uwqhd { width: 44.8%; height: 33.3%; z-index: 5; }
.res-1440  { width: 33.3%; height: 33.3%; z-index: 6; }
.res-2k    { width: 26.7%; height: 25%;   z-index: 7; }
.res-1080  { width: 25%;   height: 25%;   z-index: 8; }
.res-900   { width: 20.8%; height: 20.8%; z-index: 9; }
.res-768   { width: 17.8%; height: 17.8%; z-index: 10; }
.res-720   { width: 16.7%; height: 16.7%; z-index: 11; }
.res-480   { width: 11.1%; height: 11.1%; z-index: 12; }
.res-360   { width: 8.3%;  height: 8.3%;  z-index: 13; }
.res-240   { width: 5.6%;  height: 5.6%;  z-index: 14; }

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 960px) {
    :root {
        --gutter: 28px;
    }

    .lab-topbar {
        height: auto;
        flex-wrap: wrap;
        gap: 12px 24px;
        padding-top: 16px;
        padding-bottom: 14px;
    }

    .lab-topbar .menu {
        order: 3;
        width: 100%;
        overflow-x: auto;
        gap: 22px;
        scrollbar-width: none;
    }

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

    .hero-copy {
        padding-top: 72px;
        padding-bottom: 56px;
    }

    .hero-visual {
        border-left: none;
        border-top: 1px solid var(--border);
        padding: 32px var(--gutter);
    }

    .lab-intro > * {
        padding-top: 48px;
        padding-bottom: 48px;
    }

    .lab-intro > div {
        padding-bottom: 0;
    }

    .lab-lead {
        border-left: none;
        padding-top: 20px;
    }
}

@media (max-width: 640px) {
    :root {
        --gutter: 16px;
    }

    body:not(.lab) {
        padding: 20px 16px;
    }

    .lab .hero h1 {
        font-size: 40px;
    }

    .lab-intro h2 {
        font-size: 24px;
    }

    .lab-lead {
        font-size: 16px;
        line-height: 26px;
    }

    .lab-stage {
        padding: 28px var(--gutter);
    }

    .video-container {
        grid-template-columns: 1fr;
    }

    .lab-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .lab-field {
        padding: 14px;
    }

    .lab-run {
        flex-direction: column;
        align-items: stretch;
    }

    .lab-run #progress {
        flex: none;
    }

    .volume {
        margin-left: 0;
        width: 100%;
    }

    #volume {
        flex: 1;
    }

    .lab #downloadBtn {
        font-size: 18px;
        padding: 16px 26px;
    }
}
