/**
 * mFLIP Maus Edition - Game Screen
 * v10.3.0 - COMPLETE LAYOUT REWRITE: Proper Flexbox structure with no overlapping
 */

/* ========== PERFORMANCE OPTIMIZATIONS ========== */
.skyjo-opponent,
.pile,
.player-board,
.skyjo-slot {
    contain: layout style;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========== GAME SCREEN - MAIN FLEXBOX CONTAINER ========== */
/* v10.3.0: Three-zone vertical layout: opponents | piles | player */
#screen-game {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    position: relative;
}

.game-loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    z-index: 200;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.game-loading-overlay__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 18px 22px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    color: #ffffff;
    font-weight: 700;
    text-align: center;
}

.game-loading-overlay__spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: gameLoadingSpin 0.9s linear infinite;
}

.game-loading-overlay__text {
    font-size: 0.95rem;
}

@keyframes gameLoadingSpin {
    to { transform: rotate(360deg); }
}

/* ========== GAME BUTTONS (Absolute positioned - outside flow) ========== */
.game-btn {
    position: absolute;
    z-index: 100;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.game-btn:hover {
    transform: scale(1.05);
}

.game-btn:active {
    transform: scale(0.95);
}

.game-btn--back {
    top: 14px;
    left: 14px;
    background: linear-gradient(145deg, var(--primary) 0%, var(--primary-dark) 100%);
    box-shadow:
        0 4px 0 var(--primary-shadow),
        0 6px 16px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.game-btn--back:active {
    box-shadow:
        0 2px 0 var(--primary-shadow),
        0 4px 12px rgba(0, 0, 0, 0.3);
    transform: translateY(2px);
}

.game-btn--fullscreen {
    display: none;
}

/* ========== GAME INFO (Hidden) ========== */
.game-info {
    display: none;
}

/* ========== ZONE 1: OPPONENTS AREA (flex: 0 0 auto) ========== */
/* v10.3.0: Takes only the space it needs, no negative margins or scale transforms */
.opponents {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 52px 12px 8px 12px;
    gap: 10px;
    min-height: 0;
}

.skyjo-opponent {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    /* v10.3.0: Use CSS variables for responsive sizing instead of transform */
    --opp-scale: 0.85;
}

.skyjo-opponent.player-offline {
    opacity: 0.7;
}

.skyjo-opponent__avatar {
    width: clamp(40px, 8vw, 55px);
    height: clamp(40px, 8vw, 55px);
    border-radius: 50%;
    overflow: visible;
    border: 2px solid white;
    background: white;
    box-shadow:
        0 3px 12px rgba(0, 0, 0, 0.3),
        0 1px 4px rgba(0, 0, 0, 0.15);
    z-index: 10;
    position: relative;
    --timer-progress: 100;
    --timer-color: #FFD54F;
}

.skyjo-opponent__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    position: relative;
    z-index: 1;
}

/* Opponent Timer Overlay */
.skyjo-opponent__timer-overlay {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.skyjo-opponent.is-current-turn .skyjo-opponent__timer-overlay {
    opacity: 1;
}

.skyjo-opponent__timer-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        transparent calc(360deg * (1 - var(--timer-progress) / 100)),
        var(--timer-color) calc(360deg * (1 - var(--timer-progress) / 100)),
        var(--timer-color) 360deg
    );
    opacity: 0.6;
    transition: background 0.1s linear;
}

.skyjo-opponent__timer-overlay::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid var(--timer-color);
    opacity: 0.8;
    filter: drop-shadow(0 0 6px var(--timer-color));
    transition: border-color 0.3s, filter 0.3s;
}

.skyjo-opponent.is-current-turn.warning .skyjo-opponent__avatar {
    --timer-color: #FF5252;
}

.skyjo-opponent.is-current-turn.warning .skyjo-opponent__timer-overlay::before {
    animation: timerPulse 0.5s infinite;
}

.skyjo-opponent.is-current-turn.warning .skyjo-opponent__timer-overlay::after {
    animation: timerGlowPulse 0.5s infinite;
}

.skyjo-opponent__container {
    background: linear-gradient(145deg, rgba(80, 130, 170, 0.95) 0%, rgba(60, 110, 150, 0.98) 100%);
    border-radius: 12px;
    padding: 8px 10px 6px;
    margin-top: -20px;
    padding-top: 26px;
    text-align: center;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow:
        0 6px 16px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.skyjo-opponent.is-current-turn .skyjo-opponent__container {
    box-shadow:
        0 0 0 3px #00e676,
        0 0 25px rgba(0, 230, 118, 0.5),
        0 8px 24px rgba(0, 0, 0, 0.25);
    animation: opponentTurnPulse 1.5s infinite;
}

@keyframes opponentTurnPulse {
    0%, 100% { box-shadow: 0 0 0 3px #00e676, 0 0 25px rgba(0, 230, 118, 0.5), 0 8px 24px rgba(0, 0, 0, 0.25); }
    50% { box-shadow: 0 0 0 3px #00e676, 0 0 40px rgba(0, 230, 118, 0.7), 0 8px 24px rgba(0, 0, 0, 0.25); }
}

.skyjo-opponent__name {
    font-size: clamp(10px, 2.5vw, 12px);
    font-weight: 700;
    margin-bottom: 4px;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
}

.skyjo-opponent__score-badge {
    position: absolute;
    top: 0;
    right: -8px;
    min-width: 26px;
    height: 26px;
    padding: 0 6px;
    background: linear-gradient(145deg, var(--success) 0%, #3d9c40 100%);
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
    border: 2px solid white;
    box-shadow:
        0 3px 10px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    z-index: 15;
}

/* v10.3.0: Opponent grid uses CSS variables for responsive sizing */
.skyjo-opponent__grid {
    display: grid;
    grid-template-columns: repeat(4, var(--opp-card-w, 32px));
    grid-template-rows: repeat(3, var(--opp-card-h, 45px));
    gap: 3px;
    justify-content: center;
    margin-bottom: 6px;
}

.skyjo-opponent__card {
    border-radius: 3px;
    overflow: hidden;
    background: linear-gradient(145deg, #e0e0e0 0%, #c0c0c0 100%);
    box-shadow:
        0 1px 4px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.skyjo-opponent__card.removed {
    opacity: 0.2;
}

.skyjo-opponent__card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.skyjo-opponent__score {
    font-size: 11px;
    font-weight: 700;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.98) 0%, rgba(245, 245, 245, 0.95) 100%);
    color: #333;
    padding: 6px 14px;
    border-radius: 16px;
    display: inline-block;
    box-shadow:
        0 3px 10px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* ========== ZONE 2: PILES SECTION (flex: 0 0 auto) ========== */
/* v10.3.0: Fixed height zone with INCREASED padding - clear separation from player zone */
.piles {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 20px 16px 24px 16px;
    position: relative;
    z-index: 1;
    min-height: calc(var(--card-h) + 50px);
    /* v10.3.0: Add margin-bottom for extra separation from player area */
    margin-bottom: 8px;
}

/* ========== PLAYER INFO (Positioned within piles) ========== */
.player-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 85px;
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
}

.player-info__avatar {
    position: relative;
    width: 68px;
    height: 68px;
    --timer-progress: 100;
    --timer-color: #FFD54F;
}

.player-info__avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid white;
    object-fit: cover;
    box-shadow:
        0 5px 18px rgba(0, 0, 0, 0.35),
        0 2px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}

/* Avatar Timer Overlay */
.timer-overlay-avatar {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.player-info__avatar.my-turn .timer-overlay-avatar {
    opacity: 1;
}

.timer-overlay-avatar::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        transparent calc(360deg * (1 - var(--timer-progress) / 100)),
        var(--timer-color) calc(360deg * (1 - var(--timer-progress) / 100)),
        var(--timer-color) 360deg
    );
    opacity: 0.6;
    transition: background 0.1s linear;
}

.timer-overlay-avatar::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 3px solid var(--timer-color);
    opacity: 0.8;
    filter: drop-shadow(0 0 8px var(--timer-color));
    transition: border-color 0.3s, filter 0.3s;
}

.player-info__avatar.warning {
    --timer-color: #FF5252;
}

.player-info__avatar.warning .timer-overlay-avatar::before {
    animation: timerPulse 0.5s infinite;
}

.player-info__avatar.warning .timer-overlay-avatar::after {
    animation: timerGlowPulse 0.5s infinite;
}

@keyframes timerPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.8; }
}

@keyframes timerGlowPulse {
    0%, 100% {
        filter: drop-shadow(0 0 8px var(--timer-color));
        opacity: 0.8;
    }
    50% {
        filter: drop-shadow(0 0 16px var(--timer-color));
        opacity: 1;
    }
}

.timer-ring {
    display: none;
}

.player-info__hand-sum {
    position: absolute;
    top: -4px;
    right: -10px;
    width: 34px;
    height: 34px;
    background: linear-gradient(145deg, var(--success) 0%, #3d9c40 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    border: 2px solid white;
    box-shadow:
        0 3px 10px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    z-index: 10;
    color: white;
}

.player-info__details {
    text-align: center;
    margin-top: 6px;
}

.player-info__score {
    display: block;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.95);
    background: linear-gradient(145deg, rgba(60, 60, 60, 0.9) 0%, rgba(40, 40, 40, 0.95) 100%);
    padding: 3px 10px;
    border-radius: 10px;
    margin-bottom: 3px;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.player-info__name {
    display: block;
    font-weight: 700;
    font-size: 13px;
    background: linear-gradient(145deg, rgba(60, 60, 60, 0.9) 0%, rgba(40, 40, 40, 0.95) 100%);
    padding: 3px 12px;
    border-radius: 10px;
    color: white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* ========== CARD PILES ========== */
.piles__cards {
    display: flex;
    align-items: center;
    gap: 18px;
    position: relative;
}

/* v10.3.0: Pile cards also have max limits */
.pile {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s;
    max-width: 70px;
}

.pile.active {
    transform: scale(1.05);
    animation: pileActivePulse 1s infinite;
}

@keyframes pileActivePulse {
    0%, 100% { transform: scale(1.05); }
    50% { transform: scale(1.08); }
}

.pile.active .pile__cards {
    box-shadow:
        0 0 0 4px #00e676,
        0 0 25px rgba(0, 230, 118, 0.6),
        0 6px 20px rgba(0, 0, 0, 0.3);
    animation: pileGlow 1s infinite;
}

@keyframes pileGlow {
    0%, 100% { box-shadow: 0 0 0 4px #00e676, 0 0 25px rgba(0, 230, 118, 0.6), 0 6px 20px rgba(0, 0, 0, 0.3); }
    50% { box-shadow: 0 0 0 4px #00e676, 0 0 40px rgba(0, 230, 118, 0.8), 0 6px 20px rgba(0, 0, 0, 0.3); }
}

.pile.disabled {
    cursor: not-allowed;
}

/* v10.4.0: Pile cards with responsive max limits */
.pile__cards {
    width: var(--card-w);
    height: var(--card-h);
    max-width: var(--card-max-w, 70px);
    max-height: var(--card-max-h, 98px);
    border-radius: var(--card-radius);
    overflow: hidden;
    background: linear-gradient(145deg, #444 0%, #333 100%);
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.pile__cards img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pile__empty {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 12px;
    color: #888;
    background: rgba(255, 255, 255, 0.08);
}

.pile__label {
    display: none;
}

/* ========== HELD CARD ========== */
.held-card {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateX(-60px) rotate(-5deg);
    width: var(--card-w);
    height: var(--card-h);
    border-radius: var(--card-radius);
    overflow: hidden;
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.55),
        0 0 0 3px var(--cheese),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    display: none;
    z-index: 20;
    animation: heldCardAppear 0.3s ease-out;
}

@keyframes heldCardAppear {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) translateX(-60px) rotate(-5deg) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) translateX(-60px) rotate(-5deg) scale(1);
    }
}

.held-card.visible {
    display: block;
}

.held-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ========== ZONE 3: PLAYER AREA (flex: 1) ========== */
/* v10.3.0: Takes all remaining space, aligns content to bottom with padding-top for separation */
.player-area,
.skyjo-player-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    min-height: 0;
    overflow: visible;
    /* v10.3.0: Ensure minimum separation from piles zone */
    padding-top: 12px;
}

.player-area.is-my-turn .player-board,
.skyjo-player-area.is-my-turn .player-board {
    box-shadow:
        0 -4px 0 4px #00e676,
        0 0 50px rgba(0, 230, 118, 0.5);
    animation: boardPulse 2s infinite;
}

@keyframes boardPulse {
    0%, 100% { box-shadow: 0 -4px 0 4px #00e676, 0 0 50px rgba(0, 230, 118, 0.5); }
    50% { box-shadow: 0 -4px 0 4px #00e676, 0 0 70px rgba(0, 230, 118, 0.7); }
}

/* v10.3.0: Player board - properly sized based on card grid */
.player-board {
    background: linear-gradient(180deg, var(--board-color) 0%, var(--board-shadow) 100%);
    border-radius: 20px 20px 0 0;
    padding: 14px 16px 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow:
        0 -4px 0 var(--board-shadow),
        0 -2px 16px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: none;
}

/* ========== PLAYER GRID ========== */
/* v10.4.0: Grid uses CSS variables for responsive sizing */
.player-grid {
    display: grid;
    grid-template-columns: repeat(4, min(var(--card-w), var(--card-max-w, 70px)));
    grid-template-rows: repeat(3, min(var(--card-h), var(--card-max-h, 98px)));
    gap: var(--card-gap);
    position: relative;
}

/* Timer Overlay */
.timer-overlay {
    position: absolute;
    inset: -10px;
    pointer-events: none;
    z-index: 10;
    border-radius: 18px;
    opacity: 0;
    transition: opacity 0.3s;
}

.player-area.is-my-turn .timer-overlay,
.skyjo-player-area.is-my-turn .timer-overlay {
    opacity: 1;
}

.timer-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 18px;
    border: 4px solid transparent;
    background: linear-gradient(#00e676, #00e676) padding-box,
                conic-gradient(from 0deg, #00e676 var(--timer-progress, 100%), transparent var(--timer-progress, 100%)) border-box;
    mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: xor;
    animation: timerGlow 1s infinite;
}

@keyframes timerGlow {
    0%, 100% { filter: drop-shadow(0 0 6px rgba(0, 230, 118, 0.6)); }
    50% { filter: drop-shadow(0 0 14px rgba(0, 230, 118, 0.9)); }
}

.player-area.is-my-turn.warning .timer-overlay::before,
.skyjo-player-area.is-my-turn.warning .timer-overlay::before {
    background: linear-gradient(#ff5252, #ff5252) padding-box,
                conic-gradient(from 0deg, #ff5252 var(--timer-progress, 100%), transparent var(--timer-progress, 100%)) border-box;
    animation: timerWarning 0.5s infinite;
}

@keyframes timerWarning {
    0%, 100% { filter: drop-shadow(0 0 8px rgba(255, 82, 82, 0.8)); }
    50% { filter: drop-shadow(0 0 18px rgba(255, 82, 82, 1)); }
}

.player-hint {
    text-align: center;
    font-size: 14px;
    color: white;
    margin-top: 10px;
    min-height: 20px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ========== CARD SLOTS ========== */
/* v10.4.0: Responsive max limits via CSS variables */
.skyjo-slot {
    width: var(--card-w);
    height: var(--card-h);
    max-width: var(--card-max-w, 70px);
    max-height: var(--card-max-h, 98px);
    perspective: 600px;
    cursor: pointer;
    position: relative;
}

.player-grid.my-turn-active .skyjo-slot:not(.removed) {
    animation: myTurnGlow 1.5s infinite;
}

.player-grid.my-turn-active .skyjo-slot:not(.removed)::before {
    content: '';
    position: absolute;
    inset: -3px;
    border: 2px solid rgba(0, 230, 118, 0.5);
    border-radius: calc(var(--card-radius) + 3px);
    pointer-events: none;
    animation: myTurnBorder 1.5s infinite;
    z-index: 1;
}

@keyframes myTurnGlow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.12); }
}

@keyframes myTurnBorder {
    0%, 100% { opacity: 0.4; box-shadow: 0 0 10px rgba(0, 230, 118, 0.3); }
    50% { opacity: 0.8; box-shadow: 0 0 18px rgba(0, 230, 118, 0.5); }
}

.skyjo-slot.selectable {
    animation: cardPulse 1.2s infinite;
}

@keyframes cardPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.skyjo-slot.selectable::after {
    content: '';
    position: absolute;
    inset: -4px;
    border: 3px solid #00e676;
    border-radius: calc(var(--card-radius) + 4px);
    pointer-events: none;
    animation: borderPulse 1.2s infinite;
    box-shadow:
        0 0 15px rgba(0, 230, 118, 0.6),
        inset 0 0 10px rgba(0, 230, 118, 0.3);
}

@keyframes borderPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 15px rgba(0, 230, 118, 0.6); }
    50% { opacity: 0.7; box-shadow: 0 0 25px rgba(0, 230, 118, 0.8); }
}

.skyjo-slot__inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.skyjo-slot.flipped .skyjo-slot__inner {
    transform: rotateY(180deg);
}

.skyjo-slot.removed {
    opacity: 0.2;
    pointer-events: none;
}

/* ========== CARDS ========== */
.skyjo-card {
    position: absolute;
    inset: 0;
    border-radius: var(--card-radius);
    overflow: hidden;
    backface-visibility: hidden;
    box-shadow:
        0 3px 10px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    will-change: transform;
    transform: translateZ(0);
}

.skyjo-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.skyjo-card--face {
    transform: rotateY(180deg);
}

/* ========== TURN BADGE ========== */
.turn-badge {
    display: none !important;
}

.turn-timer {
    width: 34px;
    height: 34px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.1) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.turn-timer.warning {
    background: linear-gradient(145deg, var(--danger) 0%, #d32f2f 100%);
    animation: pulse 0.5s infinite;
    box-shadow:
        0 0 12px rgba(255, 82, 82, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* ========== FLYING CARD ANIMATIONS ========== */
.flying-card {
    position: fixed;
    width: 50px;
    height: 70px;
    z-index: 1000;
    pointer-events: none;
    border-radius: 6px;
    overflow: hidden;
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.4),
        0 0 0 2px rgba(255, 255, 255, 0.2);
}

.flying-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.opponent-held-card {
    position: fixed;
    left: 50%;
    top: 18%;
    transform: translate(-50%, -50%) rotate(-5deg) scale(0.9);
    width: var(--card-w, 54px);
    height: var(--card-h, 75px);
    border-radius: var(--card-radius, 8px);
    overflow: hidden;
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.55),
        0 0 0 3px var(--cheese, #fbbf24),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    opacity: 0;
    pointer-events: none;
    z-index: 100;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.opponent-held-card.visible {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(-5deg) scale(1);
    animation: opponentHeldCardFloat 2s ease-in-out infinite;
}

.opponent-held-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@keyframes opponentHeldCardFloat {
    0%, 100% {
        transform: translate(-50%, -50%) rotate(-5deg) scale(1) translateY(0);
        box-shadow:
            0 10px 30px rgba(0, 0, 0, 0.55),
            0 0 0 3px var(--cheese, #fbbf24);
    }
    50% {
        transform: translate(-50%, -50%) rotate(-5deg) scale(1) translateY(-5px);
        box-shadow:
            0 15px 40px rgba(0, 0, 0, 0.6),
            0 0 0 3px var(--cheese, #fbbf24),
            0 0 25px rgba(251, 191, 36, 0.4);
    }
}

.pile.pile-action .pile__cards {
    animation: pileActionPulse 0.4s ease-out;
    box-shadow:
        0 0 0 3px var(--cheese, #fbbf24),
        0 0 20px rgba(251, 191, 36, 0.5);
}

@keyframes pileActionPulse {
    0% { transform: scale(1); }
    30% { transform: scale(0.92); }
    60% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* ========== OPPONENT ACTION ANIMATIONS ========== */
.pile.pile-receive .pile__cards {
    animation: pileReceiveBounce 0.4s ease-out;
}

@keyframes pileReceiveBounce {
    0% { transform: scale(1); }
    30% { transform: scale(1.1); }
    60% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.skyjo-opponent__card.card-flipping {
    animation: cardFlip3D 0.3s ease-in-out;
    transform-style: preserve-3d;
}

@keyframes cardFlip3D {
    0% { transform: perspective(400px) rotateY(0deg) scale(1); }
    50% { transform: perspective(400px) rotateY(90deg) scale(1.1); }
    100% { transform: perspective(400px) rotateY(0deg) scale(1); }
}

.skyjo-opponent__card.card-revealed-highlight {
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.8);
    animation: revealGlow 0.6s ease-out;
}

@keyframes revealGlow {
    0% {
        box-shadow: 0 0 30px rgba(251, 191, 36, 1);
        transform: scale(1.1);
    }
    100% {
        box-shadow: 0 0 20px rgba(251, 191, 36, 0.8);
        transform: scale(1);
    }
}

.skyjo-opponent__card.card-target-highlight {
    box-shadow: 0 0 15px rgba(0, 230, 118, 0.8);
    animation: targetPulse 0.6s ease-out;
}

@keyframes targetPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(0, 230, 118, 0.6); }
    50% { box-shadow: 0 0 25px rgba(0, 230, 118, 1); }
}

.skyjo-opponent__card.column-removing {
    animation: columnRemoveFade 0.5s ease-out forwards;
}

@keyframes columnRemoveFade {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.9); }
    100% { opacity: 0.2; transform: scale(0.8); }
}

.skyjo-opponent.action-highlight .skyjo-opponent__container {
    animation: opponentActionHighlight 0.6s ease-out;
}

@keyframes opponentActionHighlight {
    0%, 100% {
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
    50% {
        box-shadow: 0 0 30px rgba(0, 230, 118, 0.6), 0 6px 16px rgba(0, 0, 0, 0.2);
    }
}
