/* Housemates — palette from bubble overlay (BBG-start-overlay.js) */
:root {
    --hm-gold:    #FFD700;
    --hm-cyan:    #00f5ff;
    --hm-pink:    #ff00aa;
    --hm-green:   #22c55e;
    --hm-amber:   #f59e0b;
    --hm-violet:  #8b5cf6;
    --hm-rose:    #ec4899;
    --hm-sky:     #06b6d4;
    --hm-lime:    #84cc16;
    --hm-orange:  #f97316;
    --hm-purple:  #a855f7;
    --hm-teal:    #14b8a6;
}

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

/* Hide page until BBGPageLoader finishes */
html.bbg-loading .hm-page,
html.bbg-loading #hm-particles-canvas,
html.bbg-loading .hm-overlay {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}
html.bbg-ready .hm-page,
html.bbg-ready #hm-particles-canvas {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.35s ease;
}

/* Canvas de partículas glow al fondo */
#hm-particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

body {
    font-family: 'Mouse Memoirs', sans-serif;
    background: #1a1a1a;
    color: #fff;
    min-height: 100vh;
    padding: 20px 24px;
}

.hm-page,
.hm-overlay {
    position: relative;
    z-index: 1;
}

.hm-page {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
}

.hm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 2px solid rgba(255, 215, 0, 0.35);
}

.hm-title {
    font-family: 'Henny Penny', cursive;
    font-size: calc(2rem + 5px);
    letter-spacing: 0.06em;
    background: linear-gradient(135deg, var(--hm-gold), var(--hm-amber), var(--hm-orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hm-nav {
    display: flex;
    gap: 10px;
}

.hm-nav a, .hm-nav button {
    font-family: 'Mouse Memoirs', sans-serif;
    font-size: calc(1.25rem + 5px);
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    border: 2px solid rgba(255, 215, 0, 0.5);
    background: rgba(20, 20, 20, 0.95);
    color: var(--hm-gold);
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.15s;
}

.hm-nav a:hover, .hm-nav button:hover {
    box-shadow: 0 0 16px rgba(255, 215, 0, 0.4);
    transform: scale(1.03);
}

/* Grid of 12 housemates: 2 rows of 6 */
.hm-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    justify-content: center;
}

.hm-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 0 0 10px 0;
    border-radius: 12px;
    border: 2px solid var(--hm-glow, #333);
    background: #141414;
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 0 12px var(--hm-glow), 0 0 24px color-mix(in srgb, var(--hm-glow) 60%, transparent), 0 0 36px color-mix(in srgb, var(--hm-glow) 35%, transparent);
}

.hm-card:hover {
    transform: scale(1.05);
    box-shadow: 0 0 18px var(--hm-glow), 0 0 36px color-mix(in srgb, var(--hm-glow) 70%, transparent), 0 0 54px color-mix(in srgb, var(--hm-glow) 45%, transparent);
}

.hm-card-media {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 10px 10px 0 0;
}

.hm-card-media img,
.hm-card-media video,
.hm-card img,
.hm-card video {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 10px 10px 0 0;
    display: block;
    vertical-align: top;
}

.hm-card-tick {
    display: none;
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #1db954;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.hm-card.is-viewed .hm-card-tick {
    display: flex;
}

.hm-card-name {
    margin: 0;
    margin-top: 8px;
    padding: 0 6px;
    font-size: calc(1.9rem + 5px);
    color: #fff;
    text-align: center;
    line-height: 1.2;
}

/* Overlay */
.hm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.88);
}

.hm-overlay.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    gap: 16px;
    overflow: visible;
}

/* Panel con borde — parte superior */
.hm-overlay-panel {
    width: 95%;
    max-width: 1100px;
    height: 80vh;
    flex-shrink: 0;
    overflow: hidden;
    background: #1a1a1a;
    border-radius: 16px;
    border: 2px solid var(--hm-popup-glow, var(--hm-gold));
    box-shadow: 0 0 20px color-mix(in srgb, var(--hm-popup-glow, var(--hm-gold)) 60%, transparent), 0 0 44px color-mix(in srgb, var(--hm-popup-glow, var(--hm-gold)) 40%, transparent), 0 0 80px rgba(0,0,0,0.6);
    padding: 16px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Barra superior: título a la izquierda, TTS + X a la derecha */
.hm-overlay-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}

.hm-overlay-topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Cuerpo: foto + texto en fila */
.hm-overlay-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: row;
    gap: 20px;
    overflow: hidden;
}

/* Foto grande a la izquierda */
.hm-overlay-photo {
    width: 260px;
    min-width: 260px;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
    border: 3px solid var(--hm-popup-glow, var(--hm-gold));
    box-shadow: inset 0 0 20px color-mix(in srgb, var(--hm-popup-glow, var(--hm-gold)) 50%, transparent),
                inset 0 0 40px color-mix(in srgb, var(--hm-popup-glow, var(--hm-gold)) 25%, transparent);
    flex-shrink: 0;
}

/* Columna derecha: solo el texto */
.hm-overlay-head { display: none; }
.hm-overlay-info { display: none; }

.hm-overlay-right {
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

.hm-text-close {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 3;
    width: 36px;
    height: 36px;
    border: 2px solid #555;
    border-radius: 8px;
    background: #222;
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.hm-text-close:hover {
    border-color: var(--hm-popup-glow, var(--hm-gold));
    background: #333;
    transform: scale(1.06);
}

.hm-overlay-text {
    flex: 1;
    min-height: 0;
    max-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    font-size: clamp(calc(1.65rem + 5px), calc(2.8vw + 5px), calc(2.5rem + 5px));
    line-height: 1.55;
    color: var(--hm-popup-glow, var(--hm-gold));
    white-space: normal;
    word-wrap: break-word;
    padding: 4px 44px 0 0;
    scrollbar-width: thin;
    scrollbar-gutter: stable;
    scrollbar-color: color-mix(in srgb, var(--hm-popup-glow, var(--hm-gold)) 55%, #444) rgba(255, 255, 255, 0.06);
}

.hm-overlay-text::-webkit-scrollbar { width: 10px; }
.hm-overlay-text::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.06); border-radius: 4px; }
.hm-overlay-text::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--hm-popup-glow, var(--hm-gold)) 55%, #444);
    border-radius: 4px;
}

/* Fila de 10 fotos — fuera del panel, debajo */
.hm-overlay-scene-row {
    width: 95%;
    max-width: 1100px;
    flex-shrink: 0;
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 10px;
    overflow: visible;
    padding: 20px 0;
}

.hm-overlay-scene-row:empty { display: none; }

.hm-overlay-scene-row img {
    width: 100%;
    height: 90px;
    min-width: 0;
    border-radius: 6px;
    object-fit: cover;
    border: 2px solid var(--hm-popup-glow, var(--hm-gold));
    box-shadow: 0 0 8px color-mix(in srgb, var(--hm-popup-glow, var(--hm-gold)) 60%, transparent),
                0 0 18px color-mix(in srgb, var(--hm-popup-glow, var(--hm-gold)) 35%, transparent);
    display: block;
    cursor: pointer;
    transition: transform 0.18s ease, opacity 0.18s ease, outline 0.12s ease, box-shadow 0.18s ease;
}

.hm-overlay-scene-row img:hover {
    box-shadow: 0 0 14px var(--hm-popup-glow, var(--hm-gold)),
                0 0 30px color-mix(in srgb, var(--hm-popup-glow, var(--hm-gold)) 55%, transparent);
}

/* Pantalla completa al pasar el ratón por una miniatura */
.hm-overlay-fullscreen {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(0, 0, 0, 0.95);
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.hm-overlay-fullscreen.active {
    display: flex;
}

.hm-overlay-fullscreen img {
    width: 100vw;
    height: 100vh;
    object-fit: contain;
    display: block;
    pointer-events: none;
}

.hm-overlay-name {
    font-family: 'Henny Penny', cursive;
    font-size: clamp(calc(2.4rem + 5px), calc(4vw + 5px), calc(3.2rem + 5px));
    color: var(--hm-popup-glow, var(--hm-gold));
    text-shadow: 0 0 12px color-mix(in srgb, var(--hm-popup-glow, var(--hm-gold)) 70%, transparent),
                 0 0 28px color-mix(in srgb, var(--hm-popup-glow, var(--hm-gold)) 40%, transparent);
    margin: 0;
}

.hm-tts {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.hm-tts-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    font-size: 21px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s;
}

.hm-tts-btn:hover { transform: scale(1.1); }

.hm-tts-play  { background: var(--hm-green); color: #fff; }
.hm-tts-pause { background: var(--hm-amber); color: #fff; }
.hm-tts-stop  { background: #ef4444; color: #fff; }
.hm-tts-speed { background: #444; color: #fff; font-weight: bold; min-width: 36px; }

.hm-music-btn,
#hmMusicToggleMenu {
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid rgba(37, 99, 235, 0.85);
    background: radial-gradient(circle at 35% 30%, #60a5fa, #2563eb 55%, #1d4ed8);
    color: #fff;
    font-size: calc(1.25rem + 5px);
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.45);
    transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s, background 0.2s;
}

.hm-music-btn:hover,
#hmMusicToggleMenu:hover {
    transform: scale(1.08);
    box-shadow: 0 0 16px rgba(37, 99, 235, 0.65);
}

.hm-music-btn.is-muted,
#hmMusicToggleMenu.is-muted {
    border-color: rgba(239, 68, 68, 0.85);
    background: radial-gradient(circle at 35% 30%, #9ca3af, #6b7280 55%, #4b5563);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.35);
    color: #fee2e2;
}

#hmMusicToggleMenu {
    width: auto;
    min-width: 44px;
    height: auto;
    padding: 12px 16px;
    font-size: calc(1.35rem + 5px);
}

.hm-tts-speed-label {
    font-size: calc(0.95rem + 5px);
    color: #aaa;
    min-width: 32px;
    text-align: center;
}

.hm-overlay-close {
    position: static;
    width: 44px;
    height: 44px;
    border: 2px solid #555;
    border-radius: 50%;
    background: #222;
    color: #fff;
    font-size: calc(1.4rem + 5px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, background 0.2s;
}

.hm-overlay-close:hover {
    border-color: var(--hm-gold);
    background: #333;
}

