/* File: /public/css/components/modal.css */
/* Arcade Layer - Modal & Popup Styles */
/* v1.8.0 - Card-back image support: .card-front.has-image hides CSS pattern/emblem
 *   → .card-front-image covers the card face (object-fit:cover, border-radius match)
 *   → .has-image class zeroes out background, hides ::before/::after pseudo-elements
 *   → Hover glow effect preserved for image variant
 *   → Falls back cleanly — without .has-image, existing CSS mystery design is unchanged
 */
/* v1.7.0 - Style: Win popup redesigned to match wheel-container aesthetic
 *   → Layered texture background (diamond crosshatch + radial glow)
 *   → Gradient border overlay via ::before (mask-composite)
 *   → Vignette overlay via ::after (darker edges)
 *   → AWESOME button matches main-spin-btn (dark gradient + gold border)
 *   → All inner content elevated above pseudo-elements via .win-popup > *
 *   → Jackpot variant uses brighter gold border + stronger glow
 */
/* v1.6.0 - Mobile perf: disable looping card animations + shorten flip; pair with ambient-effects.css v1.1.0 */
/* v1.5.9 - Fix: Reveal All / Collect & Close buttons now visible on mobile
 *   - min-height:0 on .batch-grid allows flex to properly shrink the scroll area
 *   - flex-shrink:0 on .batch-footer prevents footer from being squeezed out
 *   - Mobile: max-height uses dvh (excludes browser chrome) with vh fallback
 *   - Mobile: tighter padding/gap to fit more cards without hiding the footer
 */
/* v1.5.8 - Fix: position:relative on .card-front second rule also overriding position:absolute */
/* v1.5.7 - Fix: position:relative on .card-back was overriding position:absolute, causing row shift */
/* v1.5.6 - Fix: Card flip stays in place — replaced rotateY with scaleX (no 3D projection) */
/* v1.5.5 - Fix: Card flip works correctly — two-face independent animation replaces preserve-3d */
/* v1.5.4 - Fix: Flipped card no longer bleeds into row below (clip-path: inset instead of overflow:hidden) */
/* v1.5.3 - Fix: Card back visible after flip (removed overflow:hidden that flattened preserve-3d) */
/* v1.5.2 - Fix: Card flip no longer shifts rows (perspective as property + overflow:hidden) */
/* v1.5.1 - Fix: Card flip no longer overlaps adjacent cards (perspective moved into transform) */
/* v1.5.0 - Premium batch card redesign: CSS-geometry fronts, shimmer, emblem pulse */
/*
 * CHANGES IN v1.5.0:
 * - REDESIGNED: Card fronts now use pure-CSS premium geometry (no image dependency)
 *   - Subtle diamond tile pattern via repeating linear-gradients
 *   - Inner frame accent border
 *   - Animated shimmer sweep across unrevealed card
 *   - Pulsing gold mystery emblem (✦) replaces the old ❓ icon
 * - UPGRADED: Card backs use deeper directional gradients + inner-frame trim detail
 * - UPGRADED: Modal shell gets gradient top accent line + refined entrance animation
 * - UPGRADED: Flip transition uses smoother cubic-bezier curve
 * - UPGRADED: Jackpot cards pulse faster and brighter
 * - NOTE: wryon.css .result-card .card-front image override removed (no longer needed)
 *
 * CHANGES IN v1.4.0:
 * - FIXED: Win popup icon image now centered (display:block + margin:auto)
 * - NEW: .result-card.xp batch card style (gold border + glow animation)
 * - NEW: .stat-tag.xp for batch summary header (gold theme)
 * - NEW: .result-card.xp .result-label gold color
 *
 * CHANGES IN v1.3.1:
 * - FIXED: X close button now positioned in top-right corner (absolute)
 * - Added padding-right to header to prevent overlap with X
 *
 * CHANGES IN v1.3.0:
 * - REDESIGNED: Batch results modal now matches spin controls panel aesthetic
 * - Darker, more sophisticated backgrounds
 * - Subtle gold/secondary borders
 * - Overall premium dark mode feel
 *
 * KEY NOTES:
 * - Win popup modal for spin results
 * - Wallet connection prompt
 * - Flash overlay effects
 * - All colors use CSS variables for white-label theming
 *
 * WHITE-LABEL NOTES:
 * - Card fronts show realm-configurable image via THEME_CONFIG.assets.cardBackUrl
 * - Falls back to theme-agnostic pure CSS if image unavailable
 * - Emblem color and shimmer tint use --brand-secondary-rgb automatically
 * - Card back gradients key off --brand-primary-rgb / --brand-secondary-rgb
 */

/* =================================================================
   WIN FLASH OVERLAY
   Full-screen flash effect on wins
   ================================================================= */
.win-flash {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle, 
        rgba(var(--brand-primary-rgb), 0.3) 0%, 
        transparent 70%);
    pointer-events: none;
    z-index: var(--z-overlay);
    animation: flashPulse 0.5s ease-out forwards;
}

.win-flash.jackpot-flash {
    background: radial-gradient(circle, 
        rgba(var(--brand-secondary-rgb), 0.4) 0%, 
        transparent 70%);
}

@keyframes flashPulse {
    0% { opacity: 0; }
    30% { opacity: 1; }
    100% { opacity: 0; }
}

/* =================================================================
   WIN POPUP MODAL
   Displays prize information after spin
   v1.7.0: Restyled to match wheel-container aesthetic
   ================================================================= */
.win-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: calc(var(--z-max) + 10);
    backdrop-filter: blur(10px);
}

.win-popup {
    /* Layer 1: Soft radial glow from center */
    background: 
        radial-gradient(
            ellipse 60% 50% at 50% 45%,
            rgba(var(--brand-primary-rgb), 0.10) 0%,
            transparent 70%
        ),
        /* Layer 2: Diamond crosshatch texture */
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 18px,
            rgba(255, 255, 255, 0.015) 18px,
            rgba(255, 255, 255, 0.015) 19px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 18px,
            rgba(255, 255, 255, 0.015) 18px,
            rgba(255, 255, 255, 0.015) 19px
        ),
        /* Layer 3: Vertical gradient — darker top/bottom */
        linear-gradient(
            180deg,
            rgba(5, 15, 5, 0.55) 0%,
            rgba(10, 25, 10, 0.30) 40%,
            rgba(10, 25, 10, 0.30) 60%,
            rgba(5, 15, 5, 0.55) 100%
        );
    border: none;
    border-radius: 20px;
    padding: 30px 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    backdrop-filter: blur(20px);
    box-shadow: 
        var(--shadow-premium, 0 8px 32px rgba(0,0,0,0.4)),
        0 0 40px rgba(var(--brand-primary-rgb), 0.25);
    animation: popupAppear 0.4s var(--ease-bounce);
    position: relative;
    overflow: hidden;
}

/* Gradient border overlay (mask-composite — matches wheel-container::before) */
.win-popup::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    border: 3px solid transparent;
    background: linear-gradient(135deg,
        rgba(var(--brand-primary-rgb), 0.55),
        rgba(var(--brand-secondary-rgb), 0.3),
        rgba(var(--brand-primary-rgb), 0.2)) border-box;
    -webkit-mask:
        linear-gradient(#fff 0 0) padding-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: 0;
}

/* Vignette overlay (matches wheel-container::after) */
.win-popup::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(
        ellipse at center,
        transparent 30%,
        rgba(0, 0, 0, 0.25) 70%,
        rgba(0, 0, 0, 0.5) 100%
    );
    pointer-events: none;
    z-index: 1;
    border-radius: 20px;
}

/* Elevate ALL direct children above ::before / ::after */
.win-popup > * {
    position: relative;
    z-index: 2;
}

/* Jackpot variant — gold-dominant gradient border + stronger glow */
.win-popup.jackpot::before {
    background: linear-gradient(135deg,
        rgba(var(--brand-secondary-rgb), 0.6),
        rgba(var(--brand-primary-rgb), 0.3),
        rgba(var(--brand-secondary-rgb), 0.4)) border-box;
}

.win-popup.jackpot {
    box-shadow: 
        var(--shadow-premium, 0 8px 32px rgba(0,0,0,0.4)),
        0 0 60px rgba(var(--brand-secondary-rgb), 0.35);
}

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

/* Win Popup Icon */
.win-popup-icon {
    width: 200px;
    height: 200px;
    display: block;
    margin: 0 auto 15px auto;
    animation: iconPop 0.5s ease-out 0.2s both;
    object-fit: contain;
}

@keyframes iconPop {
    0% { transform: scale(0) rotate(-30deg); }
    50% { transform: scale(1.3) rotate(10deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* Win Popup Title */
.win-popup-title {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    color: var(--brand-primary);
    margin-bottom: var(--space-3);
    text-shadow: 0 0 20px rgba(var(--brand-primary-rgb), 0.6);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.win-popup.jackpot .win-popup-title {
    color: var(--brand-secondary);
    text-shadow: 0 0 20px rgba(var(--brand-secondary-rgb), 0.6);
}

/* Win Popup Prize Amount */
.win-popup-prize {
    font-family: var(--font-display);
    font-size: var(--text-4xl);
    color: #fff;
    margin-bottom: var(--space-5);
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

/* Win Popup Message */
.win-popup-message {
    color: var(--text-secondary);
    font-size: var(--text-base);
    margin-bottom: var(--space-6);
    line-height: var(--leading-normal);
}

/* Win Popup Close Button — matches main-spin-btn aesthetic */
.win-popup-close {
    padding: var(--space-3) var(--space-10);
    background: linear-gradient(180deg, #3a3a3a 0%, #1a1a1a 50%, #0a0a0a 100%);
    border: 3px solid var(--brand-primary);
    border-radius: 8px;
    color: var(--brand-primary);
    font-family: var(--font-display);
    font-size: var(--text-md);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 20px rgba(var(--brand-primary-rgb), 0.2);
}

.win-popup-close:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 0 30px rgba(var(--brand-primary-rgb), 0.4);
    border-color: var(--brand-primary-bright, #ffd700);
    color: var(--brand-primary-bright, #ffd700);
}

/* =================================================================
   FIREWORKS PARTICLES
   Decorative particles in win popup
   ================================================================= */
.firework {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    animation: fireworkBurst 1s ease-out forwards;
}

@keyframes fireworkBurst {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}

/* =================================================================
   CONFETTI CONTAINER
   Full-screen confetti effect
   ================================================================= */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: calc(var(--z-overlay) + 1);
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
    0% { 
        transform: translateY(-100px) rotate(0deg);
        opacity: 1;
    }
    100% { 
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* =================================================================
   WALLET PROMPT MODAL
   Mobile wallet connection options
   ================================================================= */
.wallet-prompt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-5);
}

.wallet-prompt {
    background: var(--gradient-card-angled);
    border: 2px solid var(--brand-primary);
    border-radius: var(--radius-xl);
    padding: 30px;
    max-width: 350px;
    text-align: center;
    box-shadow: 0 0 50px rgba(var(--brand-primary-rgb), 0.3);
}

.wallet-prompt h3 {
    color: var(--brand-primary);
    font-family: var(--font-display);
    font-size: var(--text-xl);
    margin-bottom: var(--space-4);
}

.wallet-prompt p {
    color: var(--text-secondary);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    margin-bottom: var(--space-5);
}

/* Wallet Options Container */
.wallet-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

/* Wallet Option Button Base */
.wallet-option-btn {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-lg);
    font-family: var(--font-display);
    font-size: var(--text-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    border: 1px solid;
}

.wallet-option-btn:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
}

/* MetaMask Option */
.wallet-option-btn.metamask {
    background: linear-gradient(135deg, 
        rgba(245, 133, 66, 0.2), 
        rgba(245, 133, 66, 0.1));
    border-color: #f58542;
    color: #f58542;
}

/* Coinbase Option */
.wallet-option-btn.coinbase {
    background: linear-gradient(135deg, 
        rgba(0, 82, 255, 0.2), 
        rgba(0, 82, 255, 0.1));
    border-color: #0052ff;
    color: #4d8bff;
}

/* Browser Wallet Option */
.wallet-option-btn.browser {
    background: var(--gradient-button-subtle);
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

/* Wallet Prompt Close Button */
.wallet-prompt-close {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-secondary);
    padding: var(--space-3) var(--space-8);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: var(--text-sm);
    transition: all var(--transition-normal);
}

.wallet-prompt-close:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}


/* =================================================================
   BATCH RESULTS MODAL - MODERN PREMIUM DARK THEME
   Matches spin controls panel aesthetic
   ================================================================= */
.batch-results-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    z-index: var(--z-max);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.batch-results-modal {
    background: linear-gradient(165deg, rgba(6, 16, 6, 0.97) 0%, rgba(3, 9, 3, 0.98) 100%);
    border: 1px solid rgba(var(--brand-secondary-rgb), 0.35);
    border-radius: 20px;
    box-shadow: 
        0 40px 100px rgba(0, 0, 0, 0.9),
        0 0 60px rgba(var(--brand-secondary-rgb), 0.07),
        0 0 120px rgba(var(--brand-primary-rgb), 0.03),
        inset 0 1px 0 rgba(var(--brand-secondary-rgb), 0.12),
        inset 0 -1px 0 rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 620px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

/* Gradient top accent line */
.batch-results-modal::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(var(--brand-secondary-rgb), 0.6) 30%,
        rgba(var(--brand-primary-rgb), 0.5) 70%,
        transparent 100%
    );
    border-radius: 20px 20px 0 0;
    z-index: 1;
}

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

/* Header - Modern subtle style */
.batch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3);
    padding: 16px 20px;
    padding-right: 50px; /* Make room for absolute X button */
    border-bottom: 1px solid rgba(var(--brand-secondary-rgb), 0.2);
    background: rgba(0, 0, 0, 0.3);
    position: relative;
}

.batch-header h2 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: rgba(var(--brand-secondary-rgb), 0.9);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Close X Button - Positioned in top-right corner */
.modal-close-x {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.6);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.modal-close-x:hover {
    background: rgba(255, 100, 100, 0.15);
    border-color: rgba(255, 100, 100, 0.4);
    color: #ff6b6b;
}

/* Summary Stats - Compact pills */
.batch-summary-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.stat-tag {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-display);
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(100, 100, 100, 0.3);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-tag.wn {
    background: rgba(var(--brand-primary-rgb), 0.15);
    border-color: rgba(var(--brand-primary-rgb), 0.4);
    color: var(--brand-primary);
}

.stat-tag.raffle {
    background: rgba(var(--brand-secondary-rgb), 0.15);
    border-color: rgba(var(--brand-secondary-rgb), 0.4);
    color: var(--brand-secondary);
}

.stat-tag.prize {
    background: rgba(255, 107, 107, 0.15);
    border-color: rgba(255, 107, 107, 0.4);
    color: #ff6b6b;
}

.stat-tag.xp {
    background: rgba(255, 215, 0, 0.15);
    border-color: rgba(255, 215, 0, 0.4);
    color: #ffd700;
}

/* Grid of Result Cards */
.batch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    padding: 16px;
    gap: 10px;
    overflow-y: auto;
    flex: 1;
    min-height: 0; /* critical: allows flex child to shrink below content height */
    background: rgba(0, 0, 0, 0.2);
    /* Custom Scrollbar - subtle */
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--brand-secondary-rgb), 0.4) rgba(0,0,0,0.2);
}

.batch-grid::-webkit-scrollbar {
    width: 6px;
}
.batch-grid::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
}
.batch-grid::-webkit-scrollbar-thumb {
    background: rgba(var(--brand-secondary-rgb), 0.4);
    border-radius: 3px;
}
.batch-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--brand-secondary-rgb), 0.6);
}

/* v1.5.6 - Replaced rotateY (causes perspective projection displacement) with scaleX.
 *   scaleX 1→0 (front vanishes), then scaleX 0→1 (back appears) is visually
 *   identical to a card flip but is a 2D transform — zero overflow, zero projection
 *   displacement, works in any layout context.
 */

/* Result Card */
.result-card {
    aspect-ratio: 3/4;
    cursor: pointer;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 10px;
}

/* Both faces fill the card */
.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    overflow: hidden;
}

/* Front: visible, collapses to edge first */
.card-front {
    transform: scaleX(1);
    transform-origin: center;
    transition: transform 0.22s ease-in 0s, visibility 0s linear 0.22s;
    visibility: visible;
}

/* Back: starts collapsed, expands after front hides */
.card-back {
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.22s ease-out 0.22s;
    visibility: hidden;
}

/* Revealed state */
.result-card.revealed .card-front {
    transform: scaleX(0);
    transition: transform 0.22s ease-in 0s, visibility 0s linear 0.22s;
    visibility: hidden;
}

.result-card.revealed .card-back {
    transform: scaleX(1);
    transition: transform 0.22s ease-out 0.22s, visibility 0s linear 0.22s;
    visibility: visible;
}

/* ---------------------------------------------------------------
   CARD FRONT (Unrevealed) — Premium CSS geometry, no image needed,
   no extra HTML elements required — all via pseudo-elements
   --------------------------------------------------------------- */
.card-front {
    background: linear-gradient(145deg,
        rgba(var(--brand-secondary-rgb), 0.06) 0%,
        rgba(0, 0, 0, 0.88) 50%,
        rgba(var(--brand-primary-rgb), 0.04) 100%
    );
    border: 1px solid rgba(var(--brand-secondary-rgb), 0.22);
    box-shadow:
        inset 0 1px 0 rgba(var(--brand-secondary-rgb), 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.4),
        0 4px 12px rgba(0, 0, 0, 0.5);
    /* position: absolute comes from shared rule — do NOT set position:relative here */
    /* transition comes from flip mechanism — do NOT set transition:all here */
    overflow: hidden;
}

/* Diamond tile pattern + animated shimmer sweep */
.card-front::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 9px;
    /* Diamond tile pattern */
    background-image:
        linear-gradient(45deg,  rgba(var(--brand-secondary-rgb), 0.035) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(var(--brand-secondary-rgb), 0.035) 25%, transparent 25%),
        linear-gradient(45deg,  transparent 75%, rgba(var(--brand-secondary-rgb), 0.035) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(var(--brand-secondary-rgb), 0.035) 75%);
    background-size: 14px 14px;
    background-position: 0 0, 0 7px, 7px -7px, -7px 0px;
    pointer-events: none;
}

/* Shimmer sweep + inner frame as single pseudo-element */
.card-front::after {
    content: '';
    position: absolute;
    inset: 5px;
    border-radius: 6px;
    border: 1px solid rgba(var(--brand-secondary-rgb), 0.1);
    /* Shimmer sweep via box-shadow animation */
    pointer-events: none;
    animation: cardFrontPulse 3s ease-in-out infinite;
}

@keyframes cardFrontPulse {
    0%, 100% { 
        border-color: rgba(var(--brand-secondary-rgb), 0.08);
        box-shadow: none;
    }
    50% {
        border-color: rgba(var(--brand-secondary-rgb), 0.22);
        box-shadow: inset 0 0 14px rgba(var(--brand-secondary-rgb), 0.06);
    }
}

/* Card front image — replaces CSS pattern when loaded (v1.8.0)
   .has-image is set by JS when the preloaded image succeeds.
   Without .has-image, the existing CSS mystery design shows unchanged. */
.card-front.has-image {
    background: transparent;
    border-color: rgba(var(--brand-secondary-rgb), 0.3);
    padding: 0;
}
.card-front.has-image::before,
.card-front.has-image::after {
    display: none;
}
.card-front-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 9px;
    pointer-events: none;
}

/* Mystery icon — styled as premium emblem */
.mystery-icon {
    font-size: 0;           /* hide the ❓ character */
    position: relative;
    z-index: 2;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1.5px solid rgba(var(--brand-secondary-rgb), 0.4);
    background: radial-gradient(
        circle,
        rgba(var(--brand-secondary-rgb), 0.12) 0%,
        rgba(0, 0, 0, 0.4) 100%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 0 10px rgba(var(--brand-secondary-rgb), 0.1),
        inset 0 0 8px rgba(0, 0, 0, 0.4);
    animation: emblemPulse 3s ease-in-out infinite;
}

/* ✦ symbol injected via ::before */
.mystery-icon::before {
    content: '✦';
    font-size: 0.85rem;
    color: rgba(var(--brand-secondary-rgb), 0.65);
    line-height: 1;
}

/* "Mystery" label via ::after */
.mystery-icon::after {
    content: 'Mystery';
    position: absolute;
    top: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.4rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(var(--brand-secondary-rgb), 0.32);
    font-family: var(--font-display);
    white-space: nowrap;
}

@keyframes emblemPulse {
    0%, 100% { box-shadow: 0 0 8px rgba(var(--brand-secondary-rgb), 0.08); }
    50%       { box-shadow: 0 0 18px rgba(var(--brand-secondary-rgb), 0.28), 0 0 5px rgba(var(--brand-primary-rgb), 0.1); }
}

/* Hover - glow only, no translateY (would drift in preserve-3d context) */
.result-card:hover .card-front {
    border-color: rgba(var(--brand-secondary-rgb), 0.5);
    box-shadow:
        inset 0 1px 0 rgba(var(--brand-secondary-rgb), 0.18),
        0 0 18px rgba(var(--brand-secondary-rgb), 0.1),
        0 6px 18px rgba(0, 0, 0, 0.6);
}
.result-card:hover .mystery-icon {
    border-color: rgba(var(--brand-secondary-rgb), 0.65);
}

/* Hover — image variant (v1.8.0) */
.result-card:hover .card-front.has-image {
    border-color: rgba(var(--brand-secondary-rgb), 0.55);
    box-shadow:
        0 0 18px rgba(var(--brand-secondary-rgb), 0.15),
        0 6px 18px rgba(0, 0, 0, 0.6);
}

/* Card Back (Revealed Outcome) */
.card-back {
    background: rgba(4, 10, 4, 0.92);
    border: 1px solid rgba(100, 100, 100, 0.22);
    gap: 5px;
    /* position:absolute comes from shared .card-front, .card-back rule above — do not override */
}

/* Inner frame trim detail on revealed cards */
.card-back::before {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    pointer-events: none;
}

/* Outcome Styles */
.result-card.wn .card-back,
.result-card.revealed.wn .card-back { 
    background: linear-gradient(160deg, rgba(16, 40, 10, 0.95) 0%, rgba(6, 18, 4, 0.98) 100%);
    border-color: rgba(var(--brand-primary-rgb), 0.45);
    box-shadow: 0 0 14px rgba(var(--brand-primary-rgb), 0.1), inset 0 1px 0 rgba(var(--brand-primary-rgb), 0.07);
}

.result-card.ticket .card-back,
.result-card.raffle .card-back,
.result-card.revealed.raffle .card-back { 
    background: linear-gradient(160deg, rgba(32, 25, 6, 0.95) 0%, rgba(14, 11, 3, 0.98) 100%);
    border-color: rgba(var(--brand-secondary-rgb), 0.55);
    box-shadow: 0 0 14px rgba(var(--brand-secondary-rgb), 0.12), inset 0 1px 0 rgba(var(--brand-secondary-rgb), 0.08);
}

.result-card.free .card-back,
.result-card.revealed.free .card-back { 
    background: linear-gradient(160deg, rgba(10, 24, 38, 0.95) 0%, rgba(4, 10, 18, 0.98) 100%);
    border-color: rgba(100, 150, 200, 0.5);
    box-shadow: 0 0 12px rgba(100, 150, 200, 0.1);
}

.result-card.prize .card-back,
.result-card.revealed.prize .card-back { 
    background: linear-gradient(160deg, rgba(40, 10, 10, 0.95) 0%, rgba(16, 4, 4, 0.98) 100%);
    border-color: rgba(255, 107, 107, 0.55);
    box-shadow: 0 0 14px rgba(255, 107, 107, 0.12), inset 0 1px 0 rgba(255, 107, 107, 0.07);
}

.result-card.jackpot .card-back,
.result-card.revealed.jackpot .card-back { 
    background: linear-gradient(160deg, rgba(38, 30, 0, 0.97) 0%, rgba(16, 12, 0, 0.99) 100%);
    border-color: rgba(255, 210, 0, 0.7);
    box-shadow: 0 0 22px rgba(255, 200, 0, 0.2), 0 0 50px rgba(255, 160, 0, 0.07), inset 0 1px 0 rgba(255, 200, 0, 0.14);
    animation: jackpotPulse 1.5s ease-in-out infinite;
}

@keyframes jackpotPulse {
    0%, 100% { box-shadow: 0 0 14px rgba(255, 200, 0, 0.14); }
    50%       { box-shadow: 0 0 32px rgba(255, 200, 0, 0.35), 0 0 60px rgba(255, 160, 0, 0.14); }
}

.result-card.miss .card-back,
.result-card.loss .card-back,
.result-card.revealed.loss .card-back { 
    background: linear-gradient(160deg, rgba(14, 14, 14, 0.95) 0%, rgba(6, 6, 6, 0.98) 100%);
    border-color: rgba(80, 80, 80, 0.3);
}

.result-card.xp .card-back,
.result-card.revealed.xp .card-back { 
    background: linear-gradient(160deg, rgba(32, 28, 0, 0.95) 0%, rgba(13, 11, 0, 0.98) 100%);
    border-color: rgba(255, 215, 0, 0.5);
    animation: xpCardGlow 2s ease-in-out infinite;
}

@keyframes xpCardGlow {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.1); }
    50%       { box-shadow: 0 0 20px rgba(255, 215, 0, 0.25); }
}

.result-icon {
    font-size: 1.3rem;
    margin-bottom: 3px;
}

.result-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.2;
    word-break: break-word;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Color-coded labels */
.result-card.wn .result-label { color: var(--brand-primary); }
.result-card.raffle .result-label,
.result-card.ticket .result-label { color: var(--brand-secondary); }
.result-card.prize .result-label { color: #ff6b6b; }
.result-card.jackpot .result-label { color: #ffd700; }
.result-card.loss .result-label,
.result-card.miss .result-label { color: rgba(255, 255, 255, 0.5); font-style: italic; }
.result-card.xp .result-label { color: #ffd700; }

/* Mini Claim Button - Modern style */
.mini-claim-btn {
    margin-top: 4px;
    font-size: 0.55rem;
    padding: 3px 8px;
    background: rgba(var(--brand-secondary-rgb), 0.3);
    border: 1px solid var(--brand-secondary);
    border-radius: 4px;
    color: var(--brand-secondary);
    cursor: pointer;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.mini-claim-btn:hover {
    background: var(--brand-secondary);
    color: #000;
    box-shadow: 0 0 10px rgba(var(--brand-secondary-rgb), 0.4);
}

.claimed-badge {
    margin-top: 4px;
    font-size: 0.55rem;
    color: var(--brand-primary);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Actions Footer - Modern subtle style */
.batch-footer,
.batch-actions {
    padding: 14px 20px;
    border-top: 1px solid rgba(var(--brand-secondary-rgb), 0.2);
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-shrink: 0; /* never let footer be squeezed out by the grid */
}

.reveal-all-btn, .close-batch-btn {
    padding: 10px 24px;
    border-radius: 8px;
    font-family: var(--font-display);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.reveal-all-btn {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.reveal-all-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
}

.reveal-all-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.close-batch-btn {
    background: rgba(var(--brand-secondary-rgb), 0.2);
    color: var(--brand-secondary);
    border: 1px solid var(--brand-secondary);
    box-shadow: 0 0 15px rgba(var(--brand-secondary-rgb), 0.2);
}

.close-batch-btn:hover {
    background: var(--brand-secondary);
    color: #000;
    box-shadow: 0 0 25px rgba(var(--brand-secondary-rgb), 0.4);
    transform: translateY(-1px);
}

/* Warning Overlay (Unclaimed Prizes) - Modern style */
.warning-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    animation: fadeIn 0.2s;
    backdrop-filter: blur(4px);
}

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

.warning-box {
    background: rgba(40, 0, 0, 0.9);
    border: 1px solid rgba(255, 100, 100, 0.5);
    padding: 24px;
    border-radius: 12px;
    text-align: center;
    max-width: 80%;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.2);
}

.warning-box h3 { 
    color: #ff6b6b; 
    margin: 0 0 12px 0;
    font-family: var(--font-display);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.warning-box p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    margin: 0 0 16px 0;
}

.warning-actions { 
    display: flex; 
    gap: 12px; 
    justify-content: center; 
}

.warn-btn {
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.warn-btn.back { 
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
}

.warn-btn.back:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.warn-btn.confirm { 
    background: rgba(255, 100, 100, 0.2);
    border: 1px solid rgba(255, 100, 100, 0.5);
    color: #ff6b6b;
}

.warn-btn.confirm:hover {
    background: #ff6b6b;
    color: #000;
}

/* Mobile Adjustments */
@media (max-width: 640px) {
    .batch-results-modal {
        max-width: 95%;
        max-height: 90vh;       /* fallback */
        max-height: 85dvh;      /* dvh excludes browser chrome (address bar etc.) */
        border-radius: 12px;
    }
    
    .batch-header {
        padding: 10px 14px;
        padding-right: 45px;
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    
    .batch-header h2 {
        font-size: 0.9rem;
    }
    
    .batch-summary-stats {
        justify-content: center;
        width: 100%;
    }
    
    .modal-close-x {
        top: 8px;
        right: 8px;
        width: 28px;
        height: 28px;
    }
    
    .batch-grid {
        padding: 10px;
        gap: 7px;
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    }
    
    .result-card {
        aspect-ratio: 3/4;
    }
    
    .result-icon {
        font-size: 1.1rem;
        margin-bottom: 2px;
    }
    
    .result-label {
        font-size: 0.55rem;
    }
    
    .mini-claim-btn {
        font-size: 0.5rem;
        padding: 2px 6px;
    }
    
    .batch-footer,
    .batch-actions {
        padding: 10px 14px;
        gap: 10px;
    }
    
    .reveal-all-btn, .close-batch-btn {
        padding: 8px 18px;
        font-size: 0.75rem;
    }
}

/* =================================================================
   MOBILE PERFORMANCE
   On mobile, simultaneous animations on 10-25 cards plus the
   ambient background particles causes jank. Disable non-essential
   looping animations inside the modal on touch devices.
   The flip animation (scaleX) is kept — it's the key interaction.
   ================================================================= */
@media (max-width: 640px) {
    /* Kill looping card-front animations — shimmer sweep and inner pulse */
    .card-front::before,
    .card-front::after {
        animation: none;
    }

    /* Kill mystery emblem pulse */
    .mystery-icon {
        animation: none;
    }

    /* Kill XP and jackpot card glow loops */
    .result-card.xp .card-back,
    .result-card.revealed.xp .card-back {
        animation: none;
    }

    .result-card.jackpot .card-back,
    .result-card.revealed.jackpot .card-back {
        animation: none;
        /* Keep the bright border so jackpot still stands out */
        box-shadow: 0 0 20px rgba(255, 200, 0, 0.25);
    }

    /* Promote card-inner to its own GPU layer to keep flip smooth */
    .card-inner {
        will-change: transform;
    }

    /* Shorten flip duration slightly on mobile for snappier feel */
    .card-front {
        transition: transform 0.18s ease-in 0s, visibility 0s linear 0.18s;
    }
    .card-back {
        transition: transform 0.18s ease-out 0.18s;
    }
    .result-card.revealed .card-front {
        transition: transform 0.18s ease-in 0s, visibility 0s linear 0.18s;
    }
    .result-card.revealed .card-back {
        transition: transform 0.18s ease-out 0.18s, visibility 0s linear 0.18s;
    }
}