/* Urban Life Simulator - CSS Styles */
/* VAPOR Engine Transformation for Urban Life Simulation */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Space Mono', monospace;
    overflow: hidden;
    background: #000;
    color: #fff;
}

#game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* UI Panels */
.ui-panel {
    position: absolute;
    background: rgba(0, 0, 0, 0.78);
    border: 2px solid #ff6600;
    padding: 10px;
    font-size: 12px;
    pointer-events: none;
    backdrop-filter: blur(6px);           /* NEW: subtle glass effect for readability */
    -webkit-backdrop-filter: blur(6px);
    border-radius: 8px;                   /* NEW: soften corners for better UX */
}

/* NEW: Music controls panel */
#music-controls {
    top: 10px;
    right: 10px;
    width: 180px;
    padding: 8px;
    z-index: 90;
    pointer-events: all;
}

#music-controls .music-title {
    font-family: 'VT323', monospace;
    color: #ff9d4d;
    margin-bottom: 4px;
    font-size: 14px;
}

#music-controls .music-track {
    font-size: 11px;
    color: #ffe0c2;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#music-controls .music-buttons {
    display: flex;
    gap: 4px;
    justify-content: space-between;
}

#music-controls .music-buttons button {
    flex: 1;
    padding: 6px 0;                        /* NEW: larger touch target */
    background: rgba(40, 20, 10, 0.95);
    border: 1px solid rgba(255, 120, 0, 0.9);
    color: #ffe0c2;
    font-family: 'VT323', monospace;
    font-size: 12px;
    cursor: pointer;
    border-radius: 999px;                 /* NEW: pill buttons for faster recognition */
    transition: background 0.12s ease, transform 0.05s ease, box-shadow 0.12s ease;
}

#music-controls .music-buttons button:hover {
    background: rgba(255, 140, 40, 0.95);
    color: #000;
    box-shadow: 0 0 8px rgba(255, 140, 40, 0.7);
}

#music-controls .music-buttons button:active {
    background: rgba(255, 200, 120, 1);
    color: #000;
    transform: translateY(1px);
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
}

#status-ui {
    top: 10px;
    left: 10px;
    width: 280px;
}

.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.1),
        rgba(0, 0, 0, 0.1) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 10;
}

.stats-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-label {
    color: #ff6600;
    min-width: 60px;
    font-weight: bold;
}

.stat-bar {
    flex: 1;
    height: 12px;
    background: rgba(255, 102, 0, 0.2);
    border: 1px solid #ff6600;
}

.stat-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6600, #ff9933);
    transition: width 0.3s;
}

.stat-value {
    color: #fff;
    min-width: 40px;
    text-align: right;
}

.wanted-display {
    color: #ff0000;
    font-size: 14px;
}

.time-display, .location-display {
    margin-top: 10px;
    color: #ff6600;
    text-align: center;
    font-weight: bold;
}

/* Start Wave button (now inside Fast Travel terminal menu) */
#start-wave-btn {
    width: 100%;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(255, 102, 0, 0.85);
    border: 2px solid #ff6600;
    border-radius: 10px;
    color: #000;
    font-family: 'VT323', monospace;
    font-size: 16px;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
}

#start-wave-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}

@media (max-width: 768px) {
    #start-wave-btn {
        padding: 7px 10px;
        font-size: 14px;
    }
}

.mobile-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none; /* Hidden by default */
    pointer-events: none;
    z-index: 100;
}

#joystick-zone {
    position: absolute;
    bottom: 30px;
    left: 30px;
    width: 150px;
    height: 150px;
    background: rgba(0,0,0,0.3);
    background-image: url('/IMG_8481 (1).png');
    background-size: 80%;
    background-position: center;
    background-repeat: no-repeat;
    filter:
        invert(80%)
        sepia(90%)
        saturate(900%)
        hue-rotate(10deg)
        brightness(1.1)
        contrast(1.1);
    border-radius: 50%;
    pointer-events: all;
}

.action-buttons {
    position: absolute;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    pointer-events: all;
}

.action-btn {
    width: 70px;
    height: 70px;
    background: rgba(255, 102, 0, 0.5);
    border: 2px solid #ff6600;
    color: white;
    font-family: 'Space Mono', monospace;
    font-size: 16px;
    font-weight: bold;
    border-radius: 50%;
    text-align: center;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.action-btn:active {
    background: rgba(255, 102, 0, 0.8);
}

/* POLISH: Crosshair styling and feedback */
#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Space Mono', monospace;
    color: rgba(255, 255, 255, 0.8);
    font-size: 20px;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    transition: transform 0.05s ease, color 0.05s ease;
    z-index: 50;
}

#crosshair.fire {
    transform: translate(-50%, -50%) scale(1.15);
    color: #ffcc00;
}

#crosshair.hit {
    transform: translate(-50%, -50%) scale(1.25);
    color: #ff4444;
}

/* POLISH: Hit marker styling */
#hit-marker {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    transform: translate(-50%, -50%) scale(0.8);
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 6px;                             /* NEW: slightly softer corners */
    opacity: 0;
    pointer-events: none;
    z-index: 49;
    transition: opacity 0.1s ease, transform 0.1s ease, box-shadow 0.1s ease;
    box-shadow: 0 0 0 rgba(255, 255, 255, 0);       /* NEW: animated glow */
}

#hit-marker.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 0 10px rgba(255, 220, 150, 0.9);
}

/* NEW: Survival HUD styling */
#survival-hud {
    position: absolute;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    min-width: 220px;
    background: rgba(5, 5, 5, 0.85);
    border-radius: 10px;
    border: 2px solid rgba(255, 76, 0, 0.9);
    padding: 10px 16px;
    text-align: center;
    z-index: 80;
    pointer-events: all; /* allow clicking upgrade button */
    font-family: 'VT323', monospace;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
    display: none !important; /* Always hide the top-middle Survival HUD box */
}

.survival-text {
    color: #ffb347;
    font-size: 16px;
    letter-spacing: 1px;
    margin: 2px 0;
}
/* NEW: subtle de-emphasis for score/combo lines */
#survival-score,
#survival-combo {
    font-size: 14px;
    opacity: 0.9;
}

.wave-announcement-text {
    color: #ffe0c2;
    font-size: 18px;
    margin-bottom: 4px;
    text-shadow: 0 0 8px rgba(255, 120, 40, 0.8);
    opacity: 0;
    transform: translateY(-8px);
}

.wave-announcement-text.active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.25s ease-out, transform 0.25s ease-out;
}

/* NEW: Overseer vote UI */
#overseer-vote-container {
    position: absolute;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(8, 0, 0, 0.92);
    border-radius: 12px;
    border: 2px solid rgba(255, 68, 68, 0.9);
    padding: 10px 14px;
    width: 90%;
    max-width: 380px;
    z-index: 85;
    pointer-events: all;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.85);
}

#overseer-options {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.vote-option {
    flex: 1;
    min-width: 150px;
    background: rgba(40, 0, 0, 0.9);
    border-radius: 8px;
    border: 1px solid rgba(255, 98, 98, 0.7);
    padding: 8px;
}

.vote-option-title {
    color: #ff6b6b;
    font-size: 14px;
    margin-bottom: 4px;
}

.vote-option-desc {
    color: #ffe5e5;
    font-size: 12px;
}

#overseer-timer {
    font-size: 18px;
    color: #ffdf80;
}

/* NEW: Overseer result toast */
#overseer-result-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%);
    background: rgba(10, 0, 0, 0.95);
    padding: 12px 18px;
    border-radius: 10px;
    border: 2px solid rgba(255, 90, 0, 0.9);
    z-index: 90;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease-out, transform 0.25s ease-out;
}

#overseer-result-container.active {
    opacity: 1;
    transform: translate(-50%, -50%);
}

/* NEW: Screen distortion overlay for effects */
#screen-distortion-effect {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, rgba(255, 120, 0, 0.2), transparent 60%);
    mix-blend-mode: screen;
    opacity: 0;
    pointer-events: none;
    z-index: 75;
    transition: opacity 0.25s ease-out;
}

#screen-distortion-effect[style*="display: block"] {
    opacity: 1;
}

/* NEW: Rain overlay for thunderstorms */
#rain-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 74;
    opacity: 0;
    background-image: linear-gradient(
        120deg,
        rgba(180, 200, 255, 0.35) 0,
        rgba(180, 200, 255, 0.35) 1px,
        transparent 1px,
        transparent 6px
    );
    background-size: 12px 24px;
    transform: translate3d(0, 0, 0);
    transition: opacity 0.3s ease-out;
}

#rain-overlay.active {
    opacity: 0.55;
    animation: rain-fall 0.6s linear infinite;
}

@keyframes rain-fall {
    from {
        background-position: 0 0;
    }
    to {
        background-position: -12px 24px;
    }
}

/* NEW: Fast travel & inventory menu styling */
.menu-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 260px;
    max-width: 90vw;
    max-height: 80vh;
    background: rgba(5, 5, 5, 0.92);
    border-radius: 12px;
    border: 2px solid rgba(255, 120, 0, 0.9);
    padding: 16px 18px;
    z-index: 120;
    color: #ffe0c2;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.9);
    overflow: hidden;
    backdrop-filter: blur(8px);                    /* NEW */
    -webkit-backdrop-filter: blur(8px);
}

.menu-panel h2 {
    font-family: 'VT323', monospace;
    font-size: 20px;
    margin-bottom: 10px;
    color: #ff9d4d;
    text-align: center;
}

#location-list,
#inventory-list {
    margin-top: 8px;
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 4px;
}

.location-btn {
    width: 100%;
    margin: 4px 0;
    padding: 6px 8px;
    background: rgba(30, 30, 30, 0.95);
    border-radius: 8px;
    border: 1px solid rgba(255, 140, 0, 0.5);
    color: #ffe0c2;
    text-align: left;
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease;
}

.location-btn:hover {
    background: rgba(60, 35, 15, 0.95);
    transform: translateY(-1px);
}

.menu-panel button#close-travel,
.menu-panel button#close-inventory {
    margin-top: 10px;
    width: 100%;
    padding: 6px 8px;
    background: rgba(80, 20, 0, 0.95);
    border-radius: 8px;
    border: 1px solid rgba(255, 120, 0, 0.8);
    color: #ffe0c2;
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    cursor: pointer;
}

/* NEW: Inventory item grid */
#inventory-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    gap: 8px;
}

.inventory-item {
    position: relative;
    width: 100%;
    padding-top: 100%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 8px;
    border: 1px solid rgba(255, 150, 0, 0.8);
    background-color: rgba(20, 20, 20, 0.9);
    cursor: pointer;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.8);
}

.inventory-item:hover {
    border-color: #ffcc66;
}

.inventory-item .item-count {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 11px;
    color: #fff;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
}

/* NEW: Living Hell overlay styling */
#living-hell-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 20%, rgba(80, 0, 0, 0.9), rgba(5, 0, 0, 0.98));
    color: #ffe6e6;
    z-index: 110;
    pointer-events: all;
    display: flex;
    flex-direction: column;
    padding: 16px;
    overflow: hidden;
    backdrop-filter: blur(6px);                    /* NEW: keep text readable during chaos */
    -webkit-backdrop-filter: blur(6px);
}

.living-hell-mode #status-ui,
.living-hell-mode #survival-hud {
    filter: grayscale(0.8) contrast(0.9);
    opacity: 0.8;
}

.hell-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.hell-header h1 {
    font-family: 'VT323', monospace;
    font-size: 22px;
    color: #ff6666;
    text-shadow: 0 0 8px rgba(255, 80, 80, 0.9);
}

.hell-stats span {
    display: block;
    font-size: 13px;
    color: #ffb3b3;
}

.hell-narrative {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    margin: 6px 0;
    background: rgba(20, 0, 0, 0.85);
    border-radius: 10px;
    border: 1px solid rgba(255, 80, 80, 0.6);
    font-size: 13px;
    line-height: 1.4;
}

.hell-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.hell-choice-btn {
    flex: 1 1 48%;
    min-width: 120px;
    background: rgba(60, 0, 0, 0.95);
    border-radius: 8px;
    border: 1px solid rgba(255, 120, 120, 0.8);
    padding: 8px;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: #ffe0e0;
    cursor: pointer;
    text-align: left;
    white-space: normal;
}

.hell-choice-btn.exit-btn {
    flex-basis: 100%;
    background: rgba(30, 0, 0, 0.95);
    border-color: rgba(255, 80, 80, 0.9);
}

/* NEW: Loading screen polish */
#loading-screen {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 20%, #1a0b00 0, #050505 60%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    color: #ffe0c2;
    font-family: 'VT323', monospace;
}

.loading-content h1 {
    font-size: 26px;
    letter-spacing: 2px;
    margin-bottom: 14px;
    color: #ff9d4d;
}

.chroma-awards-logo {
    display: block;
    max-width: 260px;
    width: 60vw;
    height: auto;
    margin: 0 auto 16px auto;
    image-rendering: crisp-edges;
    filter:
        invert(88%)
        sepia(80%)
        saturate(900%)
        hue-rotate(10deg)
        brightness(1.1)
        contrast(1.1);
    opacity: 0.95;
}

.loading-bar {
    width: 220px;
    height: 6px;
    border-radius: 999px;
    background: rgba(40, 20, 10, 0.9);
    overflow: hidden;
    border: 1px solid rgba(255, 120, 0, 0.8);
    margin-bottom: 8px;
}

#loading-progress {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #ff7f00, #ffcc66);
    transition: width 0.2s ease-out;
}

#loading-text {
    font-size: 13px;
    opacity: 0.85;
    text-align: center;
}

/* Responsive tweaks for overlays on mobile */
@media (max-width: 768px) {
    .menu-panel {
        width: 90vw;
        padding: 12px 14px;
    }

    #living-hell-overlay {
        padding: 10px;
    }

    .hell-header h1 {
        font-size: 18px;
    }

    #survival-hud {
        top: 40px;
        min-width: 200px;
    }

    #music-controls {
        top: 8px;
        right: 8px;
        width: 170px;                 /* NEW: slightly narrower to fit small screens */
    }
}

/* NEW: Gun upgrade info + button styling */
#gun-upgrade-info {
    font-size: 13px;
    color: #ffd8a0;
    margin-top: 4px;
}

#gun-upgrade-btn {
    margin-top: 6px;
    margin-bottom: 4px;
    width: 100%;
    padding: 6px 10px;
    background: rgba(40, 20, 10, 0.95);
    border-radius: 999px;
    border: 1px solid rgba(255, 140, 0, 0.9);
    color: #ffe0c2;
    font-family: 'VT323', monospace;
    font-size: 13px;
    cursor: pointer;
    pointer-events: all;
    transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}

#gun-upgrade-btn:hover {
    background: rgba(255, 140, 40, 0.95);
    color: #000;
    box-shadow: 0 0 8px rgba(255, 140, 40, 0.8);
}

#gun-upgrade-btn:active {
    transform: translateY(1px);
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.9);
}

/* NEW: Credits button (now inline in HUD instead of bottom-right corner) */
#credits-button {
    padding: 2px 8px;
    background: rgba(80, 20, 0, 0.9);
    border-radius: 999px;
    border: 1px solid rgba(255, 120, 0, 0.9);
    color: #ffe0c2;
    font-family: 'VT323', monospace;
    font-size: 12px;
    text-decoration: none;
    pointer-events: all;
    transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}

#credits-button:hover {
    background: rgba(255, 140, 40, 0.95);
    color: #000;
    box-shadow: 0 0 6px rgba(255, 140, 40, 0.8);
}

#credits-button:active {
    transform: translateY(1px);
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.9);
}