/* Extra row of the inventory bar, above the items: Skill tree button on the left, caret on the right. The row only
   exists once the player has entered the dungeon. When folded, only a thin strip with the caret stays, to unfold it again. */
.inventory-extra {
    display: none;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.inventory-extra.is-unlocked {
    display: flex;
}

.inventory-extra-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.inventory-extra.is-closed {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: 0;
}

.inventory-extra.is-closed .skill-tree-button,
.inventory-extra.is-closed .xp-row {
    display: none;
}

/* XP bar, the width of the inventory bar: level on the left, then 10 green bricks (10 % each) */
.xp-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.xp-level {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border: 2px solid #6bff4a;
    border-radius: 50%;
    background-color: #222C37;
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 800;
    line-height: 22px;
    text-align: center;
}

.xp-bar {
    position: relative;
    display: flex;
    flex: 1 1 auto;
    gap: 2px;
    height: 16px;
}

.xp-brick {
    position: relative;
    flex: 1 1 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    background-color: rgba(255, 255, 255, 0.1);
}

.xp-brick-fill {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 0;
    background-color: #3ddc4f;
    transition: width 0.5s ease;
}

/* "current / target XP · %", written over the bricks */
.xp-label {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 800;
    white-space: nowrap;
    -webkit-text-stroke: 3px #000000;
    paint-order: stroke fill;
    pointer-events: none;
}

.inventory-caret {
    margin-left: auto;
    padding: 0 8px;
    border: 0;
    background: none;
    color: #ffffff;
    font-size: 0.8rem;
    line-height: 1.4;
    opacity: 0.9;
    cursor: pointer;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.inventory-caret:hover {
    opacity: 1;
}

/* Folded: the caret points up and stays discreetly visible */
.inventory-extra.is-closed .inventory-caret {
    transform: rotate(180deg);
    opacity: 0.55;
}

.skill-tree-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 12px 3px 8px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.skill-tree-button:hover {
    background-color: rgba(255, 255, 255, 0.18);
}

.skill-tree-icon {
    position: relative;
    display: inline-block;
}

/* Small "+" that bounces while there are skill points to spend */
.skill-tree-plus {
    position: absolute;
    top: -9px;
    right: -11px;
    display: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: #3ddc4f;
    color: #222C37;
    font-size: 0.7rem;
    font-weight: 900;
    line-height: 14px;
    text-align: center;
    animation: skill-plus-bounce 0.9s ease-in-out infinite;
}

.skill-tree-button.has-points .skill-tree-plus {
    display: block;
}

@keyframes skill-plus-bounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-3px) scale(1.25); }
}

/* Skill tree window */
.skill-tree-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1250;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background-color: rgba(0, 0, 0, 0.6);
}

.skill-tree-overlay.is-open {
    display: flex;
}

.skill-tree {
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 18px 20px 22px;
    border-radius: 12px;
    background-color: #222C37;
    color: #ffffff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.skill-tree-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.skill-tree-title {
    margin: 0;
    padding: 0;
    color: #ffffff;
    font-size: 1.4rem;
    font-weight: 800;
    text-align: left;
}

.skill-tree-close {
    border: 0;
    background: none;
    color: #ffffff;
    font-size: 1.8rem;
    line-height: 1;
    opacity: 0.7;
    cursor: pointer;
}

.skill-tree-close:hover {
    opacity: 1;
}

.skill-tree-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 12px 0 8px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.skill-tree-points {
    font-weight: 700;
}

.skill-tree-points.has-points {
    color: #6bff4a;
}

.skill-tree-reset {
    padding: 4px 12px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 6px;
    background: none;
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.skill-tree-reset:hover:not(:disabled) {
    background-color: #e8141c;
    border-color: #e8141c;
}

.skill-tree-reset:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.skill-section-title {
    margin: 14px 0 8px;
    padding: 0;
    color: #ffd400;
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.skill-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.06);
}

.skill-icon {
    flex: 0 0 auto;
    font-size: 1.8rem;
    line-height: 1;
}

.skill-info {
    flex: 1 1 auto;
    min-width: 0;
}

.skill-name {
    font-weight: 800;
}

.skill-description {
    font-size: 0.8rem;
    opacity: 0.85;
}

.skill-status {
    margin-top: 2px;
    color: #ffd400;
    font-size: 0.75rem;
}

.skill-slots {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 5px;
    max-width: 130px;
}

.skill-slot {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background-color: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    font-weight: 800;
    cursor: not-allowed;
}

.skill-slot.is-filled {
    border-color: #ffd400;
    background-color: rgba(255, 212, 0, 0.25);
    color: #ffffff;
    cursor: default;
}

/* The next slot, when a point can be spent on it */
.skill-slot.is-next {
    border-color: #6bff4a;
    color: #ffffff;
    cursor: pointer;
    animation: skill-slot-pulse 1s ease-in-out infinite alternate;
}

@keyframes skill-slot-pulse {
    from { box-shadow: 0 0 0 rgba(107, 255, 74, 0); }
    to { box-shadow: 0 0 8px rgba(107, 255, 74, 0.9); }
}
