.duel-ai-mode[hidden], #aiDuelStatus[hidden], #btnContinueAi[hidden] { display: none !important; }
#aiDuelStatus { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; padding: .75rem 1rem; }
#aiDuelStatusText { flex: 1 1 16rem; }
.duel-ai-mode select { width: 100%; }
@media (max-width: 760px) { #aiDuelStatus button { flex: 1 1 auto; } }

/* =====================
   Layout del duelo contra IA.
   La barra de estado ocupa una fila propia dentro de #gameBoard y el tablero queda en
   minmax(0, 1fr), igual que el banner del modo espectador, para no desbordar ni recortar
   la mano del jugador. Sin la clase ai-duel-active (Local/Online) estas reglas no aplican.
   ===================== */
/* Solo escritorio (más de 1200 px), donde el duelo ocupa exactamente 100vh sin scroll.
   En pantallas angostas la página ya hace scroll y se conserva el layout original. */
@media (min-width: 1201px) {
    body.ai-duel-active.duel-playing #gameBoard.game-board {
        display: grid;
        grid-template-rows: auto minmax(0, 1fr);
        gap: clamp(6px, .6vw, 10px);
        min-height: 0;
        min-width: 0;
        overflow: hidden;
    }

    body.ai-duel-active.duel-playing #aiDuelStatus {
        margin: 0;
        min-width: 0;
        padding: .35rem .8rem;
        gap: .5rem;
        font-size: .88rem;
    }

    body.ai-duel-active.duel-playing #aiDuelStatus button {
        padding: .3rem .7rem;
        font-size: .82rem;
    }

    body.ai-duel-active.duel-playing #gameBoard .board-layout {
        height: 100%;
        min-height: 0;
        min-width: 0;
    }

    body.ai-duel-active.duel-playing #gameBoard .board-main,
    body.ai-duel-active.duel-playing #gameBoard .right-dock {
        min-height: 0;
        min-width: 0;
    }
}

/* =====================
   Cinta de acciones de la IA: no bloquea el tablero (pointer-events: none),
   queda bajo modales y toasts, y se retira sola.
   ===================== */
/* Escritorio: borde derecho del tablero, junto al panel de acciones; los campos alinean
   sus cartas a la izquierda, así que esa franja suele estar libre. */
.ai-action-feed {
    position: fixed;
    right: calc(clamp(320px, 23vw, 382px) + clamp(22px, 2vw, 34px));
    top: 30vh;
    z-index: 90;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    width: min(300px, 22vw);
    pointer-events: none;
}

.ai-action-entry {
    border: 1px solid rgba(244, 199, 106, .38);
    border-left: 4px solid rgba(244, 199, 106, .85);
    border-radius: 10px;
    padding: 7px 10px;
    background: rgba(6, 12, 26, .88);
    color: #eaf4ff;
    font-size: .86rem;
    font-weight: 700;
    line-height: 1.3;
    box-shadow: 0 10px 26px rgba(0, 0, 0, .35);
    animation: ai-action-entry-in .28s ease-out;
    transition: opacity .38s ease, transform .38s ease;
    max-width: 100%;
}

.ai-action-entry.is-leaving { opacity: 0; transform: translateX(12px); }
.ai-action-entry.kind-attack { border-left-color: #f87171; }
.ai-action-entry.kind-block { border-left-color: #60a5fa; }
.ai-action-entry.kind-support { border-left-color: #34d399; }
.ai-action-entry.kind-ability,
.ai-action-entry.kind-decision { border-left-color: #c084fc; }
.ai-action-entry.kind-turn,
.ai-action-entry.kind-phase,
.ai-action-entry.kind-summary { border-left-color: rgba(148, 163, 184, .9); font-weight: 600; }

@keyframes ai-action-entry-in {
    from { opacity: 0; transform: translateX(14px); }
    to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 1200px) {
    /* El panel de acciones pasa bajo el tablero: la cinta usa el borde derecho de la pantalla. */
    .ai-action-feed { right: 12px; width: min(300px, 40vw); }
}

@media (max-width: 980px) {
    .ai-action-feed {
        top: 8px;
        left: 8px;
        right: 8px;
        width: auto;
        align-items: stretch;
    }
    .ai-action-entry { font-size: .8rem; padding: 6px 9px; }
    .ai-action-entry:nth-last-child(n + 4) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .ai-action-entry { animation: none; transition: none; }
}

/* =====================
   Ritmo del turno de la IA: aviso de cambio de turno (no bloquea el tablero).
   ===================== */
.ai-turn-banner {
    position: fixed;
    left: 50%;
    top: 18vh;
    z-index: 95;
    padding: 12px 34px;
    border: 1px solid rgba(244, 199, 106, .55);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(14, 24, 44, .94), rgba(6, 12, 26, .94));
    color: #f6e3b0;
    font-size: clamp(1.05rem, 2.2vw, 1.5rem);
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    box-shadow: 0 14px 40px rgba(0, 0, 0, .45), 0 0 24px rgba(244, 199, 106, .18);
    opacity: 0;
    transform: translate(-50%, -10px) scale(.96);
    pointer-events: none;
    transition: opacity .28s ease, transform .28s ease;
}
.ai-turn-banner.is-bot { border-color: rgba(230, 120, 96, .6); color: #ffd9cc; box-shadow: 0 14px 40px rgba(0, 0, 0, .45), 0 0 24px rgba(230, 120, 96, .2); }
.ai-turn-banner.is-visible { opacity: 1; transform: translate(-50%, 0) scale(1); }
/* Mientras la IA juega, la mano propia se ve en espera (las acciones igual se rechazan si se intentan). */
body.ai-bot-acting #aiDuelStatusText { color: #ffd9cc; }
@media (max-width: 640px) { .ai-turn-banner { top: 12vh; padding: 10px 22px; } }
@media (prefers-reduced-motion: reduce) { .ai-turn-banner { transition: none; } }
