/* --- Global Styles & Dark Theme --- */
/* NEW: Use clamp() for a responsive base font size. 
   It will scale with the viewport's smallest dimension (vmin) 
   but won't go below 12px or above 18px. */
html {
    font-size: clamp(12px, 1.25vmin, 18px);
}

body {
    background-color: #1a1a1a; color: var(--text-color); font-family: 'Press Start 2P', cursive;
    /* MODIFIED: Base font-size is now relative, padding converted to rem */
    font-size: 1rem; 
    line-height: 1.6; margin: 0; padding: 1.25rem; image-rendering: pixelated;
    overflow: auto;
}

/* --- Image Background --- */
#background-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -2; }
#bg-image { width: 100%; height: 100%; object-fit: cover; filter: blur(6px) brightness(60%); transform: scale(1.1); }

/* --- Theme Color Definitions --- */
.theme-mint {
    --primary-color: #98f8e1; --secondary-color: #4a8272; --text-color: #dffff6; --shadow-color: #55c8a9;
    --terminal-border: #4a8272; --terminal-title: #2a6252; --terminal-bg: #0A0A0A;
}
.theme-rose {
    --primary-color: #f8b4d4; --secondary-color: #9c607d; --text-color: #ffe8f3; --shadow-color: #d1709e;
    --terminal-border: #9c607d; --terminal-title: #7c405d; --terminal-bg: #1a0f15;
}
.theme-strawberry {
    --primary-color: #ff7575; --secondary-color: #a04242; --text-color: #ffdede; --shadow-color: #c24545;
    --terminal-border: #a04242; --terminal-title: #802222; --terminal-bg: #1a0e0e;
}
.theme-fallout {
    --primary-color: #33ff33; --secondary-color: #229922; --text-color: #ccffcc; --shadow-color: #33ff33;
    --terminal-border: #229922; --terminal-title: #117711; --terminal-bg: #030f03;
}

/* --- Background Info Squares --- */
.info-square {
    position: fixed; 
    /* MODIFIED: Converted to rem */
    border: 0.125rem solid var(--primary-color); padding: 0.3rem 0.6rem;
    background-color: #000000; 
    font-size: 0.8em; z-index: 5; color: var(--primary-color);
    box-shadow: 0 0 1rem var(--shadow-color);
}

/* --- Layout and Containers --- */
.container {
    max-width: 56.25rem; /* 900px / 16px */
    margin: 0 auto; 
    /* MODIFIED: Converted to rem */
    border: 0.25rem solid var(--primary-color);
    box-shadow: 0 0 1.5rem var(--shadow-color); padding: 1.25rem; 
    background-color: #000000;
    position: relative; z-index: 10;
}
header { text-align: center; margin-bottom: 1.25rem; }
header h1 { font-size: 2em; color: var(--primary-color); text-shadow: 0.2rem 0.2rem 0 var(--secondary-color); margin-bottom: 0.6rem; }
footer { margin-top: 1.875rem; font-size: 0.8em; color: var(--secondary-color); text-align: center; }

/* --- Window Styling --- */
.window { background: #1e1e1e; border: 0.25rem solid var(--primary-color); margin-bottom: 1.5rem; box-shadow: inset 0 0 0.6rem rgba(0,0,0,0.5); }
.title-bar { background: var(--primary-color); padding: 0.5rem 0.6rem; display: flex; justify-content: space-between; align-items: center; color: #1a1a1a; font-weight: bold; user-select: none; }
.window-body { padding: 1.25rem; }
.window-body h3 { color: var(--primary-color); text-shadow: 0.125rem 0.125rem 0 var(--secondary-color); font-size: 1em; margin-top: 1.25rem; margin-bottom: 1rem; }
.window-body h3:first-child { margin-top: 0; }
.window-body p { margin-bottom: 1.25rem; }
.list { list-style-type: none; padding-left: 0; }
.list li { position: relative; padding-left: 1.875rem; margin-bottom: 0.6rem; }
.list li::before { content: '>'; position: absolute; left: 0; top: 0; color: var(--primary-color); }

#user-profile-window {
    background: #000000;
}

/* --- Title bar arrows --- */
.title-arrow {
    display: inline-block;
    margin-right: 0.5rem;
    transition: transform 0.3s ease-out;
}

/* --- Media Player Styles --- */
#media-player .title-bar {
    cursor: pointer;
}
#player-arrow {
    animation: icon-blink 1.5s infinite;
}
#media-player .title-bar:hover #player-arrow {
    animation: none;
    opacity: 1;
}
#media-player.open #player-arrow {
    transform: rotate(90deg);
    animation: none;
    opacity: 1;
}
#media-player .window-body {
    background-color: var(--terminal-bg);
    color: var(--primary-color);
    text-align: center;
    max-height: 0;
    overflow: hidden;
    padding: 0 1.25rem;
    transition: max-height 0.4s ease-out, padding 0.4s ease-out;
}
#media-player.open .window-body {
    max-height: 18.75rem;
    padding: 1.25rem;
}
@keyframes icon-blink {
    50% {
        opacity: 0.5;
    }
}
#song-title {
    font-size: 0.9em;
    margin-bottom: 1rem;
    min-height: 1.2em;
}
.player-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}
.player-controls button {
    background: none;
    border: 0.125rem solid var(--primary-color);
    color: var(--primary-color);
    font-family: 'Press Start 2P', cursive;
    font-size: 1.2em;
    width: 3.125rem;
    height: 2.5rem;
    cursor: pointer;
}
.player-controls button:hover {
    background-color: var(--primary-color);
    color: var(--terminal-bg);
}
.seek-container, .volume-container {
    margin-top: 0.6rem;
}
.volume-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.6rem;
}
input[type=range] {
    -webkit-appearance: none;
    appearance: none; 
    width: 80%;
    background: transparent;
}
input[type=range]:focus {
    outline: none;
}
input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 0.5rem;
    cursor: pointer;
    background: var(--secondary-color);
    border: 0.125rem solid var(--terminal-border);
}
input[type=range]::-moz-range-track {
    width: 100%;
    height: 0.5rem;
    cursor: pointer;
    background: var(--secondary-color);
    border: 0.125rem solid var(--terminal-border);
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    border: 0.125rem solid var(--terminal-border);
    height: 1.25rem;
    width: 0.75rem;
    background: var(--primary-color);
    cursor: pointer;
    margin-top: -0.5rem;
}
input[type=range]::-moz-range-thumb {
    border: 0.125rem solid var(--terminal-border);
    height: 1.25rem;
    width: 0.75rem;
    background: var(--primary-color);
    cursor: pointer;
}


/* --- Terminal Window & OS --- */
#terminal-window { background: var(--terminal-bg); border: 0.25rem solid var(--terminal-border); padding: 0; margin-bottom: 0; box-shadow: none; }
#terminal-window .title-bar { background: var(--terminal-title); color: var(--primary-color); border-bottom: 0.125rem solid var(--terminal-border); }
/* MODIFIED: Changed fixed height to a responsive viewport height */
#terminal-body { padding: 0.6rem; background-color: var(--terminal-bg); position: relative; height: 35vh; }
#file-list { color: var(--primary-color); }
#file-list p { margin: 0.125rem 0; }
.selectable-item { padding: 0.125rem 0.3rem; cursor: inherit; width: fit-content; }
.selectable-item.selected { background-color: var(--primary-color); color: var(--terminal-bg); }
#theme-selector { display: block; width: fit-content; margin: 0 auto 1rem auto; font-size: 1.2em; text-align: center; }

.update-text {
    margin: 0.125rem 0 !important;
    color: var(--primary-color);
    white-space: pre;
}

/* --- App Exit Button --- */
#app-exit-btn {
    background-color: var(--primary-color); color: var(--terminal-title); border: 0.125rem solid var(--terminal-title);
    font-family: 'Press Start 2P', cursive; width: 1.75rem; height: 1.75rem; padding: 0;
    line-height: 1.5rem; font-weight: bold; cursor: inherit;
}
#app-exit-btn:hover { background-color: var(--text-color); }

/* --- Update Button --- */
#update-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-family: inherit;
    font-size: 1.1em;
    cursor: inherit;
    padding: 0.6rem;
    animation: terminal-blink 1.2s infinite step-end;
}

#update-btn:hover {
    background-color: var(--primary-color);
    color: var(--terminal-bg);
    animation: none;
}

.update-container {
    text-align: center;
    padding-top: 3.125rem;
}

@keyframes terminal-blink {
    50% {
        opacity: 0.6;
    }
}


/* --- Application Containers --- */
.app { position: absolute; top: 0; left: 0; width: 100%; height: 100%; color: var(--primary-color); background-color: var(--terminal-bg); box-sizing: border-box; }
#game-container, #game-canvas { width: 100%; height: 100%; }
#game-container { position: relative; }
#game-canvas { background-color: #000; }
#game-ui-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; }
#game-hud { position: absolute; top: 0.6rem; left: 0.6rem; width: calc(100% - 1.25rem); display: none; justify-content: space-between; }
#start-game-btn, #restart-game-btn, #quit-game-btn { font-family: 'Press Start 2P', cursive; font-size: 1.2em; padding: 1rem 1.875rem; color: var(--terminal-bg); background-color: var(--primary-color); border: 0.25rem solid var(--text-color); box-shadow: 0 0 1rem var(--shadow-color); cursor: inherit; text-shadow: none; }
#start-game-btn:hover, #restart-game-btn:hover, #quit-game-btn:hover { background-color: var(--text-color); }
#game-over-screen { display: none; flex-direction: column; justify-content: center; align-items: center; text-align: center; width: 100%; height: 100%; }
.game-over-text { font-size: 2em; text-shadow: 0.2rem 0.2rem 0 var(--secondary-color); margin-bottom: 1.25rem; }
#final-score { font-size: 1.2em; margin-bottom: 1.875rem; }
#game-over-buttons { display: flex; gap: 1.25rem; }
#app-notepad { padding: 0.3rem; }
#notepad-textarea { width: 100%; height: 100%; background-color: transparent; border: none; color: var(--primary-color); font-family: 'Press Start 2P', cursive; font-size: 1em; resize: none; box-sizing: border-box; }
#notepad-textarea:focus { outline: none; }