/* ========================================= */
/* 1. RESET & BASE LAYOUT                    */
/* ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #0a0a0a;
    color: white;
    font-family: sans-serif;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#game-container {
    width: 100vw;  
    height: 100vh; 
    background-color: #1a1a1a;
    position: relative;
    image-rendering: pixelated; 
}

/* ========================================= */
/* 2. GLOBAL UI BUTTONS                      */
/* ========================================= */
.close-btn, .nav-btn {
    background-color: #f4e8d8;
    border: 2px solid #4a2e1b;
    padding: 8px 16px;
    font-family: monospace;
    font-weight: bold;
    color: #4a2e1b;
    cursor: pointer;
    box-shadow: 3px 3px 0px #4a2e1b; 
    transition: all 0.1s;
}

.close-btn:hover, .nav-btn:hover {
    background-color: #4a2e1b;
    color: #f4e8d8;
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0px #4a2e1b;
}

/* ========================================= */
/* 3. ENVIRONMENT & HOTSPOTS                 */
/* ========================================= */
#room-background {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.fullscreen-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.transition-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 500; 
    pointer-events: none; 
    opacity: 0; /* Keep it invisible, but fully loaded on the GPU! */
}

#interactive-layer, .hotspot-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none; 
}

.hotspot {
    fill: rgba(0, 0, 0, 0.01); /* Fix for SVG Hit-Test Bug */
    pointer-events: auto;
    cursor: pointer;
    transition: fill 0.2s ease;
}

@media (hover: hover) {
    .hotspot:hover {
        fill: rgba(255, 255, 255, 0.15); 
    }
}

/* ========================================= */
/* 4. LOGIN SCREEN & DIALOGUE UI             */
/* ========================================= */
.curtain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #0a0a0a; 
    z-index: 900; 
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-interface {
    background-color: #1a1a1a;
    padding: 40px;
    border: 2px solid #4a2e1b;
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
    text-align: center;
    width: 90%;
    max-width: 400px;
}

#access-code {
    width: 100%;
    padding: 10px;
    margin: 20px 0;
    background-color: #0a0a0a;
    border: 1px solid #4a2e1b;
    color: #f4e8d8;
    font-family: monospace;
    font-size: 1.2rem;
    text-align: center;
    text-transform: uppercase; 
}

.error-text {
    color: #d9534f;
    margin-top: 15px;
    font-size: 0.9rem;
    min-height: 20px;
}

.transition-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #0a0a0a;
    z-index: 850; 
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 1s ease-in-out;
}

.fullscreen-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none; 
}

.dialogue-container {
    position: absolute;
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1000px;
    z-index: 800; 
}

.dialogue-box {
    background-color: rgba(20, 20, 20, 0.9);
    border: 2px solid #f4e8d8;
    padding: 20px 30px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8), 5px 5px 0px rgba(0,0,0,0.5);
    color: #f4e8d8;
}

.speaker-name {
    color: #d1bfae;
    margin-bottom: 10px;
    font-family: monospace;
    font-size: 1.2rem;
    border-bottom: 1px solid #4a2e1b;
    padding-bottom: 5px;
    display: inline-block;
}

#dialogue-text {
    font-size: 1.1rem;
    line-height: 1.5;
    margin-bottom: 20px;
}

/* ========================================= */
/* 5. CORE MODAL SYSTEM                      */
/* ========================================= */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 100;
    display: none; /* Reverted back to the stable original */
    justify-content: center; /* FIX: Centers the Calendar again */
    align-items: center; /* FIX: Centers the Calendar again */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.is-visible {
    display: flex;
    opacity: 1;
}

.modal.is-visible {
    visibility: visible;
    pointer-events: auto;
    opacity: 1;
}

/* ========================================= */
/* 6. NATIVE RESPONSIVE GALLERY              */
/* ========================================= */
#gallery-modal {
    background-color: #050505; 
    background-size: 100% 100%; 
    background-position: center;
    background-repeat: no-repeat;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
    transition: none !important; /* THE FIX: Forces a hard cut instead of a slow fade */
}

/* The box that holds the layout */
.gallery-container {
    width: 30vw; /* FLUID MAGIC: Takes up exactly 30% of the screen width */
    min-width: 450px; /* Safety net so it doesn't get too tiny on small laptops */
    max-width: 800px; /* Safety net for ultra-wide monitors */
    height: 70vh; 
    margin: auto; 
    display: flex; 
    justify-content: center; 
    padding-left: 1.5vw; /* Fluid padding */
}

/* THE 2x3 GRID */
.page-grid {
    width: 100%; 
    display: grid;
    grid-template-columns: repeat(2, 1fr); 
    gap: 2.5vw; /* FLUID MAGIC: The gap grows and shrinks with the window */
    padding: 5vh 1.5vw; /* Top padding uses height, side uses width */
    align-content: start; 
}

/* THE THUMBNAILS */
.thumbnail {
    width: 100%;
    aspect-ratio: 4 / 3; 
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.6);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background-color: transparent; 
}

.thumbnail:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 20px rgba(0,0,0,0.9);
    z-index: 10;
    position: relative;
}

/* UI BUTTONS */
.book-controls {
    position: absolute;
    bottom: 8vh; /* FLUID MAGIC: Moves the buttons higher up from the bottom edge */
    left: 50%; /* Start the centering process */
    transform: translateX(-50%); /* Perfect dead-center alignment */
    width: 25vw; /* FLUID MAGIC: Squeezes the buttons much closer to each other */
    min-width: 350px; /* Prevents them from overlapping on small screens */
    max-width: 600px; 
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 300;
}

#close-gallery {
    position: absolute;
    top: 15vh; /* FLUID MAGIC: Moves it down a bit from the very top edge */
    left: 50%; /* Start the centering process */
    transform: translateX(-50%); /* Perfect dead-center alignment */
    z-index: 300;
}

/* --- ZOOMED VIEW OVERLAY --- */
#zoomed-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.95);
    display: none; 
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.zoomed-controls {
    display: flex;
    justify-content: space-between;
    width: 90%;
    max-width: 800px;
    margin-bottom: 20px;
}

#current-photo {
    max-width: 90vw;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0,0,0,1);
}
/* Hides the page counter while keeping it in the DOM so JS doesn't crash */
#page-counter {
    display: none !important;
}

/* ========================================= */
/* 7. CALENDAR INTERFACE                     */
/* ========================================= */

#calendar-modal {
    background-color: #050505; 
    background-size: 100% 100%; 
    background-position: center;
    background-repeat: no-repeat;
    flex-direction: column;
    z-index: 200;
    transition: none !important; 
}

/* ADD THIS BULLETPROOF OVERRIDE */
#calendar-modal.is-visible {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    position: absolute !important;
    top: 0 !important; 
    left: 0 !important; 
    width: 100vw !important; 
    height: 100vh !important;
    z-index: 200 !important;
}
.calendar-interface {
    background-color: #d1bfae; 
    padding: 30px;
    border-radius: 4px;
    box-shadow: inset 0 0 40px rgba(90, 50, 20, 0.4), 0px 10px 40px rgba(0,0,0,0.9);
    border: 2px solid #4a2e1b;
    width: 90%;
    max-width: 600px;
    color: #2a1a10;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0;
    font-family: monospace;
    font-size: 1.2rem;
}

.calendar-grid {
    margin-bottom: 20px;
}

.day-names {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: bold;
    font-family: monospace;
    border-bottom: 2px solid #4a2e1b;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.days-container {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.calendar-day {
    aspect-ratio: 1 / 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

@media (hover: hover) {
    .calendar-day:hover:not(.empty-day) {
        border: 1px solid #4a2e1b;
        background-color: rgba(74, 46, 27, 0.1);
    }
}

.has-event {
    background-color: green; 
    color: #f4e8d8;
    font-weight: bold;
    box-shadow: 2px 2px 0px #4a2e1b;
}
.reserved-day {
    background-color: red !important; /* A distinct tavern green */
    color: #f4e8d8;
    font-weight: bold;
    border: 1px solid #1e4a27 !important;
    box-shadow: 2px 2px 0px #1e4a27;
}

.reserved-day:hover {
    background-color: #47a85b !important;
}
.has-event:hover {
    background-color: #a84747;
}

.empty-day {
    cursor: default;
}

.event-panel {
    background-color: rgba(0, 0, 0, 0.05);
    border-top: 2px dashed #4a2e1b;
    padding-top: 20px;
    min-height: 120px;
}

/* ========================================= */
/* 8. DRINK MENU & SUB-SCENES                */
/* ========================================= */
.sub-scene {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20; 
    background-color: #0a0a0a;
}

#menu-background {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

#menu-interactive-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 25;
}

.menu-sidebar {
    position: absolute;
    left: 40px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 30;
}

.sidebar-btn {
    background-color: rgba(20, 20, 20, 0.8);
    border: 2px solid #d1bfae;
    color: #d1bfae;
    padding: 15px 30px;
    font-family: monospace;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    text-transform: uppercase;
    box-shadow: 4px 4px 0px rgba(0,0,0,0.8);
}

.sidebar-btn:hover {
    background-color: #d1bfae;
    color: #1a1a1a;
    transform: translateX(10px);
}

.sidebar-btn.active {
    background-color: #8c3b3b;
    border-color: #f4e8d8;
    color: #f4e8d8;
}

.back-btn {
    margin-top: 30px;
    background-color: transparent;
    border-color: #8c3b3b;
}

/* ========================================= */
/* 9. SPIRIT DETAIL INTERFACE                */
/* ========================================= */
.spirit-info-floating {
    position: absolute;
    right: 8%; 
    top: 50%;
    transform: translateY(-50%);
    width: 35%; 
    max-width: 500px;
    z-index: 10;
    color: #d1bfae;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.9), 0px 0px 20px rgba(0, 0, 0, 0.8);
}

.spirit-info-floating h2 {
    font-family: monospace;
    font-size: 3rem;
    margin-bottom: 20px;
    border-bottom: 2px solid #8c3b3b;
    padding-bottom: 10px;
}

.spirit-info-floating p {
    font-size: 1.3rem;
    line-height: 1.6;
}

/* ========================================= */
/* 10. MOBILE RESPONSIVE LOGIC               */
/* ========================================= */
.mobile-only {
    display: none;
}
.desktop-only {
    display: block;
}

@media (max-aspect-ratio: 1/1) {
    .mobile-only {
        display: block;
    }
    .desktop-only {
        display: none;
    }
    
    .spirit-info-floating {
        width: 80%;
        right: 10%;
        text-align: center;
    }
    .menu-sidebar {
        left: 50%;
        top: auto;
        bottom: 5%;
        transform: translateX(-50%);
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
}