/* =========================================================
   BRAWL TIER LIST · ESTILO PRINCIPAL
   Interfaz arcade moderna, adaptable y con contraste alto
   ========================================================= */

:root {
    color-scheme: dark;
    --page-bg: #080d1a;
    --surface: rgba(15, 25, 44, 0.88);
    --surface-strong: rgba(10, 18, 34, 0.96);
    --line: rgba(148, 163, 184, 0.24);
    --line-bright: rgba(125, 211, 252, 0.4);
    --text-main: #f8fafc;
    --text-muted: #a9b7ca;
    --accent: #38bdf8;
    --accent-deep: #2563eb;
    --gold: #ffd34e;
    --danger: #fb5361;
    --radius-lg: 20px;
    --shadow-deep: 0 18px 48px rgba(0, 0, 0, 0.34);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
    scrollbar-color: #3b587a #0a1120;
}

body {
    min-height: 100vh;
    padding-bottom: 80px;
    color: var(--text-main);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--page-bg);
    background-image:
        linear-gradient(135deg, rgba(5, 10, 22, 0.8), rgba(6, 19, 39, 0.58)),
        url('Fondos/BrawlTierFondo.png');
    background-repeat: no-repeat, repeat;
    background-size: cover, auto;
    background-position: center, top left;
    background-attachment: fixed, fixed;
    line-height: 1.45;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
select,
label[for] {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(125, 211, 252, 0.95);
    outline-offset: 3px;
}

.hidden {
    display: none !important;
}

/* ===== BARRA SUPERIOR ===== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 12px clamp(14px, 2.6vw, 34px);
    background: rgba(7, 14, 28, 0.91);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
    -webkit-backdrop-filter: blur(18px) saturate(135%);
    backdrop-filter: blur(18px) saturate(135%);
}

.tier-header-logo {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    min-width: 0;
}

.topbar-logo {
    display: block;
    width: auto;
    max-width: min(230px, 24vw);
    max-height: 68px;
    object-fit: contain;
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.4));
}

.topbar-actions {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 9px 14px;
    color: #f8fafc;
    font-size: 14px;
    font-weight: 750;
    line-height: 1.25;
    text-align: center;
    border: 1px solid rgba(148, 163, 184, 0.27);
    border-radius: 11px;
    background: linear-gradient(145deg, #263852, #18263b);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 4px 10px rgba(0, 0, 0, 0.13);
    cursor: pointer;
    transition: transform 150ms ease, background 150ms ease, border-color 150ms ease, box-shadow 150ms ease, filter 150ms ease;
}

.btn:hover {
    transform: translateY(-2px);
    color: #fff;
    border-color: rgba(125, 211, 252, 0.5);
    background: linear-gradient(145deg, #344c6d, #203653);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.23);
}

.btn:active {
    transform: translateY(0) scale(0.98);
}

.btn.primary {
    border-color: rgba(96, 165, 250, 0.5);
    background: linear-gradient(135deg, #2877ed, #1852bf);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 4px 12px rgba(37, 99, 235, 0.19);
}

.btn.primary:hover {
    border-color: rgba(147, 197, 253, 0.92);
    background: linear-gradient(135deg, #3b8bff, #2563db);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.26);
}

.btn.danger {
    border-color: rgba(248, 113, 113, 0.45);
    background: linear-gradient(135deg, #dc3545, #a71930);
}

.btn.danger:hover,
.btn.active-delete {
    border-color: #fda4af;
    background: linear-gradient(135deg, #f04455, #be1d35);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.13), 0 8px 20px rgba(127, 29, 29, 0.24);
}

.btn.btn-block {
    width: 100%;
}

.btn.btn-sm {
    min-height: 30px;
    padding: 6px 9px;
    font-size: 12px;
}

/* Botones con iconos ilustrados (subir, guardar, eliminar, etc.). */
.btn-img {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 8px;
    color: white;
    border: 1px solid transparent;
    border-radius: 13px;
    background: transparent;
    cursor: pointer;
    outline: none;
    box-shadow: none;
    transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, filter 160ms ease;
}

.btn-img img {
    display: block;
    width: auto;
    height: 70px;
    max-width: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.24));
}

.btn-img-large img {
    height: 65px;
}

.btn-img:hover {
    transform: translateY(-3px);
    border-color: rgba(125, 211, 252, 0.25);
    background: rgba(56, 189, 248, 0.09);
    filter: brightness(1.08);
}

.btn-img:active {
    transform: scale(0.96);
}

/* ===== ÁREA DE TRABAJO ===== */
main {
    width: min(1520px, 96%);
    margin: clamp(18px, 2.5vw, 34px) auto;
}

#tierList {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.tier,
.unclassified-group {
    display: flex;
    min-height: 108px;
    margin-bottom: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(23, 36, 57, 0.94), rgba(9, 17, 32, 0.93));
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 9px 22px rgba(0, 0, 0, 0.17), inset 0 1px 0 rgba(255, 255, 255, 0.035);
    transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.tier:hover,
.unclassified-group:hover {
    border-color: rgba(125, 211, 252, 0.3);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.21), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.tier.dragging-group,
.unclassified-group.dragging-group,
.folder-wrapper.dragging-group {
    opacity: 0.48;
    border: 2px dashed var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16);
}

.folder-drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    padding: 4px;
}

#unclassifiedGroupsContainer.drag-over-folder {
    outline: 2px dashed var(--accent);
    outline-offset: 4px;
}

.tier-label {
    position: relative;
    isolation: isolate;
    display: flex;
    flex: 0 0 150px;
    align-items: center;
    justify-content: center;
    min-width: 110px;
    padding: 12px;
    color: #fff;
    text-align: center;
    background-color: #334155;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    cursor: pointer;
    user-select: none;
    transition: filter 180ms ease;
}

.tier-label::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.36));
    pointer-events: none;
}

.tier-label:hover {
    filter: brightness(1.12) saturate(1.08);
}

.tier-label span {
    z-index: 1;
    font-size: clamp(16px, 1.4vw, 20px);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: 0.025em;
    overflow-wrap: anywhere;
    text-shadow: 0 2px 3px rgba(0, 0, 0, 0.95), 0 0 12px rgba(0, 0, 0, 0.68);
}

.image-container {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    align-content: center;
    flex-wrap: wrap;
    gap: 10px 12px;
    min-width: 0;
    min-height: 108px;
    padding: 12px;
    background-image: radial-gradient(rgba(148, 163, 184, 0.10) 0.75px, transparent 0.75px);
    background-size: 13px 13px;
    transition: background-color 180ms ease;
}

.image-container.drag-over {
    background-color: rgba(56, 189, 248, 0.16);
    box-shadow: inset 0 0 0 2px rgba(56, 189, 248, 0.52);
}

.tier-actions {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px;
    background: rgba(2, 6, 23, 0.34);
    border-left: 1px solid rgba(148, 163, 184, 0.12);
}

.drag-handle {
    padding: 4px;
    color: #9fb0c6;
    font-size: 16px;
    cursor: grab !important;
    user-select: none;
}

.drag-handle:active {
    cursor: grabbing !important;
}

.btn-move-tier,
.btn-action-icon {
    padding: 5px 7px;
    color: #a8b7ca;
    font-size: 15px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    cursor: pointer;
    transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
}

.btn-move-tier:hover,
.btn-action-icon:hover {
    color: #fff;
    border-color: rgba(148, 163, 184, 0.16);
    background: rgba(255, 255, 255, 0.1);
}

.btn-delete-tier {
    padding: 5px 7px;
    color: #fb7185;
    font-size: 16px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    cursor: pointer;
    transition: color 140ms ease, background 140ms ease;
}

.btn-delete-tier:hover {
    color: #fff;
    background: rgba(239, 68, 68, 0.24);
}

/* ===== PINS ===== */
.img-wrapper {
    position: relative;
    display: inline-block;
    border-radius: 12px;
    user-select: none;
    cursor: grab;
    transition: filter 160ms ease;
}

.img-wrapper:active {
    cursor: grabbing;
}

.img-wrapper.dragging {
    opacity: 0.3;
}

.tier-image {
    display: block;
    width: 80px;
    height: 80px;
    object-fit: contain;
    border: 0;
    border-radius: 11px;
    background: transparent;
    user-select: none;
    pointer-events: none;
    transition: transform 160ms ease, filter 160ms ease;
}

.img-wrapper:hover .tier-image {
    transform: translateY(-2px) scale(1.06);
    filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.3));
}

.delete-badge {
    position: absolute;
    top: -7px;
    right: -7px;
    z-index: 10;
    display: none;
    width: 25px;
    height: 25px;
    color: #fff;
    font-size: 13px;
    font-weight: 900;
    line-height: 21px;
    text-align: center;
    background: var(--danger);
    border: 2px solid #0b1222;
    border-radius: 50%;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.36);
    cursor: pointer;
    pointer-events: auto;
}

body.delete-mode .delete-badge {
    display: block;
}

body.delete-mode .img-wrapper {
    cursor: pointer;
}

.img-wrapper.selected .tier-image {
    outline: 3px solid #fb5361;
    outline-offset: 1px;
    filter: brightness(0.58);
}

/* ===== GALERÍA / ZONA SIN CLASIFICAR ===== */
.unclassified-section {
    margin-top: 28px;
    padding: clamp(14px, 2vw, 24px);
    background: linear-gradient(145deg, rgba(15, 25, 44, 0.92), rgba(7, 14, 27, 0.92));
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-deep);
}

.unclassified-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.menu-header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

#sectionTitle {
    color: #fff;
    font-size: clamp(22px, 2.3vw, 30px);
    font-weight: 900;
    letter-spacing: -0.025em;
}

.editable-header-text {
    cursor: pointer;
    transition: color 160ms ease;
}

.editable-header-text:hover {
    color: #7dd3fc;
}

.unclassified-hint {
    margin: 8px 0 18px;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.55;
}

.toolbar-section {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 12px;
    background: rgba(2, 8, 20, 0.45);
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 16px;
}

.toolbar-section .btn-img {
    min-width: 62px;
    min-height: 62px;
}

.folder-content {
    min-height: 54px;
    border: 1px dashed transparent;
    border-radius: 12px;
    transition: border-color 160ms ease, background-color 160ms ease;
}

.folder-content.drag-over-folder {
    background-color: rgba(56, 189, 248, 0.12) !important;
    border-color: var(--accent);
}

/* ===== MODALES GENERALES ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.77);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.modal-overlay.hidden {
    display: none !important;
}

.modal-content {
    width: min(440px, 100%);
    max-height: 90vh;
    padding: 24px;
    overflow-y: auto;
    color: #f8fafc;
    background: linear-gradient(145deg, #1a2a42, #0c1526);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 18px;
    box-shadow: 0 24px 65px rgba(0, 0, 0, 0.5);
}

.modal-content.width-medium {
    width: min(480px, 100%);
}

.modal-content h3 {
    margin-bottom: 16px;
    color: #f8fafc;
    font-size: 22px;
}

.modal-content .form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 18px;
}

.modal-content label {
    font-weight: 700;
    color: #dbeafe;
}

.modal-content input[type="text"] {
    width: 100%;
    padding: 11px 13px;
    color: #fff;
    font-size: 16px;
    background: #050b16;
    border: 1px solid #435675;
    border-radius: 10px;
    outline: none;
}

.modal-content input[type="text"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

.modal-buttons {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.modal-buttons.flex-wrap {
    flex-wrap: wrap;
}

/* ===== MODAL PERSONALIZADO ===== */
.custom-modal-content {
    width: min(520px, 95vw);
    max-height: 90vh;
    overflow-y: auto;
    color: #fff;
    background: #091322;
    border: 1px solid rgba(125, 211, 252, 0.38);
    border-radius: 22px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.68);
}

.custom-modal-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 20px;
    text-align: center;
    background: linear-gradient(135deg, #344a69, #26354d);
    border-bottom: 1px solid rgba(125, 211, 252, 0.25);
}

.modal-header-icon {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.modal-field-icon {
    width: 26px;
    height: 26px;
    object-fit: contain;
    vertical-align: middle;
}

.modal-btn-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    vertical-align: middle;
}

.custom-modal-header h3 {
    margin: 0;
    color: #fff;
    font-size: clamp(20px, 3vw, 27px);
    font-weight: 900;
    letter-spacing: 0.025em;
    text-shadow: 0 2px 3px rgba(0, 0, 0, 0.42);
}

.custom-modal-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
}

.custom-modal-body .form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 0;
}

.custom-modal-body label {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #eaf2ff;
    font-size: 15px;
    font-weight: 800;
}

.custom-modal-body input[type="text"],
.custom-modal-body input[type="number"],
.custom-modal-body select {
    width: 100%;
    padding: 11px 13px;
    color: #fff;
    font-size: 15px;
    background: #040a14;
    border: 1px solid #2f435f;
    border-radius: 11px;
    outline: none;
}

.custom-modal-body input[type="text"]:focus,
.custom-modal-body input[type="number"]:focus,
.custom-modal-body select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

.custom-modal-body input[type="color"] {
    width: 100%;
    height: 44px;
    padding: 4px;
    background: #040a14;
    border: 1px solid #2f435f;
    border-radius: 11px;
    cursor: pointer;
}

.custom-file-upload {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    color: #eaf2ff;
    font-size: 15px;
    font-weight: 800;
    background: #091322;
    border: 1px dashed #516a8b;
    border-radius: 12px;
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease;
}

.custom-file-upload:hover {
    background: #13243c;
    border-color: var(--accent);
}

.preview-box-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 70px;
    padding: 8px;
    background: #040a14;
    border: 1px solid #2f435f;
    border-radius: 12px;
}

.modal-preview-box {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50px;
    padding: 10px 14px;
    background-size: cover;
    background-position: center;
    border-radius: 9px;
    box-sizing: border-box;
}

.modal-preview-box span {
    font-weight: 800;
    overflow-wrap: anywhere;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.custom-modal-footer {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
    margin-top: 4px;
}

.btn-custom {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    padding: 10px 7px;
    color: #fff;
    font-size: 14px;
    font-weight: 850;
    background: #081120;
    border: 1px solid #2f435f;
    border-radius: 11px;
    cursor: pointer;
    transition: transform 120ms ease, filter 150ms ease;
}

.btn-custom:hover {
    transform: translateY(-1px);
    filter: brightness(1.18);
}

.btn-custom.success {
    background: linear-gradient(135deg, #16a34a, #13763a);
    border-color: #22c55e;
}

.btn-custom.cancel {
    background: #334155;
    border-color: #475569;
}

.btn-custom.danger {
    background: linear-gradient(135deg, #b91c1c, #7f1d1d);
    border-color: #ef4444;
}

.duplicate-preview-grid {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    margin: 15px 0;
    padding: 10px 0;
}

.duplicate-preview-grid img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    background: rgba(2, 6, 23, 0.65);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.delete-action-bar {
    position: fixed;
    bottom: 18px;
    left: 50%;
    z-index: 1500;
    display: flex;
    align-items: center;
    gap: 14px;
    width: max-content;
    max-width: calc(100vw - 24px);
    padding: 12px 20px;
    color: #fff;
    background: rgba(18, 28, 45, 0.96);
    border: 1px solid rgba(248, 113, 113, 0.78);
    border-radius: 999px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
    transform: translateX(-50%);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.delete-action-bar.hidden {
    display: none !important;
}

footer {
    padding: 25px;
    color: #8b9bb0;
    font-size: 13px;
    text-align: center;
}

/* Oculta visualmente el título conservando su lectura accesible. */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== ADAPTACIÓN A PANTALLAS PEQUEÑAS ===== */
@media (max-width: 1250px) {
    .topbar {
        align-items: flex-start;
    }

    .topbar-logo {
        max-width: 190px;
    }

    .topbar-actions {
        gap: 7px;
    }

    .topbar-actions .btn {
        min-height: 37px;
        padding: 8px 10px;
        font-size: 12px;
    }
}

@media (max-width: 850px) {
    .topbar {
        position: relative;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px 14px;
    }

    .tier-header-logo {
        justify-content: center;
    }

    .topbar-logo {
        max-width: min(240px, 68vw);
        max-height: 58px;
    }

    .topbar-actions {
        justify-content: center;
    }

    .topbar-actions .btn {
        flex: 1 1 auto;
    }

    main {
        width: calc(100% - 18px);
        margin: 16px auto;
    }

    .tier,
    .unclassified-group {
        min-height: 90px;
        border-radius: 12px;
    }

    .tier-label {
        flex-basis: 112px;
        min-width: 94px;
        padding: 8px;
    }

    .image-container {
        gap: 8px;
        min-height: 90px;
        padding: 8px;
    }

    .tier-image {
        width: 66px;
        height: 66px;
    }

    .btn-img img {
        height: 60px;
    }

    .btn-img-large img {
        height: 60px;
    }

    .toolbar-section {
        justify-content: center;
    }

    .unclassified-header {
        align-items: stretch;
    }

    .menu-header-right {
        justify-content: flex-start;
    }
}

@media (max-width: 560px) {
    body {
        padding-bottom: 90px;
        background-attachment: scroll, scroll;
    }

    .topbar-actions .btn {
        flex: 1 1 calc(50% - 8px);
        min-width: 0;
    }

    .topbar-actions .btn-img {
        flex: 0 0 auto;
    }

    .tier,
    .unclassified-group {
        min-height: 82px;
        margin-bottom: 8px;
    }

    .tier-label {
        flex-basis: 82px;
        min-width: 76px;
        padding: 6px;
    }

    .tier-label span {
        font-size: 14px;
    }

    .tier-actions {
        gap: 2px;
        padding: 4px;
    }

    .btn-move-tier,
    .btn-action-icon,
    .btn-delete-tier {
        padding: 4px;
        font-size: 13px;
    }

    .image-container {
        gap: 5px;
        min-height: 82px;
        padding: 6px;
    }

    .tier-image {
        width: 54px;
        height: 54px;
    }

    .img-wrapper {
        border-radius: 8px;
    }

    .delete-badge {
        width: 21px;
        height: 21px;
        line-height: 17px;
    }

    .unclassified-section {
        margin-top: 18px;
        padding: 12px;
        border-radius: 15px;
    }

    #sectionTitle {
        font-size: 22px;
    }

    .menu-header-right > * {
        flex: 1 1 100%;
        width: 100%;
    }

    .toolbar-section {
        gap: 4px;
        padding: 7px;
    }

    .toolbar-section .btn-img {
        min-width: 48px;
        min-height: 50px;
        padding: 5px;
    }

    .btn-img img,
    .btn-img-large img {
        height: 50px;
    }

    .custom-modal-footer {
        grid-template-columns: 1fr;
    }

    .delete-action-bar {
        bottom: 8px;
        gap: 8px;
        padding: 10px 13px;
        border-radius: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Controles complementarios para exportación y recuperación local */
.export-resolution-control {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 5px 9px;
    border: 1px solid rgba(148, 163, 184, .25);
    border-radius: 10px;
    background: rgba(2, 8, 20, .45);
    color: #cbd5e1;
    font-size: 11px;
    font-weight: 700;
}
.export-resolution-control select {
    min-width: 115px;
    color: #f8fafc;
    background: #172033;
    border: 1px solid #475569;
    border-radius: 7px;
    padding: 5px 8px;
    font: inherit;
    font-size: 12px;
}
.brawl-history-modal { z-index: 5100; padding: 16px; }
.brawl-history-card { width: min(860px, 96vw); max-height: 88vh; overflow: auto; }
.brawl-history-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.brawl-history-heading h2 { margin: 0 0 5px; }
.brawl-history-heading p, .brawl-history-warning { color: #94a3b8; line-height: 1.45; }
.brawl-history-warning { border: 1px solid rgba(251, 191, 36, .32); background: rgba(120, 53, 15, .18); border-radius: 10px; padding: 10px 12px; }
.brawl-history-list { display: grid; gap: 10px; }
.brawl-history-entry { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 13px; border-radius: 12px; border: 1px solid #334155; background: rgba(15, 23, 42, .72); }
.brawl-history-meta { display: grid; gap: 5px; min-width: 0; }
.brawl-history-meta strong { color: #f8fafc; }
.brawl-history-meta span { color: #94a3b8; font-size: 12px; }
.brawl-history-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.brawl-history-empty { color: #cbd5e1; padding: 24px; text-align: center; border: 1px dashed #475569; border-radius: 12px; }
.brawl-history-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; }
@media (max-width: 720px) {
    .brawl-history-entry { align-items: stretch; flex-direction: column; }
    .brawl-history-actions { justify-content: stretch; }
    .brawl-history-actions .btn { flex: 1; }
    .export-resolution-control { align-items: stretch; }
}


/* ===== Biblioteca personal de Pins ===== */
.img-wrapper.pin-library-item {
    display: flex;
    flex: 0 0 122px;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 122px;
    max-width: 100%;
    padding: 7px;
    border: 1px solid rgba(129, 140, 248, .32);
    border-radius: 12px;
    background: linear-gradient(160deg, rgba(30, 41, 59, .88), rgba(15, 23, 42, .92));
    box-shadow: 0 5px 14px rgba(0, 0, 0, .16);
    cursor: grab;
}
.img-wrapper.pin-library-item .tier-image {
    width: 96px;
    height: 96px;
    max-width: 100%;
    object-fit: contain;
}
.pin-library-name {
    display: block;
    width: 100%;
    overflow: hidden;
    color: #e2e8f0;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.25;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pin-library-controls {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
    width: 100%;
}
.pin-library-btn {
    min-width: 0;
    min-height: 27px;
    padding: 3px 0;
    color: #e2e8f0;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    background: rgba(51, 65, 85, .82);
    border: 1px solid rgba(148, 163, 184, .25);
    border-radius: 6px;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.pin-library-btn:hover {
    background: rgba(59, 130, 246, .35);
    border-color: rgba(96, 165, 250, .75);
    transform: translateY(-1px);
}
.pin-library-btn[data-action="delete"]:hover {
    background: rgba(220, 38, 38, .35);
    border-color: rgba(248, 113, 113, .8);
}
.pin-library-controls, .pin-library-controls * { cursor: pointer; }
.pin-library-item .delete-badge { top: 2px; right: 2px; }
.pin-preview-overlay {
    position: fixed;
    z-index: 7000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(2, 6, 23, .82);
    backdrop-filter: blur(8px);
}
.pin-preview-overlay[hidden] { display: none !important; }
.pin-preview-card {
    width: min(520px, 94vw);
    max-height: 92vh;
    overflow: auto;
    padding: 18px;
    color: #e2e8f0;
    background: linear-gradient(145deg, #172033, #0b1222);
    border: 1px solid rgba(148, 163, 184, .35);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .5);
}
.pin-preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.pin-preview-heading h2 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.pin-preview-close { width: 34px; height: 34px; border-radius: 9px; color: #f8fafc; background: #334155; border: 1px solid #475569; cursor: pointer; }
.pin-preview-image-wrap {
    display: grid;
    place-items: center;
    min-height: 220px;
    padding: 18px;
    border: 1px solid #334155;
    border-radius: 12px;
    background-color: #101827;
    background-image: linear-gradient(45deg, #1b2638 25%, transparent 25%), linear-gradient(-45deg, #1b2638 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #1b2638 75%), linear-gradient(-45deg, transparent 75%, #1b2638 75%);
    background-size: 20px 20px;
}
.pin-preview-image { display: block; width: min(340px, 72vw); height: min(340px, 55vh); object-fit: contain; image-rendering: auto; }
.pin-preview-hint { color: #94a3b8; font-size: 12px; margin: 12px 0 0; }
.export-resolution-preview {
    display: block;
    max-width: 160px;
    color: #93c5fd;
    font-size: 10px;
    font-weight: 650;
    line-height: 1.25;
    overflow-wrap: anywhere;
    white-space: pre-line;
}
.export-resolution-control { min-width: 130px; }
.export-resolution-control:has(#exportScaleSelect) { align-items: stretch; }
#exportImageBtn:disabled { opacity: .72; cursor: progress; }
@media (max-width: 760px) {
    .export-resolution-preview { max-width: 100%; }
    .img-wrapper.pin-library-item { flex-basis: 108px; width: 108px; }
    .img-wrapper.pin-library-item .tier-image { width: 82px; height: 82px; }
}
