/* Base Layout & Fixes */
body {
    margin: 0;
    min-height: 100vh;
    min-height: 100vh; 
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: Tahoma, "Trebuchet MS", sans-serif;
    background-color: red;
    position: relative;
    padding: 10px;
    box-sizing: border-box;
    /* Removed overflow: hidden so small screens can scroll if window expands */
}

/* Fullscreen WebGL Canvas Background */
#glitch-shader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

/* Responsive Windows XP Window */
.whole {
    width: 100%;
    max-width: 650px; /* Replaced rigid 50vw with a responsive constraint */
    background-color: #ECE9D8; 
    border: 3px solid #0053E5;
    border-radius: 8px 8px 0 0;
    box-shadow: 2px 2px 10px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10; 
    max-height: 90vh;
    max-height: 90vh;
}

.whole::before {
    content: "Psycrisis Studio";
    display: block;
    background: linear-gradient(to bottom, #0058e6 0%, #3a93ff 8%, #288eff 40%, #127dff 88%, #036bde 100%);
    color: white;
    font-weight: bold;
    font-size: 13px;
    padding: 6px 10px;
    text-shadow: 1px 1px 2px #0f1089;
    letter-spacing: 0.5px;
    border-radius: 4px 4px 0 0;
    flex-shrink: 0;
}

.bigboy {
    padding: 10px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* Enables scrolling inside the XP window body if content overflows */
}

/* Horizontal Scrollable Tabs on Mobile */
.topbuttons {
    display: flex;
    gap: 2px;
    padding-left: 2px;
    border-bottom: none;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; 
}

.topbuttons::-webkit-scrollbar {
    display: none;
}

.topbuttons button {
    background-color: #ECE9D8;
    border: 1px solid #91A0C0;
    border-bottom: none;
    border-radius: 3px 3px 0 0;
    padding: 8px 16px; /* Expanded for mobile touch accuracy */
    font-family: Tahoma, sans-serif;
    font-size: 12px;
    cursor: pointer;
    margin-top: 2px;
    box-shadow: none;
    text-align: center;
    flex-shrink: 0;
}

.topbuttons button:active {
    background-color: #d4d0c8;
}

.topbuttons .active {
    background-color: #ffffff;
    margin-top: 0;
    padding-bottom: 9px;
    position: relative;
    z-index: 2;
    font-weight: bold;
    border-color: #91A0C0;
}

.bio {
    background-color: #ffffff;
    border: 1px solid #91A0C0;
    padding: 15px;
    font-size: 13px;
    text-align: left; /* Changed from center for better legibility on small screens */
    box-shadow: inset 1px 1px 2px rgba(0,0,0,0.1);
    box-sizing: border-box;
    position: relative;
    z-index: 3;
}

.profiles {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
    text-align: left;
}

.profile-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    word-break: break-word; /* Prevents long URLs from breaking container */
}

.profile-item span {
    font-weight: bold;
    color: #0053E5;
}

.profile-item a {
    color: #0000EE;
    text-decoration: underline;
}

.profile-item a:hover {
    color: #FF0000;
}

.tab-content {
    animation: fadeIn 0.2s ease-in-out;
}

/* Responsive Image Grid */
.gameshots {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    padding: 0.5rem 0;
    width: 100%;
    box-sizing: border-box;
}

.gameshots img {
    width: 100%;
    height: 120px;
    object-fit: cover; 
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
    cursor: pointer;
}

.gameshots img:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.6);
    outline: 2px solid #fff; 
}

/* Lightbox Modifications */
#psycrisis-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#psycrisis-lightbox.lightbox-visible {
    opacity: 1;
    pointer-events: auto;
}

#lightbox-img {
    max-width: 85vw;
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    display: block;
}

.lightbox-close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: white;
    font-size: 36px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    z-index: 10000;
    padding: 10px;
}

.lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    padding: 12px 16px;
    z-index: 10000;
    transition: color 0.2s ease, background-color 0.2s ease;
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.3);
}

.lightbox-prev {
    left: 10px;
}

.lightbox-next {
    right: 10px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Mobile Media Query Tweaks */
@media (max-width: 600px) {
    .whole {
        max-height: 95vh;
        max-height: 95vh;
    }

    .bio {
        padding: 10px;
    }

    .gameshots {
        grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
        gap: 0.5rem;
    }

    .lightbox-arrow {
        font-size: 30px;
        padding: 8px 12px;
    }
}