/* Recorrido Virtual — Naturaleza  
// Autor: Christian Huanchicay Valenzuela
// 2026
*/

/* ── Variables globales ────────────────────────────────── */
:root {
    --bg:            #f7f5f0;       /* Blanco cálido natural */
    --panel:         #ffffff;       /* Panel limpio */
    --panel-alt:     #f0ede6;       /* Panel alternativo cálido */
    --steel:         #e8e4db;       /* Tono arena claro */
    --steel-light:   #d6d0c4;       /* Arena más oscuro */
    --accent:        #3a7d44;       /* Verde bosque */
    --accent-hover:  #2d6234;       /* Verde bosque profundo */
    --danger:        #c1121f;
    --text:          #2c3e2d;       /* Verde muy oscuro / casi negro */
    --text-dim:      #6b7c6e;       /* Verde grisáceo */
    --border:        #ccc8bf;       /* Borde arena suave */
    --border-accent: #3a7d44;       /* Verde bosque */
}

/* ── Base ───────────────────────────────────────────────── */
html, body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    height: 100%;
    width: 100%;
    font-family: 'Barlow Condensed', Arial, sans-serif;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    background-color: var(--bg);
    color: var(--text);
}

button {
    font-family: 'Barlow Condensed', Arial, sans-serif;
    letter-spacing: 0.06em;
}

/* ── Splash Screen ─────────────────────────────────────── */
#splashScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100vh;
    background-color: var(--bg);
    z-index: 10000;
    box-sizing: border-box;
    padding: env(safe-area-inset-top) env(safe-area-inset-right)
             env(safe-area-inset-bottom) env(safe-area-inset-left);
    opacity: 1;
    transition: opacity 1.2s cubic-bezier(0.65, 0, 0.35, 1);
}

/* Franja de acento superior */
#splashScreen::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), #6dbf7e, var(--accent));
}

/* Franja de acento inferior */
#splashScreen::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), #6dbf7e, var(--accent));
}

#splashScreen img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50%;
    max-width: 360px;
    height: auto;
    display: block;
}

/* ── Footer 1 — barra de carga ─────────────────────────── */
#footer1 {
    color: var(--accent);
    text-align: center;
    position: fixed;
    bottom: 0;
    width: 100%;
    padding: 9px 0;
    background-color: rgba(247, 245, 240, 0.97);
    border-top: 1px solid var(--border);
    z-index: 1000;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

/* ── Image Overlay ─────────────────────────────────────── */
/* ── Logo top-left ─────────────────────────────────────── */
.main-content {
    position: absolute;
    top: 10px; left: 10px;
    display: flex;
    align-items: center;
    z-index: 1001;
}

.main-content img {
    width: auto;
    max-width: 100px;
    height: auto;
}

/* ── HUD: contador de estaciones (oculto) ──────────────── */
#boxCounter {
    display: none !important;
}

/* ── Popup Overlay ─────────────────────────────────────── */
#popupOverlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(44, 62, 45, 0.45);
    z-index: 10002;
    transition: opacity 0.3s ease;
    pointer-events: auto;
}

#popupOverlay.visible {
    display: block;
    opacity: 1;
}

/* ── Welcome Popup ─────────────────────────────────────── */
#welcomePopup {
    display: none;
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background-color: var(--panel);
    border: 1px solid var(--border);
    border-top: 4px solid var(--accent);
    border-radius: 8px;
    padding: 30px 26px 24px;
    box-shadow: 0 8px 40px rgba(44, 62, 45, 0.18), 0 2px 12px rgba(58, 125, 68, 0.1);
    z-index: 10003;
    max-width: 90%;
    width: 420px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-sizing: border-box;
}

#welcomePopup.visible {
    display: block;
    opacity: 1;
    animation: zoomIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

#welcomePopup h2 {
    font-family: 'DM Serif Display', serif;
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin: 0 0 6px;
    color: var(--accent);
}

#welcomePopup h3 {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin: 0 0 16px;
    color: var(--text);
}

#welcomePopup p {
    font-size: 0.95rem;
    line-height: 1.55;
    margin: 0 0 20px;
    color: var(--text-dim);
    text-align: center;
}

#startTourButton {
    background-color: var(--accent);
    color: #ffffff;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 10px 30px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    touch-action: manipulation;
}

#startTourButton:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

/* ── Popup Info genérico ───────────────────────────────── */
/* ── Product Popup — world-anchored card ───────────────── */
#productPopup {
    display: none;
    position: fixed;
    /* left / top se asignan en JS cada frame */
    width: 280px;
    max-height: 70vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    background-color: rgba(255, 255, 255, 0.20);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(204,200,191,0.6);
    border-left: 3px solid var(--accent);
    border-radius: 10px;
    padding: 0 0 12px;
    box-shadow: 0 6px 28px rgba(44,62,45,0.18), 0 1px 6px rgba(58,125,68,0.10);
    z-index: 10003;
    color: var(--text);
    box-sizing: border-box;
    transition: opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
    opacity: 0;
    transform: scale(0.88);
    transform-origin: left center;
    will-change: opacity, transform;
}

#productPopup.open { display: block; }

#productPopup.world-anchored.visible {
    opacity: 1;
    transform: scale(1);
}

/* 1. Carrusel primero — altura se adapta a la imagen */
#productPopup .carousel {
    position: relative;
    width: 100%;
    height: auto;
    min-height: unset;
    max-height: unset;
    overflow: hidden;
    background-color: var(--panel-alt);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

#productPopup .carousel img {
    position: relative;
    top: auto; left: auto;
    width: 100%;
    height: auto;
    object-fit: unset;
    opacity: 0;
    transition: opacity 0.5s ease;
    background-color: var(--panel-alt);
    display: block;
}

/* Las inactivas se sacan del flujo para no ocupar espacio vertical */
#productPopup .carousel img:not(.active) {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
}

#productPopup .carousel img.active { opacity: 1; }

/* Contenedor de texto con padding */
#productPopup .popup-body {
    padding: 16px 18px 0;
}

/* 2. Título */
#productPopup h2 {
    font-family: 'DM Serif Display', serif;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin: 0 0 6px;
    padding-right: 28px; /* espacio para el botón cerrar */
    color: #ffffff;
    line-height: 1.2;
}

/* 3. Descripción — sin scroll propio, fluye naturalmente */
#productPopup .description {
    font-size: 0.88rem;
    line-height: 1.5;
    margin: 0 0 14px;
    color: #ffffff;
}

/* 4. Fila precio + botón juntos — peso visual equilibrado */
#productPopup .popup-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 18px 0;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}

#productPopup .buy-button {
    flex: 1;
    max-width: 200px;
    padding: 11px 20px;
    background-color: var(--accent);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: background-color 0.2s ease, transform 0.1s ease;
    touch-action: manipulation;
    min-height: 44px;
}

#productPopup .buy-button:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

/* Botón cerrar */
#productPopup #closeProductPopup {
    position: absolute;
    top: 8px; right: 8px;
    width: 28px;
    height: 28px;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-dim);
    background: rgba(255,255,255,0.9);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    z-index: 2;
    /* área táctil ampliada sin agrandar visualmente el botón */
    padding: 0;
    touch-action: manipulation;
}
#productPopup #closeProductPopup::after {
    content: '';
    position: absolute;
    inset: -8px;
}
#productPopup #closeProductPopup:hover {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ── Product Popup responsive ──────────────────────────── */
@media (max-width: 480px) {
    #productPopup { width: 240px; }
    #productPopup .carousel { height: auto; min-height: unset; }
    #productPopup h2 { font-size: 0.95rem; }
}

@media (max-height: 500px) and (orientation: landscape) {
    #productPopup { width: 220px; max-height: 80vh; }
    #productPopup .carousel { height: auto; min-height: unset; max-height: unset; }
    #productPopup h2 { font-size: 0.95rem; }
    #productPopup .description { font-size: 0.78rem; }
}


#rewardPopup {
    display: none;
    position: fixed;
    bottom: -100%;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    background-color: var(--panel);
    border: 1px solid var(--border);
    border-top: 4px solid var(--accent);
    border-radius: 12px 12px 0 0;
    padding: 24px 20px;
    box-shadow: 0 -4px 20px rgba(44, 62, 45, 0.15);
    z-index: 10003;
    color: var(--text);
    transition: bottom 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    box-sizing: border-box;
}

#rewardPopup.visible { bottom: 40px; }

#rewardPopup h2 {
    font-family: 'DM Serif Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-align: center;
    margin: 0 0 10px;
    color: var(--accent);
}

#rewardPopup p {
    font-size: 0.95rem;
    margin-bottom: 16px;
    text-align: center;
    color: var(--text-dim);
}

#rewardPopup button {
    display: block;
    margin: 0 auto;
    padding: 10px 30px;
    background-color: var(--accent);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: background-color 0.2s ease, transform 0.1s ease;
    touch-action: manipulation;
}

#rewardPopup button:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

/* ── Footer 2 ──────────────────────────────────────────── */
#footer2 {
    color: var(--text-dim);
    text-align: center;
    position: fixed;
    bottom: 0;
    width: 100%;
    background-color: rgba(247, 245, 240, 0.97);
    border-top: 1px solid var(--border);
    padding: 8px 0;
    z-index: 1002;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

/* ── Botón social (oculto) ─────────────────────────────── */
.social-button-container {
    display: none !important;
}

.social-main-button {
    width: 48px; height: 48px;
    background-color: var(--panel);
    border: 2px solid var(--accent);
    border-radius: 2px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    box-shadow: 0 0 10px rgba(240, 180, 41, 0.18);
    -webkit-tap-highlight-color: transparent;
}

.social-main-button .icon { color: var(--accent); font-size: 20px; }
.social-main-button:hover { background-color: var(--steel); transform: scale(1.05); }

.social-buttons {
    position: absolute;
    bottom: 60px; right: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: all 0.25s ease;
}

.social-button-container.active .social-buttons {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.social-child-button {
    width: 40px; height: 40px;
    background-color: var(--steel);
    border: 1px solid var(--border);
    border-radius: 2px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.social-child-button .icon { color: var(--text-dim); font-size: 18px; }

.social-child-button:hover {
    border-color: var(--accent);
    transform: scale(1.05);
}
.social-child-button:hover .icon { color: var(--accent); }

/* ── Botón lista ───────────────────────────────────────── */
.list-button-container {
    position: fixed;
    bottom: 60px; right: 20px;
    z-index: 1001;
}

.list-main-button {
    width: 48px; height: 48px;
    background-color: var(--panel);
    border: 2px solid var(--accent);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    box-shadow: 0 2px 12px rgba(58, 125, 68, 0.2);
    -webkit-tap-highlight-color: transparent;
}

.list-main-button .icon { color: var(--accent); font-size: 20px; }
.list-main-button:hover { background-color: var(--steel); transform: scale(1.05); }

/* ── Popup de estaciones visitadas ─────────────────────── */
#openedBoxesPopup {
    display: none;
    position: fixed;
    bottom: -100%;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-top: 4px solid var(--accent);
    border-radius: 12px 12px 0 0;
    padding: 20px;
    box-shadow: 0 -4px 20px rgba(44, 62, 45, 0.15);
    z-index: 10003;
    color: var(--text);
    transition: bottom 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    box-sizing: border-box;
    max-height: 75vh;
    overflow-y: auto;
}

#openedBoxesPopup.visible { bottom: 40px; }

#openedBoxesPopup h2 {
    font-family: 'DM Serif Display', serif;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-align: center;
    margin: 0 0 16px;
    color: var(--accent);
}

#openedBoxesPopup #closeOpenedBoxesPopup {
    position: absolute;
    top: 10px; right: 12px;
    cursor: pointer;
    color: var(--text-dim);
    background: none;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    transition: color 0.2s ease;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 400;
}
#openedBoxesPopup #closeOpenedBoxesPopup:hover { color: var(--accent); }

.opened-boxes-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.opened-boxes-list .product-item {
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 500px;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    box-sizing: border-box;
}

.opened-boxes-list .product-item:hover {
    background-color: var(--steel);
}

.opened-boxes-list .product-item img {
    width: 120px;
    height: auto;
    border: 1px solid var(--border);
    margin-bottom: 12px;
    object-fit: cover;
}

.opened-boxes-list .product-item .content {
    flex-grow: 1;
    text-align: center;
    width: 100%;
}

.opened-boxes-list .product-item h2.name {
    font-family: 'DM Serif Display', serif;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0 0 6px;
    color: var(--text);
}

.opened-boxes-list .product-item p.description {
    font-size: 0.88rem;
    margin: 0 0 8px;
    color: var(--text-dim);
    line-height: 1.4;
}

.opened-boxes-list .product-item p.price {
    font-family: 'DM Serif Display', serif;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--accent);
    margin: 0 0 10px;
}

.opened-boxes-list .product-item a.buy-button {
    display: inline-block;
    padding: 6px 18px;
    background-color: var(--accent);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: background-color 0.2s ease, transform 0.1s ease;
    text-decoration: none;
}

.opened-boxes-list .product-item a.buy-button:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

/* ── Modo VR (Meta Quest / WebXR) ──────────────────────── */
body.vr-mode #boxCounter {
    font-size: 18px;
    padding: 8px 26px;
}

body.vr-mode .social-main-button,
body.vr-mode .list-main-button,
body.vr-mode #miniMapToggle {
    width: 64px;
    height: 64px;
}

body.vr-mode .social-main-button .icon,
body.vr-mode .list-main-button .icon,
body.vr-mode #miniMapToggle {
    font-size: 28px;
}

body.vr-mode #hintCard {
    padding: 28px 48px;
    gap: 16px;
}

body.vr-mode #hintIcon { font-size: 3rem; }
body.vr-mode #hintText { font-size: 1.3rem; }

/* ── Hint Overlay ──────────────────────────────────────── */
#hintOverlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    pointer-events: none;
    animation: hint-fade-in 0.5s ease forwards;
}

#hintOverlay.hint-fade-out {
    animation: hint-fade-out 0.4s ease forwards;
}

#hintCard {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border-accent);
    border-radius: 12px;
    padding: 20px 32px;
    box-shadow: 0 4px 20px rgba(58, 125, 68, 0.15);
    text-align: center;
}

#hintIcon {
    font-size: 2.2rem;
    animation: hint-pulse 1.2s ease-in-out infinite;
    line-height: 1;
}

#hintText {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0;
    line-height: 1.5;
}

@media (max-width: 480px) {
    #hintCard { padding: 16px 24px; }
    #hintIcon  { font-size: 1.8rem; }
    #hintText  { font-size: 0.88rem; }
}

/* ── Animaciones ───────────────────────────────────────── */
@keyframes hint-fade-in {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes hint-fade-out {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(0.92); }
}

@keyframes hint-pulse {
    0%, 100% { transform: scale(1);    opacity: 1; }
    50%       { transform: scale(1.18); opacity: 0.7; }
}


@keyframes zoomIn {
    from { transform: translate(-50%, -50%) scale(0.75); opacity: 0; }
    to   { transform: translate(-50%, -50%) scale(1);    opacity: 1; }
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 600px) {
    #openedBoxesPopup { padding: 14px; }
    #openedBoxesPopup h2 { font-size: 1.1rem; }
    .opened-boxes-list { gap: 10px; }
    .opened-boxes-list .product-item { padding: 10px; }
    .opened-boxes-list .product-item img { width: 100px; margin-bottom: 10px; }
    .opened-boxes-list .product-item h2.name { font-size: 1rem; }
    .opened-boxes-list .product-item p.description { font-size: 0.82rem; }
    .opened-boxes-list .product-item p.price { font-size: 1rem; }
    .opened-boxes-list .product-item a.buy-button { font-size: 0.85rem; }
}

@media (max-width: 480px) {
    .opened-boxes-list .product-item { padding: 8px; }
    .opened-boxes-list .product-item img { width: 90px; }
    .opened-boxes-list .product-item h2.name { font-size: 0.95rem; }
    .opened-boxes-list .product-item p.description { font-size: 0.8rem; }
    .opened-boxes-list .product-item p.price { font-size: 0.95rem; }
    .opened-boxes-list .product-item a.buy-button { padding: 5px 12px; font-size: 0.8rem; }
}

/* ── iOS / Safari ──────────────────────────────────────── */
@supports (-webkit-overflow-scrolling: touch) {
    #splashScreen {
        height: 100%;
        min-height: -webkit-fill-available;
        background-color: var(--bg);
    }
    #splashScreen img { width: 70%; max-width: 320px; }
}

@media only screen and (max-width: 450px) and (min-width: 360px) and (max-height: 900px) {
    #splashScreen img { width: 80%; max-width: 380px; }
}

audio { display: none; }



/* ── Mini-mapa de navegación (oculto) ──────────────────── */
#miniMap {
    display: none !important;
}

#miniMapToggle {
    width: 48px;
    height: 48px;
    background-color: var(--panel);
    border: 2px solid var(--accent);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    box-shadow: 0 2px 12px rgba(58, 125, 68, 0.2);
    -webkit-tap-highlight-color: transparent;
    color: var(--accent);
    font-size: 20px;
}

#miniMapToggle:hover {
    background-color: var(--steel);
    transform: scale(1.05);
}

#miniMapPanel {
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(44, 62, 45, 0.15);
    padding: 12px;
    min-width: 160px;
    max-width: 220px;
    display: none;
    flex-direction: column;
    gap: 4px;
    transform-origin: bottom left;
    animation: mapSlideIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

#miniMapPanel.open {
    display: flex;
}

@keyframes mapSlideIn {
    from { opacity: 0; transform: scale(0.88); }
    to   { opacity: 1; transform: scale(1); }
}

#miniMapTitle {
    font-family: 'DM Serif Display', serif;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0 0 6px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
}

/* SVG diagram container */
#miniMapDiagram {
    width: 100%;
}

#miniMapDiagram svg {
    width: 100%;
    height: auto;
    display: block;
}

/* Room nodes */
.map-room-node {
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.map-room-node:hover rect,
.map-room-node:hover circle {
    stroke: var(--accent-hover);
    filter: brightness(1.2);
}

.map-room-node.current rect,
.map-room-node.current circle {
    fill: rgba(240, 180, 41, 0.25);
    stroke: var(--accent);
    stroke-width: 2;
}

.map-room-label {
    font-family: 'DM Serif Display', serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    fill: var(--text);
    pointer-events: none;
}

.map-room-node.current .map-room-label {
    fill: var(--accent);
}

.map-conn-line {
    stroke: var(--border);
    stroke-width: 1.5;
    stroke-dasharray: 3 3;
    pointer-events: none;
}

/* YOU ARE HERE pulse */
.map-current-pulse {
    animation: mapPulse 1.6s ease-in-out infinite;
}

@keyframes mapPulse {
    0%, 100% { opacity: 0.3; r: 4; }
    50%       { opacity: 1;   r: 6; }
}

/* ── Etiquetas flotantes de hotspots ───────────────────── */
.poi-label {
    position: fixed;
    pointer-events: none;
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 5px;
    transform: translate(14px, -50%);
    opacity: 0;
    transition: opacity 0.25s ease;
    will-change: transform, opacity;
}

.poi-label.visible {
    opacity: 1;
}

.poi-label-text {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border-accent);
    color: var(--accent);
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(58, 125, 68, 0.15);
    line-height: 1.5;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.poi-label-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 5px rgba(240, 180, 41, 0.6);
    flex-shrink: 0;
    order: -1;
}

@media (max-width: 600px) {
    #miniMapPanel { min-width: 130px; max-width: 180px; }
    .poi-label-text { font-size: 0.62rem; padding: 2px 6px; max-width: 100px; }
    #miniMap { bottom: 60px; left: 14px; }
}

/* ── Botón toggle de giroscopio (deshabilitado) ─────────── */
#gyroToggle {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* (estados de gyroToggle eliminados — botón deshabilitado) */

/* ── Botón toggle de etiquetas de hotspots ─────────────── */
#labelsToggle {
    position: fixed;
    bottom: 104px;           /* 44px base + 48px botón audio + 12px gap */
    left: 16px;
    z-index: 1001;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background-color: var(--panel);
    color: var(--text-dim);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease,
                transform 0.2s ease,
                opacity 0.25s ease,
                border-color 0.25s ease,
                color 0.25s ease;
    box-shadow: 0 2px 12px rgba(58, 125, 68, 0.12);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    opacity: 0.55;
}

#labelsToggle:hover {
    background-color: var(--steel);
    transform: scale(1.05);
    opacity: 0.85;
}

#labelsToggle:active {
    transform: scale(0.93);
}

/* Estado activo — etiquetas visibles */
#labelsToggle.active {
    border-color: var(--accent);
    color: var(--accent);
    opacity: 1;
    animation: labels-pulse 2.8s ease-in-out infinite;
}

@keyframes labels-pulse {
    0%, 100% { box-shadow: 0 2px 12px rgba(58, 125, 68, 0.20); }
    50%       { box-shadow: 0 2px 20px rgba(58, 125, 68, 0.50); }
}

#labelsToggle.active:hover {
    background-color: var(--steel);
    border-color: var(--accent-hover);
    color: var(--accent-hover);
}

/* VR mode */
body.vr-mode #labelsToggle {
    width: 64px;
    height: 64px;
    font-size: 26px;
    bottom: 136px;
}

@media (max-width: 600px) {
    #labelsToggle { bottom: 96px; left: 12px; width: 44px; height: 44px; font-size: 16px; }
}

/* ── Botón toggle de audio ambiente ────────────────────── */
#bgAudioToggle {
    position: fixed;
    bottom: 44px;
    left: 16px;
    z-index: 1001;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    background-color: var(--panel);
    color: var(--accent);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease,
                transform 0.2s ease,
                opacity 0.25s ease,
                border-color 0.25s ease,
                color 0.25s ease;
    box-shadow: 0 2px 12px rgba(58, 125, 68, 0.2);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

#bgAudioToggle:hover {
    background-color: var(--steel);
    transform: scale(1.05);
}

#bgAudioToggle:active {
    transform: scale(0.93);
}

/* Pulso sutil de glow cuando hay sonido activo */
@keyframes bg-audio-pulse {
    0%, 100% { box-shadow: 0 2px 12px rgba(58, 125, 68, 0.20); }
    50%       { box-shadow: 0 2px 20px rgba(58, 125, 68, 0.50); }
}

#bgAudioToggle:not(.muted) {
    animation: bg-audio-pulse 2.8s ease-in-out infinite;
}

/* Estado silenciado — mismo icono apagado que el resto de la UI */
#bgAudioToggle.muted {
    opacity: 0.42;
    border-color: var(--border);
    color: var(--text-dim);
    animation: none;
}

#bgAudioToggle.muted:hover {
    opacity: 0.80;
    border-color: var(--accent);
    color: var(--accent);
    background-color: var(--steel);
}

/* VR mode — igual que list-main-button y miniMapToggle */
body.vr-mode #bgAudioToggle {
    width: 64px;
    height: 64px;
    font-size: 28px;
}

@media (max-width: 600px) {
    #bgAudioToggle { bottom: 40px; left: 12px; width: 44px; height: 44px; font-size: 18px; }
}

/* ── Botones de zoom 360° ───────────────────────────────── */
#zoomControls {
    position: fixed;
    bottom: 44px;
    right: 16px;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#zoomInBtn,
#zoomOutBtn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    background-color: var(--panel);
    color: var(--accent);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease,
                transform 0.2s ease,
                opacity 0.25s ease,
                border-color 0.25s ease,
                color 0.25s ease;
    box-shadow: 0 2px 12px rgba(58, 125, 68, 0.2);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

#zoomInBtn:hover,
#zoomOutBtn:hover {
    background-color: var(--steel);
    transform: scale(1.05);
}

#zoomInBtn:active,
#zoomOutBtn:active {
    transform: scale(0.93);
}

/* Estado límite: visual apagado, no interactuable */
#zoomInBtn.at-limit,
#zoomOutBtn.at-limit {
    opacity: 0.35;
    border-color: var(--border);
    color: var(--text-dim);
    cursor: default;
    pointer-events: none;
    animation: none;
    transform: none;
}

/* VR mode */
body.vr-mode #zoomInBtn,
body.vr-mode #zoomOutBtn {
    width: 64px;
    height: 64px;
    font-size: 28px;
}

@media (max-width: 600px) {
    #zoomControls  { bottom: 40px; right: 12px; gap: 16px; flex-direction: column; }
    #zoomInBtn,
    #zoomOutBtn    { width: 44px; height: 44px; font-size: 18px; }
}
/* ── Hotspot Audio Popup ─────────────────────────────────── */
#audioPopup {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.72);
    z-index: 10100;
    align-items: center;
    justify-content: center;
    display: none;
}

.audio-popup-inner {
    background: var(--panel);
    border-radius: 14px;
    padding: 2rem 1.5rem;
    max-width: 340px;
    width: 90%;
    text-align: center;
    position: relative;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.audio-popup-icon {
    font-size: 2.5rem;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

#audioPopup h2 {
    font-family: 'DM Serif Display', serif;
    font-size: 1.1rem;
    color: var(--text);
    margin: 0 0 0.5rem;
}

/* ── Hotspot Video Popup ─────────────────────────────────── */
#videoPopup {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 10100;
    align-items: center;
    justify-content: center;
    display: none;
    flex-direction: column;
    padding: 1rem;
}

.video-popup-inner {
    width: 100%;
    max-width: 720px;
    position: relative;
}

#videoPopup h2 {
    font-family: 'DM Serif Display', serif;
    font-size: 1.1rem;
    color: white;
    text-align: center;
    margin: 0 0 0.75rem;
}

.video-popup-frame-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    background: #000;
}

.video-popup-frame-wrapper iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: none;
}

/* ── Botón cerrar compartido ─────────────────────────────── */
.popup-close-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 32px; height: 32px;
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    line-height: 32px;
    text-align: center;
    cursor: pointer;
    z-index: 2;
    transition: background 0.2s;
}
.popup-close-btn:hover { background: var(--accent); }

#videoPopup .popup-close-btn {
    position: fixed;
    top: 1rem; right: 1rem;
}

/* ── Audio Popup — controles personalizados ──────────────── */
.audio-progress-wrap {
    width: 100%;
    height: 4px;
    background: rgba(0,0,0,0.12);
    border-radius: 2px;
    margin: 1rem 0 0.3rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.audio-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.1s linear;
    pointer-events: none;
}

.audio-time-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-bottom: 1rem;
    font-variant-numeric: tabular-nums;
}

.audio-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.audio-btn {
    background: none;
    border: 2px solid var(--border);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-dim);
    font-size: 1rem;
    transition: all 0.18s;
}

.audio-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: scale(1.08);
}

.audio-btn-play {
    width: 56px;
    height: 56px;
    font-size: 1.25rem;
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.audio-btn-play:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: white;
    transform: scale(1.08);
}

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