:root {
    --primary-color: #3a0ca3;
    --secondary-color: #f72585;
    --background-color: #1a1a2e;
    --card-background: #16213e;
    --text-color: #e2e2e2;
    --highlight-color: #4cc9f0;

    /* Colores para la barra de capacidad */
    --capacity-low: #4CAF50; /* Verde */
    --capacity-medium: #FFC107; /* Amarillo */
    --capacity-high: #f44336; /* Rojo */
}

/* Base reset and global styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', Arial, sans-serif; /* Using Inter for a modern look */
    background-color: var(--background-color) !important;
    color: #ffffff;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* Estilos para la imagen de fondo local */
    background-image: url('../images/deck_builder_background.jpg') !important; /* Ruta relativa a public/combat/images/ */
    background-size: cover !important; /* Cubre toda la pantalla */
    background-position: center !important; /* Centra la imagen */
    background-repeat: no-repeat !important; /* No repite la imagen */
    background-attachment: fixed !important; /* Mantiene la imagen fija al hacer scroll */
}

/* --- INICIO CAMBIOS HEADER MÓVIL --- */
header {
    background-color: rgba(30, 30, 30, 0.5) !important; /* Fondo semitransparente */
    padding: 0.8rem 1rem; /* Reducir padding en móvil */
    display: flex;
    flex-wrap: wrap; /* Permitir que los elementos se envuelvan */
    justify-content: center; /* Centrar elementos cuando envuelvan */
    align-items: center;
    gap: 0.8rem; /* Añadir espacio entre título y user-info cuando envuelvan */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Sombra más sutil */
    margin-bottom: 1rem; /* Reducir margen inferior */
    border-bottom: 2px solid var(--highlight-color); /* Subtle border */
    backdrop-filter: blur(5px); /* Efecto de desenfoque para mejorar legibilidad */
}

h1 {
    font-size: 1.5rem; /* Más pequeño */
    text-align: center; /* Centrar título si queda solo */
    width: 100%; /* Ocupar ancho para centrar bien */
    margin-bottom: 0.5rem; /* Espacio si user-info envuelve abajo */
    color: white !important;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
}

.user-info {
    display: flex;
    align-items: center;
    justify-content: center; /* Centrar botones/email */
    flex-wrap: wrap; /* Permitir que botones envuelvan si es necesario */
    gap: 0.8rem; /* Reducir espacio entre elementos */
    font-size: 0.85rem; /* Texto un poco más pequeño */
    width: 100%; /* Ocupar ancho para centrar */
    color: white !important;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
}

 /* Asegurar que los botones no sean excesivamente grandes en móvil */
.user-info .action-button {
    padding: 0.6rem 1rem; /* Padding más pequeño */
    font-size: 0.85rem;
    min-width: auto; /* Permitir que sean más estrechos */
    flex-grow: 1; /* Permitir que crezcan para llenar espacio */
    flex-basis: 120px; /* Base antes de crecer */
}
/* --- FIN CAMBIOS HEADER MÓVIL --- */


/* Main content layout */
main {
    flex-grow: 1;
    padding: 0 1.5rem 1.5rem 1.5rem; /* Adjusted padding for main content */
    display: flex;
    justify-content: center;
    align-items: flex-start;
    flex-direction: column; /* Default column for mobile */
}

.main-content-wrapper {
    display: flex;
    flex-direction: column; /* Default column for mobile */
    gap: 2.5rem; /* Increased gap between main sections */
    width: 100%;
    max-width: 1600px; /* Increased max-width for wider screens */
    margin: 0 auto;
}

/* --- INICIO CAMBIOS PARA STICKY MÓVIL --- */
.deck-sections-wrapper {
    display: flex;
    flex-direction: column; /* Mazos de Ataque/Defensa y acciones principales */
    gap: 1rem; /* Reducir gap un poco para móvil */
    flex: 1; /* Para que ocupe el espacio disponible */

    /* Propiedades para hacerlo sticky abajo en móvil */
    position: sticky;
    bottom: 0; /* Pégalo abajo */
    background-color: rgba(26, 26, 46, 0.95); /* Fondo casi opaco para legibilidad sobre el scroll */
    z-index: 100; /* Asegura que esté por encima de la colección al hacer scroll */
    padding: 1rem 1rem; /* Ajustar padding */
    margin: 0 -1.5rem -1.5rem -1.5rem; /* Compensar padding de main y quitar margen inferior */
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.4); /* Sombra superior para separarlo */
    border-top: 1px solid rgba(255, 255, 255, 0.1); /* Línea sutil arriba */
}

/* Padding inferior para la colección para que no quede oculta por el mazo sticky */
.card-collection {
    /* Ajusta este valor según la altura estimada de tu mazo sticky en móvil */
    padding-bottom: 45vh; /* Ejemplo: si el mazo ocupa ~40% de la altura */
}
/* --- FIN CAMBIOS PARA STICKY MÓVIL --- */


/* Section styling */
section {
    background-color: rgba(30, 30, 30, 0.6) !important; /* Fondo semitransparente */
    border-radius: 12px; /* More rounded corners */
    padding: 1.5rem; /* More internal padding */
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); /* Deeper shadow */
    backdrop-filter: blur(5px); /* Efecto de desenfoque para mejorar legibilidad */
}

/* Ajuste para la sección de colección cuando el mazo es sticky */
.card-collection {
    background-color: rgba(30, 30, 30, 0.5) !important; /* Ligeramente más transparente */
    /* El padding-bottom se añade fuera de la media query ahora */
}


h2 {
    margin-bottom: 1.2rem;
    color: var(--highlight-color) !important; /* Highlight color for headers */
    font-size: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
    display: flex; /* Para alinear el contador con el título */
    justify-content: space-between;
    align-items: center;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
}

h2 span { /* Estilo para el contador de cartas (X/10) */
    font-size: 0.9rem;
    color: #bbb;
    margin-left: 10px;
}

/* Grid for cards (collection and decks) */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); /* Reducir tamaño mínimo en móvil */
    gap: 0.8rem; /* Reducir gap en móvil */
    padding: 0.5rem; /* Small padding inside grid */
    min-height: 373px; /* --- CAMBIO ---: 150px -> 373px (para 2 filas móviles) */
    align-content: start; /* Align content to the start */
    justify-items: center; /* Center cards within their grid cells */
}

/* Specific deck containers */
.selected-deck {
    border: 2px dashed #444;
    min-height: 373px; /* --- CAMBIO ---: 150px -> 373px (para 2 filas móviles) */
    background-color: rgba(0, 0, 0, 0.1); /* Fondo ligero para diferenciar */
    border-radius: 8px; /* Redondear bordes */
}

/* Card item styling */
.card-item {
    position: relative;
    background-color: rgba(22, 33, 62, 0.8) !important; /* Fondo ligeramente transparente */
    border-radius: 8px; /* Ligeramente menos redondeado */
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, outline 0.1s ease-out; /* Transiciones más rápidas */
    cursor: grab;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3); /* Sombra más sutil */
    width: 100%;
    aspect-ratio: 2 / 3; /* Common card aspect ratio, maintains shape */
    padding: 0; /* No padding inside card-item to maximize image space */
    min-height: 180px; /* Reducir altura mínima en móvil */
}

.card-item .card-image {
    width: 100%;
    height: 100%; /* Image fills the entire card-item */
    object-fit: cover; /* Image covers the area, potentially cropping edges */
    display: block;
    border-radius: 8px; /* Image inherits card corner radius */
}

/* Hover solo aplica en dispositivos no táctiles (generalmente) */
@media (hover: hover) and (pointer: fine) {
    .card-item:hover {
        transform: translateY(-4px) scale(1.02); /* Efecto hover más sutil */
        box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
    }
}


.card-item.selected { /* Estilo para cartas seleccionadas en el mazo (si se usa) */
    border: 3px solid var(--highlight-color);
}

/* Hide text details as they are in the image */
.card-name,
.card-stats,
.card-type {
    display: none;
}

/* Card action buttons (Remove) */
.card-actions {
    position: absolute; /* Position action buttons over the image */
    top: 5px; /* Arriba a la derecha */
    right: 5px;
    display: flex;
    justify-content: flex-end; /* Alinear a la derecha */
    gap: 0.3rem;
    padding: 0;
    z-index: 10; /* Ensure buttons are clickable */
    background-color: transparent; /* Sin fondo */
}

/* Botón de quitar (X) */
.remove-from-current-deck-button {
    background-color: rgba(211, 47, 47, 0.8); /* Rojo semitransparente */
    color: #fff;
    border: none;
    border-radius: 50%; /* Círculo */
    width: 24px;
    height: 24px;
    font-size: 14px;
    font-weight: bold;
    line-height: 24px; /* Centrar X verticalmente */
    text-align: center;
    cursor: pointer;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.remove-from-current-deck-button:hover {
    background-color: rgba(229, 57, 53, 0.9);
}
.remove-from-current-deck-button:active {
    transform: scale(0.9); /* Click feedback */
}


/* Rarity label on card */
.rarity-label {
    position: absolute;
    bottom: 5px; /* Abajo */
    left: 5px; /* A la izquierda */
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 3px 8px; /* Más pequeño */
    border-radius: 4px;
    font-size: 0.7rem; /* Más pequeño */
    text-transform: uppercase;
    font-weight: bold;
    z-index: 10;
}

/* Rarity colors */
.rarity-common { color: #aaaaaa; }
.rarity-uncommon { color: #4CAF50; }
.rarity-rare { color: #2196F3; }
.rarity-epic { color: #9C27B0; }
.rarity-legendary { color: #FFC107; }
.rarity-ultralegendary { color: #FF5722; }

/* General action buttons */
.action-button {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    padding: 0.7rem 1.2rem; /* Padding ajustado */
    border-radius: 6px; /* Menos redondeado */
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.1s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    min-width: 100px; /* Ancho mínimo ajustado */
    font-size: 0.9rem; /* Tamaño de fuente ajustado */
}

/* Hover solo aplica en dispositivos no táctiles */
@media (hover: hover) and (pointer: fine) {
    .action-button:hover {
        background-color: #5e35b1;
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    }
}


.action-button:disabled {
    background-color: #555 !important; /* Usar !important para asegurar override */
    color: #999 !important;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.action-button.primary-button { /* Para Ir a Batalla */
    background-color: var(--highlight-color);
    color: #1a1a2e;
}
@media (hover: hover) and (pointer: fine) {
    .action-button.primary-button:hover {
        background-color: #72e0ff;
    }
}


.action-button.success-button { /* Para Guardar Mazo */
    background-color: #4CAF50;
    color: #fff;
}
@media (hover: hover) and (pointer: fine) {
    .action-button.success-button:hover {
        background-color: #66bb6a;
    }
}


.action-button.danger-button { /* Para Limpiar Mazo */
    background-color: #f44336;
    color: #fff;
}
@media (hover: hover) and (pointer: fine) {
    .action-button.danger-button:hover {
        background-color: #e57373;
    }
}


/* Layout for general action button groups */
.deck-actions, .main-deck-actions { /* Both share styles */
    display: flex;
    justify-content: center;
    gap: 0.8rem; /* Menos gap */
    margin-top: 1rem; /* Adjusted margin */
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    position: relative; /* Para el tick de guardado */
}

.deck-actions .action-button, .main-deck-actions .action-button {
    flex-grow: 1; /* Permitir que crezcan un poco */
    flex-basis: 140px; /* Base antes de crecer */
    text-align: center;
    min-width: 140px; /* Ancho mínimo ajustado */
}

/* Feedback visual de guardado */
.saved-feedback {
    position: absolute;
    right: -25px; /* Ajustar posición */
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    color: #4CAF50; /* Verde */
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none; /* Asegurar que no interfiera con clics */
}

/* Clase para mostrar el tick */
.saved-feedback.show {
    opacity: 1;
}

/* Deck Capacity Bar */
.deck-capacity-bar-container {
    width: 100%;
    height: 8px; /* Más delgada */
    background-color: #333;
    border-radius: 4px;
    margin-top: 8px;
    overflow: hidden; /* Asegura que la barra interna no se salga */
}

.deck-capacity-bar {
    height: 100%;
    width: 0%; /* Se controla con JS */
    background-color: var(--capacity-low); /* Color por defecto */
    transition: width 0.3s ease-out, background-color 0.3s ease-out;
    border-radius: 4px; /* Para que coincida con el contenedor */
}

/* Empty message placeholders */
.empty-message, .loading-message, .empty-deck-message { /* Added .empty-deck-message */
    grid-column: 1 / -1; /* Span across all columns in grid */
    text-align: center;
    color: #aaa !important; /* Más sutil */
    padding: 1rem; /* Menos padding */
    font-style: italic;
    font-size: 0.9rem; /* Ligeramente más pequeño */
    text-shadow: none; /* Quitar sombra */
}

/* Message container (success/error popups) */
.message-container {
    position: fixed;
    bottom: 70px; /* Más arriba para no chocar con el mazo sticky */
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 10px 20px; /* Ajustado */
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease-in-out, bottom 0.3s ease-in-out; /* Añadir transición a bottom */
    font-size: 0.9rem;
}

.message-container.success {
    background-color: #4CAF50;
}

.message-container.error {
    background-color: #f44336;
}

.message-container[style*="display: block"] {
    opacity: 1;
}

/* Card Hover Tooltip - Ocultarlo en móvil por defecto */
.card-tooltip {
    /* ... (Estilos anteriores del tooltip) ... */
    position: fixed; /* Usar fixed para evitar problemas con scroll */
    background-color: rgba(30, 30, 30, 0.95);
    color: #fff;
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    z-index: 1020; /* Muy alto */
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    min-width: 180px;
    max-width: 250px;
    font-size: 0.9rem;
    border: 1px solid var(--highlight-color);
    display: none; /* Oculto por defecto */
    flex-direction: column;
    gap: 5px;
}
/* Mostrar tooltip solo en pantallas grandes con hover */
@media (min-width: 768px) and (hover: hover) and (pointer: fine) {
    .card-tooltip {
        display: flex; /* Mostrar en escritorio */
        position: absolute; /* Volver a absolute en escritorio si es necesario*/
    }
}


.card-tooltip p {
    margin: 0;
}

.card-tooltip .tooltip-stat {
    font-weight: bold;
    color: var(--highlight-color);
}

.card-tooltip .tooltip-name {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 8px;
    color: var(--primary-color);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 5px;
}

/* Modal styles (for confirmation) */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem; /* Añadir padding para evitar bordes en móvil */
}

.modal-content {
    background-color: #1e1e1e;
    padding: 1.5rem; /* Menos padding */
    border-radius: 10px; /* Menos redondeado */
    box-shadow: 0 5px 15px rgba(0,0,0,0.6);
    width: 95%; /* Más ancho en móvil */
    max-width: 450px; /* Ancho máximo más pequeño */
    color: var(--text-color);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem; /* Menos gap */
}

.modal-header h2 { /* Simplificado */
    margin: 0 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1.3rem; /* Ligeramente más pequeño */
    color: var(--highlight-color);
}


.modal-actions {
    display: flex;
    justify-content: space-around; /* Espaciado uniforme */
    gap: 1rem;
    margin-top: 1rem;
}

.modal-actions .action-button {
    flex-grow: 1; /* Botones ocupan espacio */
    min-width: 100px;
}

/* Drag and Drop styles */
.card-item.dragging {
    opacity: 0.4;
    transform: scale(0.9);
    border: 2px dashed var(--highlight-color);
}

.cards-grid.drag-over, .selected-deck.drag-over {
    /* Usar outline para no afectar layout */
    outline: 3px dashed var(--highlight-color);
    outline-offset: -3px;
    background-color: rgba(76, 201, 240, 0.05) !important; /* Más sutil */
}

/* Filter options */
.filter-options {
    display: flex;
    gap: 0.8rem; /* Menos gap */
    margin-bottom: 1rem;
    flex-wrap: wrap; /* Allow filters to wrap on small screens */
}

.filter-options select,
.filter-options input[type="text"] {
    padding: 0.6rem 0.8rem; /* Ajustado */
    border-radius: 4px;
    border: 1px solid #444;
    background-color: #2a2a2a;
    color: var(--text-color);
    font-size: 0.9rem;
    flex: 1 1 180px; /* Permitir crecer y encoger, base de 180px */
}


/* Defense Tier Sections */
.defense-tiers-container {
    display: flex;
    flex-direction: column;
    gap: 1rem; /* Menos gap */
    max-height: 35vh; /* Limitar altura en móvil para que quepa */
    overflow-y: auto; /* Scroll si es necesario */
    padding-right: 5px; /* Espacio para scrollbar */
}

.rarity-tier-section {
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.8rem; /* Menos padding */
    border-radius: 6px;
    background-color: rgba(0, 0, 0, 0.2); /* Slight background for tiers */
}

.rarity-tier-section h3 {
    font-size: 1rem; /* Más pequeño */
    color: #eee;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rarity-tier-section h3 span { /* Count spans within h3 */
    font-size: 0.8rem;
    color: #aaa;
}

/* --- ESTILO PARA CARTA SELECCIONADA EN MÓVIL --- */
.card-item.selected-for-placement {
    outline: 3px solid var(--highlight-color);
    outline-offset: -1px; /* Ajustar offset */
    transform: scale(1.03); /* Efecto sutil */
    box-shadow: 0 0 10px var(--highlight-color); /* Sombra de color */
}


/* Media Queries for responsiveness */
@media (min-width: 768px) {

    /* --- INICIO RESTAURAR HEADER ESCRITORIO --- */
    header {
        padding: 1rem 2rem; /* Restaurar padding original */
        flex-wrap: nowrap; /* Evitar que envuelvan */
        justify-content: space-between; /* Restaurar space-between */
        gap: 1.5rem; /* Restaurar gap original si es necesario */
        margin-bottom: 1.5rem; /* Restaurar margen */
    }

    h1 {
        font-size: 1.8rem; /* Restaurar tamaño */
        width: auto; /* Quitar ancho 100% */
        margin-bottom: 0; /* Quitar margen inferior */
        text-align: left; /* Alinear a la izquierda */
    }

    .user-info {
        justify-content: flex-end; /* Alinear a la derecha */
        width: auto; /* Quitar ancho 100% */
        gap: 1.5rem; /* Restaurar gap */
        font-size: 0.95rem; /* Restaurar tamaño texto */
        flex-wrap: nowrap; /* Evitar que envuelvan */
    }

     /* Restaurar tamaño botones header */
    .user-info .action-button {
         padding: 0.75rem 1.5rem; /* Restaurar padding */
         font-size: 1rem; /* O el tamaño que tuvieras */
         min-width: 120px; /* Restaurar ancho mínimo */
         flex-grow: 0; /* No crecer */
         flex-basis: auto; /* Base automática */
    }
    /* --- FIN RESTAURAR HEADER ESCRITORIO --- */


    main {
        flex-direction: row; /* Main content in a row for larger screens */
        align-items: flex-start;
    }

    .main-content-wrapper {
        flex-direction: row; /* Main layout is now side-by-side */
        gap: 3rem; /* More space between columns */
    }

    /* --- Resetear padding de colección en escritorio --- */
    .card-collection {
        flex: 3; /* Collection takes 3 parts (e.g., 60%) */
        max-height: calc(100vh - 120px); /* Ajustar altura máxima */
        overflow-y: auto; /* Scroll for collection */
        padding-right: 1rem; /* Reducir padding scrollbar */
        padding-bottom: 0; /* Resetear padding inferior */
        background-color: rgba(30, 30, 30, 0.6) !important; /* Restaurar fondo original si cambió */
    }

    /* --- Resetear sticky wrapper en escritorio --- */
    .deck-sections-wrapper {
        flex: 2; /* Deck sections take 2 parts (e.g., 40%) */
        position: sticky; /* Mantener sticky arriba */
        top: 1.5rem; /* Alinear arriba */
        bottom: auto; /* Resetear bottom */
        align-self: flex-start;
        z-index: 10; /* Z-index normal */
        max-height: calc(100vh - 120px); /* Ajustar altura máxima */
        overflow-y: auto; /* Enable scrolling within the sticky column */
        padding: 0; /* Resetear padding móvil */
        margin: 0; /* Resetear margen móvil */
        background-color: transparent; /* Resetear fondo móvil */
        box-shadow: none; /* Resetear sombra móvil */
        border-top: none; /* Resetear borde móvil */
        gap: 2rem; /* Restaurar gap original */
    }


    /* Deck builder container layout */
    .deck-builder-container {
        /* No necesita cambios específicos aquí si ya está dentro de deck-sections-wrapper */
    }

    /* Tiers container no necesita limitar altura en escritorio */
    .defense-tiers-container {
        max-height: none;
        overflow-y: visible;
        padding-right: 0;
        gap: 1.5rem; /* Restaurar gap */
    }

    /* Restaurar padding de Tiers */
     .rarity-tier-section {
        padding: 1rem;
    }
     .rarity-tier-section h3 {
        font-size: 1.1rem;
    }

    /* Card grid adjustments */
    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); /* Restaurar tamaño */
        gap: 1rem; /* Restaurar gap */
        min-height: 496px; /* --- CAMBIO ---: 250px -> 496px (para 2 filas desktop) */
    }
     .selected-deck {
        min-height: 496px; /* --- CAMBIO ---: 250px -> 496px (para 2 filas desktop) */
    }


    /* Card item adjustments */
    .card-item {
        min-height: 240px; /* Restaurar altura */
        border-radius: 10px; /* Restaurar redondeo */
    }
     .card-item .card-image {
        border-radius: 10px;
    }

    /* Botón quitar */
    .remove-from-current-deck-button {
         width: 28px; height: 28px; font-size: 16px; line-height: 28px;
    }
    /* Label rareza */
    .rarity-label {
        font-size: 0.75rem; padding: 4px 10px; border-radius: 6px; bottom: 8px; left: 8px;
    }


    /* Buttons */
    .action-button {
        padding: 0.75rem 1.5rem;
        border-radius: 8px;
        min-width: 120px;
        font-size: 1rem;
    }

    .deck-actions .action-button, .main-deck-actions .action-button {
        flex-grow: 0; /* No crecer */
        flex-basis: auto; /* Base automática */
        min-width: 180px; /* Restaurar ancho mínimo */
        /* gap: 1rem; /* El gap ya está en el contenedor (.deck-actions) */
    }
     .saved-feedback { right: 5px; }


    /* Capacity Bar */
    .deck-capacity-bar-container { height: 10px; border-radius: 5px; margin-top: 10px;}
    .deck-capacity-bar { border-radius: 5px; }

    /* Empty messages */
    .empty-message, .loading-message, .empty-deck-message {
        padding: 1.5rem; font-size: 1rem;
    }

    /* Message container */
    .message-container { bottom: 20px; padding: 12px 25px; border-radius: 8px; font-size: 1rem;}


    /* Modal size adjustment */
    .modal-content {
        width: 70%;
        max-width: 600px; /* Restaurar ancho modal */
        padding: 2rem; /* Restaurar padding */
        gap: 1.5rem; /* Restaurar gap */
    }
     .modal-header h2 { font-size: 1.5rem; }


    /* Filters */
    .filter-options select,
    .filter-options input[type="text"] {
        padding: 0.7rem 1rem;
        border-radius: 6px;
        font-size: 0.9rem;
        flex: 0 1 200px; /* No crecer, base 200px */
    }

}

/* ========================================================== */
/*    ESTILOS PERSONALIZADOS – SIN CAMBIAR EL TAMAÑO BASE     */
/* ========================================================== */

/* BOTÓN: MEJORA DE CARTAS (Violeta claro + icono 🛠️) */
#admin-upgrade-button {
    background-color: #a463ff !important; /* violeta claro */
    color: white !important;
    text-decoration: none !important;

    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px; /* espacio entre icono y texto */

    position: relative;
    overflow: hidden;
}

/* Icono de mejora */
#admin-upgrade-button::before {
    content: "🛠️";
    font-size: 1.1rem;
}

/* Barrido suave */
#admin-upgrade-button::after {
    content: "";
    position: absolute;
    top: 0;
    left: -120%;
    width: 200%;
    height: 100%;

    background: linear-gradient(
        115deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );

    animation: sweepEffect 2.5s infinite ease-in-out;
    pointer-events: none;
    opacity: 0.35;
}

/* ---------------------------------------------------------- */
/* BOTÓN: IR A LA BATALLA (icono ⚔️ + barrido suave) */
/* ---------------------------------------------------------- */
#go-to-battle-button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none !important;

    position: relative;
    overflow: hidden;
}

/* Icono batalla */
#go-to-battle-button::before {
    content: "⚔️";
    font-size: 1.1rem;
}

/* Barrido */
#go-to-battle-button::after {
    content: "";
    position: absolute;
    top: 0;
    left: -120%;
    width: 200%;
    height: 100%;

    background: linear-gradient(
        115deg,
        transparent 0%,
        rgba(255, 255, 255, 0.25) 50%,
        transparent 100%
    );

    animation: sweepEffect 2.4s infinite;
    opacity: 0.30;
    pointer-events: none;
}

/* Animación compartida */
@keyframes sweepEffect {
    0% { left: -130%; }
    50% { left: 15%; }
    100% { left: 130%; }
}


/* ================================================= */
/* ===== ESTILO PARA EL INDICADOR DE ORDEN DE CARTA ===== */
/* ================================================= */

.card-item .order-indicator {
    position: absolute;
    top: 5px;
    left: 5px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    font-weight: bold;
    font-size: 14px;
    width: 24px;
    height: 24px;
    border-radius: 50%; /* Para hacerlo un círculo */
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 24px; /* Centrado vertical */
    border: 1px solid white;
    z-index: 15; /* Asegura que esté por encima de la imagen pero debajo de botones si solapan */
}