* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: #2c3e50;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: #34495e;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10;
}

#controls-panel {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 8px;
    pointer-events: auto;
    transition: all 0.2s ease;
    overflow: hidden;
}

#controls-panel.expanded {
    padding: 15px;
    min-width: 150px;
    width: auto;
}

#controls-panel.collapsed {
    padding: 8px;
    width: 150px;
    min-width: 80px;
    max-width: 150px;
}

.controls-content {
    transition: opacity 0.2s ease, max-height 0.2s ease;
    opacity: 1;
    max-height: 500px;
    overflow: hidden;
}

.controls-content.hidden {
    opacity: 0;
    max-height: 0;
    padding: 0;
    margin: 0;
}

#controls-toggle {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s ease;
    width: 100%;
    display: block;
    white-space: nowrap;
    box-sizing: border-box;
    text-align: center;
}

#controls-toggle:hover {
    background: #2980b9;
}

#controls-panel h3 {
    margin-bottom: 10px;
    color: #3498db;
    font-size: 14px;
}

#controls-panel p {
    margin: 5px 0;
    font-size: 12px;
    color: #ecf0f1;
}

/* Control button styles */
.control-button {
    margin-top: 5px;
    padding: 5px 10px;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.music-button {
    background: #9b59b6;
}

.music-button:hover {
    background: #8e44ad;
}

.control-button:hover {
    opacity: 0.8;
}

.furniture-button {
    margin-top: 10px;
    background: #3498db;
}

.floor-button {
    background: #9b59b6;
}

.save-button {
    background: #27ae60;
}

.audio-button {
    background: #e74c3c;
}

.video-button {
    background: #f39c12;
}

/* Furniture label and instructions */
.furniture-label {
    margin-top: 10px;
    font-size: 11px;
    color: #bdc3c7;
}

.furniture-instruction {
    font-size: 10px;
    color: #95a5a6;
}

/* Music box styles */
.music-box {
    margin-top: 10px;
    padding: 10px;
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
}

.music-box-text {
    margin: 0 0 5px 0;
    font-size: 11px;
    color: #bdc3c7;
}

/* Save confirmation popup */
.save-confirmation {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border: 2px solid #27ae60;
    border-radius: 10px;
    padding: 20px;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.save-confirmation-content {
    text-align: center;
}

.save-confirmation-title {
    color: #27ae60;
    margin: 0 0 10px 0;
}

.save-confirmation-message {
    margin: 0 0 15px 0;
}

.save-confirmation-button {
    background: #27ae60;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.save-confirmation-button:hover {
    background: #229954;
}



/* Map toggle panel */
#map-toggle-panel {
    position: absolute;
    left: 20px;
    top: 10px;
    pointer-events: auto;
    z-index: 10;
}

.map-toggle-button {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s ease;
    font-size: 14px;
}

.map-toggle-button:hover {
    background: rgba(0, 0, 0, 0.9);
}

.map-toggle-button.active {
    background: #3498db;
}

#game-container {
    position: relative;
    display: inline-block;
}

/* Old participants panel CSS removed - now handled by chat manager */

/* Floor Tile Panel */
#floor-tile-panel {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(44, 62, 80, 0.95);
    border: 2px solid #34495e;
    border-radius: 8px;
    padding: 15px;
    z-index: 1000;
    display: none;
    width: 290px;
    max-height: 80vh;
    overflow-y: auto;
}

.floor-tile-header {
    position: relative;
    text-align: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #34495e;
}

.floor-tile-header h3 {
    color: #ecf0f1;
    margin: 0;
    font-size: 16px;
}

.floor-tile-close-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.floor-tile-close-btn:hover {
    background: #c0392b;
}

#floor-tile-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.floor-tile-item {
    width: 60px;
    height: 60px;
    border: 1px solid #34495e;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(52, 73, 94, 0.5);
    transition: all 0.2s ease;
    padding: 2px;
}

.floor-tile-item:hover {
    background: rgba(52, 73, 94, 0.8);
    border-color: #3498db;
    transform: translateY(-2px);
}

.floor-tile-item img {
    width: 48px;
    height: 48px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.floor-tile-reset-btn {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 10px;
    width: 100%;
}

.floor-tile-reset-btn:hover {
    background: #7f8c8d;
}

.participant-item {
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
}

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

.participant-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 8px;
    background: #3498db;
}

.participant-name {
    color: #ecf0f1;
}

/* Scrollbar styling */
#participants-list::-webkit-scrollbar {
    width: 6px;
}

#participants-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

#participants-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

#participants-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Furniture Panel */
.furniture-panel {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 290px;
    background: rgba(44, 62, 80, 0.95);
    border: 2px solid #34495e;
    border-radius: 8px;
    padding: 10px;
    z-index: 1000;
    max-height: 80vh;
    overflow-y: auto;
}

.furniture-panel-header {
    text-align: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #34495e;
    position: relative;
}

.furniture-panel-header h3 {
    margin: 0;
    color: #ecf0f1;
    font-size: 16px;
}

.furniture-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.furniture-piece {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px;
    background: rgba(52, 73, 94, 0.5);
    border: 1px solid #34495e;
    border-radius: 4px;
    cursor: grab;
    transition: all 0.2s ease;
    min-width: 60px;
}

.furniture-piece:hover {
    background: rgba(52, 73, 94, 0.8);
    border-color: #3498db;
    transform: translateY(-2px);
}

.furniture-piece:active {
    cursor: grabbing;
}

.furniture-label {
    font-size: 10px;
    color: #ecf0f1;
    text-align: center;
    margin-top: 4px;
    font-weight: bold;
}

/* Rotation button styling */
.rotation-btn {
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.rotation-btn:hover {
    background: #2980b9;
}

.rotation-btn:active {
    transform: translateY(1px);
}

/* Wall Panel */
.wall-panel {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 320px;
    background: rgba(44, 62, 80, 0.95);
    border: 2px solid #34495e;
    border-radius: 8px;
    padding: 10px;
    z-index: 1000;
    max-height: 80vh;
    overflow-y: auto;
    display: none;
}

.wall-panel-header {
    text-align: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #34495e;
    position: relative;
}

.wall-panel-header h3 {
    margin: 0;
    color: #ecf0f1;
    font-size: 16px;
}

.wall-close-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.wall-close-btn:hover {
    background: #c0392b;
}

.wall-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 10px;
}

.wall-type {
    border: 2px solid #ccc;
    border-radius: 4px;
    padding: 10px;
    text-align: center;
    cursor: grab;
    background: white;
    transition: all 0.2s ease;
}

.wall-type:hover {
    border-color: #3498db;
    transform: scale(1.02);
}

.wall-type:active {
    cursor: grabbing;
}

/* Wall button styling */
.wall-button {
    background: #8B4513;
}

/* Chat Panel */
#chat-panel {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    border-radius: 8px;
    min-width: 300px;
    max-width: 400px;
    max-height: 500px;
    z-index: 1000;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    pointer-events: auto;
}

#chat-panel .panel-header {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 12px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

#chat-panel .panel-title {
    font-weight: bold;
    font-size: 13px;
}

#chat-panel .panel-toggle {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#chat-panel .panel-content {
    display: flex;
    flex-direction: column;
    height: 400px;
    overflow: hidden;
}

/* Participants Section */
.participants-section {
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 12px;
}

.participants-header {
    font-weight: bold;
    font-size: 11px;
    margin-bottom: 5px;
    color: #ccc;
}

.participants-list {
    max-height: 80px;
    overflow-y: auto;
}

.participant {
    padding: 2px 0;
    font-size: 11px;
    color: #ddd;
}

.participant-name {
    color: #4CAF50;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
}

.chat-message {
    margin-bottom: 4px;
    line-height: 1.3;
    word-wrap: break-word;
}

.chat-message.system-message {
    color: #888;
    font-style: italic;
}

.message-time {
    color: #666;
    font-size: 10px;
}

.message-author {
    color: #4CAF50;
    font-weight: bold;
    margin: 0 4px;
    background: none;
}

.message-text {
    color: #ddd;
}

.notification-badge {
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    margin-left: 5px;
    display: inline-block;
    min-width: 16px;
    text-align: center;
}

.chat-link {
    color: #3498db;
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s ease;
}

.chat-link:hover {
    color: #2980b9;
    text-decoration: none;
}

.chat-link:visited {
    color: #8e44ad;
}

.mention {
    background: #cb8514;
    color: white;
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: bold;
}

/* Chat Input */
.chat-input-section {
    display: flex;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0 0 8px 8px;
}

#chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    color: white;
    padding: 6px 8px;
    font-size: 12px;
    font-family: inherit;
}

#chat-input::placeholder {
    color: #888;
}

#chat-input:focus {
    outline: none;
    border-color: #4CAF50;
}

#chat-send {
    background: #4CAF50;
    border: none;
    border-radius: 4px;
    color: white;
    padding: 6px 12px;
    margin-left: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
}

#chat-send:hover {
    background: #45a049;
}

/* Mobile responsiveness and touch controls */
@media (max-width: 768px) {
    #controls-panel {
        bottom: 10px;
        right: 10px;
        font-size: 12px;
    }
    
    .control-button {
        padding: 6px 10px;
        font-size: 11px;
        min-height: 44px;
        min-width: 44px;
    }
    
    #controls-toggle {
        padding: 6px 12px;
        font-size: 11px;
    }
    
    /* Touch controls styling */
    #touch-joystick {
        width: 100px !important;
        height: 100px !important;
        top: 50% !important;
        right: 30px !important;
        transform: translateY(-50%) !important;
    }
    
    #touch-joystick > div {
        width: 40px !important;
        height: 40px !important;
    }
    
    /* Prevent zoom on touch */
    body {
        touch-action: manipulation;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
}
