/* ==========================================================================
   RIVER RAID - RETRO ARCADE CSS
   Responsive styling for Mobile & Desktop
   ========================================================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg-color: #0b0e14;
    --bezel-color: #1a1e28;
    --bezel-border: #2a3142;
    --gold: #f8c211;
    --red: #dd2222;
    --green: #22aa44;
    --blue: #1c5cb4;
    --text-color: #e0e0e0;
}

/* 7ax.fun: the page scrolls to the article below; the game keeps the first screen */
html, body {
    width: 100%;
    background-color: var(--bg-color);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Courier New", monospace;
    color: var(--text-color);
}

#game-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: calc(100vh - 36px);
    height: calc(100svh - 36px);
    user-select: none;
    -webkit-user-select: none;
    max-width: 600px;
    margin: 0 auto;
    padding: calc(6px + env(safe-area-inset-top)) calc(8px + env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) calc(8px + env(safe-area-inset-left));
}

/* Header */
#arcade-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background: var(--bezel-color);
    border: 2px solid var(--bezel-border);
    border-radius: 8px;
    margin-bottom: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
}

.logo {
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: 2px;
    color: var(--gold);
    text-shadow: 0 0 8px rgba(248, 194, 17, 0.4);
}

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

.arcade-btn-icon {
    background: #252c3d;
    border: 1px solid #3c4660;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.arcade-btn-icon:active {
    transform: scale(0.92);
    background: #333c53;
}

/* Screen Container */
#screen-container {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 0;
    background: #000;
    border-radius: 10px;
    border: 3px solid var(--bezel-border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7), inset 0 0 16px rgba(0, 0, 0, 0.9);
    overflow: hidden;
}

#gameCanvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 360 / 540;
    object-fit: contain;
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    touch-action: none;
    cursor: crosshair;
}

/* Retro CRT scanlines effect */
.scanlines {
    pointer-events: none;
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0) 50%,
        rgba(0, 0, 0, 0.25) 51%
    );
    background-size: 100% 4px;
    opacity: 0.6;
}

.crt-glow {
    pointer-events: none;
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.6);
    border-radius: 8px;
}

/* Touch Controls (Mobile Friendly) */
.touch-overlay {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 8px 4px 4px 4px;
    flex-shrink: 0;
    touch-action: none;
}

.touch-left-cluster {
    display: flex;
    gap: 8px;
    align-items: center;
}

.dpad-horizontal {
    display: flex;
    gap: 6px;
}

.throttle-vertical {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.touch-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-weight: 800;
    color: #ffffff;
    background: linear-gradient(180deg, #2c3345 0%, #1a202c 100%);
    border: 2px solid #414c66;
    border-radius: 12px;
    box-shadow: 0 4px 0 #11151e, 0 5px 10px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    touch-action: none;
    user-select: none;
    transition: transform 0.08s, box-shadow 0.08s;
}

.touch-btn:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #11151e, 0 2px 5px rgba(0, 0, 0, 0.4);
    filter: brightness(1.2);
}

.steer-btn {
    width: 58px;
    height: 58px;
    font-size: 1.5rem;
    color: var(--gold);
}

.throttle-btn {
    width: 68px;
    height: 26px;
    font-size: 0.72rem;
    border-radius: 8px;
    letter-spacing: 0.5px;
}

.touch-right-cluster {
    display: flex;
    align-items: center;
}

.fire-btn {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    font-size: 1.15rem;
    background: linear-gradient(180deg, #e62e2e 0%, #a61212 100%);
    border: 3px solid #ff6b6b;
    color: #fff;
    box-shadow: 0 5px 0 #6d0a0a, 0 6px 12px rgba(230, 46, 46, 0.4);
    letter-spacing: 1px;
}

.fire-btn:active {
    transform: translateY(4px);
    box-shadow: 0 1px 0 #6d0a0a, 0 2px 6px rgba(230, 46, 46, 0.4);
}

/* Desktop Instructions */
#desktop-instructions {
    text-align: center;
    font-size: 0.75rem;
    color: #8c9ba5;
    padding-top: 6px;
    flex-shrink: 0;
    line-height: 1.4;
}

#desktop-instructions span {
    background: #1e2433;
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid #333d54;
    color: var(--gold);
    font-weight: 600;
}

/* Landscape Mode for Mobile Devices */
@media (max-height: 520px) and (orientation: landscape) {
    #game-wrapper {
        height: 100vh;
        height: 100svh;
        flex-direction: row;
        max-width: 100%;
        padding: 4px calc(12px + env(safe-area-inset-right)) 4px calc(12px + env(safe-area-inset-left));
        gap: 12px;
    }

    #arcade-header {
        display: none;
    }

    #desktop-instructions {
        display: none;
    }

    #screen-container {
        height: 100%;
        flex: 1 1 auto;
    }

    .touch-overlay {
        position: static;
        width: auto;
        height: 100%;
        display: contents;
    }

    .touch-left-cluster {
        order: -1;
        flex-direction: column;
        justify-content: center;
        gap: 10px;
    }

    .dpad-horizontal {
        gap: 8px;
    }

    .steer-btn {
        width: 62px;
        height: 62px;
    }

    .throttle-btn {
        width: 100%;
        height: 32px;
        font-size: 0.8rem;
    }

    .touch-right-cluster {
        order: 1;
        justify-content: center;
        padding-left: 6px;
    }

    .fire-btn {
        width: 82px;
        height: 82px;
        font-size: 1.25rem;
    }
}

/* High-resolution Desktop Screens */
@media (min-width: 768px) and (min-height: 700px) {
    #game-wrapper {
        max-width: 500px;
        padding: 16px;
    }

    #screen-container {
        border-width: 4px;
        border-radius: 12px;
    }

    #touch-controls {
        opacity: 0.85;
    }

    #desktop-instructions {
        font-size: 0.82rem;
        padding-top: 10px;
    }
}

.footer-credit {
    margin-top: 6px;
    font-size: 0.72rem;
    color: #7b8a9c;
}

.footer-credit a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s ease;
}

.footer-credit a:hover {
    color: var(--gold);
}

.footer-heart {
    color: #ff3366 !important;
    text-decoration: none !important;
    display: inline-block;
    transition: transform 0.2s ease;
}

.footer-heart:hover {
    transform: scale(1.3);
}

.tribute-banner {
    margin-top: 8px;
    padding: 6px 10px;
    background: rgba(248, 194, 17, 0.08);
    border: 1px solid rgba(248, 194, 17, 0.25);
    border-radius: 6px;
    font-size: 0.72rem;
    color: #c9d5e4;
    line-height: 1.4;
}

.tribute-banner strong {
    color: var(--gold);
}

/* Tribute Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 1000;
    animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-box {
    background: linear-gradient(180deg, #252b38 0%, #171c26 100%);
    border: 2px solid #f8c211;
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(248, 194, 17, 0.2);
    color: #e2e8f0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #1a202c;
    border-bottom: 2px solid #2d3748;
}

.modal-header h2 {
    font-size: 1rem;
    color: var(--gold);
    letter-spacing: 1px;
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    color: #a0aec0;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.15s;
}

.modal-close:hover {
    color: #fff;
}

.modal-body {
    padding: 16px;
    font-size: 0.85rem;
    line-height: 1.6;
}

.modal-lead {
    font-size: 0.95rem;
    color: var(--gold);
    font-weight: 700;
    margin-bottom: 12px;
}

.modal-body p {
    margin-bottom: 10px;
}

.modal-footer-note {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid #2d3748;
    color: #a0aec0;
    font-style: italic;
    font-size: 0.8rem;
}

/* ==========================================================================
   7ax.fun article below the game (own dark styles, 7ax.css is not loaded)
   ========================================================================== */
.peek {
    display: block;
    height: 36px;
    line-height: 36px;
    text-align: center;
    font-size: 0.78rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #8c9ba5;
    text-decoration: none;
}
.peek:hover { color: var(--gold); }

.rs-page {
    max-width: 760px;
    margin: 0 auto;
    padding: 24px 16px 40px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: #c9d5e4;
}
.rs-nav { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 28px; font-size: 0.85rem; }
.rs-nav a, .rs-page a { color: #ffd84d; text-underline-offset: 2px; }
.rs-nav .rs-brand { font-weight: 800; letter-spacing: 1px; text-decoration: none; margin-right: auto; }
.rs-page h1 { font-size: clamp(2rem, 7vw, 3rem); line-height: 1.05; color: var(--gold); letter-spacing: 1px; margin-bottom: 10px; }
.rs-lead { font-size: 1.1rem; color: #e0e6ef; }
.rs-page h2 { font-size: 1.3rem; color: #fff; margin: 34px 0 10px; }
.rs-page p, .rs-page ul, .rs-page dl { margin-bottom: 12px; }
.rs-page ul { padding-left: 20px; }
.rs-page kbd {
    background: #1e2433; border: 1px solid #333d54; border-radius: 4px;
    padding: 0 5px; color: var(--gold); font-family: inherit; font-size: 0.9em;
}
.rs-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; }
.rs-facts dt { color: #8c9ba5; }
.rs-facts dd { color: #e0e6ef; }
.rs-faq h3 { font-size: 1rem; color: var(--gold); margin: 18px 0 4px; }
.rs-meta { font-size: 0.85rem; color: #8c9ba5; }
.rs-more { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 8px; }
.share { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 30px; }
.share-label { font-size: 0.85rem; color: #8c9ba5; margin-right: 4px; }
.share-btn {
    font: inherit; font-size: 0.85rem; padding: 6px 12px; cursor: pointer;
    background: transparent; color: #e0e6ef !important; text-decoration: none;
    border: 1px solid #414c66; border-radius: 8px;
}
.share-btn:hover { border-color: var(--gold); }
.rs-footer {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
    margin-top: 36px; padding-top: 16px; border-top: 1px solid #2a3142;
    font-size: 0.8rem; color: #7b8a9c;
}
@media (max-width: 480px) {
    .rs-facts { grid-template-columns: 1fr; gap: 0; }
    .rs-facts dd { margin-bottom: 8px; }
}
