#gallery {
    opacity: 0;
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 201;
    display: flex;
    justify-content: center;
    align-items: center;
}

#gallery-content {
    background: #fff;
    max-height: 88%;
    max-width: 80%;
    min-width: 720px;
    border-radius: 15px;
    display: flex;
    flex-direction: column; 
    box-shadow: var(--shadow-soft);
}

#gallery-header {
    font-size: 26px;
    background: #555;
    color: #fff;
    text-align: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

#gallery-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow-y: scroll;
}

/* Shell layout: sidebar + content */
.gallery-shell {
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.gallery-sidebar {
    width: 160px;
    background: rgba(15, 18, 27, 0.08);
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    overflow-y: scroll;
}

.gallery-sidebar .nav-item {
    padding: 10px 12px;
    border-radius: 8px;
    color: #444;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s;
        overflow-y: scroll;
}

.gallery-sidebar .sub-item {
    padding-left: 24px;
    font-size: 13px;
    opacity: 0.8;
}

.gallery-sidebar .sub-item[aria-selected="true"] {
    opacity: 1;
}

.gallery-sidebar .nav-item[aria-disabled="true"] {
    opacity: 0.4;
    cursor: default;
}

.gallery-sidebar .nav-item[aria-selected="true"] {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
}

.gallery-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; 
    overflow: hidden;
}

/* Header close button */
#gallery-header {
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
}

#gallery-close {
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #fff;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    width: 36px;
    height: 28px;
}

#gallery-close:hover {
    transform: translateY(-1px);
}

/* Tabs */
.gallery-tabs {
    display: flex;
    gap: 8px;
    padding: 12px;
    justify-content: center;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0.02));
    flex-shrink: 0;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
}

.tab-button {
    padding: 8px 14px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #333;
    cursor: pointer;
    font-weight: 700;
}

.tab-button[aria-selected="true"] {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.tab-panel {
    padding: 12px;
    width: 100%;
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* móvil */
    
    scrollbar-width: thin; 
}

.tab-panel::-webkit-scrollbar {
    width: 10px;
}

.tab-panel::-webkit-scrollbar-track { 
    border-radius: 8px;
    background: #202030;
}

.tab-panel::-webkit-scrollbar-thumb {
    background: #9090a0;
    border-radius: 8px;
}

.tab-panel::-webkit-scrollbar-thumb:hover {
    background: #707080;
}

/* Small screens adjustments */
@media (max-width: 800px) {
    #gallery-content {
        max-width: 92%;
        max-height: 90%;
    }

    .gallery-sidebar {
        display: none;
    }

    .gallery-tabs {
        justify-content: flex-start;
        overflow-x: auto;
    }
}

/* Coins card styling */
.coins-grid {
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

.coin-card {
    background: #2b2f3a;
    color: #e6eef8;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 14px 30px rgba(10, 14, 22, 0.45);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 160px;
}

.coin-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #ffd54f, #ffb300);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: #8a5a00;
    box-shadow: inset 0 -6px 12px rgba(0, 0, 0, 0.08);
}

.coin-card div {
    color: #e6eef8;
}

.coin-card .price-btn {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    background: #1e88e5;
    color: white;
    border: none;
    cursor: pointer;
    width: 100%;
    box-shadow: 0 8px 18px rgba(30, 136, 229, 0.24);
    font-weight: 700;
}

#skinsUL {
    padding: 0;
    margin: 0;
    padding: 16px;
    width: 100%;
    height: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 18px;
    justify-items: center;
    overflow-y: scroll;
}

/* Scroll context handles on tab-panel now */
#skinsUL::-webkit-scrollbar {
    display: none;
}

.skin {
    list-style-type: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px;
}

.circular {
    width: clamp(90px, 16vw, 160px);
    aspect-ratio: 1/1;
    border-radius: 50%;
    background: url("../img/checkerboard.png");
    background-repeat: no-repeat;
    background-size: cover;
    box-shadow: 0 4px 16px rgba(14, 21, 47, 0.06);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    object-fit: cover;
}

.skinName {
    text-align: center;
    margin-bottom: 0;
    transition: all 0.2s;
}

/* Make skin action buttons wider and consistent */
.skin .btn-main {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    font-weight: 700;
}

.skin .btn-active {
    cursor: default;
}

.circular:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, .12);
    transform: translateY(-4px);

}

.circular:hover+.skinName {
    text-shadow: 0 0 1px rgba(0, 0, 0, .8);
}

.btn-active {
    background: #4CAF50;
    margin-top: 5px;
    padding: 8px;
    border: none;
    border-radius: 5px;
    color: white;
    cursor: default;
}

.levelReq {
    font-size: 11px;
    font-weight: bold;
    margin: 5px 0;
    padding: 2px 6px;
    border-radius: 4px;
}

.levelReq.locked {
    background: rgba(244, 67, 54, 0.2);
    color: #ff5252;
}

.levelReq.unlocked {
    background: rgba(76, 175, 80, 0.2);
    color: #8bc34a;
}

.skin.selected {
    border: 2px solid #00bcd4;
    background: rgba(0, 188, 212, 0.1);
    border-radius: 10px;
}

/* ============================================================
   Tarjetas de Sombreros / Perks / Boosts.
   Estas clases (.skin-card, .skin-img, .skin-name, .boost-*)
   estaban definidas SOLO en directory.css, que no se carga en
   index.html: por eso el shop las mostraba sin estilo y la imagen
   del sombrero se dibujaba a 512px (tamano natural).
   ============================================================ */
.skin-card {
    box-sizing: border-box;
    list-style: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-width: 150px;
    max-width: 180px;
    padding: 14px;
    border-radius: 14px;
    background: #2b2f3a;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 12px 26px rgba(10, 14, 22, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.skin-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 34px rgba(10, 14, 22, 0.45);
}

.skin-img {
    width: 120px;
    height: 120px;
    flex: none;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.skin-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.skin-img .skin-img-fallback {
    display: none;
    font-size: 44px;
    line-height: 1;
}

.skin-name {
    font-weight: 700;
    font-size: 1rem;
    color: #e6eef8;
    text-align: center;
    text-transform: capitalize;
    word-break: break-word;
}

.skin-card .btn-main,
.boost-card .btn-main {
    width: 100%;
}

/* Tarjeta del selector de color personalizado (Perks -> Custom Color) */
.color-picker-card {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-height: 0;
}

.color-picker-card .skin-img {
    cursor: pointer;
}

.color-picker-card #picker-action-container {
    width: 100%;
}

/* Boosts */
.boost-card {
    box-sizing: border-box;
    list-style: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-width: 150px;
    max-width: 200px;
    padding: 14px;
    border-radius: 14px;
    background: #2b2f3a;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 12px 26px rgba(10, 14, 22, 0.35);
}

.boost-img {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 44px;
    line-height: 1;
    background: radial-gradient(circle at 30% 30%, rgba(124, 77, 255, 0.35), rgba(255, 0, 85, 0.25));
}

.boost-name {
    font-weight: 700;
    color: #e6eef8;
    text-align: center;
}

/* ============================================================
   Tarjetas de Sombreros / Perks / Boosts.
   Estas clases (.skin-card, .skin-img, .skin-name, .boost-*)
   estaban definidas SOLO en directory.css, que no se carga en
   index.html: por eso el shop las mostraba sin estilo y la imagen
   del sombrero se dibujaba a 512px (tamano natural).
   ============================================================ */
.skin-card {
    box-sizing: border-box;
    list-style: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-width: 150px;
    max-width: 180px;
    padding: 14px;
    border-radius: 14px;
    background: #2b2f3a;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 12px 26px rgba(10, 14, 22, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.skin-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 34px rgba(10, 14, 22, 0.45);
}

.skin-img {
    width: 120px;
    height: 120px;
    flex: none;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.skin-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.skin-img .skin-img-fallback {
    display: none;
    font-size: 44px;
    line-height: 1;
}

.skin-name {
    font-weight: 700;
    font-size: 1rem;
    color: #e6eef8;
    text-align: center;
    text-transform: capitalize;
    word-break: break-word;
}

.skin-card .btn-main,
.boost-card .btn-main {
    width: 100%;
}

/* Tarjeta del selector de color personalizado (Perks -> Custom Color) */
.color-picker-card {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-height: 0;
}

.color-picker-card .skin-img {
    cursor: pointer;
}

.color-picker-card #picker-action-container {
    width: 100%;
}

/* Boosts */
.boost-card {
    box-sizing: border-box;
    list-style: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-width: 150px;
    max-width: 200px;
    padding: 14px;
    border-radius: 14px;
    background: #2b2f3a;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 12px 26px rgba(10, 14, 22, 0.35);
}

.boost-img {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 44px;
    line-height: 1;
    background: radial-gradient(circle at 30% 30%, rgba(124, 77, 255, 0.35), rgba(255, 0, 85, 0.25));
}

.boost-name {
    font-weight: 700;
    color: #e6eef8;
    text-align: center;
}

