/* =====================================================
   TRIVERSE
   ===================================================== */

:root {

    --gold: #d8ad52;
    --gold-light: #f3d477;

    --organic: #39cf78;
    --mechanic: #55b8ec;
    --entropy: #ed6530;

    --dark: #05090d;

}


/* =====================================================
   BASE
   ===================================================== */

* {

    box-sizing: border-box;

    margin: 0;

    padding: 0;

}


html,
body {

    width: 100%;

    height: 100%;

}


body {

    overflow: hidden;

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    background: #05090d;

    color: white;

}


/* =====================================================
   ACCUEIL — VERROUILLÉ
   ===================================================== */

#homeScreen {

    position: relative;

    width: 100vw;

    height: 100vh;

    display: flex;

    justify-content: center;

    align-items: flex-start;

    background-image:
        linear-gradient(
            rgba(0, 0, 0, 0.08),
            rgba(0, 0, 0, 0.12)
        ),
        url("./fond-accueil.webp");

    background-size: cover;

    background-position: center;

    background-repeat: no-repeat;

}


.home {

    position: relative;

    z-index: 2;

    width: min(660px, 42vw);

    min-width: 520px;

    height: 100vh;

    display: flex;

    flex-direction: column;

    align-items: center;

    padding-top: 3vh;

}


.logo {

    display: block;

    width: min(430px, 27vw);

    height: auto;

    object-fit: contain;

    filter:
        drop-shadow(
            0 10px 20px
            rgba(0, 0, 0, 0.8)
        );

}


.subtitle {

    width: 100%;

    display: flex;

    align-items: center;

    justify-content: center;

    gap: 14px;

    margin-top: 0.5vh;

    margin-bottom: 2.8vh;

}


/* Le <p> = CADRE noir translucide (calque du dessous). */
.subtitle p {
    padding: 6px 22px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(216, 173, 82, 0.28);
    border-radius: 999px;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    line-height: 1;
}

/* Le texte doré animé = calque AU-DESSUS du cadre. */
.subtitle .sub-text {
    font-size: clamp(11px, 1vw, 16px);
    letter-spacing: clamp(2px, 0.3vw, 5px);
    white-space: nowrap;
    font-weight: 700;

    background: linear-gradient(
        100deg,
        #b98f38 0%,
        #f3d477 25%,
        #fff6d8 45%,
        #f3d477 62%,
        #b98f38 85%
    );
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;

    filter:
        drop-shadow(0 1px 1px rgba(0, 0, 0, 0.9))
        drop-shadow(0 0 8px rgba(243, 212, 119, 0.4));

    animation: subtitleShine 5s linear infinite;
}

@keyframes subtitleShine {
    0% { background-position: 120% 0; }
    100% { background-position: -120% 0; }
}


.subtitle > span {

    position: relative;

    width: 55px;

    height: 2px;

    background:
        linear-gradient(
            90deg,
            transparent,
            #d8ad52
        );

    box-shadow: 0 0 8px rgba(216, 173, 82, 0.5);

    transform-origin: right center;

    animation: subtitleLine 3s ease-in-out infinite;
}

.subtitle > span:last-child {

    background:
        linear-gradient(
            90deg,
            #d8ad52,
            transparent
        );

    transform-origin: left center;
}

/* Losange scintillant à la pointe intérieure de chaque trait. */
.subtitle > span::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -4px;
    width: 7px;
    height: 7px;
    background: #f3d477;
    transform: translateY(-50%) rotate(45deg);
    box-shadow: 0 0 8px #f3d477, 0 0 16px rgba(243, 212, 119, 0.6);
    animation: subtitleDiamond 2s ease-in-out infinite;
}

.subtitle > span:last-child::after {
    right: auto;
    left: -4px;
}

@keyframes subtitleLine {
    0%, 100% { opacity: 0.55; box-shadow: 0 0 5px rgba(216, 173, 82, 0.3); }
    50% { opacity: 1; box-shadow: 0 0 13px rgba(216, 173, 82, 0.75); }
}

@keyframes subtitleDiamond {
    0%, 100% { opacity: 0.55; transform: translateY(-50%) rotate(45deg) scale(0.8); }
    50% { opacity: 1; transform: translateY(-50%) rotate(45deg) scale(1.25); }
}


.factions {

    width: 100%;

    display: flex;

    gap: 14px;

    margin-bottom: 3vh;

}


.faction {

    flex: 1;

    height: 118px;

    border-radius: 14px;

    background:
        rgba(4, 12, 16, 0.88);

    font-size: 13px;

    font-weight: bold;

    letter-spacing: 2px;

    cursor: pointer;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    gap: 6px;

    padding: 8px;

    transition: transform 0.15s ease, box-shadow 0.15s ease;

}


.faction:hover {

    transform: translateY(-3px);

}


.faction .icon {

    width: 68px;

    height: 68px;

    object-fit: contain;

    display: block;

    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));

}


.organic {

    color: #39cf78;

    border:
        2px solid #39cf78;

}


.mechanic {

    color: #55b8ec;

    border:
        2px solid #55b8ec;

}


.entropy {

    color: #ed6530;

    border:
        2px solid #ed6530;

}


.play-button {

    width: 100%;

    height: 70px;

    border-radius: 10px;

    border:
        2px solid #f2cf70;

    background:
        linear-gradient(
            180deg,
            #f0cd6b,
            #c79630
        );

    color: #111;

    font-size: 25px;

    font-weight: bold;

    letter-spacing: 4px;

    display: flex;

    align-items: center;

    justify-content: center;

    gap: 16px;

    cursor: pointer;

}


.button-icon {

    font-size: 23px;

}


.second-row {

    width: 100%;

    display: flex;

    gap: 12px;

    margin-top: 12px;

}


.secondary-button {

    flex: 1;

    height: 60px;

    border-radius: 9px;

    border:
        2px solid
        rgba(216, 173, 82, 0.45);

    background:
        linear-gradient(
            180deg,
            rgba(24, 35, 43, 0.96),
            rgba(7, 13, 18, 0.96)
        );

    color: #e7e7e7;

    font-size: 16px;

    font-weight: bold;

    letter-spacing: 3px;

    display: flex;

    align-items: center;

    justify-content: center;

    gap: 12px;

    cursor: pointer;

}


.rules-button {

    width: 100%;

    height: 60px;

    margin-top: 12px;

    border-radius: 9px;

    border:
        2px solid
        rgba(216, 173, 82, 0.45);

    background:
        linear-gradient(
            180deg,
            rgba(24, 35, 43, 0.96),
            rgba(7, 13, 18, 0.96)
        );

    color: #e7e7e7;

    font-size: 16px;

    font-weight: bold;

    letter-spacing: 3px;

    display: flex;

    align-items: center;

    justify-content: center;

    gap: 12px;

    cursor: pointer;

}


/* Le <p> = CADRE noir translucide (calque du dessous). */
.welcome {
    margin-top: 3.2vh;
    display: inline-block;
    padding: 6px 24px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(216, 173, 82, 0.22);
    border-radius: 999px;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    line-height: 1;
    animation: welcomeFloat 4s ease-in-out infinite;
}

/* Le texte doré animé = calque AU-DESSUS du cadre. */
.welcome span {
    font-size: 17px;
    letter-spacing: 3px;
    font-weight: 600;

    background: linear-gradient(
        100deg,
        #c9ac66 0%,
        #fff2c8 45%,
        #c9ac66 80%
    );
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;

    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.9));

    animation: welcomeShine 6s linear infinite;
}

@keyframes welcomeShine {
    0% { background-position: 120% 0; }
    100% { background-position: -120% 0; }
}

@keyframes welcomeFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}


.decoration {

    display: flex;

    align-items: center;

    justify-content: center;

    gap: 12px;

    margin-top: 14px;

    color: #d8ad52;

}


.decoration span {

    width: 100px;

    height: 1px;

    background:
        linear-gradient(
            90deg,
            transparent,
            #d8ad52
        );

}


.decoration span:last-child {

    background:
        linear-gradient(
            90deg,
            #d8ad52,
            transparent
        );

}


.decoration b {

    font-size: 13px;

}


/* =====================================================
   DECKS — VERROUILLÉ
   ===================================================== */

#deckScreen {

    display: none;

    position: fixed;

    inset: 0;

    width: 100vw;

    height: 100vh;

    align-items: center;

    justify-content: center;

    background-image:
        linear-gradient(
            rgba(2, 7, 10, 0.60),
            rgba(2, 7, 10, 0.78)
        ),
        url("./imagefond.webp");

    background-size: cover;

    background-position: center;

}


#deckScreen.active {

    display: flex;

}


.deck-menu {

    width: min(850px, 80vw);

    display: flex;

    flex-direction: column;

    align-items: center;

}


.deck-menu h1 {

    color: #d8ad52;

    font-size: clamp(28px, 3vw, 44px);

    letter-spacing: 6px;

}


.deck-subtitle {

    margin-top: 12px;

    margin-bottom: 40px;

    color:
        rgba(255,255,255,0.70);

    letter-spacing: 2px;

}


.deck-list {

    width: 100%;

    display: grid;

    grid-template-columns:
        repeat(2, 1fr);

    gap: 18px;

}


.deck-card {

    height: 150px;

    border:
        2px solid
        rgba(216,173,82,0.55);

    border-radius: 12px;

    background:
        linear-gradient(
            145deg,
            rgba(24,36,43,0.96),
            rgba(5,12,17,0.96)
        );

    color: white;

    cursor: pointer;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    gap: 12px;

}


.deck-number {

    color: #d8ad52;

    font-size: 30px;

    font-weight: bold;

}


.deck-name {

    font-size: 20px;

    font-weight: bold;

    letter-spacing: 4px;

}


.back-button {

    margin-top: 35px;

    padding: 13px 35px;

    border:
        1px solid
        rgba(216,173,82,0.6);

    border-radius: 7px;

    background:
        rgba(5,10,14,0.9);

    color: #d8ad52;

    font-size: 15px;

    letter-spacing: 2px;

    cursor: pointer;

}


/* =====================================================
   PLATEAU DE JEU
   ===================================================== */

#gameScreen {

    display: none;

    position: fixed;

    inset: 0;

    width: 100vw;

    height: 100vh;

    flex-direction: column;

    /* Marge gauche élargie : laisse la place au panneau HISTORIQUE. */
    padding: 15px 25px 15px 250px;

    background:
        radial-gradient(
            ellipse at center,
            #1a2924 0%,
            #0b1212 50%,
            #050809 100%
        );

}


#gameScreen.active {

    display: flex;

}


/* =====================================================
   HISTORIQUE DE PARTIE
   ===================================================== */

.game-log {
    position: absolute;
    left: 18px;
    top: 18px;
    bottom: 18px;
    width: 210px;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(216, 173, 82, 0.35);
    border-radius: 10px;
    background: rgba(4, 10, 12, 0.72);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    z-index: 40;
}

.game-log-title {
    flex: 0 0 auto;
    padding: 9px 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--gold-light);
    text-align: center;
    border-bottom: 1px solid rgba(216, 173, 82, 0.3);
    background: rgba(216, 173, 82, 0.1);
}

.game-log-entries {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
    line-height: 1.35;
    scrollbar-width: thin;
    scrollbar-color: rgba(216, 173, 82, 0.5) transparent;
}

.game-log-entries::-webkit-scrollbar {
    width: 6px;
}

.game-log-entries::-webkit-scrollbar-thumb {
    background: rgba(216, 173, 82, 0.5);
    border-radius: 3px;
}

.log-entry {
    padding: 3px 7px;
    border-left: 3px solid rgba(255, 255, 255, 0.25);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.9);
    word-break: break-word;
    animation: logAppear 0.25s ease;
}

.log-entry.log-player {
    border-left-color: var(--gold-light);
    color: #f6e2ac;
}

.log-entry.log-opponent {
    border-left-color: var(--entropy);
    color: #f3b394;
}

.log-entry.log-system {
    border-left-color: rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
}

.log-entry.log-turn {
    margin-top: 4px;
    border-left: none;
    border-radius: 5px;
    text-align: center;
    font-weight: 700;
    letter-spacing: 1px;
    background: rgba(216, 173, 82, 0.16);
    color: var(--gold-light);
}

.log-entry.log-turn.log-turn-opponent {
    background: rgba(237, 101, 48, 0.16);
    color: #f3b394;
}

@keyframes logAppear {
    from { opacity: 0; transform: translateX(-6px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* Écrans étroits : le panneau se réduit puis s'efface pour ne pas gêner le plateau. */
@media (max-width: 1024px) {
    #gameScreen { padding-left: 190px; }
    .game-log { width: 158px; }
    .game-log-entries { font-size: 10px; }
}

@media (max-width: 820px) {
    #gameScreen { padding-left: 25px; }
    .game-log { display: none; }
}


/* =====================================================
   JOUEURS
   ===================================================== */

.opponent-header,
.player-header {

    height: 70px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    padding: 0 15px;

    color: var(--gold);

    font-weight: bold;

    letter-spacing: 2px;

}


.player-name {

    font-size: 15px;

}


/* =====================================================
   DECK À DROITE
   ===================================================== */

.deck-display {

    display: flex;

    align-items: center;

    gap: 12px;

}


.deck-visual {

    width: 58px;

    height: 80px;

    border:
        2px solid
        var(--gold);

    border-radius: 7px;

    overflow: hidden;

    background: #080d10;

    box-shadow:
        0 5px 18px
        rgba(0,0,0,0.65);

}


.deck-visual img {

    width: 100%;

    height: 100%;

    display: block;

    object-fit: cover;

}


.opponent-deck-visual {

    transform:
        rotate(180deg);

}


.player-deck-visual {

    transform:
        rotate(0deg);

}


.deck-info {

    min-width: 55px;

    display: flex;

    flex-direction: column;

    align-items: flex-start;

    gap: 2px;

}


.deck-info span {

    color:
        rgba(255,255,255,0.65);

    font-size: 11px;

    letter-spacing: 2px;

}


.deck-info strong {

    color: var(--gold);

    font-size: 16px;

}


/* =====================================================
   MAIN ADVERSAIRE
   ===================================================== */

.opponent-hand-area {

    height: 100px;

    display: flex;

    align-items: flex-start;

    justify-content: center;

}


.opponent-hand {

    height: 95px;

    display: flex;

    align-items: flex-start;

    justify-content: center;

}


.opponent-hand-card {

    width: 70px;

    height: 97px;

    margin-left: -18px;

    border:
        2px solid
        rgba(216,173,82,0.65);

    border-radius: 7px;

    overflow: hidden;

    background: #080d10;

    box-shadow:
        0 5px 15px
        rgba(0,0,0,0.65);

    flex-shrink: 0;
    perspective: 900px;

}

.opponent-hand-card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform .45s ease;
}

.opponent-hand-card-face {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.opponent-hand-card-front {
    transform: rotateY(180deg);
}

.opponent-hand-card.espion-revealed .opponent-hand-card-inner {
    transform: rotateY(180deg);
}

/* Espion : pendant le dévoilement les cartes restent à taille normale ;
   l'agrandissement x2.5 se fait au survol (voir la règle :hover plus bas). */
.opponent-hand-card.espion-revealed {
    position: relative;
    cursor: zoom-in;
    /* Pendant le dévoilement, on écarte les cartes (l'éventail serré passe
       de -18px à un espacement positif) pour qu'elles ne se chevauchent plus
       et que le survol soit précis. */
    margin-left: 26px;
    transition: transform .18s ease, box-shadow .18s ease, margin-left .2s ease;
}


.opponent-hand-card:first-child {

    margin-left: 0;

}


.opponent-hand-card-face img {

    width: 100%;

    height: 100%;

    object-fit: fill;

    display: block;

    image-rendering: auto;

}


/* =====================================================
   ZONES ACTIVES
   ===================================================== */

.active-zone {

    flex: 1;

    display: flex;

    align-items: center;

    justify-content: center;

    gap: 25px;

}


.opponent-active-zone {

    /* Miroir (= rotation 180°) mais SANS ré-échantillonnage : évite le flou. */
    transform:
        scale(-1, -1);

}


/* La zone adverse est retournée à 180° : on remet le texte des postes
   ("ACTIF", "VIDE") à l'endroit pour le joueur. */
.opponent-slot .slot-label,
.opponent-slot .empty-slot-message {
    display: inline-block;
    transform: rotate(180deg);
}


.active-slot {

    position: relative;

    width: 155px;

    height: 214px;

    border:
        2px solid
        rgba(216,173,82,0.55);

    border-radius: 11px;

    background:
        rgba(4,10,11,0.72);

    display: flex;

    align-items: center;

    justify-content: center;

    color:
        rgba(255,255,255,0.25);

    font-size: 12px;

    letter-spacing: 2px;

    overflow: visible;

}


.active-slot > .active-card {

    position: absolute !important;

    inset: 0 !important;

    width: 100% !important;

    height: 100% !important;

    max-width: none !important;

    max-height: none !important;

    margin: 0 !important;

    padding: 0 !important;

    display: block !important;

    object-fit: fill !important;

    border-radius: 8px;

    box-sizing: border-box;

}

.active-slot img:not(.active-card) {

    width: 100%;

    height: 100%;

    object-fit: contain;

    display: block;

    border-radius: 8px;

}

/* Agrandissement des cartes actives au survol */
.player-active-slot .active-card:hover {
    transform: scale(3.5) !important;
    transform-origin: center center;
    z-index: 1000;
    position: relative;
}

.opponent-slot .active-card:hover {
    transform: scale(-3.5, -3.5) !important;
    transform-origin: center center;
    z-index: 1000;
    position: relative;
}


/* =====================================================
   RESSOURCES — ZONE DÉDIÉE SOUS CHAQUE CARTE
   ===================================================== */

.resource-zone {
    position: absolute;
    left: 50%;
    bottom: -52px;
    transform: translateX(-50%);
    width: 118px;
    height: 36px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
    padding: 3px 4px;
    border: 2px solid rgba(216,173,82,0.55);
    border-radius: 7px;
    background: rgba(4,10,11,0.88);
    box-shadow: 0 3px 10px rgba(0,0,0,0.45);
    z-index: 30;
    pointer-events: auto;
}

.resource-zone::before {
    content: "RESSOURCE";
    position: absolute;
    left: 7px;
    top: -12px;
    font-size: 7px;
    line-height: 1;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.65);
    pointer-events: none;
}

.resource-add-button {
    flex: 0 0 27px;
    width: 27px;
    height: 27px;
    padding: 0;
    border: 1px solid rgba(216,173,82,0.75);
    border-radius: 5px;
    background: rgba(216,173,82,0.12);
    color: var(--gold-light);
    font-size: 20px;
    line-height: 24px;
    font-weight: 700;
    cursor: pointer;
    transition: .15s ease;
}

.resource-add-button:hover {
    background: rgba(216,173,82,0.28);
    box-shadow: 0 0 10px rgba(216,173,82,0.45);
}

.resource-stack {
    position: relative;
    flex: 1 1 auto;
    width: 76px;
    height: 27px;
    min-width: 0;
    overflow: visible;
    pointer-events: none;
}

.resource-icon {
    position: absolute;
    top: 1px;
    width: 25px;
    height: 25px;
    object-fit: contain;
    display: block;
    pointer-events: auto;
    cursor: default;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.9));
}

.resource-zone.resource-target {
    border-color: var(--gold-light);
    box-shadow: 0 0 18px rgba(216,173,82,0.65);
    cursor: pointer;
}

.resource-zone.resource-target .resource-add-button {
    border-color: var(--gold-light);
    background: rgba(216,173,82,0.24);
}

/* La zone adverse est sous la carte côté joueur, malgré la rotation du plateau. */
.opponent-slot .resource-zone {
    bottom: auto;
    top: -52px;
    transform: translateX(-50%) rotate(180deg);
}

/* Les cartes restent cliquables pour les attaques ; la zone Ressource est séparée. */
.player-active-slot .active-card,
.opponent-slot .active-card {
    cursor: pointer;
}

/* =====================================================
   CENTRE
   ===================================================== */

.battle-center {

    height: 125px;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    gap: 6px;

    flex-shrink: 0;

}


.turn-indicator {

    min-width: 180px;

    padding: 5px 12px;

    border:
        1px solid
        rgba(216,173,82,0.35);

    border-radius: 6px;

    background:
        rgba(0,0,0,0.35);

    color:
        var(--gold);

    text-align: center;

    font-size: 11px;

    font-weight: bold;

    letter-spacing: 2px;

}


.turn-box {

    min-width: 90px;

    padding: 7px 15px;

    border:
        1px solid
        rgba(216,173,82,0.35);

    border-radius: 7px;

    background:
        rgba(0,0,0,0.35);

    color: var(--gold);

    text-align: center;

    font-size: 13px;

}


.turn-box strong {

    color: white;

    margin-left: 5px;

}


.resource-message {

    min-height: 17px;

    color:
        rgba(243,212,119,0.9);

    font-size: 10px;

    font-weight: bold;

    letter-spacing: 1.5px;

    text-align: center;

}


.end-turn-button {

    min-width: 145px;

    padding: 6px 15px;

    border:
        1px solid
        rgba(216,173,82,0.65);

    border-radius: 6px;

    background:
        linear-gradient(
            180deg,
            rgba(216,173,82,0.25),
            rgba(60,45,18,0.5)
        );

    color: var(--gold-light);

    font-size: 11px;

    font-weight: bold;

    letter-spacing: 2px;

    cursor: pointer;

}


.end-turn-button:hover {

    background:
        linear-gradient(
            180deg,
            rgba(216,173,82,0.42),
            rgba(60,45,18,0.7)
        );

}


.end-turn-button:disabled {

    opacity: 0.35;

    cursor: default;

}


/* =====================================================
   MAIN JOUEUR
   ===================================================== */

.hand-area {

    height: 175px;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: flex-end;

}


.hand-title {

    margin-bottom: 8px;

    color: var(--gold);

    letter-spacing: 3px;

    font-size: 12px;

}


.hand {

    display: flex;

    align-items: flex-end;

    gap: 8px;

}


.hand-card {

    position: relative;

    width: 96px;

    height: 133px;

    border:
        2px solid
        rgba(216,173,82,0.4);

    border-radius: 7px;

    background: #111817;

    cursor: pointer;

    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;

}


.hand-card img {

    width: 100%;

    height: 100%;

    display: block;

    object-fit: contain;

    border-radius: 5px;

}


.hand-card:hover {

    transform:
        translateY(-80px)
        scale(2.2);

    border-color:
        var(--gold);

    box-shadow:
        0 20px 50px
        rgba(0,0,0,0.8),

        0 0 25px
        rgba(216,173,82,0.35);

    z-index: 100;

}


.active-card {

    width: 100% !important;

    height: 100% !important;

    cursor: default !important;

    border: none !important;

    box-shadow: none !important;

    transform: none !important;

    position: absolute !important;

    inset: 0 !important;

    margin: 0 !important;

    padding: 0 !important;

    object-fit: fill !important;

    box-sizing: border-box;

}


/* =====================================================
   PILE OU FACE
   ===================================================== */

.coin-overlay {

    position: fixed;

    inset: 0;

    z-index: 1000;

    display: none;

    align-items: center;

    justify-content: center;

    background:
        rgba(0,0,0,0.82);

    backdrop-filter:
        blur(5px);

}


.coin-overlay.active {

    display: flex;

}


.coin-box {

    width: 360px;

    min-height: 430px;

    padding: 35px;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    border:
        2px solid
        rgba(216,173,82,0.65);

    border-radius: 18px;

    background:
        radial-gradient(
            circle at center,
            #18251f 0%,
            #080e10 75%
        );

    box-shadow:
        0 25px 80px
        rgba(0,0,0,0.85),

        0 0 40px
        rgba(216,173,82,0.12);

}


.coin-title {

    color: var(--gold);

    font-size: 24px;

    font-weight: bold;

    letter-spacing: 5px;

    margin-bottom: 35px;

    text-align: center;

}


.coin {

    width: 180px;

    height: 180px;

    display: flex;

    align-items: center;

    justify-content: center;

    perspective: 900px;

}


.coin img {

    width: 180px;

    height: 180px;

    object-fit: contain;

    display: block;

    filter:
        drop-shadow(
            0 12px 20px
            rgba(0,0,0,0.7)
        );

}


.coin.flipping img {

    animation:
        coinFlip 0.16s linear infinite;

}


@keyframes coinFlip {

    0% {

        transform:
            rotateY(0deg)
            scaleX(1);

    }

    25% {

        transform:
            rotateY(90deg)
            scaleX(0.15);

    }

    50% {

        transform:
            rotateY(180deg)
            scaleX(1);

    }

    75% {

        transform:
            rotateY(270deg)
            scaleX(0.15);

    }

    100% {

        transform:
            rotateY(360deg)
            scaleX(1);

    }

}


.coin-result {

    min-height: 32px;

    margin-top: 30px;

    color:
        rgba(255,255,255,0.75);

    font-size: 16px;

    font-weight: bold;

    letter-spacing: 3px;

    text-align: center;

}


.coin-result.winner {

    color: var(--gold);

    font-size: 22px;

    letter-spacing: 3px;

}
/* Cartes adverses orientées vers le joueur. Miroir exact (scale -1) au lieu
   d'une rotation : la zone est déjà retournée, donc net = image droite, et
   aucun ré-échantillonnage → image parfaitement nette. */
.opponent-slot .active-card {
    transform: scale(-1, -1) !important;
    image-rendering: auto;
}


/* =====================================================
   GLISSER-DÉPOSER DES ÉVOLUTIONS
   ===================================================== */

.evolution-dragging {
    opacity: 0.92;
    cursor: grabbing !important;
    z-index: 500;
    /* La carte suit la souris (transform géré en JS) et ne doit pas
       intercepter le pointeur, pour détecter le poste sous le curseur. */
    pointer-events: none;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7);
    transition: none;
}

.evolution-drag-target {
    border-color: var(--gold-light) !important;
    box-shadow: 0 0 22px rgba(216,173,82,0.65);
}

/* Poste survolé pendant le glisser : mise en valeur renforcée. */
.evolution-drag-hover {
    border-color: #fff6d8 !important;
    box-shadow: 0 0 30px rgba(243, 212, 119, 0.95) !important;
    transform: translateY(-4px) scale(1.04);
}

/* PV et effets adverses : visibles à l'endroit et au bon emplacement pour le joueur */
.opponent-slot .card-state-overlay {
    left: auto;
    bottom: auto;
    right: 6px;
    top: 6px;
    transform: rotate(180deg);
    transform-origin: center;
}

/* =====================================================
   ACTIONS — CIBLES ET ETAT DES CARTES
   ===================================================== */
.action-target {
    border-color: var(--gold-light) !important;
    box-shadow: 0 0 22px rgba(216,173,82,0.75) !important;
    cursor: pointer !important;
}

.action-target:hover {
    transform: translateY(-3px);
}

.card-state-overlay {
    position: absolute;
    left: 6px;
    bottom: 6px;
    z-index: 20;
    display: flex;
    gap: 5px;
    align-items: center;
    pointer-events: none;
    font-family: Arial, sans-serif;
    font-weight: 800;
    font-size: 12px;
}

.card-hp-badge,
.card-status-badge {
    padding: 3px 6px;
    border-radius: 5px;
    background: rgba(0,0,0,0.78);
    border: 1px solid rgba(216,173,82,0.9);
    color: #fff;
    text-shadow: 0 1px 2px #000;
}

.card-status-badge {
    color: #f3d477;
}

/* PV actuels incrustés dans le bouclier rouge (haut-droite de l'illustration). */
.card-hp-shield {
    position: absolute;
    top: 9%;
    left: 86.5%;
    transform: translate(-50%, -50%);
    min-width: 17px;
    height: 17px;
    padding: 0 2px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 25;
    pointer-events: none;
    font-family: Arial, sans-serif;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    color: #fff;
    background: radial-gradient(circle at 42% 30%, #e23a2d, #8a120c 85%);
    border: 1.5px solid #f2cf6a;
    border-radius: 9px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.6), inset 0 1px 2px rgba(255,255,255,0.35);
    text-shadow: 0 1px 1px #000;
}

.card-hp-shield.damaged {
    color: #ffdca0;
}

/* Côté adverse : la zone est retournée (scale -1) ; on replace et on remet
   le nombre à l'endroit pour qu'il reste sur le bouclier, lisible. */
.opponent-slot .card-hp-shield {
    top: 91%;
    left: 13.5%;
    transform: translate(-50%, -50%) scale(-1, -1);
}

.action-choice-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Plus de fond opaque : l'assombrissement se fait carte par carte
       (mode .targeting) pour que les cibles ressortent AU-DESSUS. */
    background: transparent;
}

/* =====================================================
   MODE CIBLAGE — seules les cartes ciblables ressortent
   ===================================================== */

/* Le plateau s'assombrit… */
#gameScreen.targeting .active-slot,
#gameScreen.targeting .hand-card,
#gameScreen.targeting .opponent-hand-card,
#gameScreen.targeting .opponent-header,
#gameScreen.targeting .player-header,
#gameScreen.targeting .battle-center,
#gameScreen.targeting .hand-title {
    filter: brightness(0.32);
    transition: filter 0.2s ease;
}

/* …sauf les cartes ciblables, qui restent éclatantes et passent au-dessus. */
#gameScreen.targeting .active-slot.action-target {
    filter: none !important;
    z-index: 60;
    transform: translateY(-5px) scale(1.05);
}

.action-choice-panel {
    width: min(560px, 90vw);
    padding: 28px;
    text-align: center;
    background: rgba(10,15,18,0.97);
    border: 2px solid var(--gold);
    border-radius: 14px;
    box-shadow: 0 0 35px rgba(0,0,0,0.8);
}

.action-choice-title {
    margin: 0 0 18px;
    color: #f3d477;
    font-size: 22px;
    letter-spacing: 1px;
}

.action-choice-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.action-choice-buttons button,
.action-cancel-button {
    padding: 10px 16px;
    border: 1px solid var(--gold);
    border-radius: 8px;
    background: #151c20;
    color: #fff;
    cursor: pointer;
    font-weight: 700;
}

.action-choice-buttons button:hover,
.action-cancel-button:hover {
    background: #263238;
}

.action-cancel-button {
    margin-top: 16px;
}
.action-choice-overlay {
    pointer-events: none;
    align-items: flex-start;
    padding-top: 24px;
}

.action-choice-panel {
    pointer-events: auto;
}

/* Liste des bases mortes à récupérer (Excavation). */
.excavation-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    max-width: 620px;
    margin-top: 14px;
}

.excavation-card {
    width: 110px;
    height: auto;
    border-radius: 8px;
    border: 2px solid rgba(216, 173, 82, 0.5);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.excavation-card:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.65);
    border-color: var(--gold-light);
}

/* =====================================================
   APERCU CARTE — CLIC DROIT
   ===================================================== */
.card-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.78);
    cursor: pointer;
    padding: 24px;
}

.card-preview-overlay.visible {
    display: flex;
}

.card-preview-image {
    display: block;
    width: auto;
    height: auto;
    max-width: min(70vw, 900px);
    max-height: 88vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 0 45px rgba(0,0,0,0.9), 0 0 18px rgba(216,173,82,0.35);
    user-select: none;
    pointer-events: none;
}

/* =====================================================
   COMBAT — CIBLES D'ATTAQUE
   ===================================================== */
.attack-target {
    border-color: var(--gold-light) !important;
    box-shadow: 0 0 24px rgba(216,173,82,0.9) !important;
    cursor: crosshair !important;
}

.attack-source {
    border-color: #ed6530 !important;
    box-shadow: 0 0 24px rgba(237,101,48,0.8) !important;
}


/* =====================================================
   FIN DE PARTIE
   ===================================================== */
.game-over-overlay {
    position: fixed;
    inset: 0;
    z-index: 6000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.82);
    padding: 24px;
}

.game-over-overlay.visible {
    display: flex;
}

.game-over-box {
    min-width: 360px;
    max-width: 90vw;
    padding: 42px 56px;
    text-align: center;
    border: 2px solid var(--gold-light);
    border-radius: 16px;
    background: rgba(8,13,16,0.97);
    box-shadow: 0 0 45px rgba(0,0,0,0.9), 0 0 24px rgba(216,173,82,0.25);
}

.game-over-title {
    margin: 0 0 16px;
    color: var(--gold-light);
    font-size: 42px;
    font-weight: 800;
    letter-spacing: 3px;
}

.game-over-message {
    margin: 0;
    color: #fff;
    font-size: 18px;
}


/* =====================================================
   OUVERTURE DE BOOSTER — GÉNÉRATION 1
   ===================================================== */
.booster-screen {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: none;
    overflow: auto;
    background:
        radial-gradient(circle at 50% 35%, rgba(216,173,82,0.11), transparent 32%),
        linear-gradient(180deg, rgba(3,7,10,0.98), rgba(5,9,13,1));
}

.booster-screen.active {
    display: block;
}

.booster-page {
    position: relative;
    min-height: 100vh;
    padding: 28px 34px 34px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.booster-back-button {
    position: absolute;
    top: 26px;
    left: 30px;
    padding: 11px 18px;
    border: 1px solid rgba(216,173,82,0.55);
    border-radius: 9px;
    background: rgba(8,14,19,0.9);
    color: #f3d477;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
}

.booster-header {
    text-align: center;
    margin-top: 12px;
}

.booster-kicker {
    color: #d8ad52;
    font-size: 12px;
    letter-spacing: 6px;
    margin-bottom: 8px;
}

.booster-header h1 {
    color: #f3d477;
    font-size: clamp(28px, 3vw, 48px);
    letter-spacing: 3px;
    margin: 0;
}

.booster-header p {
    margin-top: 10px;
    color: rgba(255,255,255,0.68);
    font-size: 13px;
    letter-spacing: 1.5px;
}

/* =====================================================
   COLLECTION
   ===================================================== */

.collection-screen {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: none;
    overflow: auto;
    background:
        radial-gradient(circle at 50% 30%, rgba(216,173,82,0.10), transparent 34%),
        linear-gradient(180deg, rgba(3,7,10,0.98), rgba(5,9,13,1));
}

.collection-screen.active { display: block; }

.collection-page {
    position: relative;
    min-height: 100vh;
    padding: 28px 34px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.collection-header {
    text-align: center;
    margin-top: 12px;
    margin-bottom: 22px;
}

.collection-header h1 {
    color: #f3d477;
    font-size: clamp(28px, 3vw, 48px);
    letter-spacing: 3px;
    margin: 0;
}

.collection-header p {
    margin-top: 10px;
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    letter-spacing: 1.5px;
}

.collection-header b { color: #f3d477; }

.collection-grid {
    width: min(2900px, 96vw);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
}

.collection-slot {
    position: relative;
    aspect-ratio: 2976 / 4157;
    border-radius: 8px;
    border: 2px solid rgba(216,173,82,0.3);
    background: rgba(255,255,255,0.03);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.collection-slot.owned {
    cursor: zoom-in;
    border-color: rgba(216,173,82,0.7);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.collection-slot.owned:hover {
    transform: translateY(-4px) scale(1.04);
    box-shadow: 0 10px 24px rgba(0,0,0,0.6);
    z-index: 2;
}

.collection-slot.owned img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.collection-slot.empty {
    border-style: dashed;
    border-color: rgba(216,173,82,0.22);
    background: repeating-linear-gradient(45deg, rgba(255,255,255,0.015) 0 8px, transparent 8px 16px);
}

.collection-slot-number {
    font-size: 20px;
    font-weight: 800;
    color: rgba(216,173,82,0.35);
    letter-spacing: 1px;
}

/* Bordures par rareté (cartes obtenues). */
.collection-slot.owned.rarity-rare {
    border-color: #55b8ec;
    box-shadow: 0 0 10px rgba(85,184,236,0.35);
}

.collection-slot.owned.rarity-secrete {
    border-color: #f3d477;
    box-shadow: 0 0 14px rgba(243,212,119,0.55);
}

.collection-count-badge {
    position: absolute;
    right: 5px;
    bottom: 5px;
    background: rgba(4,10,12,0.9);
    border: 1px solid rgba(216,173,82,0.7);
    color: #f3d477;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
}

.collection-hint {
    margin-top: 22px;
    color: rgba(255,255,255,0.5);
    font-size: 12px;
    letter-spacing: 1px;
    text-align: center;
}

/* =====================================================
   MES DECKS — CONSTRUCTEUR
   ===================================================== */

.decks-screen {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: none;
    overflow: auto;
    background:
        radial-gradient(circle at 50% 30%, rgba(216,173,82,0.10), transparent 34%),
        linear-gradient(180deg, rgba(3,7,10,0.98), rgba(5,9,13,1));
}

.decks-screen.active { display: block; }

.decks-page {
    position: relative;
    min-height: 100vh;
    padding: 26px 30px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.decks-header {
    text-align: center;
    margin-top: 10px;
    margin-bottom: 16px;
}

.decks-header h1 {
    color: #f3d477;
    font-size: clamp(26px, 3vw, 44px);
    letter-spacing: 3px;
    margin: 0;
}

.decks-header p {
    margin-top: 8px;
    color: rgba(255,255,255,0.6);
    font-size: 12.5px;
    letter-spacing: 1.5px;
}

.deck-slot-tabs {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 16px;
}

.deck-slot-tab {
    min-width: 150px;
    padding: 10px 16px;
    border: 2px solid rgba(216,173,82,0.35);
    border-radius: 10px;
    background: rgba(4,12,16,0.85);
    color: #fff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 3px;
    transition: 0.15s ease;
}

.deck-slot-tab:hover { border-color: rgba(216,173,82,0.7); }

.deck-slot-tab.selected {
    border-color: var(--gold-light);
    box-shadow: 0 0 16px rgba(216,173,82,0.4);
    background: rgba(216,173,82,0.12);
}

.deck-slot-tab.active-deck .deck-slot-sub { color: #7ee0a6; }

.deck-slot-name { font-weight: 700; letter-spacing: 1px; }
.deck-slot-sub { font-size: 11px; color: rgba(255,255,255,0.55); letter-spacing: 1px; }

.deck-editor-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    justify-content: center;
    margin-bottom: 8px;
}

.deck-name-input {
    padding: 9px 14px;
    border: 2px solid rgba(216,173,82,0.4);
    border-radius: 8px;
    background: rgba(4,10,12,0.9);
    color: #fff;
    font-size: 14px;
    letter-spacing: 1px;
    min-width: 200px;
}

.deck-name-input:focus {
    outline: none;
    border-color: var(--gold-light);
}

.deck-editor-count {
    color: rgba(255,255,255,0.75);
    font-size: 13px;
    letter-spacing: 1px;
}
.deck-editor-count b { color: #f3d477; }
.deck-editor-count b.complete { color: #7ee0a6; }

.deck-active-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #7ee0a6;
    font-size: 13px;
    letter-spacing: 1px;
    cursor: pointer;
    user-select: none;
}
.deck-active-toggle input { accent-color: #39cf78; cursor: pointer; }

.deck-save-button,
.deck-clear-button {
    padding: 9px 18px;
    border-radius: 8px;
    border: none;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: 0.15s ease;
}

.deck-save-button {
    background: linear-gradient(180deg, #f3d477, #d8ad52);
    color: #2a1e06;
}
.deck-save-button:hover { filter: brightness(1.08); }

.deck-clear-button {
    background: rgba(237,101,48,0.16);
    border: 1px solid rgba(237,101,48,0.5);
    color: #f3b394;
}
.deck-clear-button:hover { background: rgba(237,101,48,0.28); }

.deck-save-msg {
    min-height: 18px;
    margin-bottom: 12px;
    font-size: 12.5px;
    letter-spacing: 0.5px;
    color: #f3b394;
}
.deck-save-msg.ok { color: #7ee0a6; }

.deck-builder-grid {
    width: min(2900px, 96vw);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
}

.deck-builder-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: rgba(255,255,255,0.6);
    padding: 40px 0;
}

.deck-build-card {
    position: relative;
    aspect-ratio: 2976 / 4157;
    border-radius: 8px;
    border: 2px solid rgba(216,173,82,0.3);
    overflow: hidden;
    cursor: pointer;
    background: rgba(255,255,255,0.03);
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.deck-build-card:hover {
    transform: translateY(-3px);
    border-color: rgba(216,173,82,0.7);
}

.deck-build-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.deck-build-card.rarity-rare { border-color: rgba(85,184,236,0.75); }
.deck-build-card.rarity-secrete { border-color: rgba(243,212,119,0.9); }

.deck-build-card.in-deck {
    border-color: var(--gold-light);
    box-shadow: 0 0 14px rgba(216,173,82,0.5);
}

.deck-build-card.in-deck.rarity-rare { box-shadow: 0 0 14px rgba(85,184,236,0.6); }
.deck-build-card.in-deck.rarity-secrete { box-shadow: 0 0 16px rgba(243,212,119,0.7); }

.deck-build-card:not(.in-deck) img {
    filter: grayscale(0.35) brightness(0.82);
}

.deck-build-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(4,10,12,0.9);
    border: 1px solid rgba(216,173,82,0.7);
    color: #f3d477;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 8px;
}

.deck-build-minus {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid rgba(237,101,48,0.7);
    background: rgba(4,10,12,0.92);
    color: #f3b394;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.deck-build-minus:hover { background: rgba(237,101,48,0.3); }

.deck-builder-hint {
    margin-top: 20px;
    color: rgba(255,255,255,0.5);
    font-size: 12px;
    letter-spacing: 1px;
    text-align: center;
}

/* Deck perso dans l'écran de choix (JOUER). */
.custom-deck-card .deck-custom-sub {
    font-size: 11px;
    color: rgba(255,255,255,0.6);
    letter-spacing: 1px;
    margin-top: 2px;
}

.booster-pack-area {
    height: 330px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.6s ease;
}

.booster-pack-area.opening {
    transform: translateY(-15px) scale(1.04);
}

.booster-pack-area.hidden {
    height: 0;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.85);
}

.booster-pack {
    position: relative;
    width: 205px;
    height: 308px;
    border: none;
    border-radius: 0;
    overflow: visible;
    background: transparent;
    box-shadow: 0 0 35px rgba(216,173,82,0.28), 0 20px 45px rgba(0,0,0,0.75);
    cursor: pointer;
    transform: rotate(-2deg);
    transition: transform 0.25s ease;
}

.booster-pack:hover {
    transform: rotate(0deg) scale(1.04);
}

.booster-pack.shake {
    animation: boosterShake 0.75s ease;
}

.booster-pack-glow {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(120deg, transparent 20%, rgba(255,255,255,0.35) 48%, transparent 70%);
    transform: translateX(-100%);
    /* Invisible au repos : le reflet ne se voit que pendant le balayage
       à l'ouverture. Évite le rectangle gris garé à gauche du pack. */
    opacity: 0;
}

.booster-pack.shake .booster-pack-glow {
    animation: boosterShine 0.7s ease;
}

.booster-pack-cardback {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    opacity: 1;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.6));
    animation: boosterBob 3.6s ease-in-out infinite;
}

/* Halo doré pulsant derrière le pack. */
.booster-pack::before {
    content: "";
    position: absolute;
    inset: -16%;
    z-index: 0;
    border-radius: 50%;
    background: radial-gradient(ellipse at center,
        rgba(216, 173, 82, 0.38),
        rgba(216, 173, 82, 0.10) 45%,
        transparent 70%);
    filter: blur(8px);
    pointer-events: none;
    animation: boosterAura 3.2s ease-in-out infinite;
}

.booster-pack-title,
.booster-pack-subtitle {
    position: absolute;
    z-index: 3;
    left: 0;
    right: 0;
    text-align: center;
    text-shadow: 0 2px 8px #000;
}

.booster-pack-title {
    top: 28px;
    color: #f3d477;
    font-weight: 900;
    letter-spacing: 2px;
    font-size: 18px;
}

.booster-pack-subtitle {
    bottom: 22px;
    color: white;
    font-size: 12px;
    letter-spacing: 4px;
}

.booster-cards {
    width: min(1300px, 96vw);
    min-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(10px, 1.5vw, 22px);
    perspective: 1400px;
}

.booster-slot {
    width: clamp(145px, 15vw, 220px);
    aspect-ratio: 2976 / 4157;
    position: relative;
    perspective: 1000px;
}

.booster-card-inner {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(.2,.8,.2,1);
}

.booster-slot.locked .booster-card-inner {
    transform: rotateY(0deg) translateY(35px) scale(0.8);
}

.booster-slot.revealed .booster-card-inner {
    transform: rotateY(180deg) translateY(0) scale(1);
}

/* Carte révélée : cliquable pour l'agrandir. */
.booster-slot.revealed {
    cursor: zoom-in;
}

/* =====================================================
   ZOOM D'UNE CARTE DE BOOSTER (×4 + croix)
   ===================================================== */

.booster-zoom-overlay {
    position: fixed;
    inset: 0;
    /* Au-dessus de tout : #boosterScreen (5000), rare-reveal (6000). */
    z-index: 7000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(2, 4, 8, 0.9);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.booster-zoom-overlay.visible {
    display: flex;
}

.booster-zoom-stage {
    position: relative;
    display: inline-block;
    animation: boosterZoomIn 0.2s ease;
}

.booster-zoom-card {
    display: block;
    height: min(90vh, 900px);
    width: auto;
    max-width: 94vw;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.booster-zoom-close {
    position: absolute;
    top: -16px;
    right: -16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--gold-light);
    background: rgba(10, 14, 18, 0.96);
    color: var(--gold-light);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
    transition: transform 0.12s ease, background 0.12s ease;
}

.booster-zoom-close:hover {
    transform: scale(1.12);
    background: rgba(216, 173, 82, 0.28);
}

@keyframes boosterZoomIn {
    from { transform: scale(0.7); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}


/* =====================================================
   RÈGLES — GRIMOIRE QUI S'OUVRE
   ===================================================== */

.rules-overlay {
    position: fixed;
    inset: 0;
    z-index: 7500;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(2, 4, 8, 0.88);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    perspective: 2400px;
}

.rules-overlay.visible {
    display: flex;
}

.rules-book {
    position: relative;
    width: min(540px, 94vw);
    height: min(700px, 88vh);
    transform-style: preserve-3d;
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.rules-overlay.visible .rules-book {
    transform: scale(1);
    opacity: 1;
}

/* La page (dessous) : parchemin défilable. */
.rules-book-page {
    position: absolute;
    inset: 0;
    border-radius: 5px 16px 16px 5px;
    background:
        radial-gradient(ellipse at 20% 10%, rgba(255, 250, 235, 0.6), transparent 60%),
        linear-gradient(135deg, #f6ead0 0%, #ecdcb4 55%, #e2cf9f 100%);
    box-shadow:
        inset 14px 0 26px -14px rgba(90, 60, 20, 0.55),
        0 26px 60px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    border: 1px solid rgba(120, 85, 35, 0.4);
}

/* Tranche/reliure à gauche. */
.rules-book-page::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 22px;
    background: linear-gradient(90deg, rgba(70, 45, 15, 0.45), transparent);
    pointer-events: none;
    z-index: 3;
}

.rules-page-inner {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    padding: 30px 34px 26px 40px;
    color: #3a2a14;
    font-size: 13.5px;
    line-height: 1.5;
    scrollbar-width: thin;
    scrollbar-color: rgba(120, 85, 35, 0.6) transparent;
}

.rules-page-inner::-webkit-scrollbar { width: 8px; }
.rules-page-inner::-webkit-scrollbar-thumb {
    background: rgba(120, 85, 35, 0.55);
    border-radius: 4px;
}

.rules-title {
    text-align: center;
    font-size: 24px;
    letter-spacing: 2px;
    color: #7a3b12;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
    margin-bottom: 2px;
}

.rules-kicker {
    text-align: center;
    font-size: 10px;
    letter-spacing: 3px;
    color: #9a6b34;
    margin-bottom: 14px;
}

.rules-page-inner h2 {
    font-size: 15px;
    color: #8a2f12;
    letter-spacing: 0.5px;
    margin: 16px 0 6px;
    padding-bottom: 3px;
    border-bottom: 1px solid rgba(138, 47, 18, 0.28);
}

.rules-page-inner ul {
    margin: 0 0 4px 18px;
}

.rules-page-inner li {
    margin-bottom: 4px;
}

.rules-page-inner b {
    color: #6a3410;
}

.rules-example {
    margin: 6px 0;
    padding: 8px 12px;
    background: rgba(138, 90, 30, 0.12);
    border-left: 3px solid rgba(138, 90, 30, 0.55);
    border-radius: 4px;
    font-style: italic;
}

.rules-summary {
    margin-top: 18px;
    padding: 12px 14px;
    background: rgba(122, 59, 18, 0.1);
    border: 1px solid rgba(122, 59, 18, 0.3);
    border-radius: 8px;
}

.rules-summary h2 {
    border: none;
    margin-top: 0;
}

.rules-end {
    text-align: center;
    color: #a06a30;
    font-size: 18px;
    margin: 16px 0 4px;
}

/* La couverture (dessus) : pivote pour ouvrir le livre. */
.rules-book-cover {
    position: absolute;
    inset: 0;
    border-radius: 5px 16px 16px 5px;
    transform-origin: left center;
    transform: rotateY(0deg);
    transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    z-index: 4;
    background:
        radial-gradient(ellipse at 50% 35%, rgba(60, 78, 66, 0.55), transparent 65%),
        linear-gradient(145deg, #10201a 0%, #0a1512 60%, #050b09 100%);
    border: 2px solid rgba(216, 173, 82, 0.55);
    box-shadow: 0 26px 60px rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Ouverture : la couverture bascule vers la gauche et se cache (dos non rendu). */
.rules-overlay.open .rules-book-cover {
    transform: rotateY(-168deg);
}

.rules-cover-frame {
    width: calc(100% - 34px);
    height: calc(100% - 34px);
    border: 1px solid rgba(216, 173, 82, 0.5);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    box-shadow: inset 0 0 40px rgba(216, 173, 82, 0.12);
}

.rules-cover-eclair {
    width: 58px;
    height: 58px;
    object-fit: contain;
    filter: drop-shadow(0 0 12px rgba(120, 220, 90, 0.5));
    animation: rulesEmblem 3s ease-in-out infinite;
}

.rules-cover-logo {
    width: min(60%, 190px);
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.7));
}

.rules-cover-factions {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: center;
}

.rules-cover-factions img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.6));
    transition: transform 0.2s ease;
}

.rules-cover-factions img:hover {
    transform: translateY(-3px) scale(1.08);
}

@keyframes rulesEmblem {
    0%, 100% { transform: scale(1); opacity: 0.85; }
    50% { transform: scale(1.1); opacity: 1; }
}

.rules-cover-title {
    font-size: 34px;
    font-weight: 900;
    letter-spacing: 8px;
    color: var(--gold-light);
    text-shadow: 0 2px 10px #000;
}

.rules-cover-rule {
    width: 120px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.rules-cover-hint {
    position: absolute;
    bottom: 26px;
    font-size: 10px;
    letter-spacing: 2px;
    color: rgba(216, 173, 82, 0.6);
    animation: rulesHint 1.8s ease-in-out infinite;
}

@keyframes rulesHint {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.9; }
}

/* Croix de fermeture. */
.rules-close {
    position: absolute;
    top: 12px;
    right: 14px;
    z-index: 6;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid rgba(138, 47, 18, 0.7);
    background: rgba(246, 234, 208, 0.95);
    color: #8a2f12;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: transform 0.12s ease, background 0.12s ease, opacity 0.3s ease 0.5s;
}

.rules-overlay.open .rules-close {
    opacity: 1;
}

.rules-close:hover {
    transform: scale(1.12);
    background: #fff;
}

@media (max-width: 600px) {
    .rules-page-inner { padding: 24px 20px 22px 28px; font-size: 12.5px; }
    .rules-cover-title { font-size: 26px; letter-spacing: 5px; }
}

/* Le 5e emplacement est le slot spécial : il peut contenir une Commune, une Rare ou la Secrète. */
.booster-slot.special-slot::before {
    content: "SLOT SPÉCIAL";
    position: absolute;
    left: 50%;
    top: -34px;
    transform: translateX(-50%);
    z-index: 20;
    white-space: nowrap;
    padding: 5px 10px;
    border: 1px solid rgba(243,212,119,0.75);
    border-radius: 999px;
    background: rgba(8,14,19,0.94);
    color: #f3d477;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 2px;
    box-shadow: 0 0 18px rgba(243,212,119,0.25);
}

.booster-slot.special-slot::after {
    content: "";
    position: absolute;
    inset: -8px;
    z-index: -1;
    border-radius: 17px;
    border: 2px solid rgba(243,212,119,0.9);
    box-shadow: 0 0 12px rgba(243,212,119,0.45), 0 0 32px rgba(243,212,119,0.22);
    animation: specialSlotPulse 1.6s ease-in-out infinite;
    pointer-events: none;
}

.booster-slot.special-slot .booster-card-front {
    border-color: rgba(243,212,119,0.98);
    box-shadow: 0 0 22px rgba(243,212,119,0.42), 0 12px 30px rgba(0,0,0,0.65);
}

@keyframes specialSlotPulse {
    0%, 100% { opacity: 0.55; transform: scale(0.985); }
    50% { opacity: 1; transform: scale(1.015); }
}

.booster-card-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 11px;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(0,0,0,0.65);
}

.booster-card-back {
    background: #071016;
    border: 1px solid rgba(216,173,82,0.35);
}

.booster-card-back img,
.booster-card-front > img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.booster-card-front {
    transform: rotateY(180deg);
    border: 2px solid rgba(216,173,82,0.8);
}

.booster-card-info {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 9px 8px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
}

.booster-card-number {
    color: #fff;
}

.booster-card-rarity {
    color: #f3d477;
}

.booster-message {
    min-height: 26px;
    margin-top: 8px;
    color: rgba(255,255,255,0.85);
    text-align: center;
    font-weight: 700;
    letter-spacing: 2px;
}

.booster-open-button,
.booster-new-button {
    margin-top: 12px;
    min-width: 300px;
    padding: 15px 28px;
    border-radius: 10px;
    border: 2px solid #f2cf70;
    background: linear-gradient(180deg, #f0cd6b, #c79630);
    color: #111;
    font-weight: 900;
    letter-spacing: 2px;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
}

.booster-new-button {
    display: none;
}

.booster-rates {
    margin-top: 18px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 24px;
    color: rgba(255,255,255,0.52);
    font-size: 10px;
    letter-spacing: 0.8px;
}

.booster-rates b {
    color: rgba(243,212,119,0.85);
}

@keyframes boosterShake {
    0%,100% { transform: rotate(-2deg) translateX(0); }
    20% { transform: rotate(2deg) translateX(-7px); }
    40% { transform: rotate(-3deg) translateX(7px); }
    60% { transform: rotate(3deg) translateX(-5px); }
    80% { transform: rotate(-1deg) translateX(4px); }
}

@keyframes boosterShine {
    0% { transform: translateX(-100%); opacity: 0; }
    12% { opacity: 1; }
    88% { opacity: 1; }
    100% { transform: translateX(100%); opacity: 0; }
}

@keyframes boosterBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-9px); }
}

@keyframes boosterAura {
    0%, 100% { opacity: 0.5; transform: scale(0.95); }
    50% { opacity: 1; transform: scale(1.08); }
}


/* =====================================================
   RÉVÉLATION SPÉCIALE — RARE / SECRÈTE
   ===================================================== */

.rare-reveal-overlay {
    position: fixed;
    inset: 0;
    /* Doit passer au-dessus de #boosterScreen (z-index 5000). */
    z-index: 6000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    background: radial-gradient(ellipse at center, rgba(10,14,26,0.86), rgba(2,4,8,0.97));
    transition: opacity 0.4s ease;
}

.rare-reveal-overlay.active {
    opacity: 1;
}

/* Flash blanc d'apparition */
.rare-reveal-flash {
    position: absolute;
    inset: 0;
    background: #fff;
    opacity: 0;
    pointer-events: none;
}
.rare-reveal-overlay.active .rare-reveal-flash {
    animation: rareFlash 0.6s ease-out;
}
@keyframes rareFlash {
    0% { opacity: 0; }
    8% { opacity: 0.95; }
    100% { opacity: 0; }
}

/* Éclairs */
.rare-reveal-bolts {
    position: absolute;
    width: min(62vh, 540px);
    height: min(94vh, 780px);
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    overflow: visible;
}
.rare-reveal-bolts .bolt {
    fill: none;
    stroke: #bfe3ff;
    stroke-width: 3;
    stroke-linejoin: round;
    stroke-linecap: round;
    filter: drop-shadow(0 0 6px #7cc4ff) drop-shadow(0 0 14px #3b8cff);
    opacity: 0;
}
.rare-reveal-overlay.active .bolt-1 { animation: boltFlicker 1.15s ease-out; }
.rare-reveal-overlay.active .bolt-2 { animation: boltFlicker 1.15s ease-out 0.08s; }
.rare-reveal-overlay.active .bolt-3 { animation: boltFlicker 1.15s ease-out 0.04s; }
@keyframes boltFlicker {
    0% { opacity: 0; }
    5% { opacity: 1; }
    10% { opacity: 0.2; }
    16% { opacity: 1; }
    24% { opacity: 0.35; }
    34% { opacity: 0.9; }
    48% { opacity: 0.1; }
    62% { opacity: 0.6; }
    100% { opacity: 0; }
}

/* Carte géante */
.rare-reveal-stage {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.rare-reveal-card {
    height: min(60vh, 500px);
    width: auto;
    border-radius: 14px;
    filter: drop-shadow(0 0 22px rgba(124,196,255,0.85)) drop-shadow(0 0 46px rgba(59,140,255,0.5));
}
.rare-reveal-overlay.active .rare-reveal-card {
    animation: rareCardIn 0.7s cubic-bezier(.18,.9,.3,1.25);
}
@keyframes rareCardIn {
    0% { transform: scale(1.8); opacity: 0; }
    12% { opacity: 1; }
    30% { transform: scale(0.94); }
    55% { transform: scale(1.04); }
    100% { transform: scale(1); }
}
.rare-reveal-label {
    font-size: clamp(20px, 3vw, 34px);
    font-weight: 900;
    letter-spacing: 3px;
    color: #cfe8ff;
    text-shadow: 0 0 12px #4aa3ff, 0 0 26px #2c6cff;
    animation: rareLabelPulse 1.6s ease-in-out infinite;
}
@keyframes rareLabelPulse {
    0%,100% { opacity: 0.85; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

/* Variante SECRÈTE : prismatique */
.rare-reveal-overlay.secret .bolt {
    stroke: #ffd5f5;
    filter: drop-shadow(0 0 6px #ff7cf0) drop-shadow(0 0 14px #b06bff);
}
.rare-reveal-overlay.secret .rare-reveal-card {
    filter: drop-shadow(0 0 22px #ff7cf0) drop-shadow(0 0 44px #6ab0ff) drop-shadow(0 0 64px #b06bff);
    animation: rareCardIn 0.7s cubic-bezier(.18,.9,.3,1.25), secretHue 3.5s linear infinite;
}
.rare-reveal-overlay.secret .rare-reveal-label {
    color: #ffe6fb;
    text-shadow: 0 0 12px #ff6ae0, 0 0 26px #9a5cff;
    animation: rareLabelPulse 1.6s ease-in-out infinite, secretHue 3.5s linear infinite;
}
@keyframes secretHue {
    from { filter: hue-rotate(0deg) drop-shadow(0 0 22px #ff7cf0) drop-shadow(0 0 44px #6ab0ff); }
    to { filter: hue-rotate(360deg) drop-shadow(0 0 22px #ff7cf0) drop-shadow(0 0 44px #6ab0ff); }
}

/* Envol vers le slot */
.rare-reveal-overlay.flying {
    background: transparent;
    transition: opacity 0.5s ease, background 0.5s ease;
}
.rare-reveal-overlay.flying .rare-reveal-flash,
.rare-reveal-overlay.flying .rare-reveal-bolts,
.rare-reveal-overlay.flying .rare-reveal-label {
    opacity: 0;
    transition: opacity 0.35s ease;
}
.rare-reveal-overlay.flying .rare-reveal-card {
    animation: none;
    transition: transform 0.85s cubic-bezier(.6,.05,.25,1), filter 0.85s ease;
    filter: drop-shadow(0 0 6px rgba(124,196,255,0.4));
}

@media (max-width: 900px) {
    .booster-cards {
        gap: 7px;
        flex-wrap: wrap;
        min-height: 300px;
    }
    .booster-slot {
        width: clamp(105px, 17vw, 155px);
    }
    .booster-pack-area {
        height: 270px;
    }
    .booster-pack {
        width: 155px;
        height: 233px;
    }
}


/* Deck 2 — aperçu Espion */
.espion-panel { max-width: 900px; width: min(90vw, 900px); }
.espion-hand-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 18px 0; max-height: 60vh; overflow-y: auto; }
.espion-card-image { width: 120px; height: auto; border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.45); }


/* RÉPARTITION TACTIQUE — sélection d'une ressource précise */
.player-active-slot.resource-transfer-source {
    border-color: var(--gold-light);
    box-shadow: 0 0 18px rgba(216,173,82,0.55);
}

.player-active-slot.resource-transfer-source:hover {
    cursor: pointer;
}

.player-active-slot.resource-transfer-target {
    border-color: var(--gold-light) !important;
    box-shadow: 0 0 22px rgba(216,173,82,0.75) !important;
    cursor: pointer !important;
}

.resource-icon.resource-transfer-resource-listener {
    cursor: pointer;
    transition: transform .15s ease, filter .15s ease;
}

.resource-icon.resource-transfer-resource-listener:hover,
.resource-icon.resource-transfer-selected {
    transform: scale(1.35);
    filter: drop-shadow(0 0 8px rgba(255,215,90,.95));
    z-index: 50;
    outline: 2px solid rgba(255, 215, 90, .95);
    outline-offset: 3px;
}

/* Répartition Tactique : le + de la zone Ressource devient la cible du transfert */
.resource-zone.resource-transfer-target .resource-add-button {
    box-shadow: 0 0 14px rgba(255,215,90,.95);
    transform: scale(1.12);
    border-color: var(--gold-light);
    cursor: pointer;
}

.resource-add-button.resource-transfer-plus-listener {
    cursor: pointer;
}


/* TRAHISON — sélection directe d'une carte adverse */
.opponent-hand-card.trahison-target {
    cursor: pointer;
    border-color: var(--gold-light);
    box-shadow: 0 0 18px rgba(216,173,82,0.85), 0 5px 15px rgba(0,0,0,0.65);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
    z-index: 120;
}

.opponent-hand-card.trahison-target:hover {
    transform: translateY(-12px) scale(1.08);
    border-color: #fff0a8;
}

/* Espion : agrandissement x2.5 au survol pendant les 10 s de dévoilement.
   Le scale est sur la carte (extérieur), le flip 3D reste sur .inner : les
   deux se composent sans se casser. transform-origin en haut pour que la
   carte s'agrandisse vers le bas et reste entièrement visible. */
.opponent-hand-card.espion-revealed:hover {
    transform: scale(2.5);
    transform-origin: center top;
    z-index: 200;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.8);
}
