/* ==========================================================================
   GRAN GALERÍA MICROSOFT COPILOT 2026 · EXPERIENCIA FULL-SCREEN MOBILE-FIRST
   Tipografía legible en teléfonos (rem + line-height sin unidades), objetivos
   táctiles de 44px y contención estricta de logotipos e iconos.
   ========================================================================== */

:root {
    --gm-ivory: #f8f5ef;
    --gm-alabaster: #efeae0;
    --gm-paper: rgba(251, 249, 244, 0.96);
    --gm-ink: #1c1917;
    --gm-muted: #44403c;
    --gm-gold: #9a6f21;
    --gm-gold-light: #d4af37;
    --gm-emerald: #0a7c53;
    --gm-emerald-dark: #064e35;
    --gm-crimson: #881337;
    --gm-border: rgba(164, 120, 43, 0.3);
    --gm-shadow: 0 22px 60px rgba(28, 25, 23, 0.24);
    --target-size: 24px;
}

@media (pointer: coarse) {
    :root {
        --target-size: 44px;
    }
}

html,
body.ec-game-body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    background: #e8e1d5;
    color: var(--gm-ink);
    font-family: "Raleway", system-ui, -apple-system, sans-serif;
    line-height: 1.5;
    text-align: start;
    overflow-wrap: break-word;
    user-select: none;
    -webkit-user-select: none;
}

/* Especificidad cero (:where) para no sobreescribir el tamaño explícito de logotipos e iconos */
:where(img, video) {
    max-inline-size: 100%;
    block-size: auto;
}

body.ec-game-body :where(h1, h2, h3) {
    text-wrap: balance;
}

body.ec-game-body :where(p, li) {
    text-wrap: pretty;
}

body.ec-game-body :where(a, code) {
    overflow-wrap: anywhere;
}

/* Utilerías tipográficas amplias y legibles para teléfono móvil */
.ec-overline-gold {
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--gm-gold);
}

.ec-pop-heading {
    font-size: 1.12rem;
    font-weight: 800;
}

.ec-body-base {
    font-size: 1.06rem;
    line-height: 1.56;
}

.ec-body-sm {
    font-size: 0.98rem;
    line-height: 1.5;
}

.ec-section-legend {
    font-size: 0.98rem;
    letter-spacing: 0.04em;
    color: var(--gm-gold);
}

.ec-form-label {
    font-size: 1rem;
    line-height: 1.4;
}

.ec-score-badge {
    padding: 0.45rem 0.75rem;
    font-size: 0.96rem;
    line-height: 1.2;
}

/* Tamaño táctil mínimo adaptable (24px ratón / 44px pantallas táctiles) */
body.ec-game-body :where(
    button,
    select,
    textarea,
    input:not([type="checkbox"], [type="radio"]),
    [role="button"],
    nav a,
    label:has(input[type="checkbox"], input[type="radio"])
),
dialog.ec-dialog :where(
    button,
    select,
    textarea,
    input:not([type="checkbox"], [type="radio"]),
    label:has(input[type="checkbox"], input[type="radio"])
) {
    min-block-size: var(--target-size);
    min-inline-size: var(--target-size);
}

body.ec-game-body #m31-chat-embed-root,
body.ec-game-body #wa-float-btn-template {
    display: none !important;
}

body.ec-game-body :where(a:any-link, button, input, select, textarea):focus-visible,
dialog.ec-dialog :where(a:any-link, button, input, select, textarea):focus-visible {
    outline: 3px solid var(--gm-emerald);
    outline-offset: 3px;
}

/* Contenedor 100% Dynamic Viewport del Juego */
.ec-viewport {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    width: 100vw;
    width: 100dvw;
    height: 100dvh;
    overflow: hidden;
}

/* ==========================================================================
   BARRA SUPERIOR ÚNICA Y COMPACTA (con altura impulsada por contenido)
   ========================================================================== */
.ec-topbar {
    position: relative;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding-top: max(0.45rem, env(safe-area-inset-top, 0px));
    padding-bottom: 0.45rem;
    padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
    background: rgba(250, 247, 241, 0.96);
    border-bottom: 1px solid var(--gm-border);
    box-shadow: 0 4px 18px rgba(28, 25, 23, 0.08);
    backdrop-filter: blur(12px);
    flex-shrink: 0;
}

.ec-brand-group {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-inline-size: 0;
}

.ec-exit-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-block-size: var(--target-size);
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    border: 1px solid rgba(28, 25, 23, 0.16);
    background: #ffffff;
    color: var(--gm-ink);
    text-decoration: none;
    flex-shrink: 0;
    transition: border-color 0.2s ease, transform 0.15s ease;
}

.ec-exit-logo:hover {
    border-color: var(--gm-emerald);
    color: var(--gm-emerald);
    transform: translateY(-1px);
}

.ec-exit-logo img {
    inline-size: auto;
    max-inline-size: 6rem;
    block-size: 1.6rem;
    object-fit: contain;
    flex-shrink: 0;
}

.ec-museum-title-block {
    min-inline-size: 0;
    line-height: 1.2;
}

.ec-museum-title-block small {
    display: block;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gm-gold);
}

.ec-museum-title-block h1 {
    margin: 0;
    font-size: clamp(0.96rem, 0.86rem + 0.5vw, 1.18rem);
    font-weight: 900;
    color: var(--gm-ink);
    line-height: 1.2;
}

/* Navegación de Salas en Escritorio Amplio */
.ec-wing-nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 0.15rem 0;
}

.ec-wing-nav::-webkit-scrollbar {
    display: none;
}

.ec-wing-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    border: 1px solid rgba(28, 25, 23, 0.15);
    background: rgba(255, 255, 255, 0.82);
    color: var(--gm-muted);
    font-size: 0.86rem;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.18s ease;
}

.ec-wing-btn img {
    inline-size: 1.15rem;
    block-size: 1.15rem;
    object-fit: contain;
    flex-shrink: 0;
}

.ec-wing-btn:hover {
    border-color: var(--gm-gold);
    color: var(--gm-ink);
    background: #ffffff;
}

.ec-wing-btn.is-active {
    border-color: var(--gm-ink);
    background: var(--gm-ink);
    color: #f8f5ef;
}

.ec-actions-right {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.ec-pill-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(28, 25, 23, 0.16);
    background: #ffffff;
    color: var(--gm-ink);
    font-size: 1rem;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.18s ease;
}

.ec-pill-btn:hover {
    border-color: var(--gm-gold);
    background: #fdfbf7;
}

.ec-online-pill {
    cursor: default;
}

.ec-pill-btn.is-quote {
    border-color: var(--gm-emerald);
    background: linear-gradient(135deg, var(--gm-emerald) 0%, var(--gm-emerald-dark) 100%);
    color: #ffffff;
    box-shadow: 0 6px 18px rgba(10, 124, 83, 0.28);
}

.ec-pill-btn.is-quote:hover {
    filter: brightness(1.07);
    transform: translateY(-1px);
}

.ec-online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.22);
}

/* ==========================================================================
   POPOVER NATIVO DE ACCIONES SECUNDARIAS / SALAS EN MÓVIL
   ========================================================================== */
@supports not selector(:popover-open) {
    [popover]:not(.\:popover-open) {
        display: none;
    }
}

.ec-quick-popover {
    margin: 0;
    inset: auto;
    top: calc(3.7rem + env(safe-area-inset-top, 0px));
    right: max(0.75rem, env(safe-area-inset-right, 0px));
    width: min(25rem, calc(100dvw - 1.5rem));
    max-block-size: calc(100dvh - 5rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 1.1rem;
    border-radius: 22px;
    border: 1.5px solid var(--gm-gold);
    background: rgba(252, 250, 246, 0.99);
    color: var(--gm-ink);
    box-shadow: var(--gm-shadow);
}

.ec-quick-popover[popover]:is(:popover-open, .\:popover-open) {
    display: block;
}

.ec-popover-wings {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

.ec-pop-wing-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 0.8rem;
    border-radius: 14px;
    border: 1px solid rgba(28, 25, 23, 0.15);
    background: #ffffff;
    color: var(--gm-ink);
    font-size: 0.92rem;
    font-weight: 800;
    text-align: start;
    cursor: pointer;
}

.ec-pop-wing-btn img {
    inline-size: 1.5rem;
    block-size: 1.5rem;
    object-fit: contain;
    flex-shrink: 0;
}

.ec-pop-wing-btn img.ec-ionet-mini {
    inline-size: auto;
    max-inline-size: 2.8rem;
    block-size: 1.15rem;
}

.ec-pop-wing-btn.is-active {
    border-color: var(--gm-emerald);
    background: #ecfdf5;
    color: var(--gm-emerald-dark);
}

/* ==========================================================================
   LIENZO 3D Y CONTROLES DISCRETOS
   ========================================================================== */
.ec-stage-wrap {
    position: relative;
    flex: 1;
    min-block-size: 0;
    width: 100%;
    overflow: hidden;
}

#ecMuseumCanvas {
    display: block;
    width: 100%;
    height: 100%;
    outline: none;
    cursor: grab;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

#ecMuseumCanvas.is-dragging-cam {
    cursor: grabbing;
}

.ec-hud-subbar {
    position: absolute;
    top: 12px;
    left: max(14px, env(safe-area-inset-left, 0px));
    right: max(14px, env(safe-area-inset-right, 0px));
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    pointer-events: none;
}

.ec-hud-subbar > * {
    pointer-events: auto;
}

.ec-audioguide-bar {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--gm-border);
    background: var(--gm-paper);
    box-shadow: 0 8px 26px rgba(28, 25, 23, 0.12);
    backdrop-filter: blur(10px);
}

.ec-ag-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    border: 1px solid rgba(28, 25, 23, 0.15);
    background: #ffffff;
    color: var(--gm-ink);
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
}

.ec-ag-btn:hover {
    border-color: var(--gm-gold);
}

.ec-ag-btn.is-gold {
    border-color: var(--gm-gold);
    background: linear-gradient(135deg, #b78834, #8f651d);
    color: #ffffff;
}

.ec-ag-status {
    padding: 0 8px;
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--gm-muted);
}

.ec-status-cluster {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid var(--gm-border);
    background: var(--gm-paper);
    box-shadow: 0 8px 24px rgba(28, 25, 23, 0.1);
    font-size: 0.86rem;
    font-weight: 800;
}

.ec-emote-btn {
    display: grid;
    place-items: center;
    border: 0;
    background: transparent;
    padding: 4px 6px;
    border-radius: 10px;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.ec-emote-btn:hover {
    transform: scale(1.16);
    background: rgba(164, 120, 43, 0.14);
}

.ec-toast[hidden],
.ec-dossier[hidden],
.ec-curator-box[hidden],
.ec-drawer[hidden],
.ec-minigame-layer[hidden],
.ec-quiz-feedback[hidden],
.ec-quiz-summary[hidden],
#ecQuizActiveStage[hidden] {
    display: none !important;
}

.ec-toast {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 25;
    width: max-content;
    max-inline-size: min(34rem, calc(100dvw - 1.5rem));
    padding: 0.8rem 1.2rem;
    border-radius: 16px;
    border: 1.5px solid var(--gm-gold);
    background: rgba(28, 25, 23, 0.96);
    color: #fef3c7;
    font-size: 1.04rem;
    font-weight: 700;
    line-height: 1.48;
    text-align: center;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
}

/* ==========================================================================
   DIÁLOGO DE SALA CON VISITANTES, CURADOR O GUARDIA
   ========================================================================== */
.ec-curator-box {
    position: absolute;
    left: 50%;
    bottom: max(1.1rem, env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 22;
    width: min(44rem, calc(100dvw - 1.25rem));
    max-block-size: 78dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 1.2rem 1.3rem;
    border-radius: 22px;
    border: 1.5px solid var(--gm-gold);
    background: rgba(252, 250, 246, 0.99);
    color: var(--gm-ink);
    box-shadow: var(--gm-shadow);
    backdrop-filter: blur(14px);
    user-select: text;
}

.ec-curator-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 0.6rem;
}

.ec-curator-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.34rem 0.8rem;
    border-radius: 999px;
    background: rgba(164, 120, 43, 0.16);
    color: #7c5819;
    font-size: 0.9rem;
    font-weight: 900;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.ec-curator-speech {
    font-size: 1.1rem;
    line-height: 1.56;
}

.ec-curator-choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
    margin-top: 0.9rem;
}

.ec-choice-btn {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.8rem 1rem;
    border-radius: 14px;
    border: 1px solid rgba(28, 25, 23, 0.16);
    background: #ffffff;
    color: var(--gm-ink);
    font-size: 1.02rem;
    font-weight: 800;
    line-height: 1.38;
    text-align: start;
    cursor: pointer;
    transition: all 0.16s ease;
}

.ec-choice-btn img {
    inline-size: 1.55rem;
    block-size: 1.55rem;
    object-fit: contain;
    flex-shrink: 0;
}

.ec-choice-btn:hover {
    border-color: var(--gm-emerald);
    background: #f0fdf4;
    color: var(--gm-emerald-dark);
}

/* ==========================================================================
   CÉDULA MUSEOGRÁFICA LIMPIA Y AIREADA (SIN ETIQUETAS DE OBRA/SALA)
   ========================================================================== */
.ec-dossier {
    position: absolute;
    right: max(16px, env(safe-area-inset-right, 0px));
    top: 16px;
    max-block-size: calc(100% - 104px);
    z-index: 21;
    width: min(26.5rem, calc(100dvw - 1.5rem));
    display: flex;
    flex-direction: column;
    border-radius: 22px;
    border: 1px solid var(--gm-border);
    background: rgba(252, 250, 246, 0.99);
    color: var(--gm-ink);
    box-shadow: var(--gm-shadow);
    backdrop-filter: blur(16px);
    overflow: hidden;
    user-select: text;
}

.ec-sheet-grabber {
    display: none;
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: rgba(28, 25, 23, 0.18);
    margin: 7px auto 0;
    flex-shrink: 0;
}

.ec-dossier-head {
    padding: 0.85rem 1rem 0.75rem;
    border-bottom: 1px solid rgba(28, 25, 23, 0.08);
    background: linear-gradient(180deg, #f6f1e7 0%, rgba(252, 250, 246, 0) 100%);
}

.ec-dossier-title {
    font-size: clamp(1.06rem, 0.98rem + 0.35vw, 1.22rem);
    line-height: 1.24;
}

.ec-dossier-sub {
    font-size: 0.9rem;
    line-height: 1.32;
    color: var(--gm-gold);
}

.ec-dossier-logo-box {
    inline-size: 2.9rem;
    block-size: 2.9rem;
    border-radius: 13px;
    border: 1px solid rgba(164, 120, 43, 0.25);
    background: #ffffff;
    display: grid;
    place-items: center;
    padding: 0.3rem;
    box-shadow: 0 4px 12px rgba(28, 25, 23, 0.07);
    flex-shrink: 0;
}

.ec-dossier-logo-box img {
    inline-size: 2.15rem;
    block-size: 2.15rem;
    object-fit: contain;
}

.ec-close-round {
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid rgba(28, 25, 23, 0.16);
    background: #ffffff;
    color: var(--gm-ink);
    flex-shrink: 0;
    cursor: pointer;
}

.ec-close-round:hover {
    background: #fee2e2;
    border-color: #ef4444;
    color: #991b1b;
}

.ec-plaque-tag {
    display: inline-block;
    padding: 0.24rem 0.65rem;
    border-radius: 999px;
    background: var(--gm-ink);
    color: #f8f5ef;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    flex-shrink: 0;
}

.ec-dossier-tabs[hidden] {
    display: none !important;
}

.ec-dossier-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.45rem 1rem;
    border-bottom: 1px solid rgba(28, 25, 23, 0.07);
    background: #f6f2e9;
}

.ec-dtab {
    padding: 0.32rem 0.82rem;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--gm-muted);
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
}

.ec-dtab.is-active {
    background: #ffffff;
    border-color: var(--gm-border);
    color: var(--gm-ink);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.ec-dossier-body {
    flex: 1;
    padding: 0.9rem 1.05rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    font-size: 0.95rem;
    line-height: 1.52;
}

.ec-dossier-body ul {
    font-size: 0.92rem;
    line-height: 1.48;
}

.ec-dossier-foot {
    padding: 0.7rem 1rem max(0.7rem, env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgba(28, 25, 23, 0.08);
    background: #f7f3eb;
    display: grid;
    gap: 0.45rem;
}

/* Tablas Responsivas con Container Queries y tipografía cómoda */
.ec-table-wrapper {
    overflow: auto;
    max-inline-size: 100%;
    max-block-size: min(440px, 56dvh);
    container-type: inline-size;
    border-radius: 12px;
}

.ec-mini-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 1rem;
    line-height: 1.5;
}

.ec-mini-table caption {
    caption-side: top;
    font-weight: 800;
    font-size: 0.94rem;
    color: var(--gm-gold);
    text-transform: uppercase;
    padding-bottom: 0.45rem;
}

.ec-mini-table th,
.ec-mini-table td {
    padding: 0.55rem 0.65rem;
    border-bottom: 1px solid rgba(28, 25, 23, 0.1);
    text-align: start;
    vertical-align: top;
}

.ec-mini-table thead {
    position: sticky;
    inset-block-start: 0;
    z-index: 2;
}

.ec-mini-table thead th {
    background: #ebe4d6;
    color: var(--gm-ink);
    font-weight: 800;
}

.ec-mini-table tbody th {
    position: sticky;
    inset-inline-start: 0;
    background: #faf7f0;
    font-weight: 800;
    z-index: 1;
}

@container (width < 410px) {
    .ec-mini-table,
    .ec-mini-table thead,
    .ec-mini-table tbody,
    .ec-mini-table tr,
    .ec-mini-table th,
    .ec-mini-table td {
        display: block;
    }

    .ec-mini-table thead {
        display: none;
    }

    .ec-mini-table tr {
        margin-block-end: 0.7rem;
        border: 1px solid rgba(164, 120, 43, 0.28);
        border-radius: 12px;
        background: #ffffff;
        overflow: hidden;
    }

    .ec-mini-table tbody th {
        position: sticky;
        inset-block-start: 0;
        background: #efe8da;
        color: var(--gm-ink);
        border-bottom: 1px solid rgba(28, 25, 23, 0.08);
    }

    .ec-mini-table td:nth-child(2)::before {
        content: var(--label-2, "") ": ";
        font-weight: 800;
        color: var(--gm-gold);
    }

    .ec-mini-table td:nth-child(3)::before {
        content: var(--label-3, "") ": ";
        font-weight: 800;
        color: var(--gm-gold);
    }

    .ec-mini-table td:nth-child(4)::before {
        content: var(--label-4, "") ": ";
        font-weight: 800;
        color: var(--gm-gold);
    }

    .ec-mini-table td:nth-child(5)::before {
        content: var(--label-5, "") ": ";
        font-weight: 800;
        color: var(--gm-gold);
    }
}

/* ==========================================================================
   CONTROLES TÁCTILES INFERIORES CON BOTÓN DE ACCIÓN LEGIBLE
   ========================================================================== */
.ec-bottom-hud {
    position: absolute;
    left: max(14px, env(safe-area-inset-left, 0px));
    right: max(14px, env(safe-area-inset-right, 0px));
    bottom: max(14px, env(safe-area-inset-bottom, 0px));
    z-index: 12;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.ec-joystick {
    width: 102px;
    height: 102px;
    pointer-events: auto;
    touch-action: none;
    flex-shrink: 0;
}

.ec-joystick-ring {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1.5px solid var(--gm-border);
    background: rgba(250, 247, 241, 0.86);
    box-shadow: 0 8px 24px rgba(28, 25, 23, 0.16);
    backdrop-filter: blur(8px);
    position: relative;
    display: grid;
    place-items: center;
}

.ec-joy-dir {
    position: absolute;
    font-size: 0.72rem;
    color: rgba(28, 25, 23, 0.42);
    pointer-events: none;
}
.ec-joy-n { top: 5px; left: 50%; transform: translateX(-50%); }
.ec-joy-s { bottom: 5px; left: 50%; transform: translateX(-50%); }
.ec-joy-w { left: 5px; top: 50%; transform: translateY(-50%); }
.ec-joy-e { right: 5px; top: 50%; transform: translateY(-50%); }

.ec-joystick-knob {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    background: linear-gradient(135deg, var(--gm-ink), #44403c);
    color: #f8f5ef;
    display: grid;
    place-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
    cursor: grab;
}

.ec-right-hud {
    display: flex;
    align-items: center;
    gap: 8px;
    min-inline-size: 0;
    pointer-events: auto;
}

.ec-inspect-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    min-block-size: 3.65rem;
    max-inline-size: min(23.5rem, calc(100dvw - 8rem));
    padding: 0.6rem 1.15rem 0.6rem 0.7rem;
    border-radius: 999px;
    border: 1.5px solid rgba(28, 25, 23, 0.18);
    background: rgba(250, 247, 241, 0.94);
    color: var(--gm-muted);
    box-shadow: 0 8px 24px rgba(28, 25, 23, 0.15);
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
}

.ec-inspect-btn .ec-inspect-icon {
    width: 2.55rem;
    height: 2.55rem;
    border-radius: 50%;
    background: rgba(28, 25, 23, 0.08);
    display: grid;
    place-items: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.ec-inspect-btn .ec-inspect-text {
    display: flex;
    flex-direction: column;
    text-align: start;
    line-height: 1.25;
    min-inline-size: 0;
}

.ec-inspect-btn .ec-inspect-text strong {
    font-size: 1.05rem;
    font-weight: 900;
    letter-spacing: 0.02em;
}

.ec-inspect-btn .ec-inspect-text small {
    font-size: 0.94rem;
    font-weight: 600;
    line-height: 1.25;
}

.ec-inspect-btn.is-ready {
    border-color: var(--gm-gold-light);
    background: var(--gm-ink);
    color: #f8f5ef;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(28, 25, 23, 0.34);
}

.ec-inspect-btn.is-ready .ec-inspect-icon {
    background: var(--gm-gold-light);
    color: var(--gm-ink);
}

.ec-inspect-btn.is-sitting {
    border-color: var(--gm-emerald);
    background: linear-gradient(135deg, var(--gm-emerald), var(--gm-emerald-dark));
    color: #ffffff;
    cursor: pointer;
}

.ec-inspect-btn.is-sitting .ec-inspect-icon {
    background: #ffffff;
    color: var(--gm-emerald-dark);
}

.ec-zoom-stack {
    display: flex;
    gap: 5px;
}

.ec-zoom-stack button {
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--gm-border);
    background: var(--gm-paper);
    color: var(--gm-ink);
    font-size: 1rem;
    cursor: pointer;
}

/* Cajón Mapa / Pasaporte de la Exposición */
.ec-drawer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 24;
    width: min(24rem, 94dvw);
    padding: 1.1rem max(1.1rem, env(safe-area-inset-right, 0px)) max(1.1rem, env(safe-area-inset-bottom, 0px)) 1.1rem;
    background: rgba(252, 250, 246, 0.99);
    border-left: 1px solid var(--gm-border);
    box-shadow: -16px 0 45px rgba(28, 25, 23, 0.18);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.ec-drawer-list {
    display: grid;
    gap: 0.45rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    flex: 1;
}

.ec-drawer-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    padding: 0.65rem 0.85rem;
    border-radius: 13px;
    border: 1px solid rgba(28, 25, 23, 0.12);
    background: #ffffff;
    color: var(--gm-ink);
    font-size: 0.94rem;
    font-weight: 700;
    line-height: 1.3;
    text-align: start;
    cursor: pointer;
}

.ec-drawer-item img {
    inline-size: 1.65rem;
    block-size: 1.65rem;
    object-fit: contain;
    flex-shrink: 0;
}

.ec-drawer-item:hover,
.ec-drawer-item.is-active {
    border-color: var(--gm-gold);
    background: #faf5ea;
}

.ec-drawer-check {
    margin-left: auto;
    opacity: 0.2;
    color: var(--gm-emerald);
    font-size: 1.05rem;
}

.ec-drawer-item.is-visited .ec-drawer-check {
    opacity: 1;
}

/* ==========================================================================
   MINIJUEGOS A PANTALLA COMPLETA HASTA EL NAVBAR: FLAPPY + TRIVIA COPILOT
   ========================================================================== */
.ec-minigame-layer {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    padding: 0;
    background: #fcfaf6;
}

.ec-arcade-card {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #0f172a;
    color: #f8f5ef;
}

.ec-arcade-hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.55rem max(0.75rem, env(safe-area-inset-right, 0px)) 0.55rem max(0.75rem, env(safe-area-inset-left, 0px));
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.88) 0%, rgba(15, 23, 42, 0) 100%);
}

.ec-arcade-title {
    font-size: 1.02rem;
    font-weight: 800;
    color: #ffffff;
}

.ec-arcade-card img {
    inline-size: 1.75rem;
    block-size: 1.75rem;
    object-fit: contain;
}

.ec-arcade-card img.ec-arcade-hero-logo {
    inline-size: 3rem;
    block-size: 3rem;
}

.ec-arcade-copy {
    max-inline-size: 38ch;
    font-size: 0.96rem;
    line-height: 1.48;
}

.ec-arcade-canvas-box {
    position: relative;
    flex: 1;
    width: 100%;
    height: 100%;
    min-block-size: 0;
    border: 0;
    border-radius: 0;
    background: #0f172a;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
}

.ec-arcade-canvas-box canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

.ec-arcade-start[hidden] {
    display: none !important;
}

.ec-arcade-start {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    text-align: center;
    background: rgba(15, 23, 42, 0.88);
    color: #f8f5ef;
}

/* TRIVIA COPILOT A PANTALLA COMPLETA HASTA EL NAVBAR Y LETRA EQUILIBRADA */
.ec-quiz-card {
    width: 100%;
    height: 100%;
    max-block-size: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.8rem max(0.85rem, env(safe-area-inset-right, 0px)) max(0.9rem, env(safe-area-inset-bottom, 0px)) max(0.85rem, env(safe-area-inset-left, 0px));
    border: 0;
    border-radius: 0;
    background: linear-gradient(180deg, #faf5ea 0%, #fcfaf6 40%, #ffffff 100%);
    color: var(--gm-ink);
    user-select: text;
}

.ec-quiz-inner {
    width: min(42rem, 100%);
    margin-inline: auto;
}

.ec-quiz-main-title {
    font-size: 1.08rem;
    font-weight: 800;
}

.ec-quiz-top img {
    inline-size: 1.75rem;
    block-size: 1.75rem;
    object-fit: contain;
    flex-shrink: 0;
}

.ec-quiz-stats-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.ec-quiz-stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.68rem;
    border-radius: 999px;
    background: #1c1917;
    color: #fef3c7;
    font-size: 0.82rem;
    font-weight: 800;
}

.ec-quiz-stat-pill.is-streak {
    background: linear-gradient(135deg, #ea580c, #b45309);
    color: #ffffff;
}

.ec-quiz-lifeline-btn {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.72rem;
    border-radius: 999px;
    border: 1.5px solid #7c3aed;
    background: #f5f3ff;
    color: #5b21b6;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.16s ease;
}

.ec-quiz-lifeline-btn:hover:not(:disabled) {
    background: #ede9fe;
    transform: translateY(-1px);
}

.ec-quiz-lifeline-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.ec-quiz-segments {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 4px;
    margin-bottom: 6px;
}

.ec-quiz-seg {
    height: 6px;
    border-radius: 999px;
    background: rgba(28, 25, 23, 0.12);
    transition: background 0.25s ease, transform 0.2s ease;
}

.ec-quiz-seg.is-current {
    background: var(--gm-gold);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.32);
}

.ec-quiz-seg.is-hit {
    background: #16a34a;
}

.ec-quiz-seg.is-miss {
    background: #dc2626;
}

.ec-quiz-timer-wrap {
    height: 5px;
    border-radius: 999px;
    background: rgba(28, 25, 23, 0.08);
    overflow: hidden;
    margin-bottom: 0.65rem;
}

.ec-quiz-timer-bar {
    height: 100%;
    width: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #0a7c53, #d4af37);
    transition: width 0.2s linear;
}

.ec-quiz-scenario-box {
    padding: 0.75rem 0.9rem;
    border-radius: 15px;
    border: 1px solid rgba(164, 120, 43, 0.28);
    background: #ffffff;
    box-shadow: 0 6px 18px rgba(28, 25, 23, 0.05);
}

.ec-quiz-case-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: rgba(10, 124, 83, 0.12);
    color: var(--gm-emerald-dark);
    font-size: 0.76rem;
    font-weight: 900;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

#ecQuizSpeedBonusTag {
    font-size: 0.8rem;
}

.ec-quiz-question-text {
    font-size: clamp(0.92rem, 0.88rem + 0.25vw, 1.02rem);
    font-weight: 700;
    line-height: 1.44;
    color: var(--gm-ink);
    margin-top: 0.35rem;
}

.ec-quiz-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    margin-top: 0.65rem;
}

.ec-quiz-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-block-size: 3.35rem;
    padding: 0.55rem 0.75rem;
    border-radius: 14px;
    border: 1.5px solid rgba(28, 25, 23, 0.15);
    background: #ffffff;
    color: var(--gm-ink);
    text-align: start;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(28, 25, 23, 0.04);
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, opacity 0.2s ease;
}

.ec-quiz-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: var(--gm-gold);
    background: #fdf9f0;
}

.ec-quiz-btn.is-eliminated {
    opacity: 0.32;
    pointer-events: none;
    filter: grayscale(1);
}

.ec-quiz-opt-logo {
    inline-size: 2.2rem;
    block-size: 2.2rem;
    border-radius: 10px;
    background: #f8f5ef;
    border: 1px solid rgba(28, 25, 23, 0.08);
    display: grid;
    place-items: center;
    padding: 0.22rem;
    flex-shrink: 0;
}

.ec-quiz-opt-logo img {
    inline-size: 1.65rem;
    block-size: 1.65rem;
    object-fit: contain;
}

.ec-quiz-opt-copy {
    display: flex;
    flex-direction: column;
    min-inline-size: 0;
    flex: 1;
}

.ec-quiz-opt-copy strong {
    font-size: 0.91rem;
    font-weight: 800;
    line-height: 1.24;
}

.ec-quiz-opt-copy small {
    font-size: 0.79rem;
    line-height: 1.3;
    color: var(--gm-muted);
    margin-top: 0.12rem;
}

.ec-quiz-btn.is-correct {
    border-color: #15803d;
    background: linear-gradient(135deg, #dcfce7, #f0fdf4);
    color: #14532d;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.2);
}

.ec-quiz-btn.is-wrong {
    border-color: #b91c1c;
    background: #fef2f2;
    color: #7f1d1d;
}

.ec-quiz-feedback {
    margin-top: 0.6rem;
    padding: 0.65rem 0.85rem;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.44;
}

.ec-quiz-feedback.is-good {
    border: 1px solid #86efac;
    background: #f0fdf4;
    color: #14532d;
}

.ec-quiz-feedback.is-retry {
    border: 1px solid #fde68a;
    background: #fffbeb;
    color: #78350f;
}

.ec-quiz-footer {
    margin-top: 0.6rem;
}

.ec-quiz-summary {
    text-align: center;
    padding: 0.5rem 0.2rem;
    font-size: 0.95rem;
}

.ec-cert-card {
    padding: 1.25rem;
    border-radius: 20px;
    border: 2px solid var(--gm-gold);
    background: radial-gradient(circle at top, #fffbeb 0%, #faf5ea 100%);
    box-shadow: inset 0 0 0 4px rgba(212, 175, 55, 0.15);
}

.ec-cert-logos {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    margin: 0.85rem 0;
}

.ec-cert-logos img {
    inline-size: auto;
    max-inline-size: 4.4rem;
    block-size: 2.4rem;
    object-fit: contain;
    padding: 0.3rem 0.45rem;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid rgba(164, 120, 43, 0.25);
}

/* ==========================================================================
   DIÁLOGOS NATIVOS (<dialog>) CON TIPOGRAFÍA MÓVIL CÓMODA (1rem EN INPUTS)
   ========================================================================== */
dialog.ec-dialog {
    padding: 0;
    border: 1.5px solid var(--gm-border);
    border-radius: 26px;
    background: #fcfaf6;
    color: var(--gm-ink);
    width: min(58rem, calc(100dvw - 1.25rem));
    max-block-size: calc(100dvh - 1.5rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    box-shadow: 0 32px 90px rgba(0, 0, 0, 0.42);
    user-select: text;
}

dialog.ec-dialog.is-quote-simple {
    width: min(40rem, calc(100dvw - 1.25rem));
}

dialog.ec-dialog.is-compact {
    width: min(36rem, calc(100dvw - 1.25rem));
}

.ec-solutions-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.ec-input:user-invalid {
    border-color: #dc2626;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.14);
}

dialog.ec-dialog[open] {
    display: flex;
    flex-direction: column;
}

dialog.ec-dialog:modal {
    overscroll-behavior: contain;
}

dialog.ec-dialog::backdrop {
    overflow: hidden;
    overscroll-behavior: contain;
    background: rgba(20, 18, 15, 0.62);
    backdrop-filter: blur(6px);
}

.ec-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(28, 25, 23, 0.1);
    background: #f5efe4;
}

.ec-dialog-header img.ec-copilot-header-logo {
    inline-size: 2.25rem;
    block-size: 2.25rem;
    object-fit: contain;
    flex-shrink: 0;
}

.ec-dialog-header img.ec-ionet-header-logo {
    inline-size: auto;
    max-inline-size: 5rem;
    block-size: 1.55rem;
    object-fit: contain;
    flex-shrink: 0;
}

.ec-dialog-body {
    padding: 1.25rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.ec-quote-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.7rem;
    border-radius: 13px;
    border: 1px solid rgba(28, 25, 23, 0.15);
    background: #ffffff;
    cursor: pointer;
    transition: all 0.16s ease;
}

.ec-quote-option:hover {
    border-color: var(--gm-gold);
}

.ec-quote-option:has(input:checked) {
    border-color: var(--gm-emerald);
    background: #f0fdf4;
    box-shadow: 0 0 0 2px rgba(10, 124, 83, 0.14);
}

.ec-quote-option input[type="checkbox"] {
    width: 1.3rem;
    height: 1.3rem;
    accent-color: var(--gm-emerald);
    flex-shrink: 0;
}

.ec-quote-prod-logo {
    inline-size: 2rem;
    block-size: 2rem;
    object-fit: contain;
    flex-shrink: 0;
}

.ec-quote-copy {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-inline-size: 0;
}

.ec-quote-copy strong {
    font-size: 0.93rem;
    line-height: 1.22;
}

.ec-quote-desc {
    font-size: 0.8rem;
    line-height: 1.3;
    color: var(--gm-muted);
}

/* >= 1rem evita también el auto-zoom forzado de Safari en iOS al tocar campos */
.ec-input {
    width: 100%;
    min-block-size: var(--target-size);
    padding: 0.6rem 0.85rem;
    border-radius: 11px;
    border: 1px solid rgba(28, 25, 23, 0.22);
    background: #ffffff;
    color: var(--gm-ink);
    font-size: 1.05rem;
}

.ec-btn-emerald {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-block-size: 3.05rem;
    padding: 0.7rem 1.25rem;
    border-radius: 999px;
    border: 0;
    background: linear-gradient(135deg, var(--gm-emerald) 0%, var(--gm-emerald-dark) 100%);
    color: #ffffff;
    font-weight: 800;
    font-size: 1.04rem;
    line-height: 1.28;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(10, 124, 83, 0.25);
}

.ec-btn-emerald:hover {
    color: #ffffff;
    filter: brightness(1.06);
}

.ec-btn-gold {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-block-size: 3.05rem;
    padding: 0.65rem 1.15rem;
    border-radius: 999px;
    border: 1px solid var(--gm-gold);
    background: #faf4e6;
    color: #6b4c14;
    font-weight: 800;
    font-size: 1.02rem;
    line-height: 1.28;
    text-decoration: none;
    cursor: pointer;
}

.ec-btn-gold:hover {
    background: #f3e6c8;
    color: #4a340b;
}

.ec-social-tile {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.85rem 1rem;
    border-radius: 16px;
    border: 1px solid rgba(28, 25, 23, 0.14);
    background: #ffffff;
    color: var(--gm-ink);
    font-size: 1.05rem;
    text-decoration: none;
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.ec-social-tile:hover {
    transform: translateY(-2px);
    border-color: var(--gm-emerald);
    color: var(--gm-ink);
}

.ec-social-badge {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: #ffffff;
    font-size: 1.35rem;
    flex-shrink: 0;
}

/* ==========================================================================
   ADAPTACIÓN RESPONSIVA PARA TABLETS Y TELÉFONOS MÓVILES
   ========================================================================== */
@media (min-width: 72em) {
    .ec-menu-trigger {
        display: none;
    }
}

@media (max-width: 71.99em) {
    .ec-desktop-wings,
    .ec-hide-tablet {
        display: none !important;
    }
}

@media (max-width: 61.99em) {
    .ec-desktop-only-hud {
        display: none !important;
    }
}

@media (max-width: 47.99em) {
    .ec-hide-mobile {
        display: none !important;
    }

    .ec-sheet-grabber {
        display: block;
    }

    .ec-dossier {
        left: 0.65rem;
        right: 0.65rem;
        top: auto;
        bottom: max(0.65rem, env(safe-area-inset-bottom, 0px));
        width: auto;
        max-block-size: 64dvh;
        border-radius: 22px;
    }

    .ec-stage-wrap:has(.ec-dossier:not([hidden]), .ec-curator-box:not([hidden])) .ec-bottom-hud {
        opacity: 0;
        pointer-events: none;
        transform: translateY(18px);
    }

    .ec-curator-choices,
    .ec-quiz-grid,
    .ec-solutions-grid {
        grid-template-columns: 1fr;
    }

    .ec-quiz-card {
        padding: 1.05rem;
        border-radius: 22px;
    }

    .ec-joystick {
        width: 96px;
        height: 96px;
    }
}

@media (max-width: 28em) {
    .ec-hide-xs {
        display: none !important;
    }

    .ec-popover-wings {
        grid-template-columns: 1fr;
    }

    dialog.ec-dialog {
        width: 100dvw;
        max-block-size: 94dvh;
        margin-bottom: 0;
        border-radius: 22px 22px 0 0;
    }
}

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