/* ============================================================
   Loup-Garou — Styles immersifs
   ============================================================ */

/* Fond nuit étoilée */
.lg-night-bg {
    background: radial-gradient(ellipse at 50% 0%, #0c1445 0%, #070b1a 50%, #020408 100%);
    position: relative;
    overflow: hidden;
}

.lg-night-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(2px 2px at 20% 10%, rgba(255,255,255,0.5), transparent),
        radial-gradient(2px 2px at 40% 20%, rgba(255,255,255,0.3), transparent),
        radial-gradient(1px 1px at 60% 15%, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 80% 25%, rgba(255,255,255,0.4), transparent),
        radial-gradient(2px 2px at 10% 40%, rgba(255,255,255,0.3), transparent),
        radial-gradient(1px 1px at 30% 60%, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 50% 80%, rgba(255,255,255,0.4), transparent),
        radial-gradient(2px 2px at 70% 50%, rgba(255,255,255,0.3), transparent),
        radial-gradient(1px 1px at 90% 70%, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 15% 85%, rgba(255,255,255,0.3), transparent),
        radial-gradient(2px 2px at 55% 45%, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 85% 90%, rgba(255,255,255,0.3), transparent);
    pointer-events: none;
    animation: twinkle 4s ease-in-out infinite alternate;
}

@keyframes twinkle {
    0% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* Feu de camp */
@keyframes fire-flicker {
    0%, 100% { text-shadow: 0 0 20px #f97316, 0 0 40px #ef4444, 0 0 60px #dc2626; transform: scale(1); }
    25% { text-shadow: 0 0 25px #fb923c, 0 0 50px #f97316, 0 0 70px #ef4444; transform: scale(1.05) rotate(-1deg); }
    50% { text-shadow: 0 0 30px #fbbf24, 0 0 55px #f97316, 0 0 80px #ef4444; transform: scale(1.02) rotate(1deg); }
    75% { text-shadow: 0 0 22px #f97316, 0 0 45px #ef4444, 0 0 65px #dc2626; transform: scale(1.04) rotate(-0.5deg); }
}

.lg-fire {
    animation: fire-flicker 2s ease-in-out infinite;
    display: inline-block;
}

/* Lueur du feu sur les éléments */
.lg-fire-glow {
    box-shadow: 0 0 30px rgba(249, 115, 22, 0.15), 0 0 60px rgba(239, 68, 68, 0.1);
}

/* Lune */
@keyframes moon-glow {
    0%, 100% { box-shadow: 0 0 30px rgba(254, 240, 138, 0.3), 0 0 60px rgba(254, 240, 138, 0.1); }
    50% { box-shadow: 0 0 40px rgba(254, 240, 138, 0.5), 0 0 80px rgba(254, 240, 138, 0.2); }
}

.lg-moon {
    animation: moon-glow 4s ease-in-out infinite;
}

/* Avatar du personnage */
.lg-avatar {
    position: relative;
    width: 140px;
    height: 200px;
    margin: 0 auto;
}

.lg-avatar-body {
    width: 100px;
    height: 130px;
    border-radius: 50% 50% 40% 40%;
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
}

/* Yeux qui brillent pour les loups */
@keyframes wolf-eyes {
    0%, 90%, 100% { opacity: 1; }
    95% { opacity: 0; }
}

.lg-wolf-eyes {
    animation: wolf-eyes 3s ease-in-out infinite;
}

/* Poils dépassant du t-shirt pour les loups */
.lg-wolf-fur::before {
    content: '〰️';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    opacity: 0.6;
    letter-spacing: -3px;
}

.lg-wolf-fur::after {
    content: '';
    position: absolute;
    top: 15%;
    left: 10%;
    width: 80%;
    height: 40%;
    background: repeating-linear-gradient(
        135deg,
        transparent,
        transparent 3px,
        rgba(139, 92, 55, 0.15) 3px,
        rgba(139, 92, 55, 0.15) 4px
    );
    border-radius: 50%;
    pointer-events: none;
}

/* Halo pour la voyante */
@keyframes seer-glow {
    0%, 100% { box-shadow: 0 0 15px rgba(168, 85, 247, 0.4), 0 0 30px rgba(168, 85, 247, 0.2); }
    50% { box-shadow: 0 0 25px rgba(168, 85, 247, 0.6), 0 0 50px rgba(168, 85, 247, 0.3); }
}

.lg-seer-glow {
    animation: seer-glow 2s ease-in-out infinite;
}

/* Aura sorcière */
@keyframes witch-bubbles {
    0%, 100% { box-shadow: 0 0 15px rgba(34, 197, 94, 0.3); }
    50% { box-shadow: 0 0 25px rgba(34, 197, 94, 0.5), 0 0 45px rgba(34, 197, 94, 0.2); }
}

.lg-witch-glow {
    animation: witch-bubbles 2.5s ease-in-out infinite;
}

/* Carte de rôle — reveal */
@keyframes role-reveal {
    0% { transform: rotateY(180deg) scale(0.8); opacity: 0; }
    60% { transform: rotateY(0deg) scale(1.05); opacity: 1; }
    100% { transform: rotateY(0deg) scale(1); opacity: 1; }
}

.lg-role-card {
    animation: role-reveal 0.8s ease-out forwards;
    perspective: 1000px;
    border-radius: 1.25rem;
    overflow: hidden;
    position: relative;
}

.lg-role-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.06) 0%, transparent 60%);
    pointer-events: none;
}

/* Équipe badges */
.lg-team-village {
    background: linear-gradient(135deg, #1e3a5f, #1e40af);
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.lg-team-loup {
    background: linear-gradient(135deg, #4a0e0e, #7f1d1d);
    border: 1px solid rgba(220, 38, 38, 0.4);
}

.lg-team-solo {
    background: linear-gradient(135deg, #3b1f4e, #581c87);
    border: 1px solid rgba(147, 51, 234, 0.4);
}

/* Phase day/night indicators */
.lg-phase-night {
    background: linear-gradient(180deg, #020420, #0c1445);
}

.lg-phase-day {
    background: linear-gradient(180deg, #1e3a5f, #172554);
}

/* Vote card */
.lg-vote-card {
    background: rgba(255,255,255,0.03);
    border: 2px solid rgba(255,255,255,0.08);
    border-radius: 1rem;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lg-vote-card:hover {
    border-color: rgba(233, 69, 96, 0.4);
    background: rgba(233, 69, 96, 0.05);
}

.lg-vote-card.selected {
    border-color: #e94560;
    background: rgba(233, 69, 96, 0.15);
    box-shadow: 0 0 20px rgba(233, 69, 96, 0.2);
}

/* Dead player overlay */
.lg-dead {
    opacity: 0.4;
    filter: grayscale(1);
    position: relative;
}

.lg-dead::after {
    content: '💀';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
}

/* Breathing animation for waiting */
@keyframes breathe {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.05); opacity: 1; }
}

.lg-breathe {
    animation: breathe 3s ease-in-out infinite;
}

/* MJ Script card */
.lg-script-card {
    background: linear-gradient(135deg, #1a1a2e 0%, #0f1a3a 100%);
    border: 1px solid rgba(249, 115, 22, 0.3);
    border-radius: 1rem;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.lg-script-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #f97316, #ef4444, #f97316);
}

/* Fog effect */
@keyframes fog-drift {
    0% { transform: translateX(-10%); opacity: 0.3; }
    50% { transform: translateX(10%); opacity: 0.5; }
    100% { transform: translateX(-10%); opacity: 0.3; }
}

.lg-fog {
    position: absolute;
    bottom: 0;
    left: -10%;
    right: -10%;
    height: 80px;
    background: linear-gradient(transparent, rgba(255,255,255,0.03));
    filter: blur(20px);
    animation: fog-drift 8s ease-in-out infinite;
    pointer-events: none;
}

/* Pulse du loup */
@keyframes wolf-pulse {
    0%, 100% { filter: drop-shadow(0 0 8px rgba(220, 38, 38, 0.4)); }
    50% { filter: drop-shadow(0 0 20px rgba(220, 38, 38, 0.8)); }
}

.lg-wolf-pulse {
    animation: wolf-pulse 2s ease-in-out infinite;
}

/* ─── Tooltip rôles ─── */
.lg-tooltip {
    position: relative;
    cursor: pointer;
}

.lg-tooltip .lg-tooltip-text {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    z-index: 50;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 200px;
    max-width: 260px;
    padding: 10px 12px;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
    font-size: 11px;
    line-height: 1.5;
    color: #cbd5e1;
    text-align: center;
    font-weight: 400;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    white-space: normal;
}

.lg-tooltip .lg-tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #0f172a transparent transparent transparent;
}

/* Desktop hover */
.lg-tooltip:hover .lg-tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Mobile : quand la classe .active est ajoutée par JS */
.lg-tooltip.active .lg-tooltip-text {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

/* Variante : tooltip vers le bas (pour les éléments en haut de page) */
.lg-tooltip-down .lg-tooltip-text {
    bottom: auto;
    top: calc(100% + 8px);
}

.lg-tooltip-down .lg-tooltip-text::after {
    top: auto;
    bottom: 100%;
    border-color: transparent transparent #0f172a transparent;
}

/* Badge nom du rôle dans le tooltip */
.lg-tooltip-role-name {
    font-weight: 700;
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
}

/* ═══════════════════════════════════════════════════════
   PORTRAIT SYSTEM — Real images with emoji fallback
   ═══════════════════════════════════════════════════════ */

.lg-portrait {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    /* Fallback for older browsers */
    background: radial-gradient(circle, rgba(59, 130, 246, 0.12) 0%, transparent 70%);
    border: 2px solid rgba(59, 130, 246, 0.3);
    transition: all 0.3s ease;
}

/* Modern browsers with color-mix support */
@supports (background: color-mix(in srgb, red 50%, blue)) {
    .lg-portrait {
        background: radial-gradient(circle, color-mix(in srgb, var(--role-color, #3b82f6) 12%, transparent) 0%, transparent 70%);
        border-color: color-mix(in srgb, var(--role-color, #3b82f6) 30%, transparent);
    }
}

/* Sizes */
.lg-portrait-xs  { width: 32px;  height: 32px;  }
.lg-portrait-sm  { width: 48px;  height: 48px;  }
.lg-portrait-md  { width: 72px;  height: 72px;  }
.lg-portrait-lg  { width: 96px;  height: 96px;  }
.lg-portrait-xl  { width: 120px; height: 120px; }
.lg-portrait-2xl { width: 160px; height: 160px; }

/* Image inside portrait */
.lg-portrait-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
}

/* Emoji fallback centering */
.lg-portrait-emoji {
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
}

/* Generic player (no role) */
.lg-portrait-generic {
    --role-color: #6b7280;
    background: rgba(255,255,255,0.03);
    border-color: rgba(255,255,255,0.08);
}

/* Team border colors */
.lg-portrait-village {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.2);
}

.lg-portrait-loup {
    border-color: rgba(220, 38, 38, 0.5);
    box-shadow: 0 0 12px rgba(220, 38, 38, 0.2);
}

.lg-portrait-solo {
    border-color: rgba(168, 85, 247, 0.5);
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.2);
}

/* Hover effect on portraits */
.lg-portrait:hover {
    transform: scale(1.08);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

.lg-portrait-loup:hover {
    box-shadow: 0 0 20px rgba(220, 38, 38, 0.4);
}

.lg-portrait-solo:hover {
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.4);
}

/* Dead portrait */
.lg-portrait-dead {
    filter: grayscale(1) brightness(0.5);
    opacity: 0.5;
    border-color: rgba(255,255,255,0.05) !important;
    box-shadow: none !important;
}

.lg-portrait-dead::after {
    content: '💀';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2em;
    z-index: 2;
    filter: grayscale(0) brightness(1);
}

/* ═══════════════════════════════════════════════════════
   ROLE CARD V2 — Full graphical with image
   ═══════════════════════════════════════════════════════ */

.lg-role-card-v2 {
    animation: role-reveal 0.8s ease-out forwards;
    border-radius: 1.5rem;
    overflow: hidden;
    position: relative;
    padding: 0;
}

.lg-role-card-v2 .lg-role-card-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.lg-role-card-v2 .lg-role-card-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.15;
    filter: blur(4px);
}

.lg-role-card-v2 .lg-role-card-content {
    position: relative;
    z-index: 1;
    padding: 1.5rem;
}

/* ═══════════════════════════════════════════════════════
   GAME HUD — Overlays for phase info
   ═══════════════════════════════════════════════════════ */

.lg-hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    border-radius: 1rem;
    border: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 1rem;
}

.lg-hud-item {
    text-align: center;
    flex: 1;
}

.lg-hud-item .lg-hud-value {
    font-size: 1.1rem;
    font-weight: 900;
    line-height: 1.2;
}

.lg-hud-item .lg-hud-label {
    font-size: 0.6rem;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.lg-hud-divider {
    width: 1px;
    height: 24px;
    background: rgba(255,255,255,0.1);
    margin: 0 0.5rem;
}

/* ═══════════════════════════════════════════════════════
   SCENE BACKGROUNDS — Layered atmosphere
   ═══════════════════════════════════════════════════════ */

.lg-scene {
    position: relative;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    min-height: 70vh;
}

.lg-scene::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.7) 100%);
    z-index: 1;
}

.lg-scene > * {
    position: relative;
    z-index: 2;
}

/* Night scene fallback (when no image) */
.lg-scene-night {
    background: radial-gradient(ellipse at 50% 0%, #0c1445 0%, #070b1a 50%, #020408 100%);
}

/* Day scene fallback */
.lg-scene-day {
    background: radial-gradient(ellipse at 50% 0%, #1e3a5f 0%, #172554 50%, #0c1445 100%);
}

/* Vote scene */
.lg-scene-vote {
    background: linear-gradient(180deg, #1a0a0a 0%, #2d1b1b 50%, #1a1a1a 100%);
}

/* ═══════════════════════════════════════════════════════
   PLAYER GRID — Vote / Day / Night targets
   ═══════════════════════════════════════════════════════ */

.lg-player-card {
    background: rgba(255,255,255,0.03);
    border: 2px solid rgba(255,255,255,0.06);
    border-radius: 1rem;
    padding: 0.75rem 0.5rem;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.lg-player-card:hover {
    border-color: rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.06);
    transform: translateY(-2px);
}

.lg-player-card.selected {
    border-color: #e94560;
    background: rgba(233, 69, 96, 0.12);
    box-shadow: 0 0 20px rgba(233, 69, 96, 0.2);
    transform: translateY(-2px);
}

.lg-player-card .lg-player-name {
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    margin-top: 0.35rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════
   DEATH ANNOUNCEMENT — Dramatic reveal
   ═══════════════════════════════════════════════════════ */

@keyframes death-reveal {
    0% { opacity: 0; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}

.lg-death-card {
    animation: death-reveal 0.6s ease-out forwards;
    background: rgba(127, 29, 29, 0.2);
    border: 1px solid rgba(220, 38, 38, 0.3);
    border-radius: 1rem;
    padding: 1rem;
    text-align: center;
}

.lg-death-card .lg-portrait {
    filter: grayscale(0.5) brightness(0.7);
    border-color: rgba(220, 38, 38, 0.5);
}

/* ═══════════════════════════════════════════════════════
   RESULT PLAYER ROW — Enhanced with portrait
   ═══════════════════════════════════════════════════════ */

.lg-result-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255,255,255,0.05);
    background: rgba(255,255,255,0.02);
    transition: all 0.2s ease;
}

.lg-result-row:hover {
    background: rgba(255,255,255,0.05);
}

.lg-result-row-winner {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.2);
}

.lg-result-row-dead {
    opacity: 0.5;
}

/* ═══════════════════════════════════════════════════════
   LOBBY ROLE CONFIG — With portraits
   ═══════════════════════════════════════════════════════ */

.lg-config-role {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.4rem;
    padding: 0.25rem 0;
}

.lg-config-role-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    flex: 1;
}

/* ═══════════════════════════════════════════════════════
   ANIMATIONS — Enhanced for graphical mode
   ═══════════════════════════════════════════════════════ */

@keyframes portrait-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.lg-portrait-float {
    animation: portrait-float 3s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% { box-shadow: 0 0 12px rgba(59, 130, 246, 0.2); }
    50% { box-shadow: 0 0 30px rgba(59, 130, 246, 0.5), 0 0 60px rgba(59, 130, 246, 0.2); }
}

.lg-portrait-glow {
    animation: glow-pulse 2s ease-in-out infinite;
}

.lg-portrait-loup.lg-portrait-glow {
    animation-name: glow-pulse-red;
}

@keyframes glow-pulse-red {
    0%, 100% { box-shadow: 0 0 12px rgba(220, 38, 38, 0.3); }
    50% { box-shadow: 0 0 30px rgba(220, 38, 38, 0.6), 0 0 60px rgba(220, 38, 38, 0.2); }
}

.lg-portrait-solo.lg-portrait-glow {
    animation-name: glow-pulse-purple;
}

@keyframes glow-pulse-purple {
    0%, 100% { box-shadow: 0 0 12px rgba(168, 85, 247, 0.3); }
    50% { box-shadow: 0 0 30px rgba(168, 85, 247, 0.6), 0 0 60px rgba(168, 85, 247, 0.2); }
}

/* Particules de feu (pure CSS) */
@keyframes ember-rise {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-60px) scale(0.3); }
}

.lg-ember {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #f97316;
    animation: ember-rise 2s ease-out infinite;
    pointer-events: none;
}

.lg-ember:nth-child(2) { left: 30%; animation-delay: 0.3s; background: #fbbf24; }
.lg-ember:nth-child(3) { left: 60%; animation-delay: 0.7s; }
.lg-ember:nth-child(4) { left: 45%; animation-delay: 1.1s; background: #ef4444; }
.lg-ember:nth-child(5) { left: 70%; animation-delay: 0.5s; background: #fbbf24; }

/* ═══════════════════════════════════════════════════════
   FULLSCREEN GAME LAYOUT — Mobile game UI
   ═══════════════════════════════════════════════════════ */

.lg-fullscreen {
    min-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.lg-fullscreen-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Bottom action bar */
.lg-action-bar {
    padding: 1rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.8) 30%);
    position: sticky;
    bottom: 0;
    z-index: 10;
}

/* ═══════════════════════════════════════════════════════
   SETUP — Role gallery with portraits
   ═══════════════════════════════════════════════════════ */

.lg-role-gallery-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 1rem;
    padding: 0.75rem;
    text-align: center;
    transition: all 0.3s ease;
}

.lg-role-gallery-card:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.12);
    transform: translateY(-2px);
}

/* ═══════════════════════════════════════════════════════
   CAMPFIRE — Enhanced CSS fire effect
   ═══════════════════════════════════════════════════════ */

.lg-campfire {
    position: relative;
    display: inline-block;
    text-align: center;
}

.lg-campfire-embers {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    height: 60px;
    pointer-events: none;
}

.lg-campfire-logs {
    display: flex;
    justify-content: center;
    gap: 2px;
    margin-top: 4px;
    opacity: 0.3;
}

.lg-campfire-log {
    border-radius: 9999px;
}
