:root {
    --bg-color: #0a0a0a;
    --text-main: #00ff00;
    --text-dim: #008800;
    --text-alert: #ff003c;
    --text-yellow: #ffcc00;
    --panel-bg: #111;
    --border-color: #333;
    --header-bg: #1a1a1a;
    --font-main: 'Fira Code', monospace;
    --font-retro: 'VT323', monospace;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-main);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* CRT Effects */
.crt-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
    z-index: 100;
}

.scanlines {
    position: fixed;
    top: 0; left: 0; 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);
    pointer-events: none;
    z-index: 101;
}

/* Screens */
.screen {
    display: none;
    width: 100%;
    height: 100%;
}
.screen.active {
    display: flex;
    flex-direction: column;
}

/* Boot Screen */
#boot-screen {
    justify-content: center;
    align-items: center;
    background-color: #000;
    padding: 15px;
}
.boot-terminal {
    width: 90%;
    max-width: 800px;
    height: 85%;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    background: #050505;
    padding: 15px;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.1);
}
.boot-header {
    font-family: var(--font-retro);
    font-size: 1.6rem;
    margin-bottom: 15px;
    color: var(--text-yellow);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
}
.boot-log {
    flex-grow: 1;
    overflow-y: auto;
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 15px;
    font-family: var(--font-main);
    white-space: pre-wrap;
}
#boot-btn {
    background: var(--text-main);
    color: #000;
    border: none;
    padding: 12px 24px;
    font-family: var(--font-main);
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    align-self: flex-start;
    transition: background 0.2s;
}
#boot-btn:hover {
    background: #fff;
    box-shadow: 0 0 10px var(--text-main);
}

/* App Container */
.browser-header {
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    min-height: 60px;
}
.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.sys-title {
    font-weight: bold;
    color: #fff;
    font-size: 0.95rem;
    white-space: nowrap;
}
.blink {
    animation: blinker 1s linear infinite;
    color: var(--text-alert);
}
@keyframes blinker {
    50% { opacity: 0; }
}
.nav-buttons {
    display: flex;
    gap: 5px;
}
.nav-btn {
    background: var(--panel-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.85rem;
    border-radius: 3px;
}
.nav-btn:hover {
    background: #333;
    color: #fff;
}
.address-bar-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    background: #000;
    border: 1px solid var(--border-color);
    padding: 5px 10px;
    border-radius: 4px;
}
.protocol-label {
    color: var(--text-dim);
    margin-right: 8px;
    font-weight: bold;
    font-size: 0.85rem;
}
#address-bar {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-family: var(--font-main);
    outline: none;
    font-size: 0.9rem;
    width: 100%;
}
#go-btn {
    background: var(--panel-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 3px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    border-radius: 3px;
    margin-left: 5px;
}
#go-btn:hover {
    background: var(--text-main);
    color: #000;
}
.status-indicator {
    font-size: 0.75rem;
    display: flex;
    flex-direction: column;
}
.status-label {
    color: var(--text-dim);
    font-size: 0.65rem;
}
.status-val {
    font-weight: bold;
}
#audio-toggle {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 3px;
    font-size: 0.9rem;
}
#audio-toggle:hover {
    background: #333;
}

.text-green { color: var(--text-main); }
.text-yellow { color: var(--text-yellow); }
.text-alert { color: var(--text-alert); }

/* Workspace */
.workspace {
    display: flex;
    flex-direction: row;
    flex-grow: 1;
    overflow: hidden;
}

/* Viewport */
.viewport {
    flex-grow: 1;
    background-color: #fff;
    color: #000;
    overflow-y: auto;
    padding: 20px;
    position: relative;
}

/* Terminal Panel */
.terminal-panel {
    width: 360px;
    background-color: var(--panel-bg);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.panel-header {
    background: #1a1a1a;
    padding: 10px 15px;
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-dim);
}
.panel-status {
    color: var(--text-main);
    font-weight: bold;
}
.terminal-output {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    font-size: 0.85rem;
    line-height: 1.4;
    font-family: var(--font-main);
}
.terminal-input-line {
    display: flex;
    padding: 10px 15px;
    border-top: 1px solid var(--border-color);
    background: #000;
    align-items: center;
}
.prompt {
    margin-right: 8px;
    color: var(--text-main);
    font-weight: bold;
}
#term-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: var(--font-main);
    outline: none;
    font-size: 0.85rem;
}

/* Footer */
.browser-footer {
    background-color: var(--header-bg);
    border-top: 1px solid var(--border-color);
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-dim);
    gap: 10px;
}
.footer-item {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#footer-tip {
    text-align: right;
    color: var(--text-yellow);
}

/* Surface Web Styles */
.surface-page {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    max-width: 800px;
    margin: 0 auto;
    color: #222;
}
.surface-header {
    border-bottom: 2px solid #eaeaea;
    padding-bottom: 15px;
    margin-bottom: 20px;
}
.surface-header h1 {
    color: #111;
    font-size: 1.8rem;
}
.surface-nav {
    margin-top: 10px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}
.surface-nav a {
    color: #0066cc;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
}
.surface-nav a:hover {
    text-decoration: underline;
}
.post {
    border: 1px solid #e1e4e8;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 6px;
    background: #fcfcfc;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.post-title {
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 8px;
    color: #0056b3;
}
.post-meta {
    font-size: 0.8rem;
    color: #6a737d;
    margin-bottom: 12px;
}
.post-content {
    line-height: 1.6;
    font-size: 0.95rem;
}
.fake-link {
    color: #0066cc;
    text-decoration: underline;
    cursor: pointer;
    font-weight: bold;
}
.fake-link:hover {
    color: #004499;
}

/* Fog Styles */
.fog-page {
    background-color: #000;
    color: #ff003c;
    font-family: var(--font-retro);
    padding: 20px;
    min-height: 100%;
}
.fog-title {
    font-size: 2.2rem;
    text-align: center;
    margin-bottom: 20px;
    text-shadow: 0 0 8px #ff003c;
    letter-spacing: 2px;
}
.fog-text {
    font-size: 1.3rem;
    line-height: 1.6;
    margin-bottom: 15px;
}

/* Responsive Media Queries */
@media (max-width: 992px) {
    .terminal-panel {
        width: 300px;
    }
}

@media (max-width: 768px) {
    /* Stack workspace vertically */
    .workspace {
        flex-direction: column;
    }
    
    /* Viewport takes remaining space */
    .viewport {
        flex-grow: 1;
        height: auto;
        padding: 15px;
    }
    
    /* Terminal Panel sits at the bottom */
    .terminal-panel {
        width: 100%;
        height: 220px;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }
    
    /* Make header wrap nicely */
    .browser-header {
        flex-direction: column;
        align-items: stretch;
        height: auto;
        padding: 8px 12px;
        gap: 8px;
    }
    
    .header-left {
        justify-content: space-between;
        width: 100%;
    }
    
    .address-bar-container {
        margin: 0;
        width: 100%;
    }
    
    .header-right {
        justify-content: space-between;
        width: 100%;
        border-top: 1px solid #222;
        padding-top: 6px;
    }
    
    .status-indicator {
        flex-direction: row;
        gap: 5px;
        align-items: center;
    }
    
    .status-label {
        font-size: 0.7rem;
    }
    
    .status-val {
        font-size: 0.7rem;
    }
    
    /* Boot screen adjustments */
    .boot-terminal {
        width: 95%;
        height: 90%;
        padding: 10px;
    }
    .boot-header {
        font-size: 1.3rem;
    }
    
    /* Footer adjustments */
    .browser-footer {
        flex-direction: column;
        gap: 4px;
        align-items: flex-start;
        padding: 6px 12px;
    }
    #footer-tip {
        text-align: left;
    }
}

@media (max-width: 480px) {
    .sys-title {
        font-size: 0.85rem;
    }
    .nav-btn {
        padding: 4px 8px;
        font-size: 0.75rem;
    }
    .terminal-panel {
        height: 180px;
    }
    .surface-header h1 {
        font-size: 1.4rem;
    }
    .post {
        padding: 15px;
    }
    .post-title {
        font-size: 1.1rem;
    }
}

/* Custom Scrollbars for retro look */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #000;
}
::-webkit-scrollbar-thumb {
    background: #333;
    border: 1px solid var(--border-color);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

/* 90s Web Styles */
.site-news {
    background-color: #000080;
    color: #c0c0c0;
    font-family: "Times New Roman", Times, serif;
    min-height: 100%;
    padding: 20px;
}
.site-news .surface-header h1 { color: #ffffff; }
.site-news .post { background: #c0c0c0; color: #000; border: 2px inset #fff; }
.site-news .post-title { color: #000080; }

.site-weather {
    background-color: #87CEEB;
    color: #000;
    font-family: "Comic Sans MS", "Comic Sans", cursive, sans-serif;
    min-height: 100%;
    padding: 20px;
}
.site-weather .surface-header h1 { color: #000080; text-shadow: 2px 2px #fff; }
.site-weather .post { background: #fff; border: 3px dashed #FFD700; }

.site-recipes {
    background-color: #FFFAF0;
    font-family: Georgia, serif;
    min-height: 100%;
    padding: 20px;
}
.site-recipes .surface-header h1 { color: #8B4513; }
.site-recipes .post { background: rgba(255, 255, 255, 0.9); border: 5px ridge #8B4513; }

.site-pets {
    background-color: #FFB6C1;
    font-family: "Verdana", sans-serif;
    min-height: 100%;
    padding: 20px;
}
.site-pets .surface-header h1 { color: #FF1493; text-align: center; text-decoration: blink; }
.site-pets .post { background: #FFF0F5; border: 4px dotted #FF69B4; border-radius: 15px; }

.site-forum {
    background-color: #000;
    color: #00FF00;
    font-family: "Courier New", Courier, monospace;
    min-height: 100%;
    padding: 20px;
}
.site-forum .surface-header h1 { color: #00FF00; border-bottom: 1px solid #00FF00; }
.site-forum .post { background: #111; border: 1px solid #00FF00; color: #00FF00; }
.site-forum .post-title { color: #00FFFF; }
.site-forum .post-meta { color: #888; }
