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

html, body {
    background: #000;
    color: #0f0;
    font-family: 'Courier New', monospace;
    min-height: 100%;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

#container {
    width: 1100px;
    height: 800px;
    position: relative;
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid #0f0;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.3);
    overflow: hidden;
    z-index: 10;
}

#c {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#matrix-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

#header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(0, 20, 0, 0.95);
    border-bottom: 2px solid #0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

#header h1 {
    font-size: 24px;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: 0 0 10px #0f0;
}

#sidebar {
    position: absolute;
    left: 0;
    top: 60px;
    bottom: 60px;
    width: 205px;
    background: rgba(0, 20, 0, 0.95);
    border-right: 2px solid #0f0;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

#nav {
    padding: 20px 10px;
    max-height: 240px;
    border-bottom: 1px solid #0f0;
    flex-shrink: 0;
    overflow-y: auto;
    /* Ensure the nav fills available space */
    flex-grow: 1;
}

#nav a {
    display: block;
    color: #0f0;
    text-decoration: none;
    padding: 12px 15px;
    margin: 5px 0;
    border: 1px solid transparent;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 12px;
}

#nav a:hover, #nav a.active {
    background: rgba(0, 255, 0, 0.1);
    border-color: #0f0;
    text-shadow: 0 0 5px #0f0;
}

#shoutbox-container {
    position: absolute;
    width: 100%;
    bottom: 0;
    flex-shrink: 0;
    padding: 10px;
    overflow: hidden;
    background: linear-gradient(to bottom, #00ff00, #ff01ea);
    border: 1px solid #0a0;
    height: 440px;
    /* Ensure proper height calculation */
    box-sizing: border-box;
}

#shoutbox-form {
    padding: 10px;
    border-top: 1px solid #0f0;
    background: rgba(0, 30, 0, 0.5);
}

#footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(0, 20, 0, 0.95);
    border-top: 2px solid #0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

#footer p {
    font-size: 12px;
    color: #0a0;
    letter-spacing: 1px;
}

#main {
    position: absolute;
    top: 60px;
    left: 200px;
    right: 0;
    bottom: 60px;
    overflow-y: auto;
    padding: 30px;
    z-index: 10;
}

#main h2 {
    font-size: 28px;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: 0 0 8px #0f0;
    border-bottom: 1px solid #0f0;
    padding-bottom: 10px;
}

#main p {
    margin-bottom: 15px;
    line-height: 1.8;
    font-size: 14px;
}

#main ul {
    margin: 15px 0;
    padding-left: 20px;
}

#main li {
    margin: 8px 0;
    list-style: square;
}

#main a {
    color: #0f0;
    text-decoration: underline;
}

#main a:hover {
    text-shadow: 0 0 5px #0f0;
}

.link-list {
    list-style: none !important;
    padding: 0 !important;
}

.link-list li {
    padding: 10px;
    border: 1px solid #0f0;
    margin: 10px 0;
    transition: all 0.3s;
}

.link-list li:hover {
    background: rgba(0, 255, 0, 0.1);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

.blog-post {
    border: 1px solid #0f0;
    padding: 20px;
    margin: 20px 0;
    background: rgba(0, 30, 0, 0.3);
}

.blog-post h3 {
    font-size: 18px;
    margin-bottom: 10px;
    text-shadow: 0 0 5px #0f0;
}

.blog-post .date {
    font-size: 12px;
    color: #0a0;
    margin-bottom: 10px;
}


.ascii-art {
    text-align: center;
    overflow: hidden;
    width: 100%;
}

.ascii-art pre {
    display: inline-block;
    text-align: left;
    white-space: pre;
    line-height: 1;
    margin: 0;
    padding: 0;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #001100;
}

::-webkit-scrollbar-thumb {
    background: #0f0;
}

::-webkit-scrollbar-thumb:hover {
    background: #0a0;
}

/* Hide mobile-only elements on desktop always */
#mobile-shoutbox-overlay {
    display: none;
    position: fixed;
}
#mobile-sb-toggle {
    display: none;
}
#mobile-shoutbox-backdrop {
    display: none;
}
.mobile-title {
    display: none;
}

/* =============================================
   MOBILE STYLES - phones only (max 600px)
   ============================================= */
@media (max-width: 600px) {

    html, body {
        overflow: auto;
        align-items: flex-start;
        justify-content: flex-start;
        height: 100%;
    }

    #container {
        width: 100vw;
        height: 100vh;
        min-height: 100vh;
        border: none;
        box-shadow: none;
        overflow: hidden;
    }

    /* Hide desktop ASCII art header */
    #header .ascii-art {
        display: none;
    }

    /* Show mobile header text instead */
    #header .mobile-title {
        display: block;
        font-size: 22px;
        letter-spacing: 6px;
        text-transform: uppercase;
        text-shadow: 0 0 10px #0f0, 0 0 20px #0f0;
        font-family: 'Courier New', monospace;
        color: #0f0;
    }

    #header {
        height: 50px;
        justify-content: center;
    }

    /* Sidebar becomes horizontal nav bar */
    #sidebar {
        position: absolute;
        top: 50px;
        left: 0;
        right: 0;
        bottom: auto;
        width: 100%;
        height: auto;
        flex-direction: row;
        border-right: none;
        border-bottom: 2px solid #0f0;
        z-index: 100;
    }

    /* Hide shoutbox in sidebar on mobile */
    #shoutbox-container {
        display: none;
    }

    /* Nav links go horizontal */
    #nav {
        display: flex;
        flex-direction: row;
        padding: 0;
        max-height: none;
        border-bottom: none;
        flex-grow: 0;
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
    }

    #nav a {
        padding: 8px 12px;
        margin: 0;
        font-size: 10px;
        white-space: nowrap;
        flex-shrink: 0;
        display: flex;
        align-items: center;
    }

    /* Main content full width below nav */
    #main {
        position: absolute;
        top: 100px; /* header (50px) + nav (50px) */
        left: 0;
        right: 0;
        bottom: 50px;
        padding: 15px;
    }

    #footer {
        height: 50px;
    }

    #footer p {
        font-size: 10px;
        text-align: center;
        padding: 0 10px;
    }

    /* Floating shoutbox toggle button - always visible bottom right */
    #mobile-sb-toggle {
        display: flex;
        position: fixed;
        bottom: 10px;
        right: 10px;
        z-index: 21;
        background: rgba(0, 20, 0, 0.95);
        border: 1px solid #0f0;
        color: #0f0;
        font-family: 'Courier New', monospace;
        font-size: 11px;
        padding: 6px 10px;
        cursor: pointer;
        letter-spacing: 1px;
        text-shadow: 0 0 5px #0f0;
        box-shadow: 0 0 8px rgba(0, 255, 0, 0.3);
    }

    #mobile-sb-toggle:hover {
        background: rgba(0, 255, 0, 0.1);
    }

    /* Backdrop sits between canvas (z:1) and container (z:10) */
    #mobile-shoutbox-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 5;
        background: rgba(0, 0, 0, 0.6);
    }

    #mobile-shoutbox-backdrop.open {
        display: block;
    }

    /* Make container fully transparent when shoutbox open so matrix shows through */
    #container.sb-open {
        background: rgba(0, 0, 0, 0) !important;
        border-color: transparent !important;
        box-shadow: none !important;
    }

    /* Keep header, sidebar, footer, main hidden when shoutbox open */
    #container.sb-open #header,
    #container.sb-open #sidebar,
    #container.sb-open #footer,
    #container.sb-open #main {
        opacity: 0;
    }

    /* Shoutbox and toggle stay on top of everything */
    #mobile-shoutbox-overlay {
        z-index: 20;
    }

    #mobile-sb-toggle {
        z-index: 21;
    }

    /* Shoutbox overlay - fully centered on screen */
    #mobile-shoutbox-overlay {
        display: none;
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 20;
        background: linear-gradient(to bottom, #00ff00, #ff01ea);
        border: 1px solid #0a0;
        box-shadow: 0 0 15px rgba(0, 255, 0, 0.4);
        padding: 5px;
    }

    #mobile-shoutbox-overlay.open {
        display: block;
    }
}

/* Blog */
.blog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.blog-header h2 {
    margin: 0;
}

.blog-login-btn {
    font-size: 0.8em;
    color: #555;
    text-decoration: none;
    border: 1px solid #333;
    padding: 3px 10px;
}

.blog-login-btn:hover {
    color: #00ff00;
    border-color: #00ff00;
}

.blog-post {
    cursor: pointer;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #333;
    background: rgba(0, 0, 0, 0.3);
    transition: background 0.2s;
}

.blog-post:hover {
    background: rgba(0, 0, 0, 0.5);
}

.blog-post .post-title {
    margin: 0 0 5px 0;
    color: #00ff00;
    font-size: 1.4em;
}

.blog-post .post-date {
    color: #888;
    font-size: 0.9em;
    display: block;
    margin-bottom: 10px;
}

.blog-post .post-excerpt {
    color: #ccc;
    line-height: 1.6;
    font-size: 16px;
}

.blog-post .post-full {
    color: #ccc;
    line-height: 1.6;
    margin-top: 10px;
}

#main .blog-post .post-full p {
    font-size: 16px;
}

.blog-post .post-full h1,
.blog-post .post-full h2,
.blog-post .post-full h3 {
    color: #00ff00;
    margin-top: 15px;
    margin-bottom: 10px;
}

.blog-post .post-full strong {
    color: #fff;
}

.blog-post .post-full em {
    color: #aaa;
}

.blog-post .post-full a {
    color: #00ff00;
    text-decoration: underline;
}

.blog-post .post-full code {
    background: #222;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
}

.blog-post .post-full blockquote {
    border-left: 3px solid #00ff00;
    padding-left: 15px;
    margin: 10px 0;
    color: #888;
    font-style: italic;
}

.blog-post .post-full ul {
    margin: 10px 0;
    padding-left: 20px;
}

.blog-post .post-full li {
    margin: 5px 0;
}

.close-btn {
    display: inline-block;
    margin-top: 15px;
    padding: 8px 16px;
    background: #333;
    color: #00ff00;
    border: 1px solid #00ff00;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.2s;
}

.close-btn:hover {
    background: #444;
}

.blog-post .post-full img {
    max-width: 100%;
    max-height: 500px;
    height: auto;
    display: block;
    margin: 10px 0;
}
