        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            margin: 0;
            min-height: 100vh;
            background-color: #f0f0f0;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        /* --- SHARED STYLES --- */
        .card-box {
            background-color: #e0e0e0;
            padding: 25px;
            width: 100%;
            max-width: 480px;
            border-radius: 8px;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
            position: relative;
            box-sizing: border-box;
            margin: 10px;
        }

        h1 {
            margin-top: 0;
            font-size: 24px;
            margin-bottom: 5px;
            text-align: center;
        }

        .description {
            font-size: 14px;
            color: #444;
            margin-bottom: 5px;
            text-align: center;
        }

        .creator-credit {
            font-size: 13px;
            color: #666;
            font-style: italic;
            margin-bottom: 15px;
            border-bottom: 1px solid #ccc;
            display: block;
            text-align: center;
            padding-bottom: 10px;
        }

        .creator-highlight {
            color: #2c3e50;
            font-weight: bold;
        }

        /* Form Elements */
        .config-row {
            margin-bottom: 12px;
            font-size: 14px;
        }

        .config-row label {
            display: inline-flex;
            align-items: center;
            padding: 2px 0;
            width: fit-content;
        }

        input[type="checkbox"] {
            margin-right: 8px;
            transform: scale(1.1);
        }

        .indent {
            margin-left: 24px;
            margin-top: 4px;
            color: #555;
            line-height: 1.6;
        }

        input[type="number"] {
            width: 45px;
            padding: 5px;
            text-align: center;
            border: 1px solid #aaa;
            border-radius: 3px;
            font-size: 16px;
        }

        input::-webkit-outer-spin-button,
        input::-webkit-inner-spin-button {
            -webkit-appearance: none;
            margin: 0;
        }

        input[type=number] {
            -moz-appearance: textfield;
            appearance: textfield;
        }

        select {
            padding: 6px;
            border-radius: 3px;
            font-size: 16px;
            width: 100%;
        }

        input[type="text"] {
            padding: 8px;
            border-radius: 4px;
            border: 1px solid #aaa;
            width: 100%;
            box-sizing: border-box;
            font-size: 16px;
            margin-bottom: 10px;
        }

        /* Buttons */
        .btn {
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-weight: bold;
            transition: 0.2s;
            width: 100%;
            padding: 12px;
            font-size: 16px;
            color: white;
            display: block;
            margin-top: 10px;
        }

        .btn-primary {
            background-color: #007bff;
        }

        .btn-primary:hover {
            background-color: #0056b3;
        }

        .btn-secondary {
            background-color: #6c757d;
            margin-top: 10px;
        }

        .btn-secondary:hover {
            background-color: #5a6268;
        }

        .btn-green {
            background-color: #28a745;
        }

        .btn-green:hover {
            background-color: #218838;
        }

        .btn:disabled {
            background-color: #999;
            cursor: not-allowed;
            opacity: 0.7;
        }

        .btn-purple {
            background-color: #6f42c1;
        }

        .btn-purple:hover {
            background-color: #5a32a3;
        }

        /* --- MULTIPLAYER MENU --- */
        #multiplayer-menu {
            display: none;
            text-align: center;
        }

        .room-code-display {
            font-size: 32px;
            font-weight: bold;
            letter-spacing: 5px;
            margin: 15px 0;
            color: #333;
            background: white;
            padding: 10px;
            border: 2px dashed #999;
        }

        .status-text {
            color: #d9534f;
            font-weight: bold;
            margin: 10px 0;
            font-size: 14px;
        }

        #join-code-input {
            font-size: 24px;
            padding: 10px;
            width: 150px;
            text-align: center;
            letter-spacing: 2px;
            text-transform: uppercase;
            margin-bottom: 10px;
        }

        .connection-status {
            font-size: 11px;
            text-align: center;
            color: #888;
            margin-top: 15px;
            border-top: 1px solid #ddd;
            padding-top: 5px;
        }

        /* Player List in Lobby */
        #player-list {
            text-align: left;
            background: #fff;
            padding: 10px;
            border-radius: 4px;
            margin: 10px 0;
            max-height: 150px;
            overflow-y: auto;
            border: 1px solid #ccc;
        }

        .player-item {
            padding: 5px;
            border-bottom: 1px solid #eee;
            display: flex;
            justify-content: space-between;
        }

        .player-item:last-child {
            border-bottom: none;
        }

        .is-host-badge {
            background: #ffd700;
            color: #000;
            font-size: 10px;
            padding: 2px 5px;
            border-radius: 3px;
            font-weight: bold;
            margin-left: 5px;
        }

        /* --- GAME SCREEN --- */
        #game-screen {
            display: none;
            width: 100%;
            justify-content: center;
        }

        #game-box {
            text-align: center;
        }

        .stats-bar {
            display: flex;
            justify-content: space-between;
            margin-bottom: 20px;
            font-size: 18px;
            font-weight: bold;
            border-bottom: 1px solid #ccc;
            padding-bottom: 15px;
        }

        .problem-container {
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 40px;
            font-weight: bold;
            margin-bottom: 20px;
            flex-wrap: nowrap;
        }

        .p-num {
            display: inline-block;
            min-width: 60px;
            text-align: right;
        }

        .p-op {
            display: inline-block;
            width: 40px;
            text-align: center;
        }

        .p-eq {
            margin: 0 10px;
        }

        #answer-input {
            font-size: 40px;
            width: 120px;
            padding: 5px;
            border: 2px solid #555;
            border-radius: 4px;
            outline: none;
            background: white;
        }

        #answer-input:focus {
            border-color: #007bff;
        }

        /* --- MODAL --- */
        #game-over-modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.6);
            justify-content: center;
            align-items: center;
            z-index: 1000;
        }

        .modal-content {
            background: white;
            padding: 30px;
            border-radius: 12px;
            text-align: center;
            width: 90%;
            max-width: 400px;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
            max-height: 80vh;
            overflow-y: auto;
        }

        .score-big {
            font-size: 48px;
            font-weight: bold;
            color: #333;
            margin: 10px 0;
        }

        /* Leaderboard Table */
        .leaderboard-table {
            width: 100%;
            border-collapse: collapse;
            margin: 15px 0;
            text-align: left;
        }

        .leaderboard-table th {
            border-bottom: 2px solid #ddd;
            padding: 5px;
            font-size: 14px;
            color: #555;
        }

        .leaderboard-table td {
            border-bottom: 1px solid #eee;
            padding: 8px 5px;
            font-weight: bold;
        }

        .lb-rank {
            width: 30px;
            text-align: center;
            color: #888;
        }

        .lb-score {
            text-align: right;
            color: #007bff;
        }

        .lb-me {
            background-color: #f0f8ff;
        }

        .rematch-msg {
            font-size: 14px;
            font-style: italic;
            color: #d9534f;
            margin-bottom: 10px;
            min-height: 20px;
            font-weight: bold;
        }

        /* --- COUNTDOWN OVERLAY --- */
        #countdown-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.85);
            justify-content: center;
            align-items: center;
            z-index: 2000;
            flex-direction: column;
            color: white;
        }

        .countdown-number {
            font-size: 120px;
            font-weight: bold;
            animation: pulse 1s infinite;
        }

        .countdown-text {
            font-size: 24px;
            margin-bottom: 20px;
        }

        @keyframes pulse {
            0% {
                transform: scale(1);
            }

            50% {
                transform: scale(1.1);
            }

            100% {
                transform: scale(1);
            }
        }

        /* Mobile Tweaks */
        @media (max-width: 480px) {
            .card-box {
                padding: 15px;
            }

            .indent {
                margin-left: 0;
                font-size: 13px;
            }

            input[type="number"] {
                width: 36px;
                padding: 3px 1px;
                font-size: 14px;
            }

            .problem-container {
                font-size: 32px;
            }

            #answer-input {
                font-size: 32px;
                width: 90px;
            }

            .p-num {
                min-width: 45px;
            }

            .p-op {
                width: 30px;
            }
        }

        @media (max-height: 600px) {
            body {
                align-items: flex-start;
                padding-top: 20px;
            }
        }
