/* Background gradient from the previous style */
:root {
    --bg-gradient: linear-gradient(135deg, #2F2F2F 50%, #A9A9A9 50%);
}

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

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-height: 60vh;
    padding: 2rem;
    position: relative;
    /* added to contain absolute lang-switcher */
    /* Keeps the shadow from the previous design as it looks nice with the frame */
    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;
}

/* Projects Layout */
.projects-container {
    display: flex;
    gap: 0;
    margin-top: 1.5em;
    border: 2px solid #000;
    background-color: #C0C0C0;
    /* classic Win95 grey */
    padding: 2px;
}

.projects-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 2px solid #000;
    background-color: #FFF;
    padding: 10px;
    gap: 10px;
}

.project-item {
    display: block;
    padding: 10px;
    border: 2px outset #DFDFDF;
    background-color: #E0E0E0;
    color: #000;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
}

.project-item:active {
    border: 2px inset #DFDFDF;
    background-color: #D0D0D0;
}

.project-item.active {
    background-color: #000080;
    /* classic 1999 selected navy blue */
    color: #FFF;
    border: 2px inset #DFDFDF;
}

.project-details {
    flex: 2;
    padding: 20px;
    background-color: #FFF;
    min-height: 300px;
}

.project-detail {
    display: none;
}

.project-detail.active {
    display: block;
}

.project-detail h3 {
    margin-top: 0;
}

.image-placeholder {
    margin-top: 20px;
    width: 100%;
    height: 200px;
    border: 2px dashed #000;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #000;
    background-color: #E0E0E0;
    font-style: italic;
}

.project-image {
    margin-top: 20px;
    max-width: 100%;
    height: auto;
    border: 2px solid #000;
    display: block;
    box-shadow: 2px 2px 0px #000;
    /* retro drop shadow style */
}

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

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

.lang-btn:hover {
    background-color: #E0E0E0;
}

.lang-btn.active-lang {
    font-weight: bold;
    border: 2px inset #DFDFDF;
    background-color: #D0D0D0;
}

.mute-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    background: transparent;
    border: 2px solid #33FF33;
    color: #33FF33;
    cursor: pointer;
    border-radius: 5px;
    padding: 8px;
    box-shadow: 0 0 5px #33FF33 inset;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

.mute-btn:active {
    background-color: #33FF33;
    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: #E0E0E0;
    text-decoration: none;
}

/* Hide elements based on active language */
html[data-lang="en"] [data-lang="de"] {
    display: none !important;
}

html[data-lang="de"] [data-lang="en"] {
    display: none !important;
}

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

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

    .main-frame {
        padding: 1rem;
        /* Increase bottom padding to make space for footer links if absolute, or keep normal if static */
        padding-bottom: 2rem;
    }

    .projects-container {
        flex-direction: column;
    }

    .projects-list {
        border-right: none;
        border-bottom: 2px solid #000;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .project-item {
        flex: 1 1 auto;
    }

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

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

    .arcade-mode .footer-links {
        position: absolute;
        bottom: 20px;
        margin-top: 0;
        width: calc(100% - 2rem);
        left: 1rem;
    }

    .main-frame.arcade-mode {
        border-width: 8px;
        padding: 1.5rem 1rem;
        padding-bottom: 5rem;
    }

    .arcade-game-list {
        margin-top: 25px;
        gap: 15px;
    }

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

/* --- Arcade Machine Link --- */
.arcade-cabinet-link {
    position: absolute;
    bottom: 35px;
    /* Above footer links */
    right: 20px;
    width: 60px;
    cursor: pointer;
}

.arcade-cabinet-link a {
    display: block;
    text-decoration: none;
    color: inherit;
}

.arcade-top {
    background-color: #CC0000;
    color: #FFFF00;
    font-size: 8px;
    font-family: monospace;
    font-weight: bold;
    text-align: center;
    border: 2px outset #FF3333;
    border-radius: 5px 5px 0 0;
    padding: 2px 0;
}

.arcade-screen {
    background-color: #000;
    border: 3px inset #666;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.arcade-screen .blinking-text {
    color: #00FF00;
    font-size: 10px;
    font-family: monospace;
    font-weight: bold;
    animation: blinker 2.5s linear infinite;
}

@keyframes blinker {
    50% {
        opacity: 0.3;
    }
}

.arcade-panel {
    background-color: #888;
    border: 2px outset #AAA;
    height: 15px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 5px;
}

.joystick {
    width: 4px;
    height: 8px;
    background-color: #333;
    position: relative;
    border-radius: 2px;
}

.joystick::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -2px;
    width: 8px;
    height: 8px;
    background-color: #FF0000;
    border-radius: 50%;
}

.button {
    width: 6px;
    height: 6px;
    background-color: #0000FF;
    border-radius: 50%;
    border: 1px solid #000;
}

.arcade-bottom {
    background-color: #333;
    height: 15px;
    border: 2px outset #555;
    border-top: none;
}

.arcade-cabinet-link:hover {
    transform: scale(1.05);
}

.arcade-cabinet-link:active {
    transform: scale(0.95);
}

@media (max-width: 768px) {
    .arcade-cabinet-link {
        position: static;
        margin: 20px 0 0 auto;
    }
}

/* --- Arcade Background (Space) Removed per user request --- */

/* --- Arcade Mode (Full Screen Effect) --- */
.main-frame.arcade-mode {
    background-color: #050505;
    border: 15px inset #333;
    color: #33FF33;
    font-family: "Courier New", Courier, monospace;
    position: relative;
    overflow: hidden;
    text-shadow: 0 0 5px #33FF33;
    box-shadow: 0 0 20px #000 inset, 0 20px 40px rgba(0, 0, 0, 0.5);
    min-height: 70vh;
}

.main-frame.arcade-mode::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    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));
    z-index: 2;
    background-size: 100% 4px, 3px 100%;
    pointer-events: none;
    /* Let clicks pass through to links */
}

.main-frame.arcade-mode h1,
.main-frame.arcade-mode h2 {
    color: #33FF33;
    text-transform: uppercase;
    text-align: center;
    letter-spacing: 2px;
    font-size: clamp(1.3rem, 5.5vw, 2.5rem);
}

.main-frame.arcade-mode a {
    color: #FFFF33;
    text-decoration: none;
    font-weight: bold;
    z-index: 10;
    position: relative;
}

.main-frame.arcade-mode a:hover {
    color: #FF3333;
    background-color: transparent;
    text-shadow: 0 0 10px #FF3333;
}

.main-frame.arcade-mode hr {
    border-top: 2px dashed #33FF33;
}

.arcade-game-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    margin-top: 50px;
}

.arcade-game-item {
    font-size: clamp(1.1rem, 4.5vw, 1.5rem);
    cursor: pointer;
    transition: all 0.1s;
    position: relative;
}

.arcade-game-item::before {
    content: "►";
    position: absolute;
    left: -1.2em;
    opacity: 0;
    transition: opacity 0.1s;
}

.arcade-mode .credit-text {
    font-size: clamp(0.9rem, 3.5vw, 1.2rem);
}

.arcade-game-item:hover {
    transform: scale(1.1);
}

.arcade-game-item:hover::before {
    opacity: 1;
}

.main-frame.arcade-mode a[href="arcade/snake.html"]:hover {
    color: #33FF33;
    text-shadow: 0 0 10px #33FF33;
}

.main-frame.arcade-mode a[href="arcade/flappy.html"]:hover {
    color: #FFFF33;
    text-shadow: 0 0 10px #FFFF33;
}

.main-frame.arcade-mode a[href="arcade/neon_drift.html"]:hover {
    color: #F0F;
    text-shadow: 0 0 10px #F0F;
}

.arcade-mode .lang-switcher a {
    color: #33FF33;
}

.arcade-mode .lang-switcher a:hover {
    color: #FF3333;
}

.arcade-mode .footer-links {
    width: calc(100% - 40px);
}

/* --- Snake Game / Arcade Game Styles --- */
.snake-mode,
.flappy-mode {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.snake-header,
.game-header {
    width: 400px;
    max-width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 30px;
    margin-bottom: 10px;
}

.snake-header h1,
.game-header h1 {
    margin: 0;
    font-size: clamp(1.3rem, 5vw, 2rem);
    line-height: 1;
}

.score-display {
    font-size: clamp(1.1rem, 4vw, 1.5rem);
    font-weight: bold;
    min-width: 120px;
    text-align: right;
    white-space: nowrap;
}

.canvas-container {
    position: relative;
    border: 4px solid #33FF33;
    box-shadow: 0 0 15px #33FF33, inset 0 0 10px #33FF33;
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1 / 1;
    background: #000;
}

canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.game-overlay p {
    font-size: 1.5rem;
    margin: 10px 0;
    text-align: center;
}

/* Mobile Controls */
.mobile-controls {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.d-pad-row {
    display: flex;
    gap: 10px;
}

.d-pad-btn {
    width: 50px;
    height: 50px;
    background-color: #222;
    border: 2px solid #33FF33;
    color: #33FF33;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 5px;
    box-shadow: 0 0 5px #33FF33 inset;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.d-pad-btn:active {
    background-color: #33FF33;
    color: #000;
}

.mobile-start-btn {
    margin-top: 20px;
    padding: 10px 20px;
    background-color: #222;
    border: 2px solid #FFFF33;
    color: #FFFF33;
    font-family: inherit;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 0 5px #FFFF33 inset;
}

.mobile-start-btn:active {
    background-color: #FFFF33;
    color: #000;
}

.mobile-action-btn {
    width: 100%;
    max-width: 300px;
    margin-top: 20px;
    padding: 20px;
    background-color: #222;
    border: 2px solid #FF3333;
    color: #FF3333;
    font-family: inherit;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 0 10px #FF3333 inset;
    border-radius: 10px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.mobile-action-btn:active {
    background-color: #FF3333;
    color: #000;
}

/* --- Terminal Link --- */
.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, #33FF33);
}

@media (max-width: 768px) {
    .terminal-link {
        position: static;
        text-align: center;
        margin-top: 15px;
        display: block;
    }
}

/* --- Neon Drift Game Styles --- */
.neon-drift-mode {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.neon-drift-mode .game-header h1 {
    color: #0FF;
    text-shadow: 0 0 10px #0FF, 0 0 20px #0FF;
}

.neon-drift-mode .score-display {
    color: #F0F;
    text-shadow: 0 0 10px #F0F;
}

.neon-canvas-container {
    border: 4px solid #F0F;
    box-shadow: 0 0 15px #F0F, inset 0 0 10px #F0F;
}

.neon-drift-btn-left,
.neon-drift-btn-right {
    width: 70px;
    height: 50px;
    border-color: #F0F;
    box-shadow: 0 0 5px #F0F inset;
    color: #F0F;
}

.neon-drift-btn-left:active,
.neon-drift-btn-right:active {
    background-color: #F0F;
    color: #000;
}

.neon-drift-start-btn {
    border-color: #0FF;
    color: #0FF;
    box-shadow: 0 0 5px #0FF inset;
}

.neon-drift-start-btn:active {
    background-color: #0FF;
    color: #000;
}

/* --- Difficulty Selection Buttons --- */
.difficulty-btns {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    z-index: 10;
    width: 95%;
    flex-wrap: wrap;
}

.difficulty-btns .diff-btn {
    width: auto;
    margin-top: 0;
    padding: clamp(4px, 1.2vw, 8px) clamp(8px, 2vw, 12px);
    font-size: clamp(0.75rem, 3.2vw, 0.95rem);
    text-transform: uppercase;
}

/* --- Flappy Pixel Game Styles --- */
.flappy-mode .game-header h1 {
    color: #FFFF33;
    text-shadow: 0 0 10px #FFFF33, 0 0 20px #FFFF33;
}

.flappy-mode .score-display {
    color: #FF3333;
    text-shadow: 0 0 10px #FF3333;
}

.flappy-canvas-container {
    border: 4px solid #FFFF33;
    box-shadow: 0 0 15px #FFFF33, inset 0 0 10px #FFFF33;
}