body {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    margin: 0;
    background: linear-gradient(135deg, #232526 0%, #414345 100%);
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    color: #222;
}

#join-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 32px 24px 32px;
    background: rgba(255,255,255,0.95);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    min-width: 320px;
    gap: 12px;
}

#join-screen h1 {
    margin-bottom: 16px;
    font-size: 2.2em;
    font-weight: 700;
    letter-spacing: 1px;
    color: #2e7dff;
    text-shadow: 0 2px 8px #2e7dff22;
}

#join-screen input {
    padding: 12px;
    margin-bottom: 8px;
    border: 1.5px solid #bfc9d1;
    border-radius: 6px;
    width: 220px;
    text-align: center;
    font-size: 1.1em;
    background: #f7fafd;
    transition: border 0.2s;
}
#join-screen input:focus {
    border: 1.5px solid #2e7dff;
    outline: none;
}

#join-screen button {
    padding: 12px 28px;
    background: linear-gradient(90deg, #2e7dff 0%, #6a82fb 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    box-shadow: 0 2px 8px #2e7dff22;
    transition: background 0.2s, transform 0.1s;
}
#join-screen button:hover {
    background: linear-gradient(90deg, #6a82fb 0%, #2e7dff 100%);
    transform: translateY(-2px) scale(1.03);
}

#game-container {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    width: 100vw;
    height: 100vh;
    padding: 0;
    box-sizing: border-box;
    gap: 32px;
    overflow-y: auto;
}

canvas {
    border-radius: 12px;
    border: none;
    background: #181c20;
    box-shadow: 0 8px 32px rgba(46,125,255,0.10);
    max-width: 70vw;
    max-height: 70vh;
    margin-top: 20px;
    margin-bottom: 20px;
    display: block;
}

#board-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    height: auto;
    padding: 10px;
}

#sidebar {
    width: 280px;
    margin-left: 0;
    margin-top: 20px;
    padding: 20px 16px 16px 16px;
    background: rgba(255,255,255,0.97);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.10);
    height: fit-content;
    max-height: 70vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#sidebar h2 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1.15em;
    font-weight: 700;
    color: #2e7dff;
    border-bottom: 1.5px solid #e3eaf2;
    padding-bottom: 6px;
    letter-spacing: 0.5px;
}

#sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#sidebar li {
    padding: 6px 0 6px 0;
    font-size: 1em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-radius: 4px;
    margin-bottom: 2px;
    transition: background 0.15s;
}
#sidebar li:hover {
    background: #f0f6ff;
}

#scoreboard li {
    font-weight: 600;
    letter-spacing: 0.2px;
    padding: 8px 10px;
    background-color: #f7fafd;
    margin-bottom: 6px;
    border-radius: 6px;
    transition: transform 0.2s;
}

#scoreboard li:hover {
    transform: translateX(5px);
}

#sidebar li[data-me="true"] {
    background: #e3f0ff;
    color: #2e7dff !important;
}

/* Custom scrollbar for sidebar */
#sidebar {
    scrollbar-width: thin;
    scrollbar-color: #b3c6e0 #f7fafd;
}
#sidebar::-webkit-scrollbar {
    width: 8px;
}
#sidebar::-webkit-scrollbar-thumb {
    background: #b3c6e0;
    border-radius: 4px;
}
#sidebar::-webkit-scrollbar-track {
    background: #f7fafd;
    border-radius: 4px;
}

/* Add styles for the chat box */
#chat-container {
    display: flex;
    flex-direction: column;
    height: 220px;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#chat-messages {
    flex-grow: 1;
    padding: 10px;
    overflow-y: auto;
    background-color: #f7fafd;
    max-height: 170px;
}

#chat-input-area {
    display: flex;
    border-top: 1px solid #e3eaf2;
    background-color: white;
}

#chat-input {
    flex-grow: 1;
    border: none;
    padding: 8px 12px;
    font-size: 0.9em;
    outline: none;
}

#chat-send {
    background: linear-gradient(90deg, #2e7dff 0%, #6a82fb 100%);
    color: white;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9em;
}

#chat-send:hover {
    background: linear-gradient(90deg, #6a82fb 0%, #2e7dff 100%);
}

.chat-message {
    margin-bottom: 8px;
    word-wrap: break-word;
}

.chat-message .sender {
    font-weight: bold;
    margin-right: 5px;
}

.chat-message .timestamp {
    font-size: 0.8em;
    color: #888;
    margin-left: 5px;
}

.chat-system-message {
    color: #888;
    font-style: italic;
    margin-bottom: 8px;
}

#mobile-controls {
    display: none;
}

/* Swipe instructions */
.swipe-instructions {
    padding: 10px 15px;
    background: rgba(46, 125, 255, 0.9);
    color: white;
    text-align: center;
    border-radius: 20px;
    margin: 15px auto;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    font-weight: 500;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@media (max-width: 700px) {
    #game-container {
        flex-direction: column !important;
        align-items: center;
        gap: 0;
        padding: 0;
        width: 100vw;
        height: 100%;
        min-height: 100vh;
        overflow-x: hidden;
        overflow-y: auto;
    }
    
    #board-wrapper {
        width: 100vw;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;
        padding: 10px 0;
    }
    
    canvas {
        max-width: 90vw;
        max-height: 50vh;
        min-height: auto;
        margin: 5px auto 10px;
        touch-action: none;
        border-radius: 8px;
    }
    #sidebar {
        width: 90vw;
        max-width: 400px;
        margin: 0 auto;
        margin-top: 5px;
        margin-bottom: 10px;
        border-radius: 16px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        padding: 10px 8px;
        max-height: 45vh;
        height: auto;
    }
    #sidebar h2 {
        font-size: 0.9em;
        padding-bottom: 4px;
        margin-top: 8px;
        margin-bottom: 6px;
    }
    #scoreboard {
        margin-bottom: 10px;
    }
    #scoreboard li {
        font-size: 0.9em;
        padding: 5px 6px;
        margin-bottom: 4px;
    }
    #chat-container {
        height: 150px;
        min-height: 100px;
        max-height: 180px;
    }
    #chat-messages {
        max-height: 90px;
        font-size: 0.9em;
    }
    #chat-input-area {
        font-size: 0.9em;
    }
    #chat-input {
        padding: 6px 8px;
    }
    #chat-send {
        padding: 6px 8px;
    }
    #mobile-controls {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin: 10px 0;
        width: 90vw;
        max-width: 400px;
        z-index: 10;
    }
    
    /* Voice chat mobile adjustments */
    #voice-chat-controls {
        padding: 8px;
        margin-top: 0;
        margin-bottom: 8px;
    }
    
    .voice-btn {
        padding: 6px;
        margin-bottom: 4px;
    }
    
    /* Color dot adjustments for smaller screens */
    .color-dot {
        width: 8px;
        height: 8px;
    }
}

/* Voice Chat Styles */
#voice-chat-controls {
    margin-top: 1rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background-color: #f0f4f8;
    border-radius: 5px;
}

#voice-status {
    margin: 0.5rem 0;
    font-style: italic;
    color: #555;
}

#voice-buttons {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.5rem;
}

.voice-btn {
    background-color: #4299e1;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.voice-btn:hover {
    background-color: #2b6cb0;
}

.voice-btn.muted {
    background-color: #e53e3e;
}

.voice-btn.muted:hover {
    background-color: #c53030;
}

#volume-control {
    display: flex;
    align-items: center;
    margin-top: 0.5rem;
}

#volume-control label {
    margin-right: 0.5rem;
}

#volume-slider {
    flex-grow: 1;
}

#active-speakers {
    margin-top: 0.5rem;
}

.active-speaker {
    display: flex;
    align-items: center;
    margin-bottom: 0.25rem;
    padding: 0.25rem;
    border-radius: 3px;
}

.active-speaker.speaking {
    background-color: rgba(66, 153, 225, 0.2);
}

.speaker-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.speaker-indicator.muted {
    background-color: #e53e3e;
}

.speaker-indicator.unmuted {
    background-color: #48bb78;
}

.speaker-name {
    font-size: 0.9rem;
}

/* Responsive fixes for voice controls on small screens */
@media (max-width: 768px) {
    #voice-chat-controls {
        padding: 0.25rem;
    }
    
    .voice-btn {
        padding: 0.25rem;
        font-size: 0.8rem;
    }
    
    #volume-control label {
        font-size: 0.8rem;
    }
}

/* Color Picker Styles */
#color-picker-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 8px;
    width: 100%;
}

.color-pickers-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
}

.color-help-text {
    text-align: center;
    color: #666;
    margin-bottom: 12px;
    font-style: italic;
    width: 100%;
}

.color-picker-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.color-picker-group label {
    margin-bottom: 5px;
    font-size: 0.9em;
    color: #555;
}

.color-picker-group input[type="color"] {
    -webkit-appearance: none;
    width: 70px;
    height: 35px;
    border: none;
    border-radius: 4px;
    background: none;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.color-picker-group input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
    border-radius: 4px;
}

.color-picker-group input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Responsive styles for mobile */
@media (max-width: 700px) {
    #color-picker-container {
        gap: 5px;
    }
    
    .color-pickers-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .color-picker-group {
        flex-direction: row;
        justify-content: space-between;
        width: 100%;
        padding: 0 5px;
    }
    
    .color-picker-group input[type="color"] {
        width: 60px;
        height: 30px;
    }
    
    .color-help-text {
        margin-top: 5px;
        margin-bottom: 10px;
    }
}

/* Color dot indicators */
.color-indicator {
    display: inline-flex;
    align-items: center;
    margin-right: 8px;
}

.color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    margin-right: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

#scoreboard li {
    display: flex;
    align-items: center;
}

/* Mobile controls that are hidden but defined for larger screens */
.arrow-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 18px;
    margin-top: 6px;
}

.arrow-btn {
    background: linear-gradient(90deg, #2e7dff 0%, #6a82fb 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 2em;
    margin: 0 4px;
    box-shadow: 0 2px 8px rgba(46, 125, 255, 0.13);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
    outline: none;
    user-select: none;
}

.arrow-btn:active {
    background: linear-gradient(90deg, #6a82fb 0%, #2e7dff 100%);
    transform: scale(0.95);
}

/* Pattern Selector Styles */
#pattern-selector-container {
    width: 100%;
    margin-top: 8px;
    margin-bottom: 8px;
    padding: 12px;
    background-color: #f7fafd;
    border-radius: 8px;
    box-sizing: border-box;
}

#pattern-selector-container h3 {
    font-size: 0.95em;
    margin: 0 0 10px 0;
    color: #444;
    text-align: center;
    font-weight: 600;
}

.pattern-options {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.pattern-option {
    flex: 1;
    text-align: center;
}

.pattern-option input[type="radio"] {
    display: none;
}

.pattern-option label {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.pattern-option label:hover {
    background-color: #e3f0ff;
}

.pattern-option input[type="radio"]:checked + label {
    background-color: #dfeafd;
    box-shadow: 0 2px 4px rgba(46, 125, 255, 0.2);
}

.pattern-preview {
    width: 60px;
    height: 20px;
    display: flex;
    margin-bottom: 6px;
    border-radius: 4px;
    overflow: hidden;
}

.preview-segment {
    height: 100%;
}

.stripe-preview .preview-segment {
    flex: 1;
}

.stripe-preview .primary {
    background-color: var(--primary-color, #4080ff);
}

.stripe-preview .secondary {
    background-color: var(--secondary-color, #6a82fb);
}

.gradient-preview .preview-segment.gradient {
    width: 100%;
    background: linear-gradient(90deg, var(--primary-color, #4080ff) 0%, var(--secondary-color, #6a82fb) 100%);
}

.outline-preview .preview-segment.outline {
    width: 100%;
    background-color: var(--primary-color, #4080ff);
    border: 2px solid var(--secondary-color, #6a82fb);
    box-sizing: border-box;
}

.pattern-option span {
    font-size: 0.85em;
    font-weight: 500;
    color: #444;
}

@media (max-width: 700px) {
    #pattern-selector-container {
        padding: 8px;
    }
    
    .pattern-options {
        flex-direction: column;
        gap: 8px;
    }
}

/* User Info Styles */
#user-controls {
    margin-top: 30px;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    position: relative; /* To ensure it appears above other content */
    z-index: 10;
}

#user-info {
    margin-bottom: 12px;
    font-size: 0.9rem;
}

#user-info p {
    margin: 5px 0;
}

#logout-button {
    width: 100%;
    padding: 8px 0;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#logout-button:hover {
    background-color: #c0392b;
}

.game-btn {
    font-size: 14px;
    font-weight: 500;
    -webkit-appearance: none;
    appearance: none;
}