/* Mode équipes : salle d'attente (colonnes d'équipes), alliés dans la colonne des joueurs (main
   visible, pioche possible), verrou 🔒 sur sa main, score d'équipe, tchat d'équipe, podium. */

/* ---------- Salle d'attente ---------- */
.team-option {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.team-formats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding-left: 3.2rem;
}

.ally-play-option {
    margin-top: 0.5rem;
    padding-left: 3.2rem;
}

.team-formats .catalog-chip small {
    opacity: 0.75;
    margin-left: 0.25rem;
    font-weight: 500;
}

.team-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.8rem;
    width: 100%;
}

.team-column {
    padding: 0.7rem;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.18);
    border: 2px solid color-mix(in srgb, var(--team-color) 70%, transparent);
    box-shadow: inset 0 4px 0 var(--team-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.team-title {
    margin: 0.1rem 0 0.2rem;
    font-size: 1rem;
    text-align: left;
}

.team-title small {
    opacity: 0.7;
    font-weight: 600;
}

.team-column .seat-cards {
    justify-content: flex-start;
}

.team-join {
    align-self: flex-start;
}

.team-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: center;
    margin-top: 0.6rem;
}

.seat-teams {
    display: flex;
    gap: 0.2rem;
}

.seat-team-move {
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.25);
    color: #fff;
    border-radius: 8px;
    padding: 0.05rem 0.3rem;
    font-size: 0.72rem;
    cursor: pointer;
}

.seat-team-move:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ---------- À la table ---------- */
.team-badge {
    margin-right: 0.15rem;
}

.opponent-chip[style*="--team-color"] {
    border-left: 4px solid var(--team-color);
}

.opponent-chip.ally {
    background: color-mix(in srgb, var(--team-color, #2fa84f) 16%, rgba(0, 0, 0, 0.25));
}

.ally-hand {
    margin: 0.35rem 0 0.2rem;
}

.ally-hand-title {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.8;
    margin-bottom: 0.25rem;
}

.ally-hand-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.ally-card {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    max-width: 9.5rem;
    padding: 0.2rem 0.45rem;
    border-radius: 7px;
    border: none;
    border-top: 4px solid var(--cat-color, #999);
    background: #fffdf6;
    color: #2a2418;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    text-align: left;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    cursor: default;
}

.ally-card:disabled {
    opacity: 1;
}

.ally-card-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ally-card.ready {
    cursor: pointer;
    outline: 2px solid var(--gold);
    outline-offset: 1px;
    animation: ally-ready 1.6s ease-in-out infinite;
}

.ally-card.ready:hover {
    transform: translateY(-1px);
}

.ally-card.locked {
    opacity: 0.6;
}

.ally-card-lock {
    font-size: 0.7rem;
}

@keyframes ally-ready {
    0%, 100% { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }
    50% { box-shadow: 0 0 10px rgba(224, 180, 0, 0.8); }
}

/* Seulement pour les cartes qui portent le verrou : hors mode équipes, la main ne change pas. */
.hand-card:has(> .hand-lock) {
    position: relative;
}

.hand-lock {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.85);
    font-size: 0.8rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.55;
}

.hand-lock:hover,
.hand-lock.on {
    opacity: 1;
}

.hand-lock.on {
    background: #ffe9a8;
    border-color: #b8860b;
}

.team-scores {
    display: flex;
    gap: 0.3rem;
}

.team-score {
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid var(--team-color);
    font-weight: 800;
    font-size: 0.85rem;
    white-space: nowrap;
}

.team-score.mine {
    background: color-mix(in srgb, var(--team-color) 35%, rgba(0, 0, 0, 0.3));
}

/* ---------- Tchat d'équipe ---------- */
.chat-channels {
    display: flex;
    gap: 0.25rem;
    width: 100%;
    justify-content: flex-end;
}

.chat-channel {
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    border-radius: 999px;
    padding: 0.1rem 0.55rem;
    font: inherit;
    font-size: 0.72rem;
    cursor: pointer;
    opacity: 0.7;
}

.chat-channel.on {
    opacity: 1;
    border-color: var(--gold);
}

.chat-team {
    margin-right: 0.2rem;
}

.chat-line.team-line .chat-text {
    font-style: italic;
}

/* ---------- Fin de partie ---------- */
.team-results li {
    border-left: 4px solid var(--team-color);
    padding-left: 0.5rem;
    margin-bottom: 0.3rem;
}

.team-results small {
    display: block;
    opacity: 0.75;
}

@media (prefers-reduced-motion: reduce) {
    .ally-card.ready {
        animation: none;
    }
}

/* ---------- Téléphone : score compact, verrou dans la barre d'actions de la carte ---------- */
.hab-lock {
    align-self: flex-start;
    border: 1px solid rgba(0, 0, 0, 0.15);
    background: #fff;
    border-radius: 999px;
    padding: 0.15rem 0.5rem;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.hab-lock.on {
    background: #ffe9a8;
    border-color: #b8860b;
}

@media (min-width: 601px) and (min-height: 501px) {
    .hab-lock {
        display: none;
    }
}

@media (max-width: 600px), (orientation: landscape) and (max-height: 500px) {
    .team-scores {
        gap: 0.15rem;
    }

    .team-score {
        padding: 0.05rem 0.35rem;
        border-width: 1px;
        font-size: 0.72rem;
    }

    /* Cartes compactes : le verrou se règle dans la barre d'actions de la carte touchée ; sur la
       carte, seul le cadenas fermé reste visible (discret). */
    .hand-lock {
        display: none;
    }

    .hand-lock.on {
        display: block;
        top: 2px;
        right: 2px;
        width: 18px;
        height: 18px;
        font-size: 0.6rem;
        pointer-events: none;
    }
}
