        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Varela Round', sans-serif;
            overflow: hidden;
            background: #f0f0f0;
            cursor: url('data:image/png;base64,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'), 6 6, auto;
        }

        #join-screen {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: #77DD76;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 1000;
        }

        #join-screen.hidden {
            display: none;
        }

        .join-box {
            background: rgb(255, 255, 255);
            padding: 40px;
            border-radius: 20px;
            /* box-shadow: 0 10px 40px rgba(0,0,0,0.3); */
            text-align: center;
        }

        .join-box h1 {
            color: #77DD76;
            margin-bottom: 20px;
            font-size: 36px;
        }

        .join-box input {
            padding: 12px 20px;
            font-size: 16px;
            border: 2px solid #77DD76;
            border-radius: 10px;
            margin: 10px 0;
            width: 100%;
            max-width: 300px;
        }

        .join-box button {
            padding: 12px 40px;
            font-size: 18px;
            background: #77DD76;
            color: white;
            border: none;
            border-radius: 10px;
            cursor: pointer;
            margin-top: 10px;
            transition: background 0.3s;
            font-family: 'Varela Round', sans-serif;
        }

        .join-box button:hover {
            background: #41a360;
        }

        #game-container {
            width: 100%;
            height: 100%;
            position: relative;
        }

        #canvas-container {
            width: 100%;
            height: 100%;
            background-image: url('../assets/tt-bg-nosign.jpg');
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
        }

        #chat-container {
            position: absolute;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            width: 500px;
            background: transparent;
            border-radius: 15px;
            overflow: hidden;
            z-index: 200;
        }

        #chat-header {
            background: #6D3614;
            color: white;
            padding: 10px 15px;
            cursor: pointer;
            display: flex;
            justify-content: space-between;
            align-items: center;
            user-select: none;
        }

        #chat-header:hover {
            background: #5a2c10;
        }

        #chat-toggle {
            font-size: 18px;
            transition: transform 0.3s;
        }

        #chat-toggle.collapsed {
            transform: rotate(180deg);
        }

        #chat-messages {
            height: 200px;
            overflow-y: auto;
            padding: 15px;
            background: rgba(158, 97, 46, 0.25);
            transition: height 0.3s ease;
        }

        #chat-messages.collapsed {
            height: 0;
            padding: 0;
            overflow: hidden;
        }

        .chat-message {
            margin-bottom: 8px;
            padding: 8px;
            background: rgba(248, 249, 250, 0.8);
            border-radius: 8px;
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            gap: 10px;
        }

        .chat-message-content {
            flex: 1;
        }

        .chat-message-time {
            color: #999;
            font-size: 11px;
            white-space: nowrap;
            align-self: center;
        }

        .chat-message .username {
            font-weight: bold;
            color: #77DD76;
        }

        .chat-message .text {
            color: #333;
        }

        .chat-message.system {
            background: rgba(227, 242, 253, 0.8);
            font-style: italic;
        }

        .chat-message.system .text {
            color: #77DD76;
        }

        #chat-input-container {
            display: flex;
            padding: 10px;
            background: rgba(158, 97, 46, 1);
        }

        #chat-input {
            flex: 1;
            padding: 10px;
            border: 2px solid #77DD76;
            border-radius: 8px;
            font-size: 14px;
            background: #ffffff;
        }

        #chat-send {
            margin-left: 10px;
            padding: 10px 20px;
            background: #77DD76;
            color: white;
            border: 1px solid #50C877;
            border-radius: 8px;
            cursor: pointer;
            font-weight: bold;
        }

        #chat-send:hover {
            background: #41a360;
        }

        #player-info {
            position: absolute;
            top: 20px;
            left: 20px;
            background: rgba(255, 255, 255, 0.95);
            padding: 15px 25px;
            border-radius: 15px;
            font-size: 18px;
        }

        #player-info .name {
            font-weight: bold;
            color: #77DD76;
        }

        #leave-button {
            padding: 4px 10px;
            background: transparent;
            color: #A80000;
            border: 2px solid #A80000;
            border-radius: 8px;
            cursor: pointer;
            font-weight: bold;
            font-size: 12px;
            transition: background 0.3s, color 0.3s;
            margin-top: 5px;
        }

        #leave-button:hover {
            background: #FF7C7C;
            color: white;
        }

        .nametag {
            position: absolute;
            background: #77DD76;
            color: white;
            padding: 4px 12px;
            border-radius: 12px;
            border: 1px solid #50C877;
            font-size: 15px;
            font-weight: bold;
            pointer-events: none;
            white-space: nowrap;
            transform: translate(-50%, -50%);
            z-index: 100;
        }

        .remote-nametag {
            background: #9E612E;
            border: 1px solid #5C2A0A;
        }

        #notification-banner {
            position: absolute;
            top: 20px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(74, 108, 59, 0.95);
            color: white;
            padding: 12px 30px;
            border-radius: 10px;
            border: 2px solid #50C877;
            font-size: 16px;
            font-weight: bold;
            z-index: 300;
            animation: slideDown 0.3s ease-out;
            white-space: nowrap;
        }

        #notification-banner.hidden {
            display: none;
        }

        @keyframes slideDown {
            from {
                transform: translateX(-50%) translateY(-60px);
                opacity: 0;
            }

            to {
                transform: translateX(-50%) translateY(0);
                opacity: 1;
            }
        }

        #custom-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.6);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 500;
        }

        #custom-modal.hidden {
            display: none;
        }

        #modal-content {
            background: rgba(255, 255, 255, 0.98);
            padding: 30px 40px;
            border-radius: 15px;
            border: 3px solid #77DD76;
            min-width: 300px;
            max-width: 500px;
            text-align: center;
        }

        #modal-message {
            font-size: 18px;
            color: #333;
            margin-bottom: 25px;
            line-height: 1.5;
        }

        #modal-buttons {
            display: flex;
            gap: 15px;
            justify-content: center;
        }

        .modal-btn {
            padding: 10px 30px;
            font-size: 16px;
            background: #77DD76;
            color: white;
            border: 2px solid #50C877;
            border-radius: 10px;
            cursor: pointer;
            font-weight: bold;
            transition: background 0.3s;
        }

        .modal-btn:hover {
            background: #41a360;
        }

        .modal-btn.hidden {
            display: none;
        }

        .chat-bubble {
            position: absolute;
            background: white;
            color: #333;
            padding: 8px 14px;
            border-radius: 18px;
            font-size: 14px;
            pointer-events: none;
            max-width: 200px;
            word-wrap: break-word;
            transform: translate(-50%, -50%);
            z-index: 101;
            border: 2px solid #B2B2B2;
            display: none;
        }

        .chat-bubble::after {
            content: '';
            position: absolute;
            bottom: -10px;
            left: 50%;
            transform: translateX(-50%);
            width: 0;
            height: 0;
            border-left: 10px solid transparent;
            border-right: 10px solid transparent;
            border-top: 10px solid #B2B2B2;
        }

        .chat-bubble::before {
            content: '';
            position: absolute;
            bottom: -7px;
            left: 50%;
            transform: translateX(-50%);
            width: 0;
            height: 0;
            border-left: 8px solid transparent;
            border-right: 8px solid transparent;
            border-top: 8px solid white;
            z-index: 1;
        }

        .chat-bubble.visible {
            display: block;
            animation: bubblePop 0.2s ease-out;
        }

        @keyframes bubblePop {
            0% {
                transform: translate(-50%, -50%) scale(0.5);
                opacity: 0;
            }

            100% {
                transform: translate(-50%, -50%) scale(1);
                opacity: 1;
            }
        }
/* Disabled state styles for join screen */
.join-box button:disabled {
    background: #cccccc !important;
    cursor: not-allowed;
    opacity: 0.6;
}

.join-box input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Join error message */
.join-error {
    color: #d32f2f;
    background: #ffebee;
    border: 2px solid #ef5350;
    border-radius: 8px;
    padding: 10px;
    margin: 10px 0;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
}

.join-error.hidden {
    display: none;
}
