* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
body {
    background: radial-gradient(circle at top, #0f172a, #020617 80%);
    overflow: hidden;
    font-family: Arial, sans-serif;
}
#game {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: relative;
    background: #020617;
}
#world {
    position: absolute;
    left: 0;
    top: 0;
    will-change: transform;
}
#map {
    display: grid;
    grid-template-columns: repeat(80, 50px);
    grid-auto-rows: 50px;
}

/* ---------- Tiles ---------- */
.tile {
    width: 50px;
    height: 50px;
}
.floor, .spawn {
    background: linear-gradient(135deg, #2a3650, #1a2438);
    border: 1px solid #3d4f6e;
    position: relative;
}
.wall {
    background: linear-gradient(180deg, #4b5563, #2b3445, #161d29);
    border: 2px solid #00bfff;
    box-shadow: inset 0 0 12px rgba(0, 255, 255, .25), 0 0 8px rgba(0, 255, 255, .2);
}    
.door {
    background: linear-gradient(90deg, #0ea5e9, #67e8f9, #0ea5e9);
    border: 2px solid white;
    box-shadow: 0 0 15px cyan;
    transition: opacity 0.2s ease, filter 0.2s ease;
}
.door.open {
    opacity: 0.25;
    filter: brightness(0.5);
    box-shadow: none;
}
.window {
    background: linear-gradient(180deg, rgba(0, 191, 255, 0.4), rgba(0, 255, 255, 0.1));
    border: 2px solid #67e8f9;
    box-shadow: inset 0 0 10px rgba(0, 255, 255, 0.5);
}
.terminal {
    background: #1e293b;
    border: 2px solid #10b981;
    box-shadow: 0 0 8px #10b981;
    position: relative;
}
.terminal::after {
    content: '';
    position: absolute;
    top: 20%; left: 20%; width: 60%; height: 30%;
    background: #059669;
    box-shadow: 0 0 4px #34d399;
}
.crate {
    background: #78350f;
    border: 2px solid #d97706;
    box-shadow: inset 0 0 8px #451a03;
}
.reactor {
    background: radial-gradient(circle, #a855f7 20%, #4c1d95 80%);
    border: 2px solid #c084fc;
    box-shadow: 0 0 20px #a855f7, inset 0 0 10px #c084fc;
    animation: pulse 1.5s infinite alternate;
}
.med-eq {
    background: #eff6ff;
    border: 2px solid #3b82f6;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
}
.lab-eq {
    background: #f0fdf4;
    border: 2px solid #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}
.deco {
    background: #334155;
    border: 1px solid #64748b;
}

@keyframes pulse {
    from { transform: scale(1); box-shadow: 0 0 15px #a855f7; }
    to { transform: scale(0.95); box-shadow: 0 0 25px #d8b4fe, 0 0 35px #a855f7; }
}

/* ---------- Player ---------- */
#player {
    position: absolute;
    width: 60px;
    height: 60px;
    z-index: 100;
    will-change: transform, left, top;
}
#player img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.walking img {
    animation: walk .15s infinite alternate;
}
@keyframes walk {
    from { margin-top: 0; }
    to { margin-top: -5px; }
}

/* ---------- CIRCULAR JOYSTICK ---------- */
#joystick-container {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 140px;
    height: 140px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none; /* Prevents mobile screen scrolling while playing */
}

#joystick-base {
    width: 120px;
    height: 120px;
    background: rgba(0, 255, 255, 0.05);
    border: 2px solid rgba(0, 255, 255, 0.4);
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.2), inset 0 0 10px rgba(0, 255, 255, 0.1);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#joystick-thumb {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #00ffff, #008b8b);
    border-radius: 50%;
    box-shadow: 0 0 15px #00ffff;
    position: absolute;
    transition: transform 0.05s linear; /* Smooth micro-movements */
    cursor: pointer;
}


/* ---------- INTERACTION ACTION BUTTON ---------- */
#action-container {
    position: fixed;
    bottom: 190px; /* Positions it perfectly right above your virtual joystick */
    left: 45px;
    z-index: 1000;
}

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

#btn-action {
    width: 110px;
    height: 50px;
    background: linear-gradient(135deg, #ff9f43, #ff6b6b);
    border: 2px solid #ffffff;
    color: white;
    font-size: 14px;
    font-family: monospace;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(255, 107, 107, 0.4);
    transition: transform 0.1s ease;
}

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

/* ---------- INVENTORY HUD ---------- */
#inventory-hud {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 160px;
    background: rgba(15, 23, 42, 0.8);
    border: 2px solid rgba(0, 255, 255, 0.3);
    border-radius: 8px;
    padding: 10px;
    font-family: monospace;
    color: #ffffff;
    z-index: 1000;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.1);
}

#inventory-hud h3 {
    margin: 0 0 8px 0;
    font-size: 12px;
    letter-spacing: 1px;
    color: #00ffff;
    text-align: center;
    border-bottom: 1px solid rgba(0, 255, 255, 0.2);
    padding-bottom: 4px;
}

#inventory-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 13px;
    max-height: 120px;
    overflow-y: auto;
}

.inventory-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 8px;
    margin-bottom: 4px;
    border-radius: 4px;
    border-left: 3px solid #ff9f43;
}

.empty-msg {
    color: #64748b;
    text-align: center;
    font-style: italic;
}



/* ---------- HUD ---------- */
#hud {
    position: fixed;
    top: 15px;
    left: 15px;
    color: cyan;
    font-size: 18px;
    text-shadow: 0 0 10px cyan;
    z-index: 999;
}

/* ---------- Room Name Banner ---------- */
#room-banner {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translate(-50%, -12px);
    z-index: 998;
    padding: 10px 28px;
    color: #e0fbff;
    font-size: 22px;
    font-weight: bold;
    letter-spacing: 1px;
    background: rgba(6, 20, 32, .55);
    border: 1px solid rgba(0, 255, 255, .5);
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 255, 255, .35), inset 0 0 12px rgba(0, 255, 255, .15);
    text-shadow: 0 0 8px cyan;
    opacity: 0;
    pointer-events: none;
    transition: opacity .5s ease, transform .5s ease;
    white-space: nowrap;
}
#room-banner.show {
    opacity: 1;
    transform: translate(-50%, 0);
}
#minimap {
    position: fixed;
    top: 15px;
    right: 15px;
    width: 120px;
    height: 120px;
    background: rgba(0, 0, 0, .6);
    border: 2px solid cyan;
    border-radius: 10px;
    overflow: hidden;
    z-index: 9999;
}
#minimapCanvas {
    width: 100%;
    height: 100%;
    display: block;
  }
#bagBtn{

position:fixed;

right:20px;

bottom:20px;

width:70px;

height:70px;

border:none;

border-radius:18px;

font-size:34px;

background:#222;

color:white;

cursor:pointer;

z-index:9999;

box-shadow:0 0 20px cyan;

}

#bagWindow{

position:fixed;

left:50%;

top:50%;

transform:translate(-50%,-50%);

width:420px;

max-width:92%;

background:#111;

border:3px solid cyan;

border-radius:20px;

display:none;

padding:20px;

z-index:10000;

}

.bagTitle{

text-align:center;

font-size:28px;

color:cyan;

margin-bottom:20px;

}

#bagGrid{

display:grid;

grid-template-columns:repeat(5,60px);

gap:12px;

justify-content:center;

}

.slot{

width:60px;

height:60px;

background:#333;

border:2px solid cyan;

border-radius:12px;

}

#closeBag{

margin-top:20px;

width:100%;

height:45px;

font-size:20px;

}
