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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Navbar */
.navbar {
    background: #1a1a2e;
    color: #fff;
    padding: 0 1.5rem;
    height: 56px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    position: relative;
    z-index: 100;
    user-select: none;
}

.nav-brand a {
    color: #fff;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.3px;
}

.nav-logo {
    color: #8b5cf6;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* User info */
.nav-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.6rem 0.3rem 0.3rem;
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    transition: background 0.2s;
}

.nav-user:hover {
    background: rgba(255,255,255,0.1);
}

.nav-avatar {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.nav-username {
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(255,255,255,0.85);
}

/* Icon button (settings) */
.nav-icon-btn {
    background: none;
    border: none;
    border-radius: 8px;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    padding: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.nav-icon-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

/* Nav buttons */
.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}

.nav-btn-primary {
    background: #8b5cf6;
    color: #fff;
}

.nav-btn-primary:hover {
    background: #7c3aed;
}

.nav-btn-secondary {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.85);
}

.nav-btn-secondary:hover {
    background: rgba(255,255,255,0.18);
    color: #fff;
}

.nav-btn-logout {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.6);
}

.nav-btn-logout:hover {
    background: rgba(239,68,68,0.15);
    color: #fca5a5;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

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

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
    margin-top: 1rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.2rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: #3498db;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

/* Auth Pages */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
}

.auth-card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.auth-card h1 {
    margin-bottom: 1.5rem;
    text-align: center;
}

.auth-link {
    text-align: center;
    margin-top: 1rem;
}

.auth-link a {
    color: #3498db;
    text-decoration: none;
}

/* Alerts */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Home Page */
.hero-section {
    text-align: center;
    padding: 3rem 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.hero-section h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero-section p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.rooms-section h2 {
    margin-bottom: 1rem;
}

.rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.room-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.room-header h3 {
    margin: 0;
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.badge-public {
    background-color: #2ecc71;
    color: white;
}

.badge-private {
    background-color: #e74c3c;
    color: white;
}

.badge-admin {
    background-color: #f39c12;
    color: white;
    margin-left: 0.5rem;
}

.room-info {
    margin-bottom: 1rem;
}

.room-info p {
    margin: 0.25rem 0;
    color: #666;
}

.no-rooms {
    text-align: center;
    color: #666;
    padding: 2rem;
}

.room-page {
    padding: 0;
    max-width: none;
    margin: 0;
}

/* Room Page - New Layout */
.room-layout {
    display: flex;
    height: calc(100vh - 56px);
    background: #f5f7fa;
}

/* Sidebar */
.sidebar {
    width: 280px;
    min-width: 280px;
    background: white;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid #eef0f4;
}

.room-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 0.25rem 0;
}

.room-creator {
    font-size: 0.85rem;
    color: #8b92a8;
}

/* Sidebar Sections */
.sidebar-section {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #eef0f4;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.section-icon {
    font-size: 1rem;
}

.section-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #5c6278;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.member-count {
    margin-left: auto;
    font-size: 0.8rem;
    color: #8b92a8;
    background: #f0f2f7;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
}

/* Member List */
.member-list {
    list-style: none;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.5rem;
    border-radius: 8px;
    margin-bottom: 0.15rem;
    transition: all 0.2s;
    cursor: default;
}

.member-item:hover {
    background: #f8f9fc;
}

.member-item.member-self {
    background: #eef2ff;
}

.member-item.member-self:hover {
    background: #e0e7ff;
}

.member-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.member-name {
    font-size: 0.9rem;
    color: #2d3748;
    flex: 1;
}

.member-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-weight: 600;
}

.member-badge.admin {
    background: #feebc8;
    color: #c05621;
}

.member-voice-icon {
    font-size: 0.85rem;
}

/* Voice Panel */
.voice-panel {
    background: #f8f9fc;
    margin: 0.5rem;
    border-radius: 10px;
    border: 1px solid #e8eaf0;
}

.voice-state {
    margin-left: auto;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    background: #e2e8f0;
    color: #64748b;
}

.voice-state.connected {
    background: #d1fae5;
    color: #065f46;
}

/* Voice Users */
.voice-users {
    margin-bottom: 0.75rem;
    min-height: 0;
}

.voice-participant-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.2rem;
    background: white;
    border-radius: 8px;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.voice-participant-item:hover {
    background: #f8fafc;
}

.voice-participant-item.speaking {
    background: #ecfdf5;
    border-left: 3px solid #10b981;
    box-shadow: 0 0 0 1px #a7f3d0;
}

.voice-name {
    flex: 1;
    font-size: 0.85rem;
    color: #374151;
    font-weight: 500;
}

.voice-mic-icon {
    font-size: 0.9rem;
    opacity: 0.7;
}

.voice-mic-icon.muted {
    color: #ef4444;
}

.voice-mic-icon.unmuted {
    color: #10b981;
}

/* Voice Context Menu */
.context-menu {
    position: fixed;
    z-index: 1000;
    min-width: 150px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 0.25rem;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #374151;
    transition: all 0.15s;
}

.context-menu-item:hover {
    background: #f3f4f6;
}

.context-menu-item.danger {
    color: #ef4444;
}

.context-menu-item.danger:hover {
    background: #fef2f2;
}

.context-menu-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 0.25rem 0;
}

/* Voice Toolbar */
.voice-toolbar {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    padding-top: 0.5rem;
    border-top: 1px solid #e2e8f0;
}

.voice-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    color: #5c6278;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.2s;
}

.voice-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.voice-btn:active {
    transform: translateY(0);
}

.voice-btn.primary {
    background: #10b981;
    color: white;
}

.voice-btn.primary:hover {
    background: #059669;
}

.voice-btn.danger {
    background: #ef4444;
    color: white;
}

.voice-btn.danger:hover {
    background: #dc2626;
}

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

.voice-btn.unmuted {
    background: #10b981;
    color: white;
}

.voice-btn.screen-share {
    background: #8b5cf6;
    color: white;
}

.voice-btn.screen-share:hover {
    background: #7c3aed;
}

.voice-btn.screen-share.active {
    background: #ef4444;
    color: white;
}

.voice-btn.screen-share.active:hover {
    background: #dc2626;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-panel {
    background: white;
    border-radius: 12px;
    width: 400px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
    font-size: 1rem;
}

/* Modal Tabs */
.modal-tabs {
    display: flex;
    border-bottom: 1px solid #e2e8f0;
}

.modal-tab {
    flex: 1;
    padding: 0.6rem 0.5rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: #94a3b8;
    transition: all 0.2s;
}

.modal-tab:hover {
    color: #64748b;
    background: #f8fafc;
}

.modal-tab.active {
    color: #8b5cf6;
    border-bottom-color: #8b5cf6;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #94a3b8;
    padding: 0.25rem;
    line-height: 1;
}

.modal-close:hover {
    color: #64748b;
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Screen Share Settings Fields */
.ss-field {
    margin-bottom: 1.25rem;
}

.ss-field:last-child {
    margin-bottom: 0;
}

.ss-field > label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.4rem;
}

.ss-field select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
}

.ss-field select:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139,92,246,0.2);
}

.ss-custom-res {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.ss-num {
    width: 80px;
    padding: 0.4rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.85rem;
    text-align: center;
}

.ss-num-sm {
    width: 60px;
}

.ss-num:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139,92,246,0.2);
}

.ss-x, .ss-at {
    color: #94a3b8;
    font-size: 0.85rem;
}

.ss-field input[type="range"] {
    width: 100%;
    margin: 0.3rem 0;
    accent-color: #8b5cf6;
}

.ss-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #94a3b8;
}

#ss-bitrate-label {
    float: right;
    color: #8b5cf6;
    font-weight: 600;
}

.ss-field-hint {
    font-size: 0.78rem;
    color: #94a3b8;
    margin-top: 0.3rem;
}

.ss-placeholder {
    margin-top: 1.5rem;
    padding: 1.5rem;
    text-align: center;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
}

.ss-placeholder-text {
    font-size: 0.85rem;
    color: #94a3b8;
}

/* Screen Share Container (in chat area) */
.screen-share-container {
    display: flex;
    flex-direction: column;
    max-height: 40%;
    min-height: 180px;
    background: #1e1e2e;
    border-bottom: 3px solid #8b5cf6;
    position: relative;
    z-index: 1;
}

.screen-share-container.screen-share-expanded {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: none;
    min-height: 0;
    z-index: 100;
    border-bottom: none;
}

.screen-share-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.75rem;
    color: #e4e4e7;
    font-size: 0.78rem;
    font-weight: 500;
    background: rgba(139, 92, 246, 0.15);
    flex-shrink: 0;
}

.screen-share-controls {
    display: flex;
    gap: 0.25rem;
}

.ss-ctrl-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 4px;
    color: #d4d4d8;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.ss-ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.screen-share-video-wrapper {
    flex: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.screen-share-video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    background: #000;
}

.voice-participant-item.screen-sharing {
    border: 1px solid rgba(139, 92, 246, 0.5);
    background: rgba(139, 92, 246, 0.08);
}

/* Leave Room Button */
.leave-room-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 1rem;
    padding: 0.75rem;
    background: #fef2f2;
    color: #ef4444;
    border: 1px solid #fecaca;
    border-radius: 10px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.leave-room-btn:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

.leave-room-btn svg {
    opacity: 0.7;
}



.room-main {
    flex: 1;
    background: white;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-left: 1px solid #e2e8f0;
    position: relative;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.message {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.message-username {
    font-weight: bold;
    color: #3498db;
}

.message-time {
    color: #666;
}

.message-content {
    word-wrap: break-word;
}

.message-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 4px;
    cursor: pointer;
}

.chat-input {
    padding: 1rem;
    border-top: 1px solid #ddd;
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

.input-group input[type="text"] {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.image-preview {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

.image-preview img {
    max-width: 100px;
    max-height: 100px;
    border-radius: 4px;
}

/* Mobile Header */
.mobile-header {
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    height: 50px;
    flex-shrink: 0;
}

.menu-toggle {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: #5c6278;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.2s;
}

.menu-toggle:hover {
    background: #f3f4f6;
}

.mobile-room-name {
    font-weight: 600;
    font-size: 1rem;
    color: #1a1a2e;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Responsive - Mobile Drawer */
@media (max-width: 768px) {
    .room-layout {
        flex-direction: column;
        height: calc(100vh - 56px);
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        min-width: 280px;
        z-index: 999;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        border-right: 1px solid #e2e8f0;
        border-bottom: none;
        max-height: none;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .mobile-header {
        display: flex;
    }
    
    .room-main {
        height: calc(100vh - 65px - 50px);
    }
    
    .chat-container {
        height: 100%;
    }
    
    .navbar {
        padding: 0 1rem;
    }

    .nav-username {
        display: none;
    }
    
    .container {
        padding: 1rem;
    }
}

/* =============================================
   Game System Styles
   ============================================= */

/* Sidebar game button */
.sidebar-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: #f0f2f7;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: #374151;
    transition: all 0.2s;
}

.sidebar-action-btn:hover {
    background: #e5e7eb;
    border-color: #cbd5e1;
}

/* Game type selector */
.game-type-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.game-type-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
}

.game-type-btn:hover {
    border-color: #93c5fd;
    background: #f0f7ff;
}

.game-type-btn.selected {
    border-color: #3b82f6;
    background: #eff6ff;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.game-type-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 8px;
    flex-shrink: 0;
}

.game-type-name {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    display: block;
}

.game-type-desc {
    font-size: 0.8rem;
    color: #6b7280;
    display: block;
    margin-top: 0.1rem;
}

/* Invite message in chat */
.invite-banner {
    padding: 0.75rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
}

.invite-header {
    font-weight: 600;
    font-size: 0.9rem;
    color: #92400e;
    margin-bottom: 0.3rem;
}

.invite-text {
    font-size: 0.9rem;
    color: #78350f;
    margin-bottom: 0.5rem;
}

.invite-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-sm {
    padding: 0.3rem 0.75rem;
    font-size: 0.85rem;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
}

.game-result {
    font-weight: 600;
    text-align: center;
    font-size: 0.95rem;
}

.invite-banner.invite-finished {
    background: #f0f2f7;
    border-color: #d1d5db;
}

.invite-finished-text {
    font-size: 0.85rem;
    color: #94a3b8;
    font-weight: 500;
    padding: 0.2rem 0;
}

/* =============================================
   Game Page Styles (game/detail.html)
   ============================================= */

.game-page {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    min-height: calc(100vh - 56px);
    display: flex;
    flex-direction: column;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.game-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.game-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
}

.game-room-name {
    font-size: 0.85rem;
    color: #8b92a8;
    background: #f0f2f7;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
}

.game-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.game-user-info {
    font-size: 0.85rem;
    color: #64748b;
}

.game-body {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    flex: 1;
}

.game-board-wrapper {
    flex-shrink: 0;
    background: #dcb35c;
    padding: 0.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

#game-canvas {
    display: block;
    cursor: pointer;
    border-radius: 2px;
}

.game-sidebar {
    flex: 1;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.game-status {
    font-size: 1rem;
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: #f0f2f7;
    color: #374151;
}

.game-status.status-waiting {
    background: #fef3c7;
    color: #92400e;
}

.game-status.status-ready {
    background: #d1fae5;
    color: #065f46;
}

.game-status.status-my-turn {
    background: #dbeafe;
    color: #1e40af;
    animation: pulse-bg 1.5s ease-in-out infinite;
}

.game-status.status-playing {
    background: #f0f2f7;
    color: #374151;
}

.game-status.status-finished {
    background: #f3e8ff;
    color: #6b21a8;
}

@keyframes pulse-bg {
    0%, 100% { background: #dbeafe; }
    50% { background: #bfdbfe; }
}

.game-players {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.player-slot {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #f8f9fc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
}

.player-stone {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.black-stone {
    color: #111;
}

.white-stone {
    color: #999;
    text-shadow: 0 0 1px #333;
}

.player-label {
    color: #64748b;
    font-weight: 500;
}

.player-name {
    color: #1f2937;
    font-weight: 600;
}

.game-spectators {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    background: #f8f9fc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #64748b;
}

.spectator-icon {
    font-size: 1rem;
}

.game-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.game-actions .btn-lg {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
}

.game-rematch-hint {
    width: 100%;
    text-align: center;
    padding: 0.75rem;
    font-size: 0.9rem;
    color: #64748b;
    background: #f0f2f7;
    border-radius: 8px;
}

/* Scoreboard */
.game-scoreboard {
    padding: 0.75rem 1rem;
    background: #f8f9fc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.scoreboard-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.scoreboard-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 0;
    font-size: 0.82rem;
    border-bottom: 1px solid #eef0f4;
}

.scoreboard-row:last-child {
    border-bottom: none;
}

.scoreboard-name {
    font-weight: 500;
    color: #1f2937;
}

.scoreboard-record {
    color: #64748b;
    font-size: 0.78rem;
}

.scoreboard-empty {
    font-size: 0.8rem;
    color: #94a3b8;
    text-align: center;
    padding: 0.3rem 0;
}

/* Undo UI */
.game-undo-hint {
    width: 100%;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.85rem;
    color: #92400e;
    background: #fef3c7;
    border-radius: 6px;
}

.btn-group {
    display: flex;
    gap: 0.4rem;
    width: 100%;
}

.btn-group .btn {
    flex: 1;
    font-size: 0.82rem;
    padding: 0.4rem 0.5rem;
}

.game-info {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.game-tip {
    font-size: 0.8rem;
    color: #94a3b8;
    text-align: center;
}

/* Responsive game page */
@media (max-width: 768px) {
    .game-body {
        flex-direction: column;
        align-items: center;
    }

    .game-board-wrapper {
        max-width: 100%;
    }

    #game-canvas {
        width: 100%;
        height: auto;
    }

    .game-sidebar {
        width: 100%;
    }

    .game-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .game-header-right {
        width: 100%;
        justify-content: space-between;
    }
}

/* Room stats compact widget */
.room-stats-compact {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    padding: 0.15rem 0;
}

.stat-opponent {
    font-weight: 500;
    color: #1f2937;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-value {
    font-weight: 700;
    color: #3b82f6;
    min-width: 12px;
    text-align: center;
}

.stat-divider {
    color: #94a3b8;
    font-weight: 300;
}

.stat-me {
    font-weight: 600;
    color: #e74c3c;
}

.stat-empty {
    font-size: 0.8rem;
    color: #94a3b8;
}

/* =============================================
   Dungeon Brawl Page Styles
   ============================================= */

.db-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.5rem 1rem;
    min-height: calc(100vh - 56px);
    display: flex;
    flex-direction: column;
}

.db-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.db-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.db-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
}

.db-room-name {
    font-size: 0.85rem;
    color: #8b92a8;
    background: #f0f2f7;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
}

.db-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.db-user-info {
    font-size: 0.85rem;
    color: #64748b;
}

.db-body {
    display: flex;
    gap: 1.5rem;
    flex: 1;
}

.db-canvas-wrapper {
    flex-shrink: 0;
    background: #1a1a2e;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    overflow: hidden;
    width: 960px;
    height: 540px;
}

#game-canvas {
    display: block;
    width: 960px;
    height: 540px;
}

.db-sidebar {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.db-status {
    font-size: 1rem;
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: #f0f2f7;
    color: #374151;
}

.db-status.status-waiting {
    background: #fef3c7;
    color: #92400e;
}

.db-status.status-playing {
    background: #d1fae5;
    color: #065f46;
}

.db-status.status-finished {
    background: #f3e8ff;
    color: #6b21a8;
}

.db-player-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.db-player-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #f8f9fc;
    border-radius: 8px;
    font-size: 0.85rem;
}

.db-player-item.alive {
    border-left: 3px solid #2ecc71;
}

.db-player-item.dead {
    opacity: 0.6;
}

.db-player-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.db-player-name {
    flex: 1;
    font-weight: 500;
}

.db-player-hp {
    font-size: 0.78rem;
    color: #64748b;
}

.db-player-revive {
    font-size: 0.7rem;
    color: #f39c12;
}

.db-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.db-actions .btn-lg {
    width: 100%;
}

.db-tip {
    font-size: 0.8rem;
    color: #94a3b8;
    text-align: center;
}

/* Controls panel */
.db-controls {
    padding: 0.75rem 1rem;
    background: #f8f9fc;
    border-radius: 8px;
}

.db-controls-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.db-controls-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 0.75rem;
    font-size: 0.78rem;
}

.key {
    font-family: monospace;
    background: #e2e8f0;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    color: #1f2937;
    font-weight: 600;
    text-align: center;
}

.action {
    color: #64748b;
}

/* Loading overlay */
.db-canvas-wrapper {
    position: relative;
}

.db-canvas-loading {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #1a1a2e;
    z-index: 10;
    gap: 1rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #2d2d5e;
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: #94a3b8;
    font-size: 0.9rem;
    font-family: monospace;
}

@media (max-width: 1400px) {
    .db-body {
        flex-direction: column;
        align-items: center;
    }
    .db-canvas-wrapper {
        width: 100%;
        max-width: 960px;
        height: auto;
        aspect-ratio: 16/9;
    }
    #game-canvas {
        width: 100%;
        height: auto;
    }
}
