        :root {
            /* Color Palette */
            --felt-center: #0a5c18;
            --felt-edge: #001a05;
            --header-start: #1e3c0e;
            --header-end: #000000;
            --wood-light: #deb887;
            --highlight: #ffd700;
            --success-color: #4caf50;
            --error-color: #ff5252;
            --warning-color: #ff9800;
            
            /* Card Dimensions */
            --card-width: 80px;
            --card-height: 115px;
            --spacing-gap: 15px;
            
            /* Card Colors */
            --card-red: #d32f2f;
            --card-black: #212121;
            
            /* Transitions */
            --transition-fast: 0.1s;
            --transition-normal: 0.2s;
            --transition-slow: 0.3s;
        }

        /* Reset & Base */
        *, *::before, *::after {
            box-sizing: border-box;
            -webkit-tap-highlight-color: transparent;
        }

        html {
            height: 100%;
            overflow: hidden;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            margin: 0;
            display: flex;
            flex-direction: column;
            align-items: center;
            min-height: 100%;
            height: 100%;
            overflow-x: hidden;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            user-select: none;
            color: white;
            background: radial-gradient(circle at 50% 40%, var(--felt-center) 20%, var(--felt-edge) 100%);
        }

        body.modal-open {
            overflow: hidden;
            position: fixed;
            width: 100%;
        }

        /* Header Bar */
        .top-bar {
            width: 100%;
            min-height: 80px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 30px;
            flex-shrink: 0;
            background: linear-gradient(to bottom, var(--header-start), var(--header-end));
            box-shadow: 0 2px 10px rgba(0,0,0,0.5);
            z-index: 100;
            transform: translateZ(0);
        }

        .game-info {
            display: flex;
            flex-direction: column;
            justify-content: center;
        }

        .game-title {
            font-size: 1.5rem;
            font-weight: 700;
            color: white;
            text-shadow: 0 2px 2px rgba(0,0,0,0.5);
            margin: 0;
            line-height: 1.2;
        }

        .game-subtitle {
            font-size: 0.85rem;
            color: rgba(255, 255, 255, 0.7);
            margin: 0;
            font-weight: 400;
        }

        /* Scoreboard */
        .scoreboard {
            display: flex;
            gap: 40px;
            align-items: center;
        }

        .score-box {
            display: flex;
            flex-direction: column;
            align-items: center;
            min-width: 60px;
        }

        .score-label {
            font-size: 0.7rem;
            text-transform: uppercase;
            letter-spacing: 1px;
            opacity: 0.8;
            margin-bottom: 2px;
        }

        .score-value {
            font-size: 1.8rem;
            font-weight: bold;
            line-height: 1;
            text-shadow: 0 2px 4px rgba(0,0,0,0.5);
        }

        .score-box--human .score-value { color: #4fc3f7; }
        .score-box--computer .score-value { color: #ef5350; }

        /* Main Layout */
        .main-layout {
            display: flex;
            flex-direction: row;
            width: 100%;
            max-width: 1200px;
            margin-top: 10px;
            gap: 20px;
            padding: 0 20px;
            flex-grow: 1;
            min-height: 0;
            height: calc(100% - 90px);
        }

        /* Log Sidebar */
        .log-sidebar {
            width: 280px;
            background: rgba(0,0,0,0.25);
            border-radius: 8px;
            border: 1px solid rgba(255,255,255,0.1);
            display: flex;
            flex-direction: column;
            padding: 10px;
            height: 90%;
            margin-top: 10px;
            backdrop-filter: blur(2px);
        }

        .log-header {
            font-weight: bold;
            border-bottom: 1px solid rgba(255,255,255,0.2);
            padding-bottom: 5px;
            margin-bottom: 5px;
            text-align: center;
            color: var(--wood-light);
        }

        .message-log {
            flex: 1;
            overflow-y: auto;
            font-size: 0.9rem;
            padding-right: 5px;
            scrollbar-width: thin;
            scrollbar-color: rgba(255,255,255,0.3) transparent;
        }

        .log-entry {
            margin-bottom: 6px;
            border-bottom: 1px solid rgba(255,255,255,0.05);
            padding-bottom: 4px;
            line-height: 1.3;
        }

        .log-entry--score {
            color: #ffd54f;
            font-weight: bold;
            background: rgba(255, 215, 0, 0.1);
            padding: 2px 4px;
            border-radius: 4px;
        }

        .log-entry--info {
            color: #b0bec5;
            font-style: italic;
            font-size: 0.85rem;
            margin-left: 10px;
        }

        .log-entry--muggins {
            color: var(--error-color);
            font-weight: bold;
        }

        .log-entry--round-start {
            font-size: 1.1rem;
            font-weight: 800;
            color: var(--highlight);
            margin-top: 15px;
            margin-bottom: 2px;
            text-align: center;
            text-transform: uppercase;
            letter-spacing: 1px;
            border-bottom: none;
        }

        .log-entry--score-update {
            text-align: center;
            font-size: 0.9rem;
            color: #ccc;
            margin-bottom: 10px;
            padding-bottom: 5px;
            border-bottom: 1px solid rgba(255,255,255,0.2);
            font-family: monospace;
        }

        /* Game Area */
        .game-area {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: flex-start;
            position: relative;
            padding-top: 10px;
            min-height: 0;
        }

        /* Card Styles */
        .card {
            width: var(--card-width);
            height: var(--card-height);
            background: white;
            border-radius: 8px;
            box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            padding: 5px;
            font-weight: bold;
            font-size: 1.4rem;
            position: relative;
            cursor: default;
            transition: transform var(--transition-normal), 
                        box-shadow var(--transition-normal), 
                        top var(--transition-slow), 
                        left var(--transition-slow);
            flex-shrink: 0;
        }

        .card--interactive {
            cursor: pointer;
        }

        .card--interactive:hover {
            transform: translateY(-5px);
        }

        .card--red { color: var(--card-red); }
        .card--black { color: var(--card-black); }

        .card__rank-top {
            align-self: flex-start;
            line-height: 1;
        }

        .card__suit-center {
            align-self: center;
            font-size: 2.5rem;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
        }

        .card__rank-bottom {
            align-self: flex-end;
            transform: rotate(180deg);
            line-height: 1;
        }

        .card--back {
            background: repeating-linear-gradient(
                45deg,
                #1565c0,
                #1565c0 10px,
                #1976d2 10px,
                #1976d2 20px
            );
            border: 2px solid white;
        }

        .card--back * { display: none; }

        .card--selected {
            transform: translateY(-20px) !important;
            box-shadow: 0 0 15px var(--highlight);
            border: 2px solid var(--highlight);
        }

        .card--disabled {
            filter: brightness(0.6);
            cursor: not-allowed;
        }

        .card--played {
            opacity: 0;
            pointer-events: none;
        }

        .card--starter {
            position: relative;
            margin-bottom: 20px;
        }

        .card--starter::after {
            content: 'CUT';
            position: absolute;
            bottom: -22px;
            left: 50%;
            transform: translateX(-50%);
            font-size: 0.75rem;
            color: var(--wood-light);
            font-weight: bold;
            letter-spacing: 1px;
            text-shadow: 0 1px 2px rgba(0,0,0,0.8);
            pointer-events: none;
        }

        /* Hand Zones */
        .hand {
            display: flex;
            justify-content: center;
            gap: var(--spacing-gap);
            height: 130px;
            padding: 5px;
            width: 100%;
            flex-shrink: 0;
        }

        /* Table Center */
        .table-center {
            display: flex;
            flex-direction: row;
            justify-content: space-between;
            align-items: flex-end;
            padding-bottom: 25px;
            height: 160px;
            width: 100%;
            margin: 10px 0;
            padding-left: 40px;
            padding-right: 40px;
            flex-shrink: 0;
            position: relative;
        }

        .table-left-group {
            display: flex;
            gap: var(--spacing-gap);
            align-items: center;
        }

        .deck-pile {
            position: relative;
            width: var(--card-width);
            height: var(--card-height);
        }

        .cut-card-slot {
            position: relative;
            width: var(--card-width);
            height: var(--card-height);
            border: 2px dashed rgba(255,255,255,0.3);
            border-radius: 8px;
        }

        .play-pile {
            position: relative;
            width: 160px;
            height: var(--card-height);
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .play-pile .card {
            position: absolute;
        }

        .count-display {
            position: absolute;
            top: -30px;
            background: rgba(0,0,0,0.6);
            color: #fff;
            padding: 4px 12px;
            border-radius: 12px;
            font-size: 0.9rem;
            font-weight: normal;
            white-space: nowrap;
            box-shadow: 0 2px 4px rgba(0,0,0,0.3);
            border: 1px solid rgba(255,255,255,0.1);
            display: none;
        }

        .count-display--visible {
            display: block;
        }

        /* Crib Section */
        .crib-section {
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            justify-content: flex-end;
            min-width: 300px;
        }

        .crib-label {
            font-size: 0.9rem;
            color: var(--wood-light);
            font-weight: bold;
            text-transform: uppercase;
            letter-spacing: 1px;
            margin-bottom: 5px;
            text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
        }

        .crib-display {
            display: flex;
            justify-content: flex-end;
            gap: var(--spacing-gap);
        }

        /* Controls */
        .controls {
            height: 60px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 5px;
            margin-bottom: 5px;
            flex-shrink: 0;
        }

        .status-text {
            font-size: 1.2rem;
            text-shadow: 1px 1px 2px black;
            font-weight: bold;
        }

        /* Buttons */
        .btn {
            background: var(--wood-light);
            color: #3e2723;
            border: 2px solid #3e2723;
            padding: 10px 30px;
            font-weight: bold;
            font-size: 1rem;
            cursor: pointer;
            border-radius: 5px;
            box-shadow: 2px 2px 0 rgba(0,0,0,0.4);
            transition: all var(--transition-fast);
            appearance: none;
        }

        .btn:active {
            transform: translate(1px, 1px);
            box-shadow: 1px 1px 0 rgba(0,0,0,0.4);
        }

        .btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }

        .btn--success {
            background-color: var(--success-color);
            color: white;
            border-color: #388e3c;
        }

        .btn--hidden {
            display: none;
        }
        
        .mobile-log-btn {
            display: none;
            padding: 5px 10px;
            font-size: 0.8rem;
        }

        /* Modal */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.85);
            z-index: 1000;
            justify-content: center;
            align-items: center;
            flex-direction: column;
        }

        .modal--visible {
            display: flex;
        }

        .modal__content {
            background: #2e1d15;
            border: 2px solid var(--wood-light);
            border-radius: 12px;
            padding: 40px 60px;
            box-shadow: 0 0 20px rgba(0,0,0,0.8);
            max-width: 850px;
            width: 90%;
            max-height: 90vh;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            transform: translateZ(0);
        }

        .modal__title {
            font-size: 1.5rem;
            color: var(--wood-light);
            margin-bottom: 5px;
            text-align: center;
        }

        .modal__subtitle {
            color: #bbb;
            font-size: 0.9rem;
            text-align: center;
            margin-bottom: 15px;
        }

        .modal__body {
            display: flex;
            gap: 30px;
            align-items: center;
            margin: 20px 0;
        }

        .modal__cards-section {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 10px;
        }

        .modal__details {
            font-size: 1rem;
            color: #ddd;
            text-align: center;
            min-height: 1.5em;
            white-space: nowrap;
        }

        .modal__cards {
            flex: 0 0 auto;
            display: flex;
            gap: 15px;
            align-items: flex-end;
        }

        .modal__separator {
            width: 2px;
            height: 100px;
            background: rgba(255,255,255,0.2);
            margin: 0 10px;
            align-self: flex-end;
            margin-bottom: 7px;
        }

        .modal__controls {
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: center;
            gap: 15px;
            min-width: 150px;
            padding-right: 5px;
        }

        .modal__input {
            width: 100%;
            font-size: 1.5rem;
            text-align: center;
            padding: 10px;
            border-radius: 5px;
            border: none;
            appearance: none;
        }

        .modal__controls .btn {
            width: 100%;
        }

        .modal__feedback {
            font-size: 1.3rem;
            font-weight: bold;
            min-height: 2.5em;
            text-align: center;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 10px;
            border-radius: 5px;
        }

        .modal__feedback--success { 
            color: var(--success-color); 
            background: rgba(76, 175, 80, 0.15);
        }
        .modal__feedback--error { 
            color: var(--error-color); 
            background: rgba(255, 82, 82, 0.15);
        }
        .modal__feedback--warning { 
            color: var(--warning-color); 
            background: rgba(255, 152, 0, 0.15);
        }

        .modal__feedback--hidden {
            display: none;
        }

        /* Responsive Design */
        @media (max-width: 800px) {
            :root {
                --card-width: 50px;
                --card-height: 75px;
                --spacing-gap: 8px;
            }

            .modal__content {
                padding: 25px;
            }

            .main-layout {
                flex-direction: column-reverse;
                height: auto;
                min-height: calc(100% - 110px);
            }

            .log-sidebar {
                width: 100%;
                height: 200px;
                margin-top: 10px;
                flex-shrink: 0;
            }

            .hand { height: 90px; }

            .table-center {
                padding: 0 10px;
                height: 120px;
                align-items: center;
            }

            .crib-section { min-width: 150px; }
            .score-value { font-size: 1.5rem; }

            .top-bar {
                min-height: 100px;
                height: auto;
                flex-direction: column;
                justify-content: center;
                gap: 10px;
                padding: 10px;
            }

            .game-info { align-items: center; }

            .modal__body {
                flex-direction: column;
                align-items: center;
            }

            .modal__cards {
                justify-content: center;
                flex-wrap: wrap;
            }

            .modal__separator { display: none; }

            .modal__controls {
                width: 100%;
                align-items: center;
                padding-right: 0;
            }

            .modal__input { max-width: 200px; }
            
            .modal__controls .btn { max-width: 200px; }

            .card__suit-center {
                font-size: 1.5rem;
            }
        }

        @media (max-width: 600px) {
            .modal__separator {
                display: block;
                width: 100%;
                height: 10px;
                background: transparent;
            }

            .crib-display {
                gap: 0;
            }

            .crib-display .card:not(:first-child) {
                margin-left: -35px;
            }

            .crib-display--revealed {
                position: absolute;
                right: 0;
                bottom: 22px;
                z-index: 20;
            }

            .crib-display--revealed .card:not(:first-child) {
                margin-left: 2px;
            }

            .play-pile {
                width: 80px;
            }
        }

        /* iOS Fixes */
        @supports (-webkit-touch-callout: none) {
            body { min-height: -webkit-fill-available; }
            .modal { height: -webkit-fill-available; }
        }

        @media (max-width: 480px) {
            .mobile-log-btn {
                display: block;
                margin-left: 5px;
            }

            .top-bar {
                height: 50px;
                min-height: 50px;
                padding: 0 10px;
                flex-direction: row;
            }

            .game-subtitle {
                display: none;
            }
            
            .game-title {
                font-size: 0.8rem;
            }

            .main-layout {
                flex-direction: column;
                padding: 0;
            }

            .log-sidebar {
                position: fixed;
                bottom: 0;
                left: 0;
                width: 100%;
                height: 50vh;
                z-index: 200;
                transform: translateY(110%);
                transition: transform 0.3s ease-out;
                background: rgba(0, 0, 0, 0.95);
                margin: 0;
                border-top: 1px solid var(--wood-light);
                border-radius: 12px 12px 0 0;
            }

            .log-sidebar.active {
                transform: translateY(0);
            }

            .game-area {
                justify-content: space-between;
            }

            .controls {
                z-index: 10;
                position: relative;
            }

            .scoreboard {
                gap: 15px;
            }

            .score-box {
                min-width: auto;
            }

            .score-value {
                font-size: 1.2rem;
            }

            /* Mobile Table Layout Adjustments */
            .table-center {
                position: relative;
                justify-content: flex-start;
                align-items: flex-end;
                padding-right: 60px; /* Reserve space for the crib on the right */
            }

            .crib-section {
                position: absolute;
                right: 5px;
                top: auto;
                bottom: 0;
                transform: none;
                transform-origin: right center;
                z-index: 5;
                min-width: auto;
                align-items: flex-end;
            }

            .crib-label {
                font-size: 0.6rem;
                margin-bottom: 2px;
                text-align: right;
                width: 100%;
            }
            
            .crib-display .card {
                box-shadow: -2px 2px 5px rgba(0,0,0,0.4);
            }
        }
