/* ─── Galèrapagos : compléments au thème commun (styles.css, repris de Timebomb) ─── */

:root {
    --sea: #1b6f8a;
    --sand: #e9c46a;
    --jungle: #2a9d8f;
    --danger: #c0392b;
    --water-color: #4fc3f7;
    --food-color: #f4a261;
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, var(--danger) 100%);
    color: white;
}

.btn-danger:hover {
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.5);
}

.btn-warning {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
}

.btn-small {
    padding: 5px 10px;
    font-size: 0.7rem;
    text-transform: none;
    letter-spacing: 0;
}

.btn-spectator {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-light);
}

/* En-tête */
.gal-chip-water { border: 1px solid var(--water-color); }
.gal-chip-food { border: 1px solid var(--food-color); }
.gal-chip-raft { border: 1px solid var(--sand); }
.gal-chip-depart { background: linear-gradient(135deg, var(--jungle) 0%, #1d6f66 100%); }
.gal-chip-hurricane {
    background: linear-gradient(135deg, #6c3483 0%, #4a235a 100%);
    animation: pulse 1.5s infinite;
}

/* Panneau contextuel */
.phase-panel {
    background: rgba(15, 52, 96, 0.6);
    border: 1px solid rgba(233, 196, 106, 0.4);
    border-radius: var(--border-radius);
    padding: 10px;
    margin-bottom: 10px;
    display: none;
}

.gal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    align-items: center;
    margin: 6px 0;
}

/* Action renforcée par un objet posé : entourée en jaune */
.btn.gal-action-boost {
    box-shadow: 0 0 0 2px #ffd54f, 0 0 10px rgba(255, 213, 79, 0.55);
}

.gal-wood-action {
    display: inline-flex;
    gap: 4px;
    align-items: stretch;
}

/* Le select reprend la hauteur des boutons (sans la marge des champs de formulaire) */
.gal-wood-action select {
    width: auto;
    margin: 0;
    padding: 0 6px;
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text-light);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.7rem;
}

/* Rations nécessaires au départ (en-tête) */
.gal-need {
    opacity: 0.75;
    font-weight: 400;
}

.gal-need.gal-need-ok {
    opacity: 1;
    color: #2ecc71;
    font-weight: 700;
}

.gal-notice {
    font-size: 0.78rem;
    text-align: center;
    opacity: 0.9;
    margin: 4px 0;
}

.gal-res-title {
    text-align: center;
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.gal-shortage {
    background: var(--danger);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    margin-left: 6px;
}

/* Naufragés */
.gal-player {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 2px solid transparent;
}

.gal-player.gal-dead {
    opacity: 0.45;
    filter: grayscale(0.8);
}

.gal-player.gal-designated {
    border: 3px solid var(--danger);
    box-shadow: 0 0 20px rgba(192, 57, 43, 0.6);
    animation: pulse 1.5s infinite;
}

.gal-badges {
    display: flex;
    gap: 3px;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.gal-stats {
    font-weight: normal;
    opacity: 0.7;
    font-size: 0.75rem;
}

.gal-player-status {
    font-size: 0.75rem;
    opacity: 0.85;
    text-align: left;
}

.gal-perms {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.gal-perm {
    background: rgba(233, 196, 106, 0.2);
    border: 1px solid rgba(233, 196, 106, 0.5);
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 0.7rem;
    cursor: help;
}

.gal-vote-info,
.gal-vote-score {
    font-size: 0.75rem;
    text-align: left;
}

.gal-vote-score {
    color: #ff8a80;
    font-weight: 700;
}

/* Main */
.gal-hand {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    max-height: 45vh;
}

.gal-hand-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.gal-hand-tools {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

/* Interrupteur : contour marqué quand il est activé */
.gal-switch.on {
    background: rgba(233, 196, 106, 0.2);
    box-shadow: inset 0 0 0 1px var(--sand);
}

a.btn {
    text-decoration: none;
    display: inline-block;
}

/* Paramètres de la partie dans la salle d'attente (hôte) */
.gal-room-settings {
    background: var(--card-bg);
    padding: 12px 15px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
}

.gal-room-settings h3 {
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.gal-room-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.gal-room-settings-grid label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.gal-room-settings-grid select {
    margin: 0;
}

.gal-dev-tools {
    text-align: center;
    margin-top: 10px;
}

.gal-hand-cards {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.gal-card {
    flex: 0 0 150px;
    background: linear-gradient(160deg, #3b2f1e 0%, #2a2114 100%);
    border: 2px solid #8d6e3f;
    border-radius: 10px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gal-card.gal-kind-resource { border-color: var(--water-color); }
.gal-card.gal-kind-permanent { border-color: var(--sand); }
.gal-card.gal-kind-single { border-color: #b388ff; }
.gal-card.gal-kind-useless { border-color: #777; }

.gal-card-art {
    position: relative;
    height: 80px;
    border-radius: 6px;
    background: radial-gradient(circle, rgba(233, 196, 106, 0.25) 0%, rgba(0, 0, 0, 0.2) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.gal-card-art.small {
    height: 44px;
    width: 44px;
    flex-shrink: 0;
}

.gal-card-art img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gal-card-emoji {
    font-size: 2.4rem;
}

.gal-card-art.small .gal-card-emoji {
    font-size: 1.4rem;
}

.gal-card-name {
    font-weight: 700;
    font-size: 0.8rem;
}

.gal-cooked {
    color: #ffab40;
    font-weight: normal;
}

.gal-card-text {
    font-size: 0.68rem;
    opacity: 0.85;
    line-height: 1.25;
    flex: 1;
}

.gal-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.gal-empty {
    opacity: 0.6;
    text-align: center;
    width: 100%;
    font-size: 0.8rem;
}

/* Modales */
.gal-target-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: 15px 0;
}

.gal-target-option.selected {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
}

.gal-info-lines {
    margin: 15px 0 15px 20px;
    line-height: 1.6;
}

.gal-cards-modal {
    max-width: 640px;
}

.gal-cards-list h3 {
    margin: 12px 0 6px;
    color: var(--sand);
    font-size: 0.95rem;
}

.gal-cards-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.8rem;
}

.gal-reveal-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 10px 0;
}

.gal-reveal-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
}

.gal-reveal-item.escaped { background: rgba(42, 157, 143, 0.35); }
.gal-reveal-item.lost { background: rgba(192, 57, 43, 0.25); }

/* Logs de jeu */
.game-log-item.death { color: #ff8a80; font-weight: 600; }
.game-log-item.shortage,
.game-log-item.hurricane { color: #ffcc80; font-weight: 600; }
.game-log-item.vote { color: #b39ddb; }
.game-log-item.raft,
.game-log-item.victory { color: #80cbc4; font-weight: 600; }
.game-log-item.defeat { color: #ff8a80; font-weight: 700; }
.game-log-item.private { color: var(--sand); font-style: italic; }
.game-log-item.sick { color: #aed581; }

@media (max-width: 768px) {
    .gal-card {
        flex-basis: 130px;
    }

    .gal-hand {
        max-height: none;
    }
}

/* ─── Animations (anim.js) ─── */
.gal-toggle {
    display: flex;
    gap: 8px;
    align-items: center;
    cursor: pointer;
}

.anim-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1500;
    background: radial-gradient(circle, rgba(10, 30, 50, 0.85) 0%, rgba(0, 0, 0, 0.9) 100%);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    cursor: pointer;
}

.anim-overlay.active {
    display: flex;
    animation: animFadeIn 0.25s ease;
}

.anim-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    text-align: center;
    padding: 20px;
}

.anim-hint {
    position: absolute;
    bottom: 20px;
    font-size: 0.75rem;
    opacity: 0.5;
}

.anim-title {
    font-size: 1.3rem;
    font-weight: 700;
}

.anim-sub {
    opacity: 0.85;
}

/* Sac et boules */
.anim-bag {
    position: relative;
    width: 110px;
    height: 110px;
    border-radius: 45% 45% 40% 40%;
    background: radial-gradient(circle at 35% 30%, #c89b62 0%, #8d6e3f 60%, #5d4424 100%);
    box-shadow: inset -8px -10px 20px rgba(0, 0, 0, 0.4), 0 10px 25px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.anim-bag-neck {
    position: absolute;
    top: -12px;
    width: 46px;
    height: 20px;
    border-radius: 6px;
    background: #6d5230;
    border-bottom: 4px solid #d4a55a;
}

.anim-bag-body {
    font-size: 2rem;
    opacity: 0.35;
}

.anim-bag.shake {
    animation: animShake 0.35s ease-in-out 2;
}

.anim-balls {
    display: flex;
    gap: 14px;
    min-height: 70px;
    align-items: center;
}

.anim-ball {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    animation: animBallPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.anim-ball.white {
    background: radial-gradient(circle at 35% 30%, #ffffff 0%, #e0d6c2 70%, #b8a888 100%);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.5);
}

.anim-ball.black {
    background: radial-gradient(circle at 35% 30%, #555 0%, #1a1a1a 70%, #000 100%);
    box-shadow: 0 0 20px rgba(192, 57, 43, 0.8);
}

.anim-ball-fish {
    font-size: 0.85rem;
    line-height: 1;
    max-width: 48px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.anim-result {
    font-size: 1.5rem;
    font-weight: 800;
    min-height: 2rem;
}

.anim-result.good {
    color: #80cbc4;
    animation: animBallPop 0.4s ease;
}

.anim-result.bad {
    color: #ff8a80;
    animation: animShake 0.3s ease 2;
}

/* Objets qui volent vers les compteurs */
.anim-fly {
    position: fixed;
    z-index: 1600;
    pointer-events: none;
    will-change: transform, opacity;
}

.anim-bump {
    animation: animBump 0.5s ease;
}

/* Radeau */
.anim-raft {
    position: relative;
    width: 260px;
    height: 110px;
    overflow: hidden;
}

.anim-boat {
    position: absolute;
    bottom: 26px;
    font-size: 3.5rem;
    animation: animSail 2s ease-in-out forwards, animBob 0.6s ease-in-out infinite alternate;
}

.anim-waves {
    position: absolute;
    bottom: 0;
    width: 100%;
    font-size: 2rem;
    letter-spacing: -6px;
    animation: animBob 0.8s ease-in-out infinite alternate-reverse;
}

/* Carte de l'épave */
.anim-card {
    width: 190px;
    height: 260px;
    perspective: 900px;
}

/* Fouille de plusieurs cartes : rangée plus compacte */
.anim-card-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    max-width: 92vw;
}

.anim-card-row.multi .anim-card {
    width: 150px;
    height: 225px;
}

.anim-card-row.multi .anim-card-front .gal-card-art {
    height: 90px;
}

/* Grosses fouilles (paquets de 108 cartes et plus) : cartes réduites */
.anim-card-row.many {
    gap: 8px;
    max-height: 80vh;
    overflow-y: auto;
}

.anim-card-row.many .anim-card {
    width: 105px;
    height: 150px;
}

.anim-card-row.many .anim-card-front .gal-card-art {
    height: 55px;
}

.anim-card-row.many .gal-card-text {
    display: none;
}

.anim-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.7s cubic-bezier(0.4, 0.2, 0.2, 1);
    transform-style: preserve-3d;
}

.anim-card.flipped .anim-card-inner {
    transform: rotateY(180deg);
}

.anim-card-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.anim-card-back,
.anim-card-back-mini {
    background: repeating-linear-gradient(90deg, #6d4c2a 0 18px, #5d4024 18px 22px);
    border: 3px solid #d4a55a;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

.anim-card-back-mini {
    width: 38px;
    height: 52px;
    border-radius: 6px;
    display: flex;
    font-size: 1.2rem;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.5);
}

.anim-card-front {
    transform: rotateY(180deg);
    background: linear-gradient(160deg, #3b2f1e 0%, #2a2114 100%);
    border: 3px solid #8d6e3f;
    box-shadow: 0 0 35px rgba(233, 196, 106, 0.5);
}

.anim-card-front.gal-kind-resource { border-color: var(--water-color); }
.anim-card-front.gal-kind-permanent { border-color: var(--sand); }
.anim-card-front.gal-kind-single { border-color: #b388ff; }
.anim-card-front.gal-kind-useless { border-color: #777; }

.anim-card-front .gal-card-art {
    height: 120px;
}

@keyframes animFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes animShake {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(-9deg); }
    75% { transform: rotate(9deg); }
}

@keyframes animBallPop {
    0% { transform: translateY(-60px) scale(0.2); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes animBump {
    0%, 100% { transform: scale(1); }
    40% { transform: scale(1.25); box-shadow: 0 0 18px rgba(233, 196, 106, 0.8); }
}

@keyframes animSail {
    from { left: -70px; }
    to { left: calc(50% - 30px); }
}

@keyframes animBob {
    from { transform: translateY(0); }
    to { transform: translateY(-6px); }
}

@media (prefers-reduced-motion: reduce) {
    .anim-bag.shake,
    .anim-boat,
    .anim-waves,
    .anim-ball,
    .anim-bump {
        animation: none;
    }
}

/* Cartes jouées */
.anim-card-pop {
    animation: animCardPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.anim-card-static {
    width: 170px;
    min-height: 220px;
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.anim-card-static.anim-card-back {
    display: flex;
}

.anim-card-front-static {
    background: linear-gradient(160deg, #3b2f1e 0%, #2a2114 100%);
    border: 3px solid #8d6e3f;
    box-shadow: 0 0 35px rgba(233, 196, 106, 0.5);
}

.anim-card-front-static.gal-kind-resource { border-color: var(--water-color); }
.anim-card-front-static.gal-kind-permanent { border-color: var(--sand); }
.anim-card-front-static.gal-kind-single { border-color: #b388ff; }
.anim-card-front-static.gal-kind-useless { border-color: #777; }

.anim-card-front-static .gal-card-art {
    height: 110px;
}

.anim-card-mini {
    width: 38px;
    height: 52px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background: linear-gradient(160deg, #3b2f1e 0%, #2a2114 100%);
    border: 2px solid var(--sand);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.5);
}

/* Tir */
.anim-shot {
    font-size: 4rem;
    display: flex;
    gap: 10px;
    align-items: center;
}

.anim-gun {
    animation: animRecoil 0.25s ease 0.4s;
}

.anim-bang {
    opacity: 0;
    animation: animBang 0.6s ease 0.4s forwards;
}

.anim-hit {
    animation: animHit 0.5s ease;
}

@keyframes animCardPop {
    0% { transform: scale(0.3) rotate(-10deg); opacity: 0; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes animRecoil {
    0%, 100% { transform: rotate(0); }
    50% { transform: rotate(-25deg) translateX(-10px); }
}

@keyframes animBang {
    0% { opacity: 0; transform: scale(0.3); }
    40% { opacity: 1; transform: scale(1.4); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes animHit {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-10px); box-shadow: 0 0 25px rgba(192, 57, 43, 0.9); }
    40%, 80% { transform: translateX(10px); }
}
