/* --- 8-BIT RETRO RIVER STYLE SHEET --- */

/* Root variable system for pixel-art theme */
:root {
    --bg-dark: #050505;
    --cabinet-border: #333333;
    --bezel-color: #121212;
    --primary-blue: #888888;
    --river-water: #2a7ee6;
    --text-white: #ffffff;
    --text-yellow: #cccccc;
    --text-green: #ffffff;
    --text-red: #888888;
    --text-cyan: #ffffff;
    --btn-gray: #3a3a3a;
    
    /* Pixel borders */
    --pixel-border-color: #ffffff;
    --pixel-shadow: 4px 4px 0px rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    image-rendering: pixelated; /* Crucial for retro styling */
}

body {
    background-color: var(--bg-dark);
    color: var(--text-white);
    font-family: 'VT323', monospace;
    font-size: 22px;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* CRT Screen Effects */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, rgba(0, 0, 0, 0.4) 100%);
    pointer-events: none;
    z-index: 1000;
}

.crt-bezel-reflection {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0) 30%, rgba(0, 0, 0, 0) 70%, rgba(0, 0, 0, 0.15) 100%);
    pointer-events: none;
    z-index: 999;
}

.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.25) 50%
    );
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 10;
}

/* Arcade Cabinet Wrapping Frame */
.arcade-cabinet {
    width: 95vw;
    height: 92vh;
    max-width: 1200px;
    background-color: var(--bezel-color);
    border: 8px solid var(--cabinet-border);
    box-shadow: 
        0 0 0 8px #000,
        0 15px 0 #000,
        0 20px 25px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    position: relative;
    padding: 10px;
    overflow: hidden;
}

/* Retro Border Helper */
.retro-border {
    border: 4px solid var(--pixel-border-color);
    box-shadow: 
        0 4px 0 #000, 
        4px 0 0 #000, 
        -4px 0 0 #000, 
        0 -4px 0 #000,
        inset -4px -4px 0 rgba(0, 0, 0, 0.2), 
        inset 4px 4px 0 rgba(255, 255, 255, 0.1);
}

/* HUD System */
.retro-hud {
    background-color: #0b0c10;
    border: 4px solid #1a1c23;
    box-shadow: 0 4px 0 #000;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: 'Press Start 2P', cursive;
    font-size: 12px;
    z-index: 20;
    color: var(--text-white);
}

.header-hud {
    margin-bottom: 8px;
    border-bottom: 4px solid #fff;
}

.footer-hud {
    margin-top: 8px;
    border-top: 4px solid #fff;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.title-container h1 {
    font-size: 18px;
    color: var(--text-cyan);
    text-shadow: 3px 3px 0px #000;
}

.stats-container {
    display: flex;
    gap: 24px;
    align-items: center;
}

.controls-container {
    display: flex;
    gap: 8px;
}

/* River Stage (Screen Area) */
.river-stage {
    flex-grow: 1;
    position: relative;
    background-color: var(--river-water);
    border: 4px solid #000;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#river-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
}

/* Welcome Overlay */
.welcome-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 16, 22, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    cursor: pointer;
}

.welcome-box {
    background-color: #1a1c23;
    padding: 30px;
    max-width: 500px;
    text-align: center;
}

.welcome-box h2 {
    font-family: 'Press Start 2P', cursive;
    font-size: 18px;
    color: var(--text-yellow);
    margin-bottom: 20px;
    text-shadow: 2px 2px 0px #000;
}

.welcome-box p {
    margin-bottom: 16px;
    line-height: 1.5;
}

/* Form Controls */
.submit-wrapper, .prompt-wrapper {
    background-color: #14161f;
    padding: 8px 12px;
    border: 2px solid #2c2f3f;
    border-radius: 0;
}

.prompt-wrapper {
    text-align: center;
    font-family: 'VT323', monospace;
    font-size: 20px;
}

.retro-form .form-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 10px;
    color: var(--text-yellow);
}

.flex-grow-2 { flex-grow: 2; }
.flex-grow-3 { flex-grow: 3; }

.retro-input {
    background-color: #000000;
    color: var(--text-white);
    border: 3px solid var(--btn-gray);
    padding: 6px 10px;
    font-family: 'VT323', monospace;
    font-size: 20px;
    outline: none;
}

.retro-input:focus {
    border-color: var(--text-cyan);
}

.retro-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg fill='white' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 32px;
}

/* Buttons */
.retro-btn {
    background-color: var(--btn-gray);
    color: var(--text-white);
    border: 3px solid #fff;
    box-shadow: 3px 3px 0px #000;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    padding: 8px 12px;
    cursor: pointer;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.retro-btn:active {
    box-shadow: 0px 0px 0px #000;
    top: 3px;
    left: 3px;
}

.retro-btn:hover {
    filter: brightness(1.2);
}

.icon-btn {
    padding: 8px 8px;
    font-size: 12px;
}

.success-btn {
    background-color: #ffffff;
    color: #000000 !important;
}

.danger-btn {
    background-color: #000000;
    color: #ffffff !important;
    border-color: #ffffff;
}

.action-btn {
    background-color: #888888;
}

.full-width-btn {
    width: 100%;
    padding: 12px;
    font-size: 12px;
    margin-top: 8px;
}

.retro-btn-link {
    background: none;
    border: none;
    font-family: 'VT323', monospace;
    font-size: 22px;
    text-decoration: underline;
    cursor: pointer;
    color: var(--text-cyan);
    outline: none;
}

.retro-btn-link:hover {
    color: #fff;
}

/* Settings Sliders */
.river-settings {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    color: #888;
}

.copyright-label {
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    color: #888;
}

.settings-stats {
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    color: #888;
}

.settings-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.retro-slider {
    appearance: none;
    width: 150px;
    height: 8px;
    background: #000;
    border: 2px solid var(--btn-gray);
    outline: none;
}

.retro-slider::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--text-yellow);
    border: 2px solid #fff;
    box-shadow: 2px 2px 0px #000;
    cursor: pointer;
}

/* Inspection Overlay */
.inspect-hud {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    background-color: #0b0c10;
    border: 4px solid var(--text-cyan);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.4), 0 4px 0 #000;
    padding: 12px 16px;
    z-index: 30;
    font-family: 'VT323', monospace;
}

.inspect-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.inspect-label {
    font-family: 'Press Start 2P', cursive;
    font-size: 9px;
    color: var(--text-cyan);
}

.inspect-details {
    font-size: 24px;
    word-break: break-all;
}

.inspect-details .user-tag {
    color: var(--text-yellow);
    font-weight: bold;
}

.inspect-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-box {
    background-color: #1a1c23;
    width: 90%;
    max-width: 450px;
    display: flex;
    flex-direction: column;
    padding: 20px;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 4px solid var(--btn-gray);
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.modal-header h3 {
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    color: var(--text-cyan);
}

.close-btn {
    border: 2px solid #fff;
    padding: 4px 8px;
    font-size: 12px;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tab-container {
    display: flex;
    border: 3px solid var(--btn-gray);
    background-color: #000;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: #888;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    padding: 10px;
    cursor: pointer;
}

.tab-btn.active {
    background-color: var(--btn-gray);
    color: #fff;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-message {
    padding: 8px;
    border: 2px solid;
    font-size: 18px;
    text-align: center;
}

.auth-message.error {
    background-color: #1a1a1a;
    border-color: #ffffff;
    color: #cccccc;
}

.auth-message.success {
    background-color: #333333;
    border-color: #ffffff;
    color: #ffffff;
}

/* Animations and Utilities */
.hidden {
    display: none !important;
}

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

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.blink {
    animation: blink 1s infinite;
}

.blink-title {
    animation: blink 2.5s infinite steps(2);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 12px;
    background-color: #000;
}

::-webkit-scrollbar-thumb {
    background-color: var(--btn-gray);
    border: 3px solid #000;
}

/* --- MOBILE RESPONSIVENESS (max-width: 768px) --- */
@media (max-width: 768px) {
    body {
        align-items: stretch;
    }
    
    .arcade-cabinet {
        width: 100vw;
        height: 100vh;
        max-width: none;
        border: 4px solid var(--cabinet-border);
        box-shadow: none;
        padding: 4px;
    }

    .retro-hud {
        padding: 6px 12px;
    }

    /* Header HUD Stack */
    .retro-hud.header-hud {
        flex-direction: column;
        gap: 6px;
        align-items: stretch;
        text-align: center;
    }

    .title-container h1 {
        font-size: 14px;
        text-align: center;
    }

    .stats-container {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px 12px;
        font-size: 8px;
    }

    #hud-credits-container {
        margin: 0;
    }

    .controls-container {
        justify-content: center;
    }

    .controls-container button {
        width: 100%;
        font-size: 9px;
        padding: 6px;
    }

    /* Footer HUD Stack */
    .retro-form .form-row {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .retro-form .form-row .button-group {
        width: 100%;
        margin: 0;
    }

    .retro-form .form-row .button-group button {
        width: 100%;
        padding: 10px;
    }

    .river-settings {
        flex-direction: column;
        gap: 6px;
        text-align: center;
    }

    .copyright-label {
        font-size: 8px;
        text-align: center;
    }

    .settings-stats {
        font-size: 8px;
        text-align: center;
    }

    /* Modal dialogs */
    .modal-box {
        width: 95%;
        padding: 12px;
    }

    .tab-container {
        gap: 4px;
    }

    .tab-btn {
        font-size: 10px;
        padding: 6px;
    }

    .retro-input {
        font-size: 16px;
        padding: 6px;
    }

    /* Inspector HUD */
    .inspect-details {
        font-size: 18px;
    }

    .inspect-actions {
        flex-direction: column;
        gap: 6px;
    }

    .inspect-actions a, 
    .inspect-actions button {
        width: 100%;
    }
}

