@font-face {
    font-family: 'NeoDunggeunmo';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2001@1.3/NeoDunggeunmo.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

:root {
    --neon-red: #ff0055;
    --neon-yellow: #ffee00;
    --neon-blue: #00ffff;
    --neon-mint: #00ffaa;
    --bg-dark: #0a0a0a;
    --bg-overlay: rgba(0, 0, 0, 0.6);
    --hud-bg: rgba(0, 0, 0, 0.8);
    --font-head: 'NeoDunggeunmo', cursive;
    --font-body: 'NeoDunggeunmo', sans-serif;
}

* {
    box-sizing: border-box;
    user-select: none;
}

body {
    margin: 0;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: var(--font-body);
    color: #eee;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    /* Vignette & Background */
    box-shadow: inset 0 0 150px rgba(0, 0, 0, 0.9);
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)),
        url('bg_city.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Noise Overlay */
#game-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.04;
    pointer-events: none;
    z-index: 1000;
    mix-blend-mode: overlay;
}

/* Scanlines */
#game-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(0deg,
            transparent 0px,
            transparent 2px,
            rgba(0, 0, 0, 0.15) 2px,
            rgba(0, 0, 0, 0.15) 4px);
    pointer-events: none;
    z-index: 999;
    animation: scanlineFlicker 0.1s infinite;
}

@keyframes scanlineFlicker {

    0%,
    100% {
        opacity: 0.8;
    }

    50% {
        opacity: 0.9;
    }
}

/* Glitch Text Effect */
.glitch-text {
    position: relative;
    animation: glitchText 3s infinite;
}



/* Ending Screen */
.ending-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2500;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    transition: opacity 2s ease-in;
}

.ending-screen.bad-end {
    background: #000;
    color: #666;
}

.ending-screen.true-end {
    background: url('ending_true_background.png') no-repeat center center;
    background-size: cover;
    color: #fff;
    text-shadow: 0 0 10px #000, 0 0 20px #ff0055;
}

.ending-title {
    font-size: 4em;
    margin-bottom: 20px;
    font-family: 'DungGeunMo', sans-serif;
}

.ending-message {
    font-size: 1.5em;
    margin-bottom: 40px;
    font-family: 'DungGeunMo', sans-serif;
    line-height: 1.6;
}

@keyframes glitchText {

    0%,
    90%,
    100% {
        transform: translateX(0);
        text-shadow: none;
    }

    92% {
        transform: translateX(-2px);
        text-shadow: 2px 0 #ff0055, -2px 0 #00ffff;
    }

    94% {
        transform: translateX(2px);
        text-shadow: -2px 0 #ff0055, 2px 0 #00ffff;
    }

    96% {
        transform: translateX(-1px);
        text-shadow: 1px 0 #ff0055, -1px 0 #00ffff;
    }

    98% {
        transform: translateX(1px);
        text-shadow: -1px 0 #ff0055, 1px 0 #00ffff;
    }
}

/* --- 1. Background Grid (Pseudo 3D) --- */
.perspective-grid {
    position: absolute;
    width: 200%;
    height: 200%;
    left: -50%;
    top: -50%;
    transform: perspective(600px) rotateX(60deg);
    z-index: 0;
    pointer-events: none;
}

.floor {
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(0, 255, 204, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 204, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: moveGrid 2s linear infinite;
}

.horizon-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(to bottom, var(--bg-dark), transparent);
}

@keyframes moveGrid {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(50px);
    }
}

/* --- 2. Top HUD --- */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
}

#top-bar {
    display: flex;
    justify-content: space-between;
    padding: 20px 40px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent);
    font-family: var(--font-head);
    text-transform: uppercase;
}

.stat-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-group.left {
    width: 200px;
    align-items: flex-start;
}

.stat-group.center {
    width: 250px;
    align-items: center;
}

.stat-group.right {
    width: 200px;
    align-items: flex-end;
}

.level-group {
    width: 150px !important;
}

.sub-label {
    font-size: 0.9rem;
    color: #aaa;
    margin-top: 5px;
    letter-spacing: 1px;
}

.label {
    font-size: 1.2rem;
    letter-spacing: 2px;
}

.bar-container {
    width: 100%;
    height: 15px;
    background: #222;
    border: 1px solid #444;
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    transition: width 0.3s;
}

#approval-bar {
    background: var(--neon-mint);
    box-shadow: 0 0 10px var(--neon-mint);
}

.rent-frame {
    border-color: #500;
}

.rent-fill {
    background: var(--neon-red);
    box-shadow: 0 0 10px var(--neon-red);
}

.rent-text {
    position: absolute;
    right: 5px;
    top: -20px;
    color: #f55;
    font-size: 0.9rem;
}

.money-display {
    font-size: 2.5rem;
    color: var(--neon-yellow);
    text-shadow: 0 0 15px var(--neon-yellow);
    white-space: nowrap;
}

#news-ticker-container {
    width: 100%;
    height: 30px;
    background: rgba(0, 0, 0, 0.8);
    border-top: 1px solid var(--neon-mint);
    border-bottom: 1px solid var(--neon-mint);
    overflow: hidden;
    position: relative;
    margin-top: -10px;
}

#news-text {
    position: absolute;
    width: 100%;
    line-height: 28px;
    color: var(--neon-mint);
    font-weight: bold;
    white-space: nowrap;
    animation: scrollNews 20s linear infinite;
    padding-left: 100vw;
}

@keyframes scrollNews {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%) translateX(-100vw);
    }
}

/* --- 3. Stage & Lanes Layout --- */
#stage-3d {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    perspective: 600px;
    pointer-events: none;
    /* Let clicks pass through */
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lanes-container {
    position: relative;
    width: 800px;
    height: 100vh;
    display: flex;
    justify-content: center;
    transform-style: preserve-3d;
    transform: rotateX(20deg) translateY(50px);
}

.lane {
    position: relative;
    width: 33.33%;
    height: 2000px;
    margin: 0 15px;
    /* Spacing for rails */
    transform-style: preserve-3d;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 300px;
}

/* Static 3D Side Rails (Metal Frame) */
.lane::before,
.lane::after {
    content: '';
    position: absolute;
    top: -500px;
    width: 25px;
    height: 300%;
    background: linear-gradient(90deg, #111, #444, #111);
    border: 1px solid #000;
    transform-origin: center;
    transform: rotateX(70deg) translateZ(-90px);
    /* Slightly above floor (-100px) */
    z-index: 5;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
}

.lane::before {
    left: 0;
    border-right: 2px solid #666;
}

.lane::after {
    right: 0;
    border-left: 2px solid #666;
}

/* Lane Floors (Moving Belt) */
.lane-floor {
    position: absolute;
    top: -500px;
    left: 25px;
    /* Inside rails */
    right: 25px;
    /* Inside rails */
    width: auto;
    height: 300%;
    transform: rotateX(70deg) translateZ(-100px);
    z-index: 1;
    box-shadow: inset 0 0 20px #000;
    /* Deep shadow inside rails */
}

/* Lane Specific Treads */

/* Hell: Dark Industrial + Lava/Fire Glow */
/* Hell: Dark Industrial + Lava/Fire Glow */
/* Hell: Dark Industrial + Lava/Fire Glow */
.lane-hell {
    background-image: url('lane_hell.png');
    background-size: auto 50%;
    background-position: center 0;
    background-repeat: repeat-y;
    box-shadow: inset 0 0 50px #300;
    animation: scrollLaneBgHell 60s linear infinite;
}

@keyframes scrollLaneBgHell {
    from {
        background-position: center 0;
    }

    to {
        background-position: center -100%;
    }
}



.lane-hell .lane-floor {
    background:
        repeating-linear-gradient(0deg,
            rgba(10, 0, 0, 0.9) 0px,
            rgba(10, 0, 0, 0.9) 40px,
            /* Gap (Dark) */
            rgba(100, 0, 0, 0.6) 40px,
            /* Plate Start */
            rgba(170, 0, 0, 0.6) 42px,
            /* Highlight */
            rgba(70, 0, 0, 0.6) 78px,
            /* Plate Body */
            rgba(30, 0, 0, 0.8) 80px
            /* Shadow */
        ),
        url('lane_hell.png');
    background-size: 100% 80px, 100% 200px;
    background-repeat: repeat-y;
    animation: scrollLaneHell 0.8s linear infinite;
    /* Fast */
    border-left: 2px solid #f00;
    border-right: 2px solid #f00;
}

.lane-hell::before,
.lane-hell::after {
    border-color: #500;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.2);
}

@keyframes scrollLaneHell {
    from {
        background-position: 0 0, 0 0;
    }

    to {
        background-position: 0 -80px, 0 -200px;
    }
}

/* Recycle: Hazard Yellow/Black Stripes */
.lane-recycle {
    background-image: url('lane_recycle.png');
    background-size: auto 50%;
    background-position: center 0;
    background-repeat: repeat-y;
    box-shadow: inset 0 0 50px #330;
    animation: scrollLaneBgRecycle 70s linear infinite;
}

@keyframes scrollLaneBgRecycle {
    from {
        background-position: center 0;
    }

    to {
        background-position: center -100%;
    }
}


.lane-recycle .lane-floor {
    background:
        repeating-linear-gradient(0deg,
            rgba(17, 17, 17, 0.9) 0px,
            rgba(17, 17, 17, 0.9) 40px,
            /* Gap */
            rgba(100, 85, 0, 0.6) 40px,
            /* Plate Start */
            rgba(170, 170, 0, 0.6) 42px,
            /* Highlight */
            rgba(70, 70, 0, 0.6) 78px,
            /* Plate Body */
            rgba(34, 34, 0, 0.8) 80px
            /* Shadow */
        ),
        url('lane_recycle.png');
    background-size: 100% 80px, 100% 200px;
    background-repeat: repeat-y;
    animation: scrollLaneRecycle 1.2s linear infinite;
    /* Medium */
    border-left: 2px solid #aa0;
    border-right: 2px solid #aa0;
}

.lane-recycle::before,
.lane-recycle::after {
    border-color: #550;
    box-shadow: 0 0 15px rgba(255, 255, 0, 0.2);
}

@keyframes scrollLaneRecycle {
    from {
        background-position: 0 0, 0 0;
    }

    to {
        background-position: 0 -80px, 0 -200px;
    }
}

/* Heaven: Clean High-Tech Blue Panels */
.lane-heaven {
    background-image: url('lane_heaven.png');
    background-size: auto 50%;
    background-position: center 0;
    background-repeat: repeat-y;
    box-shadow: inset 0 0 50px #035;
    animation: scrollLaneBgHeaven 80s linear infinite;
}

@keyframes scrollLaneBgHeaven {
    from {
        background-position: center 0;
    }

    to {
        background-position: center -100%;
    }
}



.lane-heaven .lane-floor {
    background:
        repeating-linear-gradient(0deg,
            rgba(0, 0, 17, 0.9) 0px,
            rgba(0, 0, 17, 0.9) 40px,
            /* Gap */
            rgba(0, 70, 85, 0.6) 40px,
            /* Plate Start */
            rgba(0, 136, 170, 0.6) 42px,
            /* Highlight */
            rgba(0, 50, 70, 0.6) 78px,
            /* Plate Body */
            rgba(0, 17, 34, 0.8) 80px
            /* Shadow */
        ),
        url('lane_heaven.png');
    background-size: 100% 80px, 100% 200px;
    background-repeat: repeat-y;
    animation: scrollLaneHeaven 1.5s linear infinite;
    /* Smooth */
    border-left: 2px solid #0ff;
    border-right: 2px solid #0ff;
}

.lane-heaven::before,
.lane-heaven::after {
    border-color: #055;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.2);
}

@keyframes scrollLaneHeaven {
    from {
        background-position: 0 0, 0 0;
    }

    to {
        background-position: 0 -80px, 0 -200px;
    }
}

/* --- 4. Gates --- */
.gate-neon {
    width: 80%;
    margin-top: -50px;
    border: 4px solid white;
    border-radius: 10px;
    text-align: center;
    line-height: 90px;
    font-family: var(--font-head);
    font-size: 2rem;
    font-weight: bold;
    background: rgba(0, 0, 0, 0.8);
    z-index: 5;
    transform: translateZ(20px);
    box-shadow: 0 0 20px currentColor, inset 0 0 20px currentColor;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.gate-neon.red,
.gate-neon.yellow,
.gate-neon.blue {
    height: 140px;
    margin-top: -180px;
    padding-top: 10px;
    line-height: normal;
}

.gate-neon.red {
    color: var(--neon-red);
    border-color: var(--neon-red);
}

.gate-neon.yellow {
    color: var(--neon-yellow);
    border-color: var(--neon-yellow);
}

.gate-neon.blue {
    color: var(--neon-blue);
    border-color: var(--neon-blue);
}

.gate-visuals,
.gate-visuals-recycle,
.gate-visuals-hell {
    position: relative;
    width: 100%;
    height: 100px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    image-rendering: pixelated;
    margin-bottom: 5px;
}

.gate-visuals {
    background-image: url('gate_heaven.png');
    filter: drop-shadow(0 0 5px var(--neon-blue));
}

.gate-visuals-recycle {
    background-image: url('gate_recycle.png');
    filter: drop-shadow(0 0 5px var(--neon-yellow));
}

.gate-visuals-hell {
    background-image: url('gate_hell.png');
    filter: drop-shadow(0 0 5px var(--neon-red));
}

.gate-label {
    font-size: 1.2rem;
    color: white;
    text-shadow: 0 0 5px currentColor;
}

.gate-wings,
.gate-vortex {
    display: none;
}

/* --- 5. Soul Cards --- */
#soul-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    transform-style: preserve-3d;
}

.soul-card {
    position: absolute;
    width: 210px;
    height: 300px;
    background: #1a051a;
    border: 3px solid #ff0055;
    border-radius: 12px;
    box-shadow: 0 0 12px rgba(255, 0, 85, 0.5), inset 0 0 15px rgba(255, 0, 85, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    left: 50%;
    transform: translateX(-50%) translateZ(0);
    transition: transform 0.2s;
    padding: 8px;
    gap: 8px;
}

.soul-card.active-target {
    border-color: #ff0055;
    box-shadow: 0 0 15px #ff0055, 0 0 30px rgba(255, 0, 85, 0.6);
    z-index: 100;
    animation: pulseBorder 1s infinite alternate;
}

@keyframes pulseBorder {
    from {
        box-shadow: 0 0 10px #ff0055;
    }

    to {
        box-shadow: 0 0 20px #ff0055, 0 0 40px rgba(255, 0, 85, 0.8);
    }
}

.soul-card-header {
    width: 100%;
    height: 24px;
    background: transparent;
    color: #ccc;
    font-family: var(--font-body);
    font-size: 0.8rem;
    text-align: left;
    padding-left: 4px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
}

.soul-img-container {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #000;
    border: 2px solid #505;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 0 15px #200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.soul-img {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center 20%;
    image-rendering: pixelated;
}

.soul-card-footer {
    width: 100%;
    height: 24px;
    background: #300a20;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #702040;
}

.soul-name {
    font-family: var(--font-head);
    font-size: 0.8rem;
    color: #ff5588;
    text-transform: uppercase;
    text-shadow: 0 0 3px #ff0055;
}

.fly-hell {
    animation: flyHell 0.4s forwards ease-in;
}

.fly-recycle {
    animation: flyRecycle 0.4s forwards ease-in;
}

.fly-heaven {
    animation: flyHeaven 0.4s forwards ease-in;
}

@keyframes flyHell {
    to {
        transform: translateX(-35vw) translateY(-200px) scale(0.5) rotate(-45deg);
        opacity: 0;
    }
}

@keyframes flyRecycle {
    to {
        transform: translateX(-50%) translateY(-300px) scale(0) rotate(180deg);
        opacity: 0;
    }
}

@keyframes flyHeaven {
    to {
        transform: translateX(35vw) translateY(-200px) scale(0.5) rotate(45deg);
        opacity: 0;
    }
}

/* --- 6. Scanner & Controls --- */
#bottom-scanner {
    position: absolute;
    bottom: 20px;
    width: 100%;
    display: flex;
    justify-content: center;
    z-index: 150;
    pointer-events: none;
}

.scanner-hologram {
    width: 500px;
    /* Reduced from 600px */
    background: rgba(0, 10, 20, 0.95);
    border: 4px solid var(--neon-blue);
    border-radius: 20px;
    padding: 15px;
    /* Reduced padding */
    box-shadow: 0 0 20px var(--neon-blue), inset 0 0 30px rgba(0, 255, 255, 0.2);
    text-align: left;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.scan-header {
    display: none;
}

.scan-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    /* Reduced from 8px */
    margin-bottom: 12px;
    width: 100%;
    padding-left: 15px;
}

#scan-name {
    font-family: var(--font-body);
    font-size: 1.4rem;
    /* Scaled 75% from 1.8rem */
    color: white;
    text-shadow: none;
    display: flex;
    align-items: center;
}

#scan-name::before {
    content: 'NAME: ';
    color: var(--neon-blue);
    margin-right: 8px;
    font-weight: bold;
    text-shadow: 0 0 5px var(--neon-blue);
}

#scan-info {
    color: white;
    font-size: 1.1rem;
    /* Scaled 75% from 1.4rem */
    display: flex;
    align-items: center;
}

#scan-info::before {
    content: 'INFO: ';
    color: var(--neon-red);
    margin-right: 12px;
    font-weight: bold;
    text-shadow: 0 0 5px var(--neon-red);
}

#scan-dialogue {
    color: #eee;
    font-style: normal;
    font-size: 1.2rem;
    /* Scaled 75% from 1.6rem */
    margin-top: 10px;
    text-align: center;
    border-top: 1px dashed #333;
    padding-top: 8px;
}

.controls-guide {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
}

.key-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0.8;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
}

.key-item:hover {
    opacity: 1;
    transform: scale(1.1);
}

.key-item:active {
    transform: scale(0.95);
}

.key {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 45px;
    /* Scaled 75% from 60px */
    height: 45px;
    border: 3px solid white;
    border-radius: 6px;
    font-weight: bold;
    font-size: 1.8rem;
    /* Scaled 75% from 2.5rem */
    background: rgba(0, 0, 0, 0.5);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5), 0 0 10px currentColor;
    color: white;
    text-shadow: 1px 1px 0 black;
}

.key-item.left .key {
    border-color: var(--neon-red);
    color: var(--neon-red);
    box-shadow: 0 0 15px var(--neon-red), inset 0 0 10px var(--neon-red);
}

.key-item.down .key {
    border-color: var(--neon-yellow);
    color: var(--neon-yellow);
    box-shadow: 0 0 15px var(--neon-yellow), inset 0 0 10px var(--neon-yellow);
}

.key-item.right .key {
    border-color: var(--neon-blue);
    color: var(--neon-blue);
    box-shadow: 0 0 15px var(--neon-blue), inset 0 0 10px var(--neon-blue);
}

.action {
    display: block;
    margin-top: 8px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: bold;
    text-shadow: 0 0 5px black;
    letter-spacing: 1px;
}

/* --- 7. Modals --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
}

#start-screen {
    background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)), url('bg_tutorial.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    image-rendering: pixelated;
}

.modal-content {
    background: rgba(17, 17, 17, 0.95);
    border: 2px solid #333;
    padding: 40px;
    text-align: center;
    border-radius: 20px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    max-width: 600px;
}

.game-title-img {
    width: 100%;
    max-width: 500px;
    height: auto;
    margin-bottom: 20px;
    image-rendering: pixelated;
}

.populist {
    color: var(--neon-mint);
    text-shadow: 0 0 15px var(--neon-mint);
}

.subtitle {
    color: #888;
    margin-bottom: 30px;
    letter-spacing: 2px;
}

.ending-title {
    font-size: 3rem;
    margin-bottom: 20px;
    animation: glitch 1s infinite alternate;
}

.bad-end .ending-title {
    color: var(--neon-red);
    text-shadow: 4px 4px 0px #000;
}

.true-end .ending-title {
    color: #fff;
    text-shadow: 0 0 20px var(--neon-blue), 0 0 40px var(--neon-blue);
}

.ending-message {
    font-size: 1.2rem;
    line-height: 1.6;
    margin-bottom: 40px;
    color: #ccc;
}

.instruction-box {
    background: #222;
    padding: 20px;
    border-radius: 10px;
    text-align: left;
    margin-bottom: 30px;
    color: #ccc;
    font-size: 0.9rem;
    line-height: 1.8;
}

.key-mini {
    display: inline-block;
    border: 1px solid #fff;
    border-radius: 3px;
    padding: 0 5px;
    font-weight: bold;
    color: #fff;
    margin-right: 5px;
}

.btn-primary {
    background: url('ui_btn_start.png') no-repeat center;
    background-size: 100% 100%;
    color: var(--neon-blue);
    border: none;
    padding: 20px 60px;
    font-size: 1.8rem;
    font-family: var(--font-head);
    cursor: pointer;
    border-radius: 0;
    box-shadow: none;
    text-shadow: 0 0 10px var(--neon-blue);
    transition: transform 0.2s, filter 0.2s;
    image-rendering: pixelated;
    min-width: 300px;
    height: 80px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary:hover {
    transform: scale(1.05);
    filter: brightness(1.2);
    color: white;
    text-shadow: 0 0 20px white;
}

.feedback-text {
    position: absolute;
    font-family: var(--font-head);
    font-size: 1.5rem;
    font-weight: bold;
    text-shadow: 0 0 5px black;
    pointer-events: none;
    z-index: 200;
    animation: floatUpFade 1s forwards;
    white-space: nowrap;
}

@keyframes floatUpFade {
    0% {
        transform: translate(-50%, 0) scale(0.8);
        opacity: 0;
    }

    20% {
        opacity: 1;
        transform: translate(-50%, -20px) scale(1.1);
    }

    100% {
        transform: translate(-50%, -80px) scale(1);
        opacity: 0;
    }
}

/* =============================================== */
/* --- MOBILE RESPONSIVE (iPhone 12: 390px) --- */
/* =============================================== */
@media screen and (max-width: 480px) {
    #top-bar {
        padding: 10px 15px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .stat-group.left,
    .stat-group.center,
    .stat-group.right {
        width: auto;
        flex: 1;
        min-width: 80px;
    }

    .stat-group.center {
        order: -1;
        width: 100%;
        flex: none;
        margin-bottom: 5px;
    }

    .label {
        font-size: 0.7rem;
        letter-spacing: 1px;
    }

    .sub-label {
        font-size: 0.6rem;
    }

    .money-display {
        font-size: 1.4rem;
    }

    .bar-container {
        height: 10px;
    }

    .rent-text {
        font-size: 0.7rem;
        top: -16px;
    }

    #news-ticker-container {
        height: 22px;
    }

    #news-text {
        font-size: 0.8rem;
        line-height: 20px;
    }

    .scanner-hologram {
        width: 95%;
        max-width: 360px;
        padding: 10px;
    }

    .scan-content {
        gap: 4px;
        margin-bottom: 8px;
        padding-left: 10px;
    }

    #scan-name {
        font-size: 1rem;
    }

    #scan-info {
        font-size: 0.85rem;
    }

    #scan-dialogue {
        font-size: 0.9rem;
        margin-top: 6px;
    }

    .controls-guide {
        gap: 12px;
        margin-top: 8px;
    }

    .key {
        width: 38px;
        height: 38px;
        font-size: 1.4rem;
        border-width: 2px;
    }

    .action {
        font-size: 0.65rem;
        margin-top: 4px;
    }

    .soul-card {
        width: 160px;
        height: 230px;
        padding: 6px;
        gap: 5px;
    }

    .soul-card-header {
        font-size: 0.65rem;
        height: 18px;
    }

    .soul-card-footer {
        height: 20px;
    }

    .soul-name {
        font-size: 0.7rem;
    }

    .gate-neon {
        font-size: 1.2rem;
    }

    .gate-neon.red,
    .gate-neon.yellow,
    .gate-neon.blue {
        height: 100px;
        margin-top: -200px;
    }

    .gate-visuals,
    .gate-visuals-recycle,
    .gate-visuals-hell {
        height: 70px;
    }

    .gate-label {
        font-size: 0.9rem;
    }

    .feedback-text {
        font-size: 1.1rem;
    }

    .lanes-container {
        width: 100%;
    }

    .lane {
        margin: 0 5px;
    }
}

/* --- Tutorial Overlay --- */
.tutorial-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    pointer-events: auto;
    /* Block interaction with game */
    display: none;
    /* Hidden by default */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tutorial-overlay.active {
    display: block;
    opacity: 1;
}

/* Highlight Box (Spotlight effect) */
.tutorial-highlight {
    position: absolute;
    border: 3px solid var(--neon-mint);
    box-shadow: 0 0 15px var(--neon-mint), inset 0 0 15px var(--neon-mint);
    border-radius: 8px;
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    pointer-events: none;
    /* Let clicks pass through if needed, though overlay blocks generally */
    z-index: 2001;
    background: transparent;
}

/* Tutorial Dialog */
.tutorial-dialog {
    position: absolute;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 600px;
    background: rgba(10, 20, 30, 0.95);
    border: 2px solid var(--neon-mint);
    padding: 20px;
    border-radius: 10px;
    color: #fff;
    font-family: 'DungGeunMo', sans-serif;
    z-index: 2002;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    text-align: center;
}

#tutorial-text {
    font-size: 1.2rem;
    margin-bottom: 20px;
    line-height: 1.6;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.tutorial-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.btn-secondary {
    background: rgba(60, 60, 60, 0.8);
    color: #ccc;
    border: 1px solid #666;
    padding: 10px 20px;
    font-size: 1rem;
    font-family: var(--font-head);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(80, 80, 80, 0.9);
    border-color: #999;
    color: #fff;
}

@media (max-width: 600px) {
    .tutorial-dialog {
        width: 90%;
        bottom: 15%;
    }
}

/* --- Synopsis Neural Link Style --- */
.synopsis-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 3000;
    display: none;
    opacity: 0;
    transition: opacity 1s ease;
}

.synopsis-overlay.active {
    display: flex;
    opacity: 1;
}

.synopsis-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 1.2s ease-in-out;
    filter: grayscale(20%) contrast(1.1);
}

.synopsis-bg.visible {
    opacity: 0.7;
}

.synopsis-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40%;
    background: linear-gradient(to top, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.85) 70%, transparent 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    z-index: 3001;
}

.synopsis-text {
    font-family: var(--font-body);
    font-size: 1.3rem;
    color: #eee;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
    max-width: 700px;
    text-align: center;
    line-height: 2;
    min-height: 80px;
    white-space: pre-wrap;
}

.synopsis-controls {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.synopsis-indicator {
    font-size: 1.5rem;
    color: var(--neon-mint);
    animation: synopsisBlink 1s infinite;
    cursor: pointer;
}

.btn-text {
    background: none;
    border: none;
    color: #555;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: var(--font-head);
    transition: color 0.3s;
    letter-spacing: 2px;
}

.btn-text:hover {
    color: #fff;
}

@keyframes synopsisBlink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.2;
    }
}

.synopsis-hint {
    font-size: 0.8rem;
    color: #888;
    margin-top: 5px;
    margin-bottom: 5px;
    letter-spacing: 1px;
    animation: synopsisBlink 2s infinite;
}

/* --- New Instruction Grid --- */
.instruction-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: rgba(0, 0, 0, 0.6);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #444;
    margin-bottom: 30px;
    width: 100%;
    max-width: 500px;
    text-align: left;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.instruction-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.instruction-icon {
    width: 50px;
    height: 50px;
    border: 2px solid white;
    border-radius: 8px;
    background: #000;
    image-rendering: pixelated;
    flex-shrink: 0;
}

.instruction-text {
    flex: 1;
}

.instruction-title {
    font-family: var(--font-head);
    font-size: 1.1rem;
    color: var(--neon-mint);
    margin-bottom: 4px;
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
}

.instruction-desc {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: #ccc;
    line-height: 1.4;
    word-break: keep-all;
}

/* Specific Border Colors for Icons */
.instruction-item:nth-child(1) .instruction-icon {
    border-color: var(--neon-blue);
    box-shadow: 0 0 10px var(--neon-blue);
}

.instruction-item:nth-child(2) .instruction-icon {
    border-color: var(--neon-yellow);
    box-shadow: 0 0 10px var(--neon-yellow);
}

.instruction-item:nth-child(3) .instruction-icon {
    border-color: var(--neon-red);
    box-shadow: 0 0 10px var(--neon-red);
}

/* Specific Title Colors */
.instruction-item:nth-child(1) .instruction-title {
    color: var(--neon-blue);
}

.instruction-item:nth-child(2) .instruction-title {
    color: var(--neon-yellow);
}

.instruction-item:nth-child(3) .instruction-title {
    color: var(--neon-red);
}