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

:root {
    --bg-main: #000000;
    --bg-secondary: #0a0a0f;
    --bg-card: #0d0d15;
    --highlight: #00B7FF;
    --electric: #0077B6;
    --energy: #00FFF6;
    --metallic: #1a1a24;
    --blood-red: #8B0000;
    --death-purple: #4B0082;
    --text-light: #8a9ba8;
    --text-disabled: #4a4a5a;

    --border-grey: #6c757d;
    --border-blue: #0d6efd;
    --border-yellow: #ffd700;
    --border-purple: #6f42c1;
    --border-red: #dc3545;

    --glow-cyan: 0 0 15px rgba(0, 183, 255, 0.3);
    --glow-death: 0 0 20px rgba(139, 0, 0, 0.4);
    --shadow-deep: 0 8px 40px rgba(0, 0, 0, 0.95);

    /* Z-Index Layers */
    --z-background: 0;
    --z-card: 10;
    --z-card-hover: 100;
    --z-header: 3000;
    --z-modal: 30000;
    --z-mobile-bar: 20000;
    --z-tooltip: 99999;

    /* Backgrounds */
    --bg-glass: rgba(15, 15, 25, 0.4);
    --bg-glass-strong: rgba(10, 10, 15, 0.95);

    /* Card Scale for dynamic sizing */
    --card-scale: 1;

    --font-title: 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    background: var(--bg-main);
    background-image: url('public/bg.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    color: var(--text-light);
    overflow-x: hidden;
    position: relative;
    font-size: 18px;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(139, 0, 0, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 183, 255, 0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: var(--z-background);
    pointer-events: none;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(to bottom, rgba(0, 0, 0, 0.8) 0%, transparent 15%),
        linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 15%),
        radial-gradient(ellipse at center, transparent 0%, rgba(0, 0, 0, 0.9) 100%);
    z-index: var(--z-background);
    pointer-events: none;
}

/* LOADING SCREEN STYLES */
#loadingScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    transition: opacity 0.5s ease-out;
}

#loadingScreen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-logo {
    max-width: 400px;
    width: 80%;
    height: auto;
    margin-bottom: 3rem;
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

.loading-bar-container {
    width: 500px;
    max-width: 80%;
    height: 40px;
    background: var(--bg-secondary);
    border: 2px solid var(--highlight);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    box-shadow: var(--glow-cyan);
}

.loading-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--electric) 0%, var(--highlight) 50%, var(--energy) 100%);
    background-size: 200% 100%;
    animation: loadingGradient 2s ease-in-out infinite;
    transition: width 0.3s ease-out;
    position: relative;
}

.loading-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.3) 50%,
            transparent 100%);
    animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes loadingGradient {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(200%);
    }
}

.loading-text {
    margin-top: 2rem;
    font-family: var(--font-title);
    font-size: 1.5rem;
    color: var(--highlight);
    text-align: center;
    text-shadow: 0 0 10px rgba(0, 183, 255, 0.5);
    animation: textPulse 2s ease-in-out infinite;
}

@keyframes textPulse {

    0%,
    100% {
        opacity: 0.8;
    }

    50% {
        opacity: 1;
        text-shadow: 0 0 20px rgba(0, 183, 255, 0.8);
    }
}

.loading-percentage {
    margin-top: 1rem;
    font-family: var(--font-body);
    font-size: 1.2rem;
    color: var(--text-light);
}

.layout {
    display: flex;
    position: relative;
    z-index: 1;
}

/* SIDEBAR FIJA */
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    width: 550px;
    padding: 1.5rem;
    background: var(--bg-glass);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    overflow-y: auto;
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow-deep);
}

.sidebar-title {
    font-family: var(--font-title);
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    background: linear-gradient(135deg, var(--highlight), var(--energy));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    text-align: left;
}

.language-selector {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

/* Hide the language selector outside Settings panel */
.sidebar>.language-selector {
    display: none;
}

.lang-btn {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 183, 255, 0.3);
    color: var(--text-light);
    padding: 0.4rem 1rem;
    border-radius: 4px;
    font-family: var(--font-title);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
    text-transform: uppercase;
}

.lang-btn:hover {
    background: rgba(0, 183, 255, 0.2);
    border-color: var(--highlight);
    filter: brightness(1.2);
    box-shadow: 0 0 10px rgba(0, 183, 255, 0.3);
}

.lang-btn.active {
    background: var(--highlight);
    border-color: var(--highlight);
    color: black;
    box-shadow: var(--glow-cyan);
}

.controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tier-selector {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-family: var(--font-title);
    margin-bottom: 1rem;
}

.tier-selector label {
    color: #FFFFFF;
    font-weight: 700;
    font-size: 1.15rem;
    text-align: center;
    letter-spacing: 0.05em;
    text-shadow: 0 0 8px rgba(0, 200, 255, 0.9);
    background: rgba(0, 0, 0, 0.4);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(0, 183, 255, 0.3);
}

#tierCapDisplay {
    font-family: 'Rajdhani', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    color: #00E5FF;
    text-shadow: 0 0 6px rgba(0, 229, 255, 0.8);
    letter-spacing: 0.08em;
}

.tier-buttons {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.4rem;
}

.tier-btn {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 183, 255, 0.3);
    color: var(--text-light);
    padding: 0.5rem;
    border-radius: 6px;
    font-family: var(--font-title);
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

.tier-btn:hover {
    background: rgba(0, 183, 255, 0.2);
    border-color: var(--highlight);
    filter: brightness(1.2);
    box-shadow: 0 0 10px rgba(0, 183, 255, 0.3);
}

.tier-btn.active {
    background: var(--highlight);
    border-color: var(--highlight);
    color: black;
    font-weight: 700;
    box-shadow: var(--glow-cyan);
}

.btn-reset {
    background: linear-gradient(135deg, var(--blood-red), #c0392b);
    color: white;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    box-shadow: var(--glow-death);
}

.btn-reset:hover {
    filter: brightness(1.15);
    box-shadow: 0 0 15px rgba(139, 0, 0, 0.6);
}

/* UNDO/REDO BUTTONS */
.btn-undo-redo {
    background: linear-gradient(135deg, var(--electric), var(--highlight));
    color: white;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    box-shadow: var(--glow-cyan);
    transition: all 0.2s ease;
}

.btn-undo-redo:hover:not(:disabled) {
    filter: brightness(1.15);
    box-shadow: 0 0 20px rgba(0, 183, 255, 0.6);
}

.btn-undo-redo:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: linear-gradient(135deg, #333, #555);
    box-shadow: none;
}

/* TIER SELECTOR BUTTON */
.btn-tier-selector {
    width: 100%;
    background: linear-gradient(135deg, rgba(0, 183, 255, 0.2), rgba(0, 119, 182, 0.3));
    color: var(--highlight);
    border: 1px solid rgba(0, 183, 255, 0.3);
    padding: 0.75rem 1.2rem;
    border-radius: 8px;
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: background-image 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.btn-tier-selector:hover {
    background: linear-gradient(135deg, rgba(0, 183, 255, 0.3), rgba(0, 119, 182, 0.4));
    box-shadow: 0 6px 15px rgba(0, 183, 255, 0.5);
    filter: brightness(1.15);
}

.btn-tier-selector #tierCapDisplay {
    color: var(--energy);
    font-weight: 900;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0066cc, #0088ff);
    border-radius: 18px;
    transition: width 0.5s ease, background 0.5s ease, box-shadow 0.5s ease;
    box-shadow: 0 0 15px rgba(0, 136, 255, 0.4);
    z-index: 1;
}

.progress-fill.blue {
    background: linear-gradient(90deg, #0066cc, #0088ff);
    box-shadow: 0 0 15px rgba(0, 136, 255, 0.4);
}

.progress-fill.green {
    background: linear-gradient(90deg, #00cc44, #00ff55);
    box-shadow: 0 0 15px rgba(0, 255, 85, 0.4);
}

.progress-fill.yellow {
    background: linear-gradient(90deg, #ccaa00, #ffdd00);
    box-shadow: 0 0 15px rgba(255, 221, 0, 0.4);
}

.progress-fill.orange {
    background: linear-gradient(90deg, #cc6600, #ff8800);
    box-shadow: 0 0 15px rgba(255, 136, 0, 0.4);
}

.progress-fill.red {
    background: linear-gradient(90deg, #cc0000, #ff3333);
    box-shadow: 0 0 15px rgba(255, 51, 51, 0.5);
}

.progress-fill.danger {
    background: linear-gradient(90deg, #8B0000, #ff0000);
    animation: blink-red 1.5s ease-in-out infinite;
}

@keyframes blink-red {

    0%,
    100% {
        box-shadow: 0 0 30px rgba(255, 0, 0, 1), 0 0 60px rgba(255, 0, 0, 0.8), 0 0 90px rgba(255, 0, 0, 0.4);
    }

    50% {
        box-shadow: 0 0 15px rgba(255, 0, 0, 0.5), 0 0 30px rgba(255, 0, 0, 0.3), 0 0 45px rgba(255, 0, 0, 0.1);
    }
}

/* SELECTOR DE PERSONAJE - 3 SLOTS */
.character-selector {
    margin-bottom: 1.5rem;
}

/* Nombre del personaje activo */
/* CHARACTER SLOTS (3 bars) */
.character-slots {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.character-slot {
    position: relative;
    width: 100%;
    height: 75px;
    /* Default: empty or inactive state */
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(0, 183, 255, 0.3);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Active slot with character - full size */
.character-slot.active.has-character {
    height: 145px;
}

.character-slot:hover {
    border-color: var(--highlight);
    box-shadow: var(--glow-cyan);
}

.character-slot.active {
    border-color: var(--energy);
    box-shadow: 0 0 20px rgba(0, 255, 246, 0.6);
}

/* Slot 1: Blue theme */
.character-slot[data-slot="0"] {
    --slot-color: rgba(0, 119, 182, 0.3);
    --slot-progress: rgba(0, 119, 182, 0.6);
}

/* Slot 2: Cyan theme */
.character-slot[data-slot="1"] {
    --slot-color: rgba(0, 183, 255, 0.3);
    --slot-progress: rgba(0, 183, 255, 0.6);
}

/* Slot 3: Purple theme */
.character-slot[data-slot="2"] {
    --slot-color: rgba(75, 0, 130, 0.3);
    --slot-progress: rgba(75, 0, 130, 0.6);
}

.slot-portrait {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    transition: opacity 0.3s ease, filter 0.3s ease;
}

/* Active slot - portrait fully visible */
.character-slot.active.has-character .slot-portrait {
    opacity: 1;
    filter: none;
}

/* Inactive slot with character - portrait compressed and darkened */
.character-slot:not(.active).has-character .slot-portrait {
    opacity: 0.6;
    filter: brightness(0.5);
}

/* Dark gradient overlay for text readability */
.character-slot.has-character::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 60%;
    height: 100%;
    background: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.65) 100%);
    z-index: 1;
    pointer-events: none;
}

.slot-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 25px;
    /* Visible progress bar at bottom when has character and active */
    width: 0%;
    background: var(--slot-progress);
    transition: width 0.5s ease, height 0.3s ease;
    z-index: 1;
}

/* Empty slot - no progress bar visible */
.character-slot:not(.has-character) .slot-progress {
    display: none;
}

/* Inactive slot with character - progress bar fills entire height */
.character-slot:not(.active).has-character .slot-progress {
    height: 100%;
}

.slot-center-text {
    position: relative;
    z-index: 2;
    font-family: var(--font-title);
    font-size: 0.65rem;
    /* Reduced size for empty slots */
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
    text-transform: uppercase;
}

/* When slot has character and is ACTIVE, position text at bottom */
.character-slot.active.has-character .slot-center-text {
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.2rem;
}

/* When slot has character but is INACTIVE, show text in center aligned with indicators */
.character-slot:not(.active).has-character .slot-center-text {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    font-size: 0.9rem;
}

.slot-indicators {
    position: absolute;
    top: 8px;
    right: 12px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Ocultar indicadores cuando el slot no tiene personaje */
.character-slot:not(.has-character) .slot-indicators {
    display: none;
}

.indicator-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-title);
    font-size: 0.65rem;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
}

.indicator-bulb {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #666;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.indicator-bulb.green {
    background: #28a745;
    box-shadow: 0 0 8px rgba(40, 167, 69, 0.8);
}

.indicator-bulb.red {
    background: var(--blood-red);
    box-shadow: 0 0 8px rgba(139, 0, 0, 0.8);
}

.indicator-bulb.grey {
    background: #666;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

/* CHARACTER PICKER MODAL */
.character-picker-content {
    max-width: 2400px !important;
    width: 95% !important;
    max-height: 85vh;
    overflow-y: auto;
}

.character-picker-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 1rem;
    justify-content: center;
    align-items: flex-start;
}

.character-picker-item {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    width: 300px;
    height: 105px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid rgba(0, 183, 255, 0.3);
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
}

.picker-portrait {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: left center;
    z-index: 0;
}

/* Degradado oscuro en la parte inferior para legibilidad del nombre */
.character-picker-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.5) 50%, rgba(0, 0, 0, 0) 100%);
    z-index: 1;
    pointer-events: none;
}

.picker-name {
    position: relative;
    z-index: 2;
    font-family: var(--font-title);
    font-size: 0.95rem;
    font-weight: 700;
    color: #FFFFFF;
    text-align: center;
    text-transform: uppercase;
    padding: 0.75rem 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9), 0 0 4px rgba(0, 0, 0, 0.8);
}

.character-picker-item:hover {
    border-color: var(--highlight);
    box-shadow: var(--glow-cyan);
    filter: brightness(1.1);
}

.character-picker-item:hover::after {
    background: linear-gradient(to top, rgba(0, 183, 255, 0.4) 0%, rgba(0, 183, 255, 0.2) 50%, rgba(0, 0, 0, 0) 100%);
}

.character-picker-item.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    filter: grayscale(100%);
}

.character-picker-item.disabled:hover {
    transform: none;
    box-shadow: none;
}

.character-picker-item.selected {
    border-color: var(--energy);
    box-shadow: 0 0 15px rgba(0, 255, 246, 0.6);
}

.character-picker-item.selected::after {
    background: linear-gradient(to top, rgba(0, 100, 120, 0.8) 0%, rgba(0, 183, 255, 0.4) 50%, rgba(0, 0, 0, 0) 100%);
}

/* Responsive adjustments */
@media (max-width: 1400px) {
    .character-picker-item {
        width: 280px;
        height: 100px;
    }
}


@media (max-width: 768px) {
    .character-picker-item {
        width: 240px;
        height: 90px;
    }

    .picker-name {
        font-size: 0.85rem;
        padding: 0.6rem 0.8rem;
    }
}

@media (max-width: 480px) {
    .character-picker-item {
        width: 100%;
        max-width: 320px;
        height: 85px;
    }

    .picker-name {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }
}

/* SAVE DATA */
.save-data {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--metallic);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.save-data h3 {
    font-family: var(--font-title);
    font-size: 0.9rem;
    color: var(--highlight);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
}

.save-data-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.save-data-item label {
    font-size: 0.85rem;
    color: var(--text-light);
}

.save-data-item .value {
    font-family: var(--font-title);
    font-size: 1rem;
    font-weight: 700;
    color: var(--highlight);
}

.save-data-item input[type="number"] {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 183, 255, 0.3);
    color: var(--text-light);
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    font-family: var(--font-title);
    width: 60px;
    text-align: center;
}

/* PANEL DE CARTAS */
.main-content {
    flex: 1;
    padding: 0;
    overflow-y: auto;
    overflow-x: visible;
    height: 100vh;
}

.cards-header {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 1.5rem;
    background: var(--bg-glass);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    backdrop-filter: blur(16px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
}

.header-right {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-add-card {
    background: linear-gradient(135deg, var(--highlight), var(--electric));
    color: black;
    border: none;
    padding: 0.75rem 1.5rem;
    width: auto;
    height: auto;
    border-radius: 8px;
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--glow-cyan);
    transition: box-shadow 0.3s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-align: center;
    white-space: nowrap;
}

.btn-add-card:hover {
    box-shadow: 0 6px 15px rgba(0, 183, 255, 0.5), var(--glow-cyan);
    filter: brightness(1.15);
}

/* BOTÓN FILTRAR CARTAS REMOVIDAS */
.btn-filter {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.btn-filter:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    filter: brightness(1.15);
}

.btn-filter.active {
    background: var(--blood-red);
    border-color: var(--blood-red);
    color: white;
    box-shadow: 0 0 15px rgba(255, 74, 107, 0.6);
}

/* FILTRO: Ocultar cartas removidas */
body.filter-removed .card-slot.removed,
body.filter-removed .card-slot.remove-tagged,
body.filter-removed .card-slot.remove-fated {
    opacity: 0.1;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* COMPACT MODE STYLES - Dynamic padding based on slider */
.layout {
    transition: padding 0.3s ease;
}

/* Compact mode: vertical button layout when padding > 0 */
body.compact-mode .header-left {
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
}

body.compact-mode .btn-add-card,
body.compact-mode .btn-filter-removed {
    width: 100%;
}

body.compact-mode .bonus-buttons {
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
}

body.compact-mode .bonus-btn {
    width: 100%;
}

/* SETTINGS BUTTON & PANEL */
.settings-container {
    margin-bottom: 1.5rem;
}

.btn-settings {
    width: 100%;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    color: var(--highlight);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.75rem 1.2rem;
    border-radius: 8px;
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: background-image 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-settings:hover {
    filter: brightness(1.2);
    box-shadow: 0 6px 15px rgba(0, 183, 255, 0.5);
}

.btn-settings .settings-icon {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.btn-settings.active .settings-icon {
    transform: rotate(45deg);
}

.settings-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(13, 13, 21, 0.5);
    border-radius: 8px;
    margin-top: 1rem;
}

.settings-panel.open {
    max-height: 600px;
}

.settings-panel-content {
    padding: 1rem;
}

/* BOTONES DE BONIFICACIÓN */
.bonus-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-bonus {
    padding: 0.6rem 1.2rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: capitalize;
    white-space: nowrap;
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    color: white;
}

.btn-bonus:hover {
    filter: brightness(1.2);
}

.btn-bonus.available {
    background: #28a745;
    color: white;
    box-shadow: 0 0 15px rgba(40, 167, 69, 0.7), 0 0 30px rgba(40, 167, 69, 0.4);
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 15px rgba(40, 167, 69, 0.7), 0 0 30px rgba(40, 167, 69, 0.4);
    }

    50% {
        box-shadow: 0 0 25px rgba(40, 167, 69, 1), 0 0 50px rgba(40, 167, 69, 0.6);
    }
}

.btn-bonus.used {
    background: #6c757d;
    color: #999;
    cursor: not-allowed;
    opacity: 0.5;
}


/* BARRA DE PROGRESO EN HEADER */
.points-bar-header {
    width: 100%;
}


.points-label-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    /* Large space around the separator | */
    font-family: var(--font-title);
    font-size: 0.85rem;
    font-weight: 800;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    pointer-events: none;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000, 0 0 4px rgba(0, 0, 0, 0.9);
}

.header-group {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    /* Tight spacing INSIDE the groups */
}

.points-label-header .separator {
    font-size: 1.4rem;
    font-weight: 300;
    opacity: 0.5;
    margin-top: -2px;
    /* Visual center tweak */
}

.points-label-header .tooltip-trigger {
    pointer-events: auto;
    cursor: help;
}

.points-label-header .label-text {
    margin-right: 0.5rem;
    color: var(--text-light);
}

.points-label-header .value {
    color: var(--highlight);
    font-size: 1.1rem;
    font-weight: 700;
}

.card-count-active {
    color: #00ff7f;
    font-weight: 700;
}

.points-label-header,
.points-label-header .value,
.card-count-active {
    text-shadow:
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000,
        0 0 5px rgba(0, 0, 0, 0.9);
    /* Glow negro para profundidad */
    font-weight: 800;
    /* Make it bolder to read better */
}

.progress-container-header {
    width: 100%;
    height: 35px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--metallic);
    position: relative;
}

/* GRID DE CARTAS - TAMAÑO DINÁMICO */
.cards-grid {
    display: grid;
    /* Auto-fill columns based on card width */
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
    padding: 1.5rem;
    overflow: visible;
}

/* CARD SLOT - IMAGEN COMO BACKGROUND */
.card-slot {
    position: relative;
    aspect-ratio: 2 / 3;
    overflow: visible;
    border-radius: 16px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: rgba(13, 13, 21, 0.8);
    background-clip: padding-box;
    border: 3px solid;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-deep);
    transition: box-shadow 0.3s ease, z-index 0s 0.3s;
    /* z-index: 1; */
}

.card-slot:hover {
    /* NO transform */
    /* NO margin change */
    z-index: var(--z-card-hover);
    box-shadow: 0 0 25px var(--highlight);
    /* Just a stronger glow */
    border-color: var(--highlight);
}

/* DEGRADADO INFERIOR PARA VER BOTONES */
.card-slot::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.98), rgba(0, 0, 0, 0.7) 50%, transparent);
    pointer-events: none;
    z-index: 0;
    border-bottom-left-radius: 13px;
    border-bottom-right-radius: 13px;
}

/* DEGRADADO SUPERIOR PARA VER NOMBRE DE LA CARTA */
.card-slot::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 25px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.4) 50%, transparent);
    pointer-events: none;
    z-index: 0;
    border-top-left-radius: 13px;
    border-top-right-radius: 13px;
}

/* COLORES DE BORDE SEGÚN TIPO */
.card-slot.border-grey {
    box-shadow: inset 0 0 15px var(--border-grey);
    border-color: var(--border-grey);
    border-width: 3px;
}

.card-slot.border-blue {
    box-shadow: inset 0 0 15px var(--border-blue);
    border-color: var(--border-blue);
    border-width: 3px;
}

.card-slot.border-yellow {
    box-shadow: inset 0 0 15px var(--border-yellow);
    border-color: var(--border-yellow);
    border-width: 3px;
}

.card-slot.border-purple {
    box-shadow: inset 0 0 15px var(--border-purple);
    border-color: var(--border-purple);
    border-width: 3px;
}

.card-slot.border-red {
    box-shadow: inset 0 0 15px var(--border-red);
    border-color: var(--border-red);
    border-width: 3px;
}

/* Efecto Glow en Hover */
.card-slot.border-grey:hover {
    box-shadow: 0 0 15px var(--border-grey);
}

.card-slot.border-blue:hover {
    box-shadow: 0 0 15px var(--border-blue);
}

.card-slot.border-yellow:hover {
    box-shadow: 0 0 15px var(--border-yellow);
}

.card-slot.border-purple:hover {
    box-shadow: 0 0 15px var(--border-purple);
}

.card-slot.border-red:hover {
    box-shadow: 0 0 15px var(--border-red);
}

/* CARTAS DUPLICADAS - IGUALES A LA ORIGINAL */
/* Cartas replicadas se ven iguales a la original, solo con tag [REPLICATED] */
.card-slot.replicated-card {
    /* Las cartas replicadas se muestran igual que las originales */
}

/* CARTAS CON REMOVE TAG - EN GRIS CON OVERLAY */
.card-slot.remove-tagged {
    /* No opacity aquí para no apagar texto */
}

.card-slot.remove-tagged::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
    pointer-events: none;
}

/* CARTAS CON REMOVE FATE - EN GRIS CON OVERLAY */
.card-slot.remove-fated {
    /* No opacity aquí para no apagar texto */
}

.card-slot.remove-fated::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
    pointer-events: none;
}

.card-slot.removed {
    /* No opacity aquí para no apagar X y botón */
}

.card-slot.removed::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
    pointer-events: none;
}

.card-slot.removed::after {
    content: "✗";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 160px;
    color: red;
    font-weight: 900;
    z-index: 10;
    text-shadow: 0 0 12px rgba(255, 0, 0, 0.9);
    pointer-events: none;
    transition: none !important;
    /* Evita transición extraña del degradado a la X */
    background: none;
    /* Elimina el degradado cuando está removed */
    height: auto;
    /* Reset height del degradado */
    border-radius: 0;
    /* Reset border-radius del degradado */
}

/* Todos los elementos dentro del slot deben estar encima del background */
.card-slot>* {
    position: relative;
    /* z-index removido para evitar múltiples stacking contexts */
}

/* Botón X para eliminar */
.card-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: var(--blood-red);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    z-index: 9999 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    transition: all 0.2s ease;
    pointer-events: auto !important;
    isolation: isolate;
}

.card-delete-btn:hover {
    filter: brightness(1.15);
    box-shadow: 0 4px 12px rgba(139, 0, 0, 0.8);
}

/* VALORES EN ESQUINA - SOLO TOP LEFT */
.card-corner-value {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-title);
    font-size: 4.2rem;
    font-weight: 900;
    color: white;
    z-index: 2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 1);
    transition: opacity 0.3s ease;
}

.card-slot:hover .card-corner-value {
    opacity: 0.2;
}

@keyframes number-change {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
    }
}

/* BOTÓN DE EPIFANÍA COMO IMAGEN */
.epiphany-toggle-icon {
    position: absolute;
    top: 25px;
    left: 10px;
    width: 35px;
    height: auto;
    cursor: pointer;
    z-index: 20;
    filter: grayscale(100%) brightness(0.5);
    /* Default Gray */
    transition: filter 0.3s ease;
    object-fit: contain;
}

.epiphany-toggle-icon.epiphany-active {
    filter: grayscale(0%) brightness(1.0);
    /* Normal Color */
}

.epiphany-toggle-icon.divine-active {
    filter: grayscale(0%) brightness(1.0);
    /* Divine Color */
}

@keyframes pulse-glow-epiphany {

    0%,
    100% {
        filter: grayscale(100%) brightness(0.5);
        transform: scale(1);
    }

    50% {
        filter: grayscale(80%) brightness(0.8) drop-shadow(0 0 5px rgba(255, 215, 0, 0.5));
        transform: scale(1.1);
    }
}

body:not(.disable-epiphany-pulse) .epiphany-toggle-icon:not(.epiphany-active):not(.divine-active) {
    animation: pulse-glow-epiphany 2s infinite ease-in-out;
}

.epiphany-toggle-icon.epiphany-active {
    filter: grayscale(0%) brightness(1.0);
    /* Color normal para epifanía */
}

.epiphany-toggle-icon.divine-active {
    filter: grayscale(0%) brightness(1.0);
    /* Color para divina */
}

.epiphany-toggle-icon.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    filter: grayscale(100%) brightness(0.3);
}

@keyframes pulse-glow-epiphany {

    0%,
    100% {
        filter: grayscale(100%) brightness(0.5);
        transform: scale(1);
    }

    50% {
        filter: grayscale(80%) brightness(0.8) drop-shadow(0 0 5px rgba(255, 215, 0, 0.5));
        transform: scale(1.1);
    }
}

body:not(.disable-epiphany-pulse) .epiphany-toggle-icon:not(.epiphany-active):not(.divine-active):not(.disabled) {
    animation: pulse-glow-epiphany 2s infinite ease-in-out;
}


/* NOMBRE DE LA CARTA */
.card-name {
    font-family: var(--font-title);
    font-size: 1rem;
    font-weight: 900;
    color: white;
    text-align: center;
    margin-bottom: 0.25rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
    /* Limitar a máximo 2 líneas con puntos suspensivos */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    max-height: 2.4em;
    /* 2 líneas × 1.2 line-height */
    word-wrap: break-word;
    /* Asegurar que esté por encima del degradado */
    position: relative;
    z-index: 10;
}

.card-name .replicated {
    color: #ffd700;
    font-size: 0.7rem;
    display: block;
    margin-top: 0.15rem;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

.card-name .remove-tag {
    color: #ff4444;
    font-size: 0.7rem;
    display: block;
    margin-top: 0.15rem;
    text-shadow: 0 0 10px rgba(255, 68, 68, 0.8);
}

.card-name .remove-type-label {
    color: #00E5FF;
    font-size: 0.65rem;
    display: block;
    margin-top: 0.2rem;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.6);
    font-style: italic;
    opacity: 0.9;
}

/* Remove type label in card actions (above Restore button) */
.card-actions .remove-type-label {
    color: #00E5FF;
    font-size: 0.75rem;
    text-align: center;
    padding: 0.4rem 0.5rem;
    margin-bottom: 0.3rem;
    background: rgba(0, 229, 255, 0.1);
    border-radius: 4px;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.6);
    font-style: italic;
    font-weight: 600;
    line-height: 1.3;
}

/* BOTONES DE ACCIÓN */
.card-actions {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-top: auto;
    overflow: visible;
    opacity: 0.25;
    transition: opacity 0.3s ease;
    position: relative;
    z-index: 10;
}

.card-slot:hover .card-actions {
    opacity: 1;
}

/* Botones siempre visibles cuando está removed/removeFate/removeTag */
.card-slot.removed .card-actions,
.card-slot.remove-tagged .card-actions,
.card-slot.remove-fated .card-actions {
    opacity: 1;
}

/* Contenedor para botones de conversión lado a lado */
.convert-buttons-row {
    display: flex;
    gap: 0.3rem;
    width: 100%;
}

.convert-buttons-row .btn-card {
    flex: 1;
    font-size: 0.85rem;
    padding: 0.6rem 0.3rem;
}

.btn-card {
    width: 100%;
    padding: 0.7rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 900;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    font-family: var(--font-body);
    text-transform: capitalize;
    letter-spacing: 0.05em;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    z-index: 1;
    background: var(--metallic);
    color: white;
}

.dropdown-menu {
    background: var(--bg-card);
    border: 1px solid rgba(0, 183, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
}

.btn-card:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.7);
    filter: brightness(1.2);
}

.btn-duplicate {
    background: var(--accent-blue, var(--highlight));
    color: black;
}

.btn-duplicate:hover {
    background: var(--electric);
    color: white;
}

.btn-convert-dropdown,
.btn-remove-dropdown {
    background: var(--bg-secondary);
}

.btn-convert {
    background: var(--death-purple);
    color: white;
}

.btn-convert.converted {
    background: #555;
    color: #999;
    cursor: not-allowed;
}

/* TOGGLE BUTTONS */
.btn-toggle {
    background: var(--text-disabled);
    color: rgba(255, 255, 255, 0.5);
}

.btn-toggle.active {
    background: #ffd700;
    color: #333;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
}

.btn-toggle.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Estilo especial para el botón Convertir */
.btn-convert-toggle {
    background: var(--text-disabled);
    color: rgba(255, 255, 255, 0.5);
}

.btn-convert-toggle.active {
    background: #9b59b6;
    color: white;
    box-shadow: 0 0 12px rgba(155, 89, 182, 0.6);
}

/* Botón para Remove Tag */
.btn-remove-tag {
    background: var(--text-disabled);
    color: rgba(255, 255, 255, 0.5);
}

.btn-remove-tag.active {
    background: #6b7280;
    color: white;
    box-shadow: 0 0 12px rgba(107, 114, 128, 0.6);
}

/* Epiphany buttons */
.btn-epiphany-normal,
.btn-epiphany-divine {
    background: #4a5568;
    color: rgba(255, 255, 255, 0.5);
}

.btn-epiphany-normal.active {
    background: #ffd700;
    color: #000;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
    font-weight: 900;
}

.btn-epiphany-divine.active {
    background: #ffd700;
    color: #000;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
    font-weight: 900;
}

/* Dropdown buttons */
.btn-convert-dropdown,
.btn-remove-dropdown {
    background: var(--text-disabled);
    color: rgba(255, 255, 255, 0.7);
}

.btn-convert-dropdown {
    white-space: nowrap;
    /* Prevent line break */
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
    /* Slightly smaller to fit */
    padding: 0.7rem 0.2rem;
    /* Reduce side padding */
}

.dropdown-wrapper {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(20, 20, 30, 0.98);
    border: 1px solid rgba(0, 183, 255, 0.3);
    border-radius: 4px;
    margin-top: 4px;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
}

.dropdown-item {
    width: 100%;
    padding: 0.6rem;
    background: transparent;
    color: white;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    transition: background 0.2s ease;
}

.dropdown-item:hover {
    background: rgba(0, 183, 255, 0.2);
}

.dropdown-item.active {
    background: rgba(0, 183, 255, 0.3);
    color: #00E5FF;
    font-weight: 700;
}

.dropdown-item img {
    object-fit: contain;
}

/* MODAL PARA AÑADIR CARTAS */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: var(--z-modal);
    /* Highest priority */
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 2.5rem;
    max-width: 600px;
    width: 90%;
    box-shadow: var(--shadow-deep), var(--glow-cyan);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    backdrop-filter: blur(16px);
}

.modal-header {
    display: flex;
    flex-direction: row-reverse;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    position: relative;
}

.modal-header h2 {
    font-family: var(--font-title);
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    color: var(--highlight);
    text-transform: uppercase;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
}

.modal-header h2 .counter {
    font-weight: bold;
}

.modal-header h2 .counter-1 {
    color: #ff6b6b;
}

.modal-header h2 .counter-2 {
    color: #ffd93d;
}

.modal-header h2 .counter-3 {
    color: #6bcf7f;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close:hover {
    color: var(--highlight);
    transform: rotate(90deg);
}

.modal-body label {
    display: block;
    font-family: var(--font-title);
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
    text-transform: capitalize;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.modal-body input[type="text"] {
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 183, 255, 0.3);
    color: var(--text-light);
    padding: 0.75rem;
    border-radius: 6px;
    font-family: var(--font-body);
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.modal-body input[type="text"]:focus {
    outline: none;
    border-color: var(--energy);
    box-shadow: var(--glow-cyan);
}

.card-type-selector {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.quantity-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.quantity-btn {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 183, 255, 0.3);
    color: var(--text-light);
    padding: 0.6rem;
    border-radius: 6px;
    font-family: var(--font-title);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quantity-btn:hover {
    background: rgba(0, 183, 255, 0.2);
    border-color: var(--highlight);
}

.quantity-btn.active {
    background: var(--highlight);
    border-color: var(--highlight);
    color: black;
    font-weight: 700;
    box-shadow: var(--glow-cyan);
}

.btn-card-type {
    flex: 1;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(0, 183, 255, 0.3);
    color: var(--text-light);
    border-radius: 6px;
    font-family: var(--font-title);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: capitalize;
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.btn-card-type small {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    font-weight: 400;
    opacity: 0.9;
}

.btn-card-type:hover {
    border-color: var(--highlight);
    background: rgba(0, 183, 255, 0.1);
}

.btn-card-type.selected {
    background: var(--highlight);
    border-color: var(--highlight);
    color: black;
    box-shadow: var(--glow-cyan);
}

.modal-actions {
    display: flex;
    gap: 1rem;
}

.modal-actions button {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 6px;
    font-family: var(--font-title);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-modal-add {
    background: linear-gradient(135deg, var(--highlight), var(--electric));
    color: black;
    box-shadow: var(--glow-cyan);
}

.btn-modal-cancel {
    background: var(--metallic);
    color: var(--text-light);
}

.btn-modal-add:hover,
.btn-modal-cancel:hover {
    filter: brightness(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* SCROLLBAR */
.sidebar::-webkit-scrollbar,
.character-carousel::-webkit-scrollbar,
.main-content::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track,
.character-carousel::-webkit-scrollbar-track,
.main-content::-webkit-scrollbar-track {
    background: var(--bg-main);
}

.sidebar::-webkit-scrollbar-thumb,
.character-carousel::-webkit-scrollbar-thumb,
.main-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--highlight), var(--electric));
    border-radius: 10px;
}

/* TOOLTIPS */
.tooltip-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: rgba(0, 183, 255, 0.4);
    border: 2px solid var(--highlight);
    border-radius: 50%;
    color: white;
    font-family: var(--font-title);
    font-size: 0.7rem;
    font-weight: 900;
    cursor: help;
    margin-left: 0.35rem;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: 0 0 8px rgba(0, 183, 255, 0.3);
    z-index: 5;
}

.tooltip-trigger:hover {
    background: var(--highlight);
    color: black;
    transform: scale(1.1);
}

.tooltip-text {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(13, 13, 21, 0.98), rgba(0, 0, 0, 0.98));
    color: var(--text-light);
    text-align: left;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--highlight);
    box-shadow: var(--shadow-deep), var(--glow-cyan);
    z-index: 10;
    width: 220px;
    font-size: 0.65rem;
    font-weight: 400;
    line-height: 1.5;
    white-space: normal;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
    font-family: var(--font-body);
}

.tooltip-text::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: var(--highlight);
}

.tooltip-trigger:hover .tooltip-text {
    visibility: visible !important;
    opacity: 1 !important;
}

.label-with-tooltip {
    display: flex;
    align-items: center;
}




/* --- Disable VFX --- */
body.no-vfx .sidebar,
body.no-vfx .cards-header,
body.no-vfx .modal-content {
    backdrop-filter: none !important;
    background: rgba(10, 10, 15, 0.95) !important;
}

body.no-vfx .card-slot {
    transition: none;
}

body.no-vfx .card-slot:hover {
    transform: none;
    box-shadow: var(--shadow-deep);
}

body.no-vfx .epiphany-toggle-icon {
    animation: none !important;
}

body.no-vfx .card-slot.border-grey {
    box-shadow: none;
    border: 5px solid var(--border-grey);
}

body.no-vfx .card-slot.border-blue {
    box-shadow: none;
    border: 5px solid var(--border-blue);
}

body.no-vfx .card-slot.border-yellow {
    box-shadow: none;
    border: 5px solid var(--border-yellow);
}

body.no-vfx .card-slot.border-purple {
    box-shadow: none;
    border: 5px solid var(--border-purple);
}

body.no-vfx .card-slot.border-red {
    box-shadow: none;
    border: 5px solid var(--border-red);
}

/* --- New Card Animation --- */
@keyframes fadeInSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-slot.new-card {
    animation: fadeInSlideUp 0.5s ease forwards;
}

.card-corner-value.cost-yellow {
    color: #FFD700;
}

.card-corner-value.cost-orange {
    color: #FF8C00;
}

.card-corner-value.cost-red {
    color: #FF0033;
}


.btn-bonus.danger {
    background: #dc3545;
    color: white;
    box-shadow: 0 0 15px rgba(220, 53, 69, 0.7), 0 0 30px rgba(220, 53, 69, 0.4);
}

/* CARD STATUS LABELS */
.card-status-label {
    font-family: var(--font-title);
    font-size: 0.7rem;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
    position: relative;
    z-index: 10;
}

.status-replicated {
    color: #ffd700;
    /* Yellow */
}

.status-converted {
    color: #c792ea;
    /* Purple */
}

.status-remove {
    color: #ff5252;
    /* Red */
}

.status-removal {
    color: #ff5252;
    /* Red */
}

/* TIER POPUP STYLES */
.tier-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

.tier-grid-item {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 183, 255, 0.3);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tier-grid-item:hover {
    background: rgba(0, 183, 255, 0.2);
    border-color: var(--highlight);
    filter: brightness(1.15);
    box-shadow: 0 0 10px rgba(0, 183, 255, 0.3);
}

.tier-grid-item.active {
    background: var(--highlight);
    border-color: var(--highlight);
    color: black;
    font-weight: 700;
    box-shadow: var(--glow-cyan);
}

.tier-grid-level {
    font-family: var(--font-title);
    font-size: 1.1rem;
    font-weight: 700;
}

.tier-grid-cap {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* GLOBAL HIDE MOBILE ELEMENTS */
.mobile-top-bar,
.mobile-bottom-bar,
.mobile-character-bar {
    display: none !important;
}

/* ==========================================================================
   MASTER MOBILE FIX (MAX-WIDTH: 1000px)
   ========================================================================== */
@media (max-width: 1000px) {

    /* 0. PREVENT HORIZONTAL SCROLL - GLOBAL */
    html,
    body,
    .layout,
    .main-content,
    .cards-grid {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
    }

    /* 1. HIDE DESKTOP ELEMENTS */
    .sidebar,
    .cards-header {
        display: none !important;
    }

    /* 2. SHOW MOBILE ELEMENTS */
    /* Mobile Top Bar - Professional Style */
    .mobile-top-bar {
        display: flex !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 50px;
        z-index: var(--z-mobile-bar);
        background: linear-gradient(180deg, rgba(10, 10, 15, 0.98) 0%, rgba(15, 15, 20, 0.95) 100%) !important;
        border-bottom: 2px solid rgba(0, 183, 255, 0.2);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(10px) !important;
        justify-content: center;
        align-items: center;
    }

    /* Mobile Character Bar - Professional Style with Dynamic Horizontal Expansion */
    .mobile-character-bar {
        display: block !important;
        position: fixed;
        top: 50px;
        left: 0;
        width: 100%;
        height: 100px;
        /* Standard height, not square */
        z-index: var(--z-mobile-bar);
        background: linear-gradient(180deg, rgba(15, 15, 20, 0.95) 0%, rgba(10, 10, 15, 0.98) 100%) !important;
        border-bottom: 2px solid rgba(0, 183, 255, 0.15);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    }

    /* Mobile Bottom Bar - Clean flat style */
    .mobile-bottom-bar {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 75px;
        background: linear-gradient(0deg, rgba(10, 10, 15, 0.98) 0%, rgba(15, 15, 20, 0.95) 100%) !important;
        z-index: var(--z-mobile-bar);
        border-top: 2px solid rgba(0, 183, 255, 0.3);
        /* Slightly stronger border */
        box-shadow: none !important;
        /* Removed shadow for clean look */
        justify-content: space-between;
        align-items: center;
        padding: 0 15px;
    }

    /* Mobile Character Slots - Dynamic Horizontal Grid */
    .mobile-character-slots {
        display: grid;
        grid-template-columns: 1fr 2fr 1fr;
        /* Default: slot 1 active (25% 50% 25%) */
        height: 100%;
        gap: 4px;
        padding: 8px;
        transition: grid-template-columns 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Dynamic grid adjustments based on active slot */
    .mobile-character-slots.slot-0-active {
        grid-template-columns: 2fr 1fr 1fr !important;
        /* First slot active: 50% 25% 25% */
    }

    .mobile-character-slots.slot-1-active {
        grid-template-columns: 1fr 2fr 1fr !important;
        /* Middle slot active: 25% 50% 25% */
    }

    .mobile-character-slots.slot-2-active {
        grid-template-columns: 1fr 1fr 2fr !important;
        /* Last slot active: 25% 25% 50% */
    }

    .mobile-slot {
        position: relative;
        border-radius: 12px;
        overflow: hidden;
        background: rgba(0, 0, 0, 0.5);
        border: 2px solid rgba(255, 255, 255, 0.15);
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        cursor: pointer;
        /* NO aspect-ratio - slots expand horizontally only */
    }

    .mobile-slot-portrait {
        width: 100%;
        height: 100%;
        object-fit: cover;
        opacity: 0.4;
        transition: opacity 0.4s ease;
        /* NO transform scale - just opacity */
    }

    /* Active slot - enlarged horizontally and bright */
    .mobile-slot.active {
        border: 3px solid var(--highlight);
        box-shadow: 0 0 20px rgba(0, 183, 255, 0.6), 0 4px 15px rgba(0, 0, 0, 0.5);
        background: rgba(0, 183, 255, 0.1);
    }

    .mobile-slot.active .mobile-slot-portrait {
        opacity: 1;
        /* NO scale transform */
    }

    /* Inactive slots - compressed horizontally and darkened */
    .mobile-slot:not(.active) {
        opacity: 0.7;
    }

    .mobile-slot:not(.active) .mobile-slot-portrait {
        filter: brightness(0.6) grayscale(0.3);
        /* NO scale transform */
    }

    /* Hover effect for inactive slots */
    .mobile-slot:not(.active):hover {
        border-color: rgba(0, 183, 255, 0.4);
        opacity: 0.9;
    }

    /* Mobile slot name - character name above slot */
    .mobile-slot-name {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        text-align: center;
        font-family: var(--font-title);
        font-size: 0.7rem;
        font-weight: 700;
        text-transform: uppercase;
        color: #FFFFFF;
        /* Changed to white */
        z-index: 3;
        text-shadow:
            0 2px 6px rgba(0, 0, 0, 1),
            0 0 10px rgba(0, 0, 0, 0.8),
            -1px -1px 0 #000,
            1px -1px 0 #000,
            -1px 1px 0 #000,
            1px 1px 0 #000;
        /* Stronger drop shadow */
        letter-spacing: 0.5px;
        padding: 4px 8px;
        background: linear-gradient(180deg, rgba(0, 0, 0, 0.7) 0%, transparent 100%);
        /* Gradient from top */
        transition: all 0.3s ease;
    }

    .mobile-slot.active .mobile-slot-name {
        color: #FFFFFF;
        /* Keep white */
        text-align: right;
        /* Align to right to avoid character face */
        padding-right: 12px;
        /* More padding on right */
        background: linear-gradient(180deg, rgba(0, 183, 255, 0.3) 0%, transparent 100%);
        /* Cyan gradient for active */
        text-shadow:
            0 0 12px rgba(0, 183, 255, 1),
            0 2px 6px rgba(0, 0, 0, 1),
            0 0 8px rgba(0, 183, 255, 0.8),
            -1px -1px 0 #000,
            1px -1px 0 #000,
            -1px 1px 0 #000,
            1px 1px 0 #000;
        /* Cyan glow + strong shadow */
    }

    .mobile-slot-progress-bar {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 18px;
        /* Increased from 10px to fit text */
        background: rgba(0, 0, 0, 0.85);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        z-index: 2;
    }

    .mobile-slot-progress-bar .bar-fill {
        height: 100%;
        background: linear-gradient(90deg, var(--electric), var(--highlight));
        box-shadow: 0 0 12px rgba(0, 183, 255, 0.6);
        transition: width 0.5s ease;
    }

    /* Progress text showing "X / Y Pts" */
    .mobile-slot-progress-text {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-family: var(--font-title);
        font-size: 0.65rem;
        font-weight: 700;
        color: #FFFFFF;
        z-index: 3;
        text-shadow: 0 1px 4px rgba(0, 0, 0, 1),
            -1px -1px 0 #000,
            1px -1px 0 #000,
            -1px 1px 0 #000,
            1px 1px 0 #000;
        letter-spacing: 0.3px;
    }

    /* Mobile Icon Buttons - Professional Style */
    .mobile-icon-btn {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        background: linear-gradient(135deg, rgba(0, 119, 182, 0.3), rgba(0, 183, 255, 0.2));
        border: 2px solid rgba(0, 183, 255, 0.4);
        color: var(--highlight);
        width: 40px;
        height: 40px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        font-weight: 700;
        cursor: pointer;
        z-index: 2;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
        transition: all 0.3s ease;
    }

    .mobile-icon-btn:active {
        transform: translateY(-48%) scale(0.95);
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    }

    .mobile-icon-btn.settings-btn {
        left: 10px;
    }

    .mobile-icon-btn.tier-btn-mobile {
        right: 10px;
    }

    /* Mobile Add Card Button - Clean flat style without glow */
    .mobile-add-card-btn {
        position: absolute;
        left: 50%;
        bottom: 18px;
        transform: translateX(-50%);
        width: 50px !important;
        height: 50px !important;
        border-radius: 50%;
        background: linear-gradient(135deg, var(--highlight), var(--energy));
        color: #000;
        font-size: 26px !important;
        font-weight: 900;
        border: 2px solid rgba(0, 183, 255, 0.6) !important;
        /* Solid border, no glow */
        z-index: 20002;
        box-shadow: none !important;
        /* Removed all glow */
        cursor: pointer;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-add-card-btn:active {
        transform: translateX(-50%) scale(0.95);
        opacity: 0.8;
        box-shadow: none !important;
        /* No glow on press */
    }

    .mobile-bottom-bar .btn-bonus {
        flex: 1;
        margin: 0 5px;
        font-size: 0.65rem !important;
        font-weight: 600 !important;
        padding: 8px 6px !important;
        border-radius: 8px !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        transition: all 0.3s ease;
        min-height: 32px !important;
        box-shadow: none !important;
        /* Removed glow */
    }

    .mobile-bottom-bar .btn-bonus.available {
        border-color: rgba(40, 167, 69, 0.8) !important;
        /* Stronger border for available */
        box-shadow: none !important;
        /* No glow even when available */
    }

    .mobile-bottom-bar .btn-bonus:active {
        transform: scale(0.97);
        opacity: 0.8;
    }

    /* Mobile button groups with labels */
    .mobile-btn-group {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        flex: 1;
    }

    .mobile-btn-label {
        font-family: var(--font-title);
        font-size: 0.55rem;
        font-weight: 700;
        text-transform: uppercase;
        color: rgba(255, 255, 255, 0.6);
        letter-spacing: 0.5px;
        text-align: center;
    }

    .mobile-btn-group .btn-bonus {
        width: 100%;
        max-width: 120px;
        margin: 0 !important;
    }

    .mobile-bottom-bar .btn-bonus:first-child {
        margin-right: 0 !important;
        /* Override previous margin */
    }

    .mobile-bottom-bar .btn-bonus:last-child {
        margin-left: 0 !important;
        /* Override previous margin */
    }

    /* 3. LAYOUT & PADDING - Adjusted for new bar heights */
    body {
        padding-top: 152px !important;
        padding-bottom: 0 !important;
        overflow-x: hidden !important;
    }

    .main-content {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        overflow-x: hidden !important;
    }

    /* 4. GRID LAYOUT */
    .cards-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
        padding: 10px !important;
        padding-bottom: 10px !important;
        margin-bottom: 300px !important;
        /* DOUBLED: Ensures plenty of space for last cards to be fully visible */
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }

    /* 5. NUCLEAR ANTI-SCALING FIX */
    .card-slot,
    .card-slot:hover,
    .card-slot:active,
    .card-slot.mobile-selected {
        transform: none !important;
        transition: none !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        box-shadow: none !important;
        border: 2px solid transparent !important;
        scale: 1 !important;
        -webkit-transform: none !important;
        -moz-transform: none !important;
        -ms-transform: none !important;
    }

    /* Make removed card X smaller in mobile and ensure centering */
    .card-slot.removed::after {
        font-size: 100px !important;
        /* Smaller X for mobile */
        line-height: 1 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Selected State Visuals - Professional Style */
    .card-slot.mobile-selected {
        border: 4px solid var(--highlight) !important;
        box-shadow: 0 0 25px rgba(0, 183, 255, 0.6), 0 4px 20px rgba(0, 0, 0, 0.7) !important;
        z-index: 50 !important;
        transform: none !important;
        scale: 1 !important;
        animation: pulse-border 2s ease-in-out infinite;
    }

    @keyframes pulse-border {

        0%,
        100% {
            border-color: var(--highlight);
            box-shadow: 0 0 25px rgba(0, 183, 255, 0.6), 0 4px 20px rgba(0, 0, 0, 0.7);
        }

        50% {
            border-color: var(--energy);
            box-shadow: 0 0 35px rgba(0, 255, 246, 0.8), 0 4px 20px rgba(0, 0, 0, 0.7);
        }
    }

    /* Button Visibility - Hide by default */
    .card-slot .card-actions,
    .card-slot .card-delete-btn,
    .card-slot .epiphany-toggle-icon {
        display: none !important;
    }

    /* Container for buttons when card is selected - Professional Style */
    .card-slot.mobile-selected .card-actions {
        display: flex !important;
        flex-direction: column !important;
        gap: 3px !important;
        /* Reduced from 4px */

        /* Overlay Positioning - Anchored to bottom */
        position: absolute !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 6px !important;
        /* Reduced from 8px */

        /* Visuals - Professional dark background */
        background: linear-gradient(0deg, rgba(0, 0, 0, 0.98) 0%, rgba(0, 0, 0, 0.92) 100%) !important;
        border-top: 2px solid var(--highlight) !important;
        /* Reduced from 3px */
        border-radius: 0 0 13px 13px !important;
        box-shadow: 0 -4px 15px rgba(0, 183, 255, 0.3) !important;
        z-index: 100 !important;
        opacity: 1 !important;
        visibility: visible !important;

        /* Reset any conflicting transform */
        transform: none !important;
        scale: 1 !important;
        -webkit-transform: none !important;
    }

    .card-slot.mobile-selected .btn-card {
        padding: 6px 8px !important;
        /* Reduced from 8px 10px */
        font-size: 0.7rem !important;
        /* Reduced from 0.8rem */
        font-weight: 600 !important;
        /* Reduced from 700 */
        margin: 0 !important;
        width: 100% !important;
        border-radius: 4px !important;
        /* Reduced from 6px */
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        /* Reduced from 2px */
        transition: all 0.2s ease !important;
        touch-action: manipulation !important;
        min-height: 28px !important;
        /* Reduced height */
    }

    .card-slot.mobile-selected .btn-card:active {
        transform: scale(0.97) !important;
        filter: brightness(1.1) !important;
    }

    /* Prevent scroll jump for all interactive elements in mobile */
    .btn-card,
    .card-delete-btn,
    button,
    .mobile-add-card-btn,
    .mobile-icon-btn {
        touch-action: manipulation !important;
    }

    /* Ensure row buttons (Epiphany/Convert) fit - VERTICAL on mobile */
    .card-slot.mobile-selected .convert-buttons-row {
        width: 100% !important;
        flex-direction: column !important;
        gap: 3px !important;
        /* Reduced from 4px */
    }

    /* Make Convert To and Remove dropdowns full width in mobile */
    .card-slot.mobile-selected .convert-buttons-row .btn-card {
        width: 100% !important;
        flex: none !important;
        font-size: 0.7rem !important;
        /* Reduced from 0.8rem */
        padding: 6px 8px !important;
        /* Reduced from 8px 10px */
    }

    /* Delete button always visible in mobile (not just when selected) */
    .card-slot .card-delete-btn {
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
        z-index: 9999 !important;
        width: 20px !important;
        height: 20px !important;
        font-size: 0.75rem !important;
        top: 4px !important;
        right: 4px !important;
    }

    /* Prevent smooth scrolling that causes jumps */
    html,
    .main-content {
        scroll-behavior: auto !important;
    }

    /* Hide epiphany icon completely in mobile */
    .card-slot .epiphany-toggle-icon,
    .card-slot.mobile-selected .epiphany-toggle-icon {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
    }

    /* Settings Panel */
    .sidebar.mobile-visible {
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: var(--z-modal);
        background: rgba(0, 0, 0, 0.95);
        padding-top: 100px;
    }

    .sidebar.mobile-visible>*:not(.settings-container) {
        display: none;
    }

    .sidebar.mobile-visible .settings-panel {
        max-height: none !important;
        opacity: 1 !important;
    }

    /* Hide sliders on mobile */
    #compactModeContainer {
        display: none !important;
    }

    /* MOBILE FIXES */

    /* 1. Modal Add Card - Vertical buttons */
    .card-type-selector {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }

    .btn-card-type {
        width: 100% !important;
    }

    /* 2. Character Slots - 50% activo, 25% inactivos */
    .mobile-character-slots {
        grid-template-columns: 1fr 2fr 1fr !important;
    }

    /* 3. Tier Popup - 2 columnas en mobile */
    .tier-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
        /* Reduced from 0.75rem */
        padding: 0.75rem !important;
        /* Reduced from 1rem */
    }

    /* Make tier items smaller in mobile */
    .tier-grid-item {
        padding: 0.5rem !important;
        /* Much smaller padding */
        min-height: 60px !important;
        /* Reduced height */
    }

    .tier-grid-level {
        font-size: 0.85rem !important;
        /* Smaller font */
        font-weight: 700 !important;
        margin-bottom: 0.2rem !important;
    }

    .tier-grid-cap {
        font-size: 0.7rem !important;
        /* Smaller font */
        opacity: 0.8 !important;
    }

    /* 3.5. Character Picker Modal - Mobile optimized */
    .character-picker-content {
        max-width: 90% !important;
        /* Reduced from 95% to leave space for clicking outside */
        width: 90% !important;
        padding: 1.5rem !important;
        /* Added padding for better spacing */
        margin: 1rem auto !important;
        /* Added margin for top/bottom spacing */
    }

    .character-picker-grid {
        display: grid !important;
        /* Changed from flex to grid */
        grid-template-columns: repeat(2, 1fr) !important;
        /* 2 columns */
        gap: 12px !important;
        padding: 1rem 0 !important;
        justify-items: stretch !important;
    }

    .character-picker-item {
        width: 100% !important;
        /* Full width of grid cell */
        height: 90px !important;
        max-width: none !important;
    }

    /* Fix portrait positioning to show full character */
    .picker-portrait {
        object-position: center center !important;
        /* Center to show full portrait face */
    }

    .modal-header h2 {
        font-size: 1.3rem !important;
        /* Slightly larger for mobile readability */
        white-space: normal !important;
        /* Allow text wrapping if needed */
        text-align: center !important;
    }

    .picker-name {
        font-size: 0.75rem !important;
        padding: 0.5rem 0.6rem !important;
    }

    /* 4. Bottom Bar - Botón + más pequeño */
    .mobile-add-card-btn {
        width: 55px !important;
        height: 55px !important;
        font-size: 28px !important;
        bottom: 20px !important;
    }

    .mobile-bottom-bar .btn-bonus {
        text-align: center !important;
        justify-content: center !important;
        align-items: center !important;
    }

    /* 5. Ocultar settings innecesarios */
    #settingsEpiphanyPulse,
    #settingsVfx {
        display: none !important;
    }

    /* 6. Quitar scrollbar horizontal - FIX COMPLETO */
    * {
        box-sizing: border-box !important;
    }

    html {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        width: 100% !important;
    }

    body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        width: 100% !important;
    }

    .layout {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        width: 100% !important;
    }

    .main-content {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        width: 100% !important;
    }

    .cards-grid {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        width: 100% !important;
    }
}