/*
 * Diseño de laboratorio académico compartido por los seis simuladores.
 * Los métodos de monitoreo agregan los estilos de sus mapas y controles específicos.
 * Paleta, tipografía y distribución tomadas del prototipo de Stitch
 * (stitch_interactive_simulator_web_platform): panel de control a la izquierda
 * (5 columnas), resultados a la derecha (7 columnas) y reflexión a ancho completo.
 *
 * Todas las reglas cuelgan de .lab-page para ganar a simuladores-ui.css,
 * que se carga después de los estilos de cada vista.
 */

/* El fondo de la página (siluetas bajo un velo claro) viene de institucional-ubo.css. */

.lab-page {
    --lab-surface: #faf8ff;
    --lab-card: #ffffff;
    --lab-container-low: #f2f3ff;
    --lab-container: #eaedff;
    --lab-container-high: #e2e7ff;
    --lab-container-highest: #dae2fd;
    --lab-on-surface: #131b2e;
    --lab-on-variant: #3d4a42;
    --lab-outline: #6d7a72;
    --lab-outline-variant: #bccac0;
    --lab-primary: #006948;
    --lab-primary-container: #00855d;
    --lab-secondary: #006a63;
    --lab-tertiary: #006194;
    --lab-tertiary-container: #007bb9;
    --lab-error: #ba1a1a;
    --lab-error-container: #ffdad6;
    --lab-on-error-container: #93000a;
    --lab-shadow: 0 1px 3px 0 rgba(15, 23, 42, .05), 0 1px 2px -1px rgba(15, 23, 42, .04);
    --lab-shadow-hover: 0 4px 6px -1px rgba(5, 150, 105, .08), 0 2px 4px -2px rgba(15, 23, 42, .06);
    --lab-font-headline: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
    --lab-font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --lab-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* Variables que consume simuladores-ui.css (ruta de aprendizaje, foco). */
    --simulator-green: var(--lab-primary);
    --simulator-border: var(--lab-container);

    min-width: 320px;
    color: var(--lab-on-surface);
    font-family: var(--lab-font-body);
    font-size: 14px;
    line-height: 22px;
    -webkit-font-smoothing: antialiased;
}

.lab-page h1,
.lab-page h2,
.lab-page h3,
.lab-page h4 {
    margin: 0;
    color: var(--lab-on-surface);
    font-family: var(--lab-font-headline);
}

.lab-page .material-symbols-outlined {
    font-size: 20px;
    line-height: 1;
    user-select: none;
}

.lab-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.lab-page .is-primary { color: var(--lab-primary); }
.lab-page .is-secondary { color: var(--lab-secondary); }
.lab-page .is-tertiary { color: var(--lab-tertiary); }

.lab-content {
    --lab-gap: 24px;
    display: flex;
    flex-direction: column;
    gap: var(--lab-gap);
    width: min(1280px, calc(100% - 64px));
    margin: 0 auto;
    padding: 24px 0 48px;
}

.lab-card {
    background: var(--lab-card);
    border-radius: 12px;
    box-shadow: var(--lab-shadow);
}

/* ---------- 1. Contexto: migas de pan y tarjeta de alcance ---------- */
.lab-context {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.lab-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
    color: var(--lab-on-variant);
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
}

.lab-breadcrumb a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: inherit;
    text-decoration: none;
}

.lab-breadcrumb a:hover { color: var(--lab-primary); text-decoration: underline; }
.lab-breadcrumb .material-symbols-outlined { font-size: 18px; }
.lab-breadcrumb .lab-breadcrumb-section { color: var(--lab-tertiary); font-weight: 600; }
.lab-breadcrumb [aria-current] { color: var(--lab-on-surface); font-weight: 600; }

.lab-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(226, 231, 255, .6);
    color: var(--lab-on-variant);
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
}

.lab-meta-chip strong { color: var(--lab-primary); font-weight: 600; }
.lab-meta-sep { color: var(--lab-outline-variant); }

.lab-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--lab-primary);
}

.lab-scope {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 24px 24px 24px 30px;
    overflow: hidden;
}

.lab-scope::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 6px;
    background: var(--lab-primary);
}

.lab-scope-main {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    min-width: 0;
}

.lab-scope-icon {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: var(--lab-container);
    color: var(--lab-primary);
    box-shadow: var(--lab-shadow);
}

.lab-scope-icon .material-symbols-outlined { font-size: 28px; }

.lab-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
}

.lab-title-row h1 {
    font-size: 24px;
    font-weight: 700;
    line-height: 32px;
    letter-spacing: -.01em;
}

.lab-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(0, 105, 72, .1);
    color: var(--lab-primary);
    font-size: 11px;
    font-weight: 600;
    line-height: 16px;
    white-space: nowrap;
}

.lab-scope-text {
    max-width: 780px;
    margin: 4px 0 0;
    color: var(--lab-on-variant);
    font-size: 15px;
    line-height: 24px;
}

.lab-scope-text strong { color: var(--lab-on-surface); font-weight: 600; }

.lab-guide-toggle {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 0;
    border-radius: 4px;
    background: var(--lab-container);
    color: var(--lab-on-surface);
    font: 600 12px/16px var(--lab-font-body);
    cursor: pointer;
    transition: background-color .2s ease;
}

.lab-guide-toggle:hover { background: var(--lab-container-high); }
.lab-guide-toggle .material-symbols-outlined { font-size: 18px; }
.lab-guide-toggle .lab-chevron { transition: transform .2s ease; }
.lab-guide-toggle[aria-expanded="false"] .lab-chevron { transform: rotate(180deg); }

/*
 * Tarjeta plegable en celulares: solo el título y «Ver más»; desplegada, el objetivo,
 * «Ruta pedagógica» y «Ver menos». En pantallas amplias la tarjeta se ve completa.
 */
.lab-scope-more { display: none; }

@media (max-width: 767px) {
    .lab-scope.is-collapsible:not(.is-scope-open) :is(.lab-scope-text, .lab-guide-toggle) { display: none; }

    .lab-scope-more {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        padding: 0 4px;
        border: 0;
        background: none;
        color: var(--lab-primary);
        font: 600 14px/20px var(--lab-font-body);
        text-decoration: underline;
        text-underline-offset: 3px;
        cursor: pointer;
    }

    .lab-scope-text + .lab-scope-more { margin: 2px 0 0 -4px; }
}

/* ---------- Ruta pedagógica (componente compartido, reestilizado) ---------- */
/*
 * Se despliega animando la fila de la grilla de 0fr a 1fr. El margen negativo
 * compensa el espacio entre bloques mientras está plegada.
 */
.lab-pathway {
    display: grid;
    grid-template-rows: 0fr;
    margin-top: calc(-1 * var(--lab-gap));
    opacity: 0;
    transition: grid-template-rows .45s cubic-bezier(.22, 1, .36, 1), margin-top .45s cubic-bezier(.22, 1, .36, 1), opacity .35s ease;
}

/* Envoltorio sin relleno: así la fila puede llegar a 0 px de alto. */
.lab-pathway-inner {
    min-height: 0;
    overflow: hidden;
    transform: translateY(-8px);
    transition: transform .45s cubic-bezier(.22, 1, .36, 1);
}
.lab-pathway[hidden] { display: none; }

.lab-pathway.is-open {
    grid-template-rows: 1fr;
    margin-top: 0;
    opacity: 1;
}

.lab-pathway.is-open .lab-pathway-inner { transform: translateY(0); }

.lab-pathway.is-open .simulator-learning-steps li,
.lab-pathway.is-open .simulator-learning-prompts p { animation: lab-rise .45s cubic-bezier(.22, 1, .36, 1) both; }
.lab-pathway.is-open .simulator-learning-steps li:nth-child(1) { animation-delay: .08s; }
.lab-pathway.is-open .simulator-learning-steps li:nth-child(2) { animation-delay: .16s; }
.lab-pathway.is-open .simulator-learning-steps li:nth-child(3) { animation-delay: .24s; }
.lab-pathway.is-open .simulator-learning-prompts p:nth-child(1) { animation-delay: .32s; }
.lab-pathway.is-open .simulator-learning-prompts p:nth-child(2) { animation-delay: .38s; }

.lab-page .simulator-learning-path {
    margin: 0;
    padding: 24px;
    border: 0;
    border-radius: 12px;
    background: var(--lab-container-low);
    box-shadow: none;
}

.lab-page .simulator-learning-intro {
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin-bottom: 12px;
}

.lab-page .simulator-learning-eyebrow {
    color: var(--lab-primary);
    font-size: 11px;
    font-weight: 700;
    line-height: 14px;
    letter-spacing: .08em;
}

.lab-page .simulator-learning-intro h2 {
    color: var(--lab-on-surface);
    font-size: 16px;
    font-weight: 600;
    line-height: 24px;
}

.lab-page .simulator-learning-intro p {
    max-width: none;
    color: var(--lab-on-variant);
    font-size: 12px;
    line-height: 18px;
}

.lab-page .simulator-learning-steps { gap: 16px; }

.lab-page .simulator-learning-steps a {
    grid-template-columns: 32px minmax(0, 1fr);
    align-items: flex-start;
    gap: 12px;
    min-height: 0;
    height: 100%;
    padding: 16px;
    border: 0;
    border-radius: 8px;
    background: var(--lab-card);
    color: var(--lab-on-surface);
    box-shadow: var(--lab-shadow);
}

.lab-page .simulator-learning-steps a:hover {
    box-shadow: var(--lab-shadow-hover);
    transform: translateY(-1px);
}

.lab-page .simulator-learning-arrow { display: none; }

.lab-page .simulator-learning-number {
    width: 32px;
    height: 32px;
    background: var(--lab-primary);
    font-family: var(--lab-font-headline);
    font-size: 16px;
    font-weight: 600;
}

.lab-page .simulator-learning-steps li:nth-child(2) .simulator-learning-number { background: var(--lab-primary-container); }
.lab-page .simulator-learning-steps li:nth-child(3) .simulator-learning-number { background: var(--lab-tertiary-container); }

.lab-page .simulator-learning-copy strong {
    color: var(--lab-on-surface);
    font-size: 13px;
    font-weight: 700;
    line-height: 18px;
}

.lab-page .simulator-learning-copy > span {
    color: var(--lab-on-variant);
    font-size: 12px;
    line-height: 18px;
}

.lab-page .simulator-learning-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
    padding-top: 8px;
}

.lab-page .simulator-learning-prompts p {
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 4px;
    background: rgba(218, 226, 253, .5);
    color: var(--lab-on-variant);
    font-size: 12px;
    line-height: 18px;
}

.lab-page .simulator-learning-prompts strong { color: var(--lab-on-surface); font-weight: 700; }

/* Iconos de la pregunta guía y de la prueba controlada (ligaduras de Material Symbols). */
.lab-page .simulator-learning-prompts p > span:first-child::before {
    display: inline-block;
    color: var(--lab-tertiary);
    font-family: 'Material Symbols Outlined';
    font-size: 16px;
    font-weight: normal;
    line-height: 1;
    content: 'lightbulb';
}

.lab-page .simulator-learning-prompts p:nth-child(2) > span:first-child::before {
    color: var(--lab-primary);
    content: 'science';
}

/* ---------- 2. Área de trabajo: control (5) + resultados (7) ---------- */
.lab-workspace {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: start;
    gap: 24px;
}

.lab-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
    padding: 24px;
}

.alpha-page .lab-panel,
:is(.beta-page, .richness-page) .lab-panel { gap: 20px; }

:is(.beta-page, .richness-page) .lab-panel > form {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 12px;
}

.lab-panel-header,
.lab-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.lab-panel-header h2,
.lab-section-title h2,
.lab-reflection-head h2 {
    font-size: 18px;
    font-weight: 700;
    line-height: 26px;
}

.lab-panel-subtitle {
    display: block;
    color: var(--lab-on-variant);
    font-size: 11px;
    font-weight: 500;
    line-height: 14px;
}

.alpha-page .lab-panel-subtitle,
:is(.beta-page, .richness-page) .lab-panel-subtitle { font-size: 12px; line-height: 18px; }

.lab-icon-tile {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background: rgba(0, 105, 72, .1);
    color: var(--lab-primary);
}

.lab-icon-tile.is-lg { width: 40px; height: 40px; border-radius: 8px; }
.lab-icon-tile.is-lg .material-symbols-outlined { font-size: 24px; }

/* Filas de especies con contador (diversidad alfa). */
.lab-species-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lab-species {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border-radius: 8px;
    background: rgba(242, 243, 255, .7);
    transition: background-color .2s ease;
}

.lab-species:hover { background: var(--lab-container-low); }

.lab-species-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.lab-species-info {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.lab-species-icon {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--lab-card);
    font-size: 22px;
    line-height: 1;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
}

.alpha-page .lab-species-icon { width: 52px; height: 52px; }

.lab-species-icon img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: contain;
}

.lab-species-text { min-width: 0; }

.lab-species-name {
    display: block;
    color: var(--lab-on-surface);
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
}

.lab-species-share {
    display: block;
    color: var(--lab-on-variant);
    font-size: 12px;
    line-height: 18px;
    font-variant-numeric: tabular-nums;
}

.lab-stepper {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 6px;
}

.lab-step {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease, transform .1s ease;
}

.lab-step:active { transform: scale(.95); }
.lab-step .material-symbols-outlined { font-size: 18px; }
.lab-step-dec { background: var(--lab-container); color: var(--lab-on-surface); }
.lab-step-dec:hover { background: var(--lab-error-container); color: var(--lab-on-error-container); }
.lab-step-inc { background: var(--lab-primary); color: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .08); }
.lab-step-inc:hover { background: var(--lab-primary-container); }

.lab-count {
    width: 7ch;
    height: 36px;
    padding: 0 4px;
    border: 0;
    border-radius: 4px;
    background: var(--lab-card);
    color: var(--lab-on-surface);
    font: 700 17px/24px var(--lab-font-headline);
    font-variant-numeric: tabular-nums;
    text-align: center;
    -moz-appearance: textfield;
    appearance: textfield;
}

.lab-count::-webkit-outer-spin-button,
.lab-count::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.lab-count:focus { outline: none; box-shadow: 0 0 0 2px rgba(0, 105, 72, .4); }

.lab-track {
    width: 100%;
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--lab-container);
}

.lab-track-bar {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    transition: width .45s cubic-bezier(.22, 1, .36, 1);
}

/* Botones. */
.lab-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding-top: 4px;
}

.alpha-page .lab-actions { padding-top: 12px; }

.lab-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 10px 16px;
    border: 0;
    border-radius: 4px;
    font: 600 13px/18px var(--lab-font-body);
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease, transform .1s ease;
}

.lab-btn:active { transform: scale(.98); }
.lab-btn .material-symbols-outlined { font-size: 18px; }
.lab-btn-soft { background: var(--lab-container); color: var(--lab-on-surface); }
.lab-btn-soft:hover { background: var(--lab-container-high); }
.lab-btn-reset { background: var(--lab-container); color: var(--lab-on-variant); }
.lab-btn-reset:hover { background: var(--lab-error-container); color: var(--lab-on-error-container); }

.lab-btn-primary {
    padding: 10px 24px;
    background: var(--lab-primary);
    color: #fff;
    font-size: 14px;
    line-height: 20px;
    box-shadow: var(--lab-shadow);
}

.lab-btn-primary:hover { background: var(--lab-primary-container); }
.lab-btn-primary:disabled { opacity: .6; cursor: wait; }

.lab-btn-outline {
    min-height: 36px;
    padding: 8px 14px;
    background: var(--lab-card);
    color: var(--lab-primary);
    font-size: 12px;
    box-shadow: inset 0 0 0 1px rgba(0, 105, 72, .3);
}

.lab-btn-outline:hover { background: rgba(0, 105, 72, .06); }

/* Columna de resultados. */
:is(.beta-page, .richness-page) .lab-results-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-width: 0;
}

.lab-results {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.lab-section-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.lab-live {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--lab-on-variant);
    font-size: 11px;
    font-weight: 500;
    line-height: 14px;
}

.lab-live-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--lab-primary);
    box-shadow: 0 0 0 3px rgba(0, 105, 72, .15);
}

.lab-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.lab-metric {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 4px;
    min-width: 0;
    padding: 16px 20px;
    transition: box-shadow .2s ease;
}

.lab-metric:hover { box-shadow: var(--lab-shadow-hover); }

.lab-metric-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--lab-on-variant);
}

.lab-metric-label {
    font-size: 11px;
    font-weight: 600;
    line-height: 14px;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.lab-metric-value {
    margin: 4px 0;
    color: var(--lab-on-surface);
    font-family: var(--lab-font-headline);
    font-size: 36px;
    font-weight: 800;
    line-height: 44px;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}

.lab-metric-value.is-primary { color: var(--lab-primary); }

.lab-metric-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    color: var(--lab-on-variant);
    font-size: 12px;
    line-height: 18px;
}

.lab-mono {
    color: var(--lab-outline);
    font-family: var(--lab-font-mono);
    font-size: 11px;
}

.lab-badge {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--lab-container);
    color: var(--lab-on-variant);
    font-size: 11px;
    font-weight: 600;
    line-height: 16px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* Gráfico de frecuencia relativa (anillo). */
.lab-chart {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
}

.lab-chart-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.lab-chart-head h3 { font-size: 16px; font-weight: 700; line-height: 24px; }
.lab-chart-head p { margin: 0; color: var(--lab-on-variant); font-size: 12px; line-height: 18px; }

.lab-chart-body {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: center;
    gap: 16px;
}

.lab-donut-wrap {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 190px;
}

.lab-donut {
    width: 176px;
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--lab-container-low);
    -webkit-mask: radial-gradient(farthest-side, transparent 71%, #000 calc(71% + 1px));
    mask: radial-gradient(farthest-side, transparent 71%, #000 calc(71% + 1px));
}

.lab-donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    pointer-events: none;
}

.lab-donut-center strong {
    font-family: var(--lab-font-headline);
    font-size: 24px;
    font-weight: 700;
    line-height: 32px;
    font-variant-numeric: tabular-nums;
}

.lab-donut-center span {
    color: var(--lab-on-variant);
    font-size: 11px;
    font-weight: 500;
    line-height: 14px;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.lab-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.lab-legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    line-height: 20px;
}

.lab-legend-name {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lab-legend-dot {
    flex-shrink: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.lab-legend-value {
    display: flex;
    flex-shrink: 0;
    align-items: baseline;
    gap: 6px;
    font-family: var(--lab-font-mono);
    font-variant-numeric: tabular-nums;
}

.lab-legend-value strong { color: var(--lab-on-surface); }
.lab-legend-value small { color: var(--lab-outline); font-size: 11px; }

.lab-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 24px;
    border-radius: 8px;
    background: var(--lab-container-low);
    color: var(--lab-on-variant);
    font-size: 12px;
    line-height: 18px;
    text-align: center;
}

.lab-empty .material-symbols-outlined { margin-bottom: 4px; color: var(--lab-outline-variant); font-size: 32px; }
.lab-empty strong { color: var(--lab-on-surface); font-size: 12px; }

/* ---------- Diversidad beta: matriz de presencia por sitio ---------- */
.lab-presence {
    flex: 1;
    width: 100%;
    margin-top: -8px;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.lab-presence thead th {
    padding: 0 12px 4px;
    color: var(--lab-on-variant);
    font-size: 11px;
    font-weight: 600;
    line-height: 14px;
    letter-spacing: .06em;
    text-align: center;
    text-transform: uppercase;
    white-space: nowrap;
}

.lab-presence thead th:first-child { text-align: left; }

.lab-presence tbody th,
.lab-presence tbody td {
    padding: 10px 12px;
    background: rgba(242, 243, 255, .7);
    transition: background-color .2s ease;
}

.lab-presence tbody tr:hover > * { background: var(--lab-container-low); }
.lab-presence tbody th { border-radius: 8px 0 0 8px; font-weight: 600; text-align: left; }
.lab-presence tbody td:last-child { border-radius: 0 8px 8px 0; }
.lab-presence td { width: 84px; text-align: center; }

.lab-presence-species {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    font-size: 14px;
    line-height: 20px;
}

.lab-presence .lab-species-icon { width: 52px; height: 52px; font-size: 24px; }

/* La matriz de riqueza compara tres sitios sin repetir la lista de especies. */
.richness-presence { table-layout: fixed; }
.richness-site-column { width: 16%; }
.richness-presence thead th:not(:first-child) { padding-inline: 4px; }
.richness-presence td { width: auto; }
.richness-presence .lab-presence-species > span:last-child { min-width: 0; }

.lab-presence tfoot th,
.lab-presence tfoot td {
    padding: 8px 8px 0;
}

.lab-presence tfoot th {
    color: var(--lab-on-variant);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-align: left;
    text-transform: uppercase;
}

.lab-presence tfoot td {
    font-family: var(--lab-font-headline);
    font-size: 18px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.lab-site-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 6px;
    border-radius: 50%;
    background: var(--lab-primary);
    vertical-align: 1px;
}

.lab-site-dot.is-site-2 { background: var(--lab-tertiary-container); }
.lab-site-dot.is-site-3 { background: #7b4ba8; }

.lab-check {
    display: inline-grid;
    place-items: center;
    padding: 6px;
    cursor: pointer;
}

.lab-check input {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    margin: 0;
    border: 2px solid var(--lab-outline-variant);
    border-radius: 6px;
    background: var(--lab-card);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    transition: background-color .15s ease, border-color .15s ease;
}

.lab-check input::after {
    content: "";
    width: 6px;
    height: 12px;
    margin-top: -3px;
    border: solid #fff;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg) scale(0);
    transition: transform .15s ease;
}

.lab-check input:hover { border-color: var(--lab-primary); }
.lab-check input:checked { border-color: var(--lab-primary); background: var(--lab-primary); }
.lab-check input:checked::after { transform: rotate(45deg) scale(1); }
.lab-check.is-site-2 input:hover { border-color: var(--lab-tertiary-container); }
.lab-check.is-site-2 input:checked { border-color: var(--lab-tertiary-container); background: var(--lab-tertiary-container); }
.lab-check.is-site-3 input:hover { border-color: #7b4ba8; }
.lab-check.is-site-3 input:checked { border-color: #7b4ba8; background: #7b4ba8; }

/* Índice de Jaccard. */
.lab-jaccard {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    align-items: center;
    gap: 20px;
    padding: 20px 24px;
}

.lab-metric-value.is-xl {
    color: var(--lab-tertiary);
    font-size: 56px;
    line-height: 64px;
}

.lab-metric-help {
    margin: 0 0 12px;
    color: var(--lab-on-variant);
    font-size: 12px;
    line-height: 18px;
}

.lab-scale {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--lab-container);
}

.lab-scale-bar {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--lab-tertiary-container), var(--lab-primary));
    transition: width .6s cubic-bezier(.22, 1, .36, 1);
}

.lab-scale-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    color: var(--lab-outline);
    font-family: var(--lab-font-mono);
    font-size: 11px;
}

.lab-formula {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    border-radius: 8px;
    background: var(--lab-container-low);
}

.lab-formula code {
    color: var(--lab-on-surface);
    font: 600 15px/22px var(--lab-font-mono);
}

.lab-formula dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 8px;
    margin: 0;
    color: var(--lab-on-variant);
    font-size: 12px;
    line-height: 18px;
}

.lab-formula dt { color: var(--lab-on-surface); font-family: var(--lab-font-mono); font-weight: 700; }
.lab-formula dd { margin: 0; }

/*
 * Franja de composición (beta y riqueza): reparte un total en partes
 * proporcionales y, debajo, cada grupo con sus especies en el mismo orden.
 * Cada sitio usa exactamente el color de su casilla en la tabla de presencia;
 * el ocre marca siempre lo «compartido». El azul y el morado se parecen para
 * la deuteranopía, por eso cada segmento de sitio lleva su nombre escrito.
 */
.lab-page {
    --strip-site-1: var(--lab-primary);
    --strip-site-2: var(--lab-tertiary-container);
    --strip-site-3: #7b4ba8;
    --strip-shared: #9a6a12;
    --strip-in-2: #c99a45;
    --strip-in-3: #7a5208;
}

.lab-composition {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
    padding: 24px;
}

.lab-composition .lab-chart-head .lab-mono { color: var(--lab-on-variant); font-size: 12px; white-space: nowrap; }

.lab-strip {
    position: relative;
    display: flex;
    gap: 2px;
    height: 36px;
    overflow: hidden;
    border-radius: 6px;
    background: var(--lab-container-low);
}

.lab-strip[data-empty] { box-shadow: inset 0 0 0 1px var(--lab-outline-variant); }

.lab-strip-seg {
    --seg: var(--lab-secondary);
    display: grid;
    place-items: center;
    flex-basis: 0;
    min-width: 0;
    background: var(--seg);
    color: #fff;
    container-type: inline-size;
    transition: flex-grow .35s cubic-bezier(.22, 1, .36, 1);
}

.lab-strip-seg[hidden] { display: none; }
.lab-strip-seg.is-site-1 { --seg: var(--strip-site-1); }
.lab-strip-seg.is-site-2 { --seg: var(--strip-site-2); }
.lab-strip-seg.is-site-3 { --seg: var(--strip-site-3); }
.lab-strip-seg.is-shared { --seg: var(--strip-shared); }
.lab-strip-seg.is-in-2 { --seg: var(--strip-in-2); color: var(--lab-on-surface); }
.lab-strip-seg.is-in-3 { --seg: var(--strip-in-3); }

.lab-strip-label {
    font-size: 12px;
    font-weight: 700;
    line-height: 16px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/*
 * Segmento angosto: la etiqueta larga («Sitio 1 · 2») cambia a la corta («S1 · 2»);
 * si tampoco cabe, se omite (el título y los grupos conservan el dato).
 */
@container (max-width: 96px) {
    .lab-strip-label[data-short] { font-size: 0; }
    .lab-strip-label[data-short]::after { content: attr(data-short); font-size: 12px; }
}

@container (max-width: 46px) {
    .lab-strip-label { display: none; }
}

.lab-strip-empty {
    display: none;
    align-self: center;
    width: 100%;
    padding: 0 12px;
    color: var(--lab-on-variant);
    font-size: 12px;
    line-height: 16px;
    text-align: center;
}

.lab-strip[data-empty] .lab-strip-empty { display: block; }

/* Grupos bajo la franja, en el mismo orden que sus segmentos. */
.lab-sets {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.lab-set {
    --set-color: var(--strip-shared);
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--lab-container);
    border-radius: 10px;
    background: color-mix(in srgb, var(--set-color) 6%, #fff);
}

.lab-set.is-site-1 { --set-color: var(--strip-site-1); }
.lab-set.is-site-2 { --set-color: var(--strip-site-2); }
.lab-set.is-in-2 { --set-color: var(--strip-in-2); }
.lab-set.is-in-3 { --set-color: var(--strip-in-3); }
/* Los grupos ocre comparten un fondo crema: mezclar el ocre oscuro con blanco da un gris apagado. */
.lab-set:is(.is-shared, .is-in-2, .is-in-3) { background: #fcf7ec; }
/* Exclusivas de cualquier sitio: la clave reúne los tres colores de sitio y cada especie muestra el suyo. */
.lab-set.is-exclusive { background: var(--lab-surface); }
.lab-set.is-exclusive .lab-set-key { background: linear-gradient(90deg, var(--strip-site-1) 0 33.3%, var(--strip-site-2) 33.3% 66.6%, var(--strip-site-3) 66.6%); }

.lab-set-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.lab-set-head h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--lab-font-body);
    font-size: 13px;
    font-weight: 600;
    line-height: 18px;
}

.lab-set-head var {
    color: var(--lab-on-variant);
    font-family: var(--lab-font-mono);
    font-size: 13px;
    font-style: normal;
    font-weight: 700;
}

/* Clave de color: une cada grupo con su segmento de la franja. */
.lab-set-key {
    flex: none;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background: var(--set-color);
    box-shadow: inset 0 0 0 1px rgba(19, 27, 46, .18);
}

.lab-set-count {
    color: var(--lab-on-surface);
    font-family: var(--lab-font-headline);
    font-size: 26px;
    font-weight: 800;
    line-height: 30px;
    font-variant-numeric: tabular-nums;
}

.lab-set .lab-chip-list { margin: 0; }
.lab-set .lab-chip-list li { background: var(--lab-card); box-shadow: inset 0 0 0 1px var(--lab-container); }
.lab-set .lab-chip-list li.is-empty { box-shadow: none; background: transparent; }

.lab-chip-sites {
    color: var(--lab-outline);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.lab-chip-sites .lab-site-dot { margin-right: 3px; }
.lab-chip-sites .lab-site-dot:last-of-type { margin-right: 4px; }

.lab-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 0 0;
    padding: 0;
    list-style: none;
}

.lab-chip-list li {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--lab-container-low);
    color: var(--lab-on-surface);
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
}

.lab-chip-img {
    display: block;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-left: -4px;
    border-radius: 50%;
    background: var(--lab-card);
    object-fit: contain;
}

.lab-chip-list li.is-empty {
    padding-left: 0;
    background: transparent;
    color: var(--lab-outline);
    font-style: italic;
}

/* ---------- 3. Interpretación científica ---------- */
.lab-reflection {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
}

:is(.beta-page, .richness-page) .lab-reflection,
:is(.beta-page, .richness-page) .lab-reflection .lab-form { flex: 1; }

:is(.beta-page, .richness-page) .lab-reflection-head { align-items: flex-start; }

:is(.beta-page, .richness-page) .lab-textarea-wrap {
    display: flex;
    flex: 1;
    flex-direction: column;
}

:is(.beta-page, .richness-page) .lab-textarea-wrap textarea { flex: 1; min-height: 180px; }
:is(.beta-page, .richness-page) .lab-form-footer .lab-btn { margin-left: auto; }

.lab-reflection-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lab-reflection-head p {
    margin: 2px 0 0;
    color: var(--lab-on-variant);
    font-size: 12px;
    line-height: 18px;
}

.lab-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lab-form-label {
    color: var(--lab-on-surface);
    font-size: 13px;
    font-weight: 600;
    line-height: 20px;
}

.lab-textarea-wrap { position: relative; }

.lab-textarea-wrap textarea {
    display: block;
    width: 100%;
    min-height: 150px;
    padding: 16px 16px 40px;
    resize: vertical;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: var(--lab-card);
    color: var(--lab-on-surface);
    font: 400 14px/22px var(--lab-font-body);
    box-shadow: inset 0 2px 4px rgba(15, 23, 42, .04);
    transition: border-color .2s ease, box-shadow .2s ease;
}

.lab-textarea-wrap textarea::placeholder { color: rgba(109, 122, 114, .75); }

.lab-textarea-wrap textarea:focus {
    outline: none;
    border-color: var(--lab-primary);
    box-shadow: 0 0 0 3px rgba(0, 105, 72, .15);
}

.lab-counter {
    position: absolute;
    right: 12px;
    bottom: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, .9);
    color: var(--lab-outline);
    font: 500 11px/14px var(--lab-font-mono);
    pointer-events: none;
}

.lab-form-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--lab-container);
}

.lab-form-note {
    flex: 1 1 260px;
    margin: 0;
    color: var(--lab-on-variant);
    font-size: 12px;
    line-height: 18px;
}

.lab-status {
    min-height: 20px;
    color: var(--lab-on-variant);
    font-size: 13px;
    line-height: 20px;
}

.lab-status.is-success { color: var(--lab-primary); font-weight: 600; }
.lab-status.is-error { color: var(--lab-error); font-weight: 600; }

.lab-comparison {
    padding-top: 16px;
    border-top: 1px solid var(--lab-container);
}

.lab-comparison[hidden] { display: none; }

.lab-comparison h3 {
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 700;
    line-height: 24px;
}

.lab-comparison-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.lab-comparison-grid.is-single { grid-template-columns: minmax(0, 1fr); }

.lab-reference {
    padding: 16px;
    border-left: 3px solid var(--lab-primary);
    border-radius: 8px;
    background: var(--lab-container-low);
}

.lab-reference h4 {
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
}

.lab-reference-message {
    margin-top: 12px;
    color: var(--lab-on-surface);
    font-size: 14px;
    font-weight: 700;
}

.lab-reference-text {
    margin-top: 6px;
    color: var(--lab-on-variant);
    font-size: 13px;
    line-height: 20px;
}

.lab-back-to-top {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 20;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--lab-primary);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 4px 6px -1px rgba(5, 150, 105, .25), 0 2px 4px -2px rgba(15, 23, 42, .1);
    transition: background-color .2s ease, transform .2s ease;
}

.lab-back-to-top:hover { background: var(--lab-primary-container); transform: translateY(-2px); }

/* ---------- Animaciones ---------- */

/* Selección al azar y reinicio: dado que gira, filas que se iluminan en cascada,
   contadores que saltan, barras que cambian escalonadas y el anillo que gira. */
.lab-btn.is-rolling .material-symbols-outlined { animation: lab-roll .6s cubic-bezier(.22, 1, .36, 1); }

.lab-species.is-updated { animation: lab-flash .8s ease both; animation-delay: calc(var(--i, 0) * 70ms); }
.lab-species.is-updated .lab-count { animation: lab-pop .4s ease both; animation-delay: calc(var(--i, 0) * 70ms + 80ms); }
.lab-species.is-updated .lab-track-bar {
    transition-duration: .75s;
    transition-delay: calc(var(--i, 0) * 70ms);
}

.lab-donut.is-refreshed { animation: lab-donut-in .7s cubic-bezier(.22, 1, .36, 1); }

.lab-check input.is-pop { animation: lab-pop .35s ease both; animation-delay: var(--d, 0ms); }
.lab-chip-list li.is-new { animation: lab-chip-in .35s cubic-bezier(.22, 1, .36, 1) both; }

/* Valores que cambian: entran con un leve desplazamiento. */
.lab-metric-value.is-changed,
.lab-set-count.is-changed,
.lab-donut-center strong.is-changed,
.lab-presence tfoot td.is-changed { animation: lab-value .35s ease; }

/* Comprobación de la interpretación. */
.lab-btn-primary:disabled::before {
    content: "";
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: lab-spin .7s linear infinite;
}

.lab-status.is-announced { animation: lab-fade-in .3s ease both; }
.lab-status.is-success,
.lab-status.is-error { padding: 8px 12px; border-radius: 6px; }
.lab-status.is-success { background: rgba(0, 105, 72, .08); }
.lab-status.is-error { background: rgba(186, 26, 26, .07); }

.lab-comparison:not([hidden]),
.lab-comparison:not([hidden]) .lab-reference { animation: lab-rise .5s cubic-bezier(.22, 1, .36, 1) both; }
.lab-comparison:not([hidden]) .lab-reference:nth-child(1) { animation-delay: .1s; }
.lab-comparison:not([hidden]) .lab-reference:nth-child(2) { animation-delay: .2s; }

.lab-reference details[open] > :not(summary) { animation: lab-fade-in .35s ease both; }
.lab-reference details[open] > :not(summary):last-child { animation-delay: .08s; }

@keyframes lab-rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

@keyframes lab-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}

@keyframes lab-pop {
    0% { transform: scale(1); }
    40% { transform: scale(1.18); }
    100% { transform: scale(1); }
}

@keyframes lab-roll {
    0% { transform: rotate(0) scale(1); }
    50% { transform: rotate(200deg) scale(1.25); }
    100% { transform: rotate(360deg) scale(1); }
}

@keyframes lab-flash {
    0% { background-color: rgba(0, 133, 93, .18); }
    100% { background-color: rgba(242, 243, 255, .7); }
}

@keyframes lab-value {
    from { opacity: .35; transform: translateY(5px); }
    to { opacity: 1; transform: none; }
}

@keyframes lab-donut-in {
    from { opacity: .4; transform: rotate(-120deg) scale(.92); }
    to { opacity: 1; transform: none; }
}

@keyframes lab-chip-in {
    from { opacity: 0; transform: scale(.8); }
    to { opacity: 1; transform: none; }
}

@keyframes lab-spin { to { transform: rotate(360deg); } }

/* ---------- Responsivo ---------- */
@media (min-width: 1024px) {
    .alpha-page .lab-workspace,
    :is(.beta-page, .richness-page) .lab-workspace { grid-template-columns: minmax(0, 5.5fr) minmax(0, 6.5fr); }
    :is(.beta-page, .richness-page) .lab-workspace { align-items: stretch; }
    .richness-page .lab-workspace { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

@media (max-width: 1023px) {
    .lab-workspace { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 767px) {
    .lab-content { --lab-gap: 16px; width: calc(100% - 32px); padding-top: 16px; }
    .lab-scope { flex-direction: column; align-items: flex-start; padding: 16px 16px 16px 22px; }
    .lab-title-row h1 { font-size: 20px; line-height: 28px; }
    .lab-page .simulator-learning-path { padding: 16px; }
    .lab-page .simulator-learning-intro { display: block; }
    .lab-page .simulator-learning-intro p { margin-top: 4px; text-align: left; }
    .lab-page .simulator-learning-steps { grid-template-columns: minmax(0, 1fr); }
    .lab-panel,
    .lab-chart,
    .lab-composition,
    .lab-reflection { padding: 16px; }    .lab-species { gap: 8px; padding: 10px; }
    .lab-species-row,
    .lab-species-info { gap: 6px; }
    .alpha-page .lab-species-icon { width: 48px; height: 48px; }
    .lab-stepper { gap: 4px; }
    .lab-count { box-sizing: border-box; width: calc(6ch + 8px); font-size: 16px; }
    :is(.beta-page, .richness-page) .lab-results-column { gap: 16px; }
    .lab-presence tbody th,
    .lab-presence tbody td { padding: 8px 6px; }
    .lab-presence-species { gap: 8px; }
    .lab-presence .lab-species-icon { width: 48px; height: 48px; }
    .lab-check input { width: 28px; height: 28px; }
    .richness-presence .lab-species-icon { width: 44px; height: 44px; }
}

@media (max-width: 639px) {
    .lab-chart-body,
    .lab-jaccard,
    .lab-sets,
    .lab-comparison-grid { grid-template-columns: minmax(0, 1fr); }
    .lab-textarea-wrap textarea,
    .lab-count { font-size: 16px; }
    .lab-form-footer .lab-btn-primary { width: 100%; }
}

@media (max-width: 479px) {
    .lab-actions { grid-template-columns: minmax(0, 1fr); }
    .lab-metric { padding: 14px; }
    .lab-metric-value { font-size: 28px; line-height: 36px; }
    .lab-metric-value.is-xl { font-size: 44px; line-height: 52px; }
    .lab-presence td { width: 52px; }
    .lab-presence thead th { padding-inline: 4px; font-size: 10px; }
    .lab-presence .lab-site-dot { width: 6px; height: 6px; margin-right: 4px; }
    .richness-site-column { width: 48px; }
    .richness-presence thead .lab-site-dot { display: none; }
    .richness-presence tbody th,
    .richness-presence tbody td { padding: 8px 4px; }
    .richness-presence .lab-presence-species { gap: 6px; font-size: 13px; line-height: 18px; }
    .lab-back-to-top { right: 14px; bottom: 14px; }
}

@media (max-width: 389px) {
    .lab-species-row { flex-wrap: wrap; }
    .lab-species-info { flex-basis: 100%; }
    .lab-stepper { margin-left: auto; }
}

@media (max-width: 359px) {
    .richness-presence .lab-species-icon { width: 40px; height: 40px; }
    .richness-presence .lab-presence-species { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .lab-page *,
    .lab-page *::before,
    .lab-page *::after,
    .lab-back-to-top { transition: none !important; animation: none !important; }
    .lab-page .simulator-learning-steps a:hover,
    .lab-back-to-top:hover { transform: none; }
}
