/* =====================================================
   MALL COPS FROM DIMENSION X
   Corrupted Windows 95 / PS1 Fever Dream Aesthetic
   320x240 retro resolution scaled up
   ===================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

:root {
    --win95-gray: #c0c0c0;
    --win95-dark: #808080;
    --win95-darker: #404040;
    --win95-light: #dfdfdf;
    --win95-blue: #000080;
    --win95-cyan: #008080;
    --win95-black: #000000;
    --win95-white: #ffffff;
    --win95-red: #ff0000;
    --win95-green: #00ff00;
    --retro-green: #33ff33;
    --retro-amber: #ffb000;
    --crt-scan: rgba(0, 0, 0, 0.15);
    --fmv-brown: #4a3728;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #008080;
    font-family: 'VT323', monospace;
    cursor: crosshair;
}

/* =====================================================
   CRT OVERLAY EFFECTS
   ===================================================== */
#crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
}

.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        var(--crt-scan) 2px,
        var(--crt-scan) 4px
    );
    animation: scanline-flicker 0.1s infinite;
}

@keyframes scanline-flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.97; }
}

.crt-flicker {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(18, 16, 16, 0.02);
    animation: flicker 0.15s infinite;
}

@keyframes flicker {
    0% { opacity: 0.95; }
    50% { opacity: 1; }
    100% { opacity: 0.95; }
}

.vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 60%, rgba(0,0,0,0.4) 100%);
}

/* =====================================================
   BSOD / CRASH OVERLAY
   ===================================================== */
#bsod-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--win95-blue);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Lucida Console', monospace;
}

#bsod-overlay.hidden { display: none; }

.bsod-content {
    color: var(--win95-white);
    max-width: 600px;
    padding: 40px;
}

.bsod-header {
    background: var(--win95-gray);
    color: var(--win95-blue);
    padding: 4px 8px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: bold;
}

.bsod-text {
    font-size: 13px;
    line-height: 1.6;
}

.bsod-blink {
    animation: blink 1s step-end infinite;
}

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

/* =====================================================
   FAKE FMV CUTSCENE
   ===================================================== */
#fmv-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

#fmv-overlay.hidden { display: none; }

.fmv-container {
    position: relative;
    width: 640px;
    height: 480px;
    background: #000;
    border: 4px solid #333;
}

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

.fmv-subtitles {
    position: absolute;
    bottom: 40px;
    left: 0;
    right: 0;
    text-align: center;
    color: var(--win95-white);
    font-size: 18px;
    text-shadow: 2px 2px 0 #000;
    background: rgba(0,0,0,0.6);
    padding: 8px;
}

.fmv-skip {
    position: absolute;
    bottom: 8px;
    right: 8px;
    color: #888;
    font-size: 12px;
}

/* =====================================================
   BOOT SCREEN
   ===================================================== */
#boot-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--win95-black);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.boot-content {
    text-align: center;
}

.w95-logo {
    font-size: 48px;
    font-weight: bold;
    color: var(--win95-white);
    margin-bottom: 60px;
    font-family: 'Arial Black', sans-serif;
}

.w95-w { color: #ff0000; }
.w95-i { color: #00ff00; }
.w95-n { color: #0000ff; }
.w95-d { color: #ffff00; }
.w95-o { color: #ff00ff; }
.w95-w2 { color: #00ffff; }
.w95-s { color: #ff8800; }

.boot-progress {
    width: 300px;
    margin: 0 auto 40px;
}

.progress-bar {
    width: 100%;
    height: 20px;
    border: 2px inset var(--win95-gray);
    background: var(--win95-black);
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--win95-blue);
    transition: width 0.1s;
}

.boot-text {
    color: var(--win95-gray);
    font-size: 14px;
    font-family: 'Courier New', monospace;
}

.boot-copyright {
    color: #666;
    font-size: 11px;
    margin-top: 80px;
}

/* =====================================================
   GAME CONTAINER & DESKTOP
   ===================================================== */
#game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

#game-container.hidden { display: none; }

.desktop-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(0,128,128,0.03) 2px, rgba(0,128,128,0.03) 4px),
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,128,128,0.03) 2px, rgba(0,128,128,0.03) 4px),
        #008080;
}

/* Desktop icons */
.desktop-bg::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 20px;
    width: 64px;
    height: 64px;
    background: var(--win95-gray);
    border: 2px outset var(--win95-light);
    box-shadow: inset 1px 1px 0 var(--win95-white), inset -1px -1px 0 var(--win95-dark);
}

/* =====================================================
   WINDOWS 95 WINDOW STYLE
   ===================================================== */
.win95-window {
    position: absolute;
    background: var(--win95-gray);
    border: 2px outset var(--win95-light);
    box-shadow: 2px 2px 0 var(--win95-black);
    display: flex;
    flex-direction: column;
}

.win95-titlebar {
    background: linear-gradient(90deg, var(--win95-blue), #1084d0);
    color: var(--win95-white);
    padding: 2px 4px;
    display: flex;
    align-items: center;
    font-size: 13px;
    font-weight: bold;
    font-family: 'MS Sans Serif', sans-serif;
}

.win95-titlebar.inactive {
    background: linear-gradient(90deg, var(--win95-dark), #a0a0a0);
}

.win95-icon {
    margin-right: 4px;
    font-size: 14px;
}

.win95-title {
    flex: 1;
}

.win95-buttons {
    display: flex;
    gap: 2px;
}

.win95-btn {
    width: 16px;
    height: 14px;
    background: var(--win95-gray);
    border: 2px outset var(--win95-light);
    font-size: 9px;
    line-height: 10px;
    cursor: pointer;
    color: var(--win95-black);
    display: flex;
    align-items: center;
    justify-content: center;
}

.win95-btn:active {
    border: 2px inset var(--win95-dark);
}

.win95-menu {
    display: flex;
    gap: 16px;
    padding: 2px 8px;
    background: var(--win95-gray);
    border-bottom: 1px solid var(--win95-dark);
    font-size: 12px;
    font-family: 'MS Sans Serif', sans-serif;
}

.win95-menu span {
    cursor: pointer;
    padding: 2px 4px;
}

.win95-menu span:hover {
    background: var(--win95-blue);
    color: var(--win95-white);
}

.win95-content {
    flex: 1;
    background: #000;
    border: 2px inset var(--win95-dark);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.win95-statusbar {
    display: flex;
    gap: 16px;
    padding: 2px 8px;
    background: var(--win95-gray);
    border-top: 1px solid var(--win95-light);
    font-size: 12px;
    font-family: 'VT323', monospace;
}

.status-item {
    padding: 1px 6px;
    border: 1px inset var(--win95-dark);
    background: var(--win95-gray);
}

/* =====================================================
   GAME CANVAS
   ===================================================== */
#game-canvas {
    width: 640px;
    height: 480px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* =====================================================
   GAME WINDOW POSITIONING
   ===================================================== */
#game-window {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -55%);
    width: 680px;
    height: 560px;
}

/* =====================================================
   DIALOGUE BOX
   ===================================================== */
#dialogue-box {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    background: var(--win95-gray);
    border: 3px outset var(--win95-light);
    display: flex;
    padding: 8px;
    z-index: 500;
}

#dialogue-box.hidden { display: none; }

.dialogue-portrait {
    width: 80px;
    height: 80px;
    background: #000;
    border: 2px inset var(--win95-dark);
    margin-right: 12px;
    flex-shrink: 0;
}

.dialogue-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.dialogue-name {
    font-size: 16px;
    font-weight: bold;
    color: var(--win95-blue);
    margin-bottom: 4px;
    border-bottom: 1px solid var(--win95-dark);
    padding-bottom: 2px;
}

.dialogue-text {
    font-size: 16px;
    line-height: 1.4;
    color: var(--win95-black);
    min-height: 40px;
}

.dialogue-choices {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dialogue-choice {
    padding: 4px 8px;
    background: var(--win95-gray);
    border: 2px outset var(--win95-light);
    cursor: pointer;
    font-size: 14px;
}

.dialogue-choice:hover {
    background: var(--win95-blue);
    color: var(--win95-white);
}

.dialogue-hint {
    font-size: 11px;
    color: var(--win95-dark);
    margin-top: 4px;
    text-align: right;
}

/* =====================================================
   INVENTORY PANEL
   ===================================================== */
#inventory-panel {
    top: 20px;
    right: 20px;
    width: 200px;
    height: 300px;
    z-index: 400;
}

#inventory-panel.hidden { display: none; }

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 8px;
}

.inventory-slot {
    width: 50px;
    height: 50px;
    background: var(--win95-gray);
    border: 2px inset var(--win95-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
}

.inventory-slot:hover {
    border: 2px outset var(--win95-light);
}

.inventory-slot .item-count {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 10px;
    color: var(--win95-white);
    background: var(--win95-blue);
    padding: 0 2px;
}

/* =====================================================
   PAUSE MENU
   ===================================================== */
#pause-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    z-index: 8000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#pause-menu.hidden { display: none; }

.pause-content {
    background: var(--win95-gray);
    border: 3px outset var(--win95-light);
    padding: 24px;
    text-align: center;
    min-width: 300px;
}

.pause-content h2 {
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    color: var(--win95-red);
    margin-bottom: 20px;
}

.pause-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pause-options button {
    padding: 8px 16px;
    background: var(--win95-gray);
    border: 2px outset var(--win95-light);
    font-family: 'VT323', monospace;
    font-size: 18px;
    cursor: pointer;
}

.pause-options button:hover {
    background: var(--win95-blue);
    color: var(--win95-white);
}

.pause-tip {
    margin-top: 16px;
    font-size: 12px;
    color: var(--win95-dark);
    font-style: italic;
}

/* =====================================================
   MAIN MENU
   ===================================================== */
#main-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 7000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#main-menu.hidden { display: none; }

.menu-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 30% 50%, rgba(255,0,255,0.2) 0%, transparent 50%),
        radial-gradient(circle at 70% 30%, rgba(0,255,255,0.2) 0%, transparent 50%),
        radial-gradient(circle at 50% 80%, rgba(255,255,0,0.15) 0%, transparent 50%),
        linear-gradient(180deg, #1a0a2e 0%, #16213e 50%, #0f3460 100%);
    animation: menu-bg-shift 8s ease-in-out infinite;
}

@keyframes menu-bg-shift {
    0%, 100% { filter: hue-rotate(0deg); }
    50% { filter: hue-rotate(30deg); }
}

.menu-content {
    position: relative;
    text-align: center;
    z-index: 1;
}

.game-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 28px;
    line-height: 1.6;
    margin-bottom: 8px;
    text-shadow: 3px 3px 0 #000, -1px -1px 0 #f0f;
}

.title-mall { color: #ff0040; }
.title-cops { color: #00ff80; }
.title-from { color: #ffff00; font-size: 16px; }
.title-dim { color: #00ffff; font-size: 20px; display: block; }

.menu-subtitle {
    font-family: 'VT323', monospace;
    font-size: 16px;
    color: #aaa;
    margin-bottom: 4px;
}

.menu-version {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #ff6600;
    margin-bottom: 30px;
    background: #000;
    display: inline-block;
    padding: 2px 8px;
}

.menu-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.menu-btn {
    width: 280px;
    padding: 12px 20px;
    background: var(--win95-gray);
    border: 3px outset var(--win95-light);
    font-family: 'VT323', monospace;
    font-size: 22px;
    color: var(--win95-black);
    cursor: pointer;
    text-align: left;
    transition: transform 0.1s;
}

.menu-btn:hover {
    background: var(--win95-light);
    transform: translateX(4px);
}

.menu-btn:active {
    border: 3px inset var(--win95-dark);
}

.menu-footer {
    margin-top: 40px;
}

.fake-ad {
    font-size: 12px;
    color: #888;
    font-style: italic;
    animation: ad-flicker 3s infinite;
}

@keyframes ad-flicker {
    0%, 90%, 100% { opacity: 1; }
    95% { opacity: 0.3; }
}

.cheat-hint {
    margin-top: 8px;
    font-size: 10px;
    color: #444;
}

/* =====================================================
   TASKBAR
   ===================================================== */
#taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 28px;
    background: var(--win95-gray);
    border-top: 2px outset var(--win95-light);
    display: flex;
    align-items: center;
    padding: 0 2px;
    z-index: 6000;
    font-family: 'MS Sans Serif', sans-serif;
    font-size: 12px;
}

#taskbar.hidden { display: none; }

.start-btn {
    height: 22px;
    padding: 0 8px;
    background: var(--win95-gray);
    border: 2px outset var(--win95-light);
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.start-btn:active {
    border: 2px inset var(--win95-dark);
}

.taskbar-apps {
    flex: 1;
    display: flex;
    gap: 2px;
    margin: 0 4px;
}

.taskbar-app {
    padding: 2px 8px;
    background: var(--win95-gray);
    border: 2px outset var(--win95-light);
    font-size: 11px;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.taskbar-app.active {
    border: 2px inset var(--win95-dark);
    background: var(--win95-light);
}

.taskbar-time {
    padding: 2px 8px;
    border: 1px inset var(--win95-dark);
    font-size: 11px;
}

/* =====================================================
   FAKE ADVERTISEMENT WINDOWS
   ===================================================== */
#ad-windows {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 300;
}

.ad-window {
    position: absolute;
    width: 180px;
    background: var(--win95-gray);
    border: 2px outset var(--win95-light);
    pointer-events: auto;
    animation: ad-float 6s ease-in-out infinite;
}

@keyframes ad-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.ad-titlebar {
    background: var(--win95-blue);
    color: var(--win95-white);
    padding: 2px 4px;
    font-size: 11px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ad-content {
    padding: 8px;
    font-size: 11px;
    text-align: center;
}

.ad-content .ad-icon {
    font-size: 32px;
    margin-bottom: 4px;
}

.ad-content .ad-text {
    color: var(--win95-red);
    font-weight: bold;
    margin-bottom: 4px;
}

.ad-content .ad-btn {
    padding: 2px 8px;
    background: var(--win95-gray);
    border: 2px outset var(--win95-light);
    font-size: 11px;
    cursor: pointer;
}

/* =====================================================
   CHEAT NOTIFICATION
   ===================================================== */
#cheat-notification {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    border: 2px solid var(--win95-green);
    padding: 8px 16px;
    z-index: 9000;
    animation: cheat-pulse 0.5s ease-out;
}

#cheat-notification.hidden { display: none; }

.cheat-text {
    color: var(--win95-green);
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
}

@keyframes cheat-pulse {
    0% { transform: translateX(-50%) scale(2); opacity: 0; }
    50% { transform: translateX(-50%) scale(1.1); }
    100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* =====================================================
   GLITCH EFFECTS
   ===================================================== */
.glitch {
    animation: glitch 0.3s infinite;
}

@keyframes glitch {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

.corrupted {
    filter: hue-rotate(90deg) saturate(2);
    animation: corrupt 2s infinite;
}

@keyframes corrupt {
    0%, 100% { filter: hue-rotate(0deg); }
    25% { filter: hue-rotate(60deg) contrast(1.5); }
    50% { filter: hue-rotate(-30deg) brightness(1.2); }
    75% { filter: hue-rotate(120deg) saturate(3); }
}

/* =====================================================
   COMBO METER OVERLAY
   ===================================================== */
#combo-overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 200;
}

.combo-text {
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    color: #ff0040;
    text-shadow: 2px 2px 0 #000;
    animation: combo-pulse 0.5s ease-in-out;
}

@keyframes combo-pulse {
    0% { transform: scale(1.5); }
    100% { transform: scale(1); }
}

/* =====================================================
   DAMAGE NUMBER POPUP
   ===================================================== */
.damage-number {
    position: absolute;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    color: #ff0000;
    text-shadow: 1px 1px 0 #000;
    pointer-events: none;
    z-index: 150;
    animation: damage-float 1s ease-out forwards;
}

@keyframes damage-float {
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(-30px); opacity: 0; }
}

/* =====================================================
   MOBILE RESPONSIVE
   ===================================================== */
@media (max-width: 700px) {
    #game-window {
        width: 100vw;
        height: 100vh;
        top: 0;
        left: 0;
        transform: none;
    }

    #game-canvas {
        width: 100vw;
        height: 60vh;
    }

    .game-title {
        font-size: 16px;
    }

    .menu-btn {
        width: 220px;
        font-size: 16px;
    }
}

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

.pixel-font {
    font-family: 'Press Start 2P', cursive;
}

.mono-font {
    font-family: 'VT323', monospace;
}

/* Loading spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--win95-gray);
    border-top: 3px solid var(--win95-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}