/*────────────────────────────────────────────────────────────────────────*/
/* Tier container (one strip per tier, fixed height, no vertical growth) */
/*────────────────────────────────────────────────────────────────────────*/
.tier {
    display: flex;
    flex-direction: column;
    padding: 0.25rem 0.5rem;
    background: var(--tier-bg-color);
    border: 1px solid var(--card-border-color);
    resize: vertical;               /* <-- Make it vertically resizable */
    min-height: 75px;               /* <-- Allow it to shrink nicely */
    max-height: 600px;              /* <-- Optional cap */
}
.tier-first {
    border-top-left-radius: 0.25rem;
    border-top-right-radius: 0.25rem;
}
.tier-last {
    border-bottom-left-radius: 0.25rem;
    border-bottom-right-radius: 0.25rem;
}
.tier-preview {
    border-radius: 0.25rem;
    min-height: 56px;
}
/*────────────────────────────────────────────────────────────────────────*/
/* Tier title wrapper (left-aligned label container)                      */
/*────────────────────────────────────────────────────────────────────────*/
.tier-title-wrapper {
    flex: 0 0 auto;
    margin-bottom: 0.25rem;
    text-align: left;
}

/*────────────────────────────────────────────────────────────────────────*/
/* Tier title (label text)                                              */
/*────────────────────────────────────────────────────────────────────────*/
.tier-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tier-title-preview {
    font-size: 0.75rem;
    margin-bottom: 0;
}

/*────────────────────────────────────────────────────────────────────────*/
/* Assigned items list (single-line, scrolls left/right)               */
/*────────────────────────────────────────────────────────────────────────*/
.tier .sortable-tier {
    flex: 1 1 auto;            /* fill remaining height below title */
    display: flex;
    flex-wrap: wrap;           /* wrap items onto multiple lines */
    align-content: flex-start; /* pack wrapped rows at the top */
    gap: 0.5rem;               /* gutter between cards */
    margin: 0;
    padding: 0.15rem;
    list-style: none;

    min-height: 0;             /* allow flex child to shrink & scroll */
    overflow-y: auto;          /* vertical scroll when rows overflow */

    scrollbar-width: thin;     /* Firefox */
    scrollbar-color: rgba(0,0,0,.2) transparent;
}
.tier .sortable-tier::-webkit-scrollbar {
    width: 6px;
}
.tier .sortable-tier::-webkit-scrollbar-thumb {
    background: rgba(var(--scrollbar-thumb-rgb), var(--scrollbar-thumb-alpha));
    border-radius: 3px;
}

/*────────────────────────────────────────────────────────────────────────*/
/* Individual item wrapper                                              */
/*────────────────────────────────────────────────────────────────────────*/
.sortable-item {
    flex: 0 0 auto;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
    width: 75px;                /* fixed width for uniformity */
}

/*────────────────────────────────────────────────────────────────────────*/
/* Drag-drop card styling                                               */
/*────────────────────────────────────────────────────────────────────────*/
.tierlist-drag-drop-item {
    background: var(--card-bg-color);
    color: var(--card-text-color);
    border: 1px solid var(--card-border-color);
    border-radius: 6px;
    padding: 4px 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    cursor: grab;
    user-select: none;
}
.tierlist-drag-drop-item.sortable-chosen,
.tierlist-drag-drop-item.sortable-drag {
    cursor: grabbing !important;
}
.tierlist-drag-drop-item:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(0,0,0,0.12);
}

/*────────────────────────────────────────────────────────────────────────*/
/* Item thumbnails & titles                                              */
/*────────────────────────────────────────────────────────────────────────*/
.tierlist-img {
    width: 65px;
    height: 65px;
    object-fit: fill;
    border-radius: 0.25rem;
    margin-bottom: 2px;
}
.tierlist-img:active {
    cursor: grabbing;
}

.tierlist-title {
    margin: 0;
    font-size: 0.6rem;
    font-weight: 500;
    text-align: center;
    color: var(--card-text-color);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    max-width: 76px;
}

/*────────────────────────────────────────────────────────────────────────*/
/* Unassigned tier: stack header + items, scroll on the tier itself     */
/*────────────────────────────────────────────────────────────────────────*/
.unassigned-tier {
    display: flex;
    flex-direction: column;
    height: 25vh;
    overflow-y: auto;         /* vertical scrolling of the whole tier */
    overflow-x: hidden;
}

/* Keep the heading stuck at the top while scrolling the items below */
.unassigned-tier .tier-title {
    position: sticky;
    top: 0;
    background: var(--tier-bg-color);
    z-index: 2;
    margin-bottom: 0.5rem;
    margin-right: 0;
}

/* Wrap items onto multiple lines, allow menu overflow */
.unassigned-tier .sortable-tier {
    flex: 1 1 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0.15rem;
    list-style: none;
    overflow: visible;
}

.unassigned-tier::-webkit-scrollbar {
  width: 6px;
}
.unassigned-tier::-webkit-scrollbar-thumb {
  background: rgba(var(--scrollbar-thumb-rgb), var(--scrollbar-thumb-alpha));
  border-radius: 3px;
}


/* Anchor wrapper for absolute‑positioned menus */
.hover-wrapper {
  position: relative;
}