 @import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap');

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            background: url('https://icirr.us/wild/tcgp/bg.jpg') repeat;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            font-family: 'Futura', 'Century Gothic', sans-serif;
            padding: 40px 20px;
        }

        /* Typography */
        h1 {
            color: #23354a;
            text-shadow: 1.5px 1.5px 0 #fff, -1.5px -1.5px 0 #fff, 1.5px -1.5px 0 #fff, -1.5px 1.5px 0 #fff, 0 1.5px 0 #fff, 0 -1.5px 0 #fff, 1.5px 0 0 #fff, -1.5px 0 0 #fff;
            font: normal 2em/160% 'Futura', 'Century Gothic', sans-serif;
        }

        /* Layout */
        .pack-opening {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 40px;
            width: 100%;
        }

        .pack-select {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 20px;
            width: 100%;
            max-width: 1000px;
            margin: 0 auto;
        }

        .index-stats-container {
            margin-top: 40px;
            display: flex;
            gap: 40px;
            max-width: 1000px;
        }

        /* Packs */
        .pack {
            width: 184px;
            height: 254px;
            background: url('assets/card.png') center/cover no-repeat;
            border-radius: 20px;
            box-shadow: 0 0 0 3px #FFD700, 0 20px 60px rgba(0, 0, 0, 0.4);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
        }

        .pack:hover {
            transform: scale(1.05);
            box-shadow: 0 0 0 3px #b7574d, 0 25px 70px rgba(183, 87, 77, 0.4);
        }

        .pack:hover .pack-text {
            color: #FFD700;
        }

        .pack.opened {
            opacity: 0.7;
            box-shadow: 0 0 0 3px #808080, 0 20px 60px rgba(0, 0, 0, 0.4);
        }

        .pack.opened::after {
            content: '✓';
            position: absolute;
            top: 10px;
            right: 10px;
            background: #b7574d;
            color: white;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
            font-weight: bold;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
        }

        .pack.opening {
            animation: packBurst 0.6s ease-out;
        }

        .pack-text {
            font-size: 24px;
            font-weight: bold;
            color: #ffffff;
            text-shadow: 2px 2px 4px rgba(80, 0, 0, 0.7);
            text-align: center;
            pointer-events: none;
            transition: all 0.3s ease;
        }

        @keyframes packBurst {
            0% {
                transform: scale(1) rotateZ(0deg);
            }
            50% {
                transform: scale(1.1) rotateZ(5deg);
            }
            100% {
                transform: scale(0.5) rotateZ(-10deg);
                opacity: 0;
            }
        }

        /* Card Viewer */
        #cardViewer {
            width: 100%;
            justify-content: center;
        }

        .container {
            perspective: 1000px;
            position: relative;
            width: 100%;
            max-width: 400px;
            height: 500px;
            display: none;
        }

        .container.active {
            display: block;
        }

        .card-stack {
            position: relative;
            width: 100%;
            height: 100%;
        }

        .card {
            position: absolute;
            width: 100%;
            height: 100%;
            background: white;
            border-radius: 15px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            padding: 20px;
            text-align: center;
            cursor: pointer;
            transition: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
            opacity: 0;
            transform: translateY(50px) rotateZ(-5deg) scale(0.8);
            color: #333;
            border: 3px solid #fff;
        }

        .card.visible {
            opacity: 1;
            transform: translateY(0) rotateZ(0) scale(1);
        }

        .card.next {
            transform: translateY(20px) rotateZ(2deg) scale(0.95);
            opacity: 0.8;
        }

        .card-image {
            width: 200px;
            height: 200px;
            margin: 20px auto;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 80px;
        }

        .card-image img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            border-radius: 10px;
            image-rendering: smooth;
        }

        .card-name {
            font-size: 24px;
            font-weight: bold;
            margin: 15px 0;
            color: inherit;
        }

        .card-type {
            display: inline-block;
            padding: 5px 15px;
            border-radius: 20px;
            border: 2px solid currentColor;
            font-size: 12px;
            margin-bottom: 15px;
            font-weight: bold;
        }

        .card-stats {
            display: flex;
            justify-content: space-around;
            margin-top: 20px;
            font-size: 14px;
            color: inherit;
        }

        .stat {
            color: inherit;
            opacity: 0.8;
        }

        .stat-label {
            font-weight: bold;
            display: block;
            color: inherit;
            opacity: 1;
        }

        /* Type Styling */
        .card.Fire { background: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%); color: white; }
        .card.Water { background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%); color: white; }
        .card.Grass { background: linear-gradient(135deg, #26A65B 0%, #1E8449 100%); color: white; }
        .card.Flying { background: linear-gradient(135deg, #A8DADC 0%, #457B9D 100%); color: white; }
        .card.Electric { background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%); color: #333; border-color: #333;}
        .card.Dragon { background: linear-gradient(135deg, #7851A9 0%, #C23B22 100%); color: white; }
        .card.Fighting { background: linear-gradient(135deg, #D2691E 0%, #8B4513 100%); color: white; }
        .card.Steel { background: linear-gradient(135deg, #B8B8D1 0%, #70707B 100%); color: white; }
        .card.Rock { background: linear-gradient(135deg, #8B7355 0%, #654321 100%); color: white; }
        .card.Ice { background: linear-gradient(135deg, #B3E5FC 0%, #01579B 100%); color: white; }
        .card.Poison { background: linear-gradient(135deg, #B71C1C 0%, #7B1FA2 100%); color: white; }
        .card.Psychic { background: linear-gradient(135deg, #E91E63 0%, #9C27B0 100%); color: white; }
        .card.Ghost { background: linear-gradient(135deg, #6A1B9A 0%, #212121 100%); color: white; }
        .card.Dark { background: linear-gradient(135deg, #37474F 0%, #000000 100%); color: white; }
        .card.Fairy { background: linear-gradient(135deg, #F48FB1 0%, #C2185B 100%); color: white; }
        .card.Normal { background: linear-gradient(135deg, #BDBDBD 0%, #757575 100%); color: white; }
        .card.Ground { background: linear-gradient(135deg, #D7CCC8 0%, #5D4037 100%); color: white; }
        .card.Bug { background: linear-gradient(135deg, #7CB342 0%, #558B2F 100%); color: white; }

        .card-type.Fire { background: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%); }
        .card-type.Water { background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%); }
        .card-type.Grass { background: linear-gradient(135deg, #26A65B 0%, #1E8449 100%); }
        .card-type.Flying { background: linear-gradient(135deg, #A8DADC 0%, #457B9D 100%); }
        .card-type.Electric { background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%); color: #333 !important; }
        .card-type.Dragon { background: linear-gradient(135deg, #7851A9 0%, #C23B22 100%); }
        .card-type.Fighting { background: linear-gradient(135deg, #D2691E 0%, #8B4513 100%); }
        .card-type.Steel { background: linear-gradient(135deg, #B8B8D1 0%, #70707B 100%); }
        .card-type.Rock { background: linear-gradient(135deg, #8B7355 0%, #654321 100%); }
        .card-type.Ice { background: linear-gradient(135deg, #B3E5FC 0%, #01579B 100%); }
        .card-type.Poison { background: linear-gradient(135deg, #B71C1C 0%, #7B1FA2 100%); }
        .card-type.Psychic { background: linear-gradient(135deg, #E91E63 0%, #9C27B0 100%); }
        .card-type.Ghost { background: linear-gradient(135deg, #6A1B9A 0%, #212121 100%); }
        .card-type.Dark { background: linear-gradient(135deg, #37474F 0%, #000000 100%); }
        .card-type.Fairy { background: linear-gradient(135deg, #F48FB1 0%, #C2185B 100%); }
        .card-type.Normal { background: linear-gradient(135deg, #BDBDBD 0%, #757575 100%); }
        .card-type.Ground { background: linear-gradient(135deg, #D7CCC8 0%, #5D4037 100%); }
        .card-type.Bug { background: linear-gradient(135deg, #7CB342 0%, #558B2F 100%); }

        /* Controls */
        .controls {
            margin-top: 50px;
            display: flex;
            gap: 15px;
            align-items: center;
        }

        .card-counter {
            color: #fff;
            font-size: 18px;
            font-weight: bold;
            min-width: 60px;
            text-align: center;
            display: flex;
            justify-content: center;
        }

        button {
            padding: 15px 30px;
            font-size: 16px;
            background: #23354a;
            border: 2px solid #fff;
            border-radius: 50px;
            cursor: pointer;
            color: #fff;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
            transition: all 0.3s ease;
            font-family: 'Futura', 'Century Gothic', sans-serif;
        }

        button:hover {
            transform: translateY(-2px);
            background: #b7574d;
            border-color: #b7574d;
            box-shadow: 0 8px 20px rgba(183, 87, 77, 0.4);
        }

        button:active {
            transform: translateY(0);
        }

        button:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .back-btn {
            align-self: flex-start;
            margin-bottom: 30px;
            font: normal 1em/160% 'Futura', 'Century Gothic', sans-serif;
        }

        /* Stats */
        .stats-box {
            background: #fff;
            padding: 25px;
            border-radius: 10px;
            width: 300px;
            border: 2px solid #23354a;
            height: 300px;
            overflow-y: auto;
            scrollbar-width: thin;
            scrollbar-color: #b7574d #f0f0f0;
        }

        .stats-box h3 {
            margin-bottom: 20px;
            text-decoration: underline;
            color: #23354a;
        }

        .stat-item {
            display: flex;
            justify-content: space-between;
            margin: 12px 0;
            font-size: 14px;
            color: #23354a;
        }

        /* Details */
        details {
            max-width: 900px;
            margin: 15px auto 30px;
        }

        summary {
            background: #23354a;
            color: #fff;
            padding: 15px 30px;
            border-radius: 50px;
            cursor: pointer;
            font-size: 18px;
            border: 2px solid #FFD700;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 10px;
            text-transform: lowercase;
        }

        summary:hover {
            transform: translateY(-2px);
            background: #b7574d;
            border-color: #b7574d;
            box-shadow: 0 8px 20px rgba(183, 87, 77, 0.4);
        }

        summary::marker {
            color: #FFD700;
        }

        #blurb {
            max-width: 900px;
            margin: 0.5em 0 0 0;
            padding: 30px;
            background: #fff;
            border: 2px solid #23354a;
            border-radius: 10px;
            color: #23354a;
            line-height: 1.8;
            text-align: justify;
            font: normal 1em/160% 'Lato', sans-serif;
        }

        #blurb p {
            margin-bottom: 20px;
            font-size: 16px;
        }

        #blurb p:last-child {
            margin-bottom: 0;
        }

        #blurb a {
            color: #193782;
            text-decoration: underline;
            font-weight: bold;
            transition: color 0.3s ease;
        }

        #blurb a:hover {
            color: #b7574d;
        }

        #blurb em {
            color: #b7574d;
            font-style: italic;
        }

        footer {
            margin: 4em 0 1em;
            text-align: center;
        }

        footer img{
            image-rendering: pixelated;
        }

        footer a:link, footer a:visited {
            color: #23354a;
            text-decoration: none;
            font-size: 1.5em;
            transition: color 0.3s ease;
        }

        footer a:hover {
            color: #b7574d;
        }

        /* Tablet and Mobile Responsiveness */
        @media (max-width: 1024px) {
            .pack-select {
                grid-template-columns: repeat(4, 1fr);
                gap: 15px;
                max-width: 800px;
            }

            .index-stats-container {
                flex-direction: column;
                gap: 20px;
                width: 90%;
            }

            .stats-box {
                width: 100%;
            }

            h1 {
                font-size: 1.5em;
            }
        }

        @media (max-width: 768px) {
            body {
                padding: 20px 10px;
            }

            .pack-select {
                grid-template-columns: repeat(3, 1fr);
                gap: 12px;
                max-width: 600px;
            }

            .pack {
                width: 140px;
                height: 190px;
            }

            .pack-text {
                font-size: 18px;
            }

            h1 {
                font-size: 1.3em;
            }

            details {
                max-width: 90%;
            }

            #blurb {
                padding: 20px;
                font-size: 14px;
            }

            #blurb p {
                margin-bottom: 15px;
            }

            .controls {
                flex-direction: column;
                gap: 10px;
                margin-top: 30px;
            }

            button {
                padding: 12px 24px;
                font-size: 14px;
                width: 100%;
            }

            .back-btn {
                align-self: center;
                width: 90%;
                max-width: 300px;
            }

            .container {
                max-width: 90%;
                height: 400px;
            }

            .card-image {
                width: 150px;
                height: 150px;
                margin: 15px auto;
            }

            .card-name {
                font-size: 18px;
                margin: 10px 0;
            }

            .card-type {
                font-size: 11px;
                padding: 4px 12px;
            }

            .card-stats {
                font-size: 12px;
                margin-top: 15px;
            }
        }

        @media (max-width: 480px) {
            body {
                padding: 15px 8px;
            }

            .pack-select {
                grid-template-columns: repeat(2, 1fr);
                gap: 10px;
                max-width: 100%;
            }

            .pack {
                width: 100%;
                height: auto;
                aspect-ratio: 184/254;
            }

            .pack-text {
                font-size: 16px;
            }

            h1 {
                font-size: 1.1em;
                margin-bottom: 15px;
            }

            .index-stats-container {
                flex-direction: column;
                gap: 15px;
                width: 95%;
                margin-top: 20px;
            }

            .stats-box {
                width: 100%;
                padding: 15px;
                height: auto;
                max-height: 300px;
            }

            .stats-box h3 {
                font-size: 14px;
                margin-bottom: 10px;
            }

            .stat-item {
                font-size: 12px;
                margin: 8px 0;
            }

            details {
                max-width: 95%;
            }

            summary {
                padding: 12px 20px;
                font-size: 14px;
            }

            #blurb {
                padding: 15px;
                font-size: 13px;
                line-height: 1.6;
            }

            #blurb p {
                margin-bottom: 12px;
                font-size: 13px;
            }

            .container {
                max-width: 95%;
                height: 350px;
            }

            .card {
                padding: 15px;
            }

            .card-image {
                width: 120px;
                height: 120px;
                margin: 10px auto;
            }

            .card-name {
                font-size: 16px;
                margin: 8px 0;
            }

            .card-type {
                font-size: 10px;
                padding: 3px 10px;
                margin-bottom: 10px;
            }

            .card-stats {
                font-size: 11px;
                margin-top: 10px;
                flex-direction: column;
                gap: 8px;
            }

            .controls {
                width: 95%;
                margin-top: 20px;
            }

            button {
                padding: 10px 16px;
                font-size: 13px;
            }

            .back-btn {
                width: 100%;
            }

            .card-counter {
                font-size: 14px;
                min-width: 50px;
            }

            footer {
                margin: 2em 0 0.5em;
            }

            footer a:link, footer a:visited {
                font-size: 1.2em;
            }
        }