/* ============================================
   CAMERA + 3D OBJECTS APPLICATION - STYLES
   ============================================
   Clean and minimal styling for camera experience
   ============================================ */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@font-face {
    font-family: 'Teshrin AR LT';
    src: url('font/510d36c34e39deee4abbd9264a159c79.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Teshrin AR LT';
    src: url('font/teshrin-medium.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    overflow: hidden;
    background-color: #000;
    color: #fff;
}

/* Main App Container */
#app-container {
    width: 100vw;
    height: 100vh;
    /* dvh tracks the actually-visible viewport on mobile browsers - 100vh is measured with the
       address bar hidden, which is taller than what's really on screen when it's showing, and was
       pushing bottom-anchored content (like the language-select buttons) off-screen. vh above is
       the fallback for older browsers that don't support dvh. */
    height: 100dvh;
    position: relative;
}

/* Info Panel - Shows status and instructions */
#info-panel {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    border-radius: 12px;
    text-align: center;
    z-index: 100;
    max-width: 85%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

#info-panel h1 {
    font-size: 18px;
    margin-bottom: 6px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

#status-text {
    font-size: 13px;
    margin-bottom: 3px;
    font-weight: 500;
    color: #4CAF50;
}

#instructions {
    font-size: 11px;
    color: #aaa;
    font-weight: 400;
}

/* Start Camera Button */
#start-camera-btn {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    padding: 18px 45px;
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    background-color: transparent;
    background-image: url('assets/blue-btn.png');
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    border: none;
    cursor: pointer;
    z-index: 100;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.4));
    transition: transform 0.2s ease, filter 0.2s ease;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

#start-camera-btn:hover {
    transform: translateX(-50%) scale(1.05);
    filter: drop-shadow(0 8px 15px rgba(0, 0, 0, 0.6));
}

#start-camera-btn:active {
    transform: translateX(-50%) scale(0.95);
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4));
}

/* Spawn Objects Button */
#spawn-btn {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    padding: 18px 45px;
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    background-color: transparent;
    background-image: url('assets/green-btn.png');
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    border: none;
    cursor: pointer;
    z-index: 100;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.4));
    transition: transform 0.2s ease, filter 0.2s ease;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    animation: pulseFilter 2s infinite;
}

#spawn-btn:active {
    transform: translateX(-50%) scale(0.95);
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4));
}

@keyframes pulseFilter {

    0%,
    100% {
        filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.4));
    }

    50% {
        filter: drop-shadow(0 8px 15px rgba(0, 0, 0, 0.7));
    }
}

/* Settings Toggle Button (Top Right Corner) */
.settings-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 5000;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5));
}

.settings-toggle:hover {
    transform: scale(1.1) rotate(15deg);
}

.settings-toggle:active {
    transform: scale(0.95);
}

/* Mini Settings Panel */
#mini-settings-panel {
    position: fixed;
    top: 80px;
    left: 20px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 215, 0, 0.6);
    border-radius: 12px;
    padding: 15px;
    width: 220px;
    z-index: 4999;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
}

/* Custom Image Slider Styling */
.custom-slider-container {
    position: relative;
    width: 100%;
    height: 30px;
    margin-top: 5px;
    display: flex;
    align-items: center;
}

/* Invisible native input placed on top to capture events */
#volume-slider {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

/* Track background using user's asset */
.slider-track-bg {
    position: absolute;
    width: 100%;
    height: 20px;
    background-image: url('assets/bar-filler.png');
    background-size: 100% 100%;
    background-position: left center;
    background-repeat: no-repeat;
    border-radius: 10px;
    filter: grayscale(80%) brightness(50%);
    /* Darkened version for background Empty */
    z-index: 1;
}

/* Filled track using user's asset with clip-path */
.slider-fill {
    position: absolute;
    width: 100%;
    /* Will be updated via JS */
    height: 20px;
    background-image: url('assets/bar-filler.png');
    background-size: cover;
    background-position: left center;
    background-repeat: no-repeat;
    border-radius: 10px;
    clip-path: inset(0 60% 0 0);
    /* 40% width example, updated by JS */
    z-index: 2;
}

/* Custom thumb icon using user's asset */
.slider-thumb {
    position: absolute;
    width: 30px;
    height: 30px;
    background-image: url('assets/slider.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    left: 40%;
    /* Updated by JS */
    transform: translateX(-50%);
    z-index: 3;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
    pointer-events: none;
}

/* Camera Container - Where Three.js renders */
#camera-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

#camera-container canvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    /* Prevent default touch behaviors */
}

/* Debug Panel (optional) */
#debug-panel {
    position: absolute;
    bottom: 200px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px;
    border-radius: 8px;
    font-size: 11px;
    font-family: monospace;
    z-index: 100;
    max-width: 200px;
    display: none;
    /* Hidden by default */
}

#debug-content {
    color: #0f0;
    line-height: 1.4;
}

/* Loading State */
.loading #status-text {
    color: #FFC107;
}

/* Error State */
.error #status-text {
    color: #F44336;
}

/* Success State */
.success #status-text {
    color: #4CAF50;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    #info-panel {
        padding: 15px 20px;
        top: 10px;
    }

    #info-panel h1 {
        font-size: 20px;
        margin-bottom: 8px;
    }

    #status-text {
        font-size: 14px;
    }

    #instructions {
        font-size: 12px;
    }

    #start-camera-btn {
        padding: 15px 40px;
        font-size: 16px;
        bottom: 100px;
    }

    #spawn-btn {
        padding: 15px 40px;
        font-size: 16px;
        bottom: 100px;
    }
}

/* Landscape Orientation */
@media (orientation: landscape) and (max-height: 500px) {
    #info-panel {
        top: 10px;
        padding: 10px 20px;
    }

    #info-panel h1 {
        font-size: 18px;
        margin-bottom: 5px;
    }

    #status-text {
        font-size: 13px;
    }

    #instructions {
        font-size: 11px;
    }

    #start-camera-btn {
        bottom: 20px;
        padding: 12px 35px;
        font-size: 14px;
    }
}

/* .disclaimer-body is still used by the (currently skipped) Objectives screen further down */
.disclaimer-body {
    margin-bottom: 25px;
    font-size: 15px;
    line-height: 1.6;
}

.disclaimer-body ul {
    margin: 15px 0;
    padding-left: 20px;
}

.disclaimer-body li {
    margin-bottom: 8px;
}

.disclaimer-body strong {
    font-weight: 700;
}



/* Intro Screens Styling */
.intro-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    /* Higher than disclaimer */
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
    overflow-y: auto;
    /* Enable vertical scrolling for small screens */
    padding: 20px 0;
    /* Add vertical padding */
}

/* Absolute positioned blurred background */
.intro-screen-bg {
    position: fixed;
    top: -5%;
    left: -5%;
    width: 110%;
    height: 110%;
    background-image: url('assets/bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(8px);
    /* 50% perceived blur effect */
    z-index: -1;
    /* Keep it behind the content */
}

/* Language Select Screen (custom-built piece by piece, no baked artwork - a solid color always
   fills its box exactly on every device, so this is fully responsive with no scaling/cropping).
   The screen element itself is the flex column (not a separate position:absolute wrapper), and
   stays in normal document flow, so if its content is ever taller than the screen (a very short
   or wide/tablet viewport), the inherited .intro-screen overflow-y:auto lets it scroll instead of
   clipping or pushing the buttons off-screen where they'd be unreachable. */
.lang-screen {
    background-color: rgb(158, 219, 239);
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0 0 220px 0;
    /* reserve room at the bottom equal to roughly the fixed bar's height, so on very short
       screens the scrollable logo content never sits underneath it */
}

/* This screen is full-bleed edge-to-edge, not a centered card like the other intro screens, so
   drop the generic .intro-screen spacer pseudo-elements that would otherwise fight our own layout.
   Uses the compound .intro-screen.lang-screen selector (not just .lang-screen) so its specificity
   reliably beats .intro-screen::before/::after regardless of source order in this file. */
.intro-screen.lang-screen::before,
.intro-screen.lang-screen::after {
    content: none;
}

.lang-logo {
    display: block;
    width: min(88%, 440px);
    height: auto;
    margin-top: 9vh;
    flex-shrink: 0;
}

/* Bottom red bar - pinned with position:fixed directly to the real device viewport edge instead
   of relying on a parent's computed height (100%/dvh chains can be off by the height of a mobile
   browser's address/toolbar during its show/hide animation, leaving a gap below the bar). Fixed
   positioning is re-anchored by the browser to the actual visual viewport in real time, so this
   always reaches the true bottom edge on every device. */
.lang-bottom-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgb(234, 46, 48);
    border-radius: 32px 32px 0 0;
    padding: 26px 24px max(26px, env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.lang-bar-text {
    font-family: 'Teshrin AR LT', 'Poppins', sans-serif;
    color: #fff;
    font-size: clamp(1.35rem, 6.2vw, 2rem);
    font-weight: 700;
    line-height: 1.35;
    margin: 0;
}

.lang-btn-row {
    display: flex;
    justify-content: center;
    gap: 16px;
    width: 100%;
    max-width: 420px;
    margin-top: 16px;
}

.lang-btn {
    flex: 1;
    max-width: 160px;
    padding: 15px 10px;
    background-color: transparent;
    background-image: url('assets/blue-btn.png');
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    border: none;
    color: #fff;
    font-family: 'Teshrin AR LT', 'Poppins', sans-serif;
    font-size: clamp(0.95rem, 4vw, 1.15rem);
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.3));
    transition: transform 0.15s ease, filter 0.15s ease;
}

.lang-btn:hover {
    transform: scale(1.04);
}

.lang-btn:active {
    transform: scale(0.95);
}

.lang-btn:focus-visible {
    outline: 3px solid #FFD700;
    outline-offset: 3px;
    border-radius: 12px;
}

/* Disclaimer Screen - same visual language as the language screen (blue background, icon on top,
   red rounded-top bottom bar), but with a lot more text, so the bar itself scrolls internally
   instead of the whole screen, keeping the title and Accept button always in view. */
.disclaimer-screen {
    background-color: rgb(158, 219, 239);
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0;
}

.intro-screen.disclaimer-screen::before,
.intro-screen.disclaimer-screen::after {
    content: none;
}

.disclaimer-icon-area {
    margin-top: 9vh;
    flex-shrink: 0;
}

.disclaimer-icon {
    display: block;
    font-size: 4rem;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.2));
}

.disclaimer-bottom-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 72vh;
    max-height: 72dvh;
    background-color: rgb(234, 46, 48);
    border-radius: 32px 32px 0 0;
    padding: 24px 24px max(20px, env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    align-items: center;
}

.disclaimer-title {
    font-family: 'Teshrin AR LT', 'Poppins', sans-serif;
    color: #fff;
    font-size: clamp(1.1rem, 4.5vw, 1.4rem);
    font-weight: 700;
    text-align: center;
    margin: 0 0 14px;
    flex-shrink: 0;
}

.disclaimer-body-scroll {
    width: 100%;
    overflow-y: auto;
    color: #fff;
    font-size: 0.95rem;
    line-height: 1.5;
}

.disclaimer-body-scroll p {
    margin: 0 0 10px;
    text-align: center;
}

.disclaimer-body-scroll ul {
    margin: 0 0 10px;
    padding-left: 22px;
}

.disclaimer-body-scroll li {
    margin-bottom: 8px;
}

.disclaimer-agreement {
    font-style: italic;
    font-size: 0.8rem;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    margin-top: 10px !important;
    padding-top: 10px;
    opacity: 0.9;
}

.disclaimer-accept-btn {
    flex-shrink: 0;
    width: 100%;
    max-width: 320px;
    margin-top: 18px;
    padding: 15px 10px;
    background-color: transparent;
    background-image: url('assets/blue-btn.png');
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    border: none;
    color: #fff;
    font-family: 'Teshrin AR LT', 'Poppins', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.3));
    transition: transform 0.15s ease;
}

.disclaimer-accept-btn:hover {
    transform: scale(1.03);
}

.disclaimer-accept-btn:active {
    transform: scale(0.95);
}

.disclaimer-accept-btn:focus-visible {
    outline: 3px solid #FFD700;
    outline-offset: 3px;
    border-radius: 12px;
}

/* Ensure content is centered but scrollable */
.intro-screen::before,
.intro-screen::after {
    content: "";
    flex: 1;
    min-height: 20px;
}

.intro-screen .screen-content {
    padding: 20px;
    max-width: 600px;
    width: 90%;
    animation: fadeIn 1s ease-out;
    margin: auto 0;
    /* Center vertically in flow */
}

.eid-moon {
    font-size: clamp(50px, 15vh, 80px);
    /* Responsive emoji size */
    margin-bottom: 2vh;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.6));
    animation: float 3s ease-in-out infinite;
}

.intro-screen h1 {
    font-size: clamp(1.8rem, 5vw, 3rem);
    /* Responsive title */
    margin-bottom: 2vh;
    color: #FFD700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    font-family: 'Georgia', serif;
    /* More classic look for Eid */
}

.greeting-text {
    font-size: clamp(1rem, 3vw, 1.2rem);
    line-height: 1.5;
    margin-bottom: 4vh;
    color: #e0e0e0;
    font-style: italic;
}

.game-intro {
    background: rgba(255, 255, 255, 0.1);
    padding: 2vh;
    border-radius: 15px;
    margin-bottom: 4vh;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    /* Ensure column layout by defaut */
}

.game-intro img {
    animation: gentleShake 4s infinite ease-in-out;
    max-height: 30vh;
    /* Limit image height on short screens */
    width: auto;
    /* Maintain aspect ratio */
    max-width: 100%;
    /* Prevent overflow width */
}

@keyframes gentleShake {
    0% {
        transform: translate(0, 0);
    }

    10% {
        transform: translate(-2px, -2px);
    }

    20% {
        transform: translate(2px, -1px);
    }

    30% {
        transform: translate(-1px, 2px);
    }

    40% {
        transform: translate(1px, 1px);
    }

    50% {
        transform: translate(-1px, -2px);
    }

    60% {
        transform: translate(2px, 1px);
    }

    70% {
        transform: translate(-2px, 1px);
    }

    80% {
        transform: translate(1px, -1px);
    }

    90% {
        transform: translate(-1px, 2px);
    }

    100% {
        transform: translate(0, 0);
    }
}

.game-intro h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #4CAF50;
}

.action-btn {
    padding: 15px 40px;
    font-size: 1.2rem;
    background-color: transparent;
    background-image: url('assets/green-btn.png');
    /* Default fallback */
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    border: none;
    cursor: pointer;
    font-weight: bold;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
    transition: transform 0.2s ease, filter 0.2s ease;
}

/* Explicit Button Color Classes */
.action-btn.btn-green,
.menu-btn.btn-green {
    background-image: url('assets/green-btn.png') !important;
}

.action-btn.btn-blue,
.menu-btn.btn-blue {
    background-image: url('assets/blue-btn.png') !important;
}

.action-btn:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.6));
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Typing Effect Cursor */
.typing-cursor::after {
    content: '|';
    animation: blink 1s step-start infinite;
    font-weight: bold;
    color: #4CAF50;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   GAME HUD - Unified Top Panel
   ============================================ */
#game-hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 500;
    pointer-events: none;
}

#hud-top-panel {
    position: fixed;
    top: 15px;
    left: 0;
    width: 100%;
    padding: 0 15px;
    /* Spacing from screen edges */
    box-sizing: border-box;
    display: flex;
    align-items: center;
    z-index: 600;
}

/* #start-settings-toggle-btn now lives inside #hud-top-panel as a normal flex item next to the
   bars (instead of being independently position:fixed elsewhere on screen), so it aligns with
   them exactly. This ID selector reliably overrides the .settings-toggle base positioning. */
#start-settings-toggle-btn {
    position: static;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

/* Groups the 3 stat bars tightly together and pushes them to the right, leaving the settings
   icon on the far left with the rest of the row as open space between them. */
.hud-stats-group {
    display: flex;
    align-items: center;
    gap: 4px;
    /* Logical property (not margin-left) so this correctly pushes to the end of the row in both
       directions: right in LTR, left in RTL - keeping the settings gear on the opposite (start) side. */
    margin-inline-start: auto;
}

/* Shared Widget Style - white pill with red border (assets/hud-bar.png), matching the reference UI */
.hud-widget {
    background-image: url('assets/hud-bar.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    padding: 5px 14px;
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 96px;
    justify-content: center;
}

/* Shared Icon Style */
.hud-icon {
    width: 19px;
    height: 19px;
    object-fit: contain;
    flex-shrink: 0;
}

/* Shared Display Style */
.hud-display {
    font-family: 'Teshrin AR LT', 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 800;
    color: rgb(234, 46, 48);
    letter-spacing: 0.5px;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.5s;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.hud-display.bump {
    transform: scale(1.3);
    color: #FF8A00;
}

#timer-display.warning {
    color: #FF9800;
    animation: timerPulse 1s infinite;
}

#timer-display.danger {
    color: #f44336;
    animation: timerPulse 0.5s infinite;
}

@keyframes timerPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Score popup animation */
.score-popup {
    position: fixed;
    font-size: 22px;
    font-weight: 800;
    color: #FFD700;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
    pointer-events: none;
    z-index: 600;
    animation: scoreFloat 1.5s ease-out forwards;
}

@keyframes scoreFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(-80px) scale(1.4);
    }
}

/* Time bonus popup */
.time-bonus-popup {
    position: fixed;
    font-size: 18px;
    font-weight: 700;
    color: #4CAF50;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
    pointer-events: none;
    z-index: 600;
    animation: scoreFloat 1.5s ease-out forwards;
}

/* ============================================
   GAME OVER SCREEN (Redesigned)
   ============================================ */
/* We rely on .intro-screen for the main container now */
.premium-card {
    background: rgba(10, 20, 30, 0.85);
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 215, 0, 0.5);
    border-radius: 20px;
    /* Squircle appearance */
    padding: 25px 20px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(255, 215, 0, 0.1);
    width: 90%;
    max-width: 380px;
    margin: 0 auto;
    text-align: center;
}

/* Compact popups (player ID / cooldown) shown over the live gameplay screen - a dim backdrop to
   focus attention, but not a full opaque/blurred screen takeover like the old .intro-screen. */
.game-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 7000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.game-popup-overlay .premium-card {
    animation: fadeIn 0.3s ease-out;
}

/* Game Start overlay - just the Start button + settings gear floating directly on top of the
   already-running camera/gameplay view (not a separate screen). */
#game-start-overlay {
    position: fixed;
    inset: 0;
    z-index: 2500;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 0 20px max(28px, env(safe-area-inset-bottom, 0px));
}

/* Large flat rounded button matching the reference UI (not the blue-btn.png pill style) */
.game-start-cta {
    width: 100%;
    max-width: 440px;
    padding: 22px 20px;
    background-color: rgb(64, 191, 209);
    border: none;
    border-radius: 20px;
    color: #fff;
    font-family: 'Teshrin AR LT', 'Poppins', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    transition: transform 0.15s ease;
}

.game-start-cta:hover {
    transform: translateY(-2px);
}

.game-start-cta:active {
    transform: scale(0.97);
}

/* Terms/Objectives/Disclaimer popup - shown over the live camera/gameplay view, same as the
   Start screen. #game-hud has its own z-index (500), which makes it a stacking context of its
   own - #hud-top-panel's z-index:600 only applies *inside* that context and can't "escape" it to
   out-rank a sibling element, so this popup's z-index must be lower than #game-hud's (500), not
   just lower than the bars' own (600), for the bars to stay above this popup's dark backdrop. */
#terms-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    padding: 70px 20px 20px;
}

.terms-popup-card {
    width: 100%;
    max-width: 420px;
    background-color: rgb(158, 219, 239);
    border: 5px solid #fff;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease-out;
}

.terms-popup-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 44px;
    padding: 50px 24px;
}

/* Text versions of the link labels (previously baked-text images, which couldn't translate to
   Arabic) - bold + underlined to match the original artwork's look, but real i18n-able text. */
.terms-popup-link-text,
.terms-popup-link-btn span {
    font-family: 'Teshrin AR LT', 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: #3d5560;
    text-decoration: underline;
    text-underline-offset: 6px;
    text-decoration-thickness: 3px;
}

.terms-popup-footer {
    background-color: rgb(234, 46, 48);
    padding: 24px;
    display: flex;
    justify-content: center;
}

/* Accept button - real translatable text over the blank assets/popup-blue-btn.png (the original
   button.png had "Accept and Continue" baked into the image, which didn't translate to Arabic). */
.terms-accept-btn {
    background-color: transparent;
    background-image: url('assets/popup-blue-btn.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    border: none;
    padding: 18px 20px;
    cursor: pointer;
    width: 100%;
    max-width: 340px;
    transition: transform 0.15s ease;
}

.terms-accept-btn span {
    font-family: 'Teshrin AR LT', 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.3rem;
    color: #fff;
}

.terms-accept-btn:active {
    transform: scale(0.96);
}

/* Objectives/Disclaimer links on the Terms popup - reset to look identical to the plain
   .terms-popup-link-text, just clickable now. */
.terms-popup-link-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    max-width: 85%;
    transition: transform 0.15s ease;
}

.terms-popup-link-btn img {
    width: 100%;
    height: auto;
    display: block;
}

.terms-popup-link-btn:active {
    transform: scale(0.96);
}

/* Objectives/Disclaimer detail popups - same dark backdrop + card shell as the Terms popup, but
   with a title + scrollable white text box instead of the link list. Shares #terms-popup-overlay's
   z-index reasoning (must stay below #game-hud's own stacking context). */
#objectives-popup-overlay,
#disclaimer-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    padding: 70px 20px 20px;
}

.detail-popup-card {
    width: 100%;
    max-width: 420px;
    height: 80vh;
    height: 80dvh;
    max-height: 640px;
    background-color: rgb(158, 219, 239);
    border: 5px solid #fff;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease-out;
}

.detail-popup-title {
    flex-shrink: 0;
    text-align: center;
    padding: 28px 24px 0;
}

.detail-popup-title span {
    display: inline-block;
    font-family: 'Teshrin AR LT', 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 2rem;
    color: #3d5560;
    text-decoration: underline;
    text-underline-offset: 8px;
    text-decoration-thickness: 3px;
}

.detail-popup-body-wrap {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin: 20px 22px;
}

/* The text popup.png background already includes the little triangle notch pointing up at the
   title, the rounded corners, and the border - stretched to fill whatever size this box ends up. */
.detail-popup-body {
    flex: 1;
    min-width: 0;
    background-image: url('assets/popup-text-box.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    padding-block: 26px;
    padding-inline: 22px 18px;
    overflow-y: auto;
    scrollbar-width: none;
    color: #3d5560;
    font-family: 'Teshrin AR LT', 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.5;
    text-align: start;
}

.detail-popup-body::-webkit-scrollbar {
    display: none;
}

.detail-popup-body p {
    margin: 0 0 14px;
}

.detail-popup-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.detail-popup-list li {
    position: relative;
    padding-inline-start: 20px;
    margin-bottom: 16px;
}

.detail-popup-list li::before {
    content: "";
    position: absolute;
    inset-inline-start: 2px;
    top: 0.55em;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.detail-popup-highlight {
    color: #2fae4a;
}

.detail-popup-agreement {
    font-style: italic;
    font-size: 0.85rem;
    border-top: 1px solid rgba(61, 85, 96, 0.25);
    padding-top: 12px;
    margin-top: 10px !important;
}

/* Custom scrollbar (assets/popup-scrollbar-track.png + popup-scrollbar-thumb.png) that mirrors
   the real scroll position of .detail-popup-body via JS - not a native draggable scrollbar. */
.detail-popup-scroll-track {
    width: 10px;
    flex-shrink: 0;
    position: relative;
    background-image: url('assets/popup-scrollbar-track.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
}

.detail-popup-scroll-thumb {
    position: absolute;
    left: 0;
    width: 100%;
    border-radius: 5px;
    background-image: url('assets/popup-scrollbar-thumb.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
}

.gameover-header {
    margin-bottom: 12px;
    position: relative;
    display: flex;
    justify-content: center;
}

.gameover-top-title {
    font-size: 1.6rem;
    color: #FFD700;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

/* Game Over Screen - same theme as the other popup screens (dark backdrop, live camera visible
   behind it, z-index kept below #game-hud's own stacking context so the bars/settings gear stay
   visible above it - see the note on #terms-popup-overlay for why that specific z-index matters).
   Card uses the two-tone (white title strip + red body) assets/gameover-popup-bg.png, sized via
   aspect-ratio so it always matches the artwork's proportions with no stretching, plus a timer
   badge overlapping the top edge. */
.gameover-screen {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    padding: 60px 20px 20px;
}

.gameover-card {
    position: relative;
    width: 100%;
    max-width: 400px;
    aspect-ratio: 984 / 1277;
    background-image: url('assets/gameover-popup-bg.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    text-align: center;
    filter: drop-shadow(0 15px 40px rgba(0, 0, 0, 0.4));
    animation: fadeIn 0.4s ease-out;
}

.gameover-timer-badge {
    position: absolute;
    top: -13%;
    left: 50%;
    transform: translateX(-50%);
    width: 22%;
    height: auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

.gameover-title-block {
    flex: 0 0 23%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 4% 8% 0;
}

#gameover-title {
    font-family: 'Teshrin AR LT', 'Poppins', sans-serif;
    font-size: clamp(1.7rem, 8.5vw, 2.2rem);
    font-weight: 900;
    color: #3d5560;
    letter-spacing: 1px;
    margin: 0 0 6%;
    text-transform: uppercase;
}

.gameover-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4% 8% 6%;
}

#gameover-subtitle {
    font-family: 'Teshrin AR LT', 'Poppins', sans-serif;
    font-size: clamp(1.2rem, 5.5vw, 1.5rem);
    font-weight: 700;
    color: #fff;
    margin: 0 0 5%;
}

.gameover-stats-row {
    display: flex;
    gap: 3%;
    justify-content: center;
    width: 100%;
}

.gameover-stat-box {
    flex: 1;
    min-width: 0;
    /* flex items default to min-width:auto, which stops them shrinking below their content's
       natural size - combined with aspect-ratio that was pushing these wider than the row had
       room for, overflowing past the card's edges. min-width:0 lets them actually shrink to fit. */
    aspect-ratio: 275 / 315;
    background-image: url('assets/gameover-container.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4%;
    padding: 6% 4%;
}

.gameover-stat-icon {
    width: 62%;
    height: auto;
    object-fit: contain;
}

.gameover-stat-box .stat-value {
    font-family: 'Teshrin AR LT', 'Poppins', sans-serif;
    font-size: clamp(1.1rem, 5.5vw, 1.5rem);
    font-weight: 800;
    color: #fff;
    line-height: 1;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.35);
}

.gameover-stat-label {
    font-family: 'Teshrin AR LT', 'Poppins', sans-serif;
    font-size: clamp(0.7rem, 3vw, 0.85rem);
    font-weight: 700;
    color: #fff;
    text-align: center;
    line-height: 1.1;
}

/* flex:1 makes this block absorb all the leftover space between the stat boxes and the button,
   then centers its own text within that space - so it sits exactly between them regardless of
   how much room is actually available. */
.gameover-cooldown-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.gameover-cooldown-text p {
    font-family: 'Teshrin AR LT', 'Poppins', sans-serif;
    font-size: clamp(1rem, 4.8vw, 1.3rem);
    font-weight: 800;
    color: #fff;
    margin: 0 0 6px;
}

.gameover-restart-btn {
    width: 100%;
    padding: 5% 20px;
    background-color: rgb(71, 180, 203);
    border: none;
    border-radius: 18px;
    color: #fff;
    font-family: 'Teshrin AR LT', 'Poppins', sans-serif;
    font-size: clamp(1.1rem, 5.5vw, 1.4rem);
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s ease;
}

.gameover-restart-btn:active {
    transform: scale(0.96);
}

/* Treasure Collection Popup ("You Collected") - shown only for special items, same theme as
   .gameover-screen (dark backdrop over the live camera, z-index kept below #game-hud's own
   stacking context - see the note on #terms-popup-overlay for why that specific z-index matters).
   Card uses the three-tone (white title strip + light-blue body + red footer)
   assets/collected-popup-bg.png, sized via aspect-ratio so it always matches the artwork's
   proportions with no stretching. */
.collected-screen {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    padding: 20px;
}

.collected-card {
    position: relative;
    width: 100%;
    max-width: 380px;
    aspect-ratio: 984 / 1497;
    background-image: url('assets/collected-popup-bg.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    text-align: center;
    filter: drop-shadow(0 15px 40px rgba(0, 0, 0, 0.4));
    animation: fadeIn 0.4s ease-out;
}

.collected-title-block {
    flex: 0 0 14.3%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8%;
}

.collected-title-block h1 {
    font-family: 'Teshrin AR LT', 'Poppins', sans-serif;
    font-size: clamp(1.4rem, 7.5vw, 2rem);
    font-weight: 900;
    color: #3d5560;
    letter-spacing: 1px;
    margin: 0;
    text-transform: uppercase;
}

.collected-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 2%;
    padding: 2.5% 9% 1%;
}

.collected-star-icon {
    width: 26%;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.25));
}

#collected-item-name {
    font-family: 'Teshrin AR LT', 'Poppins', sans-serif;
    font-size: clamp(1.2rem, 6vw, 1.65rem);
    font-weight: 800;
    color: #3d5560;
    margin: 0;
}

.collected-item-wrap {
    position: relative;
    width: 50%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.collected-sunburst {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 185%;
    height: 185%;
    transform: translate(-50%, -50%);
    object-fit: contain;
    pointer-events: none;
}

.collected-item-img {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.2));
}

#collected-cashback-msg {
    font-family: 'Teshrin AR LT', 'Poppins', sans-serif;
    font-size: clamp(0.95rem, 4.3vw, 1.15rem);
    font-weight: 700;
    color: #3d5560;
    white-space: pre-line;
    line-height: 1.25;
    margin: 0;
}

.collected-footer {
    flex: 0 0 22.2%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6%;
}

.collected-continue-btn {
    width: 100%;
    height: 55%;
    background-color: transparent;
    background-image: url('assets/collected-continue-bg.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    border: none;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease;
}

.collected-continue-btn:active {
    transform: scale(0.96);
}

.collected-continue-btn span {
    font-family: 'Teshrin AR LT', 'Poppins', sans-serif;
    font-size: clamp(1rem, 5vw, 1.3rem);
    font-weight: 800;
    color: #fff;
}

/* ============================================
   MENU SCREEN
   ============================================ */
#menu-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(160deg, #0d1b2a 0%, #1b2838 50%, #0d1b2a 100%);
    z-index: 1500;
    /* between disclaimer (1000) and screen-one (2000) */
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.5s ease-out;
}

.menu-content {
    width: 90%;
    max-width: 420px;
    text-align: center;
    padding: 20px;
}

.menu-logo {
    font-size: 56px;
    margin-bottom: 8px;
    filter: drop-shadow(0 0 18px rgba(255, 215, 0, 0.5));
    animation: float 3s ease-in-out infinite;
}

.menu-title {
    font-size: 2rem;
    font-weight: 800;
    color: #FFD700;
    margin: 0 0 4px;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.menu-subtitle {
    font-size: 0.95rem;
    color: #aaa;
    margin: 0 0 32px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Base menu button */
.menu-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 16px 20px;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    font-size: 1.05rem;
    font-weight: 600;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s;
    text-align: left;
    gap: 14px;
    position: relative;
}

.menu-btn:active {
    transform: scale(0.97);
}

.menu-btn-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.menu-btn-text {
    flex: 1;
    color: #fff;
}

.menu-btn-arrow {
    font-size: 1.4rem;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 300;
}

/* Primary — Start Game */
.menu-btn-primary {
    background: linear-gradient(135deg, #1a6b2e, #27ae60);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.35);
}

.menu-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(39, 174, 96, 0.5);
}

/* Secondary — Language / Location */
.menu-btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.menu-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.14);
    transform: translateY(-2px);
}

/* Location option buttons inside the new popup */
.loc-option-btn {
    width: 100%;
    padding: 15px 20px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.4);
    color: #ccc;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.loc-option-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateY(-2px);
}

.loc-option-btn.active-loc {
    background: rgba(76, 175, 80, 0.2);
    border: 2px solid #4CAF50;
    color: #4CAF50;
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

/* Danger — Exit */
.menu-btn-danger {
    background: rgba(192, 57, 43, 0.25);
    border: 1px solid rgba(192, 57, 43, 0.4);
    box-shadow: 0 4px 12px rgba(192, 57, 43, 0.2);
}

.menu-btn-danger:hover {
    background: rgba(192, 57, 43, 0.4);
    transform: translateY(-2px);
}

/* Language sub-panel */
.sub-panel {
    display: flex;
    gap: 10px;
    padding: 4px 0 4px 0;
    animation: fadeIn 0.3s ease-out;
}

.lang-option {
    flex: 1;
    padding: 12px 8px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.06);
    color: #ccc;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.lang-option:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.lang-option.active-lang {
    background: rgba(255, 215, 0, 0.15);
    border-color: rgba(255, 215, 0, 0.5);
    color: #FFD700;
    font-weight: 700;
}

/* Short Screen Optimizations (Landscape/Small Phones) */
@media (max-height: 700px) {
    .intro-screen h1 {
        margin-bottom: 1vh;
    }

    .greeting-text {
        margin-bottom: 2vh;
    }

    .game-intro {
        margin-bottom: 2vh;
        padding: 1.5vh;
    }

    .action-btn {
        padding: 10px 40px;
        font-size: 1rem;
    }

    .eid-moon {
        display: none;
        /* Hide moon emoji on very short screens to save space */
    }
}

/* ============================================
   DIRECTION ARROW - Points toward bucket
   ============================================ */
#direction-arrow {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 52px;
    height: 52px;
    z-index: 500;
    pointer-events: none;
    transform-origin: center center;
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.9));
    display: none;
}

@keyframes arrowPulse {

    0%,
    100% {
        filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.7));
    }

    50% {
        filter: drop-shadow(0 0 18px rgba(255, 215, 0, 1));
    }
}

/* =========================================
   ERROR SCREENS
========================================= */

.error-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(15px);
    z-index: 3000;
    display: none;
    /* Hidden by default */
    justify-content: center;
    align-items: center;
}

.error-content {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    max-width: 90%;
    width: 400px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.error-icon {
    font-size: 50px;
    margin-bottom: 20px;
}

.error-content h1 {
    font-size: 24px;
    margin-bottom: 12px;
    color: #FF5252;
}

.error-content p {
    font-size: 16px;
    color: #ddd;
    line-height: 1.5;
    margin-bottom: 20px;
}

.error-steps {
    text-align: left;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 25px;
}

.error-steps p {
    font-size: 14px;
    margin-bottom: 8px;
    color: #ccc;
}

.error-steps p:last-child {
    margin-bottom: 0;
}

.error-content .action-btn {
    width: 100%;
    background: linear-gradient(135deg, #FF5252, #FF1744);
    box-shadow: 0 4px 15px rgba(255, 82, 82, 0.4);
}


/* =========================================
   SETTINGS / PAUSE MENU
========================================= */

#pause-btn {
    display: none !important;
}

/* HUD Settings Icon — now a normal flex item inside #hud-top-panel, left of the stat bars */
#hud-settings-btn {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.2s;
}

#hud-settings-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

#hud-settings-btn:active {
    transform: scale(0.9);
}

/* Settings Popup Overlay */
#settings-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 7000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#settings-popup {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 16px;
    padding: 24px 28px;
    width: 280px;
    color: white;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

#settings-popup h2 {
    text-align: center;
    margin: 0 0 18px 0;
    font-size: 1.3rem;
    color: #FFD700;
}

.settings-popup-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.settings-popup-row label {
    font-size: 0.95rem;
    font-weight: 600;
    min-width: 80px;
}

.settings-popup-row input[type="range"] {
    flex: 1;
    margin-left: 10px;
    accent-color: #FFD700;
    height: 6px;
}

.settings-popup-buttons {
    display: flex;
    gap: 10px;
    margin: 18px 0 12px 0;
}

.settings-popup-btn {
    flex: 1;
    padding: 10px 0;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.15s;
    color: white;
}

.settings-popup-btn:active {
    transform: scale(0.95);
}

.btn-exit {
    background: #4CAF50;
}

.btn-ok {
    background: #2196F3;
}

.settings-options button {
    font-size: 1.1rem;
    padding: 15px 20px;
}