/* =========================================
   HIIII 4 OS - MASTER STYLESHEET (v11.0 - Bug Fixed)
   ========================================= */

/* --- 1. FONTS & RESET --- */
@font-face {
    font-family: 'Press Start 2P';
    src: url('../assets/fonts/PressStart2P-Regular.ttf') format('truetype');
}
@font-face {
    font-family: 'VT323';
    src: url('../assets/fonts/VT323-Regular.ttf') format('truetype');
}

:root {
    --bg-pale: #E0F0FF;
    --tv-plastic: #2B3A42;
    --tv-shadow: #1a2328;
    --screen-bg: #e6f2ff;
    --screen-text: #2b3a42;
    --accent-blue: #3b82f6;
    --accent-red: #ff4d4d;
    --accent-green: #10b981;
    --font-headers: 'Press Start 2P', cursive;
    --font-body: 'VT323', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; }

/* --- 2. ENVIRONMENT --- */
body {
    height: 100vh; width: 100vw; overflow: hidden;
    font-family: var(--font-body);
    background-color: var(--bg-pale);
    background-image: 
        linear-gradient(45deg, #d0e4ff 25%, transparent 25%), 
        linear-gradient(-45deg, #d0e4ff 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #d0e4ff 75%), 
        linear-gradient(-45deg, transparent 75%, #d0e4ff 75%);
    background-size: 4px 4px;
    background-position: 0 0, 0 2px, 2px -2px, -2px 0px;
    display: flex; justify-content: center; align-items: center;
}

/* --- 3. START OVERLAY & LOGIN --- */
#start-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #050510; z-index: 100000;
    display: flex; justify-content: center; align-items: center;
    background-image: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
    background-size: 100% 4px;
}
.start-content { text-align: center; font-family: var(--font-headers); color: white; }
.start-content h1 { 
    font-size: 2.5rem; margin-bottom: 30px; color: var(--accent-blue);
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

.login-box {
    display: flex; flex-direction: column; gap: 15px; align-items: center;
}
.login-box p { font-size: 1rem; color: #aaa; letter-spacing: 2px; }

#sys-password {
    background: transparent;
    border: 2px solid var(--accent-green);
    color: var(--accent-green);
    font-family: var(--font-body);
    font-size: 1.5rem;
    padding: 10px;
    text-align: center;
    width: 250px;
    outline: none;
    text-transform: uppercase;
}
#sys-password:focus { box-shadow: 0 0 15px var(--accent-green); }

.blink { animation: blinker 0.5s linear infinite; }
@keyframes blinker { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }

/* --- 4. RETRO MODAL --- */
#retro-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); z-index: 99999;
    display: flex; justify-content: center; align-items: center;
    backdrop-filter: blur(4px);
}
.hidden { display: none !important; }

.retro-modal-box {
    width: 450px; background: #2B3A42; border: 4px solid #111; 
    box-shadow: 10px 10px 0px rgba(0,0,0,0.5);
    font-family: var(--font-body); 
    animation: popIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: white;
}
.modal-header {
    background: #111; color: var(--accent-blue); padding: 15px;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 2px solid #000; font-family: var(--font-headers); font-size: 12px;
}
.modal-close-btn {
    background: var(--accent-red); border: 2px solid #fff; color: white;
    width: 24px; height: 24px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.modal-body { padding: 25px; font-size: 1.4rem; color: #eef6ff; }
.modal-inputs input, .modal-inputs textarea {
    width: 100%; margin-top: 15px; padding: 10px;
    font-family: var(--font-body); font-size: 1.3rem; 
    border: 2px solid var(--accent-blue); background: #050510; color: white; outline: none;
}
.modal-footer {
    padding: 15px; display: flex; justify-content: flex-end; gap: 10px;
    background: #222; border-top: 2px solid #000;
}
@keyframes popIn { 0% { transform: scale(0.8); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* --- 5. TV HARDWARE --- */
.tv-set {
    width: 960px; height: 720px; position: relative;
    animation: floatTV 6s ease-in-out infinite;
}
.tv-bezel {
    width: 100%; height: 100%; background-color: var(--tv-plastic);
    border-radius: 40px; padding: 35px; display: flex; flex-direction: column;
    box-shadow: inset 5px 5px 15px rgba(255,255,255,0.15), inset -10px -10px 30px rgba(0,0,0,0.6), 0 40px 80px rgba(0,0,0,0.4);
}
.tv-chin {
    height: 70px; margin-top: 10px; display: flex; justify-content: space-between; align-items: center; padding: 0 30px;
}
.power-group { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.brand-badge { color: rgba(255,255,255,0.3); font-family: var(--font-headers); font-size: 10px; letter-spacing: 2px; }
.power-led {
    width: 12px; height: 12px; background-color: #400; border-radius: 50%;
    box-shadow: 0 0 0 2px #222; transition: all 0.3s;
}
.power-led.active { background-color: #ff3333; box-shadow: 0 0 15px #ff3333, 0 0 0 2px #222; }

.volume-group {
    display: flex; align-items: center; gap: 10px; background: #1a2328;
    padding: 5px 10px; border-radius: 4px; border: 1px solid #333; margin-right: 20px;
}
.volume-group label { color: #555; font-size: 10px; font-family: var(--font-headers); }
input[type=range] {
    -webkit-appearance: none; appearance: none; width: 80px; height: 6px;
    background: #111; border-radius: 2px; outline: none;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; width: 12px; height: 12px;
    background: var(--accent-red); border: 1px solid #000; cursor: pointer; box-shadow: 1px 1px 5px rgba(0,0,0,0.5);
}
.speaker-grill span { display: inline-block; width: 6px; height: 24px; background: #1a2328; margin-left: 6px; border-radius: 4px; }

/* --- 6. SCREEN & ANIMATIONS --- */
.crt-screen {
    flex-grow: 1; background-color: var(--screen-bg); border-radius: 60px / 20px;
    position: relative; overflow: hidden; border: 8px solid #1a1a1a;
    box-shadow: inset 0 0 80px rgba(0,0,0,0.2);
    transition: background-color 0.1s;
}

/* TV Animations */
.crt-off { animation: turnOff 0.5s ease-out forwards; }
.crt-on { animation: turnOn 0.4s ease-out forwards; }

@keyframes turnOff {
    0% { transform: scale(1, 1); filter: brightness(1); }
    40% { transform: scale(1, 0.002); filter: brightness(5); } 
    70% { transform: scale(0.5, 0.002); }
    100% { transform: scale(0, 0); filter: brightness(0); }
}
@keyframes turnOn {
    0% { transform: scale(0, 0); filter: brightness(5); }
    30% { transform: scale(0.5, 0.002); }
    60% { transform: scale(1, 0.002); }
    100% { transform: scale(1, 1); filter: brightness(1); }
}

.scanlines {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%);
    background-size: 100% 4px; pointer-events: none; z-index: 50; opacity: 0.6;
}
.screen-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(0,0,0,0.2) 100%);
    pointer-events: none; z-index: 51;
}

.screen-content {
    width: 100%; height: 100%; padding: 40px; 
    display: flex; flex-direction: column;
    color: var(--screen-text); position: relative; z-index: 10;
    overflow-y: auto; scrollbar-width: thin; scrollbar-color: #3b82f6 #000;
}
.screen-content::-webkit-scrollbar { width: 10px; }
.screen-content::-webkit-scrollbar-track { background: #050510; }
.screen-content::-webkit-scrollbar-thumb { background: #3b82f6; border: 2px solid #050510; border-radius: 4px; }

h1, h2, h3 { font-family: var(--font-headers); text-transform: uppercase; letter-spacing: -1px; }

/* --- 7. HOME & SCREENSAVER --- */
.home-layout { display: flex; height: 100%; gap: 30px; width: 100%; }

.screensaver-container {
    display: flex; justify-content: center; align-items: center; height: 100%;
    background: #000; flex-direction: column; width: 100%;
}
.saver-text {
    font-family: var(--font-headers); font-size: 3rem; color: #3b82f6;
    animation: breathe 3s infinite ease-in-out; text-shadow: 0 0 10px #3b82f6;
}
@keyframes breathe {
    0%, 100% { opacity: 0.3; transform: scale(0.95); }
    50% { opacity: 1; transform: scale(1.05); text-shadow: 0 0 30px #3b82f6; }
}

.zone-left { flex: 3; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.title-group { text-align: center; margin-bottom: 25px; }
.main-game-title { font-size: 3.5rem; color: #3b82f6; text-shadow: 4px 4px 0px #1e3a8a; margin-bottom: 5px; line-height: 1; }
.since-badge { display: inline-block; background: #1e3a8a; color: white; padding: 4px 8px; font-size: 0.8rem; font-family: var(--font-headers); border-radius: 4px; letter-spacing: 2px; }
.hero-frame { background: rgba(255,255,255,0.5); border: 4px dashed #3b82f6; border-radius: 10px; padding: 20px; margin-bottom: 20px; box-shadow: 0 0 20px rgba(59, 130, 246, 0.2); position: relative; }
.pixel-avatar { width: 100%; max-width: 320px; height: auto; image-rendering: pixelated; display: block; }
.server-stats-box { background: #111; border: 2px solid #555; padding: 10px 15px; width: 100%; max-width: 320px; font-family: monospace; font-size: 1rem; color: #0f0; box-shadow: 5px 5px 0px rgba(0,0,0,0.2); }
.server-stats-box p { margin: 4px 0; display: flex; justify-content: space-between; }
.server-stats-box span { color: #888; }
.zone-right { flex: 2; display: flex; flex-direction: column; justify-content: center; gap: 15px; }

/* --- 8. BUTTONS --- */
.retro-btn {
    font-family: var(--font-headers); font-size: 14px;
    color: white; background-color: var(--accent-blue);
    border: 4px solid #1e3a8a; padding: 15px 10px;
    width: 100%; cursor: pointer; text-align: left; display: flex; align-items: center;
    box-shadow: inset 4px 4px 0px rgba(255,255,255,0.3), inset -4px -4px 0px rgba(0,0,0,0.3), 4px 4px 0px rgba(0,0,0,0.5);
    transition: transform 0.1s;
}
.retro-btn:hover { background-color: #60a5fa; transform: translateY(-2px); }
.retro-btn:active { transform: translateY(2px); box-shadow: none; }
.btn-icon { width: 28px; height: 28px; margin-right: 15px; filter: drop-shadow(2px 2px 0px rgba(0,0,0,0.5)); image-rendering: pixelated; }

.retro-btn-small {
    font-family: var(--font-headers); font-size: 10px;
    background: #999; color: white; border: 2px solid #555; padding: 10px 15px;
    cursor: pointer; box-shadow: 3px 3px 0 rgba(0,0,0,0.3);
}
.retro-btn-small:hover { background: #aaa; }
.retro-btn-small.danger { background: var(--accent-red); border-color: #900; }
.retro-btn-small.warning { background: #f59e0b; border-color: #b45309; }
.retro-btn-small.success { background: var(--accent-green); border-color: #047857; }

.system-btn {
    position: absolute; top: 15px; left: 15px; z-index: 100;
    background: var(--accent-red); border: 2px solid #500; color: white;
    font-family: var(--font-headers); padding: 8px 12px; font-size: 10px;
    cursor: pointer; box-shadow: 3px 3px 0px #000;
}
.system-btn:hover { background: #ff6666; }

/* --- 9. TABS --- */
.profile-layout { display: flex; flex-direction: column; height: 100%; }
.section-title { font-size: 1.5rem; margin-top: 35px; margin-bottom: 20px; border-bottom: 4px solid var(--accent-blue); padding-bottom: 10px; }
.character-select-container { display: flex; gap: 30px; height: 100%; align-items: stretch; }
.char-display-box { flex: 1; background: white; border: 4px solid var(--screen-text); padding: 20px; display: flex; flex-direction: column; align-items: center; box-shadow: 8px 8px 0 rgba(0,0,0,0.1); }
.char-portrait { width: 140px; height: 140px; object-fit: cover; border: 4px solid var(--screen-text); margin-bottom: 15px; image-rendering: pixelated; background: #ccc; }
.char-stats { width: 100%; text-align: left; font-size: 1.3rem; line-height: 1.5; }
.char-stats h3 { font-size: 1.8rem; color: var(--accent-blue); margin-bottom: 10px; text-align: center; border-bottom: 2px dashed #ccc; padding-bottom: 5px; }
.highlight { color: var(--accent-blue); font-weight: bold; }
.danger { color: var(--accent-red); font-weight: bold; }
.char-grid { flex: 1; display: grid; grid-template-columns: 1fr 1fr; grid-gap: 15px; align-content: start; }
.char-btn { font-family: var(--font-headers); background: #ccc; border: 4px solid transparent; padding: 20px; cursor: pointer; text-transform: uppercase; font-size: 0.8rem; box-shadow: 4px 4px 0 rgba(0,0,0,0.1); }
.char-btn:hover { background: #ddd; transform: translateY(-2px); }
.char-btn.active { background: var(--accent-blue); color: white; border-color: var(--screen-text); box-shadow: inset 4px 4px 0 rgba(0,0,0,0.2); transform: translateY(2px); }

/* [FIX] Removed overflow-y:auto to prevent double scrollbars */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 15px; padding: 10px; }

.polaroid { background: white; padding: 8px 8px 30px 8px; box-shadow: 3px 3px 5px rgba(0,0,0,0.2); position: relative; transform: rotate(-2deg); transition: transform 0.2s; cursor: pointer; }
.polaroid:hover { transform: scale(1.05) rotate(0deg); z-index: 10; }
.polaroid img { width: 100%; height: 110px; object-fit: cover; border: 1px solid #ddd; }
.delete-overlay { position: absolute; top: -10px; right: -10px; background: var(--accent-red); color: white; width: 24px; height: 24px; text-align: center; line-height: 24px; border-radius: 50%; cursor: pointer; display: none; font-weight: bold; border: 2px solid white; box-shadow: 2px 2px 5px rgba(0,0,0,0.3); z-index: 20; }
.polaroid:hover .delete-overlay { display: block; }
.polaroid .caption { font-size: 1rem; text-align: center; margin-top: 5px; color: #555; word-wrap: break-word; }

.input-row { display: flex; gap: 10px; margin-bottom: 20px; }
.retro-input { flex: 1; font-family: var(--font-body); font-size: 1.5rem; padding: 10px; border: 2px solid #555; outline: none; }
.lists-container { display: flex; gap: 20px; flex-grow: 1; overflow: hidden; }
.list-column { flex: 1; background: white; border: 2px solid var(--screen-text); padding: 10px; overflow-y: auto; }
.list-column h3 { font-size: 1.2rem; text-align: center; background: #eee; padding: 5px; margin-bottom: 10px; }
.pixel-list { list-style: none; }
.pixel-list li { padding: 8px; border-bottom: 1px dashed #ccc; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-size: 1.3rem; }
.pixel-list li:hover { background: #f0f8ff; }
.pixel-list li.completed span { text-decoration: line-through; color: #888; }
.del-btn { background: none; border: none; color: var(--accent-red); font-family: var(--font-headers); cursor: pointer; font-size: 0.8rem; padding: 5px; }

.chat-log-box { flex-grow: 1; background: #111; color: #0f0; padding: 20px; overflow-y: auto; border: 4px solid var(--screen-text); font-family: monospace; margin-bottom: 15px; box-shadow: inset 0 0 20px rgba(0,255,0,0.2); }
.chat-bubble { margin-bottom: 15px; border-bottom: 1px dashed #333; padding-bottom: 5px; position: relative; padding-right: 20px; }
.bubble-text { font-size: 1.2rem; margin-bottom: 5px; word-wrap: break-word; }
.bubble-meta { font-size: 0.9rem; color: #888; text-align: right; font-style: italic; }
.chat-del { position: absolute; right: 0; top: 0; color: #555; cursor: pointer; font-family: sans-serif; font-weight: bold; }
.chat-del:hover { color: var(--accent-red); }

@keyframes floatTV { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.fade-in { animation: fadeIn 0.5s ease-in; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.static-noise { width: 100%; height: 100%; background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.1) 2px, rgba(0,0,0,0.1) 4px); animation: scrollStatic 0.2s infinite linear; }
@keyframes scrollStatic { 0% { background-position: 0 0; } 100% { background-position: 0 100%; } }

/* [FIX] Changed from 900px to 600px to allow Tablets */
#mobile-warning { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #111; color: var(--accent-red); z-index: 9999; flex-direction: column; align-items: center; justify-content: center; text-align: center; font-family: var(--font-headers); gap: 20px; }
@media (max-width: 600px) { #mobile-warning { display: flex; } .room-container { display: none; } }