:root {
    --bg-color: #222;
    --text-color: #fff;
    --dialog-bg: rgba(0, 0, 0, 0.85);
    --dialog-border: #fff;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'DotGothic16', sans-serif;
    overflow: hidden;
    /* Prevent scrolling outside game container */
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container {
    position: relative;
    width: 100%;
    /* max-width: 1280px; Optional: limit max size */
    aspect-ratio: 1024 / 572;
    height: auto;
    overflow: hidden;
    background-color: #000;
    image-rendering: pixelated;
    border: 2px solid #555;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

#game-world {
    position: relative;
    width: 1024px;
    height: 572px;
    transform-origin: 0 0;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    image-rendering: pixelated;
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../assets/map.png');
    background-size: cover;
    /* Or 100% 100% since aspect matches */
    background-repeat: no-repeat;
    z-index: 0;
    image-rendering: pixelated;
}

#player {
    position: absolute;
    width: 64px;
    height: 64px;
    background-image: url('../assets/player.png');
    background-size: 128px 128px;
    background-position: 0 0;
    z-index: 10;
    image-rendering: pixelated;
}

/* UI Layer */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Let clicks pass through to game */
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 20px;
    box-sizing: border-box;
    /* Ensure padding doesn't expand width */
}

.hidden {
    display: none !important;
}

#dialog-box {
    pointer-events: auto;
    width: 90%;
    height: 150px;
    background-color: var(--dialog-bg);
    border: 4px solid var(--dialog-border);
    border-radius: 8px;
    padding: 16px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#dialog-content {
    flex-grow: 1;
}

#speaker-name {
    font-weight: bold;
    margin-bottom: 8px;
    color: #ffcc00;
}

#dialog-text {
    line-height: 1.5;
    font-size: 1.2rem;
}

button {
    background: #444;
    color: #fff;
    border: 1px solid #fff;
    padding: 5px 10px;
    font-family: inherit;
    cursor: pointer;
}

button:hover {
    background: #666;
}

/* Old prompt animation removed */

/* Old controls styles removed */

.d-pad {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.d-mid {
    display: flex;
    gap: 40px;
}

.d-btn {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid #fff;
    border-radius: 50%;
    color: #fff;
    font-size: 24px;
    user-select: none;
}

.d-btn:active {
    background: rgba(255, 255, 255, 0.6);
}

.action-btn {
    pointer-events: auto;
    width: 80px;
    height: 80px;
    background: rgba(255, 50, 50, 0.5);
    border: 2px solid #fff;
    border-radius: 50%;
    color: #fff;
    font-size: 24px;
    margin-bottom: 20px;
    user-select: none;
}

.action-btn:active {
    background: rgba(255, 50, 50, 0.8);
}

/* Layout */
#main-layout {
    display: flex;
    width: 100%;
    height: 100vh;
    background-color: #000;
}

#sidebar {
    width: 250px;
    background: #111;
    color: #eee;
    padding: 20px;
    padding-bottom: 60px;
    /* Extra padding for bottom items */
    overflow-y: auto;
    border-right: 1px solid #444;
    z-index: 200;
    box-sizing: border-box;
    /* Include padding in width/height */
}

#sidebar h1 {
    font-size: 1.5rem;
    margin-bottom: 30px;
    color: #ffcc00;
}

.nav-section {
    margin-bottom: 25px;
}

.nav-section h3 {
    font-size: 1rem;
    color: #aaa;
    border-bottom: 1px solid #444;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

.nav-section ul {
    list-style: none;
    padding: 0;
}

.nav-section li {
    margin-bottom: 8px;
}

.nav-section a {
    color: #fff;
    text-decoration: none;
    transition: color 0.2s;
}

.nav-section a:hover {
    color: #ffcc00;
}

#main-content {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* Console Device Styles */
#console-device {
    background: #2a2a2a;
    /* Dark plastic */
    padding: 20px;
    border-radius: 30px;
    box-shadow:
        inset 0 2px 5px rgba(255, 255, 255, 0.1),
        inset 0 -5px 10px rgba(0, 0, 0, 0.5),
        0 20px 50px rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    max-width: 95vw;
    max-height: 90vh;
    border: 2px solid #111;
    position: relative;
    transition: all 0.3s ease;
}

#screen-bezel {
    background: #000;
    padding: 15px 15px 30px 15px;
    /* Bottom wider for logo space usually */
    border-radius: 10px;
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.1);
    position: relative;
    /* Maintain 16:9 for the screen area */
    aspect-ratio: 16/9;
    height: 60vh;
    /* Base sizing */
    width: auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #111;
    position: relative;
    image-rendering: pixelated;
    cursor: default;
    border: 1px solid #333;
}

/* Controls Styling */
.works-gallery {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

.works-gallery img {
    width: 100%;
    max-width: 600px;
    /* Limit width if it gets too big */
    margin: 0 auto;
    border-radius: 4px;
    border: 1px solid #ffcc00;
    object-fit: cover;
    aspect-ratio: 16/9;
    /* Wider for single column */
    transition: transform 0.2s;
}

.works-gallery img:hover {
    transform: scale(1.02);
    z-index: 10;
}

/* Slideshow Styles */
.slideshow-container {
    width: 100%;
    position: relative;
    margin-bottom: 40px;
    border: 2px solid #ffcc00;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 16/9;
    background: #000;
}

.slide {
    display: none;
    width: 100%;
    height: 100%;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: auto;
    /* Photos should be smooth */
}

/* Fading animation */
.fade {
    animation-name: fade;
    animation-duration: 1.5s;
}

@keyframes fade {
    from {
        opacity: .4
    }

    to {
        opacity: 1
    }
}

#console-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.d-pad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.d-mid {
    display: flex;
    gap: 35px;
}

.d-btn {
    width: 50px;
    height: 50px;
    background: #111;
    border: 2px solid #444;
    border-radius: 8px;
    /* Square-ish for retro feel */
    color: #555;
    box-shadow: 0 4px 0 #000;
    font-size: 0;
    /* Hide text */
    position: relative;
}

.d-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-style: solid;
}

/* Arrows */
#btn-up::after {
    border-width: 0 8px 12px 8px;
    border-color: transparent transparent #555 transparent;
}

#btn-down::after {
    border-width: 12px 8px 0 8px;
    border-color: #555 transparent transparent transparent;
}

#btn-left::after {
    border-width: 8px 12px 8px 0;
    border-color: transparent #555 transparent transparent;
}

#btn-right::after {
    border-width: 8px 0 8px 12px;
    border-color: transparent transparent transparent #555;
}

.d-btn:active {
    box-shadow: 0 1px 0 #000;
    transform: translateY(3px);
}

.action-area {
    display: flex;
    justify-content: center;
}

.action-btn {
    width: 70px;
    height: 70px;
    background: #ff4444;
    /* AB Button Red */
    border: none;
    border-radius: 50%;
    box-shadow: 0 5px 0 #990000;
    color: #fff;
    font-family: 'DotGothic16', sans-serif;
    font-size: 24px;
    cursor: pointer;
}

.action-btn:active {
    box-shadow: 0 2px 0 #990000;
    transform: translateY(3px);
}

/* PC/Tablet: Landscape (Move controls to sides or split?) */
/* Current HTML structure groups controls. Let's put them on the right for now (Switch style right-con) */
@media (min-width: 769px) {
    #console-device {
        flex-direction: row;
        padding-right: 40px;
        /* Space for controls */
    }

    #screen-bezel {
        height: 70vh;
        max-width: 80vw;
    }

    .action-area {
        margin-top: 20px;
    }
}

/* Mobile: GameBoy Style (Vertical) */
@media (max-width: 768px) {
    #console-device {
        flex-direction: column;
        width: 100%;
        height: 100vh;
        border-radius: 0;
        padding: 40px 10px 10px 10px;
        /* Top padding for "screen" */
        max-width: 100%;
        max-height: 100%;
        box-sizing: border-box;
        justify-content: flex-start;
    }

    #screen-bezel {
        width: 100%;
        height: auto;
        aspect-ratio: 16/9;
        /* Keep screen ratio */
        border-radius: 10px 10px 40px 10px;
        /* GameBoy curve */
        margin-bottom: 40px;
    }

    #console-controls {
        flex-direction: row;
        width: 100%;
        justify-content: space-evenly;
        align-items: center;
        margin-top: auto;
        padding-bottom: 40px;
    }

    .d-pad {
        gap: 0;
    }

    /* Cross D-pad styling override for realism? optimized for touch */
}

/* Hide Sidebar on mobile */
/* Mobile Menu Toggle */
#menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 300;
    background: #2a2a2a;
    color: #ffcc00;
    border: 2px solid #fff;
    border-radius: 8px;
    width: 44px;
    height: 44px;
    font-family: inherit;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 0 #000;
    align-items: center;
    justify-content: center;
    padding: 0;
}

#menu-toggle:active {
    box-shadow: 0 1px 0 #000;
    transform: translateY(3px);
}

@media (max-width: 768px) {
    #menu-toggle {
        display: flex;
        /* Show checking trigger */
    }

    #sidebar {
        /* display: none; Removed */
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 250px;
        transform: translateX(-100%);
        /* Hidden by default */
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }

    #sidebar.active {
        transform: translateX(0);
        /* Slide in */
    }
}

/* Floating Interaction Prompt */
#interaction-prompt {
    position: absolute;
    bottom: 20%;
    /* Position relative to screen area */
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    /* Start lower for slide up */
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    border: 2px solid #fff;
    border-radius: 30px;
    padding: 10px 24px;
    font-size: 1.2rem;
    opacity: 0;
    /* Hidden by default */
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Bouncy pop-up */
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

#interaction-prompt.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    /* Slide to final position */
}

/* Content Page Layout */
#content-container {
    width: 100%;
    max-width: 900px;
    height: 100vh;
    padding: 40px;
    box-sizing: border-box;
    overflow-y: auto;
    background-color: #222;
    color: #eee;
}

.content-header {
    border-bottom: 2px solid #ffcc00;
    margin-bottom: 30px;
    padding-bottom: 10px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.header-image {
    width: 64px;
    height: 64px;
    object-fit: cover;
    margin-right: 20px;
    border: 2px solid #ffcc00;
    border-radius: 8px;
    background: #000;
    /* Pixel art crispy */
    image-rendering: pixelated;
}

.content-header h1 {
    font-size: 2rem;
    color: #ffcc00;
    margin: 0;
}

.content-header .back-link {
    margin-left: auto;
    /* Push to right */
}

.content-body {
    padding-bottom: 60px;
}

.content-body h2 {
    font-size: 1.5rem;
    color: #4db8ff;
    /* Light blue accent */
    margin-top: 40px;
    margin-bottom: 20px;
    border-left: 5px solid #4db8ff;
    padding-left: 15px;
    background: rgba(77, 184, 255, 0.1);
    padding: 10px 15px;
}

.content-body h3 {
    font-size: 1.2rem;
    color: #ffaa55;
    margin-top: 30px;
    margin-bottom: 15px;
}

.content-body p {
    line-height: 1.8;
    margin-bottom: 20px;
    font-size: 1.05rem;
    text-align: justify;
}

.content-body ul {
    margin-bottom: 20px;
    padding-left: 20px;
    background: rgba(255, 255, 255, 0.05);
    padding: 20px 20px 20px 40px;
    border-radius: 10px;
}

.content-body li {
    margin-bottom: 10px;
    line-height: 1.6;
}

.back-link {
    display: inline-block;
    padding: 8px 20px;
    background: #444;
    color: #fff;
    text-decoration: none;
    border: 2px solid #fff;
    border-radius: 5px;
    transition: all 0.2s;
    font-size: 1rem;
}

.back-link:hover {
    background: #ffcc00;
    color: #000;
    border-color: #ffcc00;
}

/* Scrollbar styling for content */
#content-container::-webkit-scrollbar {
    width: 10px;
}

#content-container::-webkit-scrollbar-track {
    background: #111;
}

#content-container::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 5px;
}

#content-container::-webkit-scrollbar-thumb:hover {
    background: #888;
}

@media (max-width: 768px) {
    #content-container {
        padding: 20px;
        padding-top: 70px;
    }

    .content-header h1 {
        font-size: 1.5rem;
    }

    .content-body h2 {
        font-size: 1.3rem;
    }
}