/* ═══════════════════════════════════════════════════════════════════
   BATTLE SCREEN - Game Board Layout
   All elements in one flex column, NO position:fixed, NO overflow.
   Everything fits inside 100dvh by design.
   ═══════════════════════════════════════════════════════════════════ */

.battle-screen {
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    touch-action: none;
    background: #0a0a14;
}

/* ── TOP BAR ── */
.battle-top-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 3px var(--spacing-sm);
    background: linear-gradient(180deg, rgba(20, 20, 40, 0.98) 0%, rgba(10, 10, 20, 0.95) 100%);
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
    flex-shrink: 0;
}

.battle-timer {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.battle-timer-icon {
    font-size: 1rem;
}

.battle-timer-display {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--color-gold);
    min-width: 36px;
    text-align: center;
    font-family: var(--font-mono);
}

.battle-timer-display.warning {
    color: #ffaa00;
    text-shadow: 0 0 10px rgba(255, 170, 0, 0.5);
}

.battle-timer-display.danger {
    color: var(--color-danger);
    animation: timer-pulse 0.5s infinite;
    text-shadow: 0 0 15px rgba(255, 68, 68, 0.7);
}

@keyframes timer-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.battle-timer-label {
    font-size: 0.6rem;
    color: var(--color-text-secondary);
    text-transform: uppercase;
}

.battle-turn-indicator {
    padding: 2px 10px;
    border-radius: 10px;
    font-weight: bold;
    font-size: 0.75rem;
}

.battle-turn-indicator.my-turn {
    background: linear-gradient(135deg, var(--color-success) 0%, #00aa00 100%);
    color: #000;
}

.battle-turn-indicator.opponent-turn {
    background: rgba(255, 100, 100, 0.3);
    color: var(--color-text-primary);
}

.battle-turn-indicator.waiting {
    background: rgba(100, 100, 100, 0.3);
    color: var(--color-text-secondary);
}

.battle-match-info {
    font-size: 0.55rem;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.battle-mute-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 2px;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.battle-mute-btn:hover {
    opacity: 1;
}

/* Auto-advance mode - takes over main timer */
.battle-timer.auto-advance-mode {
    border-color: var(--color-cyan);
}

.battle-timer.auto-advance-mode .battle-timer-display {
    color: var(--color-cyan);
}

@keyframes auto-advance-pulse {
    0%, 100% { box-shadow: 0 0 15px rgba(78, 205, 196, 0.4); }
    50% { box-shadow: 0 0 25px rgba(78, 205, 196, 0.7); }
}

.battle-timer-display.auto-advance {
    color: var(--color-cyan);
    animation: none;
}

.battle-timer.auto-advance-mode .battle-timer-label {
    color: var(--color-cyan);
    font-weight: bold;
    font-size: 0.55rem;
}

/* Legacy auto-advance indicator (hidden) */
.battle-auto-advance {
    display: none;
}

.battle-timer-wrapper {
    position: relative;
}

/* Auto-Battle Status */
.battle-auto-status {
    text-align: center;
    padding: 2px var(--spacing-sm);
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.3) 0%, rgba(103, 58, 183, 0.3) 100%);
    border: 1px solid var(--color-purple);
    color: var(--color-purple);
    font-weight: bold;
    font-size: 0.7rem;
    animation: auto-battle-pulse 2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes auto-battle-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.btn-active {
    background: linear-gradient(135deg, var(--color-purple) 0%, #673ab7 100%) !important;
    color: #fff !important;
}

/* ── GAME BOARD ── */
.battle-board {
    flex: 1;
    display: grid;
    grid-template-columns: 170px 1fr 50px;
    min-height: 0;
    overflow: hidden;
}

/* ── SIDE DECORATIONS ── */
.board-deco {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 0;
}

.board-deco-left {
    display: grid;
    grid-template-rows: auto auto auto 1fr;
    gap: 0;
    padding: 4px 0;
    align-items: stretch;
    justify-content: stretch;
    min-height: 0;
    overflow: hidden;
}

/* ── EVENT LOG SIDEBAR (desktop) ── */
.board-log-sidebar {
    overflow-y: auto;
    overflow-x: hidden;
    font-family: var(--font-mono);
    font-size: 0.5rem;
    line-height: 1.3;
    padding: 4px 6px;
    margin: 4px 2px 2px 4px;
    min-height: 0;
    background: rgba(10, 10, 25, 0.6);
    border: 1px solid rgba(255, 215, 0, 0.12);
    border-radius: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 215, 0, 0.2) transparent;
}

.board-log-sidebar::-webkit-scrollbar { width: 3px; }
.board-log-sidebar::-webkit-scrollbar-track { background: transparent; }
.board-log-sidebar::-webkit-scrollbar-thumb { background: rgba(255, 215, 0, 0.25); border-radius: 2px; }

.board-log-sidebar .battle-log-entry {
    padding: 2px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    word-break: break-word;
}

.board-log-sidebar .battle-log-entry.error { color: var(--color-danger); }
.board-log-sidebar .battle-log-entry.success { color: var(--color-success); }
.board-log-sidebar .battle-log-entry.info { color: var(--color-cyan); }
.board-log-sidebar .battle-log-entry.event { color: var(--color-gold); }

.board-deco-line {
    width: 2px;
    flex: 1;
    background: linear-gradient(180deg, transparent 0%, rgba(255, 215, 0, 0.4) 50%, transparent 100%);
}

.board-deco-glow {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.6) 0%, rgba(255, 215, 0, 0.1) 70%, transparent 100%);
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
    transition: box-shadow 0.3s;
}

.board-deco-glow.pulse {
    animation: decoPulse 0.4s ease-out;
}

@keyframes decoPulse {
    0% { box-shadow: 0 0 8px rgba(255, 215, 0, 0.3); transform: scale(1); }
    50% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.8); transform: scale(1.4); }
    100% { box-shadow: 0 0 8px rgba(255, 215, 0, 0.3); transform: scale(1); }
}

/* ── BOARD SURFACE ── */
.board-surface {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    background: linear-gradient(180deg, #0d0d1a 0%, #111128 50%, #0d0d1a 100%);
    border-left: 1px solid rgba(255, 215, 0, 0.15);
    border-right: 1px solid rgba(255, 215, 0, 0.15);
}

/* ── BOARD ZONES ── */
.board-zone {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 2px 6px;
    overflow: hidden;
}

.opponent-zone {
    justify-content: flex-start;
}

.my-zone {
    justify-content: flex-end;
}

/* ── PLAYER BAR (avatar + stats + deck) ── */
.board-player-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
    flex-shrink: 0;
}

/* ── AVATAR ── */
.board-avatar {
    flex-shrink: 0;
    width: 42px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: default;
}

.board-avatar.opponent {
    cursor: pointer;
}

.avatar-figure {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.avatar-figure.opponent {
    background: linear-gradient(135deg, #3a1010 0%, #1a0808 100%);
    border: 2px solid var(--color-danger);
    box-shadow: 0 0 8px rgba(255, 68, 68, 0.3);
}

.avatar-figure.me {
    background: linear-gradient(135deg, #102030 0%, #081018 100%);
    border: 2px solid var(--color-cyan);
    box-shadow: 0 0 8px rgba(78, 205, 196, 0.3);
}

/* CSS silhouette (head + shoulders) */
.avatar-silhouette {
    width: 100%;
    height: 100%;
    position: relative;
}

.avatar-silhouette::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
}

.avatar-silhouette::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 26px;
    height: 12px;
    border-radius: 13px 13px 0 0;
    background: rgba(255, 255, 255, 0.12);
}

/* Avatar pulse when targetable */
.board-avatar.targetable .avatar-figure {
    animation: avatarTargetPulse 1s ease-in-out infinite;
}

@keyframes avatarTargetPulse {
    0%, 100% { box-shadow: 0 0 8px rgba(255, 68, 68, 0.3); }
    50% { box-shadow: 0 0 20px rgba(255, 68, 68, 0.8); }
}

/* Face attack indicator — pulsing border + sword icon */
.board-avatar.opponent.face-attackable {
    position: relative;
    cursor: pointer;
}

.board-avatar.opponent.face-attackable .avatar-figure {
    animation: faceTargetPulse 1s ease-in-out infinite;
}

.board-avatar.opponent.face-attackable::after {
    content: '\2694\FE0F';
    position: absolute;
    top: -6px;
    right: -6px;
    font-size: 0.85rem;
    animation: faceTargetBounce 1s ease-in-out infinite;
    z-index: 2;
    filter: drop-shadow(0 0 3px rgba(255, 50, 50, 0.8));
}

@keyframes faceTargetPulse {
    0%, 100% {
        border-color: var(--color-danger);
        box-shadow: 0 0 8px rgba(255, 68, 68, 0.3);
    }
    50% {
        border-color: #ff2222;
        box-shadow: 0 0 18px rgba(255, 34, 34, 0.8), 0 0 30px rgba(255, 68, 68, 0.3);
    }
}

@keyframes faceTargetBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* HP bar under avatar */
.avatar-hp-bar {
    width: 36px;
    height: 3px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 2px;
    margin-top: 2px;
    overflow: hidden;
}

.avatar-hp-fill {
    height: 100%;
    border-radius: 2px;
    background: #44ff44;
    transition: width 0.4s ease, background-color 0.4s ease;
    width: 100%;
}

/* ── BOARD STATS ── */
.board-stats {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
}

.board-stat {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.board-stat span {
    font-weight: bold;
    color: var(--color-gold);
}

/* ── DECK PILE ── */
.board-deck-pile {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.deck-pile-stack {
    position: relative;
    width: 20px;
    height: 28px;
}

.deck-card {
    position: absolute;
    width: 20px;
    height: 28px;
    background: linear-gradient(135deg, #2a2a4a 0%, #1a1a2e 100%);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 2px;
}

.deck-card:nth-child(1) { top: 0; left: 0; }
.deck-card:nth-child(2) { top: -1px; left: 1px; }
.deck-card:nth-child(3) { top: -2px; left: 2px; }

.deck-pile-count {
    font-size: 0.55rem;
    font-weight: bold;
    color: var(--color-gold);
    margin-top: 1px;
}

/* ── REVEALED HAND ── */
.revealed-label {
    color: #aa66ff;
    font-size: 0.6rem;
    margin-bottom: 2px;
}

#opponentRevealedContainer {
    flex-shrink: 0;
}

#opponentRevealedContainer .board-field-slots {
    justify-content: flex-start;
}

/* ── BOARD FIELD ── */
.board-field {
    flex: 1;
    display: flex;
    align-items: center;
    min-height: 0;
    overflow: hidden;
}

.board-field-slots {
    display: flex;
    flex-wrap: nowrap;
    gap: 3px;
    justify-content: center;
    width: 100%;
}

/* ── FIELD LANES ── */
.board-field-lanes {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: space-evenly;
}

.field-lane {
    display: flex;
    flex-wrap: nowrap;
    gap: 3px;
    justify-content: center;
    align-items: center;
    min-height: 0;
    flex: 0 0 auto;
    position: relative;
}

/* Empty lanes collapse completely */
.field-lane:empty {
    flex: 0;
    min-height: 0;
    padding: 0;
}

/* Subtle lane label */
.field-lane::before {
    content: attr(data-lane-label);
    position: absolute;
    left: 2px;
    font-size: 0.3rem;
    color: rgba(255, 255, 255, 0.12);
    text-transform: uppercase;
    pointer-events: none;
}
.field-lane:empty::before { display: none; }

/* ── TX ZONE ── */
.tx-zone {
    position: relative;
    width: 32px;
    height: 14px;
}

.tx-zone.active {
    box-shadow: 0 0 12px rgba(68, 255, 170, 0.6);
    border-radius: 4px;
}

/* ── BOARD DIVIDER ── */
.board-divider {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 1px 6px;
    flex-shrink: 0;
}

.board-divider-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 215, 0, 0.4) 50%, transparent 100%);
}

.board-divider-emblem {
    font-size: 0.75rem;
    opacity: 0.5;
    line-height: 1;
}

/* ── HAND TRAY ── */
.battle-hand-tray {
    flex-shrink: 0;
    padding: 2px 8px;
    background: linear-gradient(180deg, rgba(15, 15, 30, 0.95) 0%, rgba(10, 10, 20, 0.98) 100%);
    border-top: 1px solid rgba(255, 215, 0, 0.15);
}

.hand-tray-cards {
    display: flex;
    gap: 4px;
    justify-content: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 1px 0;
}

.hand-tray-cards::-webkit-scrollbar {
    display: none;
}

/* ── BATTLE CARD ── */
.battle-card {
    position: relative;
    overflow: hidden;
    border: 2px solid #555;
    border-radius: var(--radius-sm);
    width: 76px;
    min-width: 76px;
    aspect-ratio: 3 / 4;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    background: linear-gradient(135deg, #2a2a4a 0%, #0d0d1a 100%);
}

.battle-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-gold);
}

.battle-card.selected {
    border-color: var(--color-success) !important;
    box-shadow: 0 0 15px rgba(68, 255, 68, 0.6) !important;
}

/* Rarity frames (primary visual) */
.battle-card.rarity-common  { border-color: #666; }
.battle-card.rarity-rare    { border-color: #4a9eff; box-shadow: 0 0 6px rgba(74, 158, 255, 0.35); }
.battle-card.rarity-epic    { border-color: #a855f7; box-shadow: 0 0 8px rgba(168, 85, 247, 0.4); }
.battle-card.rarity-legendary { border-color: #ffd700; }

/* Role fallback (used when no rarity class) */
.battle-card.attacker { border-color: var(--color-attacker); }
.battle-card.defender { border-color: var(--color-defender); }
.battle-card.hybrid   { border-color: var(--color-hybrid); }
.battle-card.no-art   { background: linear-gradient(135deg, #2a2a4a 0%, #0d0d1a 100%); }

/* Art fills card — contain shows full square images without cropping */
.battle-card-bg-art {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center top;
    display: block;
    background: #0d0d1a;
}

/* Cost badge — top right */
.battle-card-cost {
    position: absolute;
    top: 3px;
    right: 3px;
    background: var(--color-gold);
    color: #000;
    border-radius: var(--radius-round);
    width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    font-weight: bold;
    font-size: 0.55rem;
    z-index: 2;
    box-shadow: 0 1px 3px rgba(0,0,0,0.7);
}

/* Bottom overlay with name + stats */
.battle-card-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.6) 60%, transparent 100%);
    padding: 3px 3px 2px;
    z-index: 2;
}

/* Role color indicator line at top of footer */
.battle-card-footer::before {
    content: '';
    display: block;
    height: 2px;
    margin-bottom: 1px;
    border-radius: 1px;
}
.battle-card.attacker .battle-card-footer::before { background: var(--color-attacker); }
.battle-card.defender .battle-card-footer::before { background: var(--color-defender); }
.battle-card.hybrid   .battle-card-footer::before { background: var(--color-hybrid); }

.battle-card-name {
    font-size: 0.45rem;
    font-weight: bold;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px rgba(0,0,0,1);
    line-height: 1.3;
}

.battle-card-stats {
    font-size: 0.48rem;
    color: rgba(255,255,255,0.9);
    display: flex;
    justify-content: space-between;
    text-shadow: 0 1px 2px rgba(0,0,0,1);
    line-height: 1.3;
}

/* Hand cards slightly smaller */
.hand-tray-cards .battle-card {
    width: 68px;
    min-width: 68px;
}

/* ── ACTION BUTTONS ── */
.battle-actions {
    display: flex;
    gap: 3px;
    padding: 3px 8px;
    background: rgba(10, 10, 20, 0.98);
    border-top: 1px solid rgba(255, 215, 0, 0.1);
    flex-shrink: 0;
}

.battle-actions .btn {
    flex: 1;
    font-size: 0.65rem;
    padding: 5px 2px;
    min-width: 0;
}

/* ── BATTLE LOG (legacy, now in sidebar) ── */
.battle-log-entry {
    padding: 1px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.battle-log-entry.error { color: var(--color-danger); }
.battle-log-entry.success { color: var(--color-success); }
.battle-log-entry.info { color: var(--color-cyan); }
.battle-log-entry.event { color: var(--color-gold); }

/* Match Info (in top bar) */
.battle-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.55rem;
    color: var(--color-text-muted);
}

/* Card Tooltip */
.card-tooltip {
    position: fixed;
    background: rgba(20, 20, 40, 0.98);
    border: 2px solid var(--color-gold);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm);
    width: 180px;
    z-index: 1500;
    pointer-events: none;
    box-shadow: var(--shadow-lg);
}

.card-tooltip-name {
    color: var(--color-gold);
    font-weight: bold;
    font-size: 0.75rem;
    margin-bottom: var(--spacing-xs);
}

.card-tooltip-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-sm);
}

.card-tooltip-ability {
    background: rgba(156, 39, 176, 0.2);
    border-left: 3px solid var(--color-purple);
    padding: var(--spacing-xs);
    border-radius: var(--radius-xs);
}

.card-tooltip-trigger {
    color: var(--color-gold);
    font-size: 0.55rem;
    font-weight: bold;
    margin-bottom: 2px;
}

.card-tooltip-text {
    color: var(--color-text-secondary);
    font-size: 0.6rem;
    line-height: 1.4;
}

.card-tooltip-combo {
    margin-top: var(--spacing-xs);
    background: rgba(255, 215, 0, 0.1);
    border-left: 3px solid var(--color-gold);
    padding: var(--spacing-xs);
    border-radius: var(--radius-xs);
}

.card-tooltip-combo-header {
    color: var(--color-gold);
    font-size: 0.55rem;
    font-weight: bold;
    margin-bottom: 2px;
}

.card-tooltip-combo-line {
    color: var(--color-text-secondary);
    font-size: 0.55rem;
    line-height: 1.3;
}

.card-tooltip-combo-line strong {
    color: #fff;
}

.card-tooltip-combo-effect {
    color: rgba(255, 215, 0, 0.7);
    font-size: 0.5rem;
    font-style: italic;
    padding-left: 8px;
}

/* Game End Modal */
.battle-end-modal {
    text-align: center;
}

.battle-end-modal.victory h2 { color: var(--color-success); }
.battle-end-modal.defeat h2 { color: var(--color-danger); }

.battle-end-stats {
    margin: var(--spacing-lg) 0;
}

.battle-end-stat {
    padding: var(--spacing-sm);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
}

/* ═══════════════════════════════════════════════════════════════════
   MOBILE BATTLE LAYOUT (<768px)
   No position:fixed — everything stays in flex flow to fit 100dvh.
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
    .battle-board {
        grid-template-columns: 1fr;
    }

    .board-deco {
        display: none;
    }

    .battle-top-bar {
        padding: 2px var(--spacing-xs);
    }

    .battle-timer-display {
        font-size: 1.1rem;
        min-width: 28px;
    }

    .battle-timer-icon {
        font-size: 0.8rem;
    }

    .battle-turn-indicator {
        font-size: 0.6rem;
        padding: 1px 6px;
    }

    .battle-match-info {
        display: none;
    }

    .board-surface {
        border-left: none;
        border-right: none;
    }

    .board-zone {
        padding: 1px 4px;
    }

    .board-player-bar {
        gap: 4px;
        padding: 1px 0;
    }

    /* Smaller cards for mobile — use clamp for responsive sizing */
    .battle-card {
        width: clamp(42px, 12vw, 55px);
        min-width: clamp(42px, 12vw, 55px);
        aspect-ratio: 3 / 4;
        padding: 2px;
    }

    .battle-card-cost {
        width: 12px;
        height: 12px;
        line-height: 12px;
        font-size: 0.45rem;
        margin-bottom: 1px;
    }

    .battle-card-name {
        font-size: 0.38rem;
    }

    .battle-card-stats {
        font-size: 0.4rem;
    }

    .hand-tray-cards .battle-card {
        width: clamp(48px, 14vw, 60px);
        min-width: clamp(48px, 14vw, 60px);
    }

    .hand-tray-cards {
        justify-content: flex-start;
    }

    .battle-hand-tray {
        padding: 1px 4px;
    }

    /* Smaller avatar on mobile */
    .avatar-figure {
        width: 28px;
        height: 28px;
    }

    .avatar-hp-bar {
        width: 28px;
        height: 2px;
        margin-top: 1px;
    }

    .board-avatar {
        width: 34px;
    }

    .board-stat {
        font-size: 0.6rem;
        padding: 1px 3px;
        gap: 2px;
    }

    .board-stats {
        gap: 4px;
    }

    .deck-pile-stack {
        width: 16px;
        height: 22px;
    }

    .deck-card {
        width: 16px;
        height: 22px;
    }

    .deck-pile-count {
        font-size: 0.5rem;
    }

    /* Actions in flow — NOT fixed */
    .battle-actions {
        padding: 2px 4px;
        gap: 2px;
    }

    .battle-actions .btn {
        font-size: 0.55rem;
        padding: 4px 1px;
    }

    /* Hide event log on mobile */
    .battle-log {
        display: none;
    }

    .battle-auto-status {
        padding: 1px var(--spacing-xs);
        font-size: 0.6rem;
    }

    .board-divider {
        padding: 0 4px;
    }

    .board-divider-emblem {
        font-size: 0.6rem;
    }

    /* ── MOBILE: Flatten lanes into single row ── */
    .board-field-lanes {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: center;
        align-items: center;
        gap: 3px;
    }

    .field-lane {
        display: contents;
    }

    .field-lane::before {
        display: none !important;
    }

    /* Status badges overlay card bottom — prevent height growth */
    .board-field-lanes .status-effects {
        position: absolute;
        bottom: 1px;
        left: 1px;
        right: 1px;
    }

    .board-field-lanes .battle-card {
        position: relative;
    }

    /* Status badges → colored dots on mobile field cards */
    .board-field-lanes .status-badge {
        font-size: 0;
        width: 6px;
        height: 6px;
        border-radius: 50%;
        padding: 0;
        display: inline-block;
        line-height: 6px;
        min-width: 6px;
    }
    .board-field-lanes .status-badge.freeze  { background: #66ccff; }
    .board-field-lanes .status-badge.shield  { background: #ffffff; }
    .board-field-lanes .status-badge.buff    { background: #44ff44; }
    .board-field-lanes .status-badge.debuff  { background: #ff4444; }
    .board-field-lanes .status-badge.stealth { background: #aa66ff; }

    /* Gas cost → tiny corner badge on mobile field cards */
    .board-field-lanes .battle-card-cost {
        position: absolute;
        top: -4px;
        right: -4px;
        width: 11px;
        height: 11px;
        line-height: 11px;
        font-size: 0.4rem;
        margin: 0;
        z-index: 1;
    }
}

/* Very small screens (<380px) — ultra compact */
@media (max-width: 380px) {
    .battle-card {
        width: 40px;
        min-width: 40px;
    }

    .hand-tray-cards .battle-card {
        width: 44px;
        min-width: 44px;
    }

    .battle-card-cost {
        width: 11px;
        height: 11px;
        line-height: 11px;
        font-size: 0.4rem;
    }

    .board-stat {
        font-size: 0.5rem;
    }

    .battle-actions .btn {
        font-size: 0.5rem;
        padding: 3px 1px;
    }

    .avatar-figure {
        width: 24px;
        height: 24px;
    }

    .avatar-hp-bar {
        width: 24px;
    }

    .board-avatar {
        width: 28px;
    }
}

/* Desktop: fullscreen battle */
@media (min-width: 768px) {
    .battle-screen {
        max-width: 100%;
        margin: 0;
    }

    .battle-board {
        grid-template-columns: 220px 1fr 60px;
    }

    /* Hand tray: width-based (you're choosing cards — bigger = clearer art) */
    .hand-tray-cards .battle-card {
        width: clamp(80px, 7vw, 100px);
        min-width: clamp(80px, 7vw, 100px);
    }

    /* Field cards: height-based so 3 full lanes (3 per side × 2 sides) always fit */
    .board-field-lanes .battle-card {
        height: clamp(65px, 8vh, 90px);
        width: auto;
        min-width: 0;
    }
}

/* Large desktop: bigger hand cards, field cards stay viewport-proportional */
@media (min-width: 1200px) {
    .hand-tray-cards .battle-card {
        width: clamp(90px, 7vw, 110px);
        min-width: clamp(90px, 7vw, 110px);
    }

    .board-field-lanes .battle-card {
        height: clamp(70px, 9vh, 100px);
    }
}

/* Ultra-wide desktop */
@media (min-width: 1440px) {
    .battle-board {
        grid-template-columns: 260px 1fr 80px;
    }
}

/* Cap at very large viewports */
@media (min-width: 1920px) {
    .hand-tray-cards .battle-card {
        width: 120px;
        min-width: 120px;
    }

    .board-field-lanes .battle-card {
        height: 105px;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   MOBILE EVENT LOG — Toggle button + slide-up panel
   ═══════════════════════════════════════════════════════════════════ */

/* Desktop: hidden */
.mobile-log-toggle, .mobile-log-panel { display: none; }

@media (max-width: 767px) {
    .mobile-log-toggle {
        display: flex;
        position: fixed;
        top: 50%;
        right: 4px;
        transform: translateY(-50%);
        width: 26px;
        height: 26px;
        border-radius: 50%;
        background: rgba(20, 20, 40, 0.85);
        border: 1px solid rgba(255, 215, 0, 0.25);
        align-items: center;
        justify-content: center;
        font-size: 0.65rem;
        z-index: 100;
        cursor: pointer;
        opacity: 0.6;
    }
    .mobile-log-panel {
        position: fixed;
        bottom: 0; left: 0; right: 0;
        height: 50vh;
        background: rgba(10, 10, 25, 0.95);
        border-top: 2px solid rgba(255, 215, 0, 0.3);
        z-index: 200;
        flex-direction: column;
    }
    .mobile-log-panel.open { display: flex; }
    .mobile-log-header {
        display: flex; justify-content: space-between;
        padding: 8px 12px;
        border-bottom: 1px solid rgba(255, 215, 0, 0.15);
        color: var(--color-gold); font-size: 0.7rem;
    }
    .mobile-log-close { background: none; border: none; color: var(--color-text-muted); font-size: 1rem; cursor: pointer; }
    .mobile-log-content {
        flex: 1; overflow-y: auto;
        padding: 6px 10px;
        font-family: var(--font-mono); font-size: 0.5rem;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   SIMULATION OVERLAY - Both players have Auto-Battle
   ═══════════════════════════════════════════════════════════════════ */

.simulation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: sim-fade-in 0.3s ease;
}

@keyframes sim-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.simulation-content {
    text-align: center;
    padding: var(--spacing-xl);
}

.simulation-icon {
    font-size: 4rem;
    animation: sim-pulse 1s ease-in-out infinite;
    margin-bottom: var(--spacing-md);
}

@keyframes sim-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

.simulation-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--color-gold);
    margin-bottom: var(--spacing-sm);
}

.simulation-text {
    font-size: 1rem;
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-lg);
}

.simulation-spinner {
    font-size: 0.9rem;
    color: var(--color-cyan);
    animation: sim-dots 1.5s ease-in-out infinite;
}

@keyframes sim-dots {
    0%, 20% { content: 'Simulating match.'; }
    40% { content: 'Simulating match..'; }
    60%, 100% { content: 'Simulating match...'; }
}

/* ═══════════════════════════════════════════════════════════════════
   QUEST REWARDS POPUP
   ═══════════════════════════════════════════════════════════════════ */

.quest-rewards-popup {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9000;
    animation: quest-popup-slide 0.4s ease-out;
}

@keyframes quest-popup-slide {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.quest-rewards-popup.fade-out {
    animation: quest-popup-fade 0.5s ease-out forwards;
}

@keyframes quest-popup-fade {
    to {
        opacity: 0;
        transform: translateX(50px);
    }
}

.quest-rewards-content {
    background: linear-gradient(135deg, rgba(30, 30, 50, 0.98) 0%, rgba(20, 20, 40, 0.98) 100%);
    border: 2px solid var(--color-gold);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    min-width: 250px;
    max-width: 320px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 215, 0, 0.2);
}

.quest-rewards-header {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--color-gold);
    margin-bottom: var(--spacing-sm);
    text-align: center;
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
}

.quest-reward-item {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.quest-reward-item:last-child {
    border-bottom: none;
}

.quest-reward-item .reward-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.quest-reward-item .reward-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.quest-reward-item .reward-text strong {
    color: var(--color-text-primary);
    font-size: 0.9rem;
}

.quest-reward-item .reward-text span {
    color: var(--color-text-muted);
    font-size: 0.8rem;
}

/* Streak bonus - special styling */
.quest-reward-item.streak-bonus {
    background: linear-gradient(90deg, rgba(255, 100, 0, 0.1) 0%, transparent 100%);
    border-radius: var(--radius-sm);
    padding: var(--spacing-sm);
    margin: var(--spacing-xs) 0;
}

.quest-reward-item.streak-bonus .reward-text strong {
    color: var(--color-gold);
}

.reward-badge {
    display: inline-block;
    background: var(--color-gold);
    color: #000;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: bold;
    margin-top: 4px;
}

.reward-title {
    color: var(--color-purple) !important;
    font-weight: bold;
}

/* Quest complete styling */
.quest-reward-item.quest-complete .reward-text strong {
    color: var(--color-success);
}

/* Season points styling */
.quest-reward-item.season-points .reward-text strong {
    color: var(--color-purple);
}

/* Ladder points styling */
.quest-reward-item.ladder-points {
    opacity: 0.8;
}

/* Mobile adjustments for quest popup */
@media (max-width: 480px) {
    .quest-rewards-popup {
        top: 60px;
        right: 8px;
        left: auto;
        max-width: 200px;
    }

    .quest-rewards-content {
        padding: var(--spacing-sm);
        min-width: auto;
        max-width: 200px;
    }

    .quest-rewards-header {
        font-size: 0.85rem;
        padding-bottom: var(--spacing-xs);
        margin-bottom: var(--spacing-xs);
    }

    .quest-reward-item {
        padding: var(--spacing-xs) 0;
        gap: var(--spacing-xs);
    }

    .quest-reward-item .reward-icon {
        font-size: 1rem;
    }

    .quest-reward-item .reward-text strong {
        font-size: 0.7rem;
    }

    .quest-reward-item .reward-text span {
        font-size: 0.6rem;
    }

    .reward-badge {
        font-size: 0.55rem;
        padding: 1px 5px;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   TRANSACTION CARD STYLES
   ═══════════════════════════════════════════════════════════════════ */

/* Transaction cards in hand — teal border/glow */
.battle-card.transaction {
    border: 2px solid #44ffaa;
    background: linear-gradient(135deg, #1a3a2a 0%, #0d1f1a 100%);
    box-shadow: 0 0 8px rgba(68, 255, 170, 0.3);
}

.battle-card.transaction:hover {
    box-shadow: 0 0 15px rgba(68, 255, 170, 0.6);
}

.battle-card-tx-text {
    font-size: 0.4rem;
    color: #44ffaa;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.2;
}

/* Transaction executed overlay animation */
.tx-cast-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: txFadeIn 0.3s ease-out;
    pointer-events: none;
}

.tx-cast-content {
    text-align: center;
    animation: txPulse 0.8s ease-in-out;
}

.tx-cast-name {
    font-size: 2rem;
    font-weight: bold;
    color: #44ffaa;
    text-shadow: 0 0 20px rgba(68, 255, 170, 0.8), 0 0 40px rgba(68, 255, 170, 0.4);
    margin-bottom: 8px;
}

.tx-cast-effect {
    font-size: 1rem;
    color: #aaffdd;
    text-shadow: 0 0 10px rgba(68, 255, 170, 0.5);
    max-width: 400px;
}

.tx-cast-fade-out {
    animation: txFadeOut 0.5s ease-in forwards;
}

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

@keyframes txPulse {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

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

/* Transaction targeting highlight — cards glow teal when selectable as target */
.battle-card.tx-target-highlight {
    border-color: #44ffaa !important;
    box-shadow: 0 0 12px rgba(68, 255, 170, 0.7) !important;
    animation: txTargetPulse 1s ease-in-out infinite;
}

@keyframes txTargetPulse {
    0%, 100% { box-shadow: 0 0 8px rgba(68, 255, 170, 0.5); }
    50% { box-shadow: 0 0 18px rgba(68, 255, 170, 0.9); }
}

/* Drawn card highlight during discard choice */
.battle-card.drawn-card-highlight {
    border-color: #ffdd44 !important;
    box-shadow: 0 0 14px rgba(255, 221, 68, 0.8) !important;
    animation: drawnCardPulse 1s ease-in-out infinite;
    position: relative;
}

.battle-card.drawn-card-highlight::after {
    content: 'NEW';
    position: absolute;
    top: -6px;
    right: -4px;
    background: #ffdd44;
    color: #000;
    font-size: 0.55rem;
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 3px;
    z-index: 2;
    letter-spacing: 0.5px;
}

@keyframes drawnCardPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 221, 68, 0.6); }
    50% { box-shadow: 0 0 20px rgba(255, 221, 68, 1); }
}

/* ═══════════════════════════════════════════════════════════
   STATUS EFFECTS — Visual indicators on battle cards
   ═══════════════════════════════════════════════════════════ */

/* Status badge container — sits below card stats */
.status-effects {
    display: flex;
    gap: 2px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 2px;
}

/* Individual status badge */
.status-badge {
    font-size: 0.55rem;
    padding: 0 2px;
    border-radius: 3px;
    line-height: 1.2;
    background: rgba(0, 0, 0, 0.5);
}

.status-badge.freeze { color: #66ccff; border: 1px solid #66ccff44; }
.status-badge.shield { color: #ffffff; border: 1px solid #ffffff44; }
.status-badge.buff   { color: #44ff44; border: 1px solid #44ff4444; }
.status-badge.debuff { color: #ff4444; border: 1px solid #ff444444; }
.status-badge.stealth { color: #aa66ff; border: 1px solid #aa66ff44; }

/* Frozen card — blue tint overlay + pulse */
.battle-card.frozen {
    border-color: #66ccff !important;
    box-shadow: 0 0 8px rgba(102, 204, 255, 0.5), inset 0 0 15px rgba(102, 204, 255, 0.15);
    animation: frozenPulse 2s ease-in-out infinite;
}

@keyframes frozenPulse {
    0%, 100% { box-shadow: 0 0 6px rgba(102, 204, 255, 0.4), inset 0 0 12px rgba(102, 204, 255, 0.1); }
    50% { box-shadow: 0 0 12px rgba(102, 204, 255, 0.7), inset 0 0 20px rgba(102, 204, 255, 0.2); }
}

/* ═══════════════════════════════════════════════════════════
   COMBO SYSTEM — Visual indicators for combo cards
   ═══════════════════════════════════════════════════════════ */

/* Combo badge in card name */
.combo-badge {
    color: var(--color-gold);
    font-size: 0.5rem;
}

/* Active combo — both partners on field, gold glow */
.battle-card.combo-active {
    border-color: var(--color-gold) !important;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.5), inset 0 0 10px rgba(255, 215, 0, 0.1);
    animation: comboPulse 2s ease-in-out infinite;
}

@keyframes comboPulse {
    0%, 100% { box-shadow: 0 0 6px rgba(255, 215, 0, 0.4), inset 0 0 8px rgba(255, 215, 0, 0.08); }
    50% { box-shadow: 0 0 14px rgba(255, 215, 0, 0.7), inset 0 0 15px rgba(255, 215, 0, 0.15); }
}

/* Combo activation overlay banner */
.combo-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: comboFadeIn 0.3s ease-out;
    pointer-events: none;
}

.combo-overlay-content {
    text-align: center;
    animation: comboBurst 0.8s ease-in-out;
}

.combo-overlay-icon {
    font-size: 3rem;
    margin-bottom: 4px;
}

.combo-overlay-name {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--color-gold);
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 40px rgba(255, 215, 0, 0.4);
    margin-bottom: 8px;
}

.combo-overlay-effect {
    font-size: 0.9rem;
    color: #ffe680;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    max-width: 400px;
}

.combo-overlay-fade-out {
    animation: comboFadeOut 0.5s ease-in forwards;
}

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

@keyframes comboBurst {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

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

/* ═══════════════════════════════════════════════════════════════════
   BITCONNEEECT! Overlay — Carlos Matos (#111)
   ═══════════════════════════════════════════════════════════════════ */

.bitconnect-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    background: rgba(180, 0, 0, 0.6);
    animation: bitconnectFlash 0.3s ease-in-out 3;
    pointer-events: none;
}

.bitconnect-overlay-content {
    text-align: center;
    animation: bitconnectBurst 0.6s ease-out;
}

.bitconnect-text-hey {
    font-size: 2.5rem;
    font-weight: bold;
    color: #ff0;
    text-shadow: 0 0 20px #ff0, 0 0 40px #f80, 2px 2px 0 #000;
    animation: bitconnectShake 0.15s infinite;
}

.bitconnect-text-wassa {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ff4444;
    text-shadow: 0 0 10px #f00, 2px 2px 0 #000;
    margin-top: 4px;
}

.bitconnect-text-bitconnect {
    font-size: 3rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 30px #ff0, 0 0 60px #f80, 3px 3px 0 #000;
    margin-top: 8px;
    letter-spacing: 4px;
    animation: bitconnectPulse 0.4s ease-in-out infinite;
}

.bitconnect-text-effect {
    font-size: 1rem;
    color: #ffe680;
    margin-top: 8px;
}

.bitconnect-overlay-fade-out {
    animation: comboFadeOut 0.5s ease-in forwards;
}

@keyframes bitconnectFlash {
    0%, 100% { background: rgba(255, 0, 0, 0.15); }
    50% { background: rgba(255, 0, 0, 0.35); }
}

@keyframes bitconnectBurst {
    0% { transform: scale(0.3) rotate(-5deg); opacity: 0; }
    60% { transform: scale(1.2) rotate(3deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes bitconnectShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

@keyframes bitconnectPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

/* Unplayable cards — not enough gas to play */
.battle-card.unplayable {
    opacity: 0.45;
    filter: grayscale(40%);
}
.battle-card.unplayable .battle-card-cost {
    color: #ff4444;
    text-shadow: 0 0 6px rgba(255, 68, 68, 0.6);
}

/* ═══════════════════════════════════════════════════════════
   REVEALED HAND — Opponent cards visible via Smart Money etc
   ═══════════════════════════════════════════════════════════ */

.revealed-label {
    color: #aa66ff;
}

.battle-card.revealed-card {
    border: 2px solid #aa66ff;
    opacity: 0.85;
    box-shadow: 0 0 6px rgba(170, 102, 255, 0.4);
    cursor: default;
}

.battle-card.revealed-card:hover {
    transform: none;
    box-shadow: 0 0 8px rgba(170, 102, 255, 0.5);
}

/* ═══════════════════════════════════════════════════════════════════
   BATTLE ANIMATIONS - Attack lunge, damage numbers, death effects
   ═══════════════════════════════════════════════════════════════════ */

.battle-animation-layer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 500;
    overflow: hidden;
}

/* Attack lunge — card moves toward target then snaps back */
@keyframes animLunge {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(var(--lunge-x), var(--lunge-y)) scale(1.1); }
    100% { transform: translate(0, 0) scale(1); }
}

/* Impact flash at target */
.anim-impact {
    background: radial-gradient(circle, rgba(255, 200, 50, 0.9) 0%, rgba(255, 100, 0, 0.6) 40%, transparent 70%);
    border-radius: 50%;
    animation: animImpactScale 250ms ease-out forwards;
}

@keyframes animImpactScale {
    0% { transform: scale(0.3); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* Floating damage number */
.anim-damage-number {
    font-size: 1.4rem;
    font-weight: bold;
    color: #ff4444;
    text-shadow: 0 0 8px rgba(255, 0, 0, 0.8), 2px 2px 0 #000;
    font-family: var(--font-mono);
    transform: translateX(-50%);
    animation: animDamageFloat 600ms ease-out forwards;
}

/* Face damage — larger */
.anim-damage-number.face-damage {
    font-size: 2rem;
    color: #ff2222;
    text-shadow: 0 0 12px rgba(255, 0, 0, 1), 3px 3px 0 #000;
}

@keyframes animDamageFloat {
    0% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.2); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-40px) scale(0.8); }
}

/* Blocked damage (smaller, offset right) */
.anim-blocked-number {
    font-size: 0.85rem;
    font-weight: bold;
    color: #aaaaff;
    text-shadow: 1px 1px 0 #000;
    font-family: var(--font-mono);
    animation: animDamageFloat 600ms ease-out forwards;
}

/* Red flash overlay on hit card */
.anim-red-flash {
    background: rgba(255, 0, 0, 0.4);
    animation: animRedFlash 200ms ease-out forwards;
}

@keyframes animRedFlash {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* Green glow flash for buff/aura effects */
.anim-buff-glow {
    background: rgba(0, 255, 100, 0.35);
    animation: animBuffGlow 600ms ease-out forwards;
}

@keyframes animBuffGlow {
    0% { opacity: 0; }
    20% { opacity: 1; }
    100% { opacity: 0; }
}

/* Floating buff number (green, floats up) */
.anim-buff-number {
    font-size: 1.2rem;
    font-weight: bold;
    color: #44ff88;
    text-shadow: 0 0 6px rgba(0, 255, 100, 0.8), 0 1px 2px rgba(0, 0, 0, 0.8);
    transform: translateX(-50%);
    animation: animBuffFloat 800ms ease-out forwards;
    white-space: nowrap;
}

@keyframes animBuffFloat {
    0% { opacity: 0; transform: translateX(-50%) translateY(0); }
    20% { opacity: 1; }
    100% { opacity: 0; transform: translateX(-50%) translateY(-30px); }
}

/* Card death — shrink + rotate + desaturate */
.anim-death-card {
    animation: animDeath 400ms ease-in forwards;
    background: linear-gradient(135deg, #2a2a4a 0%, var(--color-bg-primary, #1a1a2e) 100%);
    border: 2px solid #555;
    border-radius: var(--radius-sm, 6px);
}

@keyframes animDeath {
    0% { opacity: 1; transform: scale(1) rotate(0deg); filter: grayscale(0); }
    100% { opacity: 0; transform: scale(0.3) rotate(-8deg); filter: grayscale(1); }
}

/* Death scatter particles */
.anim-particle {
    width: 4px;
    height: 4px;
    background: #ff6644;
    border-radius: 50%;
    animation: animParticle 400ms ease-out forwards;
}

@keyframes animParticle {
    0% { opacity: 1; transform: translate(0, 0); }
    100% { opacity: 0; transform: translate(var(--px), var(--py)); }
}

/* Card play — flying clone from hand to field */
.anim-play-clone {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3) 0%, rgba(42, 42, 74, 0.8) 100%);
    border: 2px solid var(--color-gold, #ffd700);
    border-radius: var(--radius-sm, 6px);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

/* Target highlight — pulsing red glow on attacked card/face */
.anim-target-highlight {
    border: 2px solid #ff4444;
    animation: animTargetHighlight 500ms ease-out forwards;
}

@keyframes animTargetHighlight {
    0% { opacity: 0; box-shadow: 0 0 5px rgba(255, 68, 68, 0.3); }
    25% { opacity: 1; box-shadow: 0 0 20px rgba(255, 68, 68, 0.9), inset 0 0 12px rgba(255, 68, 68, 0.3); }
    100% { opacity: 0; box-shadow: 0 0 5px rgba(255, 68, 68, 0.1); }
}

/* Opponent transaction overlay — orange/red instead of teal */
.tx-cast-overlay.opponent .tx-cast-name {
    color: #ff6644;
    text-shadow: 0 0 20px rgba(255, 102, 68, 0.8), 0 0 40px rgba(255, 102, 68, 0.4);
}

.tx-cast-overlay.opponent .tx-cast-effect {
    color: #ffaa88;
    text-shadow: 0 0 10px rgba(255, 102, 68, 0.5);
}

.tx-cast-label {
    font-size: 0.85rem;
    color: #ff8866;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 4px;
}

/* TX beam animation — energy bolt from TX zone to avatar */
.anim-tx-beam {
    position: fixed;
    height: 3px;
    background: linear-gradient(90deg, transparent 0%, #44ffaa 30%, #44ffaa 70%, transparent 100%);
    box-shadow: 0 0 8px rgba(68, 255, 170, 0.8), 0 0 16px rgba(68, 255, 170, 0.4);
    border-radius: 2px;
    pointer-events: none;
    z-index: 502;
    transform-origin: left center;
}

.anim-tx-beam.opponent {
    background: linear-gradient(90deg, transparent 0%, #ff6644 30%, #ff6644 70%, transparent 100%);
    box-shadow: 0 0 8px rgba(255, 102, 68, 0.8), 0 0 16px rgba(255, 102, 68, 0.4);
}

/* TX impact flash on avatar */
.anim-tx-impact {
    position: fixed;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(68, 255, 170, 0.9) 0%, rgba(68, 255, 170, 0.4) 40%, transparent 70%);
    pointer-events: none;
    z-index: 502;
    animation: animTxImpact 300ms ease-out forwards;
}

.anim-tx-impact.opponent {
    background: radial-gradient(circle, rgba(255, 102, 68, 0.9) 0%, rgba(255, 102, 68, 0.4) 40%, transparent 70%);
}

@keyframes animTxImpact {
    0% { transform: scale(0.3); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* Mobile adjustments for animations */
@media (max-width: 767px) {
    .anim-damage-number {
        font-size: 1.1rem;
    }
    .anim-damage-number.face-damage {
        font-size: 1.5rem;
    }
    .anim-blocked-number {
        font-size: 0.7rem;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   CARD TEST EXHIBITION OVERLAY
   ═══════════════════════════════════════════════════════════════════ */

.card-test-overlay {
    position: fixed;
    top: 0;
    right: 0;
    width: 340px;
    height: 100vh;
    z-index: 600;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    flex-direction: column;
    border-left: 2px solid #44ffaa;
    font-size: 0.8rem;
    color: #ccc;
}

.card-test-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(68, 255, 170, 0.3);
    flex-shrink: 0;
}

.card-test-overlay .batch-info {
    color: #44ffaa;
    font-weight: 600;
    font-size: 0.75rem;
}

.card-test-overlay button {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

.card-test-overlay .btn-pause {
    background: #f0a030;
    color: #000;
}

.card-test-overlay .btn-stop {
    background: #ff4444;
    color: #fff;
}

.card-test-overlay.paused {
    border-left-color: #f0a030;
}

.card-test-overlay.paused .batch-info::after {
    content: ' (PAUSED)';
    color: #f0a030;
}

/* Log panel */
.card-test-log {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    font-family: monospace;
    font-size: 0.65rem;
    line-height: 1.5;
}

.card-test-log-line {
    padding: 1px 4px;
    border-radius: 2px;
    word-break: break-word;
}

.card-test-log-line.log-turn-header {
    color: #44ffaa;
    font-weight: bold;
    margin-top: 6px;
    padding-top: 4px;
    border-top: 1px solid rgba(68, 255, 170, 0.2);
}

.card-test-log-line.log-combat {
    color: #ffd93d;
}

.card-test-log-line.log-death {
    color: #ff6b6b;
}

.card-test-log-line.log-ability {
    color: #a78bfa;
}

.card-test-log-line.log-winner {
    color: #44ffaa;
    font-weight: bold;
    font-size: 0.75rem;
    margin-top: 4px;
}

.card-test-log-line.log-life {
    color: #ff9999;
}

.card-test-log-line.log-fatigue {
    color: #ff8844;
}

.card-test-log-line.log-game-separator {
    color: #44ffaa;
    font-weight: bold;
    font-size: 0.75rem;
    text-align: center;
    margin: 10px 0 6px;
    padding: 4px 0;
    border-top: 2px solid #44ffaa;
    border-bottom: 1px solid rgba(68, 255, 170, 0.3);
}

@media (max-width: 767px) {
    .card-test-overlay {
        width: 100%;
        height: 35vh;
        top: auto;
        bottom: 0;
        border-left: none;
        border-top: 2px solid #44ffaa;
    }
    .card-test-header {
        padding: 6px 8px;
    }
    .card-test-overlay button {
        padding: 3px 8px;
        font-size: 0.6rem;
    }
    .card-test-log {
        font-size: 0.6rem;
    }
}
