/* Generic Overlay (Fixed position) */
.overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100dvh !important; /* Changé de 100vh à 100dvh pour le mobile */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100000;
    margin: 0 !important;
    padding: 0 !important;
    background-color: rgba(0, 0, 0, 0.85);
}

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

/* Login Overlay */
#login-overlay {
    background-color: #1a1a1a;
    z-index: 210000 !important;
}

.login-content {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    padding: 50px;
    border-radius: 20px;
    text-align: center;
    color: white;
    border: 2px solid #3498db;
    box-shadow: 0 0 50px rgba(52, 152, 219, 0.3);
}

.login-content h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    color: #3498db;
}

.login-content h2 {
    margin-bottom: 40px;
    color: #bdc3c7;
}

.login-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 20px;
}

.menu-btn {
    padding: 12px 30px;
    font-size: 1.1rem;
    background-color: #3498db;
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
}

.menu-btn:hover {
    background-color: #2980b9;
    transform: scale(1.05);
}

.menu-input {
    width: 100%;
    max-width: 300px;
    padding: 12px;
    margin-bottom: 15px;
    border-radius: 8px;
    border: 1px solid #444;
    background-color: #1a1a1a;
    color: white;
    box-sizing: border-box;
}

/* End Turn Button */
.end-turn {
    background: radial-gradient(circle at 30% 30%, #e67e22, #d35400);
    border-color: #fff !important;
    cursor: pointer;
    font-size: 1rem !important;
    letter-spacing: 1px;
}

.end-turn:hover {
    box-shadow: 0 0 15px #e67e22;
}

.end-turn.hidden, .play-all.hidden {
    display: none !important;
}

.play-all {
    background: radial-gradient(circle at 30% 30%, #3498db, #2980b9);
    border-color: #fff !important;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.play-all:hover {
    box-shadow: 0 0 15px #3498db;
}

/* Not My Turn Styles */
body.not-my-turn .card {
    cursor: default !important;
}

body.not-my-turn .market-buyable,
body.not-my-turn .opponent-attackable,
body.not-my-turn .card-attackable,
body.not-my-turn .effect-available {
    pointer-events: none !important;
    cursor: default !important;
    box-shadow: none !important;
    animation: none !important;
}

body.not-my-turn #hand-container {
    opacity: 0.7;
}

#menu-toggle-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 200;
    width: 40px;
    height: 40px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

#menu-toggle-btn:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

#menu-toggle-btn svg {
    width: 24px;
    height: 24px;
}

#settings-menu {
    position: absolute;
    top: 70px;
    right: 20px;
    z-index: 9999;
    background-color: rgba(0, 0, 0, 0.85);
    padding: 20px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    transition: opacity 0.3s, transform 0.3s;
}

#settings-menu.hidden {
    display: none;
    opacity: 0;
    transform: translateY(-10px);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: white;
}

.control-group label {
    font-size: 0.9rem;
    font-weight: bold;
}

.control-group input[type="range"] {
    width: 200px;
    cursor: pointer;
}

#reset-btn {
    margin-top: 10px;
    padding: 10px;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
}

#reset-btn:hover {
    background-color: #c0392b;
}

/* Pile View Overlay Specific */
#pile-view-overlay {
    backdrop-filter: blur(8px) !important;
}

.overlay-content {
    background-color: rgba(44, 62, 80, 0.95);
    border-radius: 15px;
    width: 90%;
    max-width: 1000px;
    height: 90%;
    position: relative;
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
    border: 1px solid rgba(255,255,255,0.1);
}

#close-overlay-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    z-index: 3010;
}

#overlay-title {
    color: white;
    margin-bottom: 20px;
    text-align: center;
    text-transform: capitalize;
    font-size: 2rem;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

#pile-cards-grid {
    flex-grow: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); /* More responsive grid */
    gap: 30px;
    overflow-y: auto;
    padding: 40px;
    justify-items: center;
    align-content: start;
}

/* Scrollbar styling for the grid */
#pile-cards-grid::-webkit-scrollbar {
    width: 8px;
}

#pile-cards-grid::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

#pile-cards-grid::-webkit-scrollbar-thumb {
    background: #7f8c8d;
    border-radius: 4px;
}

/* Stats Containers */
.stats-container {
    position: absolute !important;
    left: 50% !important;
    display: flex !important;
    gap: 5px !important;
    z-index: 5000 !important;
    pointer-events: auto !important;
    height: 60px !important;
    align-items: center !important;
}

#player-stats {
    left: 25% !important; /* Décalé à 25% pour laisser plus de place au centre */
}

#opponent-stats {
    left: 75% !important; /* Décalé à 75% pour laisser plus de place au centre */
}

.stats-container-right {
    position: absolute !important;
    left: 75% !important; /* Aligné à 75% pour être symétrique aux stats joueur */
    display: flex !important;
    gap: 15px !important;
    z-index: 5000 !important;
    pointer-events: auto !important;
    height: 60px !important;
    align-items: center !important;
}

.stats-container.bottom {
    top: 0 !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
}

.stats-container-right.bottom {
    top: 0 !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
}

.stats-container.top {
    top: auto !important;
    bottom: 0 !important;
    transform: translate(-50%, 50%) !important;
}

.stat-circle {
    height: 70%;
    max-height: 60px;
    min-height: 35px;
    aspect-ratio: 1 / 1;
    width: auto;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-circle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.6);
}

/* Dynamic Tooltip system (Absolute Top-Level) */
.dynamic-tooltip {
    position: fixed !important;
    background: rgba(0, 0, 0, 0.95);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.95rem;
    white-space: normal;
    width: max-content;
    max-width: 250px;
    pointer-events: none;
    box-shadow: 0 8px 25px rgba(0,0,0,0.7);
    border: 1px solid rgba(255,255,255,0.2);
    font-weight: normal;
    text-shadow: none;
    line-height: 1.4;
    animation: tooltipAppear 0.15s ease-out;
    z-index: 300000 !important; /* Au-dessus de tous les overlays (incluant deck-selection-overlay à 220000) */
}

@keyframes tooltipAppear {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.dynamic-tooltip.align-left {
    transform-origin: bottom left;
}

.dynamic-tooltip.align-right {
    transform-origin: bottom right;
}

/* Custom Tooltip System */
.custom-tooltip {
    position: relative;
}

.custom-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(-5px) scale(0.95);
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 9000; /* Tooltips: au-dessus des éléments UI mais sous les overlays */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.custom-tooltip::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 9000; /* Tooltips: au-dessus des éléments UI mais sous les overlays */
}

.custom-tooltip:hover::after,
.custom-tooltip:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
}

/* Tooltip Variants */
.custom-tooltip.tooltip-left::after {
    left: 0;
    transform: translateX(0) translateY(-5px) scale(0.95);
}

.custom-tooltip.tooltip-left::before {
    left: 20px;
    transform: translateX(0) translateY(-5px);
}

.custom-tooltip.tooltip-left:hover::after {
    transform: translateX(0) translateY(0) scale(1);
}

.custom-tooltip.tooltip-left:hover::before {
    transform: translateX(0) translateY(0);
}

.custom-tooltip.tooltip-bottom::after {
    bottom: auto;
    top: calc(100% + 10px);
    transform: translateX(-50%) translateY(5px) scale(0.95);
}

.custom-tooltip.tooltip-bottom::before {
    bottom: auto;
    top: calc(100% + 2px);
    border-top-color: transparent;
    border-bottom-color: rgba(0, 0, 0, 0.9);
    transform: translateX(-50%) translateY(5px);
}

.custom-tooltip.tooltip-bottom:hover::after,
.custom-tooltip.tooltip-bottom:hover::before {
    transform: translateX(-50%) translateY(0) scale(1);
}

/* Tooltip Right Align (for right-side elements like end-turn) */
.custom-tooltip.tooltip-right::after {
    left: auto;
    right: 0;
    transform: translateX(0) translateY(-5px) scale(0.95);
}

.custom-tooltip.tooltip-right::before {
    left: auto;
    right: 20px;
    transform: translateX(0) translateY(-5px);
}

.custom-tooltip.tooltip-right:hover::after {
    transform: translateX(0) translateY(0) scale(1);
}

.custom-tooltip.tooltip-right:hover::before {
    transform: translateX(0) translateY(0);
}

/* Combination: bottom + left align */
.custom-tooltip.tooltip-bottom.tooltip-left::after {
    left: 0;
    transform: translateX(0) translateY(5px) scale(0.95);
}

.custom-tooltip.tooltip-bottom.tooltip-left::before {
    left: 20px;
    transform: translateX(0) translateY(5px);
}

.custom-tooltip.tooltip-bottom.tooltip-left:hover::after,
.custom-tooltip.tooltip-bottom.tooltip-left:hover::before {
    transform: translateX(0) translateY(0) scale(1);
}

/* Combination: bottom + right align */
.custom-tooltip.tooltip-bottom.tooltip-right::after {
    left: auto;
    right: 0;
    transform: translateX(0) translateY(5px) scale(0.95);
}

.custom-tooltip.tooltip-bottom.tooltip-right::before {
    left: auto;
    right: 20px;
    transform: translateX(0) translateY(5px);
}

.custom-tooltip.tooltip-bottom.tooltip-right:hover::after,
.custom-tooltip.tooltip-bottom.tooltip-right:hover::before {
    transform: translateX(0) translateY(0) scale(1);
}

.stat-svg-container {
    position: relative;
    height: 100%; /* Utilise toute la hauteur du conteneur (60px sur PC) */
    max-height: 60px; /* Réduit de 80px à 60px */
    min-height: 35px;
    aspect-ratio: 1 / 1;
    width: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    transition: transform 0.2s;
    container-type: size;
}

.stat-svg-container:hover {
    transform: scale(1.1);
}

.stat-svg-container svg {
    height: 100%;
    width: auto;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5));
}

.stat-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40cqh;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), -1px -1px 0 #000;
    pointer-events: none;
}

/* Precise centering for the specific SVG shapes used */
.stat-svg-container.tomate .stat-value {
    top: 52%; /* Center of the circle body */
}

.stat-svg-container.graine .stat-value {
    top: 50%; /* Center of the ellipse */
}

.stat-svg-container.leaf .stat-value {
    top: 55%; /* Slightly lower for the leaf shape */
}

#sealed-overlay {
    scrollbar-gutter: stable;
    justify-content: flex-start !important;
    align-items: center !important;
    overflow-y: auto !important;
    display: flex;
    flex-direction: column !important;
}

#sealed-overlay::-webkit-scrollbar {
    width: 14px;
}

#sealed-overlay::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.4);
}

#sealed-overlay::-webkit-scrollbar-thumb {
    background: #3498db;
    border-radius: 7px;
    border: 3px solid rgba(0, 0, 0, 0.4);
    box-shadow: inset 0 0 6px rgba(0,0,0,0.5);
}

#sealed-overlay::-webkit-scrollbar-thumb:hover {
    background: #2980b9;
}

#sealed-actions {
    position: sticky;
    bottom: 20px;
    background: #1a1a1a;
    padding: 20px;
    border-radius: 50px;
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
    display: inline-block;
    z-index: 25000; /* Plus haut que les cartes */
    pointer-events: auto;
}

#btn-confirm-sealed {
    position: relative;
    z-index: 25001;
    cursor: pointer;
}

#btn-confirm-sealed:disabled {
    cursor: not-allowed;
}

.sealed-card {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative !important;
    margin: 0 auto;
}

.sealed-card.card-vertical {
    width: 160px !important;
    height: 240px !important;
}

.sealed-card.card-horizontal {
    width: 240px !important;
    height: 160px !important;
}

.sealed-card:hover {
    transform: none !important;
    z-index: 100 !important;
}

.sealed-card.selected {
    box-shadow: 0 0 15px #f1c40f, 0 0 30px #f1c40f !important;
    transform: scale(1.05) translateY(-10px);
}

.sealed-card.selected::before {
    content: '✓';
    position: absolute;
    top: 5px; /* Déplacé à l'intérieur */
    right: 5px; /* Déplacé à l'intérieur */
    background: #f1c40f;
    color: #1a1a1a;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    z-index: 100;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

#sealed-pool-grid::-webkit-scrollbar {
    width: 8px;
}
#sealed-pool-grid::-webkit-scrollbar-thumb {
    background: #3498db;
    border-radius: 4px;
}
#victory-overlay {
    background: rgba(0, 0, 0, 0.85);
    z-index: 20000;
    backdrop-filter: blur(8px);
}

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

.victory-content {
    background: linear-gradient(135deg, #1a1a1a, #2c3e50);
    padding: 50px 80px;
    border-radius: 30px;
    border: 4px solid #f1c40f;
    text-align: center;
    box-shadow: 0 0 70px rgba(241, 196, 15, 0.4);
    animation: victory-pop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.victory-content.defeat {
    border-color: #e74c3c;
    box-shadow: 0 0 70px rgba(231, 76, 60, 0.4);
}

.victory-content h1 {
    color: #f1c40f;
    font-size: 5rem;
    margin-bottom: 20px;
    text-shadow: 0 0 30px rgba(241, 196, 15, 0.6);
    letter-spacing: 5px;
}

.victory-content.defeat h1 {
    color: #e74c3c;
    text-shadow: 0 0 30px rgba(231, 76, 60, 0.6);
}

.victory-content p {
    color: white;
    font-size: 1.5rem;
    margin-bottom: 40px;
}

@keyframes victory-pop {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Market Deck Pile label */
.pile-label {
    position: absolute;
    bottom: -20px;
    width: 100%;
    text-align: center;
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
}

/* Market specific adjustments */
.market-pile, .market-pile .pile-card {
    height: 130px !important;
}

.market-pile .pile-count {
    font-size: 1rem !important;
    width: 30px !important;
    height: 30px !important;
}

#compost-card-buy-container {
    position: absolute;
    left: -50px;
    top: 45%;
    transform: translateY(-40%);
    width: 150px;
    height: 180px;
    z-index: 150; /* Réduit pour passer sous les cartes du marché au survol (z:200) */
    pointer-events: none; /* Le conteneur ne bloque plus les clics */
}

#compost-card-buy-container .card {
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), left 0.3s ease, box-shadow 0.3s;
    transform: scale(0.5);
    transform-origin: center center;
    position: absolute !important;
    left: 15px !important; /* Plus à droite au repos */
    top: 0 !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    cursor: pointer;
    pointer-events: auto; /* Seule la carte réagit au survol */
}

#compost-card-buy-container .card:hover {
    transform: scale(1);
    left: 50px !important; /* Sortie franche vers la droite */
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
}

.market-buyable {
    box-shadow: 0 0 15px #f1c40f, 0 0 30px #f1c40f !important;
    cursor: pointer !important;
}

/* Market specific count bubble */
.market-count {
    top: auto !important;
    left: auto !important;
    bottom: -15px !important;
    right: -15px !important;
    transform: none !important;
    background-color: #f1c40f !important;
    color: #2c3e50 !important;
    border: 2px solid #2c3e50 !important;
    width: 35px !important;
    height: 35px !important;
    font-size: 1rem !important;
}

/* Attackable styles */
.opponent-attackable {
    cursor: pointer !important;
}

.opponent-attackable svg {
    filter: drop-shadow(0 0 15px #e74c3c) drop-shadow(0 0 30px #e74c3c) !important;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Mode Selection Overlay */
#mode-selection-overlay.hidden,
#swap-overlay.hidden {
    display: none !important;
}

#swap-overlay {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(44, 62, 80, 0.95);
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    z-index: 200000; /* Augmenté pour être au-dessus du pile-view-overlay (150000) */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    border: 2px solid #3498db;
    pointer-events: auto;
}

.swap-instructions {
    font-size: 1.1rem;
    font-weight: bold;
    text-align: center;
}

#choice-container {
    display: flex;
    gap: 20px;
    margin: 10px 0;
}

.choice-btn {
    padding: 15px 30px;
    background: #3498db;
    color: white;
    border: 2px solid #fff;
    border-radius: 15px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.2rem;
    transition: all 0.2s;
    box-shadow: 0 6px 15px rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 150px;
}

.choice-btn:hover {
    background: #2980b9;
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
}

#choice-container.hidden {
    display: none !important;
}

.swap-controls {
    display: flex;
    gap: 15px;
}

.btn-swap-confirm, .btn-swap-cancel {
    padding: 8px 20px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.btn-swap-confirm {
    background: #27ae60;
    color: white;
}

.btn-swap-confirm:disabled {
    background: #7f8c8d;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-swap-cancel {
    background: #e74c3c;
    color: white;
}

.card.selection-selected {
    box-shadow: 0 0 15px #f1c40f, 0 0 25px #f1c40f !important;
    transform: translateY(-10px) scale(1.05) !important;
}

.card.selection-selected::after {
    border-color: #f1c40f !important;
    border-width: 4px !important;
}

.mode-btn {
    padding: 20px 40px;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    background-color: #3498db;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    width: 300px;
}

.mode-btn:hover {
    background-color: #2980b9;
    transform: scale(1.05);
}

.mode-btn#scenario-mode-btn {
    background-color: #e67e22;
}

.mode-btn#scenario-mode-btn:hover {
    background-color: #d35400;
}

.deck-btn {
    transition: transform 0.2s, box-shadow 0.2s !important;
}

.deck-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

#deck-preview-grid .card {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    transform: scale(0.85) !important;
    margin: -15px !important;
}

.game-modes-container {
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.mode-disabled {
    position: relative;
}

.mode-disabled::after {
    content: '🔒';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
}

/* Victory Overlay */
#victory-overlay {
    background: rgba(0, 0, 0, 0.85);
    z-index: 20000;
    backdrop-filter: blur(8px);
}

/* --- Animations Carousel --- */
@keyframes slide-in-right {
    from { opacity: 0; transform: translateX(30px) scale(0.95); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes slide-in-left {
    from { opacity: 0; transform: translateX(-30px) scale(0.95); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes card-arrival {
    0% { transform: scale(0.7) translateY(30px); opacity: 0; }
    70% { transform: scale(1.05) translateY(-5px); opacity: 1; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.card-arrival {
    animation: card-arrival 0.4s cubic-bezier(0.2, 0.8, 0.2, 1.1) forwards;
}

.slide-next {
    animation: slide-in-right 0.25s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.slide-prev {
    animation: slide-in-left 0.25s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* --- Shading (Obscurcissement intelligent) --- */
body.shading-active .shading-dimmed {
    filter: grayscale(1) brightness(0.3) !important;
    pointer-events: none !important;
    transition: filter 0.3s;
}

body.shading-active .tutorial-highlight {
    opacity: 1 !important;
    pointer-events: auto !important;
    box-shadow: 0 0 15px #f1c40f, 0 0 30px #f1c40f !important;
    animation: tutorial-pulse 1.5s infinite alternate !important;
    border-radius: 8px; /* Assure un arrondi propre pour le halo */
}

@keyframes tutorial-pulse {
    from { box-shadow: 0 0 10px #f1c40f, 0 0 20px #f1c40f; }
    to { box-shadow: 0 0 20px #f1c40f, 0 0 40px #f1c40f; }
}

#tutorial-message-overlay {
    position: fixed !important;
    top: 20px !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: auto !important;
    display: flex !important;
    justify-content: center !important;
    align-items: flex-start !important;
    padding: 0 20px !important;
    background: transparent !important;
    z-index: 50000;
    pointer-events: none;
    transition: all 0.3s ease;
}

#tutorial-message-overlay.position-bottom {
    top: auto !important;
    bottom: 150px !important;
    align-items: flex-end !important;
}

#tutorial-message-overlay.position-center {
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    background-color: rgba(0, 0, 0, 0.2) !important;
    padding: 0 !important;
    margin: 0 !important;
}

#tutorial-message-overlay.hidden {
    display: none !important;
}

.tutorial-message-content {
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 15px 20px !important;
    border-radius: 10px;
    max-width: 450px;
    text-align: center;
    pointer-events: auto;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    border: 1px solid #f1c40f;
}

#tutorial-message-text {
    margin-bottom: 15px;
    font-size: 1rem;
    line-height: 1.4;
}

.tutorial-message-content.no-validation #tutorial-message-text {
    margin-bottom: 0 !important;
}

#tutorial-validate-btn {
    background: #f1c40f;
    color: #2c3e50;
    border: none;
    padding: 8px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9rem;
    transition: transform 0.2s;
}

#tutorial-validate-btn:hover {
    transform: scale(1.05);
}
