* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #05140b; /* Vert Jäger ultra sombre */
    background-image: radial-gradient(#0c301b, #030a06);
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    padding: 15px;
}

#app-container {
    position: relative;
    background: rgba(10, 20, 14, 0.9); /* Taverne noire/verte */
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.9), 0 0 20px rgba(230, 92, 0, 0.15);
    backdrop-filter: blur(5px);
    text-align: center;
    width: 95vw;
    max-width: 600px;
    max-height: 96vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    border: 2px solid #ff6600; /* Liseré orange signature */
}

#btn-home {
    position: absolute; 
    top: 20px; 
    left: 20px;
    background: #111; 
    color: #ff6600; 
    padding: 6px 12px; 
    font-size: 0.85em;
    border-radius: 5px; 
    text-decoration: none; 
    border: 1px solid #ff6600; 
    z-index: 10;
    font-weight: bold;
}
#btn-home:hover { background: #ff6600; color: #111; }

h1 { 
    color: #ffaa00; /* Or Jäger */
    font-size: calc(1.4rem + 0.5vw); 
    margin-top: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.control-panel {
    display: flex;
    justify-content: center;
    align-items: center;
}

.toggle-group {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    font-size: 0.95em;
    color: #aaa;
}

select {
    background: #0d2114;
    color: #ffaa00;
    border: 1px solid #ff6600;
    padding: 5px 10px;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    outline: none;
}

#status-bar {
    background: #732600; /* Marron/Orange liqueur */
    padding: 8px 15px;
    border-radius: 5px;
    font-weight: bold;
    font-size: 0.95em;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.6);
    border: 1px solid #ff6600;
    color: #fff;
}

.table-zone {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    margin: 5px 0;
}

.deck-container, .card-view-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.label {
    font-size: 0.85em;
    text-transform: uppercase;
    color: #666;
    letter-spacing: 1px;
    font-weight: bold;
}

/* --- LE DECK ET LES CARTES --- */
.card-deck, .flip-container {
    width: min(115px, 25vw);
    height: min(165px, 36vw);
    perspective: 1000px; 
}

.card-deck {
    background: #092414;
    border: 3px solid #ffaa00; /* Bordure dorée label */
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8em;
    cursor: pointer;
    position: relative;
    user-select: none;
}

/* Effet d'épaisseur de pile dynamique */
.card-back-stack {
    position: absolute;
    width: 100%; height: 100%;
    top: 5px; left: 5px;
    background: #05140b;
    border: 3px solid #ff6600;
    border-radius: 8px;
    z-index: -1;
    box-shadow: 3px 3px 8px rgba(0,0,0,0.6);
    transition: transform 0.2s;
}

/* 🛠️ CORRECTION : Si mode rapide, on réduit visuellement la taille de la pile */
.card-deck.mode-rapide .card-back-stack {
    top: 2px;
    left: 2px;
    border-color: #aa4400;
}

#cards-left {
    background: rgba(0,0,0,0.8);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.55em;
    font-weight: bold;
    color: #ffffcc;
    border: 1px solid #ffaa00;
}

/* --- FLIP ACTION 3D --- */
.flip-container { cursor: pointer; }
.flipper {
    position: relative; width: 100%; height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.flip-container.flipped .flipper { transform: rotateY(180deg); }

.front, .back {
    position: absolute; width: 100%; height: 100%;
    backface-visibility: hidden; border-radius: 8px;
    display: flex;
}

/* --- THÈME DOS DE CARTE JÄGER-CRABE --- */
.back {
    background: #092414; /* Vert bouteille */
    border: 3px solid #ffaa00; /* Cadre doré */
    color: white;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.5);
}

.jager-cross {
    font-size: 1.4em;
    color: #ff6600;
    line-height: 1;
    margin-bottom: -2px;
    text-shadow: 0 0 5px rgba(255,102,0,0.6);
}

.jager-emblem {
    font-size: 2.3em;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

/* --- FACE DE CARTE --- */
.front {
    background: #fffdf0; /* Ivoire vintage label */
    color: black;
    flex-direction: column;
    justify-content: space-between;
    padding: 8px;
    transform: rotateY(180deg); 
    border: 3px solid #ffaa00;
}

.front.red { color: #cc2424; }
.front.black { color: #111111; }

.card-corner { font-weight: bold; font-size: 1.15em; line-height: 1; display: flex; flex-direction: column; align-items: center; }
.card-center { font-size: 2.6em; align-self: center; line-height: 1; }
.bottom-right { transform: rotate(180deg); }

/* --- ENCART DE TEXTE --- */
#rule-display {
    background: rgba(5, 10, 7, 0.9);
    border-left: 4px solid #ff6600;
    padding: 15px;
    border-radius: 4px;
    text-align: left;
    max-height: 24vh; 
    overflow-y: auto;
    border-top: 1px solid #1c3325;
    border-bottom: 1px solid #1c3325;
    border-right: 1px solid #1c3325;
}

#rule-title { color: #ffaa00; font-size: 1.15em; margin-bottom: 5px; text-transform: uppercase; }
#rule-description { color: #ddd; font-size: 0.95em; line-height: 1.4; }
#rule-description b { color: #ff6600; }

#btn-restart {
    background: #ff6600; color: white; padding: 10px 20px;
    font-size: 1em; border: none; border-radius: 5px; font-weight: bold; cursor: pointer;
    box-shadow: 0 4px 12px rgba(255, 102, 0, 0.3);
}
#btn-restart:hover { background: #e05500; }

.hidden { display: none !important; }

@media (max-width: 480px) {
    #app-container { padding: 15px; gap: 10px; }
    .table-zone { gap: 20px; }
    #btn-home { position: relative; top: 0; left: 0; margin: 0 auto; width: fit-content; }
    h1 { margin-top: 0; }
    .card-center { font-size: 2.1em; }
    #status-bar { font-size: 0.85em; padding: 6px 10px; }
}