* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #050505;
    font-family: 'Cinzel', 'Trajan Pro', 'Georgia', serif;
    color: #dcd0b8;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #120c0b 0%, #050404 100%);
    cursor: crosshair;
}

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

/* Classic Gothic HUD */
#hud-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Top Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 28px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0) 100%);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
}

.game-title {
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 3px;
    color: #e6c888;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
}

.game-stats {
    display: flex;
    gap: 24px;
    font-size: 16px;
    letter-spacing: 1px;
}

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

.stat-label {
    color: #8c8270;
}

.stat-value {
    color: #ff4747;
    font-weight: bold;
}

/* Bottom Action Bar & Orbs */
.bottom-bar {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 14px;
    gap: 24px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0) 100%);
}

/* Health and Resource Orbs */
.orb-container {
    position: relative;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: 3px solid #3d2b1f;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.9), inset 0 0 15px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    background: #0d0606;
}

.orb-liquid {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: height 0.1s ease-out;
}

.health-orb .orb-liquid {
    background: radial-gradient(circle at 35% 35%, #f02d2d 0%, #8c0a0a 65%, #2a0000 100%);
    box-shadow: 0 0 20px rgba(220, 20, 20, 0.6);
}

.fury-orb .orb-liquid {
    background: radial-gradient(circle at 35% 35%, #ff7b1a 0%, #a83200 65%, #380f00 100%);
    box-shadow: 0 0 20px rgba(230, 100, 20, 0.6);
}

.orb-glass {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0.05) 40%, rgba(0, 0, 0, 0.7) 100%);
    pointer-events: none;
}

.orb-text {
    position: absolute;
    width: 100%;
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
    font-size: 13px;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 0 2px 4px #000;
}

/* Skills Tray */
.skills-tray {
    display: flex;
    gap: 12px;
    background: rgba(18, 12, 10, 0.85);
    border: 2px solid #4a3828;
    border-radius: 8px;
    padding: 8px 14px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
    margin-bottom: 6px;
}

.skill-slot {
    position: relative;
    width: 52px;
    height: 52px;
    background: #151010;
    border: 2px solid #634d35;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.8);
}

.skill-icon {
    font-size: 22px;
}

.skill-key {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 10px;
    font-weight: bold;
    color: #e6c888;
    text-shadow: 0 1px 2px #000;
}

.skill-name {
    position: absolute;
    top: -20px;
    font-size: 10px;
    color: #c9bca0;
    white-space: nowrap;
    opacity: 0.8;
}

.skill-cooldown {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
}

/* Initial Tutorial Banner */
#guide-banner {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(14, 9, 7, 0.92);
    border: 1px solid #755535;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.95);
    padding: 14px 28px;
    border-radius: 6px;
    text-align: center;
    pointer-events: none;
    transition: opacity 1.5s ease-out;
}

#guide-banner h3 {
    color: #e6c888;
    font-size: 16px;
    margin-bottom: 6px;
    letter-spacing: 2px;
}

#guide-banner p {
    font-size: 13px;
    color: #baa78e;
    line-height: 1.5;
}

#guide-banner kbd {
    display: inline-block;
    padding: 1px 5px;
    font-size: 11px;
    font-family: monospace;
    background: #2b1f17;
    border: 1px solid #5a422d;
    border-radius: 3px;
    color: #f1dfbc;
}

/* Death Overlay Modal */
#death-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(28, 8, 8, 0.96) 0%, rgba(10, 4, 4, 0.98) 100%);
    border: 2px solid #8f2121;
    box-shadow: 0 0 50px rgba(180, 20, 20, 0.8), inset 0 0 30px rgba(0, 0, 0, 0.9);
    padding: 36px 48px;
    border-radius: 8px;
    text-align: center;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    z-index: 100;
}

#death-modal h2 {
    color: #ff3333;
    font-size: 32px;
    letter-spacing: 4px;
    text-shadow: 0 0 15px rgba(255, 0, 0, 0.7);
}

#death-modal p {
    color: #d1bda2;
    font-size: 16px;
    letter-spacing: 1px;
}

#respawn-btn {
    background: linear-gradient(180deg, #6b1414 0%, #3d0707 100%);
    border: 2px solid #b83232;
    color: #fce8cc;
    font-family: 'Cinzel', serif;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 2px;
    padding: 10px 28px;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
    transition: all 0.15s ease-in-out;
}

#respawn-btn:hover {
    background: linear-gradient(180deg, #8f1b1b 0%, #520909 100%);
    border-color: #ff5252;
    box-shadow: 0 0 15px rgba(255, 60, 60, 0.5);
    transform: scale(1.04);
}

.respawn-hint {
    font-size: 11px;
    color: #7d6b5e;
}

/* HUD Buttons in top-bar */
.hud-btn {
    background: #1e1614;
    border: 1px solid #5a422d;
    color: #e6c888;
    font-family: 'Cinzel', serif;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
    pointer-events: auto;
    transition: all 0.15s ease-in-out;
}

.hud-btn:hover {
    background: #33231c;
    border-color: #8c6747;
    color: #fff;
}

/* Inventory & Character Sheet Modal */
/* Inventory & Character Sheet Modal */
#inventory-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 900px;
    max-width: 96vw;
    max-height: 92vh;
    background: radial-gradient(circle at center, #181110 0%, #0a0606 100%);
    border: 2px solid #543e2c;
    border-radius: 8px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.95), inset 0 0 25px rgba(0, 0, 0, 0.85);
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    z-index: 90;
    overflow: hidden;
}

.inv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: linear-gradient(to bottom, #2b1c16 0%, #150d0a 100%);
    border-bottom: 2px solid #4a3424;
}

.inv-header h2 {
    font-size: 15px;
    letter-spacing: 2px;
    color: #e6c888;
    margin: 0;
}

#inv-close-btn {
    background: none;
    border: none;
    color: #baa78e;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

#inv-close-btn:hover {
    color: #ff4747;
}

.inv-body {
    display: grid;
    grid-template-columns: 215px 335px 1fr;
    padding: 16px 20px 20px;
    gap: 18px;
    overflow-y: auto;
}

.inv-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.inv-column h3 {
    font-size: 12px;
    letter-spacing: 1.5px;
    color: #baa78e;
    border-bottom: 1px solid #3d2b1f;
    padding-bottom: 4px;
    margin: 0;
}

.column-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #3d2b1f;
    padding-bottom: 4px;
}

.column-header-row h3 {
    border-bottom: none;
    padding-bottom: 0;
}

.capacity-badge {
    font-size: 11px;
    font-family: monospace;
    color: #e5b94c;
    background: #211612;
    padding: 1px 7px;
    border-radius: 3px;
    border: 1px solid #4a3424;
}

/* Equipment slots */
.equip-slots {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.equip-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.slot-label {
    font-size: 9px;
    color: #7d6b5e;
    letter-spacing: 1px;
}

.slot-box {
    width: 54px;
    height: 54px;
    background: #110c0b;
    border: 2px solid #423024;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 22px;
    cursor: pointer;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
    transition: all 0.15s ease;
}

.slot-box:hover {
    border-color: #e6c888;
    transform: scale(1.04);
}

/* Stat Sheet */
.stat-sheet {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: rgba(10, 6, 6, 0.6);
    border: 1px solid #36251b;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 11px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    color: #a3947f;
}

.stat-row .val {
    color: #e6c888;
    font-weight: bold;
}

/* Backpack Grid: 24 Slots (6 columns x 4 rows) */
.backpack-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    background: rgba(10, 6, 6, 0.7);
    border: 1px solid #36251b;
    border-radius: 6px;
    padding: 8px;
}

.backpack-slot {
    width: 48px;
    height: 48px;
    background: #140e0d;
    border: 1px solid #3d2b1f;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    cursor: pointer;
    position: relative;
    box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.6);
    transition: transform 0.1s ease, border-color 0.15s ease;
}

.backpack-slot:hover {
    transform: scale(1.08);
    z-index: 2;
    border-color: #e5b94c !important;
}

.inv-tip {
    font-size: 10px;
    color: #7d6b5e;
    line-height: 1.3;
    padding: 4px 6px;
    background: rgba(20, 12, 10, 0.4);
    border-radius: 4px;
    border: 1px solid #2d1c14;
}

/* Dedicated Item Inspection Panel & Auto-Expanding Tooltip */
.item-inspect-panel {
    background: rgba(12, 7, 7, 0.85);
    border: 1px solid #3a281e;
    border-radius: 6px;
    padding: 12px;
    min-height: 280px;
    max-height: 380px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Empty State Placeholder */
.tt-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 240px;
    text-align: center;
    color: #614f41;
    padding: 15px;
}

.tt-placeholder-icon {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: 0.5;
}

.tt-placeholder h4 {
    font-size: 12px;
    letter-spacing: 1.5px;
    margin: 0 0 6px 0;
    color: #7a6351;
}

.tt-placeholder p {
    font-size: 11px;
    line-height: 1.4;
    margin: 0;
}

/* Tooltip Card (auto-expands to accommodate long descriptions) */
.item-tooltip {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: linear-gradient(180deg, #1f1412 0%, #110a09 100%);
    border: 2px solid #543e2c;
    border-radius: 6px;
    padding: 12px 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.85);
    animation: fadeIn 0.12s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(3px); }
    to { opacity: 1; transform: translateY(0); }
}

.tt-header {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #38251a;
    padding-bottom: 8px;
}

.tt-icon {
    font-size: 26px;
    background: #0d0807;
    border: 1px solid #4a3424;
    border-radius: 4px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tt-header-text {
    display: flex;
    flex-direction: column;
}

.tt-title {
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 2px;
    line-height: 1.2;
}

.tt-type {
    font-size: 10px;
    color: #8c7c68;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tt-status-badge {
    font-size: 9px;
    letter-spacing: 1px;
    padding: 2px 6px;
    border-radius: 3px;
    align-self: flex-start;
    font-weight: bold;
}

.tt-status-equipped {
    background: rgba(20, 80, 20, 0.4);
    border: 1px solid #2e8b57;
    color: #70db70;
}

.tt-status-backpack {
    background: rgba(70, 50, 20, 0.4);
    border: 1px solid #8b6b2e;
    color: #ffd700;
}

.tt-affixes {
    display: flex;
    flex-direction: column;
    gap: 3px;
    color: #92bdf7;
    font-size: 11px;
    padding: 4px 0;
}

.tt-power-box {
    background: rgba(36, 18, 10, 0.6);
    border: 1px solid #6b3e18;
    border-radius: 4px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.tt-power-label {
    font-size: 9px;
    letter-spacing: 1px;
    color: #ff9933;
    font-weight: bold;
}

.tt-power {
    color: #ffb86c;
    font-style: italic;
    font-size: 11px;
    line-height: 1.4;
    word-break: break-word;
}

.tt-action-hint {
    font-size: 10px;
    letter-spacing: 1px;
    color: #baa78e;
    text-align: center;
    border-top: 1px solid #332117;
    padding-top: 6px;
    margin-top: 2px;
}

/* Boss Health Bar (Top Center) */
#boss-bar-container {
    position: absolute;
    top: 65px;
    left: 50%;
    transform: translateX(-50%);
    width: 480px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    z-index: 60;
    pointer-events: none;
    animation: bossAppear 0.8s ease-out;
}

@keyframes bossAppear {
    0% { opacity: 0; transform: translate(-50%, -20px) scale(0.9); }
    100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

.boss-info {
    display: flex;
    align-items: center;
    gap: 10px;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.9);
}

.boss-icon {
    font-size: 20px;
    filter: drop-shadow(0 0 6px #ff2222);
}

.boss-name {
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 3px;
    color: #ff3333;
    text-transform: uppercase;
}

.boss-phase {
    font-size: 11px;
    color: #e5b94c;
    letter-spacing: 1.5px;
    background: rgba(40, 10, 10, 0.7);
    padding: 1px 6px;
    border-radius: 3px;
    border: 1px solid #753333;
}

.boss-bar-frame {
    position: relative;
    width: 100%;
    height: 18px;
    background: #110808;
    border: 2px solid #801818;
    border-radius: 4px;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.4), inset 0 0 8px rgba(0, 0, 0, 0.9);
    overflow: hidden;
}

.boss-health-fill {
    height: 100%;
    background: linear-gradient(90deg, #870505 0%, #e61a1a 50%, #ff4d4d 100%);
    box-shadow: 0 0 10px rgba(255, 30, 30, 0.8);
    transition: width 0.15s ease-out;
}

.boss-health-text {
    position: absolute;
    width: 100%;
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
    font-size: 10px;
    font-weight: bold;
    color: #ffffff;
    letter-spacing: 1px;
    text-shadow: 0 1px 3px #000;
}



