/* --- LOGIN CURTAIN --- */
.curtain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #0a0a0a; /* Pitch black */
    z-index: 900; /* Sits on top of EVERYTHING */
    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; /* Forces codes to be uppercase */
}

.error-text {
    color: #d9534f;
    margin-top: 15px;
    font-size: 0.9rem;
    min-height: 20px;
}

/* --- DIALOGUE UI (Visual Novel Style) --- */
.dialogue-container {
    position: absolute;
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1000px;
    z-index: 800; /* Sits above the background, below the login */
}

.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;
}
/* --- RESET & LAYOUT --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
/* --- LOGIN TRANSITION SCREEN --- */
.transition-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #0a0a0a;
    z-index: 850; /* Sits below the login screen, but above everything else */
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 1s ease-in-out;
}
/* Ensures the transition video covers the whole screen perfectly */
.fullscreen-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none; /* Prevents accidental clicks on the video */
}

body {
    background-color: #0a0a0a;
    color: white;
    font-family: sans-serif;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#game-container {
    /* Our main visual novel window */
    width: 100vw;  /* 100% of the Viewport Width */
    height: 100vh; /* 100% of the Viewport Height */
    background-color: #1a1a1a;
    position: relative;
    image-rendering: pixelated; 
}


/* --- ENVIRONMENT LAYERS --- */
#room-background {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.transition-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 50;
    display: none; 
    pointer-events: none; 
}

#interactive-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none; 
}

/* --- HOTSPOTS --- */
.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); 
    }
}

/* --- 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;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.is-visible {
    display: flex;
    opacity: 1;
}

/* --- BOOK INTERFACE --- */
.book-interface {
    background-color: #d1bfae;
    padding: 30px;
    border-radius: 4px;
    box-shadow: inset 0 0 50px rgba(90, 50, 20, 0.4), 0px 10px 40px rgba(0,0,0,0.9);
    border: 2px solid #4a2e1b;
    text-align: center;
    width: 95%;
    max-width: 1200px;
    color: #2a1a10;
}

.page-container {
    margin: 20px 0;
    perspective: 1000px; 
}

.thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 20px;
    margin: 20px 0;
    min-height: 400px;
}

.thumbnail {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background-color: #f8f4e6;
    padding: 6px 6px 20px 6px;
    border: 1px solid #ccc;
    box-shadow: 3px 3px 8px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    image-rendering: auto;
}

.thumbnail:hover {
    transform: scale(1.05) rotate(-2deg);
    box-shadow: 5px 5px 15px rgba(0,0,0,0.5);
    z-index: 10;
}

.gallery-photo {
    width: 100%;
    height: auto;
    max-height: 80vh;
    object-fit: contain;
    border: none;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    image-rendering: auto; 
}

/* --- UI BUTTONS & CONTROLS --- */
.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;
}

.zoomed-controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    width: 100%;
}

.book-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    font-family: monospace;
    font-weight: bold;
}
/* --- CALENDAR INTERFACE --- */
.calendar-interface {
    background-color: #d1bfae; /* Same aged paper color */
    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;
}

/* The hover effect */
@media (hover: hover) {
    .calendar-day:hover:not(.empty-day) {
        border: 1px solid #4a2e1b;
        background-color: rgba(74, 46, 27, 0.1);
    }
}

/* Days that have an event */
.has-event {
    background-color: #8c3b3b; /* A faded tavern red */
    color: #f4e8d8;
    font-weight: bold;
    box-shadow: 2px 2px 0px #4a2e1b;
}

.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;
}
/* --- SUB-SCENES --- */
.sub-scene {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20; /* Sits above main background, below transitions */
    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 --- */
.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;
}

/* --- SPIRIT DETAIL INTERFACE (FLOATING) --- */

.fullscreen-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.spirit-info-floating {
    position: absolute;
    right: 8%; /* Pushes the text to the right side of the screen */
    top: 50%;
    transform: translateY(-50%);
    width: 35%; /* Takes up about a third of the screen */
    max-width: 500px;
    z-index: 10;
    color: #d1bfae;
    
    /* A heavy text shadow ensures the text is always readable, 
       even if your 3D background has bright spots behind it */
    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;
}
/* --- DUAL-BUILD RESPONSIVE LOGIC --- */
/* By default, assume Desktop */
.mobile-only {
    display: none;
}
.desktop-only {
    display: block;
}

/* If the viewport is a portrait aspect ratio (Mobile) */
@media (max-aspect-ratio: 1/1) {
    .mobile-only {
        display: block;
    }
    .desktop-only {
        display: none;
    }
    
    /* Minor mobile UI adjustments */
    .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;
    }
}

/* --- FULLSCREEN UTILITY --- */
.fullscreen-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

/* Update hotspot layers to use absolute positioning natively */
.hotspot-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none; 
}