/* ═══════════════════════════════════════════════════════════════════
   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:
        radial-gradient(ellipse at 50% 50%, rgba(30, 30, 70, 0.6) 0%, rgba(8, 8, 20, 0.95) 70%),
        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);
    /* Subtle grid overlay */
    background-image:
        radial-gradient(ellipse at 50% 50%, rgba(30, 30, 70, 0.5) 0%, rgba(8, 8, 20, 0.95) 70%),
        linear-gradient(rgba(255, 215, 0, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 215, 0, 0.02) 1px, transparent 1px);
    background-size: 100% 100%, 40px 40px, 40px 40px;
}

/* ── 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: visible;
}

.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) — improved placeholder */
.avatar-silhouette {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 2px;
}

/* Head */
.avatar-silhouette::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 6px rgba(255,255,255,0.1);
}

/* Shoulders */
.avatar-silhouette::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 14px;
    border-radius: 14px 14px 0 0;
    background: rgba(255, 255, 255, 0.14);
}

/* Opponent: red tint */
.avatar-figure.opponent .avatar-silhouette::before { background: rgba(255, 100, 100, 0.3); }
.avatar-figure.opponent .avatar-silhouette::after  { background: rgba(255, 100, 100, 0.2); }

/* Me: blue tint */
.avatar-figure.me .avatar-silhouette::before { background: rgba(78, 205, 196, 0.3); }
.avatar-figure.me .avatar-silhouette::after  { background: rgba(78, 205, 196, 0.2); }

/* ── Avatar profile image ── */
.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

/* ── Avatar frame overlay ── */
.avatar-frame {
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    pointer-events: none;
}

.avatar-frame.frame_gold {
    border: 3px solid #FFD700;
    box-shadow: 0 0 8px #FFD700, inset 0 0 4px rgba(255, 215, 0, 0.3);
}

.avatar-frame.frame_diamond {
    border: 3px solid #b9f2ff;
    box-shadow: 0 0 12px #b9f2ff, inset 0 0 6px rgba(185, 242, 255, 0.3);
}

.avatar-frame.frame_neon {
    border: 3px solid #44ffaa;
    box-shadow: 0 0 10px #44ffaa, inset 0 0 5px rgba(68, 255, 170, 0.3);
}

.avatar-frame.frame_fire {
    border: 3px solid #ff6600;
    box-shadow: 0 0 12px #ff4400;
    animation: frameFire 1s ease-in-out infinite alternate;
}

@keyframes frameFire {
    from { box-shadow: 0 0 8px #ff6600, 0 0 16px #ff2200; border-color: #ff6600; }
    to   { box-shadow: 0 0 16px #ffaa00, 0 0 28px #ff6600; border-color: #ffcc00; }
}

.avatar-frame.frame_season1_top10 {
    border: 3px solid transparent;
    background: linear-gradient(135deg, #c0c0c0, #e8e8e8, #c0c0c0) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: destination-out;
    mask-composite: exclude;
    box-shadow: 0 0 10px rgba(192, 192, 192, 0.6);
}

.avatar-frame.frame_season1_champion {
    border: 3px solid transparent;
    background: linear-gradient(135deg, #FFD700, #FFA500, #FFD700) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: destination-out;
    mask-composite: exclude;
    box-shadow: 0 0 14px rgba(255, 215, 0, 0.8);
    animation: championPulse 2s ease-in-out infinite;
}

@keyframes championPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.6); }
    50% { box-shadow: 0 0 20px rgba(255, 215, 0, 1), 0 0 30px rgba(255, 165, 0, 0.5); }
}

.avatar-frame.frame_koth_legend {
    border: 3px solid #9b59b6;
    box-shadow: 0 0 10px #9b59b6, inset 0 0 6px rgba(155, 89, 182, 0.3);
}

.avatar-frame.frame_whale {
    border: 3px solid #00d4ff;
    box-shadow: 0 0 12px #00d4ff, inset 0 0 6px rgba(0, 212, 255, 0.3);
}

/* 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); }
}

@keyframes faceHeroGlow {
    0%, 100% {
        background: radial-gradient(circle at 50% 80%, rgba(255, 68, 68, 0.3) 0%, transparent 70%);
    }
    50% {
        background: radial-gradient(circle at 50% 80%, rgba(255, 34, 34, 0.65) 0%, rgba(255, 68, 68, 0.15) 60%, transparent 80%);
    }
}

/* 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-hero-badge {
    font-size: 1.1rem;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    padding: 2px 6px;
    cursor: default;
    flex-shrink: 0;
}

.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;
    gap: 3px;
}

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

/* Card back — each stacked card */
.deck-card {
    position: absolute;
    width: 28px;
    height: 38px;
    border-radius: 3px;
    border: 1px solid rgba(255, 215, 0, 0.4);
    overflow: hidden;
}

/* Card back gradient + diagonal cross pattern */
.deck-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(135deg, #1a1a3e 0%, #0d0d24 50%, #1a1a3e 100%);
}

.deck-card::after {
    content: '';
    position: absolute;
    inset: 2px;
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 2px;
    background-image:
        repeating-linear-gradient(
            45deg,
            rgba(255, 215, 0, 0.04) 0px,
            rgba(255, 215, 0, 0.04) 1px,
            transparent 1px,
            transparent 6px
        );
}

.deck-card:nth-child(1) { top: 0;    left: 0;  box-shadow: 1px 1px 3px rgba(0,0,0,0.6); }
.deck-card:nth-child(2) { top: -2px; left: 2px; }
.deck-card:nth-child(3) { top: -4px; left: 4px; }

.deck-pile-count {
    font-size: 0.6rem;
    font-weight: bold;
    color: var(--color-gold);
    background: rgba(0, 0, 0, 0.5);
    padding: 1px 4px;
    border-radius: 3px;
    border: 1px solid rgba(255, 215, 0, 0.2);
    min-width: 20px;
    text-align: center;
}

/* ── 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: show a placeholder slot area */
.field-lane:empty {
    flex: 0 0 30px;
    min-height: 30px;
    padding: 0 4px;
    border: 1px dashed rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    margin: 1px 0;
}

/* Lane label */
.field-lane::before {
    content: attr(data-lane-label);
    position: absolute;
    left: 4px;
    font-size: 0.45rem;
    font-weight: bold;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.18);
    text-transform: uppercase;
    pointer-events: none;
}

/* Empty lane placeholder text */
.field-lane:empty::before {
    display: flex;
    content: attr(data-lane-label);
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 0.5rem;
    color: rgba(255, 255, 255, 0.1);
    left: 0;
    text-align: center;
}

/* ── FIELD TX SLOT (left column inside board-field-lanes) ── */
.field-tx-slot {
    display: none; /* hidden on mobile */
}

.field-tx-label {
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: rgba(68, 255, 170, 0.25);
    text-align: center;
    pointer-events: none;
}

.field-tx-slot.active .field-tx-label {
    display: none;
}

.field-tx-slot.active {
    border-color: rgba(68, 255, 170, 0.8);
    box-shadow: 0 0 20px rgba(68, 255, 170, 0.4), inset 0 0 14px rgba(68, 255, 170, 0.08);
}

/* TX card sitting in the slot */
.tx-zone-card {
    position: absolute;
    inset: 3px;
    border-radius: 4px;
    background: linear-gradient(135deg, #0a1a14 0%, #0d2020 50%, #0a1a14 100%);
    border: 1.5px solid #44ffaa;
    box-shadow: 0 0 12px rgba(68, 255, 170, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 4px 3px;
    overflow: hidden;
    animation: txCardIn 0.3s ease-out;
}
.tx-zone-card-img {
    width: 100%;
    flex: 1;
    object-fit: cover;
    border-radius: 2px;
    min-height: 0;
}
.tx-zone-card-name {
    font-size: 6px;
    color: #44ffaa;
    text-align: center;
    font-weight: 700;
    line-height: 1.2;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tx-zone-card-effect {
    font-size: 5px;
    color: rgba(68, 255, 170, 0.7);
    text-align: center;
    line-height: 1.3;
    width: 100%;
}
/* Circuit board pattern overlay */
.tx-zone-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(68,255,170,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(68,255,170,0.04) 1px, transparent 1px);
    background-size: 6px 6px;
    pointer-events: none;
    border-radius: 4px;
}
.tx-zone-card.fade-out {
    animation: txCardOut 0.5s ease-in forwards;
}

@keyframes txCardIn {
    from { opacity: 0; transform: scale(0.6) translateY(-10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes txCardOut {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(0.4) translateY(10px); }
}

/* ── TRANSACTION CARD HAND STYLE ── */
/* Circuit-board pattern overlay on TX card */
.battle-card.transaction .battle-card-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(68,255,170,0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(68,255,170,0.06) 1px, transparent 1px);
    background-size: 8px 8px;
    pointer-events: none;
}
@keyframes txHandPulse {
    0%, 100% { box-shadow: 0 0 6px rgba(68,255,170,0.4), 0 0 12px rgba(68,255,170,0.2); }
    50%       { box-shadow: 0 0 12px rgba(68,255,170,0.8), 0 0 24px rgba(68,255,170,0.4); }
}

/* ── 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;
}

/* ── BOTTOM WRAPPER (Hand + Actions) ── */
.battle-bottom {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

/* Preview panel hidden on mobile */
.hand-tray-preview {
    display: none;
}

/* ── 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 BATTLE LAYOUT (≥768px) — Gwent-inspired full-board design
   ═══════════════════════════════════════════════════════════════════ */
@media (min-width: 768px) {
    .battle-screen {
        max-width: 100%;
        margin: 0;
    }

    /* ── BOARD GRID ── */
    .battle-board {
        grid-template-columns: 200px 1fr 50px;
    }

    /* Right deco is redundant — hide it */
    .board-deco-right {
        display: none;
    }

    /* ── BOARD SURFACE — zone coloring ── */
    .board-surface {
        position: relative;
    }

    /* ── BOARD ZONES ── */
    .board-zone {
        padding: 0;
        overflow: visible;
        display: flex;
        flex-direction: column;
    }

    .opponent-zone {
        background: linear-gradient(180deg, rgba(40, 5, 5, 0.25) 0%, transparent 100%);
        border-bottom: 1px solid rgba(255, 60, 60, 0.1);
    }

    .my-zone {
        background: linear-gradient(0deg, rgba(5, 20, 35, 0.3) 0%, transparent 100%);
        border-top: 1px solid rgba(78, 205, 196, 0.1);
    }

    /* ── PLAYER BAR — full-width prominent strip ── */
    .board-player-bar {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 6px 14px;
        margin: 0;
        border-radius: 0;
        flex-shrink: 0;
        width: 100%;
    }

    .board-player-bar.opponent {
        background: linear-gradient(90deg, rgba(60, 5, 5, 0.5) 0%, rgba(20, 5, 5, 0.3) 60%, transparent 100%);
        border-bottom: 1px solid rgba(255, 60, 60, 0.18);
    }

    .board-player-bar.me {
        background: linear-gradient(90deg, rgba(5, 30, 50, 0.5) 0%, rgba(5, 20, 35, 0.3) 60%, transparent 100%);
        border-top: 1px solid rgba(78, 205, 196, 0.18);
    }

    /* ── FIELD TX SLOT — absolute left of each zone's field area ── */
    .field-tx-slot {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        position: absolute;
        left: 8px;
        top: 50%;
        transform: translateY(-50%);
        width: clamp(62px, 5.5vw, 82px);
        height: clamp(87px, 7.7vw, 115px);  /* card proportions ~1:1.4 */
        border: 1.5px dashed rgba(68, 255, 170, 0.22);
        border-radius: 6px;
        z-index: 5;
        transition: border-color 0.3s, box-shadow 0.3s;
        background: rgba(4, 14, 10, 0.7);
    }

    /* TX card fills the slot */
    .field-tx-slot .tx-zone-card {
        position: absolute;
        inset: 4px;
    }

    /* ── AVATAR — bigger ── */
    .avatar-figure {
        width: 46px;
        height: 46px;
    }

    .avatar-hp-bar {
        width: 46px;
        height: 5px;
        margin-top: 3px;
    }

    .board-avatar {
        width: 52px;
    }

    /* ── STATS — more readable ── */
    .board-stat {
        font-size: 0.82rem;
        padding: 3px 9px;
        gap: 4px;
    }

    .board-stats {
        gap: 6px;
    }

    /* ── DECK PILE — bigger, more visible ── */
    .deck-pile-stack {
        width: 36px;
        height: 50px;
    }

    .deck-card {
        width: 36px;
        height: 50px;
        border-radius: 4px;
    }

    .deck-pile-count {
        font-size: 0.7rem;
        padding: 2px 6px;
    }

    /* ── BOARD/ZONE OVERFLOW — allow cards to be fully visible ── */
    .board-surface {
        overflow: visible;
    }

    /* ── FIELD LANES — visible horizontal bands ── */
    .board-field-lanes {
        flex: 1;
        gap: 3px;
        padding: 3px 8px 3px clamp(78px, 7vw, 100px);  /* left padding reserves TX slot space */
        overflow: visible;
        position: relative;
    }

    .field-lane {
        flex: 1;
        min-height: clamp(88px, 10.5vh, 122px);  /* match card height */
        border-radius: 4px;
        padding: 3px 8px;
        background: rgba(255, 255, 255, 0.015);
        border: 1px solid rgba(255, 255, 255, 0.05);
        position: relative;
        overflow: visible;
    }

    .field-lane:empty {
        flex: 1;
        min-height: clamp(88px, 10.5vh, 122px);
        border: 1px dashed rgba(255, 255, 255, 0.07);
        background: rgba(255, 255, 255, 0.01);
        padding: 0;
    }

    /* Lane label: centered left */
    .field-lane::before {
        content: attr(data-lane-label);
        position: absolute;
        left: 7px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 0.5rem;
        font-weight: 700;
        letter-spacing: 0.1em;
        color: rgba(255, 255, 255, 0.15);
        pointer-events: none;
    }

    .opponent-zone .lane-front, .my-zone .lane-front { border-color: rgba(255, 80, 80, 0.1); }
    .opponent-zone .lane-mid,   .my-zone .lane-mid   { border-color: rgba(255, 200, 80, 0.08); }
    .opponent-zone .lane-back,  .my-zone .lane-back  { border-color: rgba(80, 140, 255, 0.1); }

    /* ── FIELD CARDS ── */
    .board-field-lanes .battle-card {
        height: clamp(85px, 10vh, 118px);
        width: auto;
        min-width: 0;
    }

    /* ── BOTTOM AREA: Hand + Preview + Actions side by side ── */
    .battle-bottom {
        flex-direction: row;
        align-items: stretch;
        overflow: visible;          /* allow fan cards to lift upward */
        background: rgba(8, 8, 18, 0.97);
        border-top: 1px solid rgba(255, 215, 0, 0.18);
    }

    /* ── HAND FAN ── */
    .battle-hand-tray {
        flex: 1;
        min-width: 0;
        padding: 0;
        border-top: none;
        height: 220px;
        overflow: visible;  /* allow cards to lift above tray */
    }

    .hand-tray-cards {
        position: relative;    /* anchor for absolute-positioned fan cards */
        width: 100%;
        height: 100%;
        overflow: visible;
    }

    /* Fan card base — JS sets position/transform, CSS handles transitions */
    .hand-tray-cards .battle-card {
        position: absolute;
        bottom: 16px;
        width: clamp(85px, 7vw, 105px);
        min-width: clamp(85px, 7vw, 105px);
        transform-origin: 50% 50%;
        transition:
            transform 0.2s cubic-bezier(0.34, 1.4, 0.64, 1),
            box-shadow 0.15s ease;
        cursor: pointer;
    }

    /* Selected: green glow shadow — transform set by JS */
    .hand-tray-cards .battle-card.selected {
        box-shadow:
            0 22px 50px rgba(0, 0, 0, 0.9),
            0 0 24px rgba(68, 255, 68, 0.4) !important;
        z-index: 100 !important;
    }

    /* ── CARD PREVIEW PANEL ── */
    .hand-tray-preview {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        width: 160px;
        flex-shrink: 0;
        padding: 10px 10px 20px;
        border-left: 1px solid rgba(255, 215, 0, 0.08);
        background: rgba(5, 5, 15, 0.6);
        overflow: hidden;
        justify-content: flex-end;
    }

    .hand-tray-preview .preview-hint {
        font-size: 0.55rem;
        color: rgba(255, 255, 255, 0.15);
        text-align: center;
        font-style: italic;
        margin: auto;
    }

    .hand-tray-preview .preview-card {
        width: 86px;
        min-width: 86px;
        aspect-ratio: 3 / 4;
        pointer-events: none;
        flex-shrink: 0;
        animation: previewCardIn 0.18s cubic-bezier(0.34, 1.4, 0.64, 1);
    }

    @keyframes previewCardIn {
        from { opacity: 0; transform: translateY(10px) scale(0.88); }
        to   { opacity: 1; transform: translateY(0)   scale(1); }
    }

    .preview-ability {
        font-size: 0.58rem;
        color: var(--color-cyan);
        background: rgba(78, 205, 196, 0.07);
        border-left: 2px solid rgba(78, 205, 196, 0.4);
        padding: 5px 8px;
        border-radius: 0 4px 4px 0;
        line-height: 1.5;
        width: 100%;
        display: -webkit-box;
        -webkit-line-clamp: 5;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .preview-lore {
        font-size: 0.48rem;
        color: rgba(255, 255, 255, 0.25);
        font-style: italic;
        line-height: 1.4;
        text-align: center;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* ── ACTIONS COLUMN ── */
    .battle-actions {
        flex-direction: column;
        border-top: none;
        border-left: 1px solid rgba(255, 215, 0, 0.1);
        background: rgba(6, 6, 16, 0.98);
        padding: 8px 8px;
        gap: 5px;
        min-width: 115px;
        justify-content: center;
    }

    .battle-actions .btn {
        flex: 0 0 auto;
        font-size: 0.72rem;
        padding: 7px 8px;
        width: 100%;
        text-align: center;
        white-space: nowrap;
    }
}

/* Large desktop */
@media (min-width: 1200px) {
    .battle-board {
        grid-template-columns: 220px 1fr 0px;
    }

    .hand-tray-cards .battle-card {
        width: clamp(90px, 7vw, 115px);
        min-width: clamp(90px, 7vw, 115px);
    }

    .board-field-lanes .battle-card {
        height: clamp(95px, 11vh, 130px);
    }

    .battle-actions {
        min-width: 130px;
    }
}

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

/* Very large */
@media (min-width: 1920px) {
    .hand-tray-cards .battle-card {
        width: 125px;
        min-width: 125px;
    }

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



/* ═══════════════════════════════════════════════════════════════════
   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 + pulse */
.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);
    animation: txHandPulse 2s ease-in-out infinite;
}

.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);
}

/* Opponent card entrance — gold flash when opponent card appears on field */
.anim-card-entrance {
    background: rgba(255, 215, 0, 0.15);
    border: 2px solid rgba(255, 215, 0, 0.7);
    animation: animCardEntrance 500ms ease-out forwards;
}

@keyframes animCardEntrance {
    0%   { opacity: 0; transform: scale(0.85); box-shadow: 0 0 20px rgba(255, 215, 0, 0.9); }
    25%  { opacity: 1; transform: scale(1.05); box-shadow: 0 0 30px rgba(255, 215, 0, 0.6); }
    100% { opacity: 0; transform: scale(1);    box-shadow: none; }
}

/* 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;
    }
}

/* ═══════════════════════════════════════════════════════════
   TRAP CARDS — Amber/Orange color scheme
   ═══════════════════════════════════════════════════════════ */

/* Trap card in hand — amber border, slightly darker background */
.battle-card.trap-card {
    border: 2px solid #f59e0b !important;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
    background: linear-gradient(135deg, #1a1000 0%, #2d1f00 100%);
}

.battle-card.trap-card:hover {
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.7);
}

/* Face-down trap on the field (opponent's — no info revealed) */
/* Opponent face-down trap — card-back image, no interaction */
.battle-card.trap-facedown {
    background: #1a0f00;
    border: 2px solid #f59e0b;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.5);
    cursor: default;
    pointer-events: none;
    overflow: hidden;
}

.battle-card.trap-facedown .trap-facedown-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
}

/* Own trap on field: full card visible + amber glow + SET overlay */
.battle-card.trap-card {
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

/* SET overlay: small badge bottom-center so player knows it's face-down to opponent */
.trap-set-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(245, 158, 11, 0.85);
    color: #000;
    font-size: 8px;
    font-weight: bold;
    text-align: center;
    padding: 2px 0;
    letter-spacing: 1px;
    border-radius: 0 0 5px 5px;
    z-index: 20;
    pointer-events: none;
}

/* TRAP type badge (shown in card header, same style as tx badge) */
.trap-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #f59e0b;
    color: #000;
    font-size: 9px;
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 3px;
    z-index: 10;
}


/* TRAP triggered overlay — appears on top of the triggering card briefly */
.trap-trigger-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(245, 158, 11, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    color: #000;
    border-radius: 6px;
    z-index: 100;
    animation: trapFlash 1.5s ease-out forwards;
    pointer-events: none;
}

@keyframes trapFlash {
    0%   { opacity: 0; transform: scale(0.5); }
    20%  { opacity: 1; transform: scale(1.1); }
    70%  { opacity: 1; transform: scale(1);   }
    100% { opacity: 0; transform: scale(1);   }
}

/* Flip animation for when a trap reveals itself */
.trap-flip-animation {
    animation: trapFlip 0.4s ease-in-out;
}

@keyframes trapFlip {
    0%   { transform: rotateY(0deg);  }
    50%  { transform: rotateY(90deg); }
    100% { transform: rotateY(0deg);  }
}

/* Full-screen TRAP! cast overlay (mirrors tx-cast-overlay style) */
.trap-cast-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: 9000;
    pointer-events: none;
    animation: txPulse 0.8s ease-in-out;
}

.trap-cast-content {
    text-align: center;
}

.trap-cast-exclaim {
    font-size: 3rem;
    font-weight: bold;
    color: #f59e0b;
    text-shadow: 0 0 20px rgba(245, 158, 11, 0.8), 0 0 40px rgba(245, 158, 11, 0.4);
    letter-spacing: 4px;
    margin-bottom: 8px;
}

.trap-cast-name {
    font-size: 2rem;
    font-weight: bold;
    color: #fcd34d;
    text-shadow: 0 0 20px rgba(252, 211, 77, 0.8);
    margin-bottom: 8px;
}

.trap-cast-effect {
    font-size: 1rem;
    color: #fde68a;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.trap-cast-label {
    font-size: 0.85rem;
    color: #fb923c;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

/* Trap card in Collection / Deck builder */
.collection-card.trap-type,
.deck-card-mini.trap-type {
    border-color: #f59e0b;
}

/* Trap type tag in card detail modal */
.trap-type-tag {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
    border: 1px solid #f59e0b;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* Trap badge in detail modal header */
.tx-badge-detail.trap-badge-detail {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
    border: 1px solid #f59e0b;
}

/* ═══════════════════════════════════════════════════════
   HERO PORTRAIT PANEL
═══════════════════════════════════════════════════════ */

/* Hide player-bar portrait on desktop — field figure replaces it */
@media (min-width: 1000px) {
    .board-hero-portrait { display: none !important; }
}

.board-hero-portrait {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: default;
    position: relative;
}

.hero-portrait-frame {
    width: 44px;
    height: 56px;
    border-radius: 6px;
    border: 2px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.5);
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.hero-portrait-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    inset: 0;
}

.hero-portrait-emoji {
    font-size: 1.6rem;
    z-index: 1;
    pointer-events: none;
}

/* Hide emoji when image loads */
.hero-portrait-img:not([src=""]) + .hero-portrait-emoji {
    display: none;
}

.hero-portrait-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    border-radius: 6px;
    z-index: 2;
}

.hero-portrait-name {
    font-size: 0.58rem;
    color: rgba(255,255,255,0.5);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    text-align: center;
    white-space: nowrap;
}

/* ── Per-hero color glows ─────────────────────────────── */

.board-hero-portrait[data-hero="hero_miner"] .hero-portrait-frame {
    border-color: #FFD700;
    box-shadow: 0 0 10px rgba(255,215,0,0.5), inset 0 0 8px rgba(255,215,0,0.1);
}
.board-hero-portrait[data-hero="hero_miner"] .hero-portrait-name { color: #FFD700; }

.board-hero-portrait[data-hero="hero_validator"] .hero-portrait-frame {
    border-color: #4ECDC4;
    box-shadow: 0 0 10px rgba(78,205,196,0.5), inset 0 0 8px rgba(78,205,196,0.1);
}
.board-hero-portrait[data-hero="hero_validator"] .hero-portrait-name { color: #4ECDC4; }

.board-hero-portrait[data-hero="hero_degen"] .hero-portrait-frame {
    border-color: #44FF44;
    box-shadow: 0 0 10px rgba(68,255,68,0.5), inset 0 0 8px rgba(68,255,68,0.1);
}
.board-hero-portrait[data-hero="hero_degen"] .hero-portrait-name { color: #44FF44; }

.board-hero-portrait[data-hero="hero_whale"] .hero-portrait-frame {
    border-color: #006994;
    box-shadow: 0 0 10px rgba(0,105,148,0.7), inset 0 0 8px rgba(0,105,148,0.2);
}
.board-hero-portrait[data-hero="hero_whale"] .hero-portrait-name { color: #4ab8e0; }

.board-hero-portrait[data-hero="hero_builder"] .hero-portrait-frame {
    border-color: #44ffaa;
    box-shadow: 0 0 10px rgba(68,255,170,0.5), inset 0 0 8px rgba(68,255,170,0.1);
}
.board-hero-portrait[data-hero="hero_builder"] .hero-portrait-name { color: #44ffaa; }

.board-hero-portrait[data-hero="hero_hacker"] .hero-portrait-frame {
    border-color: #FF3333;
    box-shadow: 0 0 10px rgba(255,51,51,0.5), inset 0 0 8px rgba(255,51,51,0.1);
}
.board-hero-portrait[data-hero="hero_hacker"] .hero-portrait-name { color: #FF3333; }

.board-hero-portrait[data-hero="hero_oracle"] .hero-portrait-frame {
    border-color: #9B59B6;
    box-shadow: 0 0 10px rgba(155,89,182,0.6), inset 0 0 8px rgba(155,89,182,0.15);
}
.board-hero-portrait[data-hero="hero_oracle"] .hero-portrait-name { color: #c39bd3; }

.board-hero-portrait[data-hero="hero_nomad"] .hero-portrait-frame {
    border-color: #00FFFF;
    box-shadow: 0 0 10px rgba(0,255,255,0.4), inset 0 0 8px rgba(0,255,255,0.1);
}
.board-hero-portrait[data-hero="hero_nomad"] .hero-portrait-name { color: #00FFFF; }

.board-hero-portrait[data-hero="hero_collector"] .hero-portrait-frame {
    border-color: #FF69B4;
    box-shadow: 0 0 10px rgba(255,105,180,0.5), inset 0 0 8px rgba(255,105,180,0.1);
}
.board-hero-portrait[data-hero="hero_collector"] .hero-portrait-name { color: #FF69B4; }

.board-hero-portrait[data-hero="hero_maximalist"] .hero-portrait-frame {
    border-color: #F7931A;
    box-shadow: 0 0 10px rgba(247,147,26,0.6), inset 0 0 8px rgba(247,147,26,0.15);
}
.board-hero-portrait[data-hero="hero_maximalist"] .hero-portrait-name { color: #F7931A; }

/* ── Passive fire animation ──────────────────────────── */

@keyframes heroPassiveFire {
    0%   { transform: scale(1);   filter: brightness(1); }
    30%  { transform: scale(1.12); filter: brightness(1.8); }
    60%  { transform: scale(1.05); filter: brightness(1.3); }
    100% { transform: scale(1);   filter: brightness(1); }
}

.board-hero-portrait.hero-passive-fire .hero-portrait-frame {
    animation: heroPassiveFire 0.6s ease-out;
}

/* ── Particle keyframes ──────────────────────────────── */

/* Miner — gold sparks rising */
@keyframes minerSpark {
    0%   { transform: translateY(0) translateX(0) scale(1); opacity: 0.9; }
    100% { transform: translateY(-52px) translateX(var(--dx, 0px)) scale(0); opacity: 0; }
}

/* Validator — teal rings expanding */
@keyframes validatorRing {
    0%   { transform: scale(0.2); opacity: 0.7; }
    100% { transform: scale(1.6); opacity: 0; }
}

/* Whale — bubbles rising */
@keyframes whaleBubble {
    0%   { transform: translateY(0) scale(1); opacity: 0.6; }
    100% { transform: translateY(-54px) scale(0.3); opacity: 0; }
}

/* Builder — grid pulse */
@keyframes builderPulse {
    0%   { opacity: 0; transform: scaleX(1); }
    50%  { opacity: 0.5; }
    100% { opacity: 0; transform: scaleX(1.4); }
}

/* Oracle — star orbit */
@keyframes oracleStar {
    0%   { transform: rotate(0deg) translateX(18px) scale(1); opacity: 0.8; }
    100% { transform: rotate(360deg) translateX(18px) scale(0.2); opacity: 0; }
}

/* Nomad — portal ring */
@keyframes nomadPortal {
    0%   { transform: scale(0.1) rotate(0deg); opacity: 0.8; border-radius: 50%; }
    70%  { opacity: 0.4; }
    100% { transform: scale(1.8) rotate(180deg); opacity: 0; border-radius: 50%; }
}

/* Collector — card float */
@keyframes collectorCard {
    0%   { transform: translateY(0) rotate(var(--rot, 0deg)); opacity: 0.7; }
    100% { transform: translateY(-50px) rotate(var(--rot2, 20deg)); opacity: 0; }
}

/* Hacker — code rain */
@keyframes hackerRain {
    0%   { transform: translateY(-10px); opacity: 0.8; }
    100% { transform: translateY(58px);  opacity: 0; }
}

/* Maximalist — lightning */
@keyframes maxFlash {
    0%   { opacity: 0; }
    10%  { opacity: 1; }
    20%  { opacity: 0; }
    30%  { opacity: 0.7; }
    40%  { opacity: 0; }
    100% { opacity: 0; }
}

/* Degen — rocket/candle */
@keyframes degenRocket {
    0%   { transform: translateY(0) scale(1); opacity: 0.9; }
    100% { transform: translateY(-56px) scale(0.5); opacity: 0; }
}

/* ── Particle DOM elements (generated via CSS content) ─ */

/* Miner particles */
.board-hero-portrait[data-hero="hero_miner"] .hero-portrait-particles::before,
.board-hero-portrait[data-hero="hero_miner"] .hero-portrait-particles::after {
    content: '✦';
    position: absolute;
    bottom: 4px;
    font-size: 8px;
    color: #FFD700;
    animation: minerSpark 1.4s ease-out infinite;
}
.board-hero-portrait[data-hero="hero_miner"] .hero-portrait-particles::before {
    left: 8px;
    --dx: -4px;
    animation-delay: 0s;
}
.board-hero-portrait[data-hero="hero_miner"] .hero-portrait-particles::after {
    left: 28px;
    --dx: 6px;
    animation-delay: 0.7s;
}

/* Validator particles */
.board-hero-portrait[data-hero="hero_validator"] .hero-portrait-particles::before {
    content: '';
    position: absolute;
    inset: 8px;
    border: 1.5px solid #4ECDC4;
    border-radius: 50%;
    animation: validatorRing 1.6s ease-out infinite;
}
.board-hero-portrait[data-hero="hero_validator"] .hero-portrait-particles::after {
    content: '';
    position: absolute;
    inset: 8px;
    border: 1.5px solid #4ECDC4;
    border-radius: 50%;
    animation: validatorRing 1.6s ease-out infinite 0.8s;
}

/* Whale particles */
.board-hero-portrait[data-hero="hero_whale"] .hero-portrait-particles::before,
.board-hero-portrait[data-hero="hero_whale"] .hero-portrait-particles::after {
    content: '●';
    position: absolute;
    bottom: 6px;
    font-size: 5px;
    color: #4ab8e0;
    opacity: 0.6;
    animation: whaleBubble 2s ease-in infinite;
}
.board-hero-portrait[data-hero="hero_whale"] .hero-portrait-particles::before { left: 10px; animation-delay: 0s; }
.board-hero-portrait[data-hero="hero_whale"] .hero-portrait-particles::after  { left: 26px; animation-delay: 1s; }

/* Hacker particles */
.board-hero-portrait[data-hero="hero_hacker"] .hero-portrait-particles::before,
.board-hero-portrait[data-hero="hero_hacker"] .hero-portrait-particles::after {
    content: '1';
    position: absolute;
    top: -4px;
    font-size: 8px;
    font-family: monospace;
    color: #FF3333;
    animation: hackerRain 1.2s linear infinite;
}
.board-hero-portrait[data-hero="hero_hacker"] .hero-portrait-particles::before { left: 8px;  animation-delay: 0s; }
.board-hero-portrait[data-hero="hero_hacker"] .hero-portrait-particles::after  { left: 28px; animation-delay: 0.6s; content: '0'; }

/* Oracle particles */
.board-hero-portrait[data-hero="hero_oracle"] .hero-portrait-particles::before {
    content: '★';
    position: absolute;
    top: 50%;
    left: 50%;
    font-size: 7px;
    color: #9B59B6;
    transform-origin: -10px center;
    animation: oracleStar 2.4s linear infinite;
}
.board-hero-portrait[data-hero="hero_oracle"] .hero-portrait-particles::after {
    content: '✦';
    position: absolute;
    top: 50%;
    left: 50%;
    font-size: 6px;
    color: #c39bd3;
    transform-origin: -14px center;
    animation: oracleStar 3.2s linear infinite reverse 1.2s;
}

/* Nomad particles */
.board-hero-portrait[data-hero="hero_nomad"] .hero-portrait-particles::before {
    content: '';
    position: absolute;
    inset: 12px;
    border: 2px solid #00FFFF;
    animation: nomadPortal 2s ease-out infinite;
}
.board-hero-portrait[data-hero="hero_nomad"] .hero-portrait-particles::after {
    content: '';
    position: absolute;
    inset: 12px;
    border: 2px solid #00FFFF;
    animation: nomadPortal 2s ease-out infinite 1s;
}

/* Collector particles */
.board-hero-portrait[data-hero="hero_collector"] .hero-portrait-particles::before,
.board-hero-portrait[data-hero="hero_collector"] .hero-portrait-particles::after {
    content: '🎴';
    position: absolute;
    bottom: 2px;
    font-size: 8px;
    --rot: -10deg;
    --rot2: 15deg;
    animation: collectorCard 1.8s ease-out infinite;
}
.board-hero-portrait[data-hero="hero_collector"] .hero-portrait-particles::before { left: 6px;  animation-delay: 0s; }
.board-hero-portrait[data-hero="hero_collector"] .hero-portrait-particles::after  { left: 26px; animation-delay: 0.9s; --rot: 5deg; --rot2: -20deg; }

/* Maximalist particles */
.board-hero-portrait[data-hero="hero_maximalist"] .hero-portrait-particles::before {
    content: '₿';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #F7931A;
    animation: maxFlash 2.5s ease-out infinite;
}
.board-hero-portrait[data-hero="hero_maximalist"] .hero-portrait-particles::after {
    content: '⚡';
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 10px;
    color: #F7931A;
    animation: maxFlash 2.5s ease-out infinite 1.2s;
}

/* Degen particles */
.board-hero-portrait[data-hero="hero_degen"] .hero-portrait-particles::before,
.board-hero-portrait[data-hero="hero_degen"] .hero-portrait-particles::after {
    content: '🚀';
    position: absolute;
    bottom: 4px;
    font-size: 9px;
    animation: degenRocket 1.6s ease-out infinite;
}
.board-hero-portrait[data-hero="hero_degen"] .hero-portrait-particles::before { left: 6px;  animation-delay: 0s; }
.board-hero-portrait[data-hero="hero_degen"] .hero-portrait-particles::after  { left: 24px; animation-delay: 0.8s; }

/* Builder particles */
.board-hero-portrait[data-hero="hero_builder"] .hero-portrait-particles::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 7px,
        rgba(68,255,170,0.15) 7px,
        rgba(68,255,170,0.15) 8px
    );
    animation: builderPulse 2s ease-in-out infinite;
}
.board-hero-portrait[data-hero="hero_builder"] .hero-portrait-particles::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 7px,
        rgba(68,255,170,0.15) 7px,
        rgba(68,255,170,0.15) 8px
    );
    animation: builderPulse 2s ease-in-out infinite 1s;
}

/* ── Mobile: slightly smaller portrait ───────────────── */
@media (max-width: 480px) {
    .hero-portrait-frame {
        width: 36px;
        height: 46px;
    }
    .hero-portrait-emoji { font-size: 1.3rem; }
    .hero-portrait-name  { font-size: 0.52rem; }
}


/* ═══════════════════════════════════════════════════════
   HERO FIELD FIGURE — positioned on battlefield (desktop)
═══════════════════════════════════════════════════════ */

/* Hidden on mobile — only shown on desktop */
.board-hero-figure {
    display: none;
}

@media (min-width: 1000px) {
    /* board-field-lanes needs position:relative for absolute child */
    .board-field-lanes {
        position: relative;
    }

    /* Hero figure: positioned BELOW the TX slot.
       TX slot is at top:50% centered (~87-115px tall), so hero figure
       starts at calc(50% + half-tx-height + gap) to avoid overlap.
       z-index: 3 — behind TX slot (z-index:5). */
    .board-hero-figure {
        display: flex;
        position: absolute;
        left: 8px;
        top: calc(50% + clamp(50px, 4.5vw, 64px));
        bottom: 6px;
        width: clamp(62px, 5.8vw, 84px);
        z-index: 3;
        flex-direction: column;
        align-items: stretch;
        border-radius: 7px;
        overflow: hidden;
        pointer-events: auto;
        animation: heroIdle 3s ease-in-out infinite;
    }

    /* Opponent hero figure: clickable for face attacks */
    #oppHeroFigure {
        cursor: pointer;
    }

    /* Hidden when no hero set */
    .board-hero-figure[data-hero=""] {
        display: none !important;
    }

    /* Opponent hero figure pulses red when face attack is available */
    #oppHeroFigure.face-attackable {
        z-index: 10;
    }
    #oppHeroFigure.face-attackable .hero-figure-glow {
        opacity: 1;
        animation: faceHeroGlow 1s ease-in-out infinite;
    }
    #oppHeroFigure.face-attackable::before {
        content: '\2694\FE0F';
        position: absolute;
        bottom: 8px;
        right: 4px;
        font-size: 1.1rem;
        animation: faceTargetBounce 1s ease-in-out infinite;
        z-index: 5;
        pointer-events: none;
        filter: drop-shadow(0 0 4px rgba(255, 50, 50, 0.9));
    }

    .hero-figure-img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: 50% 15%;
        border-radius: 6px;
        z-index: 1;
    }

    .hero-figure-emoji {
        position: absolute;
        inset: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 2rem;
        z-index: 2;
        opacity: 0.9;
    }

    /* Hide emoji once image loaded */
    .hero-figure-img[src]:not([src=""]) ~ .hero-figure-emoji { opacity: 0; }

    .hero-figure-particles {
        position: absolute;
        inset: 0;
        z-index: 3;
        pointer-events: none;
        overflow: hidden;
        border-radius: 6px;
    }

    .hero-figure-glow {
        position: absolute;
        inset: 0;
        border-radius: 7px;
        border: 2px solid rgba(255,255,255,0.2);
        z-index: 4;
        pointer-events: none;
        transition: border-color 0.3s, box-shadow 0.3s;
    }

    /* Bottom fade — figure blends into field */
    .board-hero-figure::after {
        content: '';
        position: absolute;
        bottom: 0; left: 0; right: 0;
        height: 28%;
        background: linear-gradient(to top, rgba(10,10,20,0.7) 0%, transparent 100%);
        z-index: 5;
        border-radius: 0 0 6px 6px;
        pointer-events: none;
    }

    /* Per-hero color glows */
    .board-hero-figure[data-hero="hero_miner"] .hero-figure-glow {
        border-color: rgba(255,215,0,0.7);
        box-shadow: 0 0 18px rgba(255,215,0,0.45), inset 0 0 10px rgba(255,215,0,0.08);
    }
    .board-hero-figure[data-hero="hero_validator"] .hero-figure-glow {
        border-color: rgba(78,205,196,0.7);
        box-shadow: 0 0 18px rgba(78,205,196,0.45), inset 0 0 10px rgba(78,205,196,0.08);
    }
    .board-hero-figure[data-hero="hero_degen"] .hero-figure-glow {
        border-color: rgba(68,255,68,0.7);
        box-shadow: 0 0 18px rgba(68,255,68,0.45), inset 0 0 10px rgba(68,255,68,0.08);
    }
    .board-hero-figure[data-hero="hero_whale"] .hero-figure-glow {
        border-color: rgba(74,184,224,0.7);
        box-shadow: 0 0 18px rgba(74,184,224,0.45);
    }
    .board-hero-figure[data-hero="hero_builder"] .hero-figure-glow {
        border-color: rgba(68,255,170,0.7);
        box-shadow: 0 0 18px rgba(68,255,170,0.45), inset 0 0 10px rgba(68,255,170,0.08);
    }
    .board-hero-figure[data-hero="hero_hacker"] .hero-figure-glow {
        border-color: rgba(255,51,51,0.7);
        box-shadow: 0 0 18px rgba(255,51,51,0.45), inset 0 0 10px rgba(255,51,51,0.08);
    }
    .board-hero-figure[data-hero="hero_oracle"] .hero-figure-glow {
        border-color: rgba(155,89,182,0.7);
        box-shadow: 0 0 18px rgba(155,89,182,0.5), inset 0 0 10px rgba(155,89,182,0.1);
    }
    .board-hero-figure[data-hero="hero_nomad"] .hero-figure-glow {
        border-color: rgba(0,255,255,0.65);
        box-shadow: 0 0 18px rgba(0,255,255,0.4), inset 0 0 10px rgba(0,255,255,0.07);
    }
    .board-hero-figure[data-hero="hero_collector"] .hero-figure-glow {
        border-color: rgba(255,105,180,0.7);
        box-shadow: 0 0 18px rgba(255,105,180,0.45), inset 0 0 10px rgba(255,105,180,0.08);
    }
    .board-hero-figure[data-hero="hero_maximalist"] .hero-figure-glow {
        border-color: rgba(247,147,26,0.7);
        box-shadow: 0 0 18px rgba(247,147,26,0.5), inset 0 0 10px rgba(247,147,26,0.1);
    }

    /* Idle breathing animation */
    @keyframes heroIdle {
        0%, 100% { transform: translateY(0px); filter: brightness(1); }
        50%       { transform: translateY(-3px); filter: brightness(1.08); }
    }
    /* Take damage — red flash + shake */
    @keyframes heroTakeDamage {
        0%   { filter: brightness(1) saturate(1); transform: translateX(0) translateY(0px); }
        15%  { filter: brightness(2.5) saturate(0) sepia(1) hue-rotate(-30deg); transform: translateX(-5px); }
        30%  { filter: brightness(1.8) saturate(0) sepia(1) hue-rotate(-30deg); transform: translateX(4px); }
        50%  { filter: brightness(1.4) saturate(0.3); transform: translateX(-3px); }
        75%  { filter: brightness(1.1); transform: translateX(2px); }
        100% { filter: brightness(1) saturate(1); transform: translateX(0) translateY(0px); }
    }
    .board-hero-figure.hero-take-damage {
        animation: heroTakeDamage 0.55s ease-out !important;
    }

    /* Attack lean — triggered via JS class */
    @keyframes heroAttackLean {
        0%   { transform: translateX(0) rotate(0deg); }
        25%  { transform: translateX(5px) rotate(2deg); }
        60%  { transform: translateX(-2px) rotate(-1deg); }
        100% { transform: translateX(0) rotate(0deg); }
    }
    .board-hero-figure.hero-attack { animation: heroAttackLean 0.5s ease-out; }

    /* Passive fire on field figure */
    .board-hero-figure.hero-passive-fire { animation: heroPassiveFire 0.6s ease-out; }

    /* Particle effects on field figure */
    .board-hero-figure[data-hero="hero_miner"] .hero-figure-particles::before,
    .board-hero-figure[data-hero="hero_miner"] .hero-figure-particles::after {
        content: "\2726"; position: absolute; bottom: 8px; font-size: 9px;
        color: #FFD700; animation: minerSpark 1.6s ease-out infinite;
    }
    .board-hero-figure[data-hero="hero_miner"] .hero-figure-particles::before { left: 30%; --dx: -5px; animation-delay: 0s; }
    .board-hero-figure[data-hero="hero_miner"] .hero-figure-particles::after  { left: 60%; --dx: 7px; animation-delay: 0.8s; }

    .board-hero-figure[data-hero="hero_validator"] .hero-figure-particles::before,
    .board-hero-figure[data-hero="hero_validator"] .hero-figure-particles::after {
        content: ''; position: absolute; inset: 15%; border: 1.5px solid #4ECDC4;
        border-radius: 50%; animation: validatorRing 1.8s ease-out infinite;
    }
    .board-hero-figure[data-hero="hero_validator"] .hero-figure-particles::after { animation-delay: 0.9s; }

    .board-hero-figure[data-hero="hero_whale"] .hero-figure-particles::before,
    .board-hero-figure[data-hero="hero_whale"] .hero-figure-particles::after {
        content: "\25CF"; position: absolute; bottom: 10px; font-size: 6px;
        color: #4ab8e0; animation: whaleBubble 2.2s ease-in infinite;
    }
    .board-hero-figure[data-hero="hero_whale"] .hero-figure-particles::before { left: 25%; animation-delay: 0s; }
    .board-hero-figure[data-hero="hero_whale"] .hero-figure-particles::after  { left: 65%; animation-delay: 1.1s; }

    .board-hero-figure[data-hero="hero_hacker"] .hero-figure-particles::before,
    .board-hero-figure[data-hero="hero_hacker"] .hero-figure-particles::after {
        position: absolute; top: -4px; font-size: 9px; font-family: monospace;
        color: #FF3333; animation: hackerRain 1.1s linear infinite;
    }
    .board-hero-figure[data-hero="hero_hacker"] .hero-figure-particles::before { content: '1'; left: 25%; animation-delay: 0s; }
    .board-hero-figure[data-hero="hero_hacker"] .hero-figure-particles::after  { content: '0'; left: 60%; animation-delay: 0.55s; }

    .board-hero-figure[data-hero="hero_oracle"] .hero-figure-particles::before {
        content: "\2605"; position: absolute; top: 50%; left: 50%; font-size: 8px;
        color: #9B59B6; transform-origin: -12px center; animation: oracleStar 2.6s linear infinite;
    }
    .board-hero-figure[data-hero="hero_oracle"] .hero-figure-particles::after {
        content: "\2726"; position: absolute; top: 50%; left: 50%; font-size: 7px;
        color: #c39bd3; transform-origin: -16px center; animation: oracleStar 3.4s linear infinite reverse 1.3s;
    }

    .board-hero-figure[data-hero="hero_nomad"] .hero-figure-particles::before,
    .board-hero-figure[data-hero="hero_nomad"] .hero-figure-particles::after {
        content: ''; position: absolute; inset: 20%; border: 2px solid #00FFFF;
        animation: nomadPortal 2.2s ease-out infinite;
    }
    .board-hero-figure[data-hero="hero_nomad"] .hero-figure-particles::after { animation-delay: 1.1s; }

    .board-hero-figure[data-hero="hero_maximalist"] .hero-figure-particles::before {
        content: "\20BF"; position: absolute; inset: 0; display: flex;
        align-items: center; justify-content: center;
        font-size: 22px; color: #F7931A; animation: maxFlash 2.8s ease-out infinite;
    }
    .board-hero-figure[data-hero="hero_maximalist"] .hero-figure-particles::after {
        content: "\26A1"; position: absolute; top: 5px; right: 5px;
        font-size: 11px; color: #F7931A; animation: maxFlash 2.8s ease-out infinite 1.4s;
    }

    .board-hero-figure[data-hero="hero_degen"] .hero-figure-particles::before,
    .board-hero-figure[data-hero="hero_degen"] .hero-figure-particles::after {
        content: "\1F680"; position: absolute; bottom: 6px; font-size: 10px;
        animation: degenRocket 1.7s ease-out infinite;
    }
    .board-hero-figure[data-hero="hero_degen"] .hero-figure-particles::before { left: 20%; animation-delay: 0s; }
    .board-hero-figure[data-hero="hero_degen"] .hero-figure-particles::after  { left: 55%; animation-delay: 0.85s; }

    .board-hero-figure[data-hero="hero_collector"] .hero-figure-particles::before,
    .board-hero-figure[data-hero="hero_collector"] .hero-figure-particles::after {
        content: "\1F004"; position: absolute; bottom: 4px; font-size: 9px;
        --rot: -10deg; --rot2: 15deg; animation: collectorCard 2s ease-out infinite;
    }
    .board-hero-figure[data-hero="hero_collector"] .hero-figure-particles::before { left: 15%; animation-delay: 0s; }
    .board-hero-figure[data-hero="hero_collector"] .hero-figure-particles::after  { left: 55%; animation-delay: 1s; }

    .board-hero-figure[data-hero="hero_builder"] .hero-figure-particles::before {
        content: ''; position: absolute; inset: 0;
        background: repeating-linear-gradient(90deg, transparent, transparent 8px, rgba(68,255,170,0.12) 8px, rgba(68,255,170,0.12) 9px);
        animation: builderPulse 2.2s ease-in-out infinite;
    }
    .board-hero-figure[data-hero="hero_builder"] .hero-figure-particles::after {
        content: ''; position: absolute; inset: 0;
        background: repeating-linear-gradient(0deg, transparent, transparent 8px, rgba(68,255,170,0.12) 8px, rgba(68,255,170,0.12) 9px);
        animation: builderPulse 2.2s ease-in-out infinite 1.1s;
    }

    /* ── SPEECH BUBBLE ── */
    .hero-speech-bubble {
        display: none;
        position: absolute;
        top: -36px;
        left: 50%;
        transform: translateX(-50%) scale(0.6);
        background: rgba(8, 8, 20, 0.92);
        border: 1.5px solid rgba(255,255,255,0.3);
        border-radius: 8px;
        padding: 4px 8px;
        font-size: 10px;
        font-family: monospace;
        font-weight: bold;
        color: #fff;
        white-space: nowrap;
        z-index: 20;
        pointer-events: none;
        letter-spacing: 0.5px;
        opacity: 0;
    }
    /* Arrow pointing down */
    .hero-speech-bubble::after {
        content: '';
        position: absolute;
        bottom: -6px;
        left: 50%;
        transform: translateX(-50%);
        border: 6px solid transparent;
        border-top-color: rgba(255,255,255,0.3);
        border-bottom: none;
    }
    @keyframes bubblePop {
        0%   { opacity: 0; transform: translateX(-50%) scale(0.6) translateY(4px); }
        20%  { opacity: 1; transform: translateX(-50%) scale(1.05) translateY(0); }
        35%  { transform: translateX(-50%) scale(1) translateY(0); }
        75%  { opacity: 1; }
        100% { opacity: 0; transform: translateX(-50%) scale(0.95) translateY(-4px); }
    }
    .board-hero-figure.hero-passive-fire .hero-speech-bubble {
        display: block;
        animation: bubblePop 1.8s ease-out forwards;
    }
    /* Per-hero bubble border color */
    .board-hero-figure[data-hero="hero_miner"] .hero-speech-bubble      { border-color: rgba(255,215,0,0.7); }
    .board-hero-figure[data-hero="hero_validator"] .hero-speech-bubble  { border-color: rgba(78,205,196,0.7); }
    .board-hero-figure[data-hero="hero_degen"] .hero-speech-bubble      { border-color: rgba(68,255,68,0.7); }
    .board-hero-figure[data-hero="hero_whale"] .hero-speech-bubble      { border-color: rgba(74,184,224,0.7); }
    .board-hero-figure[data-hero="hero_builder"] .hero-speech-bubble    { border-color: rgba(68,255,170,0.7); }
    .board-hero-figure[data-hero="hero_hacker"] .hero-speech-bubble     { border-color: rgba(255,51,51,0.7); }
    .board-hero-figure[data-hero="hero_oracle"] .hero-speech-bubble     { border-color: rgba(155,89,182,0.7); }
    .board-hero-figure[data-hero="hero_nomad"] .hero-speech-bubble      { border-color: rgba(0,255,255,0.65); }
    .board-hero-figure[data-hero="hero_collector"] .hero-speech-bubble  { border-color: rgba(255,105,180,0.7); }
    .board-hero-figure[data-hero="hero_maximalist"] .hero-speech-bubble { border-color: rgba(247,147,26,0.7); }
}

/* ── Tutorial Highlight System ─────────────────────────────────────── */
.tutorial-highlight {
    outline: 3px solid #44ffaa !important;
    outline-offset: 4px;
    border-radius: 8px;
    animation: tutHighlightBlink 0.7s ease-in-out infinite alternate;
    position: relative;
    z-index: 10;
}

/* Blinks between teal and white — clearly distinct from TX card teal border */
@keyframes tutHighlightBlink {
    0%   {
        outline-color: #44ffaa;
        box-shadow: 0 0 0 4px rgba(68,255,170,0.25), 0 0 20px rgba(68,255,170,0.5);
    }
    100% {
        outline-color: #ffffff;
        box-shadow: 0 0 0 6px rgba(255,255,255,0.5), 0 0 30px rgba(68,255,170,0.8);
    }
}

/* Arrow bounces left→right toward the highlighted card */
@keyframes tutArrowBounce {
    from { transform: translateX(-6px); }
    to   { transform: translateX(4px); }
}
