/* Traitres à Bord - Design Premium V5 (Glassmorphism Apple) */

:root {
    --traitres-gold: #fbbf24;
    --traitres-gold-glow: rgba(251, 191, 36, 0.6);
    --traitres-danger: #ef4444;
    --traitres-blue: #0ea5e9;
    /* Glassmorphism Apple Style */
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.25);
    --glass-blur: blur(20px);
}

/* --- Container Principal --- */
.traitres-board {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: url('../images/games/traitresàbord/pirate_table_background.png') no-repeat center center;
    background-size: cover;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    touch-action: none;
    z-index: 10;
}

.traitres-board::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, transparent 30%, rgba(0, 0, 0, 0.75) 100%);
    pointer-events: none;
    z-index: 0;
}

/* --- Zone Stats & Joueurs --- */
.traitres-top-zone {
    flex: 0 0 auto;
    width: 100%;
    padding: 8px 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.85), transparent);
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.traitres-stats-bar {
    display: flex;
    justify-content: space-between;
    padding: 0 15px;
    color: var(--traitres-gold);
    font-weight: bold;
    font-size: 1rem;
    text-shadow: 0 2px 4px black;
}

.traitres-players-row {
    display: flex;
    gap: 12px;
    padding: 5px 15px;
    overflow-x: auto;
    scrollbar-width: none;
    justify-content: center;
}

.traitres-players-row::-webkit-scrollbar {
    display: none;
}

.player-node {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 55px;
    flex-shrink: 0;
}

.player-avatar-frame {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid #5d4037;
    background: #2a2a2a;
    overflow: visible;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5);
    position: relative;
}

.player-avatar-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.player-turn-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: var(--traitres-gold);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 13px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    z-index: 10;
    animation: spinSlow 2s linear infinite;
    border: 2px solid white;
}

@keyframes spinSlow {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.player-node.active .player-avatar-frame {
    border-color: var(--traitres-gold);
    box-shadow: 0 0 12px var(--traitres-gold);
}

.player-node.me .player-avatar-frame {
    border-color: var(--traitres-blue);
}

.player-node.me.active .player-avatar-frame {
    border-color: var(--traitres-gold);
}

.player-name {
    font-size: 0.7rem;
    color: white;
    margin-top: 4px;
    text-shadow: 0 1px 3px black;
    white-space: nowrap;
    text-align: center;
}

.player-planks {
    display: flex;
    gap: 2px;
    margin-top: 2px;
}

.mini-plank {
    width: 10px;
    height: 4px;
    background: #5d4037;
    border-radius: 2px;
    opacity: 0.5;
}

.mini-plank.active {
    background: var(--traitres-danger);
    opacity: 1;
    box-shadow: 0 0 4px red;
}

.player-node.eliminated {
    filter: grayscale(1);
    opacity: 0.5;
}

/* --- Zone Annonce (Glassmorphism Apple) --- */
.traitres-announce-zone {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 12px 24px;
    margin: 8px 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: white;
    font-size: 0.95rem;
    z-index: 20;
    min-height: 44px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.traitres-announce-zone .announce-player {
    font-weight: 600;
    color: var(--traitres-gold);
}

.traitres-announce-zone .announce-value {
    font-size: 1.6rem;
    font-weight: bold;
    color: var(--traitres-gold);
    text-shadow: 0 0 12px var(--traitres-gold-glow);
}

/* --- Zone Coffre --- */
.traitres-center-zone {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 10;
}

.chest-container {
    width: 200px;
    height: 160px;
    position: relative;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chest-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 8px 15px rgba(0, 0, 0, 0.6));
}

.chest-container.drag-over {
    transform: scale(1.1);
    filter: brightness(1.2);
}

.chest-count-badge {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--traitres-gold);
    color: var(--traitres-gold);
    padding: 5px 14px;
    border-radius: 14px;
    font-size: 0.85rem;
    font-weight: bold;
    white-space: nowrap;
}

/* --- Zone Actions (Boutons) --- */
.traitres-actions-zone {
    position: absolute;
    bottom: 170px;
    right: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
    z-index: 40;
}

/* Conteneur Bouton avec Badge Superposé */
.action-btn-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Halo Doré Animé */
.golden-halo {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
    border: 3px solid var(--traitres-gold);
    box-shadow:
        0 0 15px var(--traitres-gold-glow),
        0 0 30px var(--traitres-gold-glow),
        inset 0 0 15px var(--traitres-gold-glow);
    animation: pulseGlow 2s ease-in-out infinite;
    overflow: hidden;
}

@keyframes pulseGlow {

    0%,
    100% {
        box-shadow:
            0 0 10px var(--traitres-gold-glow),
            0 0 25px var(--traitres-gold-glow),
            inset 0 0 10px var(--traitres-gold-glow);
    }

    50% {
        box-shadow:
            0 0 20px var(--traitres-gold-glow),
            0 0 40px var(--traitres-gold-glow),
            inset 0 0 20px var(--traitres-gold-glow);
    }
}

/* Badge Superposé avec Blur */
.btn-label {
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6rem;
    color: white;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 3px 10px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    z-index: 5;
}

/* Bouton Clé (fond noir transparent + blur, remplit tout le halo) */
.btn-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.btn-inner:active {
    transform: scale(0.9);
}

.btn-inner img {
    width: 38px;
    height: 38px;
    object-fit: contain;
}

/* Bouton Rôle (pièce pleine taille, centrée) */
.btn-role {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s;
    background: transparent;
    padding: 0;
    margin: 0;
}

.btn-role:active {
    transform: scale(0.9);
}

/* Pièce Rôle - Pleine taille, parfaitement ronde et centrée */
.role-coin-container {
    width: 100%;
    height: 100%;
    perspective: 1000px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.role-coin {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    border-radius: 50%;
}

.role-coin-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 50%;
    background-image: url('../images/games/traitresàbord/double_coin.png');
    background-size: 200% 100%;
}

.role-coin-front {
    background-position: 0% 0%;
}

.role-coin-back {
    transform: rotateY(180deg);
    background-position: 100% 0%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.role-icon-overlay {
    width: 55%;
    height: 55%;
    object-fit: contain;
}

/* --- Zone Main --- */
.traitres-hand-zone {
    height: 150px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 15px;
    z-index: 50;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85), transparent);
}

.card-hand {
    width: 85px;
    height: 120px;
    background-size: 100% 100%;
    border-radius: 8px;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
    cursor: grab;
    margin-left: -30px;
    transform-origin: bottom center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.card-hand:first-child {
    margin-left: 0;
}

.card-hand:hover,
.card-hand:active {
    transform: translateY(-25px) scale(1.1);
    z-index: 100;
    margin-right: 20px;
}

/* --- Pêche Miraculeuse Selection --- */
.peche-selection-zone {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 100;
    padding: 20px;
}

.peche-container {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    max-width: 95%;
}

.peche-title {
    font-size: 1rem;
    color: var(--traitres-gold);
    font-weight: bold;
    text-align: center;
}

.peche-cards-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.peche-card {
    width: 60px;
    height: 85px;
    background-size: 100% 100%;
    border-radius: 6px;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

.peche-card.selected {
    border-color: var(--traitres-gold);
    box-shadow: 0 0 15px var(--traitres-gold);
    transform: translateY(-5px);
}

.peche-card.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.peche-btn-validate {
    background: var(--traitres-gold);
    color: #1a1a1a;
    border: none;
    padding: 10px 25px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
}

.peche-btn-validate:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Modal Glassmorphism Apple --- */
.traitres-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.traitres-modal {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    padding: 28px;
    border-radius: 24px;
    width: 85%;
    max-width: 340px;
    text-align: center;
    color: white;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.traitres-modal h3 {
    margin: 0 0 18px 0;
    color: var(--traitres-gold);
    font-size: 1.3rem;
    font-weight: 600;
}

.traitres-modal p {
    margin: 0 0 18px 0;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
    line-height: 1.4;
}

.traitres-btn-group {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Modal Rôle Plein Écran */
.role-fullscreen-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.role-fullscreen-card {
    width: 250px;
    height: 360px;
    border-radius: 16px;
    box-shadow: 0 0 60px var(--traitres-gold-glow);
    animation: zoomIn 0.3s ease-out;
}

@keyframes zoomIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Animation fadeUp */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Longue-vue Cards --- */
.longue-vue-card {
    width: 70px;
    height: 100px;
    background-size: 100% 100%;
    border-radius: 8px;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    position: relative;
}

.longue-vue-card.selected {
    border-color: var(--traitres-gold);
    box-shadow: 0 0 15px var(--traitres-gold-glow);
    transform: translateY(-5px);
}

.lv-order-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: var(--traitres-gold);
    color: #1a1a1a;
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* --- Modal Résultat --- */
.result-card-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.result-card {
    width: 50px;
    height: 72px;
    background-size: 100% 100%;
    border-radius: 6px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

.result-card-group .card-count {
    color: var(--traitres-gold);
    font-size: 1rem;
    font-weight: bold;
}

.result-card .card-value {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 10px;
    padding: 1px 4px;
    border-radius: 3px;
}

/* Grille joueurs résultat */
.result-players-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 10px;
}

.result-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 60px;
}

.result-player.eliminated {
    opacity: 0.5;
}

.result-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--traitres-gold);
    object-fit: cover;
}

.result-player-name {
    font-size: 0.65rem;
    color: white;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60px;
}

.result-role-card {
    width: 40px;
    height: 56px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* Responsive */
@media (max-width: 380px) {
    .chest-container {
        width: 160px;
        height: 130px;
    }

    .card-hand {
        width: 65px;
        height: 95px;
        margin-left: -22px;
    }

    .player-avatar-frame {
        width: 40px;
        height: 40px;
    }

    .golden-halo {
        width: 60px;
        height: 60px;
    }

    .btn-inner {
        width: 45px;
        height: 45px;
    }

    .btn-inner img {
        width: 35px;
        height: 35px;
    }

    .longue-vue-card {
        width: 55px;
        height: 80px;
    }
}