body {
    margin: 0;
    overflow: hidden;
    background: radial-gradient(circle at 20% 20%, #172030, #07090f 60%);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    user-select: none;
}

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

.crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    pointer-events: none;
    z-index: 10;
}

.crosshair::before,
.crosshair::after {
    content: '';
    position: absolute;
    background: rgba(196, 222, 255, 0.95);
    box-shadow: 0 0 8px rgba(112, 180, 255, 0.75);
}

.crosshair::before {
    width: 14px;
    height: 2px;
    top: 6px;
    left: 0;
}

.crosshair::after {
    width: 2px;
    height: 14px;
    left: 6px;
    top: 0;
}

#hud {
    position: fixed !important;
    left: 16px !important;
    bottom: 16px !important;
    top: auto !important;
    right: auto !important;
    z-index: 30;
}

.hud-panel {
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border-radius: 14px;
    background: rgba(16, 20, 30, 0.7);
    border: 1px solid rgba(140, 170, 220, 0.26);
    backdrop-filter: blur(8px);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
}

.progress-bar-bg {
    background: linear-gradient(180deg, rgba(11, 18, 28, 0.94), rgba(7, 12, 19, 0.94));
    border: 1px solid rgba(122, 165, 226, 0.26);
}

.hud-row {
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 10px;
    padding: 7px 9px;
    min-height: 38px;
}

.hud-icon {
    width: 20px;
    text-align: center;
    font-size: 14px;
    opacity: 0.95;
}

.hud-meter-bg {
    flex: 1;
    position: relative;
    border-radius: 7px;
    border: 1px solid rgba(92, 117, 151, 0.4);
    height: 12px;
    background: #161f2c;
    overflow: hidden;
}

.hud-meter-fill {
    height: 100%;
    width: 100%;
    transition: width 0.25s ease;
}

.hud-hp {
    background: linear-gradient(90deg, #8a1f2e, #e14b60);
}

.hud-hunger {
    background: linear-gradient(90deg, #7d470f, #f29d2a);
}

.hud-thirst {
    background: linear-gradient(90deg, #144372, #3eb5ff);
}

.hud-meter-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    color: #f2f8ff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.hud-money-row {
    border-color: rgba(82, 167, 118, 0.45);
}

.hud-money {
    margin-left: 2px;
    font-size: 1rem;
    font-weight: 800;
    color: #7dffaf;
    letter-spacing: 0.02em;
}

#interaction-prompt {
    background: rgba(8, 13, 20, 0.88);
    border: 1px solid rgba(118, 175, 255, 0.45);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45), 0 0 20px rgba(55, 135, 255, 0.2);
}

#notification-area {
    position: fixed !important;
    right: 16px;
    bottom: 96px;
    left: auto !important;
    transform: none !important;
    z-index: 35;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    max-width: 360px;
}

#notification-area > div {
    min-width: 240px;
    border-radius: 10px;
    border: 1px solid rgba(104, 130, 170, 0.4) !important;
    background: linear-gradient(180deg, rgba(40, 47, 63, 0.96), rgba(31, 37, 52, 0.96)) !important;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

/* REDESIGN INVENTORY GRID & SLOTS */
.inv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
    padding: 4px;
}

.inv-slot {
    background: rgba(20, 25, 35, 0.6);
    border: 1px solid rgba(60, 80, 110, 0.4);
    border-radius: 12px;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s ease-out;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.5);
    overflow: hidden;
}

.inv-slot:hover {
    background: rgba(30, 45, 65, 0.8);
    border-color: rgba(100, 180, 255, 0.7);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.5), inset 0 0 20px rgba(100,180,255,0.1);
}

.inv-count {
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 0.8rem;
    color: #fff;
    background: rgba(0,0,0,0.6);
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: bold;
    z-index: 2;
}

.inv-weight-label {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 0.65rem;
    color: #88aadd;
    z-index: 2;
}

.inv-icon {
    font-size: 3rem;
    margin-top: 15px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5));
    transition: transform 0.2s;
}

.inv-slot:hover .inv-icon {
    transform: scale(1.1);
}

.inv-name {
    font-size: 0.7rem;
    color: #cceeff;
    margin-top: auto;
    padding: 10px 4px 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    width: 100%;
    background: linear-gradient(0deg, rgba(0,0,0,0.8) 0%, transparent 100%);
    z-index: 2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inv-use-btn {
    position: absolute;
    inset: 0;
    background: rgba(10, 20, 30, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    color: #4ade80;
    font-weight: 900;
    font-size: 1.1rem;
    letter-spacing: 2px;
    cursor: pointer;
    z-index: 10;
    backdrop-filter: blur(2px);
}

.inv-slot:hover .inv-use-btn {
    opacity: 1;
}

.inv-use-btn:hover {
    background: rgba(20, 45, 30, 0.95);
    color: #86efac;
}

/* CUSTOM SCROLLBAR FOR INVENTORY */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(80, 100, 130, 0.5);
    border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 130, 180, 0.8);
}


/* LOOT PANEL REFINEMENTS */
.loot-panel {
    width: min(96vw, 980px);
    background: rgba(10, 15, 24, 0.95);
    border: 1px solid rgba(80, 120, 180, 0.4);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.9);
    padding: 20px;
    backdrop-filter: blur(10px);
}

.loot-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(80, 120, 180, 0.2);
}

.loot-title {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: #fff;
}

.loot-subtitle {
    font-size: 0.85rem;
    color: #8ba8d4;
}

.loot-close-btn {
    background: #6d1f28;
    color: #fff;
    border: 1px solid #a33945;
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.loot-close-btn:hover {
    background: #8a2935;
}

.loot-search-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.loot-tile {
    border: 1px solid #3b4860;
    border-radius: 8px;
    min-height: 44px;
    font-weight: 700;
    cursor: pointer;
    color: #dbe6f9;
    transition: all 0.2s;
}

.loot-tile:hover:not(.loot-tile-hidden) {
    transform: scale(1.05);
}

.loot-tile-hidden {
    background: linear-gradient(180deg, #15181e, #0a0b0e);
    color: #555;
}

.loot-tile-hidden:hover {
    background: #1c222e;
    color: #888;
}

.loot-tile-empty {
    background: #1a202c;
    color: #7d8ba4;
}

.loot-tile-item {
    background: #253045;
    color: #e6f0ff;
    box-shadow: inset 0 0 10px rgba(100,150,255,0.2);
}

.loot-tile-money {
    background: #27402a;
    color: #d3f6c7;
    box-shadow: inset 0 0 10px rgba(100,255,100,0.1);
}

.loot-inv-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.loot-column {
    background: rgba(15, 21, 31, 0.6);
    border: 1px solid rgba(87, 112, 148, 0.3);
    border-radius: 12px;
    padding: 12px;
    min-height: 220px;
}

.loot-col-title {
    font-weight: 800;
    font-size: 0.95rem;
    color: #c7daff;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.loot-drop-zone {
    border: 1px dashed #4d6fa3;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    font-size: 0.8rem;
    color: #9ec1ff;
    margin-bottom: 12px;
    background: rgba(14, 24, 36, 0.5);
    transition: all 0.2s;
}

.loot-drop-zone-active {
    border-color: #8dc0ff;
    background: rgba(29, 48, 74, 0.8);
    transform: scale(1.02);
}

.loot-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 4px;
}

.loot-items::-webkit-scrollbar {
    width: 4px;
}
.loot-items::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
}
.loot-items::-webkit-scrollbar-thumb {
    background: rgba(80,100,130,0.5);
}

.loot-item-card {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid #4d688f;
    border-radius: 10px;
    background: rgba(24, 33, 48, 0.8);
    cursor: grab;
    transition: background 0.2s, border-color 0.2s;
}

.loot-item-card:active {
    cursor: grabbing;
}

.loot-item-card:hover {
    background: rgba(35, 48, 70, 0.9);
    border-color: #6a8bbd;
}

.loot-item-card-player {
    cursor: default;
    border-color: #3f536f;
    background: rgba(19, 26, 38, 0.6);
}

.loot-item-card-player:hover {
    background: rgba(19, 26, 38, 0.6);
    border-color: #3f536f;
}

.loot-item-count {
    color: #89ff9d;
    font-weight: 800;
    font-size: 0.85rem;
    background: rgba(0,0,0,0.3);
    padding: 2px 6px;
    border-radius: 6px;
}

.loot-empty {
    font-size: 0.85rem;
    color: #8ea2c2;
    text-align: center;
    padding: 20px 0;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

@media (max-width: 900px) {
    #hud {
        left: 8px !important;
        bottom: 8px !important;
    }

    .hud-panel {
        width: min(92vw, 300px);
    }

    #notification-area {
        right: 8px;
        bottom: 88px;
        max-width: 72vw;
    }

    .loot-search-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .loot-inv-wrap {
        grid-template-columns: 1fr;
    }
}