/* TCG Content Page Styles */

/* Import Loot styles for consistency if needed, but we'll define specific overrides here */
/* Note: Link loot.css in the HTML before this file */

body.tcg-page,
body.tcg-page.theme-mtg {
    background-color: transparent !important;
    background-image: none !important;
    background-size: cover !important;
    background-position: center !important;
    background-attachment: fixed !important;
    background-repeat: no-repeat !important;
    color: #e0e0e0 !important;
    min-height: 100vh !important;
    font-family: 'Cinzel', serif !important;
    /* Overriding MTG fonts */
    overflow-x: hidden;
}

/* Custom TCG Arcane Glows */
body.tcg-page .glow-1 {
    background: radial-gradient(circle, rgba(212, 175, 55, 0.2) 0%, rgba(212, 175, 55, 0) 70%);
    /* Gold Arcane */
}

body.tcg-page .glow-2 {
    background: radial-gradient(circle, rgba(147, 51, 234, 0.2) 0%, rgba(147, 51, 234, 0) 70%);
    /* Deep Purple Arcane */
}

/* Force-hide MTG specific layers if they exist */
body.tcg-page .mtg-video-bg,
body.tcg-page .mtg-video-overlay {
    display: none !important;
}

/* Overlay to darken background for readability if needed */
body.tcg-page::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: -1;
    pointer-events: none;
}

/* Show all content - battle is just a section now */
.tcg-page .tcg-background-glow,
.tcg-page .tcg-particles {
    display: none !important;
}

/* Ensure header container is visible for the Nav */
.tcg-page #header-include {
    display: block !important;
}

/* Hide the logo header specifically on TCG page (since we have TCG Realm header) */
.tcg-page .site-header {
    display: none !important;
}

.tcg-container {
    position: relative;
    z-index: 10;
    padding: 0;
    /* Removed padding to allow sections to be full width */
    width: 100%;
    max-width: 100%;
}

body.tcg-page {
    background: #000 !important;
    overflow-x: hidden !important;
    /* Strictly lock horizontal scroll */
    overflow-y: auto;
    padding: 0 !important;
    /* Ensure no mobile padding from global styles */
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Force-remove the global footer spacer from styles.css */
body.tcg-page::after {
    display: none !important;
    content: none !important;
    height: 0 !important;
}

.tcg-container {
    position: relative;
    z-index: 10;
    padding: 0;
    width: 100%;
    max-width: 100%;
    margin: 0;
    overflow-x: hidden;
}

.tcg-title {
    display: none;
    /* Title is now in the center divider */
}

@keyframes title-shimmer {
    to {
        background-position: 200% center;
    }
}

/* Card Interaction Sparks */
.card-sparkle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 0 10px #fff, 0 0 20px #ffd700;
    animation: sparkle-fade 0.8s ease-out forwards;
}

@keyframes sparkle-fade {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

.tcg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2.5rem;
    padding: 1rem;
    perspective: 1000px;
    /* For 3D card effects */
}

/* Card Design */
.tcg-card {
    /* Dimensions & Scaling */
    aspect-ratio: 0.714;
    /* Standard MTG Card Ratio */

    /* Theme Variables Definition (Defaults) */
    --frame-bg: #d1c8b3;
    --inner-border: #a9a9a9;
    --text-box-bg: rgba(255, 255, 255, 0.9);
    --border-color: #171314;

    font-family: "Goudy Old Style", "Garamond", serif;
    background: var(--border-color);
    /* Outer Black Border */
    border-radius: 14px;
    padding: 10px;
    /* The black border thickness */
    position: relative;
    overflow: hidden;
    transition: transform 0.1s ease-out, box-shadow 0.3s ease, border-color 0.3s ease;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    height: 100%;
    transform-style: preserve-3d;
    will-change: transform, box-shadow;
    will-change: transform, box-shadow;
    opacity: 0;
}

/* Color Identity Overrides */
/* WHITE */
.tcg-card.mtg-white {
    --frame-bg: linear-gradient(135deg, #e6e6e6 0%, #f9faf4 50%, #dcdcdc 100%);
    --inner-border: #fff;
    --text-box-bg: rgba(249, 250, 244, 0.92);
}

/* BLUE */
.tcg-card.mtg-blue {
    --frame-bg: linear-gradient(135deg, #b0c4de 0%, #c1d7e9 50%, #aab7c4 100%);
    --inner-border: #0e68ab;
    --text-box-bg: rgba(193, 215, 233, 0.92);
}

/* BLACK */
.tcg-card.mtg-black {
    --frame-bg: url('https://www.transparenttextures.com/patterns/black-scales.png'), linear-gradient(135deg, #595552 0%, #2f2f2f 100%);
    --inner-border: #150b00;
    --text-box-bg: rgba(200, 190, 190, 0.92);
    color: #000;
}

/* RED */
.tcg-card.mtg-red {
    --frame-bg: linear-gradient(135deg, #f08080 0%, #e49977 50%, #cd5c5c 100%);
    --inner-border: #d3202a;
    --text-box-bg: rgba(245, 220, 210, 0.92);
}

/* GREEN */
.tcg-card.mtg-green {
    --frame-bg: linear-gradient(135deg, #8fbc8f 0%, #c4d3ca 50%, #556b2f 100%);
    --inner-border: #00733e;
    --text-box-bg: rgba(210, 230, 215, 0.92);
}

/* Card Rarity Borders/Glows (Refined) */
.tcg-card:hover {
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8), 0 0 20px rgba(255, 215, 0, 0.4);
    border-color: #ffd700;
    z-index: 10;
}

/* Dealing Animation */
.tcg-card.dealt {
    animation: card-deal-in 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes card-deal-in {
    0% {
        opacity: 0;
        transform: translateY(100px) rotateX(45deg) scale(0.8);
    }

    100% {
        opacity: 1;
        transform: translateY(0) rotateX(0) scale(1);
    }
}

/* Holographic / Foil Effect */
.tcg-card.foil::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(125deg,
            transparent 0%,
            rgba(255, 255, 255, 0.05) 30%,
            rgba(255, 255, 255, 0.12) 50%,
            rgba(255, 255, 255, 0.05) 70%,
            transparent 100%);
    background-size: 200% 200%;
    opacity: 0.4;
    pointer-events: none;
    z-index: 2;
}

@keyframes foil-shine {
    0% {
        background-position: -200% 0%;
    }

    100% {
        background-position: 200% 0%;
    }
}

/* Dynamic Shine Layer (Controlled by JS) */
.tcg-card .shine {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
            rgba(255, 255, 255, 0.15) 0%,
            transparent 60%);
    pointer-events: none;
    z-index: 3;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tcg-card:hover .shine {
    opacity: 1;
}

/* Rarity Glows (ONLY for glow, not frame backgrounds) */
.tcg-card.rarity-legendary {
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
    border-color: #ffd700 !important;
}

.tcg-card.rarity-epic {
    box-shadow: 0 0 20px rgba(163, 53, 238, 0.4);
    border-color: #a335ee !important;
}

.tcg-card.rarity-rare {
    box-shadow: 0 0 20px rgba(0, 112, 221, 0.4);
    border-color: #0070dd !important;
}

.tcg-card.rarity-common {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

/* Color Identity Overrides (HIGH SPECIFICITY) */
.tcg-card.mtg-white {
    --frame-bg: linear-gradient(135deg, #e6e6e6 0%, #f9faf4 50%, #dcdcdc 100%);
    --inner-border: #fff;
    --text-box-bg: rgba(249, 250, 244, 0.95);
}

.tcg-card.mtg-blue {
    --frame-bg: linear-gradient(135deg, #b0c4de 0%, #c1d7e9 50%, #aab7c4 100%);
    --inner-border: #0e68ab;
    --text-box-bg: rgba(193, 215, 233, 0.95);
}

.tcg-card.mtg-black {
    --frame-bg: url('https://www.transparenttextures.com/patterns/black-scales.png'), linear-gradient(135deg, #595552 0%, #2f2f2f 100%);
    --inner-border: #150b00;
    --text-box-bg: rgba(200, 190, 190, 0.95);
}

.tcg-card.mtg-red {
    --frame-bg: linear-gradient(135deg, #f08080 0%, #e49977 50%, #cd5c5c 100%);
    --inner-border: #d3202a;
    --text-box-bg: rgba(245, 220, 210, 0.95);
}

.tcg-card.mtg-green {
    --frame-bg: linear-gradient(135deg, #8fbc8f 0%, #c4d3ca 50%, #556b2f 100%);
    --inner-border: #00733e;
    --text-box-bg: rgba(210, 230, 215, 0.95);
}

.tcg-card.mtg-gold {
    --frame-bg: linear-gradient(135deg, #b8860b 0%, #ffdf00 40%, #dab522 60%, #b8860b 100%);
    --inner-border: #f0e68c;
    --text-box-bg: rgba(255, 245, 230, 0.95);
}

/* ARTIFACT */
.tcg-card.mtg-artifact {
    --frame-bg: linear-gradient(135deg, #a9a9a9 0%, #d3d3d3 50%, #808080 100%);
    --inner-border: #444;
    --text-box-bg: rgba(240, 240, 240, 0.95);
}

/* Inner Frame (The "Art" box + text box container) */
/* Inner Frame */
.card-frame {
    flex: 1;
    background: var(--frame-bg);
    border: 3px solid var(--inner-border);
    border-radius: 8px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
}

/* Card Header (Title & Mana/Cost) */
/* Card Header (Title & Mana/Cost) */
.card-header {
    background: rgba(255, 255, 255, 0.85);
    border: 2px solid #555;
    border-radius: 5px;
    padding: 3px 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

.card-title {
    font-family: 'Goudy Old Style', serif;
    font-size: 0.95rem;
    font-weight: 900;
    color: #000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 8px;
    letter-spacing: 0.5px;
}

.card-cost {
    background: #cbc2c0;
    color: #111;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    border: 1px solid #555;
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
}

/* Card Art (Video Thumbnail) */
.card-art-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border: 2px solid #222;
    margin-bottom: 4px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.8);
    z-index: 1;
}

.card-art {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.tcg-card:hover .card-art {
    transform: scale(1.1);
}

.play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s;
}

.tcg-card:hover .play-overlay {
    opacity: 1;
}

.play-icon {
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #ffd700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px #ffd700;
}

.play-triangle {
    width: 0;
    height: 0;
    border-left: 16px solid #ffd700;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    margin-left: 4px;
}

/* Card Type Line (Middle bar) */
.card-type-line {
    background: rgba(255, 255, 255, 0.85);
    border: 2px solid #555;
    border-radius: 5px;
    padding: 3px 8px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 2;
    font-weight: bold;
    color: #000;
}

.card-type {
    font-family: 'Goudy Old Style', serif;
    font-size: 0.8rem;
    color: #000;
    text-transform: none;
}

.card-set-icon {
    color: #ffd700;
    font-size: 1rem;
}

/* Card Text Box (Description) */
.card-text-box {
    background: var(--text-box-bg);
    border: 2px solid #555;
    padding: 8px;
    flex: 1;
    font-family: 'Crimson Text', serif;
    font-size: 0.9rem;
    line-height: 1.3;
    color: #111;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
}

.holofoil-stamp {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, #fff 0%, #d1d1d1 40%, #8a8a8a 100%);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    border: 1px solid #666;
    z-index: 10;
    opacity: 0.8;
}

/* Power/Toughness (Loot Theme Style) */
.pt-box {
    position: absolute;
    bottom: -1px;
    right: -1px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #444;
    border-radius: 8px 0 6px 0;
    padding: 2px 10px;
    font-weight: 900;
    font-size: 1.1rem;
    font-family: "Goudy Old Style", serif;
    color: #000;
    box-shadow: -1px -1px 3px rgba(0, 0, 0, 0.3);
    z-index: 5;
    min-width: 50px;
    text-align: center;
}

.flavor-text {
    font-style: italic;
    color: #444;
    font-size: 0.75rem;
    margin-top: 5px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding-top: 4px;
    display: block;
}

/* Collector Info (Bottom Rim metadata) */
.card-collector-info {
    position: absolute;
    bottom: 2px;
    left: 12px;
    right: 12px;
    display: flex;
    justify-content: flex-start;
    /* Group to the left */
    gap: 15px;
    align-items: center;
    font-size: 0.65rem;
    /* Larger for readability */
    color: rgba(255, 255, 255, 0.7);
    /* Brighter for contrast */
    font-family: 'Segoe UI', Arial, sans-serif;
    text-transform: uppercase;
    z-index: 10;
    pointer-events: none;
}

/* Card Footer (Stats) Container - Now relative for Pt positioning */
.card-footer {
    position: relative;
    height: 25px;
    /* Space for P/T overlap */
    margin-top: auto;
}

/* Video Player Inline Override */
.card-art-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Pack Opening Experience */
.pack-opening-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    margin: 2rem 0;
    gap: 2rem;
}

.pack-wrapper {
    position: relative;
    width: 300px;
    height: 450px;
    perspective: 1000px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.pack-wrapper:hover {
    transform: scale(1.05);
}

.card-pack {
    position: absolute;
    width: 100%;
    height: 100%;
    /* No background on container, background goes on pieces */
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    overflow: visible;
    /* To allow fly-out */
    z-index: 50;
    transition: all 0.5s ease;
}

/* Assign backgrounds to pieces based on parent class */
.card-pack.modern .pack-left,
.card-pack.modern .pack-right {
    background-image: url('../assets/images/tcg/modern_pack.png') !important;
}

.card-pack.legacy .pack-left,
.card-pack.legacy .pack-right {
    background-image: url('../assets/images/tcg/legacy_pack.png') !important;
}

/* Ripping Effect */
.card-pack.ripping {
    animation: pack-shake-intense 0.8s ease-in-out infinite;
    filter: brightness(1.2) contrast(1.1);
}

.pack-tear-line {
    position: absolute;
    top: 0;
    left: 50%;
    width: 12px;
    height: 0;
    background: linear-gradient(to bottom, #fff, #ffd700, #fff, #ffd700);
    background-size: 100% 20px;
    box-shadow: 0 0 20px #fff, 0 0 40px #ffd700, 0 0 80px rgba(255, 215, 0, 0.5);
    transform: translateX(-50%);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    clip-path: polygon(50% 0%, 100% 2%, 20% 5%, 80% 8%, 10% 12%, 90% 15%, 30% 20%, 70% 25%, 20% 30%, 80% 35%, 50% 40%,
            100% 45%, 0% 50%, 100% 55%, 0% 60%, 100% 65%, 0% 70%, 100% 75%, 0% 80%, 100% 85%, 0% 90%, 100% 95%, 50% 100%);
}

.card-pack.ripping .pack-tear-line {
    animation: tear-down 0.4s ease-in forwards, tear-flicker 0.1s infinite alternate;
}

@keyframes tear-flicker {
    from {
        opacity: 0.8;
        transform: translateX(-50%) scaleX(1);
        filter: brightness(1);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) scaleX(1.3);
        filter: brightness(2);
    }
}

@keyframes tear-down {
    0% {
        height: 0;
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    100% {
        height: 100%;
        opacity: 1;
    }
}

@keyframes pack-shake-intense {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    10% {
        transform: translate(-2px, -2px) rotate(-2deg);
    }

    20% {
        transform: translate(2px, 2px) rotate(2deg);
    }

    30% {
        transform: translate(-3px, 1px) rotate(-3deg);
    }

    40% {
        transform: translate(3px, -1px) rotate(3deg);
    }

    50% {
        transform: translate(-1px, 2px) rotate(-1deg);
    }

    60% {
        transform: translate(1px, -2px) rotate(1deg);
    }

    70% {
        transform: translate(-2px, -1px) rotate(-2deg);
    }

    80% {
        transform: translate(2px, 1px) rotate(2deg);
    }

    90% {
        transform: translate(-1px, -1px) rotate(-1deg);
    }
}

.pack-left,
.pack-right {
    position: absolute;
    width: 51%;
    /* Slight overlap to hide the seam */
    height: 100%;
    background-size: 300px 450px;
    background-repeat: no-repeat;
    transition: transform 1.2s cubic-bezier(0.19, 1, 0.22, 1), opacity 1s ease;
    z-index: 51;
    pointer-events: none;
}

.pack-left {
    left: 0;
    background-position: left center;
    clip-path: polygon(0% 0%, 100% 0%,
            92% 5%, 100% 10%, 92% 15%, 100% 20%, 92% 25%, 100% 30%, 92% 35%, 100% 40%, 92% 45%, 100% 50%,
            92% 55%, 100% 60%, 92% 65%, 100% 70%, 92% 75%, 100% 80%, 92% 85%, 100% 90%, 92% 95%, 100% 100%,
            0% 100%);
}

.pack-right {
    right: 0;
    background-position: right center;
    clip-path: polygon(8% 0%, 100% 0%, 100% 100%, 8% 100%,
            0% 95%, 8% 90%, 0% 85%, 8% 80%, 0% 75%, 8% 70%, 0% 65%, 8% 60%, 0% 55%, 8% 50%,
            0% 45%, 8% 40%, 0% 35%, 8% 30%, 0% 25%, 8% 20%, 0% 15%, 8% 10%, 0% 5%);
}

.card-pack.opened .pack-left {
    transform: translateX(-100%) rotateY(-60deg) rotateZ(-10deg);
    opacity: 0;
}

.card-pack.opened .pack-right {
    transform: translateX(100%) rotateY(60deg) rotateZ(10deg);
    opacity: 0;
}

/* Dealing Animation (MTG Arena Style) */
.tcg-card {
    opacity: 0;
    will-change: transform, opacity;
}

.tcg-card.dealt {
    animation: card-fly-in 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes card-fly-in {
    0% {
        opacity: 0;
        transform:
            translate(var(--deal-from-x, 0), var(--deal-from-y, 0)) scale(0.5) rotateZ(20deg) rotateY(45deg);
    }

    60% {
        opacity: 1;
    }

    100% {
        opacity: 1;
        transform: translate(0, 0) scale(1) rotateZ(0) rotateY(0);
    }
}

.burst-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: white;
    z-index: 1000;
    pointer-events: none;
    animation: burst-flash-anim 0.8s ease-out forwards;
}

@keyframes burst-flash-anim {
    0% {
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

.magic-particle {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 999;
    mix-blend-mode: screen;
}

.pack-label-container {
    position: absolute;
    bottom: -70px;
    /* Move below the 450px pack */
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    pointer-events: none;
    /* Let clicks pass to the wrapper if needed, though they are inside it */
    z-index: 60;
}

.pack-label {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    /* Slightly smaller for better fit */
    color: #ffd700;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    background: rgba(0, 0, 0, 0.8);
    padding: 8px 20px;
    border-radius: 30px;
    border: 2px solid #ffd700;
    white-space: nowrap;
    /* Prevent wrapping */
    display: inline-block;
}

/* Grid reveal state */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2.5rem;
    padding: 1rem;
    perspective: 1000px;
    margin: 0 auto;
    opacity: 0;
    /* Starts hidden */
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.video-grid.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .tcg-grid {
        grid-template-columns: 1fr;
    }

    .tcg-title {
        font-size: 2.2rem;
    }

    .pack-wrapper {
        width: 200px;
        height: 300px;
    }

    .pack-top,
    .pack-bottom {
        background-size: 200px 300px;
    }
}

/* Mana and Symbols */
.mana-cost {
    display: flex;
    align-items: center;
    gap: 2px;
}

.ms {
    font-family: 'Mana' !important;
    /* Explicitly set the font family */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    font-size: 0.9rem !important;
    width: 1.3rem;
    /* Slightly larger */
    height: 1.3rem;
    line-height: 1.3rem;
    text-align: center;
    border-radius: 50%;
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
    opacity: 1 !important;
    font-weight: normal;
    /* Font handles boldness usually */
}

.ms-w {
    background-color: #f8e7b9;
    color: #111 !important;
}

.ms-u {
    background-color: #aae0fa;
    color: #111 !important;
}

.ms-b {
    background-color: #cbc2bf;
    color: #111 !important;
}

.ms-r {
    background-color: #f9aa8f;
    color: #111 !important;
}

.ms-g {
    background-color: #9bd3ae;
    color: #111 !important;
}

.ms-cost,
.ms-c {
    background-color: #cbc2c0 !important;
    color: #111 !important;
    border: 1px solid #777;
}

.ms-inline {
    width: 1rem;
    height: 1rem;
    line-height: 1;
    font-size: 0.8rem !important;
    margin: 0 1px;
    display: inline-flex;
    vertical-align: middle;
    position: relative;
    top: -1px;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    font-family: 'Mana', sans-serif !important;
}

.ms-inline.ms-cost {
    background-color: #cbc2c0 !important;
    color: #111 !important;
    border-radius: 50%;
    width: 1.1rem;
    height: 1.1rem;
    font-size: 0.7rem !important;
    box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2) !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ms-t {
    background: transparent !important;
}

/* --- Battle Background Visuals (Versus Mode) --- */
#battle-background {
    position: relative;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    /* Center relative to screen width */
    min-height: 600px;
    height: auto;
    z-index: 5;
    overflow: hidden;
    /* Prevent battle elements from leaking out */
    background: #000;
}

/* TCG Realm Page Header - Holographic Foil Edition */
.tcg-realm-header {
    width: 100%;
    text-align: center;
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 8px;
    padding: 20px 0;
    position: relative;
    z-index: 100;
    color: #fff;
    background: #000;
    overflow: hidden;
    border-bottom: 2px solid #ffd700;
}

.tcg-realm-header::before {
    content: 'TCG Realm';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(110deg,
            #ff0000 0%, #ff7f00 20%, #ffff00 40%, #00ff00 60%,
            #00ffff 80%, #0000ff 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: foil-shimmer 6s linear infinite;
    z-index: 101;
    pointer-events: none;
}

.tcg-realm-header::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg,
            rgba(255, 255, 255, 0) 45%,
            rgba(255, 255, 255, 0.4) 50%,
            rgba(255, 255, 255, 0) 55%);
    animation: foil-glint 3s infinite;
    z-index: 102;
    pointer-events: none;
}

@keyframes foil-shimmer {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 150% 50%;
    }
}

@keyframes foil-glow {
    from {
        text-shadow: 0 0 10px rgba(255, 215, 0, 0.3), 0 0 20px rgba(255, 255, 255, 0.2);
    }

    to {
        text-shadow: 0 0 20px rgba(255, 215, 0, 0.7), 0 0 40px rgba(255, 255, 0, 0.5);
    }
}

@keyframes foil-glint {
    0% {
        transform: translateX(-100%) translateY(-100%);
    }

    100% {
        transform: translateX(100%) translateY(100%);
    }
}

.battle-scene {
    width: 100%;
    min-height: 600px;
    /* Reduced from 800px */
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
    /* Full width children */
    padding: 10px 20px;
    opacity: 1;
    z-index: 1;
    position: relative;
}

/* Responsive Scaling for Contained Layout */
@media (max-width: 1200px) {
    #battle-background {
        height: 600px;
    }
}

@media (max-width: 900px) {
    #battle-background {
        height: 550px;
    }
}

/* The Floor - Board Background */
.battle-scene::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('../assets/board_zendikar.png') no-repeat center center;
    background-size: 100% 100%;
    /* Stretch to fit without cropping */
    z-index: -1;
    opacity: 0.8;
    filter: brightness(0.7);
}

/* Board Themes based on Mana */
.battle-scene.board-white::before {
    background-image: url('../assets/board_white.png');
}

.battle-scene.board-blue::before {
    background-image: url('../assets/board_blue.png');
}

.battle-scene.board-black::before {
    background-image: url('../assets/board_black.png');
}

.battle-scene.board-red::before {
    background-image: url('../assets/board_red.png');
}

.battle-scene.board-green::before {
    background-image: url('../assets/board_green.png');
}

.battle-scene.board-zendikar::before {
    background-image: url('../assets/board_zendikar.png');
}

.battle-scene.board-gothic::before {
    background-image: url('../assets/board_black.png');
}

.battle-scene.board-fire::before {
    background-image: url('../assets/board_red.png');
}

.battle-scene.board-nature::before {
    background-image: url('../assets/board_green.png');
}

.battle-scene.board-celestial::before {
    background-image: url('../assets/board_white.png');
}

.battle-scene.board-oceanic::before {
    background-image: url('../assets/board_blue.png');
}

.battle-scene.board-wasteland::before {
    background-image: url('../assets/board_red.png');
}

.battle-scene.board-icy::before {
    background-image: url('../assets/board_blue.png');
}

.battle-scene.board-royal::before {
    background-image: url('../assets/board_white.png');
}

.battle-scene.board-cyber::before {
    background-image: url('../assets/board_black.png');
}

/* --- HEAD-TO-HEAD SIDE-BY-SIDE LAYOUT --- */

/* --- HEAD-TO-HEAD HORIZONTAL LAYOUT --- */

/* --- MTG ARENA STYLE TOP-BOTTOM LAYOUT --- */

/* COMMON ZONE STYLES */
.opponent-zone,
.player-zone {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
}

/* Hand Row - Contains the hand-zone, spans full width */
.hand-row {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 130px;
    /* Taller for card visibility */
    padding: 5px;
}

/* Play Row - Avatar, Mana, Battlefield, Graveyard in a horizontal line */
.play-row {
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 15px;
    padding: 10px 15px;
    min-height: 140px;
    /* Taller for card visibility */
}

/* Center Divider - Visual separator with title */
.center-divider {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 0;
    margin: 5px 0;
    flex-shrink: 0;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 215, 0, 0.2) 20%,
            rgba(255, 215, 0, 0.3) 50%,
            rgba(255, 215, 0, 0.2) 80%,
            transparent 100%);
    border-top: 1px solid rgba(255, 215, 0, 0.3);
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
}

.divider-title {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    color: #ffd700;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5), 1px 1px 2px #000;
}

/* Internal Layouts */
.battlefield-zone {
    flex: 1;
    /* Take remaining space */
    min-height: 100px;
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    /* Left to right */
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.mana-zone {
    width: 200px;
    /* Fixed width for lands */
    flex-shrink: 0;
    min-height: 80px;
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 4px;
    flex-wrap: wrap;
    padding: 5px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 6px;
}

/* Graveyard Zone */
.graveyard-zone {
    width: 70px;
    height: 95px;
    border: 2px dashed rgba(128, 0, 128, 0.5);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    box-shadow: inset 0 0 15px rgba(128, 0, 128, 0.3);
    z-index: 100;
    /* Above other elements */
    flex-shrink: 0;
}

.graveyard-zone::after {
    content: '☠';
    font-size: 1.2rem;
    color: rgba(128, 0, 128, 0.4);
    position: absolute;
    pointer-events: none;
}

.graveyard-zone .battle-card {
    position: absolute;
    transform: scale(0.7);
    opacity: 0.6;
}

/* Cards orientation - Top/Bottom */
.player-zone .battle-card {
    transform: rotate(0deg);
}

.opponent-zone .battle-card {
    transform: rotate(180deg);
}

/* Adjust Tapped State for Sideways Cards */
.player-zone .battle-card.tapped {
    transform: rotate(10deg) translateY(10px);
    /* Tap is usually 90deg but 10deg is subtle 'used' look or go full 90? MTG is 90 */
    transform: rotate(90deg);
}

.opponent-zone .battle-card.tapped {
    transform: rotate(calc(180deg + 90deg));
}

/* Hand Zone - Full width row of cards */
.hand-zone {
    width: 100%;
    min-height: 90px;
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    /* Left to right */
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 6px;
}

.hand-zone .battle-card {
    position: relative;
    /* Not absolute */
}

/* Discard Piles */
.discard-pile {
    position: absolute;
    width: 80px;
    height: 110px;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
}

/* We don't have explicit discard HTML in JS yet, but if added later */

/* Avatar - On the side of the battlefield */
.avatar-zone {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid #666;
    display: flex;
    flex-shrink: 0;
    justify-content: center;
    align-items: center;
    background: #111;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8), inset 0 0 10px rgba(0, 0, 0, 0.5);
    z-index: 60;
    transition: all 0.3s ease;
    overflow: hidden;
}

/* Highlight Active Turn Avatar */
.avatar-zone.active-turn {
    border-color: #ffd700;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.3);
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.life-counter {
    position: absolute;
    bottom: -10px;
    background: #000;
    border: 2px solid #ffd700;
    border-radius: 12px;
    padding: 2px 10px;
    font-size: 1.4rem;
    font-weight: 900;
    color: #fff;
    min-width: 40px;
    text-align: center;
    font-family: 'Cinzel', serif;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.8);
    z-index: 70;
}

/* Standard Battle Card visuals - View Only (No Hover) */
.battle-card {
    width: 80px;
    height: 112px;
    background: #151515;
    border: 2px solid #333;
    border-radius: 5px;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
    flex-shrink: 0;
    pointer-events: none;
    /* Disable all mouse interaction */
    cursor: default;
}

.battle-card-img {
    position: absolute;
    top: 16px;
    /* Smaller space for name */
    left: 2px;
    right: 2px;
    bottom: 16px;
    /* Smaller space for PT */
    width: calc(100% - 4px);
    height: calc(100% - 32px);
    object-fit: cover;
    border: 1px solid #000;
    background: #333;
}

.battle-card.land {
    width: 50px;
    height: 70px;
    /* Proper card aspect ratio */
    border: 1px solid #444;
}

.battle-card.land .battle-card-img {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    border-radius: 3px;
}

.battle-card.land .battle-card-name,
.battle-card.land .battle-card-pt {
    display: none;
    /* Hide text on lands */
}

.battle-card-name {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: #e0e0e0;
    border-bottom: 1px solid #000;
    color: #000;
    font-size: 0.65rem;
    /* Larger font */
    line-height: 20px;
    padding: 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Cinzel', serif;
    font-weight: bold;
    z-index: 5;
    border-radius: 4px 4px 0 0;
}

.battle-card-pt {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: #e0e0e0;
    border: 1px solid #000;
    color: #000;
    font-size: 0.75rem;
    font-weight: 900;
    padding: 1px 5px;
    border-radius: 4px;
    z-index: 10;
    font-family: serif;
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Animations & States */
.battle-card.tapped {
    filter: brightness(0.8);
    /* Transform handled above per zone */
}

/* Hand Zone Cards - View Only */
.hand-zone .battle-card {
    opacity: 0.9;
    /* Slightly dimmed to indicate inactive */
}

/* Attack Animations - Vertical for Arena style */
.player-zone .battle-card.attacking {
    z-index: 1000;
    animation: arena-attack-up 0.4s ease-in forwards;
}

.opponent-zone .battle-card.attacking {
    z-index: 1000;
    animation: arena-attack-down 0.4s ease-in forwards;
}

@keyframes arena-attack-up {
    0% {
        transform: scale(1);
    }

    50% {
        transform: translateY(-150px) scale(1.2);
    }

    100% {
        transform: translateY(-30px) scale(1);
    }

    /* Return to tapped pos approx */
}

@keyframes arena-attack-down {
    0% {
        transform: rotate(180deg) scale(1);
    }

    50% {
        transform: rotate(180deg) translateY(-150px) scale(1.2);
    }

    100% {
        transform: rotate(180deg) translateY(-30px) scale(1);
    }
}

.battle-card.hit {
    animation: mtg-hit 0.3s ease-out;
}

@keyframes mtg-hit {
    0% {
        filter: brightness(3) sepia(1) hue-rotate(-50deg);
        transform: scale(1.1);
    }

    100% {
        filter: brightness(1) sepia(0);
        transform: scale(1);
    }
}

.battle-card.dying {
    transition: all 0.5s;
    transform: scale(0) rotate(720deg);
    opacity: 0;
    filter: grayscale(1);
}

.avatar-zone.shake {
    animation: avatar-shake 0.4s ease-in-out;
    border-color: #ff3333;
    box-shadow: 0 0 35px #ff0000;
}

/* VFX */
.vfx-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2000;
}

.battle-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    pointer-events: none;
    animation: mtg-particle 0.6s ease-out forwards;
    box-shadow: 0 0 10px currentColor;
}

@keyframes mtg-particle {
    to {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

@keyframes avatar-shake {

    0%,
    100% {
        transform: translate(0, 0);
    }

    25% {
        transform: translate(-10px, 0);
    }

    75% {
        transform: translate(10px, 0);
    }
}

/* VS Poop Battle Section - Full Cinematic Rework */
.vs-battle-section {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    height: 300px;
    margin-top: -1px;
    /* Overlap slightly if needed to kill line gaps */
    margin-bottom: 0;
    background: #000;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-top: 4px solid #ffd700;
    border-bottom: 4px solid #ffd700;
    z-index: 50;
    box-sizing: border-box;
}

/* Diagonal Background Split */
.vs-battle-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #2b1f42 50%, #1a1a1a 50%);
    z-index: -1;
}

/* Speed Lines Overlay */
.speed-lines {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(90deg, transparent 95%, rgba(255, 255, 255, 0.1) 95%),
        linear-gradient(0deg, transparent 95%, rgba(255, 255, 255, 0.1) 95%);
    background-size: 50px 50px;
    opacity: 0.3;
    animation: speed-move 0.2s linear infinite;
    pointer-events: none;
}

@keyframes speed-move {
    from {
        transform: translate(0, 0);
    }

    to {
        transform: translate(50px, 50px);
    }
}

.vs-stage {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 600px;
    /* Narrowed the stage significantly */
    height: 200px;
    /* Scaled down height */
    position: relative;
    padding: 0 40px;
}

.vs-character {
    width: 150px;
    /* Ultra-scaled down characters */
    height: 150px;
    object-fit: contain;
    position: relative;
    filter: drop-shadow(0 0 15px rgba(0, 0, 0, 0.8));
    z-index: 2;
}

.vs-character.trainer {
    transform: translateX(-150%);
    opacity: 0;
}

.vs-battle-section.active .vs-character.trainer {
    animation: trainer-entrance 6s cubic-bezier(0.2, 0, 0.2, 1) forwards;
}

.vs-character.toilet {
    transform: translateX(150%);
    opacity: 0;
}

.vs-battle-section.active .vs-character.toilet {
    animation: toilet-entrance 6s cubic-bezier(0.2, 0, 0.2, 1) forwards;
}

.vs-logo-container {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0);
    z-index: 10;
    opacity: 0;
}

.vs-battle-section.active .vs-logo-container {
    animation: vs-drop-cinematic 6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.vs-logo-text {
    font-family: 'Cinzel', serif;
    font-size: 3rem;
    /* Ultra-scaled down VS text */
    font-weight: 900;
    color: #ffd700;
    font-style: italic;
    text-shadow:
        0 0 15px rgba(255, 215, 0, 0.8),
        4px 4px 0px #000;
}

/* Keyframe Animations for Battle Sequence */
@keyframes trainer-entrance {
    0% {
        transform: translateX(-150%) scale(1);
        opacity: 0;
    }

    15% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }

    40% {
        transform: translateX(-30px) scale(1);
        opacity: 1;
    }

    45% {
        transform: translateX(350px) scale(1.15);
        opacity: 1;
    }

    46% {
        transform: translateX(350px) scale(1.15);
        opacity: 0;
    }

    100% {
        transform: translateX(0) scale(0);
        opacity: 0;
    }
}

@keyframes toilet-entrance {
    0% {
        transform: translateX(150%) scale(1);
        opacity: 0;
    }

    15% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }

    40% {
        transform: translateX(30px) scale(1);
        opacity: 1;
    }

    45% {
        transform: translateX(-350px) scale(1.15);
        opacity: 1;
    }

    46% {
        transform: translateX(-350px) scale(1.15);
        opacity: 0;
    }

    100% {
        transform: translateX(0) scale(0);
        opacity: 0;
    }
}

@keyframes vs-drop-cinematic {
    0% {
        transform: translate(-50%, -50%) scale(5);
        opacity: 0;
    }

    15% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }

    40% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 1;
    }

    45% {
        transform: translate(-50%, -50%) scale(1.8);
        opacity: 1;
    }

    46% {
        transform: translate(-50%, -50%) scale(1.8);
        opacity: 0;
    }

    100% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
}

/* THE CLASH FLASH */
.clash-flash-cinematic {
    position: absolute;
    inset: 0;
    background: #fff;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
}

.vs-battle-section.active .clash-flash-cinematic {
    animation: clash-boom-final 6s linear forwards;
}

@keyframes clash-boom-final {

    0%,
    43% {
        opacity: 0;
    }

    45% {
        opacity: 1;
    }

    47% {
        opacity: 0;
    }

    48% {
        opacity: 0.8;
    }

    50% {
        opacity: 0;
    }

    100% {
        opacity: 0;
    }
}

/* REVEAL TEXT: POOP READING */
.reveal-container {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 60;
    pointer-events: none;
}

.reveal-container.active {
    pointer-events: auto;
}

.poop-reading-magical {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    /* Ultra-scaled down final text */
    font-weight: 900;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 8px;
    opacity: 0;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

/* Magical Writing Animation */
/* Magical Writing Animation - Delayed to appear AFTER battle chaos */
.reveal-container.active .poop-reading-magical {
    animation:
        magical-reveal-cinematic 2s cubic-bezier(0.19, 1, 0.22, 1) forwards 6s,
        holographic-foil-cinematic 4s linear infinite 8s;
}

@keyframes magical-reveal-cinematic {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
        filter: blur(10px);
        letter-spacing: 50px;
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0);
        letter-spacing: 15px;
        text-shadow:
            0 0 20px rgba(255, 215, 0, 0.8),
            0 0 40px rgba(255, 215, 0, 0.4),
            0 0 60px rgba(255, 215, 0, 0.2);
    }
}

@keyframes holographic-foil-cinematic {
    0% {
        color: #fff;
        text-shadow: 0 0 20px #ffd700;
    }

    25% {
        color: #ccf;
        text-shadow: 0 0 20px #00ffff;
    }

    50% {
        color: #fcf;
        text-shadow: 0 0 20px #ff00ff;
    }

    75% {
        color: #fcc;
        text-shadow: 0 0 20px #ff3300;
    }

    100% {
        color: #fff;
        text-shadow: 0 0 20px #ffd700;
    }
}

.poop-reading-magical:hover {
    transform: scale(1.1);
    letter-spacing: 20px;
    color: #ffd700;
}

/* TCG Portal Section & Interactive Litter */
/* TCG Portal Section & Interactive Litter */
.tcg-portal-section {
    position: relative;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    padding: 60px 20px;
    margin-top: 0;
    /* Flush with section above */
    margin-bottom: 0;
    /* No space below */
    border-radius: 0;
    /* No rounded corners for full width */
    background: radial-gradient(circle at center, rgba(13, 13, 13, 0.9) 0%, rgba(0, 0, 0, 1) 100%);
    box-shadow: 0 0 100px rgba(0, 0, 0, 0.8), inset 0 0 50px rgba(255, 215, 0, 0.05);
    border-top: none;
    /* Use border from section above */
    border-bottom: none;
    border-left: none;
    border-right: none;
    min-height: 100vh;
    /* Fill screen to prevent grey scroll area */
    box-sizing: border-box;
    overflow: hidden;
}

.tcg-litter-background {
    position: absolute;
    inset: 0;
    background-image: url('../assets/images/tcg/tcg_littered_background.png');
    background-size: cover;
    background-position: center;
    opacity: 0.25;
    mix-blend-mode: lighten;
    z-index: 1;
    pointer-events: none;
    filter: blur(4px) brightness(0.5) saturate(0.5);
    transition: opacity 1s ease, filter 1s ease;
}

.tcg-portal-section:hover .tcg-litter-background {
    opacity: 0.4;
    filter: blur(2px) brightness(0.7) saturate(1);
}

.tcg-litter-container {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: auto;
    overflow: hidden;
}

.litter-piece {
    position: absolute;
    pointer-events: none;
    user-select: none;
    transition: transform 0.1s linear, opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    will-change: transform, left, top;
}

.litter-piece svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 10px currentColor);
    animation: piece-float var(--float-duration, 10s) ease-in-out infinite alternate var(--float-delay, 0s),
        piece-rotate var(--rotation-speed, 20s) linear infinite;
}

@keyframes piece-float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(20px, 30px) scale(1.15);
    }
}

@keyframes piece-rotate {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Specific glows for different game types */
.litter-piece.pokemon {
    color: #ffcb05;
}

.litter-piece.mtg {
    color: #ff3333;
}

.litter-piece.yugioh {
    color: #ff8c00;
}

.litter-piece.lorcana {
    color: #9333ea;
}

.litter-piece.onepiece {
    color: #3b82f6;
}

.litter-piece.dragonball {
    color: #f97316;
}

.litter-piece.fab {
    color: #8b0000;
}

/* Interactive Hover state */
.tcg-portal-section.active .litter-piece {
    opacity: 0.05;
    filter: blur(10px);
}

.tcg-portal-section .pack-opening-area,
.tcg-portal-section .video-grid {
    position: relative;
    z-index: 10;
}

/* Subtle scanline overlay for premium feel */
.tcg-portal-section::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%),
        linear-gradient(90deg, rgba(255, 0, 0, 0.012), rgba(0, 255, 0, 0.005), rgba(0, 0, 255, 0.012));
    background-size: 100% 4px, 3px 100%;
    z-index: 3;
    pointer-events: none;
    opacity: 0.3;
}

.litter-piece.starwars {
    color: #2dd4bf;
}

/* Boost visibility of pieces */
.litter-piece svg {
    filter: drop-shadow(0 0 15px currentColor);
}

/* =========================================
   MOBILE RESPONSIVENESS - MINIMAL OVERRIDES
   ========================================= */

/* =========================================
   MOBILE RESPONSIVENESS - COMPREHENSIVE FIXES
   ========================================= */

@media (max-width: 900px) {
    #battle-background {
        width: 100%;
        margin-left: 0;
        min-height: auto;
        height: auto;
        overflow: hidden;
    }

    .battle-scene {
        min-height: auto;
        padding: 5px;
        width: 100%;
        box-sizing: border-box;
    }
}

@media (max-width: 600px) {

    /* --- GLOBAL CONTAINER FIXES --- */
    .tcg-container {
        padding: 0;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        overflow-x: hidden;
    }

    /* --- BATTLE SECTION RESIZING --- */
    #battle-background {
        width: 100vw !important;
        margin-left: calc(50% - 50vw) !important;
        height: auto;
        min-height: auto;
        display: block;
        padding-bottom: 20px;
    }

    .battle-scene {
        width: 100% !important;
        padding: 0;
        min-height: auto;
        gap: 0;
        transform: scale(0.9);
        /* Scale entire scene to fit safely */
        transform-origin: top center;
    }

    /* Resize Zones */
    .play-row {
        gap: 2px;
        padding: 2px;
        min-height: auto;
        justify-content: center;
        flex-wrap: nowrap;
        /* Prevent wrapping which causes vertical bloat */
    }

    .hand-row {
        min-height: 70px;
        padding: 0;
    }

    .hand-zone {
        min-height: 70px;
        gap: -15px;
        padding: 2px;
        justify-content: center;
    }

    /* Scale Down Fixed Elements */
    .avatar-zone {
        width: 40px;
        height: 40px;
        border-width: 2px;
    }

    .life-counter {
        font-size: 0.9rem;
        padding: 0 4px;
        min-width: 15px;
        bottom: -4px;
    }

    .graveyard-zone {
        width: 35px;
        height: 50px;
        border-width: 1px;
    }

    .mana-zone {
        width: 60px;
        min-height: 30px;
        gap: 1px;
    }

    .battlefield-zone {
        min-height: 70px;
        padding: 2px;
        gap: 2px;
    }

    /* Resize Cards */
    .battle-card {
        width: 40px;
        height: 56px;
        border-width: 1px;
    }

    .battle-card.land {
        width: 25px;
        height: 35px;
    }

    .battle-card-name {
        font-size: 0.45rem;
        height: 10px;
        line-height: 10px;
    }

    .battle-card-pt {
        font-size: 0.55rem;
        padding: 1px 2px;
    }

    .battle-card-img {
        top: 11px;
        bottom: 11px;
    }

    /* Adjust animations for smaller scale */
    @keyframes arena-attack-up {
        0% {
            transform: scale(1);
        }

        50% {
            transform: translateY(-50px) scale(1.1);
        }

        100% {
            transform: translateY(-10px) scale(1);
        }
    }

    @keyframes arena-attack-down {
        0% {
            transform: rotate(180deg) scale(1);
        }

        50% {
            transform: rotate(180deg) translateY(-50px) scale(1.1);
        }

        100% {
            transform: rotate(180deg) translateY(-10px) scale(1);
        }
    }

    /* Dividers */
    .center-divider {
        padding: 2px 0;
        margin: 2px 0;
    }

    .divider-title {
        font-size: 0.8rem;
        letter-spacing: 2px;
    }

    /* --- VS SECTION FIXES --- */
    .vs-battle-section {
        width: 100vw !important;
        margin-left: calc(50% - 50vw) !important;
        height: 160px;
        margin-top: 0;
        border-width: 2px;
        z-index: 20;
    }

    .vs-stage {
        height: 100%;
        padding: 0;
        max-width: 100%;
    }

    .vs-character {
        width: 65px;
        height: 65px;
    }

    .vs-logo-text {
        font-size: 1.4rem;
    }

    .poop-reading-magical {
        font-size: 0.85rem;
        letter-spacing: 2px;
    }

    /* --- PACK OPENING & PORTAL CORRECTIONS --- */
    .tcg-portal-section {
        width: 100vw !important;
        margin-left: calc(50% - 50vw) !important;
        padding: 20px 0;
        border-radius: 0;
        min-height: 100vh;
        margin-top: 0;
        box-shadow: none;
    }

    .pack-opening-area {
        min-height: 400px;
        margin: 0;
        gap: 0.5rem;
        padding: 10px;
    }

    .pack-wrapper {
        width: 150px;
        height: 225px;
    }

    .pack-left,
    .pack-right {
        background-size: 150px 225px !important;
    }

    .pack-label-container {
        bottom: -30px;
    }

    .pack-label {
        font-size: 0.75rem;
        padding: 3px 8px;
    }

    /* Grid & Videos */
    .tcg-grid.video-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
        width: 100%;
    }

    /* Litter Background Optimization */
    .tcg-litter-background {
        opacity: 0.2;
    }
}