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

        /* MODIFIED: Body styles for seamless embedding */
        body {
            background-color: transparent;
            font-family: 'Lora', serif;
            color: #fff;
            margin: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            padding: 0;
            touch-action: manipulation;
        }

        #crazy-eights-wrapper {
            position: relative;
            width: 100%;
            max-width: 1400px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 1rem;
            color: #fff;
            padding: 2rem 0;
        }

        #game-header {
            color: #FBBF24;
            font-size: 2.5rem;
            font-weight: bold;
            text-shadow: 2px 2px 5px rgba(0,0,0,0.5);
        }

        #game-container {
            position: relative;
            width: 90vw;
            height: 90vh;
            max-width: 1200px;
            max-height: 800px;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        #game-table {
            width: 100%;
            height: 100%;
            background-color: #065f46;
            background-image: radial-gradient(rgba(255, 255, 255, 0.05) 15%, transparent 15%);
            background-size: 3px 3px;
            border-radius: 120px;
            border: 20px solid #6b4226;
            box-shadow: inset 0 0 25px rgba(0,0,0,0.6), 0 10px 30px rgba(0,0,0,0.5);
            position: relative;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        #watermark {
            position: absolute;
            bottom: 25px;
            right: 40px;
            font-size: 1rem;
            color: rgba(255, 255, 255, 0.15);
            font-weight: bold;
            text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
            pointer-events: none;
            z-index: 10;
        }

        .player-area {
            position: absolute;
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 10px;
            border-radius: 10px;
            transition: background-color 0.3s;
            z-index: 20;
        }
        
        .current-player {
            background-color: rgba(251, 191, 36, 0.2);
        }

        .player-area.top { top: 20px; left: 50%; transform: translateX(-50%); }
        .player-area.bottom { bottom: 20px; left: 50%; transform: translateX(-50%); width: 60%; }
        .player-area.left { left: 20px; top: 50%; transform: translateY(-50%); }
        .player-area.right { right: 40px; top: 50%; transform: translateY(-50%); }

        .player-name {
            font-size: 1.25rem;
            margin-bottom: 10px;
            font-weight: 700;
            color: #fff;
        }
        
        .current-player .player-name {
            color: #FBBF24;
            animation: pulse 1.5s infinite;
            text-shadow: 2px 2px 4px #1a202c;
        }

        @keyframes pulse {
            0%, 100% { transform: scale(1); text-shadow: 2px 2px 4px #1a202c; }
            50% { transform: scale(1.05); text-shadow: 2px 2px 8px #FBBF24; }
        }

        .card {
            width: 80px;
            height: 120px;
            border-radius: 8px;
            background-color: white;
            border: 1px solid #999;
            position: relative;
            cursor: pointer;
            transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
            box-shadow: 0 4px 6px rgba(0,0,0,0.3);
            font-family: 'Roboto', sans-serif;
        }

        .player-area.bottom .card:hover {
            transform: translateY(-10px) scale(1.05);
            box-shadow: 0 10px 15px rgba(0,0,0,0.4);
        }

        .card.red { color: #DC2626; }
        .card.black { color: #374151; }

        .card-back {
            background: linear-gradient(135deg, #4a044e 25%, transparent 25%) -40px 0,
                        linear-gradient(225deg, #4a044e 25%, transparent 25%) -40px 0,
                        linear-gradient(315deg, #4a044e 25%, transparent 25%),
                        linear-gradient(45deg, #4a044e 25%, transparent 25%);
            background-size: 80px 80px;
            background-color: #701a75;
            border: 1px solid #4a044e;
            color: white;
            display: flex;
            justify-content: center;
            align-items: center;
            text-align: center;
        }

        .card-back-content {
            font-family: 'Lora', serif;
            font-weight: bold;
            font-size: 13px;
            line-height: 1.1;
            text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
            transform: rotate(-10deg);
        }
        
        .corner-rank { position: absolute; font-size: 16px; line-height: 1; text-align: center; font-weight: 700; }
        .corner-rank.top-left { top: 5px; left: 7px; }
        .corner-rank.bottom-right { bottom: 5px; right: 7px; transform: rotate(180deg); }
        .center-suit { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 48px; }
        .center-suit.face-card { font-size: 40px; font-weight: bold; }
        
        .player-hand { display: flex; justify-content: center; align-items: flex-end; min-height: 125px; }
        .player-area.bottom .player-hand { gap: -40px; }
        .player-area.top .ai-hand { gap: -60px; }
        .player-area.left .ai-hand, .player-area.right .ai-hand { flex-direction: column; align-items: center; gap: -45px; min-width: 100px; min-height: auto; }
        .player-area.left .ai-hand .card, .player-area.right .ai-hand .card { transform: rotate(90deg); width: 60px; height: 90px; }

        #center-area { display: flex; justify-content: center; align-items: center; gap: 40px; z-index: 20; }
        .pile-container { display: flex; flex-direction: column; align-items: center; }
        .pile-label { margin-bottom: 10px; font-size: 1rem; font-weight: bold; }

        #suit-picker {
            position: fixed;
            bottom: 220px;
            left: 50%;
            transform: translateX(-50%);
            background-color: rgba(0,0,0,0.8);
            padding: 20px;
            border-radius: 10px;
            z-index: 500;
            display: none;
            gap: 10px;
            border: 2px solid #FBBF24;
        }

        .suit-choice {
            width: 60px;
            height: 60px;
            font-size: 40px;
            cursor: pointer;
            border: 2px solid #aaa;
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            transition: transform 0.2s, background-color 0.2s;
            background-color: white;
        }
        .suit-choice:hover { transform: scale(1.1); background-color: #FBBF24; }
        .suit-choice.suit-red { color: #DC2626; }
        .suit-choice.suit-black { color: #374151; }

        #message-box {
            position: absolute;
            top: 28%;
            left: 50%;
            transform: translateX(-50%);
            background-color: rgba(0, 0, 0, 0.4);
            padding: 8px 15px;
            border-radius: 8px;
            z-index: 50;
            text-align: center;
            font-size: 1.1rem;
            font-weight: bold;
            max-width: 50%;
            text-shadow: 1px 1px 3px #1a202c;
        }
        
        #scoreboard {
            position: absolute;
            left: 15%;
            top: 50%;
            transform: translateY(-50%);
            background-color: rgba(26, 32, 44, 0.8);
            padding: 15px;
            border-radius: 10px;
            z-index: 30;
            font-size: 1rem;
            border: 1px solid rgba(255,255,255,0.2);
            backdrop-filter: blur(5px);
            width: 220px;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        #top-right-ui {
            position: absolute;
            top: 50px;
            right: 70px;
            z-index: 300;
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            gap: 8px;
        }

        .dropdown-container { position: relative; }

        .ui-button {
            background-color: #4a5568;
            color: white;
            padding: 6px 12px;
            border-radius: 6px;
            cursor: pointer;
            border: 1px solid #718096;
            font-family: 'Roboto', sans-serif;
            font-weight: bold;
            font-size: 0.875rem;
            transition: background-color 0.2s;
        }
        .ui-button:hover { background-color: #2d3748; }
        
        #end-game-button { background-color: #c53030; border-color: #9b2c2c; }
        #end-game-button:hover { background-color: #9b2c2c; }

        .dropdown-content {
            display: none;
            position: absolute;
            right: 0;
            top: 100%;
            margin-top: 5px;
            background-color: rgba(26, 32, 44, 0.9);
            min-width: 300px;
            max-width: 400px;
            max-height: 50vh;
            overflow-y: auto;
            border-radius: 8px;
            border: 1px solid #4a5568;
            padding: 15px;
            color: #cbd5e0;
            font-size: 0.9rem;
            line-height: 1.5;
        }
        
        .dropdown-content h3 { font-size: 1.1rem; font-weight: bold; color: #FBBF24; margin-top: 10px; margin-bottom: 5px; border-bottom: 1px solid #4a5568; padding-bottom: 5px; }
        .dropdown-content h3:first-child { margin-top: 0; }
        .dropdown-content ul { list-style-type: disc; padding-left: 20px; }
        .log-entry { padding: 4px 0; border-bottom: 1px solid #2d3748; }
        .log-entry:first-child { font-weight: bold; }
        
        #player-instructions {
            position: absolute;
            top: 50%;
            right: 15%;
            transform: translateY(-50%);
            background-color: rgba(0, 0, 0, 0.6);
            padding: 15px;
            border-radius: 8px;
            text-align: left;
            font-size: 1rem;
            width: 220px;
            border: 1px solid rgba(255,255,255,0.2);
            backdrop-filter: blur(5px);
            z-index: 30;
            text-shadow: 1px 1px 3px rgba(0,0,0,0.7);
        }
        #player-instructions ul { list-style-type: '→ '; padding-left: 15px; line-height: 1.6; }
        
        .card-stack-container { position: relative; display: flex; justify-content: center; align-items: center; }
        .card-count-indicator {
            position: absolute;
            background-color: #FBBF24;
            color: #1a202c;
            width: 28px;
            height: 28px;
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            font-weight: bold;
            font-size: 14px;
            border: 2px solid white;
            z-index: 1;
        }

        .player-area.top .card-count-indicator { bottom: 5px; right: -10px; }
        .player-area.left .card-count-indicator, .player-area.right .card-count-indicator { top: 25px; right: 0px; }
        
        .modal-overlay {
            position: fixed;
            inset: 0;
            background-color: rgba(0,0,0,0.75);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 400;
        }
        .modal {
            background-color: #2d3748;
            padding: 2rem;
            border-radius: 0.5rem;
            box-shadow: 0 10px 25px rgba(0,0,0,0.5);
            text-align: center;
            border: 1px solid #4a5568;
        }
        .modal h2 { color: #FBBF24; font-size: 1.5rem; font-weight: bold; margin-bottom: 1rem; }
        .modal p { margin-bottom: 1.5rem; color: #e2e8f0; }
        .modal .button-container { display: flex; justify-content: center; gap: 1rem; }
        .modal .ui-button { padding: 10px 24px; font-size: 1rem; }
        
        #rules-yes-btn { background-color: #2f855a; border-color: #276749; }
        #rules-yes-btn:hover { background-color: #276749; }
        #rules-no-btn { background-color: #c53030; border-color: #9b2c2c; }
        #rules-no-btn:hover { background-color: #9b2c2c; }
        #play-again-btn { background-color: #2b6cb0; border-color: #2c5282;}
        #play-again-btn:hover { background-color: #2c5282;}

        /* Utility classes (formerly Tailwind) */
        .hidden { display: none; }
        .font-bold { font-weight: 700; }
        .mb-2 { margin-bottom: 0.5rem; }
        .mt-2 { margin-top: 0.5rem; }
        .mr-2 { margin-right: 0.5rem; }
        .text-amber-300 { color: #FBBF24; }
        .text-slate-400 { color: #94a3b8; }
        .text-yellow-700 { color: #b45309; }
        .text-lg { font-size: 1.125rem; }
        .text-2xl { font-size: 1.5rem; }
        .flex { display: flex; }
        .items-center { align-items: center; }
        .justify-between { justify-content: space-between; }
        .w-full { width: 100%; }
        .pb-1 { padding-bottom: 0.25rem; }
        .border-b { border-bottom-width: 1px; border-bottom-style: solid; }
        .border-white\/20 { border-color: rgba(255, 255, 255, 0.2); }
