/* Shared theme, page layout, and navigation. */
:root {
    --retro-surface: #C0C0C0;
    --retro-border-light: #DFDFDF;
    --retro-border-dark: #808080;
    --retro-hover: #E0E0E0;
    --retro-pressed: #D8D8D8;
    --retro-selection: #000080;
    --neon-green: #33FF33;
    --neon-yellow: #FFFF33;
    --neon-red: #FF3333;

    --bg-gradient: linear-gradient(135deg, #2F2F2F 50%, #A9A9A9 50%);
}

* {
    box-sizing: border-box;
    touch-action: manipulation;
}

/* Keep page widths and centering consistent when only some pages scroll. */
html {
    scrollbar-gutter: stable both-edges;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: "Times New Roman", Times, serif;
    /* classic 1999 look */
    font-size: 1.1rem;
    color: #000000;
    background-color: #6a6a6a;
    /* Fallback to prevent white flash on load */
}

/* Fixed background for all devices including iOS to prevent stretching or clipping */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-gradient);
    z-index: -1;
}

.main-frame {
    background-color: #FFFFFF;
    border: 3px solid #000000;
    width: 100%;
    max-width: 800px;
    min-width: 0;
    min-height: min(60vh, 560px);
    padding: 2rem;
    position: relative;
    /* Contains the positioned language switcher and footer links. */
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

/* Old school 1999 links */
a {
    color: blue;
    text-decoration: underline;
}

a:visited {
    color: purple;
}

a:active {
    color: red;
}

h1,
h2,
h3 {
    font-weight: bold;
    margin-top: 1em;
    margin-bottom: 0.5em;
}

hr {
    border: none;
    border-top: 1px solid #000;
    margin: 1.5em 0;
}

/* Language Switcher */
.lang-switcher {
    position: absolute;
    top: 20px;
    right: 20px;
    text-align: right;
    margin-bottom: 0;
    font-family: monospace;
    font-size: 1rem;
}

.lang-btn,
.lang-btn:visited {
    text-decoration: none;
    color: #000;
    padding: 2px 6px;
    border: 2px solid transparent;
    background: transparent;
    cursor: pointer;
}

.lang-btn:hover {
    background-color: var(--retro-hover);
}

.lang-btn.active-lang {
    font-weight: bold;
    border: 2px inset var(--retro-border-light);
    background-color: #D0D0D0;
}

/* Header Audio Controls */
.mute-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    background: transparent;
    border: 2px solid var(--neon-green);
    color: var(--neon-green);
    cursor: pointer;
    border-radius: 5px;
    padding: 8px;
    box-shadow: 0 0 5px var(--neon-green) inset;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

.mute-btn:active {
    background-color: var(--neon-green);
    color: #000;
}

/* Footer Links */
.footer-links {
    position: absolute;
    bottom: 12px;
    right: 20px;
    font-family: monospace;
    font-size: 0.85rem;
    color: #000;
}

.footer-links a {
    color: #000;
    text-decoration: underline;
}

.footer-links a:visited {
    color: #000;
}

.footer-links a:hover {
    background-color: var(--retro-hover);
    text-decoration: none;
}

/* List item spacing */
.main-frame ul li {
    margin-bottom: 12px;
}

/* --- Terminal Link (on retro pages) --- */
.terminal-link {
    position: absolute;
    bottom: 12px;
    left: 20px;
    font-family: monospace;
    font-size: 1rem;
}

.terminal-link a {
    color: #000;
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
    padding: 0 4px;
    margin: 0 -4px;
}

.terminal-link a:hover {
    background-color: #000;
    color: var(--terminal-hover-color, var(--neon-green));
}

/* Shared animation for the homepage preview and arcade prompt. */
@keyframes blinker {
    50% {
        opacity: 0.3;
    }
}

/* Responsive Design for smaller screens */
@media (max-width: 768px) {
    body {
        padding: 10px;
        font-size: 1rem;
    }

    .main-frame {
        padding: 1rem;
        padding-bottom: 2rem;
    }

    .lang-switcher {
        position: static;
        text-align: right;
        margin-bottom: 15px;
    }

    .footer-links {
        position: static;
        margin-top: 30px;
        text-align: center;
        display: block;
    }

    .mute-btn {
        top: 12px;
        left: 12px;
        padding: 6px;
    }

    .terminal-link {
        position: static;
        text-align: center;
        margin-top: 15px;
        display: block;
    }
}
