:root {
            --p1-color: #00A2FF; /* Bright Blue */
            --p1-dark: #0077BA;
            --p2-color: #FF4D4D; /* Brighter Red */
            --p2-dark: #B32A00;
            --chip-color: #F2F2F2;
            --chip-shadow: #999999;
            --bg-color: #232527; /* Dark Roblox theme */
            --stud-color: rgba(0,0,0,0.1);
        }

        * {
            box-sizing: border-box;
            user-select: none;
            -webkit-tap-highlight-color: transparent;
        }

        body {
            margin: 0;
            padding: 0;
            background-color: var(--bg-color);
            background-image: radial-gradient(var(--stud-color) 15%, transparent 16%);
            background-size: 20px 20px;
            font-family: 'Fredoka', sans-serif;
            color: white;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100vh;
            height: 100dvh; 
            overflow: hidden;
        }

        /* --- SPLASH SCREEN --- */
        #splash-screen {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: #111;
            z-index: 200;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            transition: opacity 0.5s ease-out;
        }

        .splash-logo {
            font-size: 4rem;
            animation: bounce 1s infinite alternate;
        }

        .splash-text {
            font-size: 2.5rem;
            color: #FFD700;
            font-weight: bold;
            margin-top: 20px;
            text-align: center;
            padding: 0 20px;
            text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
        }

        .splash-loader {
            margin-top: 30px;
            width: 50px;
            height: 50px;
            border: 5px solid #333;
            border-top: 5px solid #FFD700;
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

        @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
        @keyframes bounce { from { transform: translateY(0); } to { transform: translateY(-20px); } }

        /* --- UI CONTAINER --- */
        #game-container {
            width: 100%;
            max-width: 500px;
            height: 100%;
            display: flex;
            flex-direction: column;
            position: relative;
            background: rgba(0,0,0,0.1);
        }
        
        @media (min-width: 501px) {
            #game-container {
                height: 95vh;
                max-height: 900px;
                border: 4px solid #444;
                border-radius: 20px;
                overflow: hidden;
                box-shadow: 0 0 30px rgba(0,0,0,0.5);
            }
        }

        /* --- HUD (Heads Up Display) --- */
        .hud-panel {
            padding: 10px 15px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: rgba(30, 30, 30, 0.95);
            border-bottom: 2px solid rgba(255,255,255,0.1);
            z-index: 10;
            min-height: 60px;
            box-shadow: 0 4px 6px rgba(0,0,0,0.3);
            flex-shrink: 0;
        }

        #p2-panel {
            padding-top: max(15px, env(safe-area-inset-top));
            height: auto;
            border-bottom: 4px solid rgba(0,0,0,0.3);
        }

        .hud-bottom {
            border-bottom: none;
            border-top: 4px solid rgba(0,0,0,0.3);
            padding-bottom: max(15px, env(safe-area-inset-bottom));
        }

        .player-info {
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 1.2rem;
            font-weight: 700;
            text-shadow: 2px 2px 0px #000;
            letter-spacing: 0.5px;
        }

        .avatar {
            width: 35px;
            height: 35px;
            border-radius: 50%;
            border: 3px solid white;
            background-size: cover;
            background-color: #ddd;
            box-shadow: 0 2px 5px rgba(0,0,0,0.5);
            flex-shrink: 0;
        }

        .hearts {
            display: flex;
            gap: 3px;
        }

        .heart {
            font-size: 1.2rem;
            filter: drop-shadow(2px 2px 0 #000);
            transition: transform 0.2s;
        }

        .heart.lost {
            filter: grayscale(1) opacity(0.3);
            transform: scale(0.8);
        }

        /* --- STATUS BAR --- */
        #game-status-bar {
            text-align: center;
            padding: 8px;
            background: rgba(0,0,0,0.6);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            border-bottom: 1px solid rgba(255,255,255,0.1);
            flex-shrink: 0;
        }

        #turn-text {
            font-size: 1.2rem;
            font-weight: 800;
            text-transform: uppercase;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
            margin-bottom: 4px;
            letter-spacing: 1px;
        }

        #timer-container {
            width: 50%;
            max-width: 200px;
            height: 10px;
            background: #444;
            border-radius: 6px;
            overflow: hidden;
            border: 2px solid #fff;
            position: relative;
            box-shadow: 0 2px 4px rgba(0,0,0,0.5);
        }

        #timer-bar {
            width: 100%;
            height: 100%;
            background: #00ff00;
            transition: width 1s linear;
        }
        
        #timer-text {
            font-size: 0.8rem;
            margin-top: 2px;
            color: #ddd;
            font-weight: 600;
        }

        /* --- GAME BOARD (2D STYLE) --- */
        #board-area {
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 10px;
            overflow: hidden;
            min-height: 0;
        }

        #grid {
            display: grid;
            grid-template-columns: repeat(6, 1fr);
            gap: 1.5vmin;
            width: 100%;
            
            /* Responsive Size - 80vmin ensures it fits well */
            max-width: 80vmin;
            max-height: 80vmin;
            aspect-ratio: 1/1;
            
            /* Realistic Wooden Table Styling */
            background-color: #5D4037;
            background-image: url('assets/table.jpg');
            background-size: cover;
            background-position: center;
            
            padding: 2vmin;
            border-radius: 15px;
            
            /* Table Border and Shadow for depth */
            border: 8px solid #3E2723;
            box-shadow: 
                inset 0 0 40px rgba(0,0,0,0.7),  /* Inner depth */
                0 20px 50px rgba(0,0,0,0.8);     /* Drop shadow */
        }

        .chip {
            background-color: var(--chip-color);
            border-radius: 6px;
            /* Simple 2D button look */
            border-bottom: 0.6vmin solid var(--chip-shadow);
            cursor: pointer;
            position: relative;
            transition: all 0.1s;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 4vmin;
        }

        .chip:active {
            transform: translateY(3px);
            border-bottom-width: 2px;
        }

        .chip-content {
            pointer-events: none;
            /* No shadow needed for flat look */
            width: 100%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .chip.eaten {
            background-color: #333;
            border-bottom: 2px solid #111;
            transform: translateY(3px);
            cursor: default;
            box-shadow: inset 0 0 5px black;
        }
        
        .chip.eaten .chip-content { display: none; }

        .chip.bomb-reveal {
            background-color: #ffcccb; 
            border-color: #d32f2f;
            animation: popUpSimple 0.3s;
        }
        
        @keyframes popUpSimple {
            0% { transform: scale(1); }
            50% { transform: scale(1.1); }
            100% { transform: scale(1); }
        }

        /* --- OVERLAYS & MENU --- */
        .overlay {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            z-index: 100;
            text-align: center;
            padding: 20px;
            transition: opacity 0.3s;
        }
        
        /* Menu Background with Image Effect */
        #screen-menu {
            /* Fallback color */
            background-color: #2c3e50;
            /* Dark overlay + Full screen responsive image */
            background-image: 
                linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.8)),
                url('assets/menu.jpg');
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
        }
        
        #screen-intermission, #screen-gameover {
            background: rgba(15, 15, 15, 0.98);
        }

        .hidden {
            opacity: 0;
            pointer-events: none;
            display: none !important;
        }

        h1 {
            font-size: clamp(2rem, 8vw, 3rem);
            color: #FFD700;
            text-shadow: 4px 4px 0px #000;
            margin-bottom: 10px;
            line-height: 1.1;
        }

        /* --- LOGO STYLING --- */
        .menu-logo {
            width: 90%; /* Responsive width */
            max-width: 500px; /* Max width to prevent it being too huge on desktop */
            height: auto; /* Maintain aspect ratio */
            aspect-ratio: 977 / 215; /* Explicit ratio as requested */
            margin-bottom: 20px;
            filter: drop-shadow(4px 4px 0px #000); /* Drop shadow to match previous text style */
        }

        p {
            font-size: clamp(1rem, 4vw, 1.2rem);
            color: #ccc;
            margin-bottom: 20px;
            max-width: 400px;
        }

        /* --- THEME SELECTOR --- */
        .theme-container {
            margin-top: 15px;
            background: rgba(0,0,0,0.5);
            padding: 15px;
            border-radius: 15px;
            border: 2px solid #555;
            width: 100%;
            max-width: 400px;
            display: flex;
            flex-direction: column;
            max-height: 35vh;
        }

        .theme-title {
            color: #fff;
            margin-bottom: 10px;
            font-size: 1rem;
            text-transform: uppercase;
            letter-spacing: 1px;
            flex-shrink: 0;
        }

        .theme-grid {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 10px;
            overflow-y: auto;
            flex: 1;
        }

        .theme-btn {
            font-size: 1.5rem;
            width: 45px;
            height: 45px;
            border-radius: 10px;
            border: none;
            background: #444;
            cursor: pointer;
            transition: transform 0.1s, background 0.2s;
            border-bottom: 4px solid #222;
            padding: 0; /* Remove padding for images */
            overflow: hidden;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .theme-btn:active {
            transform: translateY(2px);
            border-bottom-width: 2px;
        }

        .theme-btn.selected {
            background: #00A2FF;
            border-bottom-color: #0077BA;
            box-shadow: 0 0 10px #00A2FF;
            transform: scale(1.1);
        }

        /* --- BUTTONS --- */
        .btn-3d {
            background-color: #00b06f;
            color: white;
            font-family: 'Fredoka', sans-serif;
            font-size: clamp(1.2rem, 5vw, 1.8rem);
            font-weight: 700;
            padding: 15px 10vw;
            border: none;
            border-radius: 12px;
            border-bottom: 6px solid #007a4d;
            cursor: pointer;
            transition: all 0.1s;
            text-transform: uppercase;
            text-shadow: 1px 1px 0 rgba(0,0,0,0.3);
            margin: 10px;
            box-shadow: 0 10px 20px rgba(0,0,0,0.3);
            white-space: nowrap;
        }

        .btn-3d:active {
            transform: translateY(4px);
            border-bottom-width: 2px;
        }

        /* --- SETUP INDICATOR --- */
        .setup-indicator {
            position: absolute;
            top: 25%; 
            background: #333;
            padding: 10px 20px;
            border-radius: 20px;
            font-weight: bold;
            border: 2px solid white;
            z-index: 50;
            pointer-events: none;
            box-shadow: 0 5px 15px rgba(0,0,0,0.5);
            font-size: clamp(0.9rem, 4vw, 1.1rem);
        }

        .chip.setup-selected {
            background-color: #FFD700;
            border-bottom-color: #B29600;
        }

        /* --- ANIMATIONS --- */
        @keyframes shake {
            0% { transform: translate(1px, 1px) rotate(0deg); }
            50% { transform: translate(-1px, 2px) rotate(-1deg); }
            100% { transform: translate(1px, -2px) rotate(-1deg); }
        }
        .shaking { animation: shake 0.5s; }

        .explosion-text {
            position: absolute;
            font-size: 3rem;
            font-weight: bold;
            color: red;
            text-shadow: 2px 2px 0 yellow;
            pointer-events: none;
            animation: popUp 1s forwards;
            z-index: 60;
        }
        @keyframes popUp {
            0% { transform: scale(0); opacity: 0; }
            50% { transform: scale(1.5); opacity: 1; }
            100% { transform: scale(2) translateY(-50px); opacity: 0; }
        }
        
        .turn-highlight {
            box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.2);
            border-color: white;
        }

        /* --- EXTRA RESPONSIVE TWEAKS --- */
        @media (max-width: 380px) {
            .player-info { gap: 6px; font-size: 1rem; }
            .avatar { width: 30px; height: 30px; }
            .heart { font-size: 1rem; }
            .btn-3d { padding: 12px 30px; }
        }

        @media (max-height: 650px) {
            .hud-panel { min-height: 50px; padding: 5px 15px; }
            h1 { font-size: 2.2rem; margin-bottom: 5px; }
            .btn-3d { padding: 10px 40px; margin: 5px; }
            .theme-container { margin-top: 10px; max-height: 30vh; }
            #board-area { padding: 5px; }
        }
