/* =========================================================
   BRAWL TIER LIST · MENÚ DE CALIFICACIÓN
   Tema visual: arcade moderno, vidrio oscuro y acentos dorados
   ========================================================= */

.rating-view-container {
    --rating-accent: #ffd34e;
    --rating-accent-strong: #ffad28;
    --rating-blue: #38bdf8;
    --rating-surface: rgba(8, 15, 32, 0.82);
    --rating-line: rgba(191, 219, 254,  0.24);
    position: relative;
    isolation: isolate;
    width: min(1540px, calc(100% - 32px));
    max-width: 1540px;
    margin: 28px auto;
    padding: clamp(12px, 2.2vw, 30px);
    color: #f8fafc;
    background-color: #0b1222;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 1px solid rgba(191, 219, 254, 0.25);
    border-radius: 24px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    box-sizing: border-box;
    overflow: hidden;
}

.rating-view-container::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(135deg, rgba(5, 12, 28, 0.64), rgba(10, 27, 55, 0.48));
    -webkit-backdrop-filter: blur(var(--rating-bg-blur, 4px));
    backdrop-filter: blur(var(--rating-bg-blur, 4px));
    pointer-events: none;
    border-radius: inherit;
}

.rating-view-container > * {
    position: relative;
    z-index: 0;
}

.rating-view-container.hidden {
    display: none !important;
}

main:has(.rating-view-container:not(.hidden)) {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 1px 0 32px !important;
    box-sizing: border-box;
}

.rating-workspace {
    display: flex;
    flex-direction: column;
    gap: clamp(18px, 2.2vw, 30px);
    width: 100%;
    min-width: 0;
    padding: clamp(12px, 2vw, 28px);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 20px;
    background: linear-gradient(145deg, rgba(5, 12, 28, 0.76), rgba(13, 27, 50, 0.58));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 12px 28px rgba(0, 0, 0, 0.16);
    box-sizing: border-box;
}

/* Los selectores específicos evitan que imágenes futuras se estiren por error. */
.rating-workspace .rating-top-header img,
.rating-workspace .rating-item-info img,
.rating-workspace .star-slot-btn img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.rating-top-header {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: center;
    gap: clamp(8px, 2vw, 28px);
    padding: clamp(12px, 2vw, 24px) clamp(12px, 2vw, 24px) clamp(28px, 2.5vw, 36px);
    border: 1px solid rgba(186, 230, 253, 0.2);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(8, 18, 38, 0.84), rgba(21, 44, 78, 0.72));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 10px 24px rgba(0, 0, 0, 0.16);
}

.brawler-selector-trigger,
.header-stacked-container {
    position: relative;
    justify-self: center;
    width: min(100%, 116px);
    aspect-ratio: 1 / 1;
    flex: 0 0 auto;
}

.brawler-selector-trigger {
    border: 1px solid rgba(255, 211, 78, 0.52);
    border-radius: 18px;
    padding: 0;
    background: radial-gradient(circle at 50% 38%, rgba(255, 211, 78, 0.16), rgba(8, 15, 32, 0.78) 72%);
    box-shadow: 0 0 0 3px rgba(255, 211, 78, 0.06), 0 8px 20px rgba(0, 0, 0, 0.26);
    cursor: pointer;
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.brawler-selector-trigger:hover {
    transform: translateY(-3px) scale(1.035);
    border-color: var(--rating-accent);
    box-shadow: 0 0 0 4px rgba(255, 211, 78, 0.11), 0 12px 26px rgba(0, 0, 0, 0.3);
}

.brawler-selector-trigger::after,
.header-stacked-container::after {
    position: absolute;
    right: -8px;
    bottom: -27px;
    left: -8px;
    color: rgba(226, 232, 240, 0.88);
    font-size: 10px;
    font-weight: 850;
    line-height: 1.1;
    letter-spacing: 0.08em;
    text-align: center;
    text-transform: uppercase;
    pointer-events: none;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.brawler-selector-trigger::after { content: 'Brawler'; }
.rating-top-header > .header-stacked-container:nth-child(2)::after { content: 'Gadgets'; }
.rating-top-header > .header-stacked-container:nth-child(3)::after { content: 'Estelares'; }
.rating-top-header > .header-stacked-container:nth-child(4)::after { content: 'Gears'; }
.rating-top-header > .header-stacked-container:nth-child(5)::after { content: 'Hipercarga'; }

.item-slot-btn-main {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 5%;
    border: 1px solid rgba(191, 219, 254, 0.28);
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(33, 55, 87, 0.94), rgba(5, 12, 28, 0.94));
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    cursor: pointer;
    z-index: 1;
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.item-slot-btn-main:hover {
    transform: translateY(-2px);
    border-color: rgba(56, 189, 248, 0.78);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.08), 0 9px 20px rgba(0, 0, 0, 0.27);
}

div.item-slot-btn-main:hover {
    transform: none;
}

.item-slot-btn-sub {
    position: absolute;
    right: -12%;
    bottom: -10%;
    width: 56%;
    height: 56%;
    padding: 4%;
    border: 1px solid rgba(255, 211, 78, 0.75);
    border-radius: 13px;
    background: linear-gradient(145deg, rgba(43, 54, 76, 0.98), rgba(8, 15, 32, 0.98));
    box-shadow: 0 5px 13px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    cursor: pointer;
    z-index: 2;
    transition: transform 160ms ease, border-color 160ms ease;
}

.item-slot-btn-sub:hover {
    transform: scale(1.09) rotate(2deg);
    border-color: #fff0a3;
}

.item-slot-btn-sub img[src*="empty2"] {
    opacity: 0.8;
}

.brawler-selector-trigger:focus-visible,
.item-slot-btn-main:focus-visible,
.item-slot-btn-sub:focus-visible,
.star-slot-btn:focus-visible {
    outline: 3px solid var(--rating-accent);
    outline-offset: 4px;
}

.rating-grid-two-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: clamp(16px, 2.1vw, 32px);
    row-gap: clamp(10px, 1.25vw, 18px);
    align-items: center;
    width: 100%;
    min-width: 0;
}

.rating-row {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: clamp(8px, 1.1vw, 16px);
    padding: clamp(8px, 1vw, 13px);
    border: 1px solid rgba(191, 219, 254, 0.12);
    border-radius: 15px;
    background: linear-gradient(135deg, rgba(5, 13, 30, 0.75), rgba(24, 43, 69, 0.65));
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.035);
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.rating-row:hover {
    transform: translateY(-2px);
    border-color: rgba(56, 189, 248, 0.42);
    background: linear-gradient(135deg, rgba(7, 20, 43, 0.88), rgba(22, 52, 82, 0.76));
}

.rating-item-info {
    position: relative;
    flex: 0 0 15%;
    min-width: 0;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    background: rgba(2, 6, 23, 0.44);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.rating-stars-group {
    display: flex;
    flex: 1 1 0;
    min-width: 0;
    align-items: center;
    gap: clamp(2px, 0.4vw, 7px);
}

.star-slot-btn {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    aspect-ratio: 1 / 1;
    padding: 0;
    border: 1px solid rgba(191, 219, 254, 0.13);
    border-radius: 9px;
    background: linear-gradient(145deg, rgba(15, 28, 49, 0.86), rgba(3, 8, 20, 0.78));
    cursor: pointer;
    transition: transform 130ms ease, border-color 130ms ease, background 130ms ease, box-shadow 130ms ease;
}

.star-slot-btn:hover {
    transform: translateY(-2px) scale(1.06);
    border-color: rgba(255, 211, 78, 0.68);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.24);
}

.star-slot-btn:active {
    transform: scale(0.94);
}

.rating-image-missing {
    display: none !important;
}

/* Destaca la última categoría competitiva sin alterar la secuencia de filas. */
.competitive-master-row {
    grid-column: 1 / -1;
    width: min(100%, 570px);
    max-width: 100%;
    justify-self: center;
}

.competitive-master-row .rating-item-info {
    flex-basis: 12%;
}

/* ===== MODALES ===== */
.rating-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 18px;
    background: rgba(2, 6, 18, 0.78);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    animation: ratingOverlayIn 160ms ease both;
}

.rating-modal-overlay.hidden {
    display: none !important;
}

.rating-modal-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: min(950px, 100%);
    max-height: min(84vh, 900px);
    padding: clamp(16px, 2vw, 26px);
    overflow: hidden;
    color: #f8fafc;
    background: linear-gradient(145deg, #101e35, #07101f 78%);
    border: 1px solid rgba(125, 211, 252, 0.3);
    border-radius: 22px;
    box-shadow: 0 28px 85px rgba(0, 0, 0, 0.62), inset 0 1px 0 rgba(255, 255, 255, 0.07);
    box-sizing: border-box;
    animation: ratingModalIn 180ms ease both;
}

.rating-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(191, 219, 254, 0.15);
}

.rating-modal-header h3 {
    margin: 0;
    color: #fff7d6;
    font-size: clamp(17px, 1.6vw, 22px);
    font-weight: 850;
    letter-spacing: 0.01em;
}

.rating-modal-header .btn {
    flex: 0 0 auto;
    padding: 8px 12px;
    border: 1px solid rgba(248, 113, 113, 0.3);
    background: rgba(127, 29, 29, 0.36);
}

.rating-modal-header .btn:hover {
    background: rgba(185, 28, 28, 0.65);
}

.brawler-search-input {
    flex: 1 1 230px;
    width: 100%;
    max-width: 360px;
    min-width: 130px;
    padding: 11px 14px;
    color: #f8fafc;
    font: inherit;
    font-size: 14px;
    outline: none;
    background: rgba(2, 6, 23, 0.82);
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 12px;
    box-sizing: border-box;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.brawler-search-input:focus {
    border-color: var(--rating-blue);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.13);
}

.brawler-grid,
.gadget-grid,
.starpower-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 12px;
    max-height: 60vh;
    padding: 2px 5px 4px 2px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.brawler-card,
.gadget-card,
.starpower-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    min-width: 0;
    padding: 12px 8px 10px;
    color: #e2e8f0;
    text-align: center;
    background: linear-gradient(145deg, rgba(30, 48, 75, 0.92), rgba(10, 19, 36, 0.95));
    border: 1px solid rgba(148, 163, 184, 0.23);
    border-radius: 15px;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.brawler-card:hover,
.gadget-card:hover,
.starpower-card:hover {
    transform: translateY(-3px);
    border-color: rgba(56, 189, 248, 0.82);
    background: linear-gradient(145deg, rgba(24, 91, 130, 0.72), rgba(19, 34, 60, 0.97));
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.24), 0 0 0 2px rgba(56, 189, 248, 0.06);
}

.brawler-card img,
.gadget-card img,
.starpower-card img {
    display: block;
    width: clamp(44px, 4vw, 64px);
    height: clamp(44px, 4vw, 64px);
    object-fit: contain;
    pointer-events: none;
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.22));
}

.brawler-card span,
.gadget-card span,
.starpower-card span {
    display: block;
    width: 100%;
    color: #dbeafe;
    font-size: 11px;
    font-weight: 650;
    line-height: 1.25;
    text-align: center;
    overflow-wrap: anywhere;
}

.rating-option-unavailable {
    opacity: 0.44;
    cursor: not-allowed;
    filter: grayscale(0.75);
}

.rating-option-unavailable:hover {
    transform: none;
    border-color: rgba(148, 163, 184, 0.23);
    background: linear-gradient(145deg, rgba(30, 48, 75, 0.92), rgba(10, 19, 36, 0.95));
    box-shadow: none;
}

/* ===== GALERÍA DE FONDOS ===== */
/* El selector ocupa un poco más de espacio para que las vistas previas sean útiles. */
#bgGalleryModal .rating-modal-content {
    width: min(1160px, calc(100vw - 36px));
    max-width: 1160px !important;
    max-height: min(90vh, 980px);
}

.bg-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
    gap: 14px;
    max-height: 64vh;
    padding: 4px 6px 8px 4px;
    overflow-y: auto;
    overscroll-behavior: contain;
    contain: layout paint;
}

.bg-card-item {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    background: rgba(17, 31, 53, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 13px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
    transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.bg-card-item:hover {
    transform: translateY(-3px);
    border-color: var(--rating-accent);
    box-shadow: 0 12px 23px rgba(0, 0, 0, 0.27);
}

/* `contain` muestra la imagen entera sin recortarla ni deformarla. */
.bg-card-item img {
    display: block;
    width: 100%;
    height: 132px;
    padding: 5px;
    box-sizing: border-box;
    object-fit: contain;
    object-position: center;
    background: radial-gradient(ellipse at center, rgba(35, 55, 82, 0.8), #050b16 78%);
}

.bg-card-item span {
    display: block;
    min-height: 34px;
    padding: 8px 10px 10px;
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.3;
    text-align: center;
    overflow-wrap: anywhere;
}

.bg-card-item.bg-card-missing {
    opacity: 0.43;
    cursor: not-allowed;
}

.rating-warning-content {
    width: min(480px, 100%);
    color: #e2e8f0;
}

.rating-warning-content p {
    margin: 0;
    line-height: 1.55;
}

.rating-warning-list {
    margin: 0;
    padding: 12px 16px 12px 36px;
    color: #fecaca;
    font-weight: 650;
    line-height: 1.75;
    background: rgba(127, 29, 29, 0.22);
    border: 1px solid rgba(248, 113, 113, 0.28);
    border-radius: 13px;
}

.rating-warning-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.rating-view-container .btn {
    border-radius: 11px;
}

@keyframes ratingOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes ratingModalIn {
    from { opacity: 0; transform: translateY(10px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* =========================================================
   BUFFI · Botón de activación y marcos superpuestos
   Los marcos solo se muestran cuando Buffi está activo y hay
   un gadget, estelar o hipercarga real seleccionado.
   ========================================================= */
.rating-view-container .rating-buffi-toggle {
    display: inline-flex;
    flex: 0 0 56px;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-inline: clamp(4px, 0.8vw, 12px);
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: transparent;
    cursor: pointer;
    transition: transform 160ms ease, filter 160ms ease;
    -webkit-tap-highlight-color: transparent;
}

.rating-view-container .rating-buffi-toggle:hover {
    transform: translateY(-2px) scale(1.045);
    filter: brightness(1.08);
}

.rating-view-container .rating-buffi-toggle:focus-visible {
    outline: 3px solid var(--rating-accent, #ffd34e);
    outline-offset: 3px;
}

.rating-view-container .rating-buffi-toggle img {
    display: block;
    position: static !important;
    inset: auto !important;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.rating-workspace .rating-top-header .buffi-overlay-image {
    z-index: 5 !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 100ms ease;
}

.rating-workspace .rating-top-header .buffi-overlay-image.is-visible {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 760px) {
    .rating-view-container .rating-buffi-toggle {
        flex-basis: 46px;
        width: 46px;
        height: 46px;
        margin-inline: 0;
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .rating-grid-two-columns {
        grid-template-columns: minmax(0, 1fr);
        max-width: 760px;
        margin: 0 auto;
    }

    .rating-top-header {
        gap: 12px;
        padding: 14px 14px 34px;
    }

    .brawler-selector-trigger,
    .header-stacked-container {
        width: min(100%, 100px);
    }

    .competitive-master-row {
        grid-column: auto;
        width: 100%;
    }
}

@media (max-width: 560px) {
    .rating-view-container {
        width: calc(100% - 14px);
        margin: 12px auto;
        padding: 8px;
        border-radius: 16px;
    }

    .rating-workspace {
        gap: 14px;
        padding: 8px;
        border-radius: 13px;
    }

    .rating-top-header {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 6px;
        padding: 9px 6px 25px;
        border-radius: 13px;
    }

    .brawler-selector-trigger,
    .header-stacked-container {
        width: 100%;
        max-width: 64px;
    }

    .brawler-selector-trigger,
    .item-slot-btn-main {
        border-radius: 10px;
    }

    .brawler-selector-trigger::after,
    .header-stacked-container::after {
        bottom: -20px;
        font-size: 7px;
        letter-spacing: 0.025em;
    }

    .item-slot-btn-sub {
        border-radius: 8px;
    }

    .rating-row {
        gap: 7px;
        padding: 7px;
        border-radius: 11px;
    }

    .rating-item-info {
        flex-basis: 15%;
        border-radius: 8px;
    }

    .star-slot-btn {
        border-radius: 6px;
    }

    .rating-modal-overlay {
        align-items: flex-end;
        padding: 8px;
    }

    .rating-modal-content {
        max-height: 88vh;
        padding: 14px;
        gap: 12px;
        border-radius: 18px;
    }

    .rating-modal-header {
        gap: 9px;
    }

    .rating-modal-header h3 {
        flex: 1 1 100%;
        white-space: normal;
    }

    .brawler-grid,
    .gadget-grid,
    .starpower-grid {
        grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
        gap: 8px;
    }

    .brawler-card,
    .gadget-card,
    .starpower-card {
        padding: 9px 5px 8px;
        border-radius: 11px;
    }

    #bgGalleryModal .rating-modal-content {
        width: min(100%, calc(100vw - 16px));
        max-height: 90vh;
    }

    .bg-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
        gap: 9px;
        max-height: 58vh;
    }

    .bg-card-item img {
        height: 96px;
        padding: 4px;
    }

    .rating-warning-actions > .btn {
        flex: 1 1 100%;
        justify-content: center;
    }
}

/* =========================================================
   AJUSTE VISUAL · elementos internos sin marcos
   Mantiene la estructura general, pero elimina los cuadros
   que rodeaban cada Brawler, accesorio, modo y estrella.
   ========================================================= */
.rating-view-container .brawler-selector-trigger,
.rating-view-container .item-slot-btn-main,
.rating-view-container .item-slot-btn-sub,
.rating-view-container .rating-row,
.rating-view-container .rating-item-info,
.rating-view-container .star-slot-btn,
.rating-modal-content .brawler-card,
.rating-modal-content .gadget-card,
.rating-modal-content .starpower-card,
.rating-modal-content .bg-card-item {
    border: 0 !important;
    box-shadow: none !important;
}

/* Los espacios de selección muestran la imagen sin una tarjeta alrededor. */
.rating-view-container .brawler-selector-trigger,
.rating-view-container .item-slot-btn-main,
.rating-view-container .item-slot-btn-sub {
    background: transparent !important;
}

.rating-view-container .brawler-selector-trigger:hover,
.rating-view-container .item-slot-btn-main:hover,
.rating-view-container .item-slot-btn-sub:hover {
    border: 0 !important;
    box-shadow: none !important;
    filter: brightness(1.09);
}

/* Las filas de modos/rangos quedan limpias, sin una caja por categoría. */
.rating-view-container .rating-row {
    padding-inline: 0;
    background: transparent !important;
    border-radius: 0;
    transition: none;
}

.rating-view-container .rating-row:hover {
    transform: none;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

.rating-view-container .rating-item-info {
    background: transparent !important;
    border-radius: 8px;
}

/* Las estrellas se muestran como imágenes; solo reaccionan suavemente al cursor. */
.rating-view-container .star-slot-btn {
    background: transparent !important;
    border-radius: 6px;
    transition: transform 130ms ease, filter 130ms ease;
}

.rating-view-container .star-slot-btn:hover {
    transform: translateY(-1px) scale(1.045);
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    filter: brightness(1.12);
}

/* Opciones de los modales sin contornos persistentes. */
.rating-modal-content .brawler-card,
.rating-modal-content .gadget-card,
.rating-modal-content .starpower-card {
    background: rgba(255, 255, 255, 0.025) !important;
    border-radius: 10px;
    transition: background 150ms ease, transform 150ms ease;
}

.rating-modal-content .brawler-card:hover,
.rating-modal-content .gadget-card:hover,
.rating-modal-content .starpower-card:hover {
    transform: translateY(-2px);
    background: rgba(56, 189, 248, 0.11) !important;
    border: 0 !important;
    box-shadow: none !important;
}

.rating-modal-content .rating-option-unavailable:hover {
    border: 0 !important;
    box-shadow: none !important;
}

/* Las tarjetas de fondos también conservan la imagen sin marco. */
.rating-modal-content .bg-card-item {
    background: rgba(255, 255, 255, 0.025);
    border-radius: 10px;
}

.rating-modal-content .bg-card-item:hover {
    border: 0 !important;
    box-shadow: none !important;
    transform: translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
    .rating-view-container *,
    .rating-modal-overlay,
    .rating-modal-content {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}


/* ===== CORRECCIÓN DEFINITIVA DE MINIATURAS DE FONDOS =====
   El preview tiene una proporción panorámica fija; la imagen se contiene dentro
   sin estirarla. Estas reglas quedan al final para prevalecer sobre estilos anteriores. */
#bgGalleryModal .rating-modal-content {
    width: min(1260px, calc(100vw - 32px)) !important;
    max-width: 1260px !important;
}

#bgGalleryModal .bg-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
    gap: 16px !important;
    max-height: 66vh !important;
    padding: 8px !important;
}

#bgGalleryModal .bg-card-item {
    min-width: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    align-self: start !important;
}

#bgGalleryModal .bg-card-preview {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    aspect-ratio: 16 / 9 !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
    background: #050b16 !important;
    flex: 0 0 auto !important;
}

#bgGalleryModal .bg-card-preview > img.bg-card-thumbnail {
    display: block !important;
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 100% !important;
    max-height: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    object-fit: contain !important;
    object-position: center center !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    transform: none !important;
}

#bgGalleryModal .bg-card-item > span {
    min-height: 38px !important;
    flex: 0 0 auto !important;
}

@media (max-width: 680px) {
    #bgGalleryModal .rating-modal-content {
        width: calc(100vw - 16px) !important;
        max-width: none !important;
    }
    #bgGalleryModal .bg-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)) !important;
        gap: 10px !important;
        max-height: 58vh !important;
    }
}

/* Galería de fondos de Casual/Competitivo: usa la misma cuadrícula que el selector principal. */
#bgGalleryModal .rating-modal-content.main-bg-modal-content {
    width: min(1100px, 96vw) !important;
    max-width: 1100px !important;
    max-height: 90vh !important;
    gap: 16px !important;
    padding: 22px !important;
}

#bgGalleryModal .main-bg-gallery-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)) !important;
    gap: 12px !important;
    min-height: 150px;
    max-height: 52vh !important;
    padding: 3px 5px 5px 2px !important;
    overflow: auto !important;
    overscroll-behavior: contain;
    contain: layout paint;
}

#bgGalleryModal .main-bg-card {
    position: relative;
    min-width: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 7px !important;
    padding: 6px !important;
    text-align: center !important;
    color: #e2e8f0 !important;
    background: #1e293b !important;
    border: 2px solid #334155 !important;
    border-radius: 10px !important;
    cursor: pointer;
    box-shadow: none !important;
    transform: none;
}

#bgGalleryModal .main-bg-card:hover {
    transform: translateY(-2px) !important;
    border-color: #60a5fa !important;
    background: #1e293b !important;
}

#bgGalleryModal .main-bg-card.selected {
    border-color: #3b82f6 !important;
    background: #1d355f !important;
    box-shadow: 0 0 0 1px #3b82f6, 0 0 16px rgba(59, 130, 246, .2) !important;
}

#bgGalleryModal .main-bg-card img {
    display: block !important;
    position: static !important;
    width: 100% !important;
    height: 86px !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    max-height: none !important;
    flex: 0 0 86px !important;
    object-fit: cover !important;
    object-position: center !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 5px !important;
    background: #0f172a !important;
    transform: none !important;
}

#bgGalleryModal .main-bg-card span {
    display: block !important;
    width: 100% !important;
    min-height: 30px !important;
    flex: 0 0 auto !important;
    padding: 0 2px 2px !important;
    overflow: hidden !important;
    color: #e2e8f0 !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    text-align: center !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
}

#bgGalleryModal .main-bg-card.missing {
    opacity: .42 !important;
    cursor: not-allowed !important;
}

@media (max-width: 640px) {
    #bgGalleryModal .rating-modal-content.main-bg-modal-content {
        width: calc(100vw - 16px) !important;
        max-width: none !important;
        padding: 14px !important;
        gap: 12px !important;
    }
    #bgGalleryModal .main-bg-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(115px, 1fr)) !important;
        max-height: 55vh !important;
    }
}


/* =========================================================
   BUFFI · Ajuste visual solicitado
   Botón compacto dentro de las acciones y marcos centrados
   sobre gadgets, estelares e hipercarga.
   ========================================================= */
.rating-view-container .creator-header .creator-header-actions {
    display: flex;
    align-items: center;
    gap: clamp(6px, 0.7vw, 10px);
}

.rating-view-container .creator-header-actions .rating-buffi-toggle {
    display: inline-flex;
    flex: 0 0 44px !important;
    width: 44px !important;
    min-width: 44px;
    height: 44px !important;
    margin: 0 !important;
    padding: 3px !important;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    border: 1px solid rgba(186, 230, 253, 0.42) !important;
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(31, 52, 83, 0.96), rgba(5, 13, 31, 0.98)) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28),
                inset 0 1px 0 rgba(255, 255, 255, 0.12),
                0 0 0 2px rgba(56, 189, 248, 0.06) !important;
}

.rating-view-container .creator-header-actions .rating-buffi-toggle:hover {
    border-color: rgba(255, 211, 78, 0.9) !important;
    box-shadow: 0 0 0 3px rgba(255, 211, 78, 0.12),
                0 7px 16px rgba(0, 0, 0, 0.34),
                inset 0 1px 0 rgba(255, 255, 255, 0.14) !important;
    filter: brightness(1.08);
}

.rating-view-container .creator-header-actions .rating-buffi-toggle img {
    display: block;
    position: static !important;
    inset: auto !important;
    flex: 0 0 auto;
    width: 100% !important;
    height: 100% !important;
    max-width: none;
    max-height: none;
    object-fit: contain;
    padding: 0;
    margin: 0;
}

/* Los PNG transparentes de Buffi se centran por el centro del espacio,
   no por los bordes visibles de cada icono, que varían entre brawlers. */
.rating-workspace .rating-top-header .buffi-overlay-image {
    position: absolute !important;
    inset: auto !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    width: 112% !important;
    height: 112% !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    object-fit: contain !important;
    transform: translate(-50%, -50%) !important;
    transform-origin: center center;
    pointer-events: none;
}

.rating-workspace .rating-top-header .buffi-overlay-image.is-visible {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 760px) {
    .rating-view-container .creator-header-actions .rating-buffi-toggle {
        flex-basis: 40px !important;
        width: 40px !important;
        min-width: 40px;
        height: 40px !important;
    }
}

/* =========================================================
   AJUSTES DE TAMAÑO Y CENTRADO (Casual / Competitivo)
   ========================================================= */

/* Los cinco accesos de selección quedan más grandes tanto en pantalla
   como en la imagen exportada, ya que se captura el propio workspace. */
.rating-top-header {
    gap: clamp(10px, 1.8vw, 26px);
    padding: clamp(15px, 2vw, 26px) clamp(12px, 2vw, 28px) clamp(34px, 2.6vw, 40px);
}

.brawler-selector-trigger,
.header-stacked-container {
    width: min(100%, 148px);
}

/* Noqueo 5v5 es el único elemento de la última fila de Casual;
   ocupar ambas columnas hace que se centre en el espacio disponible. */
.casual-noqueo-5v5-row {
    grid-column: 1 / -1;
    width: min(100%, 800px);
    justify-self: center;
}

/* Masters debe ser la fila de mayor peso visual del menú Competitivo. */
.competitive-master-row {
    grid-column: 1 / -1;
    width: min(100%, 1040px);
    max-width: 100%;
    justify-self: center;
    gap: clamp(12px, 1.8vw, 24px);
    padding: clamp(10px, 1.3vw, 16px);
    border-color: rgba(255, 211, 78, 0.36);
    background: linear-gradient(135deg, rgba(20, 23, 43, 0.88), rgba(53, 42, 79, 0.78));
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 226, 130, 0.09);
}

.competitive-master-row .rating-item-info {
    flex: 0 0 clamp(100px, 18%, 178px);
    width: clamp(100px, 18%, 178px);
    max-width: 178px;
    min-width: 100px;
    border-radius: 15px;
    background: rgba(2, 6, 23, 0.58);
    box-shadow: inset 0 0 0 1px rgba(255, 211, 78, 0.22), 0 0 20px rgba(255, 211, 78, 0.06);
}

.competitive-master-row .rating-stars-group {
    gap: clamp(4px, 0.8vw, 11px);
    justify-content: center;
}

.competitive-master-row .star-slot-btn {
    flex: 1 1 0;
    max-width: 124px;
    min-width: 0;
    border-radius: 13px;
    border-color: rgba(255, 211, 78, 0.22);
    background: linear-gradient(145deg, rgba(51, 43, 67, 0.94), rgba(15, 18, 35, 0.92));
}

.competitive-master-row .star-slot-btn:hover {
    border-color: rgba(255, 226, 130, 0.9);
    box-shadow: 0 0 0 3px rgba(255, 211, 78, 0.1), 0 7px 16px rgba(0, 0, 0, 0.28);
}

@media (max-width: 900px) {
    .brawler-selector-trigger,
    .header-stacked-container {
        width: min(100%, 120px);
    }

    .casual-noqueo-5v5-row {
        grid-column: auto;
        width: 100%;
    }

    .competitive-master-row {
        grid-column: auto;
        width: 100%;
    }
}

@media (max-width: 560px) {
    .rating-top-header {
        gap: 6px;
        padding: 10px 6px 27px;
    }

    .brawler-selector-trigger,
    .header-stacked-container {
        width: min(100%, 70px);
    }

    .competitive-master-row {
        gap: 7px;
        padding: 7px;
    }

    .competitive-master-row .rating-item-info {
        flex: 0 0 18%;
        width: 18%;
        min-width: 0;
        max-width: none;
    }

    .competitive-master-row .rating-stars-group {
        gap: 3px;
    }

    .competitive-master-row .star-slot-btn {
        max-width: none;
        border-radius: 6px;
    }
}

