/* ========================================= */
/* QUEST PORTAL / GAME VIEWPORT LAYOUT       */
/* ========================================= */

body.game-layout {
    margin: 0; padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--ts-outline);
}

/* Nav Offset for Game Mode */
.dashboard-nav.game-nav {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 60px;
    background-color: var(--ts-stone);
    border-bottom: 4px solid var(--ts-outline);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 25px;
    box-sizing: border-box;
    z-index: 1000;
}

.game-viewport-wrapper {
    margin-top: 70px; /* Fixed Navbar Offset */
    height: calc(100vh - 70px);
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px; 
    box-sizing: border-box;
    position: relative;
    z-index: 5;
}

/* The 16:9 Cinema Frame */
.game-frame {
    aspect-ratio: 16 / 9; 
    width: 100%;
    /* Prevents frame from taller than screen */
    max-width: calc((100vh - 100px) * (16 / 9)); 
    background: black;
    border: 6px solid var(--ts-outline);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 50px rgba(0,0,0,0.8), 12px 12px 0px rgba(0,0,0,0.4);
}

.game-frame iframe {
    width: 100%; height: 100%;
    border: none; display: block;
}

/* Tooltip System */
.cq-tooltip-wrapper { position: relative; display: inline-block; }
.cq-tooltip-wrapper:hover .cq-tooltip-text {
    visibility: visible;
    opacity: 1;
}

.cq-tooltip-text {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: -45px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--ts-parchment);
    color: var(--ts-outline);
    padding: 6px 12px;
    border: 3px solid var(--ts-outline);
    font-family: 'VT323';
    font-size: 1rem;
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
}

/* --- QUEST CONTAINER (The physical card) --- */
.quest-container {
    width: 850px;
    max-width: 95%;
    min-height: 520px; 
    background: var(--ts-stone);
    border: 6px solid var(--ts-outline);
    border-radius: 12px;
    display: flex;
    box-shadow: 10px 10px 0px rgba(0, 0, 0, 0.4);
    position: relative; 
    z-index: 10;
    overflow: hidden; /* Keeps the internal panels inside the border */
}

/* --- SIDEBAR PANEL (Parchment/Left) --- */
.quest-sidebar {
    flex: 0 0 300px; /* Rigid width for the left side */
    background-color: var(--ts-parchment);
    background-image: radial-gradient(circle at center, transparent 30%, rgba(101, 50, 15, 0.2) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    text-align: center;
    border-right: 4px solid var(--ts-outline);
    box-shadow: inset 0px 0px 50px rgba(101, 50, 15, 0.3);
}

/* --- FORM SECTION PANEL (Stone/Right) --- */
.quest-form-section {
    flex: 1; /* Fills the rest of the space */
    padding: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background-color: var(--ts-stone);
    background-image: radial-gradient(circle at center, transparent 10%, rgba(37, 51, 66, 0.3) 120%);
    box-shadow: inset 4px 4px 0px rgba(255, 255, 255, 0.1);
}

/* --- TITLES (Chelsea Market) --- */
.sidebar-title, .form-title {
    font-family: 'Chelsea Market', cursive;
    text-shadow: var(--ts-header-shadow);
    margin: 0;
}

.sidebar-title { color: var(--ts-red); font-size: 2.2rem; }
.form-title { color: var(--ts-white); font-size: 1.8rem; margin-bottom: 20px; border-bottom: 3px dashed rgba(255,255,255,0.2); padding-bottom: 10px; }

/* --- MOBILE RESPONSIVENESS OVERRIDES --- */
@media (max-width: 768px) {
    .game-viewport-wrapper {
        padding: 15px;
        height: auto; /* Allows page to scroll if content is long */
        min-height: calc(100vh - 60px);
        display: flex;
        align-items: center; /* Vertical centering */
    }

    .quest-container {
        flex-direction: column;
        width: 100%;
        max-width: 450px;
        min-height: auto;
        margin: 0 auto;
    }

    .quest-sidebar {
        flex: none; /* Removes the 300px rigid width */
        width: 100%;
        padding: 30px 15px;
        border-right: none;
        border-bottom: 4px solid var(--ts-outline);
    }

    .quest-sidebar img {
        width: 80px !important; /* Scale down logo for mobile */
    }

    .quest-form-section {
        padding: 30px 20px;
        text-align: center;
        align-items: center; /* Centers items horizontally in flex column */
    }

    .portal-desc {
        font-size: 1.2rem !important;
        margin-bottom: 20px !important;
    }

    .portal-btn {
        width: 100%;
        max-width: 300px; /* Keeps buttons from getting too wide */
        justify-content: center;
    }
}

/* Landscape fix for very short phones */
@media (max-height: 500px) and (orientation: landscape) {
    .game-viewport-wrapper {
        align-items: flex-start;
        overflow-y: auto;
    }
}