/* ==========================================================================
   Ferryrab.com - Retro Car Ferry Arcade Game Styles
   ========================================================================== */

:root {
    --bg-dark: #0a111e;
    --arcade-bg: #121c2d;
    --arcade-border: #1a2d48;
    --sea-blue: #0d4b75;
    --sea-turquoise: #1aa3ba;
    --ferry-green: #23854e;
    --ferry-yellow: #f8c822;
    --neon-yellow: #ffee32;
    --neon-cyan: #00f0ff;
    --neon-orange: #ff9100;
    --neon-red: #ff3366;
    --text-gold: #ffcf40;
    --text-light: #e2f1f8;
    --font-pixel: 'Press Start 2P', cursive, monospace;
    --font-digital: 'VT323', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    font-family: var(--font-pixel);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 50% 20%, #152744 0%, var(--bg-dark) 80%),
        repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.15) 1px, transparent 1px, transparent 2px);
}



/* ==========================================================================
   AdSense Placement Containers & Responsive Behavior
   ========================================================================== */

/* Visibility classes */
.desktop-only-ad {
    display: none;
}

.mobile-only-ad {
    display: flex;
}

@media (min-width: 880px) {
    .desktop-only-ad {
        display: flex;
    }
    .mobile-only-ad {
        display: none !important;
    }
}

.ad-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    padding: 0;
    margin: 6px 0;
    position: relative;
    z-index: 10;
}

.ad-label {
    font-size: 8px;
    color: rgba(226, 241, 248, 0.4);
    letter-spacing: 1.5px;
    margin-bottom: 4px;
    font-family: var(--font-pixel);
    text-transform: uppercase;
}

.ad-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: transparent;
    position: relative;
}

/* Vertical Skyscraper Side Banners (Desktop Only) */
.ad-side-wrapper {
    position: sticky;
    top: 20px;
    display: none;
    flex-direction: column;
    align-items: center;
    width: 168px;
    min-width: 168px;
    flex: 0 0 168px;
    z-index: 10;
}

@media (min-width: 880px) {
    .ad-side-wrapper {
        display: flex;
    }
}

.ad-skyscraper-container {
    width: 168px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
}

.ad-skyscraper-slot {
    width: 160px;
    height: 600px;
}

/* Dedicated Single Mobile Ad Banner (Below Arcade Controls) */
.mobile-banner-container {
    width: 100%;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px dashed rgba(0, 240, 255, 0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.mobile-banner-slot {
    width: 320px;
    height: 50px;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(4, 15, 25, 0.7);
    border: 1px solid rgba(0, 240, 255, 0.2);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
}

/* Mobile Sponsor Square Ad Container in Level Complete Modal */
.sponsor-ad-container {
    margin: 10px 0 14px 0;
    display: none; /* Only shown when Google fills an ad */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.sponsor-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.sponsor-tag-icon {
    font-size: 11px;
}

.sponsor-badge {
    font-family: var(--font-pixel);
    font-size: 8px;
    color: #4cd964;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 0 8px rgba(76, 217, 100, 0.5);
}

.sponsor-ad-slot.square-ad-slot {
    width: 250px;
    height: 250px;
    max-width: 100%;
    background: #040f0c;
    border: 1.5px dashed rgba(76, 217, 100, 0.45);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    box-shadow: 0 0 15px rgba(76, 217, 100, 0.15), inset 0 0 12px rgba(0, 0, 0, 0.8);
}

ins.adsbygoogle {
    display: inline-block;
}

/* Layout Wrappers */
.main-layout {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    max-width: 1360px;
    margin: 10px auto;
    padding: 0 20px;
    box-sizing: border-box;
}

@media (max-width: 879px) {
    .main-layout {
        justify-content: center;
        padding: 0 8px;
    }
}

/* ==========================================================================
   Main Game Wrapper & Cabinet
   ========================================================================== */

.game-wrapper {
    background: var(--arcade-bg);
    border: 3px solid var(--arcade-border);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.8),
        0 0 15px rgba(0, 240, 255, 0.15),
        inset 0 0 20px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 520px;
    flex: 0 1 520px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
}

@keyframes screen-shake {
    0% { transform: translate(0, 0); }
    20% { transform: translate(-6px, 4px); }
    40% { transform: translate(6px, -4px); }
    60% { transform: translate(-4px, 3px); }
    80% { transform: translate(4px, -2px); }
    100% { transform: translate(0, 0); }
}

.shake {
    animation: screen-shake 0.38s ease-in-out;
}

/* Arcade Marquee */
.arcade-marquee {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: linear-gradient(180deg, #1c3254 0%, #0d1a2d 100%);
    border: 2px solid var(--neon-cyan);
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 10px;
    box-shadow: inset 0 0 10px rgba(0, 240, 255, 0.3);
}

.marquee-logo {
    display: flex;
    flex-direction: column;
}

.logo-text {
    font-size: 14px;
    color: var(--neon-yellow);
    text-shadow: 2px 2px 0 #000, 0 0 8px var(--neon-yellow);
    letter-spacing: 1px;
}

.logo-dot {
    color: var(--neon-cyan);
}

.logo-sub {
    font-size: 8px;
    color: var(--neon-cyan);
    margin-top: 2px;
    font-family: var(--font-digital);
    letter-spacing: 1px;
}

.header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn-icon, .btn-marquee {
    background: #0e1e32;
    border: 1.5px solid var(--neon-cyan);
    color: var(--neon-cyan);
    padding: 6px 8px;
    font-family: var(--font-pixel);
    font-size: 7px;
    letter-spacing: 0.5px;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.12s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
    user-select: none;
    outline: none;
}

.btn-icon:hover, .btn-marquee:hover {
    background: var(--neon-cyan);
    color: #000;
    box-shadow: 0 0 10px var(--neon-cyan);
    transform: translateY(-1px);
}

.btn-marquee.btn-off {
    border-color: #4a6378;
    color: #7b94a8;
    background: #08101a;
    box-shadow: none;
}

/* Scoreboard Bar */
.scoreboard-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    width: 100%;
    background: #080d16;
    border: 2px solid #1a2f4c;
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 8px;
}

.score-box {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-label {
    font-size: 7px;
    color: #7b9ab8;
    margin-bottom: 4px;
}

.score-val {
    font-family: var(--font-digital);
    font-size: 18px;
    color: var(--neon-cyan);
    text-shadow: 0 0 5px var(--neon-cyan);
}


/* Canvas Container */
.canvas-container {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: #050a12;
    border: 3px solid #1e3a63;
    border-radius: 6px;
    box-shadow: inset 0 0 20px #000;
    overflow: hidden;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

#game-canvas {
    display: block;
    width: 100%;
    height: auto;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    touch-action: pan-y;
    cursor: pointer;
}

/* Floating Toast Notification */
.toast-overlay {
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(10, 20, 38, 0.92);
    border: 2px solid var(--neon-yellow);
    color: var(--neon-yellow);
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 11px;
    text-align: center;
    box-shadow: 0 0 20px rgba(255, 238, 50, 0.5);
    pointer-events: none;
    z-index: 20;
    animation: toastPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes toastPop {
    0% { transform: translate(-50%, -40%) scale(0.7); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Ship Balance Meter Container (Thin Profile, 90% Capsize Threshold) */
.balance-container {
    width: 100%;
    max-width: 480px;
    background: linear-gradient(180deg, #0c1c30 0%, #060f1c 100%);
    border: 1.5px solid #1a355c;
    border-radius: 6px;
    padding: 3px 8px 3px 8px;
    margin-top: 4px;
    margin-bottom: 2px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5), inset 0 0 6px rgba(0, 0, 0, 0.7);
    transition: border-color 0.25s, box-shadow 0.25s;
}

.balance-container.balance-caution {
    border-color: #ffd600;
    box-shadow: 0 0 10px rgba(255, 214, 0, 0.4);
}

.balance-container.balance-warning {
    border-color: #ff9100;
    box-shadow: 0 0 14px rgba(255, 145, 0, 0.6);
    animation: balanceWarnPulse 0.8s infinite alternate;
}

.balance-container.balance-danger {
    border-color: #ff1744;
    box-shadow: 0 0 18px rgba(255, 23, 68, 0.85);
    animation: balanceDangerPulse 0.35s infinite alternate;
}

@keyframes balanceWarnPulse {
    0% { box-shadow: 0 0 6px rgba(255, 145, 0, 0.3); }
    100% { box-shadow: 0 0 14px rgba(255, 145, 0, 0.7); }
}

@keyframes balanceDangerPulse {
    0% { box-shadow: 0 0 8px rgba(255, 23, 68, 0.4); }
    100% { box-shadow: 0 0 20px rgba(255, 23, 68, 0.95); }
}

.balance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-pixel);
    font-size: 7px;
    margin-bottom: 2px;
}

.balance-side-label {
    color: #80deea;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 6.5px;
}

.balance-side-label .pct-val {
    font-family: var(--font-digital);
    font-size: 13px;
    color: var(--neon-yellow);
}

.balance-title {
    color: #ffffff;
    font-size: 7px;
    letter-spacing: 0.5px;
    text-shadow: 0 0 5px rgba(0, 229, 255, 0.5);
}

.balance-track-wrapper {
    width: 100%;
    padding: 0;
}

.balance-track {
    position: relative;
    width: 100%;
    height: 7px;
    background: #040810;
    border: 1px solid #162b48;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* 90% Capsize threshold markers at both ends */
.balance-danger-zone {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 10%; /* 90% capsize limit */
    background: rgba(255, 23, 68, 0.25);
    z-index: 1;
}

.balance-danger-zone.left-zone {
    left: 0;
    border-right: 1px dashed rgba(255, 23, 68, 0.7);
}

.balance-danger-zone.right-zone {
    right: 0;
    border-left: 1px dashed rgba(255, 23, 68, 0.7);
}

.balance-center-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.85);
    z-index: 3;
}

.balance-fill-bar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 0%;
    background: linear-gradient(90deg, #00e5ff 0%, #76ff03 100%);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
    border-radius: 2px;
}

.balance-container.balance-caution .balance-fill-bar {
    background: linear-gradient(90deg, #ffd600 0%, #ff9100 100%);
}

.balance-container.balance-warning .balance-fill-bar {
    background: linear-gradient(90deg, #ff9100 0%, #ff1744 100%);
}

.balance-container.balance-danger .balance-fill-bar {
    background: #ff1744;
}

.balance-needle {
    position: absolute;
    top: -1px;
    bottom: -1px;
    width: 4px;
    margin-left: -2px;
    background: #ffffff;
    border-radius: 2px;
    box-shadow: 0 0 5px #00e5ff;
    transition: left 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 4;
}

.balance-status-bar {
    text-align: center;
    margin-top: 2px;
    font-family: var(--font-pixel);
    font-size: 6.5px;
    letter-spacing: 0.5px;
    line-height: 1;
}

/* Controls Arcade Deck */
.controls-deck {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 480px;
    margin-top: 10px;
    padding: 2px 8px;
}

.dpad-group {
    display: flex;
    gap: 8px;
    flex: 0 1 184px;
    max-width: 190px;
}

.btn-arcade {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 6px;
    background: linear-gradient(180deg, #203a60 0%, #102038 100%);
    border: 2px solid var(--neon-cyan);
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 4px 0 #081220, 0 5px 10px rgba(0, 0, 0, 0.5);
    transition: all 0.08s ease;
    touch-action: manipulation;
}

.btn-dpad {
    flex: 1 1 86px;
    max-width: 90px;
    height: 72px;
}

.btn-arcade:active, .btn-arcade.active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #081220, 0 2px 4px rgba(0, 0, 0, 0.5);
    background: var(--neon-cyan);
    color: #000;
}

.action-group {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    padding-left: 24px;
}

/* Big Round Red Arcade Park Button */
.btn-park-red {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #ff4d4d 0%, #d80000 60%, #800000 100%);
    border: 3px solid #ff7b7b;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        0 6px 0 #500000,
        0 8px 16px rgba(255, 0, 0, 0.45),
        inset 0 3px 6px rgba(255, 255, 255, 0.6),
        inset 0 -4px 6px rgba(0, 0, 0, 0.6);
    transition: all 0.08s ease;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    outline: none;
}

.btn-park-red:active, .btn-park-red.active {
    transform: translateY(4px);
    box-shadow: 
        0 2px 0 #500000,
        0 3px 8px rgba(255, 0, 0, 0.5),
        inset 0 1px 3px rgba(255, 255, 255, 0.4),
        inset 0 -2px 4px rgba(0, 0, 0, 0.8);
    background: radial-gradient(circle at 35% 30%, #ff6666 0%, #ff0000 60%, #a00000 100%);
}

.park-circle-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.park-icon {
    font-size: 20px;
    line-height: 1;
    margin-bottom: 2px;
}

.park-text {
    font-size: 9px;
    font-weight: bold;
    letter-spacing: 1px;
    color: #ffffff;
    text-shadow: 1px 1px 2px #000, 0 0 6px rgba(255, 255, 255, 0.8);
}

.btn-icon-large {
    font-size: 20px;
    line-height: 1;
    margin-bottom: 4px;
}

.btn-subtext {
    font-size: 8px;
    letter-spacing: 1px;
}

.btn-keycap-hint {
    font-family: var(--font-pixel);
    font-size: 7px;
    color: var(--neon-yellow);
    margin-top: 2px;
    letter-spacing: 0.5px;
    text-shadow: 0 0 5px rgba(255, 238, 50, 0.6);
}

.park-key-hint {
    font-size: 6.5px;
    color: #fffb80;
    margin-top: 2px;
    text-shadow: 1px 1px 1px #000;
}

.keyboard-hints {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin-top: 8px;
    font-size: 7px;
    color: #5d7e9e;
}

/* ==========================================================================
   Modals & Overlays
   ========================================================================== */

.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(4, 9, 18, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 16px;
}

.modal-card {
    background: var(--arcade-bg);
    border: 3px solid var(--neon-cyan);
    border-radius: 12px;
    padding: 24px;
    width: 100%;
    max-width: 440px;
    text-align: center;
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.3), inset 0 0 15px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-large {
    max-width: 500px;
}

.modal-badge {
    font-size: 8px;
    color: var(--neon-cyan);
    letter-spacing: 2px;
    margin-bottom: 6px;
}

.modal-title {
    font-size: 20px;
    color: var(--neon-yellow);
    text-shadow: 2px 2px 0 #000, 0 0 10px var(--neon-yellow);
    margin-bottom: 8px;
}

.modal-danger {
    color: var(--neon-red);
    text-shadow: 2px 2px 0 #000, 0 0 10px var(--neon-red);
}

.modal-success {
    color: #4ade80;
    text-shadow: 2px 2px 0 #000, 0 0 14px rgba(74, 222, 128, 0.95), 0 0 28px rgba(34, 197, 94, 0.7);
}

.modal-subtitle {
    font-size: 9px;
    color: var(--text-light);
    line-height: 1.5;
    margin-bottom: 16px;
}

.modal-hero-banner {
    position: relative;
    width: 100%;
    height: 140px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 14px;
    border: 2px solid var(--neon-cyan);
    box-shadow: 0 4px 15px rgba(0, 240, 255, 0.2);
}

.hero-ferry-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: saturate(1.1) brightness(0.95);
}

.hero-tag {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(0deg, rgba(6, 18, 30, 0.95) 0%, rgba(6, 18, 30, 0.6) 80%, transparent 100%);
    color: #ffeb3b;
    font-size: 8px;
    padding: 8px 6px 6px;
    letter-spacing: 1px;
    text-shadow: 1px 1px 2px #000;
}

.park-cars-text {
    font-family: var(--font-pixel);
    font-size: 8px;
    color: var(--neon-yellow);
    letter-spacing: 0.8px;
    text-align: center;
    margin: 8px 0 10px;
    text-shadow: 0 0 10px rgba(255, 235, 59, 0.65), 1px 1px 2px rgba(0, 0, 0, 0.9);
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin-top: 10px;
}

/* Captain Name Call-Sign Input & Play Button Deck */
.captain-input-deck {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
    background: linear-gradient(180deg, #0e223a 0%, #071322 100%);
    border: 2px solid var(--neon-cyan);
    border-radius: 8px;
    padding: 14px 16px;
    margin-top: 10px;
    margin-bottom: 12px;
    box-shadow: 0 0 16px rgba(0, 240, 255, 0.25), inset 0 0 12px rgba(0, 0, 0, 0.8);
}

.enter-name-hint {
    font-family: var(--font-pixel);
    font-size: 8px;
    color: var(--neon-yellow);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    text-align: left;
    display: block;
    animation: blinkPrompt 0.8s infinite alternate;
}

@keyframes blinkPrompt {
    0% {
        opacity: 1;
        color: #fff176;
        text-shadow: 0 0 8px rgba(255, 238, 50, 0.95), 0 0 16px rgba(255, 238, 50, 0.6);
    }
    100% {
        opacity: 0.25;
        color: #80deea;
        text-shadow: 0 0 2px rgba(0, 229, 255, 0.3);
    }
}

.captain-input-fullrow {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.captain-callsign-prefix {
    font-family: var(--font-pixel);
    font-size: 13px;
    color: var(--neon-yellow);
    text-shadow: 0 0 8px rgba(255, 238, 50, 0.8);
    white-space: nowrap;
    letter-spacing: 1px;
}

.captain-callsign-input {
    flex: 1;
    width: 100%;
    background: rgba(4, 12, 22, 0.85);
    border: 2px solid rgba(0, 229, 255, 0.45);
    border-radius: 6px;
    color: #ffffff;
    font-family: var(--font-pixel);
    font-size: 13px;
    padding: 10px 14px;
    outline: none;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.7);
}

.captain-callsign-input:focus {
    border-color: var(--neon-yellow);
    background: rgba(0, 229, 255, 0.12);
    box-shadow: 0 0 12px rgba(255, 238, 50, 0.5), inset 0 2px 6px rgba(0, 0, 0, 0.8);
}

.captain-callsign-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 1.5px;
}

/* Wide Glowing Play Button Under Input */
.btn-play-action {
    width: 100%;
    background: linear-gradient(180deg, #76ff03 0%, #388e3c 100%);
    border: 2px solid #b9f6ca;
    color: #042404;
    font-family: var(--font-pixel);
    font-size: 14px;
    font-weight: bold;
    padding: 13px 20px;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 4px 0 #1b5e20, 0 0 20px rgba(118, 255, 3, 0.8), 0 0 35px rgba(56, 142, 60, 0.5);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
    transition: transform 0.08s, box-shadow 0.15s, filter 0.15s;
    white-space: nowrap;
    text-align: center;
    letter-spacing: 1px;
    animation: playGlowPulse 1.6s infinite ease-in-out alternate;
}

@keyframes playGlowPulse {
    0% {
        box-shadow: 0 4px 0 #1b5e20, 0 0 16px rgba(118, 255, 3, 0.7), 0 0 30px rgba(76, 175, 80, 0.4);
        filter: brightness(1);
    }
    100% {
        box-shadow: 0 4px 0 #1b5e20, 0 0 30px rgba(118, 255, 3, 1), 0 0 50px rgba(118, 255, 3, 0.7);
        filter: brightness(1.12);
    }
}

.btn-play-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #1b5e20, 0 0 35px rgba(118, 255, 3, 1), 0 0 60px rgba(118, 255, 3, 0.85);
    background: linear-gradient(180deg, #8aff1e 0%, #43a047 100%);
    filter: brightness(1.18);
}

.btn-play-action:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #1b5e20, 0 0 16px rgba(118, 255, 3, 0.6);
}

/* Red Warning State when Play is clicked without entering a name */
.btn-play-action.btn-error-state {
    background: linear-gradient(180deg, #ff1744 0%, #b71c1c 100%) !important;
    border-color: #ff8a80 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 0 #7f0000, 0 0 25px rgba(255, 23, 68, 0.9), 0 0 50px rgba(183, 28, 28, 0.6) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9) !important;
    animation: btnRedPulse 0.6s infinite alternate ease-in-out !important;
    letter-spacing: 1.5px;
}

@keyframes btnRedPulse {
    0% {
        box-shadow: 0 4px 0 #7f0000, 0 0 16px rgba(255, 23, 68, 0.7);
        filter: brightness(1);
    }
    100% {
        box-shadow: 0 4px 0 #7f0000, 0 0 35px rgba(255, 23, 68, 1), 0 0 55px rgba(255, 23, 68, 0.85);
        filter: brightness(1.15);
    }
}

/* Shake Animation on Empty Name Submission */
@keyframes captainInputShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.captain-input-fullrow.shake-error {
    animation: captainInputShake 0.35s ease-in-out;
}

.captain-callsign-input.input-error {
    border-color: #ff1744 !important;
    box-shadow: 0 0 16px rgba(255, 23, 68, 0.7), inset 0 2px 6px rgba(0, 0, 0, 0.8) !important;
}

.modal-actions-sub {
    width: 100%;
    margin-top: 8px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-sub-left {
    flex: 1 1 0;
    padding: 11px 4px;
    font-size: 8px;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-whatsapp {
    flex: 1 1 0;
    padding: 11px 4px;
    font-size: 8px;
    background: linear-gradient(180deg, #25D366 0%, #128C7E 100%);
    border: 2px solid #55efc4;
    color: #ffffff;
    box-shadow: 0 4px 0 #075E54, 0 0 14px rgba(37, 211, 102, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    letter-spacing: 0.5px;
    font-family: var(--font-pixel);
    cursor: pointer;
    border-radius: 6px;
    transition: transform 0.1s, box-shadow 0.1s;
    user-select: none;
    text-decoration: none;
    white-space: nowrap;
}

.btn-whatsapp:hover {
    transform: translateY(-2px);
    background: linear-gradient(180deg, #2ecc71 0%, #16a085 100%);
    box-shadow: 0 6px 0 #075E54, 0 0 22px rgba(37, 211, 102, 0.8);
    color: #ffffff;
}

.btn-whatsapp:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #075E54;
}

.whatsapp-icon {
    flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.logo-carpark {
    color: var(--neon-cyan);
    text-shadow: 0 0 8px var(--neon-cyan);
}

.btn-modal {
    width: 100%;
    padding: 12px;
    font-family: var(--font-pixel);
    font-size: 11px;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
}

.btn-primary {
    background: linear-gradient(180deg, #f8c822 0%, #c49600 100%);
    border: 2px solid #ffe680;
    color: #000;
    box-shadow: 0 4px 0 #856600;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #856600;
}

.btn-secondary {
    background: linear-gradient(180deg, #1b355a 0%, #0d1e36 100%);
    border: 2px solid var(--neon-cyan);
    color: #fff;
    box-shadow: 0 4px 0 #061120;
}

.btn-secondary:hover {
    background: var(--neon-cyan);
    color: #000;
}

.btn-danger {
    background: linear-gradient(180deg, #5a1b1b 0%, #360d0d 100%);
    border: 2px solid #ff4444;
    color: #ff8888;
    box-shadow: 0 4px 0 #200606;
}

.btn-danger:hover {
    background: linear-gradient(180deg, #8b2020 0%, #5a1212 100%);
    color: #fff;
    box-shadow: 0 6px 0 #200606;
}

/* Leaderboard Table & Top 40 Scrolling */
.leaderboard-table-container {
    width: 100%;
    background: #08101c;
    border: 1px solid #1a2f4c;
    border-radius: 6px;
    margin-bottom: 16px;
    max-height: 360px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--neon-cyan) #08101c;
}

.leaderboard-table-container::-webkit-scrollbar {
    width: 6px;
}

.leaderboard-table-container::-webkit-scrollbar-track {
    background: #08101c;
}

.leaderboard-table-container::-webkit-scrollbar-thumb {
    background: var(--neon-cyan);
    border-radius: 3px;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 8px;
}

.leaderboard-table th, .leaderboard-table td {
    padding: 8px 6px;
    text-align: center;
    border-bottom: 1px solid #122238;
}

.leaderboard-table th {
    background: #112138;
    color: var(--neon-cyan);
    position: sticky;
    top: 0;
    z-index: 10;
}

.leaderboard-table tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.rank-top {
    color: var(--text-gold);
    font-weight: bold;
}

.name-cell {
    font-weight: bold;
    color: #ffffff;
    text-align: left !important;
    padding-left: 12px !important;
}

.score-cell {
    font-family: var(--font-digital);
    font-size: 15px;
    color: var(--neon-yellow);
}

.rank-badge {
    display: inline-block;
    background: rgba(0, 229, 255, 0.12);
    border: 1px solid rgba(0, 229, 255, 0.35);
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 7px;
    color: #80deea;
    white-space: nowrap;
}

.player-row-highlight {
    background: rgba(118, 255, 3, 0.15) !important;
    border-left: 3px solid #76ff03;
    color: #ffffff;
}

/* Final Stats Box */
.final-stats-box {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: 100%;
    background: #070d17;
    border: 1px dashed var(--neon-cyan);
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 12px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 6px;
    color: #6a8ba6;
    margin-bottom: 4px;
}

.stat-val {
    font-family: var(--font-digital);
    font-size: 18px;
    color: var(--neon-yellow);
}

.highscore-input-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin-bottom: 12px;
    background: rgba(248, 200, 34, 0.1);
    border: 1px solid var(--ferry-yellow);
    padding: 10px;
    border-radius: 6px;
}

.new-record-tag {
    font-size: 10px;
    color: var(--neon-yellow);
    animation: blink 0.8s infinite;
    margin: 6px 0;
    text-shadow: 0 0 8px rgba(255, 235, 59, 0.7);
    letter-spacing: 1px;
}

.autosave-notice {
    font-size: 8px;
    color: #4ade80;
    text-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
    letter-spacing: 0.6px;
    margin: 6px auto 12px;
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.35);
    padding: 8px 14px;
    border-radius: 6px;
    display: inline-block;
    text-align: center;
    max-width: 92%;
    line-height: 1.4;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

#player-name-input {
    background: #060b13;
    border: 2px solid var(--neon-cyan);
    color: #fff;
    font-family: var(--font-pixel);
    font-size: 12px;
    padding: 8px;
    text-align: center;
    border-radius: 4px;
    width: 100%;
    max-width: 200px;
    text-transform: uppercase;
}

/* Ad Modal Wrapper */
.ad-modal-wrapper {
    margin: 10px 0 16px 0;
}

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

.blink {
    animation: blink 0.8s infinite;
}

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

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */


@media (max-width: 768px) {
    .ad-728x90 {
        width: 100%;
        max-width: 340px;
        height: 50px;
    }

    .ad-bottom-responsive {
        height: 50px;
    }

    .arcade-marquee {
        padding: 6px;
    }

    .logo-text {
        font-size: 11px;
    }

    .scoreboard-bar {
        padding: 4px;
    }

    .score-val {
        font-size: 14px;
    }

    .controls-deck {
        gap: 6px;
    }

    .btn-arcade {
        padding: 10px 4px;
    }

    .btn-icon-large {
        font-size: 16px;
    }
}

/* ==========================================================================
   Next Level Screen (#modal-levelclear) - Neon Green Theme & Glowing Accents
   ========================================================================== */
#modal-levelclear .modal-card {
    border: 3px solid #22c55e;
    box-shadow: 0 0 35px rgba(34, 197, 94, 0.5), 0 0 70px rgba(34, 197, 94, 0.25), inset 0 0 20px rgba(0, 0, 0, 0.85);
}

#modal-levelclear .modal-badge {
    color: #4ade80;
    text-shadow: 0 0 10px rgba(74, 222, 128, 0.85);
}

#modal-levelclear .modal-title,
#levelclear-title {
    color: #4ade80 !important;
    text-shadow: 2px 2px 0 #000, 0 0 14px rgba(74, 222, 128, 0.95), 0 0 28px rgba(34, 197, 94, 0.7) !important;
}

#modal-levelclear .final-stats-box {
    border: 1px dashed #22c55e;
    box-shadow: 0 0 18px rgba(34, 197, 94, 0.3), inset 0 0 12px rgba(4, 30, 15, 0.7);
    background: rgba(4, 24, 14, 0.75);
}

#modal-levelclear .stat-label {
    color: #86efac;
    text-shadow: 0 0 6px rgba(74, 222, 128, 0.45);
}

#modal-levelclear .stat-val {
    color: #39ff14 !important;
    text-shadow: 0 0 10px rgba(57, 255, 20, 0.9), 0 0 22px rgba(74, 222, 128, 0.6) !important;
}

#btn-next-level {
    background: linear-gradient(180deg, #4ade80 0%, #16a34a 50%, #15803d 100%) !important;
    border: 2px solid #bbf7d0 !important;
    color: #032009 !important;
    font-weight: bold;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 0 #14532d, 0 0 24px rgba(74, 222, 128, 0.8), 0 0 45px rgba(34, 197, 94, 0.45) !important;
    transition: transform 0.1s, box-shadow 0.1s, filter 0.1s;
}

#btn-next-level:hover {
    transform: translateY(-2px);
    background: linear-gradient(180deg, #86efac 0%, #22c55e 50%, #16a34a 100%) !important;
    box-shadow: 0 6px 0 #14532d, 0 0 32px rgba(74, 222, 128, 1), 0 0 60px rgba(34, 197, 94, 0.65) !important;
    filter: brightness(1.08);
}

#btn-next-level:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #14532d, 0 0 16px rgba(74, 222, 128, 0.6) !important;
}

/* Emergency Front-Row Priority Rule Badge */
.priority-rule-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.18) 0%, rgba(2, 132, 199, 0.18) 100%);
    border: 1px solid rgba(239, 68, 68, 0.45);
    border-radius: 6px;
    padding: 8px 12px;
    margin: 8px auto 12px;
    max-width: 92%;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.2);
    text-align: left;
}

.priority-rule-badge .rule-icon {
    font-size: 16px;
    flex-shrink: 0;
    animation: blink-fast 1s infinite;
}

.priority-rule-badge .rule-text {
    font-size: 7.5px;
    line-height: 1.4;
    color: #ffd700;
    text-shadow: 0 0 6px rgba(255, 215, 0, 0.5);
}

@keyframes blink-fast {
    0%, 100% { opacity: 1; filter: brightness(1.2); }
    50% { opacity: 0.4; filter: brightness(0.8); }
}

/* ==========================================================================
   Language Selector Flags (Croatian, English, German)
   ========================================================================== */
.lang-picker-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    padding: 6px 12px;
    background: rgba(7, 20, 35, 0.75);
    border: 1.5px solid rgba(0, 240, 255, 0.35);
    border-radius: 6px;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.15), inset 0 0 8px rgba(0, 0, 0, 0.6);
}

.lang-picker-label {
    font-family: var(--font-pixel);
    font-size: 7px;
    color: var(--neon-cyan);
    letter-spacing: 1px;
}

.lang-flags-row {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.modal-pause-flags {
    margin-bottom: 14px;
}

.btn-flag {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #0d1e34;
    border: 1.5px solid rgba(0, 240, 255, 0.4);
    border-radius: 5px;
    padding: 4px 9px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    user-select: none;
    outline: none;
}

.btn-flag:hover {
    transform: translateY(-2px);
    border-color: var(--neon-yellow);
    box-shadow: 0 0 10px rgba(255, 238, 50, 0.5);
    background: #132d4e;
}

.btn-flag.active {
    border-color: #ffd700;
    background: linear-gradient(180deg, #1d3e68 0%, #0d223c 100%);
    box-shadow: 0 0 14px rgba(255, 215, 0, 0.75), inset 0 0 6px rgba(255, 215, 0, 0.2);
    transform: scale(1.05);
}

.flag-svg {
    display: block;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    flex-shrink: 0;
}

.flag-name {
    font-family: var(--font-pixel);
    font-size: 8px;
    font-weight: bold;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.btn-flag.active .flag-name {
    color: #ffd700;
    text-shadow: 0 0 6px rgba(255, 215, 0, 0.8);
}

/* ==========================================================================
   Under-Buttons Control Instructions (Clean, Subtle, Unhighlighted)
   ========================================================================== */
.controls-instructions {
    width: 100%;
    margin-top: 8px;
    font-family: var(--font-pixel);
    font-size: 7px;
    color: #5d7e9e;
    text-align: center;
    letter-spacing: 0.5px;
    user-select: none;
}



