/* ===================================================
 * PACK OPENING SYSTEM - 3D Karten Animation
 * Karten springen mit 3D-Spin aus dem Pack
 * =================================================== */

/* === PACK OPENING CONTAINER === */
.pack-opening-results {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, 
        rgba(139, 94, 60, 0.1) 0%, 
        rgba(0, 0, 0, 0.95) 100%);
    backdrop-filter: blur(25px) saturate(1.3);
    -webkit-backdrop-filter: blur(25px) saturate(1.3);
    z-index: 10002;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.8s ease-out;
    pointer-events: none;
    isolation: isolate; /* Erstellt neuen stacking context */
    
    /* Mobile Touch Optimierungen */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.pack-opening-results.active {
    opacity: 1;
    pointer-events: all;
}

/* === PACK WACKEL-ANIMATION === */
.pack-opening-container.shake {
    animation: packShake 0.6s ease-in-out infinite;
}

@keyframes packShake {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    10% { transform: translate(-2px, -1px) rotate(-0.5deg); }
    20% { transform: translate(2px, 1px) rotate(0.5deg); }
    30% { transform: translate(-1px, 2px) rotate(-0.3deg); }
    40% { transform: translate(1px, -2px) rotate(0.3deg); }
    50% { transform: translate(-2px, 1px) rotate(-0.2deg); }
    60% { transform: translate(2px, -1px) rotate(0.2deg); }
    70% { transform: translate(-1px, -2px) rotate(-0.4deg); }
    80% { transform: translate(1px, 2px) rotate(0.4deg); }
    90% { transform: translate(-2px, -1px) rotate(-0.1deg); }
}

/* Pack verschwindet nach dem Öffnen */
.pack-opening-container.vanish {
    animation: packVanish 1s ease-out forwards;
}

@keyframes packVanish {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.2);
    }
    100% {
        opacity: 0;
        transform: scale(0.3);
        pointer-events: none;
    }
}

/* === PACK OPENING REVEAL CONTAINER (festes 16:9 Format) === */
.cards-reveal-container {
    position: relative;
    
    width: 110%;
    right: 5%;
    /* Karten-Layout innerhalb des Containers */
    display: flex;
    align-items: flex-start;  /* Karten oben ausrichten statt center */
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;  /* Horizontaler Abstand */
    row-gap: 0rem;  /* Kein vertikaler Abstand zwischen Zeilen */
    padding-top: 2.5rem;  /* Mehr Platz für NEU Badge über Karten */
    box-sizing: border-box;
    overflow: visible;  /* Badge muss sichtbar sein */
    
    /* WICHTIG: Perspective für 3D-Effekte */
    perspective: 1000px;
    
    /* Zentriert auf der Seite */
    margin: 0 auto;
    transform-origin: center center;
}

/* === TRADING CARD (EXAKT Original EJS + Transform Scale) === */
.pack-opened-card {
    /* Original EJS Größe - EXAKTES Seitenverhältnis */
    width: 280px;
    height: 400px;
    /* Transform wird von spezifischeren Regeln gesetzt (siehe unten) */
    
    /* EXAKTE Original EJS Styles */
    position: relative;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.1) 0%, 
        rgba(255, 255, 255, 0.05) 100%);
    border: 1px solid var(--category-color, #FF6B6B);
    border-radius: 20px;
    overflow: visible;
    cursor: pointer;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: block;
    bottom: 2rem;
    padding: 0;
    
    /* Touch-Optimierungen für Mobile */
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

/* === NEU Badge für neue Karten === */
.card-new-badge {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: #FFD700;
    font-weight: 900;
    font-size: 1.6rem;
    letter-spacing: 6px;
    text-shadow: 
        0 0 15px rgba(255, 215, 0, 1),
        0 0 30px rgba(255, 215, 0, 0.9),
        0 0 45px rgba(255, 215, 0, 0.7),
        0 0 60px rgba(255, 215, 0, 0.5),
        0 0 80px rgba(255, 215, 0, 0.3),
        0 2px 6px rgba(0, 0, 0, 0.6);
    z-index: 1001;
    animation: textGlowStrong 2s ease-in-out infinite;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease-out;
    transform-style: flat;
    will-change: opacity;
}

/* Badge nur sichtbar wenn Karte aufgedeckt ist */
.pack-opened-card[data-flipped="true"] .card-new-badge {
    opacity: 1;
}

/* === DUPLIKAT Badge für bereits gesammelte Karten === */
.card-duplicate-badge {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    color: transparent;
    font-weight: 900;
    font-size: 1.2rem;
    letter-spacing: 2px;
    /* Minimale Konturen für Performance */
    text-shadow: 
        /* Füllfarbe */
        0 0 0 #ff60f6,
        /* Magenta Kontur - nur 4 Richtungen */
        -1.5px -1.5px 0 #a900a0,
        1.5px -1.5px 0 #a900a0,
        -1.5px 1.5px 0 #a900a0,
        1.5px 1.5px 0 #a900a0,
        /* Schatten */
        0 3px 4px rgba(0, 0, 0, 0.5);
    z-index: 1001;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease-out;
    transform-style: flat;
    will-change: opacity;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.pack-opened-card[data-flipped="true"] .card-duplicate-badge {
    opacity: 1;
}

/* Gem Icon im Badge */
.card-duplicate-badge .gem-icon {
    width: 1.4rem;
    height: 1.4rem;
    /* Kein Filter für bessere Performance */
}

/* Magenta Glow für Duplikat-Karten - nur nach Reveal */
.pack-opened-card[data-is-new="false"][data-flipped="true"] {
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.2),
        0 0 30px rgba(255, 0, 240, 0.3);
}

/* Duplikat-Karten komplett ausgrauen wenn aufgedeckt - mit Transition */
.pack-opened-card[data-is-new="false"] .card-front {
    transition: filter 1.5s ease-out, opacity 1.5s ease-out;
}

.pack-opened-card[data-is-new="false"][data-flipped="true"] .card-front {
    filter: grayscale(1) brightness(0.75);
    opacity: 0.6;
}

/* "Bereits freigeschaltet" Text unter Duplikat-Karten */
.card-already-unlocked {
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.5s ease-out 0.5s;
    pointer-events: none;
    z-index: 1000;
    text-shadow: 
        0 0 8px rgba(255, 255, 255, 0.6),
        0 2px 4px rgba(0, 0, 0, 0.7);
}

/* Zeige Text erst nach Reveal */
.pack-opened-card[data-flipped="true"] .card-already-unlocked {
    opacity: 1;
}

/* Deaktiviere Hover-Effekt für ausgegraute Duplikat-Karten */
.pack-opened-card[data-is-new="false"][data-flipped="true"]:hover .card-front {
    filter: grayscale(1) brightness(0.75) !important;
    opacity: 0.6 !important;
}

/* Clippy-Gem Konfetti Animation */
.gem-confetti-particle {
    position: absolute;
    pointer-events: none;
}

@keyframes gemExplosion {
    0% {
        transform: translate(-50%, -50%) scale(0.3) rotate(0deg);
        opacity: 1;
    }
    70% {
        opacity: 1;
    }
    100% {
        transform: translate(
            calc(var(--end-x) - 50%), 
            calc(var(--end-y) - 50%)
        ) scale(0.6) rotate(var(--rotation));
        opacity: 0;
    }
}

/* Stärkere Leucht-Animation für NEU Badges */
@keyframes textGlowStrong {
    0%, 100% {
        text-shadow: 
            0 0 15px rgba(255, 215, 0, 1),
            0 0 30px rgba(255, 215, 0, 0.9),
            0 0 45px rgba(255, 215, 0, 0.7),
            0 0 60px rgba(255, 215, 0, 0.5),
            0 0 80px rgba(255, 215, 0, 0.3),
            0 2px 6px rgba(0, 0, 0, 0.6);
        transform: translateX(-50%) scale(1);
    }
    50% {
        text-shadow: 
            0 0 25px rgba(255, 215, 0, 1),
            0 0 45px rgba(255, 215, 0, 1),
            0 0 65px rgba(255, 215, 0, 0.9),
            0 0 85px rgba(255, 215, 0, 0.7),
            0 0 110px rgba(255, 215, 0, 0.5),
            0 0 140px rgba(255, 215, 0, 0.3),
            0 2px 6px rgba(0, 0, 0, 0.6);
        transform: translateX(-50%) scale(1.12);
    }
}

/* Neue Karten leuchten */
.pack-opened-card.card-new {
    animation: cardNewGlow 2s ease-in-out infinite;
}

@keyframes cardNewGlow {
    0%, 100% {
        box-shadow: 
            0 8px 32px rgba(0, 0, 0, 0.2),
            0 0 40px rgba(255, 215, 0, 0.3);
        border-color: var(--category-color, #FF6B6B);
    }
    50% {
        box-shadow: 
            0 8px 32px rgba(0, 0, 0, 0.2),
            0 0 60px rgba(255, 215, 0, 0.6),
            0 0 80px rgba(255, 215, 0, 0.3);
        border-color: rgba(255, 215, 0, 0.8);
    }
}

/* Initial versteckt (nur wenn keine Animation läuft) */
.pack-opened-card:not(.animate-in):not([data-animation-complete="true"]) {
    opacity: 0;
    will-change: transform, opacity; /* Bereite Browser auf Animation vor */
}

/* Nach Animation: Stelle sicher dass scale 0.7 bleibt (außer bei Hover, Animation oder 3D-Effekt) */
.pack-opened-card[data-animation-complete="true"]:not(.card-hover):not(.card-idle-shake)[data-flipped="false"] {
    transform: scale(0.7) translateY(50px) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Für aufgedeckte Karten: Default scale 0.7, erlaube inline 3D transforms */
.pack-opened-card[data-flipped="true"]:not(.card-hover):not(.card-idle-shake):not(.card-3d-active) {
    transform: scale(0.7) translateY(50px) !important;
    transition: transform 0.3s ease-out !important;
}

/* Während 3D aktiv: KEINE Transition für instant response */
.pack-opened-card.card-3d-active {
    transition: none !important;
}

/* Hover Effect - scale 0.8 mit sanfter Transition */
.pack-opened-card.card-hover {
    transform: scale(0.8) translateY(50px) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === EPISCHE REVEAL ANIMATION === */
.pack-opened-card.card-epic-reveal {
    animation: epicReveal 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards !important;
    animation-name: epicReveal !important;
    animation-duration: 1.2s !important;
    animation-fill-mode: forwards !important;
    z-index: 1000 !important;
    position: relative !important;
    transform-style: preserve-3d !important;
    /* Performance-Optimierungen */
    transition: none !important;
    will-change: transform, filter, box-shadow;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Blitz-Effekte (Performance-optimiert mit will-change) */
.pack-opened-card.card-epic-reveal::before,
.pack-opened-card.card-epic-reveal::after {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: 22px;
    pointer-events: none;
    will-change: opacity;
}

/* Blitz 1 - Goldener Flash */
.pack-opened-card.card-epic-reveal::before {
    background: linear-gradient(135deg, 
        rgba(255, 215, 0, 0) 0%,
        rgba(255, 215, 0, 0.4) 50%,
        rgba(255, 215, 0, 0) 100%);
    animation: lightning1 1.2s ease-in-out;
}

/* Blitz 2 - Weißer Flash */
.pack-opened-card.card-epic-reveal::after {
    background: linear-gradient(45deg, 
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.6) 50%,
        rgba(255, 255, 255, 0) 100%);
    animation: lightning2 1.2s ease-in-out;
}

/* Blitz-Animation 1 - Goldener Blitz */
@keyframes lightning1 {
    0%, 20%, 40%, 60%, 80%, 100% {
        opacity: 0;
    }
    22%, 42% {
        opacity: 1;
    }
    24%, 44% {
        opacity: 0;
    }
}

/* Blitz-Animation 2 - Weißer Blitz (versetzt) */
@keyframes lightning2 {
    0%, 30%, 50%, 70%, 100% {
        opacity: 0;
    }
    32%, 52% {
        opacity: 0.8;
    }
    34%, 54% {
        opacity: 0;
    }
}

/* === FUNKEN-PARTIKEL === */
.card-spark-particle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: radial-gradient(circle, 
        rgba(255, 215, 0, 1) 0%,
        rgba(255, 140, 0, 1) 50%,
        rgba(255, 69, 0, 0.8) 100%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 999; /* HINTER der Karte (Karte hat z-index: 1000) */
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.8); /* Reduziert auf 1 Layer */
    animation: sparkExplosion 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    animation-delay: var(--delay, 0s);
    will-change: transform, opacity;
    backface-visibility: hidden;
}

@keyframes sparkExplosion {
    0% {
        transform: translate(-50%, -50%) 
                   rotate(var(--angle, 0deg)) 
                   translateX(-20px) 
                   translateZ(-50px)
                   scale(0.3);
        opacity: 0;
    }
    5% {
        opacity: 1;
        transform: translate(-50%, -50%) 
                   rotate(var(--angle, 0deg)) 
                   translateX(0px) 
                   translateZ(0px)
                   scale(1.2);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) 
                   rotate(var(--angle, 0deg)) 
                   translateX(40px) 
                   translateZ(20px)
                   scale(1);
    }
    60% {
        opacity: 0.6;
        transform: translate(-50%, -50%) 
                   rotate(var(--angle, 0deg)) 
                   translateX(var(--distance, 100px)) 
                   translateZ(30px)
                   scale(0.6);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) 
                   rotate(var(--angle, 0deg)) 
                   translateX(calc(var(--distance, 100px) * 1.8)) 
                   translateZ(40px)
                   scale(0.2);
    }
}

@keyframes epicReveal {
    0% {
        transform: scale(0.7) translateY(50px) rotateY(0deg);
        filter: brightness(1);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    }
    25% {
        transform: scale(0.85) translateY(30px) rotateY(90deg);
        filter: brightness(1.3);
        box-shadow: 0 20px 50px rgba(255, 215, 0, 0.3);
    }
    50% {
        transform: scale(1) translateY(0px) rotateY(180deg);
        filter: brightness(1.5);
        box-shadow: 0 25px 60px rgba(255, 215, 0, 0.4);
    }
    75% {
        transform: scale(0.9) translateY(20px) rotateY(270deg);
        filter: brightness(1.3);
        box-shadow: 0 20px 50px rgba(255, 215, 0, 0.3);
    }
    100% {
        transform: scale(0.7) translateY(50px) rotateY(360deg);
        filter: brightness(1.1);
        box-shadow: 0 12px 35px rgba(255, 215, 0, 0.2);
    }
}

/* 3D Transform Support für aufgedeckte Karten */
.pack-opened-card[data-flipped="true"] {
    transform-style: preserve-3d;
}

/* Parent Container für 3D Perspective */
.pack-opened-cards-grid {
    perspective: 1000px;
    transform-style: preserve-3d;
}

/* Karten-Animation beim Erscheinen */
/* Original Hover-Effekte aus cards.css */
.pack-opened-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--category-color, #FF6B6B), rgba(255,255,255,0.3), var(--category-color, #FF6B6B));
    border-radius: 18px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Hover-Effekte entfernt - werden durch 3D Mouse-Tracking überschrieben */
.pack-opened-card:hover::before {
    opacity: 0.25; /* Stark reduziert - nur subtiler Glow */
}

/* Deaktiviere Hover für ausgegraute Duplikat-Karten */
.pack-opened-card[data-is-new="false"][data-flipped="true"]:hover::before {
    opacity: 0 !important;
}

.pack-opened-card.animate-in {
    animation: cardSpinIn 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards !important;
    animation-fill-mode: forwards !important;
    will-change: transform, opacity;
    backface-visibility: hidden;
}

/* Nach Animation: Karte muss sichtbar bleiben */
.pack-opened-card[data-animation-complete="true"] {
    opacity: 1 !important;
}

@keyframes cardSpinIn {
    0% {
        opacity: 0;
        /* Alle Karten starten vom Container-Zentrum und sind winzig */
        transform: scale(0.05) translateY(0) rotateY(180deg);
    }
    30% {
        opacity: 0.7;
        /* Karten werden sichtbar, bewegen sich vom Zentrum weg */
        transform: scale(0.4) translateY(-30px) rotateY(90deg);
    }
    70% {
        opacity: 1;
        /* Karten erreichen fast ihre finale Größe */
        transform: scale(0.68) translateY(40px) rotateY(5deg);
    }
    100% {
        opacity: 1;
        /* Finale Position - komplett gerade OHNE jegliche Rotation */
        transform: scale(0.7) translateY(50px);
    }
}

/* === IDLE TEASER ANIMATION === */
.pack-opened-card.card-idle-shake {
    animation: idle-teaser 0.7s ease-in-out !important;
    animation-fill-mode: both !important;
    transform-origin: center center !important;
    will-change: transform, filter;
}

/* Kombinierte Teaser-Animation: Shake + Brightness (STÄRKER - MIT scale 0.7 + translateY) */
@keyframes idle-teaser {
    0%, 100% { 
        transform: scale(0.7) translateY(50px) translateX(0) rotateZ(0deg);
        filter: brightness(1);
    }
    10% { 
        transform: scale(0.7) translateY(50px) translateX(-5px) rotateZ(-2deg);
        filter: brightness(1.08);
    }
    20% { 
        transform: scale(0.7) translateY(50px) translateX(5px) rotateZ(2deg);
        filter: brightness(1.12);
    }
    30% { 
        transform: scale(0.7) translateY(50px) translateX(-4px) rotateZ(-1.5deg);
        filter: brightness(1.15);
    }
    40% { 
        transform: scale(0.7) translateY(50px) translateX(4px) rotateZ(1.5deg);
        filter: brightness(1.18);
    }
    50% { 
        transform: scale(0.7) translateY(50px) translateX(-3px) rotateZ(-1deg);
        filter: brightness(1.2);
    }
    60% { 
        transform: scale(0.7) translateY(50px) translateX(3px) rotateZ(1deg);
        filter: brightness(1.18);
    }
    70% { 
        transform: scale(0.7) translateY(50px) translateX(-2px) rotateZ(-0.5deg);
        filter: brightness(1.12);
    }
    80% { 
        transform: scale(0.7) translateY(50px) translateX(2px) rotateZ(0.5deg);
        filter: brightness(1.08);
    }
    90% { 
        transform: scale(0.7) translateY(50px) translateX(0) rotateZ(0deg);
        filter: brightness(1);
    }
}

/* Glow-Effekt während Idle-Animation */
.card-idle-shake .card-back {
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 0 30px rgba(255, 255, 255, 0.4),
        inset 0 0 20px rgba(255, 255, 255, 0.15);
    transition: box-shadow 0.3s ease-in-out;
}


/* Removed duplicate hover effects - using original cards.css hover */

/* === KARTEN-HEADER (EXAKT wie EJS - KEIN ABSTAND ZUM RAND!) === */
.pack-opened-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    background: linear-gradient(135deg, 
        rgba(var(--category-color-rgb, 255, 107, 107), 0.6) 0%, 
        rgba(var(--category-color-rgb, 255, 107, 107), 0.3) 30%,
        rgba(0, 0, 0, 0.4) 70%,
        rgba(var(--category-color-rgb, 255, 107, 107), 0.2) 100%);
    border-bottom: 2px solid rgba(var(--category-color-rgb, 255, 107, 107), 0.4);
    backdrop-filter: blur(5px);
    min-height: 52px;
    box-shadow: 
        0 2px 8px rgba(var(--category-color-rgb, 255, 107, 107), 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    margin-bottom: 0;
}

.pack-opened-card .card-streamer-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.pack-opened-card .card-status-icon {
    font-size: 1rem;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

/* === KARTEN-THUMBNAIL CONTAINER (EXAKT wie EJS!) === */
.pack-opened-card .card-thumbnail-container {
    padding: 0.5rem 0.5rem 0 0.5rem;
    border-left: 1px solid rgba(128, 128, 128, 0.4);
    border-right: 1px solid rgba(128, 128, 128, 0.4);
    background: rgba(var(--category-color-rgb, 255, 107, 107), 0.05);
}

.pack-opened-card .card-thumbnail {
    position: relative;
    width: 100%;
    height: 0;
    padding-top: 56.25%; /* 16:9 ratio (9/16 * 100) - EXAKT wie Original */
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, 
        rgba(0, 0, 0, 0.8) 0%, 
        rgba(0, 0, 0, 0.6) 100%);
}

.pack-opened-card .card-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.pack-opened-card .card-thumbnail:hover img {
    transform: scale(1.05);
}

.pack-opened-card .card-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.2rem;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.1) 0%, 
        rgba(255, 255, 255, 0.05) 100%);
    backdrop-filter: blur(5px);
}

/* === KARTEN-CONTENT (EXAKT wie EJS!) === */
.pack-opened-card .card-content {
    padding: 0.5rem 0.8rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(var(--category-color-rgb, 255, 107, 107), 0.05);
    border-left: 1px solid rgba(128, 128, 128, 0.4);
    border-right: 1px solid rgba(128, 128, 128, 0.4);
}

.pack-opened-card .card-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: rgba(var(--category-color-rgb, 255, 107, 107), 1);
    margin: 0;
    line-height: 1.3;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* .card-streamer entfernt - wird in Original EJS nicht verwendet */

.pack-opened-card .card-description {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.2);
    line-height: 1.5;
    flex: 1;
    margin: 0;
    font-style: italic;
}

/* === KARTEN-FOOTER (EXAKT wie EJS - KEIN ABSTAND ZUM RAND!) === */
.pack-opened-card .card-footer {
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, 
        rgba(var(--category-color-rgb, 255, 107, 107), 0.5) 0%, 
        rgba(var(--category-color-rgb, 255, 107, 107), 0.2) 30%,
        rgba(0, 0, 0, 0.3) 70%,
        rgba(var(--category-color-rgb, 255, 107, 107), 0.3) 100%);
    border-top: 2px solid rgba(var(--category-color-rgb, 255, 107, 107), 0.4);
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(5px);
    box-shadow: 
        0 -2px 8px rgba(var(--category-color-rgb, 255, 107, 107), 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.pack-opened-card .card-year-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pack-opened-card .card-position {
    font-size: 0.75rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 1);
    background: linear-gradient(135deg, 
        rgba(var(--category-color-rgb, 255, 107, 107), 0.8) 0%, 
        rgba(var(--category-color-rgb, 255, 107, 107), 0.6) 50%,
        rgba(var(--category-color-rgb, 255, 107, 107), 0.9) 100%);
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    border: 2px solid rgba(var(--category-color-rgb, 255, 107, 107), 0.6);
    box-shadow: 
        0 2px 8px rgba(var(--category-color-rgb, 255, 107, 107), 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* === CARD STATE STYLING (wie Original EJS) === */
/* Collected State - normal appearance */
.pack-opened-card.card-collected {
    background: linear-gradient(135deg, 
        rgba(var(--category-color-rgb, 255, 107, 107), 0.15) 0%, 
        rgba(var(--category-color-rgb, 255, 107, 107), 0.05) 100%);
    border: 1px solid var(--category-color, #FF6B6B);
}

/* Besitz-Indikator entfernt - war hässlich */

/* Not Collected State - dimmed with lock */
.pack-opened-card.card-not-collected {
    opacity: 0.5;
    filter: grayscale(0.8) brightness(0.7);
    border: 1px dashed rgba(255, 255, 255, 0.3);
}

.pack-opened-card.card-not-collected:hover {
    opacity: 0.7;
    filter: grayscale(0.6) brightness(0.8);
}

/* Schloss verschwindet beim Hover */
.pack-opened-card.card-not-collected:hover::before {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Text in nicht gesammelten Karten ist gedämpfter */
.pack-opened-card.card-not-collected .card-title {
    color: rgba(var(--category-color-rgb, 255, 107, 107), 0.5);
}

.pack-opened-card.card-not-collected .card-description {
    color: rgba(255, 255, 255, 0.3);
}

.pack-opened-card.card-not-collected .card-streamer-name {
    color: rgba(255, 255, 255, 0.4);
}

/* Schloss-Overlay für nicht gesammelte Karten */
.pack-opened-card.card-not-collected::before {
    content: '🔒';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.2);
    z-index: 10;
    pointer-events: none;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease;
}

/* Empty State */
.pack-opened-card.card-empty {
    opacity: 0.4;
    border-style: dashed;
    border-width: 2px;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.05) 0%, 
        rgba(255, 255, 255, 0.02) 100%);
}

.pack-opened-card.card-empty::after {
    content: '🔮';
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1rem;
    z-index: 2;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

/* === RARITY-SPECIFIC STYLING === */
.pack-opened-card[data-rarity="common"] {
    border-color: rgba(139, 94, 60, 0.6);
}

.pack-opened-card[data-rarity="uncommon"] {
    border-color: rgba(192, 192, 192, 0.6);
}

.pack-opened-card[data-rarity="rare"] {
    border-color: rgba(255, 215, 0, 0.6);
}

.pack-opened-card[data-rarity="epic"] {
    border-color: rgba(153, 102, 204, 0.6);
}

.pack-opened-card[data-rarity="heroic"] {
    border-color: rgba(0, 191, 255, 0.6);
}

.pack-opened-card[data-rarity="legendary"] {
    border-color: rgba(255, 165, 0, 0.6);
    box-shadow: 
        0 0 30px rgba(255, 165, 0, 0.3),
        inset 0 0 20px rgba(255, 165, 0, 0.1);
}

.pack-opened-card[data-rarity="mythic"] {
    border-color: rgba(224, 17, 95, 0.6);
    box-shadow: 
        0 0 30px rgba(224, 17, 95, 0.3),
        inset 0 0 20px rgba(224, 17, 95, 0.1);
}

.pack-opened-card[data-rarity="ancient"] {
    border-color: rgba(255, 0, 255, 0.6);
    box-shadow: 
        0 0 30px rgba(255, 0, 255, 0.3),
        inset 0 0 20px rgba(255, 0, 255, 0.1);
}

/* === 16:9 CONTAINER ÜBERSCHREIBT ALLE LAYOUTS === */
/* Alle Kartenanzahlen verwenden den gleichen 16:9 flex Container */
/* Die Karten arrangieren sich automatisch innerhalb des 16:9 Bereichs */

/* === RESPONSIVE SCALING (einfacher Transform Ansatz) === */
/* Container ist fest 1200x675px und wird nur skaliert */

@media (max-width: 1300px) {
    .cards-reveal-container {
        transform: scale(0.9);
    }
}

/* === RESPONSIVE DESIGN - MOBILE FIRST === */

/* Desktop: 1200px+ - Volle Größe */
@media (max-width: 1200px) {
    .cards-reveal-container {
        transform: scale(0.85);
        width: 100%;
        right: 0;
    }
}

/* Laptop: 1024px */
@media (max-width: 1024px) {
    .cards-reveal-container {
        transform: scale(0.75);
        gap: 0.4rem;
        padding-top: 0.3rem;
    }
}

/* Tablet Landscape: 900px */
@media (max-width: 900px) {
    .cards-reveal-container {
        transform: scale(0.65);
        gap: 0.3rem;
    }
}

/* Tablet Portrait: 768px */
@media (max-width: 768px) {
    .cards-reveal-container {
        transform: scale(0.48);
        width: 150%;
        right: 25%;
    }
    
    .pack-opened-card {
        /* Touch-optimierte Hover-Effekte */
        -webkit-tap-highlight-color: transparent;
    }
}

/* Mobile Large: 650px */
@media (max-width: 650px) {
    .cards-reveal-container {
        transform: scale(0.48);
        width: 150%;
        right: 25%;
    }
    
    .pack-opening-results {
        /* Verbesserte Touch-Navigation */
        touch-action: manipulation;
    }
}

/* Mobile Medium: 480px */
@media (max-width: 480px) {
    .cards-reveal-container {
        transform: scale(0.48);
        gap: 0.2rem;
    }
    
    .pack-opened-card {
        /* Optimierte Kartengröße für kleine Screens */
        width: 260px;
        height: 380px;
    }
}

/* Mobile Small: 390px (iPhone 14 Pro) */
@media (max-width: 390px) {
    .cards-reveal-container {
        transform: scale(0.38);
    }
}

/* Mobile Tiny: 360px */
@media (max-width: 360px) {
    .cards-reveal-container {
        transform: scale(0.35);
    }
}

/* Landscape Orientation für Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .cards-reveal-container {
        transform: scale(0.4);
        padding-top: 0.2rem;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
    }
    
    .pack-opening-results {
        align-items: flex-start;
    }
}

/* === TOUCH FEEDBACK FÜR MOBILE === */
@media (hover: none) and (pointer: coarse) {
    /* Active State für Touch-Geräte */
    .pack-opened-card:active {
        transform: scale(0.68) !important;
        transition: transform 0.1s ease;
    }
    
    .card-flippable:active {
        opacity: 0.9;
    }
    
    /* Deaktiviere Hover-Effekte auf Touch-Geräten */
    .pack-opened-card:hover {
        transform: none !important;
    }
}

/* === SCHLOSS WACKEL-ANIMATION === */
@keyframes lockShake {
    0% { transform: translateX(0) rotate(0deg); }
    15% { transform: translateX(-8px) rotate(-5deg); }
    30% { transform: translateX(8px) rotate(5deg); }
    45% { transform: translateX(-6px) rotate(-3deg); }
    60% { transform: translateX(6px) rotate(3deg); }
    75% { transform: translateX(-3px) rotate(-1deg); }
    90% { transform: translateX(3px) rotate(1deg); }
    100% { transform: translateX(0) rotate(0deg); }
}

.pack-lock img {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.pack-lock img:hover {
    transform: scale(1.1);
}

.pack-lock.shake img {
    animation: lockShake 0.6s ease-in-out;
}

/* === PACK OPENING RESULT HEADER === */
.pack-opening-header {
    position: absolute;
    top: 4rem; /* Tiefer platziert */
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 1;
}

/* Blur-Background hinter Titel */
.pack-title-blur-background {
    position: absolute;
    top: -20px;
    left: -80px;
    right: -80px;
    bottom: -10px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 25px;
    z-index: -1;
    pointer-events: none;
    
    /* Transparenz-Maske wie im Album */
    mask-image: 
        linear-gradient(to right,
            rgba(0,0,0,0) 0%,
            rgba(0,0,0,1) 15%,
            rgba(0,0,0,1) 85%,
            rgba(0,0,0,0) 100%),
        linear-gradient(to bottom,
            rgba(0,0,0,0) 0%,
            rgba(0,0,0,1) 20%,
            rgba(0,0,0,1) 80%,
            rgba(0,0,0,0) 100%);
    mask-composite: intersect;
    -webkit-mask-composite: destination-in;
}

.pack-opening-title {
    font-size: 2rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    margin: 0 0 0.5rem 0;
    opacity: 0;
    animation: titleFadeIn 1s ease-out 0.5s forwards;
    position: relative;
}

/* Blur-Background hinter Subtitle */
.pack-subtitle-blur-background {
    position: absolute;
    top: -15px;
    left: -60px;
    right: -60px;
    bottom: -15px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 30px;
    z-index: -1;
    pointer-events: none;
    
    /* Transparenz-Maske */
    mask-image: 
        linear-gradient(to right,
            rgba(0,0,0,0) 0%,
            rgba(0,0,0,1) 20%,
            rgba(0,0,0,1) 80%,
            rgba(0,0,0,0) 100%),
        linear-gradient(to bottom,
            rgba(0,0,0,0) 0%,
            rgba(0,0,0,1) 25%,
            rgba(0,0,0,1) 75%,
            rgba(0,0,0,0) 100%);
    mask-composite: intersect;
    -webkit-mask-composite: destination-in;
}

.pack-opening-subtitle-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    margin: 1rem 0 0 0;
    position: relative;
}

.pack-opening-subtitle-row .card-count + .cards-icon {
    margin-left: -0.4rem; /* Minimaler Abstand zwischen Zahl und Icon */
}

.cards-icon {
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.card-count {
    font-size: 1rem;
    font-weight: 700;
    color: rgba(255, 196, 0, 0.95);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.rarity-badge {
    padding: 0.3rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.95);
    position: relative;
    overflow: hidden;
}

/* Leuchten in Rarity-Farbe */
.rarity-badge::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    padding: 1px;
    background: var(--rarity-gradient, linear-gradient(135deg, #10B981, #14B8A6));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    opacity: 0.6;
}

.rarity-badge::after {
    content: '';
    position: absolute;
    inset: -20px;
    background: var(--rarity-glow, radial-gradient(circle, rgba(16, 185, 129, 0.15), transparent 70%));
    filter: blur(20px);
    z-index: -1;
}

.aus-text, .booster-text {
    font-size: 1rem;
    color: rgba(255, 196, 0, 0.95);
    font-weight: 400;
}

@keyframes titleFadeIn {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === CLOSE BUTTON === */
.pack-opening-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    opacity: 0;
    animation: titleFadeIn 1s ease-out 1.5s forwards;
}

.pack-opening-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

/* === FERTIG BUTTON (UNTEN MITTIG) === */
.pack-opening-finish-btn {
    position: fixed;
    bottom: 3rem;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 0.75rem 2rem;
    color: rgba(255, 255, 255, 0.9);
    font-family: 'Unbounded', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(15px);
    opacity: 0;
    animation: titleFadeIn 1s ease-out 2.5s forwards;
    width: 140px;
    text-align: center;
    z-index: 1000;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.pack-opening-finish-btn .finish-icon {
    font-size: 1.2rem;
    font-weight: 700;
}

.pack-opening-finish-btn .finish-text {
    font-size: 1rem;
}

.pack-opening-finish-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* === AUTO-REVEAL PROGRESS BAR === */
.auto-reveal-progress-container {
    position: fixed;
    bottom: 7rem; /* Über dem Fertig-Button */
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    z-index: 100;
    animation: progressFadeIn 0.3s ease-out;
}

@keyframes progressFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.auto-reveal-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.auto-reveal-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, 
        rgba(255, 215, 0, 1) 0%,
        rgba(255, 215, 0, 1) 50%,
        rgba(255, 140, 0, 1) 100%);
    border-radius: 10px;
    transition: width 0.4s ease-out;
    box-shadow: 
        0 0 20px rgba(255, 215, 0, 0.9),
        0 0 40px rgba(255, 215, 0, 0.6),
        0 0 60px rgba(255, 140, 0, 0.4),
        inset 0 0 10px rgba(255, 255, 255, 0.5);
    animation: progressGlow 1.5s ease-in-out infinite;
}

@keyframes progressGlow {
    0%, 100% {
        box-shadow: 
            0 0 20px rgba(255, 215, 0, 0.9),
            0 0 40px rgba(255, 215, 0, 0.6),
            0 0 60px rgba(255, 140, 0, 0.4),
            inset 0 0 10px rgba(255, 255, 255, 0.5);
    }
    50% {
        box-shadow: 
            0 0 30px rgba(255, 215, 0, 1),
            0 0 60px rgba(255, 215, 0, 0.8),
            0 0 90px rgba(255, 140, 0, 0.6),
            inset 0 0 15px rgba(255, 255, 255, 0.7);
    }
}

/* ===================================================
 * VOLUME CONTROL (links vom Close-Button)
 * =================================================== */
.pack-volume-control {
    position: absolute;
    top: 2rem; /* Gleiche Position wie Close-Button */
    right: 5.5rem; /* Links vom Close-Button */
    z-index: 99999; /* Extrem hoher z-index, damit es IMMER klickbar ist */
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    animation: titleFadeIn 1s ease-out 1.5s forwards; /* Gleiche Animation wie Close-Button */
    pointer-events: auto !important; /* Immer klickbar - wichtig! */
}

.volume-toggle-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    z-index: 1; /* Relativ zum Parent */
    position: relative; /* Für z-index */
    pointer-events: auto !important; /* Immer klickbar */
}

.volume-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.volume-toggle-btn i {
    color: white;
    font-size: 20px;
}

.volume-slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 15px;
    border-radius: 25px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    animation: slideIn 0.3s ease-out;
    z-index: 2; /* Relativ zum Parent */
    position: relative; /* Für z-index */
    pointer-events: auto !important; /* Immer klickbar */
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.volume-slider {
    width: 120px;
    height: 5px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.volume-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.volume-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.volume-percent {
    color: white;
    font-size: 14px;
    font-weight: 600;
    min-width: 40px;
    text-align: center;
}

/* Mobile Anpassungen */
@media (max-width: 768px) {
    .pack-volume-control {
        top: 1rem; /* Gleiche Top-Position wie Close-Button auf Mobile */
        right: 4rem; /* Links vom Close-Button auf Mobile */
    }
    
    .volume-toggle-btn {
        width: 40px;
        height: 40px;
    }
    
    .volume-toggle-btn i {
        font-size: 18px;
    }
    
    .volume-slider {
        width: 80px;
    }
    
    .volume-slider-container {
        padding: 8px 12px;
    }
}
