/* Variables globales pour le thème sombre */
:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-card: #2a2a2a;
    --bg-hover: #3a3a3a;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;
    --border-color: #404040;
    --accent-primary: #4a9eff;
    --accent-secondary: #6b46c1;

    /* Couleurs des raretés */
    --rarity-common: #ffffff;
    --rarity-rare: #3b82f6;
    --rarity-very-rare: #10b981;
    --rarity-epic: #f59e0b;
    --rarity-legendary: #ef4444;

    /* Animations */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #1a1a2e 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.game-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px;
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    position: relative;
}

.settings-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.settings-btn:hover,
.settings-btn:active {
    background: var(--bg-hover);
    transform: rotate(90deg);
    border-color: var(--accent-primary);
}

/* Responsive pour le bouton paramètres */
@media (max-width: 768px) {
    .settings-btn {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
}

.game-header h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.player-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.stat {
    background: var(--bg-card);
    padding: 15px 25px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.stat .label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.stat span:last-child {
    font-weight: bold;
    color: var(--accent-primary);
    font-size: 1.1rem;
}

.countdown-stat {
    background: linear-gradient(135deg, var(--bg-card) 0%, #2a2a4a 100%);
    border-color: #4a9eff;
}

.countdown-stat .label {
    color: #4a9eff;
}

.countdown-stat #next-credit-countdown {
    font-weight: bold;
    font-size: 1.1rem;
    font-family: 'Courier New', monospace;
}

/* Navigation par thèmes */
.theme-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.tab-btn {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition-normal);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 120px;
    position: relative;
}

.tab-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.tab-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* Indicateurs de progression sur les onglets */
.theme-completion {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
}

/* Indicateur d'amélioration sur les onglets */
.theme-upgrade-indicator {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #ef4444;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    z-index: 10;
    animation: pulse-upgrade 2s ease-in-out infinite;
    cursor: pointer;
}

@keyframes pulse-upgrade {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    }
}

.completion-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

/* Segments de rareté dans la barre de progression */
.completion-segment {
    position: absolute;
    top: 0;
    height: 100%;
    transition: all var(--transition-normal);
    border-radius: 2px;
}

/* Styles spécifiques pour chaque rareté */
.completion-segment.rarity-common {
    opacity: 0.9;
}

.completion-segment.rarity-rare {
    opacity: 0.95;
}

.completion-segment.rarity-very-rare {
    opacity: 1;
    box-shadow: 0 0 4px rgba(16, 185, 129, 0.3);
}

.completion-segment.rarity-epic {
    opacity: 1;
    box-shadow: 0 0 4px rgba(245, 158, 11, 0.4);
}

.completion-segment.rarity-legendary {
    opacity: 1;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
    animation: legendary-glow 2s ease-in-out infinite alternate;
}

@keyframes legendary-glow {
    from {
        box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
    }
    to {
        box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
    }
}

.completion-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s ease, background-color 0.3s ease;
    position: relative;
}

.completion-fill.low {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

.completion-fill.low-medium {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.completion-fill.medium {
    background: linear-gradient(90deg, #eab308, #facc15);
}

.completion-fill.high {
    background: linear-gradient(90deg, #22c55e, #4ade80);
}

.completion-fill.complete {
    background: linear-gradient(90deg, #10b981, #34d399);
    animation: completeGlow 2s ease-in-out infinite alternate;
}

@keyframes completeGlow {
    from { box-shadow: 0 0 5px rgba(16, 185, 129, 0.5); }
    to { box-shadow: 0 0 15px rgba(16, 185, 129, 0.8); }
}

.completion-text {
    font-size: 0.7rem;
    font-weight: 600;
    opacity: 0.9;
}

/* Styles des onglets selon leur progression */
.tab-btn.complete {
    border-color: var(--rarity-very-rare);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.tab-btn.complete:not(.active) {
    background: linear-gradient(135deg, var(--bg-card), rgba(16, 185, 129, 0.1));
}

.tab-btn.high:not(.active) {
    background: linear-gradient(135deg, var(--bg-card), rgba(34, 197, 94, 0.1));
}

.tab-btn.medium:not(.active) {
    background: linear-gradient(135deg, var(--bg-card), rgba(234, 179, 8, 0.1));
}

.tab-btn.low-medium:not(.active) {
    background: linear-gradient(135deg, var(--bg-card), rgba(245, 158, 11, 0.1));
}

.tab-btn.low:not(.active) {
    background: linear-gradient(135deg, var(--bg-card), rgba(239, 68, 68, 0.1));
}

/* Panel d'actions */
.action-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 20px;
}

.draw-btn {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.draw-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(74, 158, 255, 0.3);
}

.draw-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.draw-cooldown {
    display: block;
    font-size: 0.8rem;
    margin-top: 5px;
    opacity: 0.8;
}

.filters {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.filters select,
.filters input {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: var(--transition-fast);
}

.filters select:focus,
.filters input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

/* Grille de collection */
.collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 50px;
}

/* Cartes */
.card {
    background: var(--bg-card);
    border-radius: 16px;
    border: 2px solid var(--border-color);
    padding: 20px;
    cursor: pointer;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
    border-color: var(--accent-primary);
}

.card.owned {
    border-color: var(--rarity-common);
}

.card.owned.rare {
    border-color: var(--rarity-rare);
}

.card.owned.very_rare {
    border-color: var(--rarity-very-rare);
}

.card.owned.epic {
    border-color: var(--rarity-epic);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
}

.card.owned.legendary {
    border-color: var(--rarity-legendary);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
    animation: legendary-glow 2s ease-in-out infinite alternate;
}

@keyframes legendary-glow {
    from { box-shadow: 0 0 20px rgba(239, 68, 68, 0.3); }
    to { box-shadow: 0 0 30px rgba(239, 68, 68, 0.6); }
}

.card.not-owned {
    opacity: 0.4;
    background: var(--bg-secondary);
}

.card-image {
    width: 100%;
    height: 210px;
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-hover));
    border-radius: 12px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    border: 1px solid var(--border-color);
    overflow: hidden;
    position: relative;
}

/* Style unifié pour les visuels de cartes (images et emojis) */
.card-visual-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    transition: transform var(--transition-normal);
}

.card-visual-image.small {
    max-height: 80px;
}

.card-visual-image.medium {
    max-height: 210px;
    object-fit: cover;
    object-position: center top;
}

.card-visual-image.large {
    max-height: 200px;
    object-fit: cover;
    object-position: center top;
}

/* Animation de défilement vertical automatique pour les images */
.card-visual-image.medium {
    animation: pan-vertical 12s ease-in-out infinite;
    transform-origin: center;
}

@keyframes pan-vertical {
    0%, 15% {
        object-position: center top;
    }
    42%, 58% {
        object-position: center bottom;
    }
    85%, 100% {
        object-position: center top;
    }
}

.card-visual-emoji {
    display: inline-block;
    transition: transform var(--transition-normal);
}

/* Visuels dans la modal */
.modal-visual {
    z-index: 2;
    position: relative;
}

/* Animation automatique pour les grandes images dans la modal */
.modal-visual.card-visual-image.large {
    object-position: center top;
    animation: pan-vertical-modal 16s ease-in-out infinite;
}

@keyframes pan-vertical-modal {
    0%, 20% {
        object-position: center top;
    }
    40%, 60% {
        object-position: center bottom;
    }
    80%, 100% {
        object-position: center top;
    }
}

.card-info h3 {
    margin-bottom: 8px;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.card-name {
    text-align: center;
    margin: 0;
    padding-bottom: 20px;
}

/* Bandeau de rareté en bas de carte avec dégradé */
.card-rarity-banner {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 0 15px 15px;
    backdrop-filter: blur(5px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.card-rarity-banner .rarity-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    z-index: 2;
    position: relative;
}

/* Dégradés pour chaque rareté */
.card-rarity-banner.mystery {
    background: linear-gradient(90deg,
        rgba(128, 128, 128, 0.9) 0%,
        rgba(128, 128, 128, 1) 50%,
        rgba(128, 128, 128, 0.9) 100%);
}

.card-rarity-banner.common {
    background: linear-gradient(90deg,
        rgba(185, 185, 185, 0.9) 0%,
        rgba(185, 185, 185, 1) 50%,
        rgba(185, 185, 185, 0.9) 100%);
}

.card-rarity-banner.rare {
    background: linear-gradient(90deg,
        rgba(52, 152, 219, 0.9) 0%,
        rgba(52, 152, 219, 1) 50%,
        rgba(52, 152, 219, 0.9) 100%);
}

.card-rarity-banner.very_rare {
    background: linear-gradient(90deg,
        rgba(155, 89, 182, 0.9) 0%,
        rgba(155, 89, 182, 1) 50%,
        rgba(155, 89, 182, 0.9) 100%);
}

.card-rarity-banner.epic {
    background: linear-gradient(90deg,
        rgba(241, 196, 15, 0.9) 0%,
        rgba(241, 196, 15, 1) 50%,
        rgba(241, 196, 15, 0.9) 100%);
}

.card-rarity-banner.legendary {
    background: linear-gradient(90deg,
        rgba(231, 76, 60, 0.9) 0%,
        rgba(231, 76, 60, 1) 20%,
        rgba(255, 215, 0, 1) 50%,
        rgba(231, 76, 60, 1) 80%,
        rgba(231, 76, 60, 0.9) 100%);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* Animation d'apparition du bandeau */
.card-rarity-banner {
    animation: bannerSlideUp 0.3s ease-out;
}

@keyframes bannerSlideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.card-points {
    background: var(--accent-primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 8px;
}

.card-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
    max-height: 65px;
    overflow: hidden;
    position: relative;
}

/* Animation de défilement pour descriptions longues */
.card-description.needs-scroll {
    mask-image: linear-gradient(to bottom,
        black 0%,
        black 80%,
        transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom,
        black 0%,
        black 80%,
        transparent 100%);
}

.card-description-inner {
    display: block;
    transition: transform 0.3s ease;
}

/* Animation au hover uniquement si nécessaire */
.card:hover .card-description.needs-scroll .card-description-inner {
    animation: scrollText 8s linear infinite;
}

@keyframes scrollText {
    0%, 10% {
        transform: translateY(0);
    }
    45%, 55% {
        transform: translateY(calc(-100% + 65px));
    }
    90%, 100% {
        transform: translateY(0);
    }
}

.card-count {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--accent-primary);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(74, 158, 255, 0.4);
}

/* Indicateur d'amélioration sur les cartes */
.card-upgrade-indicator {
    position: absolute;
    top: 10px;
    left: 10px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 6px;
    border-radius: 50%;
    font-size: 0.9rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 3px 10px rgba(16, 185, 129, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    animation: pulse-upgrade 2s ease-in-out infinite;
}

.card-upgrade-indicator:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.7);
}

@keyframes pulse-upgrade {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

/* Cartes mystères */
.mystery-card {
    font-size: 3rem;
    opacity: 0.3;
    filter: blur(2px);
}

.card-description.mystery {
    font-style: italic;
    opacity: 0.6;
}

.card-emoji-large.mystery {
    opacity: 0.3;
    filter: blur(3px);
}

.card-description-text.mystery {
    font-style: italic;
    opacity: 0.7;
    color: var(--text-muted);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    backdrop-filter: blur(8px);
}

.modal-content {
    background: transparent;
    margin: 2% auto;
    padding: 20px;
    width: 95%;
    max-width: 500px;
    position: relative;
    animation: modalSlideIn 0.3s ease;
    max-height: 95vh;
    overflow-y: auto;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-50px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.close {
    color: var(--text-muted);
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition-fast);
    z-index: 1001;
}

.close:hover {
    color: var(--text-primary);
    transform: scale(1.1);
}

/* Visualiseur de carte physique */
.card-viewer {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.physical-card {
    width: 320px;
    height: 480px;
    background: var(--bg-card);
    border-radius: 20px;
    border: 3px solid var(--border-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: visible;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
}

.card-count-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--accent-primary);
    color: white;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 700;
    z-index: 10;
    box-shadow: 0 4px 10px rgba(74, 158, 255, 0.3);
}

.physical-card.common {
    border-color: var(--rarity-common);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(255, 255, 255, 0.1) 100%);
}

.physical-card.rare {
    border-color: var(--rarity-rare);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(59, 130, 246, 0.2) 100%);
    box-shadow: 0 25px 50px rgba(59, 130, 246, 0.3);
}

.physical-card.very_rare {
    border-color: var(--rarity-very-rare);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(16, 185, 129, 0.2) 100%);
    box-shadow: 0 25px 50px rgba(16, 185, 129, 0.3);
}

.physical-card.epic {
    border-color: var(--rarity-epic);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(245, 158, 11, 0.2) 100%);
    box-shadow: 0 25px 50px rgba(245, 158, 11, 0.4);
}

.physical-card.legendary {
    border-color: var(--rarity-legendary);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(239, 68, 68, 0.2) 100%);
    box-shadow: 0 25px 50px rgba(239, 68, 68, 0.5);
    animation: legendaryCardGlow 2s ease-in-out infinite alternate;
}

@keyframes legendaryCardGlow {
    from { box-shadow: 0 25px 50px rgba(239, 68, 68, 0.5); }
    to { box-shadow: 0 30px 60px rgba(239, 68, 68, 0.8); }
}

.card-border {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    pointer-events: none;
}

.card-header {
    text-align: center;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.card-title {
    font-size: 1.4rem;
    margin-bottom: 8px;
    color: var(--text-primary);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.card-rarity-badge {
    font-size: 0.9rem;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.card-artwork {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 15px 0;
    position: relative;
}

.artwork-frame {
    width: 220px;
    height: 200px;
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-hover));
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.card-emoji-large {
    font-size: 6rem;
    z-index: 2;
    position: relative;
}

/* Image dans la carte de la modal */
.card-artwork-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 2;
    position: relative;
}

.holographic-effect {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: translateX(-100%);
    animation: holographicShine 3s ease-in-out infinite;
}

@keyframes holographicShine {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
}

.card-info-section {
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
    margin-bottom: 15px;
}

.card-description-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 15px;
    text-align: center;
}

.card-stats-bar {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.stat-box {
    flex: 1;
    text-align: center;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.stat-value {
    font-size: 1rem;
    font-weight: bold;
    color: var(--accent-primary);
    margin-bottom: 2px;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.card-theme {
    font-size: 0.8rem;
    opacity: 0.8;
}

.card-collection-number {
    font-size: 0.7rem;
    opacity: 0.6;
}

.not-owned-overlay {
    text-align: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    color: var(--text-muted);
    font-style: italic;
}

/* Boutons d'action */
.modal-actions {
    margin-top: 25px;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.modal-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.modal-btn:hover {
    background: var(--accent-secondary);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(74, 158, 255, 0.3);
}

.modal-btn.secondary {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
}

.modal-btn.upgrade-btn {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.2));
    border: 2px solid rgba(16, 185, 129, 0.4);
    color: var(--text-primary);
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.modal-btn.upgrade-btn:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(5, 150, 105, 0.3));
    border-color: rgba(16, 185, 129, 0.6);
    transform: translateY(-2px);
}

.btn-cost {
    font-size: 0.7rem;
    opacity: 0.9;
}

/* Info d'amélioration */
.upgrade-info-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.info-icon {
    font-size: 1.2rem;
}

.info-text {
    flex: 1;
}

/* Barre de progression d'amélioration */
.upgrade-progress {
    margin-top: 15px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.progress-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 4px;
    transition: width 0.5s ease;
    min-width: 2px;
}

.progress-text {
    font-size: 0.75rem;
    color: var(--accent-primary);
    text-align: center;
    font-weight: 600;
}

/* Animations d'amélioration */
.physical-card.upgrading {
    animation: cardUpgradeGlow 0.5s ease-in-out;
    transform: scale(1.05);
}

@keyframes cardUpgradeGlow {
    0%, 100% {
        box-shadow: 0 25px 50px rgba(0,0,0,0.5);
        filter: brightness(1);
    }
    50% {
        box-shadow: 0 30px 70px rgba(255, 255, 255, 0.6);
        filter: brightness(1.3);
    }
}

.physical-card.upgrade-complete {
    animation: upgradeComplete 1.5s ease-out;
}

@keyframes upgradeComplete {
    0% { transform: scale(1.05); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.upgrade-particles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 100;
}

.upgrade-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: particleExplode 1.5s ease-out forwards;
}

@keyframes particleExplode {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0);
    }
    50% {
        opacity: 1;
        transform: translate(calc(-50% + var(--end-x)), calc(-50% + var(--end-y))) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--end-x)), calc(-50% + var(--end-y))) scale(0);
    }
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 15px 25px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    transform: translateX(400px);
    transition: var(--transition-normal);
    z-index: 1001;
    max-width: 350px;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-color: var(--rarity-very-rare);
    background: linear-gradient(135deg, var(--bg-secondary), #0f4c3c);
}

.toast.error {
    border-color: var(--rarity-legendary);
    background: linear-gradient(135deg, var(--bg-secondary), #4c0f0f);
}

/* Animation de pioche - Overlay modal avec carte tournoyante */
.draw-animation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.draw-animation-overlay.show {
    opacity: 1;
}

.animated-card {
    width: 300px;
    height: 420px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

.animated-card.flipping {
    animation: cardFlip 2s ease-in-out;
}

@keyframes cardFlip {
    0% {
        transform: rotateY(0deg) scale(0.5) translateY(50px);
        opacity: 0;
    }
    15% {
        opacity: 1;
        transform: rotateY(180deg) scale(0.8) translateY(0px);
    }
    50% {
        transform: rotateY(540deg) scale(1.1) translateY(-20px);
    }
    85% {
        transform: rotateY(720deg) scale(1.05) translateY(-10px);
    }
    100% {
        transform: rotateY(720deg) scale(1) translateY(0px);
    }
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 20px;
    border: 3px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.card-face.back {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #1a1a2e 100%);
    transform: rotateY(180deg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-back-pattern {
    font-size: 6rem;
    opacity: 0.3;
    animation: pulse 2s ease-in-out infinite alternate;
}

@keyframes pulse {
    from { opacity: 0.2; transform: scale(0.95); }
    to { opacity: 0.4; transform: scale(1.05); }
}

.card-face.front {
    background: var(--bg-card);
    padding: 20px;
    transform: rotateY(0deg);
}

.card-face.front.common {
    border-color: var(--rarity-common);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(255, 255, 255, 0.1) 100%);
}

.card-face.front.rare {
    border-color: var(--rarity-rare);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(59, 130, 246, 0.2) 100%);
    box-shadow: 0 20px 40px rgba(59, 130, 246, 0.3);
}

.card-face.front.very_rare {
    border-color: var(--rarity-very-rare);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(16, 185, 129, 0.2) 100%);
    box-shadow: 0 20px 40px rgba(16, 185, 129, 0.3);
}

.card-face.front.epic {
    border-color: var(--rarity-epic);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(245, 158, 11, 0.2) 100%);
    box-shadow: 0 20px 40px rgba(245, 158, 11, 0.4);
    animation: epicGlow 1.5s ease-in-out infinite alternate;
}

@keyframes epicGlow {
    from { box-shadow: 0 20px 40px rgba(245, 158, 11, 0.4); }
    to { box-shadow: 0 25px 50px rgba(245, 158, 11, 0.6); }
}

.card-face.front.legendary {
    border-color: var(--rarity-legendary);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(239, 68, 68, 0.2) 100%);
    box-shadow: 0 20px 40px rgba(239, 68, 68, 0.5);
    animation: legendaryGlow 1s ease-in-out infinite alternate;
}

@keyframes legendaryGlow {
    from {
        box-shadow: 0 20px 40px rgba(239, 68, 68, 0.5);
        transform: scale(1);
    }
    to {
        box-shadow: 0 30px 60px rgba(239, 68, 68, 0.8);
        transform: scale(1.02);
    }
}

.animated-card-image {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-hover));
    border-radius: 15px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
    border: 2px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

/* Image dans l'animation de pioche */
.animated-card-image-content {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 15px;
    object-position: center top;
}

/* Animation automatique dans l'animation de pioche */
.animated-card-image .animated-card-image-content {
    animation: pan-vertical-draw 20s ease-in-out infinite !important;
    z-index: 3;
    position: relative;
}

/* Assure-toi que l'animation démarre immédiatement */
.animated-card-image .animated-card-image-content {
    animation-delay: 0s !important;
    animation-play-state: running !important;
}

@keyframes pan-vertical-draw {
    0%, 25% {
        object-position: center top;
    }
    37%, 63% {
        object-position: center bottom;
    }
    75%, 100% {
        object-position: center top;
    }
}

.animated-card-image::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(45deg);
    animation: shine 3s ease-in-out infinite;
    z-index: 1;
    pointer-events: none;
}

@keyframes shine {
    0%, 100% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    50% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.animated-card-info h2 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    text-align: center;
    color: var(--text-primary);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.animated-card-rarity {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 15px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.animated-card-description {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.4;
    margin-bottom: 20px;
}

.draw-animation-buttons {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    opacity: 0;
    animation: fadeInButtons 0.5s ease 2.5s forwards;
}

@keyframes fadeInButtons {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.draw-animation-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(74, 158, 255, 0.3);
}

.draw-animation-btn:hover {
    background: var(--accent-secondary);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 158, 255, 0.4);
}

.draw-animation-btn.secondary {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Effets de particules pour les raretés élevées */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: particleFloat 3s ease-in-out infinite;
}

.particle.epic {
    background: var(--rarity-epic);
    box-shadow: 0 0 10px var(--rarity-epic);
}

.particle.legendary {
    background: var(--rarity-legendary);
    box-shadow: 0 0 15px var(--rarity-legendary);
    animation: particleFloatLegendary 2s ease-in-out infinite;
}

@keyframes particleFloat {
    0%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0;
    }
    10% { opacity: 1; }
    50% {
        transform: translateY(-100px) scale(1.2);
        opacity: 0.8;
    }
    90% { opacity: 1; }
}

@keyframes particleFloatLegendary {
    0%, 100% {
        transform: translateY(0) scale(1) rotate(0deg);
        opacity: 0;
    }
    10% { opacity: 1; }
    50% {
        transform: translateY(-150px) scale(1.5) rotate(180deg);
        opacity: 1;
    }
    90% { opacity: 1; }
}

/* Animations d'entrée pour les nouvelles cartes dans la collection */
@keyframes cardDraw {
    0% {
        opacity: 0;
        transform: scale(0.8) rotateY(90deg);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1) rotateY(45deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotateY(0deg);
    }
}

/* Styles pour l'affichage multiple de cartes */
.multiple-cards-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90%;
    max-width: 800px;
    background: var(--bg-secondary);
    border-radius: 20px;
    border: 2px solid var(--accent-primary);
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
}

.multiple-cards-header {
    margin-bottom: 20px;
}

.multiple-cards-header h2 {
    color: var(--text-primary);
    font-size: 1.8rem;
    text-align: center;
    margin: 0;
}

.multiple-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 15px;
    width: 100%;
    margin-bottom: 30px;
    max-height: 70vh;
    overflow-y: auto;
}

/* Quand il n'y a qu'une seule carte, centre-la et limite sa largeur */
.multiple-cards-grid:has(.grouped-card:only-child) {
    grid-template-columns: 1fr;
    justify-items: center;
}

.multiple-cards-grid .grouped-card:only-child {
    max-width: 200px;
    width: 100%;
}

.grouped-card {
    background: var(--bg-card);
    border-radius: 8px; /* 16px / 2 */
    border: 1px solid var(--border-color); /* 2px / 2 */
    padding: 10px; /* 20px / 2 */
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
}

.grouped-card.revealed {
    opacity: 1;
    transform: translateY(0);
}

.grouped-card.new-card {
    border-color: var(--rarity-rare);
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.3);
    animation: wiggle-loop 2.6s ease-in-out infinite;
}

/* Animation de gigotement en boucle pour les nouvelles cartes */
@keyframes wiggle-loop {
    /* Gigotement pendant les premières 23% (0.6s) */
    0% {
        transform: translateY(0) rotate(0deg);
    }
    3.8% { /* 15% de 23% */
        transform: translateY(-2px) rotate(-2deg);
    }
    7.7% { /* 30% de 23% */
        transform: translateY(2px) rotate(2deg);
    }
    11.5% { /* 45% de 23% */
        transform: translateY(-1px) rotate(-1deg);
    }
    15.4% { /* 60% de 23% */
        transform: translateY(1px) rotate(1deg);
    }
    19.2% { /* 75% de 23% */
        transform: translateY(-1px) rotate(-0.5deg);
    }
    23% {
        transform: translateY(0) rotate(0deg);
    }
    /* Pause de 2 secondes (77% du temps) */
    23%, 100% {
        transform: translateY(0) rotate(0deg);
    }
}

/* Bandeau "New!" diagonal dans le coin */
.new-card-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    background: linear-gradient(135deg, #ffd700, #ffb300);
    color: #333;
    padding: 2px 8px;
    font-size: 0.6rem;
    font-weight: bold;
    text-transform: uppercase;
    z-index: 15;
    transform: rotate(-45deg);
    transform-origin: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    animation: pulse-new-badge 1.5s ease-in-out infinite;
}

/* Animation de pulsation pour le badge "New!" */
@keyframes pulse-new-badge {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.9;
    }
}

.grouped-card.duplicate-card {
    border-color: var(--border-color);
}

/* Cartes miniatures à l'échelle 1/2 */
.grouped-card .card-image {
    height: 105px; /* 210px / 2 */
    margin-bottom: 7px; /* 15px / 2 */
}

.grouped-card .card-name {
    font-size: 0.6rem; /* 1.2rem / 2 */
    padding-bottom: 10px; /* 20px / 2 */
}

.grouped-card .card-description {
    margin-top: 5px;
    margin-bottom: 7px;
}

.grouped-card .card-description-inner {
    font-size: 0.45rem; /* 0.9rem / 2 */
    line-height: 1.3;
}

.grouped-card .card-rarity-banner {
    height: 16px; /* 32px / 2 */
    border-radius: 0 0 7px 7px; /* Adapté au border-radius de la carte */
}

.grouped-card .card-rarity-banner .rarity-text {
    font-size: 0.4rem; /* 0.85rem / 2 */
}

.grouped-card .card-count {
    padding: 2px 4px; /* 4px 8px / 2 */
    border-radius: 6px; /* 12px / 2 */
    font-size: 0.4rem; /* 0.8rem / 2 */
    top: 5px; /* 10px / 2 */
    right: 5px; /* 10px / 2 */
}

.grouped-card .new-card-badge {
    top: 3px;
    left: 3px;
    padding: 1px 5px;
    font-size: 0.3rem;
    transform: rotate(-45deg);
}

.card.new-draw {
    animation: cardDraw 0.8s ease-out;
}

/* Modale de paramètres */
.settings-content {
    padding: 20px 0;
}

.setting-item {
    margin-bottom: 20px;
}

.setting-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: var(--text-primary);
}

.setting-item input {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 1rem;
}

.setting-item input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.credits-controls {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.settings-btn-action {
    padding: 10px 20px;
    border: 2px solid var(--accent-primary);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--accent-primary);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-weight: bold;
}

.settings-btn-action:hover {
    background: var(--accent-primary);
    color: white;
    transform: translateY(-2px);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .game-header h1 {
        font-size: 2rem;
    }

    .player-stats {
        gap: 20px;
    }

    .action-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .filters {
        justify-content: center;
    }

    .collection-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
    }

    .modal-content {
        margin: 10% auto;
        padding: 20px;
        width: 95%;
    }

    /* Animation responsive sur mobile */
    .animated-card {
        width: 280px;
        height: 390px;
    }

    /* Carte physique sur mobile */
    .physical-card {
        width: 290px;
        height: 450px;
        padding: 15px;
    }

    .artwork-frame {
        width: 180px;
        height: 160px;
    }

    .card-emoji-large {
        font-size: 5rem;
    }

    .animated-card-image {
        height: 180px;
        font-size: 4rem;
    }

    .animated-card-info h2 {
        font-size: 1.6rem;
    }

    .animated-card-rarity {
        font-size: 1.1rem;
    }

    .animated-card-description {
        font-size: 0.9rem;
    }

    .draw-animation-buttons {
        bottom: 20px;
        flex-direction: column;
        gap: 10px;
    }

    .draw-animation-btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }

    /* Onglets responsive */
    .tab-btn {
        min-width: 100px;
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .completion-text {
        font-size: 0.6rem;
    }
}

/* États de chargement */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--accent-primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Scrollbar custom */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}