html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: #050505;
}

body {
    font-family: monospace;
    color: #e8fffb;
}

#game-container {
    position: fixed;
    inset: 0;
    overflow: hidden;
}

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

/* UI Layout */
#ui-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 20px;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#ui-overlay>* {
    pointer-events: auto;
}

#login-panel {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(5, 5, 5, 0.72);
    backdrop-filter: blur(4px);
}

.login-title {
    color: #00ffcc;
    font-weight: bold;
    letter-spacing: 2px;
    text-shadow: 0 0 12px rgba(0, 255, 204, 0.55);
}

#steam-login-button {
    background: #00ffcc;
    border: 0;
    color: #050505;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    padding: 11px 14px;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    text-shadow: 0 0 10px rgba(0, 255, 204, 0.5);
    gap: 24px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.stat-bar,
.attributes {
    background: rgba(5, 5, 5, 0.65);
    border: 1px solid rgba(0, 255, 204, 0.28);
    padding: 8px 10px;
    max-width: min(720px, 72vw);
}

#ability-choice-panel {
    position: fixed;
    left: 20px;
    top: 104px;
    width: min(520px, calc(100vw - 40px));
    background: rgba(5, 5, 5, 0.88);
    border: 1px solid rgba(0, 255, 204, 0.45);
    box-shadow: 0 0 24px rgba(0, 255, 204, 0.14);
    padding: 12px;
}

.choice-title {
    color: #00ffcc;
    font-size: 0.8rem;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

#ability-choice-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.ability-choice {
    min-height: 86px;
    background: rgba(0, 255, 204, 0.06);
    border: 1px solid rgba(0, 255, 204, 0.32);
    color: #e8fffb;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    padding: 8px;
}

.ability-choice:hover {
    border-color: #00ffcc;
    background: rgba(0, 255, 204, 0.12);
}

.ability-choice-name {
    color: #00ffcc;
    font-size: 0.78rem;
    line-height: 1.15;
    margin-bottom: 8px;
    overflow-wrap: anywhere;
}

.ability-choice-meta {
    color: rgba(232, 255, 251, 0.72);
    font-size: 0.68rem;
    line-height: 1.25;
}

#side-actions {
    display: flex;
    gap: 10px;
    align-self: flex-start;
}

#inventory-toggle,
#waypoint-toggle {
    background: rgba(0, 40, 40, 0.7);
    border: 1px solid #00ffcc;
    color: #00ffcc;
    padding: 10px 20px;
    cursor: pointer;
    font-family: inherit;
    text-shadow: 0 0 10px #00ffcc;
    box-shadow: 0 0 15px rgba(0, 255, 204, 0.2);
    transition: all 0.2s;
}

#inventory-toggle:hover,
#waypoint-toggle:hover {
    background: #00ffcc;
    color: #050505;
    box-shadow: 0 0 30px #00ffcc;
}

#waypoint-panel {
    position: fixed;
    top: 104px;
    right: 20px;
    width: min(330px, calc(100vw - 40px));
    max-height: min(420px, calc(100vh - 170px));
    background: rgba(5, 5, 5, 0.92);
    border: 1px solid rgba(255, 204, 51, 0.72);
    box-shadow: 0 0 28px rgba(255, 204, 51, 0.16);
    padding: 14px;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 204, 51, 0.36);
    padding-bottom: 8px;
}

.panel-header h2 {
    margin: 0;
    color: #ffcc33;
    font-size: 0.9rem;
    letter-spacing: 2px;
}

#close-waypoints {
    background: none;
    border: none;
    color: #ff3366;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

#waypoint-list {
    display: grid;
    gap: 8px;
    overflow-y: auto;
}

.waypoint-row {
    min-height: 44px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    background: rgba(255, 204, 51, 0.06);
    border: 1px solid rgba(255, 204, 51, 0.34);
    color: #e8fffb;
    cursor: pointer;
    font: inherit;
    text-align: left;
    padding: 9px 10px;
}

.waypoint-row:hover:not(:disabled) {
    border-color: #ffcc33;
    background: rgba(255, 204, 51, 0.14);
}

.waypoint-row:disabled {
    cursor: default;
    opacity: 0.62;
}

.waypoint-row.current {
    border-color: #00ffcc;
    background: rgba(0, 255, 204, 0.09);
}

.waypoint-name {
    overflow-wrap: anywhere;
    line-height: 1.2;
}

.waypoint-state {
    color: #ffcc33;
    font-size: 0.68rem;
    letter-spacing: 1px;
}

.waypoint-row.current .waypoint-state {
    color: #00ffcc;
}

#waypoint-empty {
    color: rgba(232, 255, 251, 0.55);
    border: 1px dashed rgba(255, 204, 51, 0.3);
    padding: 16px;
    text-align: center;
    font-size: 0.78rem;
}

/* Inventory Modal */
#inventory-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(920px, calc(100vw - 40px));
    height: min(720px, calc(100vh - 48px));
    background: rgba(5, 5, 5, 0.95);
    border: 2px solid #00ffcc;
    box-shadow: 0 0 50px rgba(0, 255, 204, 0.3);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    padding: 20px;
    z-index: 100;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #00ffcc;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;
    letter-spacing: 5px;
    text-shadow: 0 0 15px #00ffcc;
}

#close-inventory {
    background: none;
    border: none;
    color: #ff3366;
    font-size: 2rem;
    cursor: pointer;
}

.inventory-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 30px;
    min-height: 230px;
}

.inventory-section {
    min-width: 0;
}

.inventory-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

#inventory-count {
    border: 1px solid rgba(0, 255, 204, 0.28);
    color: rgba(232, 255, 251, 0.74);
    font-size: 0.68rem;
    padding: 3px 7px;
}

#inventory-count.full {
    border-color: #ff3366;
    color: #ff99aa;
}

.equipment-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    justify-items: center;
}

.slot {
    width: 60px;
    height: 60px;
    background: rgba(0, 255, 204, 0.05);
    border: 1px dashed rgba(0, 255, 204, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    cursor: pointer;
}

.slot::before {
    content: attr(data-label);
    position: absolute;
    bottom: -15px;
    font-size: 0.6rem;
    opacity: 0.5;
    white-space: nowrap;
}

.slot.occupied {
    border-style: solid;
    border-color: #00ffcc;
    background: rgba(0, 255, 204, 0.1);
}

.slot.occupied:hover {
    background: rgba(0, 255, 204, 0.16);
}

.slot.empty {
    cursor: default;
}

.inventory-slot::before {
    bottom: 3px;
    right: 4px;
    font-size: 0.55rem;
    color: rgba(232, 255, 251, 0.32);
}

.inventory-slot.empty {
    border-style: dashed;
    opacity: 0.72;
}

#inventory-grid {
    display: grid;
    grid-template-columns: repeat(6, 60px);
    grid-auto-rows: 60px;
    gap: 10px;
    overflow-y: auto;
    align-content: start;
    padding-bottom: 18px;
}

.ability-section {
    border-top: 1px solid rgba(0, 255, 204, 0.28);
    margin-top: 18px;
    padding-top: 14px;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.ability-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.ability-section h3,
.equipment-section h3,
.inventory-section h3 {
    margin: 0 0 12px;
    color: #e8fffb;
    font-size: 0.78rem;
    letter-spacing: 2px;
}

.ability-section h3 {
    margin-bottom: 0;
}

.ability-key-strip {
    display: flex;
    gap: 6px;
}

.ability-key-strip span {
    min-width: 38px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0, 255, 204, 0.32);
    color: rgba(232, 255, 251, 0.72);
    font-size: 0.68rem;
}

#ability-book-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    overflow-y: auto;
    padding-right: 4px;
}

#ability-book-empty {
    color: rgba(232, 255, 251, 0.5);
    border: 1px dashed rgba(0, 255, 204, 0.24);
    padding: 18px;
    text-align: center;
    font-size: 0.8rem;
}

.ability-card {
    min-height: 124px;
    border: 1px solid rgba(0, 255, 204, 0.28);
    background: rgba(0, 255, 204, 0.045);
    padding: 9px;
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    gap: 7px;
}

.ability-card-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.ability-card-name {
    color: #00ffcc;
    font-size: 0.78rem;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.ability-card-source {
    flex: 0 0 auto;
    color: rgba(232, 255, 251, 0.62);
    font-size: 0.62rem;
    text-transform: uppercase;
}

.ability-card-meta,
.ability-card-tags {
    color: rgba(232, 255, 251, 0.7);
    font-size: 0.66rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.ability-card-tags {
    color: rgba(232, 255, 251, 0.52);
}

.ability-assign-row {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
}

.ability-assign-btn {
    height: 26px;
    border: 1px solid rgba(0, 255, 204, 0.3);
    background: rgba(5, 5, 5, 0.82);
    color: rgba(232, 255, 251, 0.78);
    font: inherit;
    font-size: 0.68rem;
    cursor: pointer;
}

.ability-assign-btn:hover,
.ability-assign-btn.assigned {
    border-color: #00ffcc;
    background: rgba(0, 255, 204, 0.18);
    color: #e8fffb;
}

/* Tooltip */
#item-tooltip {
    position: absolute;
    width: 250px;
    background: rgba(0, 10, 10, 0.95);
    border: 1px solid #00ffcc;
    padding: 15px;
    pointer-events: auto;
    z-index: 110;
}

.tooltip-name {
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.tooltip-rarity {
    font-size: 0.8rem;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.tooltip-slot {
    color: rgba(232, 255, 251, 0.62);
    font-size: 0.76rem;
    margin-bottom: 10px;
}

.tooltip-affixes {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.85rem;
    color: #cfcfcf;
}

.tooltip-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.action-btn {
    min-height: 32px;
    border: 1px solid rgba(0, 255, 204, 0.42);
    background: rgba(0, 255, 204, 0.08);
    color: #e8fffb;
    cursor: pointer;
    font: inherit;
    font-size: 0.72rem;
    padding: 6px 10px;
}

.action-btn:hover:not(:disabled) {
    border-color: #00ffcc;
    background: rgba(0, 255, 204, 0.18);
}

.action-btn:disabled {
    cursor: default;
    opacity: 0.42;
}

.tooltip-affixes .muted {
    color: rgba(207, 207, 207, 0.55);
}

.hidden {
    display: none !important;
}

/* Rarity Colors */
.common {
    color: #888;
    border-color: #888;
}

.magic {
    color: #3399ff;
    border-color: #3399ff;
    text-shadow: 0 0 10px #3399ff;
}

.rare {
    color: #ffff33;
    border-color: #ffff33;
    text-shadow: 0 0 10px #ffff33;
}

.legendary {
    color: #ff9900;
    border-color: #ff9900;
    text-shadow: 0 0 15px #ff9900;
}

/* Hotbar */
#hotbar {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    background: rgba(0, 20, 20, 0.8);
    padding: 15px;
    border: 1px solid rgba(0, 255, 204, 0.4);
    box-shadow: 0 0 30px rgba(0, 255, 204, 0.1);
    backdrop-filter: blur(5px);
    pointer-events: auto;
}

.hotbar-slot {
    width: 60px;
    height: 60px;
    background: rgba(5, 5, 5, 0.9);
    border: 1px solid rgba(0, 255, 204, 0.6);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.slot-icon {
    max-width: 52px;
    padding: 0 4px;
    text-align: center;
    font-size: 0.72rem;
    line-height: 1.1;
    color: #e8fffb;
    overflow-wrap: anywhere;
}

.key-bind {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: #00ffcc;
    color: #050505;
    font-size: 0.62rem;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 3px;
    box-shadow: 0 0 10px #00ffcc;
    white-space: nowrap;
}

.cooldown-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 0%;
    background: rgba(0, 255, 204, 0.3);
    transition: height 0.1s linear;
}

/* Mini-map */
#mini-map-container {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 150px;
    height: 150px;
    background: rgba(5, 5, 5, 0.8);
    border: 2px solid #00ffcc;
    box-shadow: 0 0 20px rgba(0, 255, 204, 0.2);
    overflow: hidden;
}

#mini-map-canvas {
    width: 100%;
    height: 100%;
}

@media (max-width: 760px) {
    #inventory-modal {
        width: calc(100vw - 24px);
        height: calc(100vh - 24px);
        padding: 14px;
    }

    .inventory-layout {
        grid-template-columns: 1fr;
        gap: 22px;
        overflow-y: auto;
        padding-bottom: 10px;
    }

    #inventory-grid {
        grid-template-columns: repeat(auto-fill, 60px);
    }

    #ability-book-grid {
        grid-template-columns: 1fr;
    }
}
