

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #0a0a1a;
    color: white;
    min-height: 100vh;
    overflow: hidden;
    touch-action: none;
}

#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.8s ease;
}

#loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 30px;
}

.loader-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
}

.loader-ring:nth-child(2) {
    width: 80%;
    height: 80%;
    top: 10%;
    left: 10%;
    border-top-color: #764ba2;
    animation-duration: 1s;
    animation-direction: reverse;
}

.loader-ring:nth-child(3) {
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
    border-top-color: #f093fb;
    animation-duration: 0.8s;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 20px;
    color: rgba(255,255,255,0.9);
    text-align: center;
    font-weight: 300;
    letter-spacing: 2px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

#city-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0a0a1a;
}

#city-canvas {
    width: 100%;
    height: 100%;
    display: block;
    outline: none;
    image-rendering: optimizeQuality;
}

.ui-overlay {
    position: fixed;
    z-index: 100;
    pointer-events: none;
}

.ui-overlay > * {
    pointer-events: auto;
}

#top-bar {
    top: 15px;
    left: 15px;
    right: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.logo {
    font-size: 20px;
    font-weight: bold;
    color: white;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 10px 20px;
    border-radius: 50px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.logo:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.3);
}

.user-panel {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.user-info {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 10px 20px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.user-emoji {
    font-size: 22px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.user-coins {
    color: #FFD700;
    font-weight: bold;
    background: rgba(255, 215, 0, 0.15);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 13px;
}

.btn {
    background: rgba(102, 126, 234, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 10px 18px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: rgba(102, 126, 234, 0.95);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
}

.btn-success {
    background: rgba(0, 184, 148, 0.8);
    box-shadow: 0 4px 15px rgba(0, 184, 148, 0.3);
}

.btn-danger {
    background: rgba(255, 71, 87, 0.8);
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.3);
}

#building-panel {
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.98);
    color: #333;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
    width: 340px;
    max-height: 85vh;
}

#building-panel.collapsed {
    width: 60px;
}

.panel-header {
    padding: 18px 20px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.9), rgba(118, 75, 162, 0.9));
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.toggle-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.panel-content {
    padding: 25px;
    max-height: 70vh;
    overflow-y: auto;
}

.form-group {
    margin-bottom: 20px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid rgba(0,0,0,0.08);
    border-radius: 12px;
    font-size: 14px;
    background: rgba(0,0,0,0.02);
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

.infrastructure-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 15px 0;
}

.infrastructure-btn {
    padding: 12px;
    background: rgba(255,255,255,0.9);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.infrastructure-btn:hover {
    border-color: #667eea;
    transform: translateY(-2px);
}

.infrastructure-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: rgba(255, 255, 255, 0.98);
    color: #333;
    padding: 30px;
    border-radius: 24px;
    max-width: 550px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 80px rgba(0,0,0,0.6);
}

.building-info {
    position: fixed;
    background: rgba(24, 26, 34, 0.97);
    backdrop-filter: blur(22px) saturate(140%);
    color: #fff;
    border-radius: 20px;
    box-shadow: 0 25px 90px rgba(0, 0, 0, 0.65);
    z-index: 1000;
    display: none;
    width: 680px;
    max-width: 94vw;
    max-height: 88vh;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.12);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.building-info.show { display: block; }

.building-info-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #6a7cf0 0%, #8b5cf6 55%, #a855f7 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

.building-info-header:active { cursor: grabbing; }
.building-info-heading { display: flex; align-items: center; gap: 14px; min-width: 0; }
.building-info-emoji {
    font-size: 30px; line-height: 1; width: 48px; height: 48px; flex: 0 0 48px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.16); border-radius: 14px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
}
.building-info-titles { min-width: 0; }
.building-info-titles h3 {
    margin: 0; font-size: 17px; font-weight: 700; line-height: 1.25;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 460px;
}
.building-info-presence { display: inline-flex; align-items: center; gap: 5px; margin-top: 3px; font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.82); }
.building-info-presence.live { color: #a7f3d0; }
.building-info-controls { display: flex; gap: 8px; flex: 0 0 auto; }

.building-info-control-btn {
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.building-info-control-btn:hover { background: rgba(255,255,255,0.28); }

.building-info-content {
    padding: 20px;
    max-height: calc(88vh - 80px);
    overflow-y: auto;
    color: rgba(255,255,255,0.9);
}

.building-info-content a { color: #7c8cf8; text-decoration: none; transition: color 0.3s; }
.building-info-content a:hover { color: #a855f7; text-decoration: underline; }

.building-tabs { display: flex; gap: 6px; border-bottom: 2px solid rgba(255,255,255,0.08); margin-bottom: 16px; }
.building-tab {
    flex: 1; padding: 11px 8px; cursor: pointer; border: none;
    background: transparent; color: rgba(255,255,255,0.55);
    font-weight: 600; font-size: 13.5px; border-bottom: 3px solid transparent;
    transition: all 0.25s; white-space: nowrap;
}

.building-tab.active { color: #fff; border-bottom-color: #7c8cf8; background: rgba(124,140,248,0.14); }
.building-tab:hover { color: #fff; }

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.28s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* panel body primitives */
.bpanel-author { font-size: 12.5px; opacity: 0.72; margin-bottom: 10px; }
.bpanel-desc {
    font-size: 14px; line-height: 1.6; color: rgba(255,255,255,0.92);
    padding: 12px 14px; background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.07); border-radius: 12px;
    max-height: 160px; overflow-y: auto;
}
.bpanel-desc em { opacity: 0.6; }
.bpanel-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.bpanel-stat {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 12px 8px; background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.07); border-radius: 12px;
}
.bpanel-stat .bpanel-stat-ico { font-size: 20px; line-height: 1; }
.bpanel-stat b { font-size: 19px; font-weight: 700; }
.bpanel-stat span:last-child { font-size: 11px; opacity: 0.6; text-transform: uppercase; letter-spacing: 0.04em; }
.bpanel-btn { display: block; width: 100%; padding: 13px; margin: 14px 0 4px; border: none; border-radius: 12px; font-size: 15px; font-weight: 700; cursor: pointer; transition: all 0.2s; }
.bpanel-btn-enter { background: linear-gradient(135deg, #10b981, #059669); color: #fff; box-shadow: 0 6px 18px rgba(16,185,129,0.35); }
.bpanel-btn-enter:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(16,185,129,0.45); }
.bpanel-locked { padding: 12px; margin: 14px 0 4px; text-align: center; font-size: 13px; color: rgba(255,255,255,0.6); background: rgba(255,255,255,0.05); border-radius: 12px; border: 1px dashed rgba(255,255,255,0.15); }
.bpanel-section-title { margin: 16px 0 10px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.75; }

/* comments */
.comment-composer { margin-bottom: 12px; }
.comment-input {
    width: 100%; box-sizing: border-box; min-height: 64px; padding: 12px 14px;
    background: rgba(255,255,255,0.06); color: #fff; border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px; font-size: 14px; resize: vertical; font-family: inherit;
    transition: border-color 0.2s;
}
.comment-input:focus { outline: none; border-color: #7c8cf8; background: rgba(255,255,255,0.09); }
.comment-input::placeholder { color: rgba(255,255,255,0.4); }
.comment-composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.comment-attach {
    display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
    font-size: 13px; color: rgba(255,255,255,0.75); padding: 8px 12px;
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); border-radius: 10px;
    transition: all 0.2s;
}
.comment-attach:hover { background: rgba(255,255,255,0.12); }
.comment-attach input { display: none; }
.comment-attach-hint { font-size: 12.5px; color: rgba(255,255,255,0.5); text-decoration: none; }
.comment-attach-hint:hover { color: #7c8cf8; }
.comment-post {
    padding: 9px 18px; border: none; border-radius: 10px; cursor: pointer;
    background: linear-gradient(135deg, #667eea, #764ba2); color: #fff;
    font-size: 13.5px; font-weight: 700; transition: all 0.2s;
}
.comment-post:hover { filter: brightness(1.1); }
.comment-post:disabled { opacity: 0.5; cursor: default; }

.comment-list { display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto; }
.comment-empty { text-align: center; padding: 22px; opacity: 0.5; font-size: 13px; }
.comment-item { display: flex; gap: 10px; padding: 11px 12px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06); border-radius: 12px; }
.comment-avatar { flex: 0 0 auto; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.08); border-radius: 50%; font-size: 16px; }
.comment-main { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: baseline; gap: 8px; }
.comment-author { font-size: 13px; color: #cdd2ff; }
.comment-time { font-size: 11px; opacity: 0.45; }
.comment-body { font-size: 13.5px; line-height: 1.5; color: rgba(255,255,255,0.92); margin-top: 2px; word-wrap: break-word; }
.comment-media { display: block; max-width: 100%; max-height: 220px; border-radius: 10px; margin-top: 8px; }
.comment-media-file { display: inline-block; padding: 8px 12px; background: rgba(255,255,255,0.06); border-radius: 8px; color: #cdd2ff; text-decoration: none; font-size: 13px; margin-top: 8px; }
.comment-media-file:hover { background: rgba(255,255,255,0.12); }

/* mobile panel */
.bpanel-mobile-hero { text-align: center; margin-bottom: 12px; }
.bpanel-mobile-emoji { font-size: 46px; line-height: 1; margin-bottom: 6px; }
.bpanel-mobile-title { margin: 4px 0; font-size: 20px; color: #fff; }
.bpanel-mobile-by { font-size: 12px; opacity: 0.65; }
.bpanel-mobile-comments { margin-top: 14px; }

.interaction-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
.interaction-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.9);
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13.5px;
    transition: all 0.25s;
}

.interaction-btn:hover { background: rgba(255,255,255,0.11); transform: translateY(-2px); }
.interaction-btn.liked { background: rgba(255, 107, 107, 0.18); color: #ff6b6b; border-color: rgba(255,107,107,0.5); }
.interaction-btn.following { background: rgba(0, 184, 148, 0.18); color: #00b894; border-color: rgba(0,184,148,0.5); }
.interaction-btn.danger { color: #ff6b6b; border-color: rgba(255,107,107,0.35); }
.interaction-btn.danger:hover { background: rgba(255,107,107,0.18); }

/* Interior navigation panel (left, built by interior.js): title + exit +
   room switcher in one column, kept on the left so it never overlaps the
   bottom-right day/night + cinematic buttons. */
#algerrha-interior-nav {
    position: fixed;
    left: 16px;
    top: 16px;
    width: 250px;
    max-width: 84vw;
    z-index: 4000;
    display: none;
    flex-direction: column;
    gap: 10px;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
#algerrha-interior-nav .inav-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 12px;
    background: rgba(20, 22, 30, 0.92);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px;
}
.inav-titlewrap { display: flex; flex-direction: column; min-width: 0; }
.inav-title { font-size: 13px; font-weight: 700; line-height: 1.3; }
.inav-hint { font-size: 11px; color: rgba(255,255,255,0.45); margin-top: 2px; }
.inav-exit {
    flex: 0 0 auto; border: none; cursor: pointer; white-space: nowrap;
    background: rgba(231, 76, 60, 0.9); color: #fff;
    padding: 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 600;
    box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}
.inav-exit:hover { background: #e74c3c; }
.inav-live {
    flex: 0 0 auto; border: none; cursor: pointer; white-space: nowrap;
    background: linear-gradient(135deg, #667eea, #764ba2); color: #fff;
    padding: 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 600;
    box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}
.inav-live:hover { filter: brightness(1.12); }
.inav-rooms {
    display: none; flex-direction: column; gap: 6px;
    padding: 8px;
    background: rgba(20, 22, 30, 0.92);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    max-height: 46vh; overflow-y: auto;
}
.inav-rooms button {
    display: flex; align-items: center; gap: 8px; width: 100%;
    text-align: left; cursor: pointer;
    background: rgba(255,255,255,0.06); color: #fff;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px; padding: 9px 11px; font-size: 13px; white-space: nowrap;
}
.inav-rooms button:hover { background: rgba(255,255,255,0.12); }
.inav-rooms button.active { background: rgba(52, 152, 219, 0.85); border-color: rgba(52,152,219,0.9); }

/* Interior social overlay (built by interior.js). Pinned bottom-left so the
   navigation panel above it and the day/night + cinematic buttons bottom-right
   all stay clear of one another. */
#algerrha-interior-social {
    position: fixed;
    left: 16px;
    bottom: 16px;
    width: 320px;
    max-width: 88vw;
    max-height: 62vh;
    z-index: 4000;
    display: flex;
    flex-direction: column;
    background: rgba(20, 22, 30, 0.92);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 16px;
    overflow: hidden;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
#algerrha-interior-social .isocial-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 12px 14px; background: rgba(255,255,255,0.06);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.isocial-title { font-size: 14px; font-weight: 700; }
.isocial-presence { font-size: 12px; font-weight: 600; color: #a7f3d0; white-space: nowrap; }
.isocial-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 60px; max-height: 38vh; }
.isocial-composer { display: flex; gap: 8px; padding: 10px; border-top: 1px solid rgba(255,255,255,0.08); }
.isocial-composer textarea {
    flex: 1; box-sizing: border-box; min-height: 40px; max-height: 96px; padding: 9px 12px;
    background: rgba(255,255,255,0.07); color: #fff; border: 1px solid rgba(255,255,255,0.14);
    border-radius: 10px; font-size: 13px; resize: none; font-family: inherit;
}
.isocial-composer textarea:focus { outline: none; border-color: #7c8cf8; }
.isocial-composer textarea::placeholder { color: rgba(255,255,255,0.4); }
.isocial-composer button {
    flex: 0 0 auto; width: 42px; border: none; border-radius: 10px; cursor: pointer;
    background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; font-size: 18px;
}
.isocial-composer button:hover { filter: brightness(1.1); }
#algerrha-interior-social .comment-item { background: rgba(255,255,255,0.05); }

/* Per-building live room (chat + voice + video via LiveKit). A larger,
   centered panel opened from the interior nav's 🎥 Live button. */
#algerrha-live-room {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
#algerrha-live-room .lr-panel {
    width: min(920px, 94vw);
    height: min(620px, 88vh);
    display: flex;
    flex-direction: column;
    background: rgba(20, 22, 30, 0.96);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.lr-head {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px; background: rgba(255,255,255,0.06);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.lr-title { font-size: 14px; font-weight: 700; flex: 0 0 auto; }
.lr-status { font-size: 12px; color: rgba(255,255,255,0.55); flex: 1; }
.lr-access {
    flex: 0 0 auto; background: rgba(255,255,255,0.1); color: #fff;
    border: 1px solid rgba(255,255,255,0.2); border-radius: 8px;
    padding: 5px 8px; font-size: 12px;
}
.lr-close {
    flex: 0 0 auto; width: 28px; height: 28px; border: none; cursor: pointer;
    border-radius: 8px; background: rgba(231, 76, 60, 0.9); color: #fff;
    font-size: 16px; line-height: 1;
}
.lr-close:hover { background: #e74c3c; }
.lr-body {
    flex: 1; display: flex; min-height: 0;
}
.lr-left {
    flex: 1.6; display: flex; flex-direction: column; min-width: 0;
    border-right: 1px solid rgba(255,255,255,0.08);
}
.lr-actions { display: flex; gap: 8px; padding: 10px 12px; align-items: center; }
.lr-actions button {
    border: none; cursor: pointer; border-radius: 10px; color: #fff;
    padding: 8px 12px; font-size: 13px; font-weight: 600;
}
.lr-join { background: linear-gradient(135deg, #667eea, #764ba2); }
.lr-mic, .lr-cam {
    background: rgba(255,255,255,0.1); font-size: 14px !important;
}
.lr-mic.lr-on, .lr-cam.lr-on { background: #2ecc71; }
.lr-mic:disabled, .lr-cam:disabled { opacity: 0.35; cursor: default; }
.lr-videos {
    flex: 1; display: flex; flex-wrap: wrap; gap: 8px;
    padding: 10px 12px; overflow-y: auto; align-content: flex-start;
}
.lr-tile-wrap {
    position: relative; width: calc(50% - 4px); aspect-ratio: 4 / 3;
    background: #0c0e14; border-radius: 10px; overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
}
.lr-tile { width: 100%; height: 100%; object-fit: cover; display: block; }
.lr-tile-name {
    position: absolute; left: 6px; bottom: 6px; font-size: 11px; font-weight: 600;
    background: rgba(0,0,0,0.55); padding: 2px 7px; border-radius: 6px;
}
.lr-right {
    flex: 1; display: flex; flex-direction: column; min-width: 0;
}
.lr-participants {
    padding: 10px 12px; font-size: 12px; color: rgba(255,255,255,0.8);
    border-bottom: 1px solid rgba(255,255,255,0.08); max-height: 120px; overflow-y: auto;
}
.lr-part { display: flex; align-items: center; gap: 7px; padding: 2px 0; }
.lr-part-dot { width: 8px; height: 8px; border-radius: 50%; background: #2ecc71; flex: 0 0 auto; }
.lr-chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.lr-chat-list {
    flex: 1; overflow-y: auto; padding: 10px 12px;
    display: flex; flex-direction: column; gap: 8px;
}
.lr-msg { font-size: 13px; line-height: 1.4; }
.lr-msg-name { font-weight: 700; color: #7c8cf8; }
.lr-msg-text { color: rgba(255,255,255,0.9); word-break: break-word; }
.lr-chat-composer { display: flex; gap: 8px; padding: 10px; border-top: 1px solid rgba(255,255,255,0.08); }
.lr-chat-composer input {
    flex: 1; box-sizing: border-box; padding: 9px 12px;
    background: rgba(255,255,255,0.07); color: #fff;
    border: 1px solid rgba(255,255,255,0.14); border-radius: 10px;
    font-size: 13px; font-family: inherit;
}
.lr-chat-composer input:focus { outline: none; border-color: #7c8cf8; }
.lr-chat-composer input::placeholder { color: rgba(255,255,255,0.4); }
.lr-chat-composer button {
    flex: 0 0 auto; width: 42px; border: none; border-radius: 10px; cursor: pointer;
    background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; font-size: 18px;
}
.lr-chat-composer button:hover { filter: brightness(1.1); }
.lr-audio { display: none; }

@media (max-width: 640px) {
    #algerrha-live-room .lr-body { flex-direction: column; }
    .lr-left { border-right: none; border-bottom: 1px solid rgba(255,255,255,0.08); }
}

.building-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 24px;
    padding: 18px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(76, 175, 80, 0.4);
    z-index: 10000;
    animation: slideIn 0.4s ease;
    max-width: 400px;
    display: none;
    border: 1px solid rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
}

@keyframes slideIn {
    from { transform: translateX(100%) scale(0.9); opacity: 0; }
    to { transform: translateX(0) scale(1); opacity: 1; }
}
 
@media (max-width: 768px) {
    .building-info {
        width: 95%;
        min-width: 95%;
        max-width: 95%;
        left: 2.5%;
        right: 2.5%;
        top: 10%;
        resize: none;
    }
    
    #building-panel {
        width: 90%;
        left: 5%;
        right: 5%;
        top: auto;
        bottom: 80px;
        transform: none;
    }
}

/* ============================================
   MOBILE CONTROLS v3.0 - Bottom-Optimized UI
   ============================================ */

#mobile-controls {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 90;
    pointer-events: none;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

/* Show on touch devices */
@media (hover: none) and (pointer: coarse) {
    #mobile-controls {
        display: block;
    }
    #nav-instructions,
    #control-hints {
        display: none;
    }
}

/* ---- JOYSTICK (Bottom Left) ---- */
#joystick-area {
    position: absolute;
    bottom: 30px;
    left: 25px;
    width: 140px;
    height: 140px;
    pointer-events: auto;
}

#joystick-base {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 110px;
    height: 110px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

#joystick-base.active {
    background: rgba(102, 126, 234, 0.15);
    border-color: rgba(102, 126, 234, 0.5);
}

#joystick-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transform: translate(-50%, -50%);
    transition: transform 0.05s linear;
}

#joystick-knob::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
}

#joystick-hint {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 1px;
    text-transform: uppercase;
    pointer-events: none;
}

/* ---- LOOK ZONE (Right 65% of screen) ---- */
#look-zone {
    position: absolute;
    top: 0;
    right: 0;
    width: 65%;
    height: 100%;
    pointer-events: auto;
}

#look-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.25);
    letter-spacing: 2px;
    text-transform: uppercase;
    pointer-events: none;
    transition: opacity 0.3s;
}

#look-zone.touched #look-hint {
    opacity: 0;
}

/* ---- ACTION PAD (Bottom Right) ---- */
#action-pad {
    position: absolute;
    bottom: 30px;
    right: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
}

.action-btn {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    transition: all 0.15s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    -webkit-tap-highlight-color: transparent;
}

.action-btn:active {
    transform: scale(0.9);
}

/* Jump - Largest button */
.action-btn.jump {
    width: 75px;
    height: 75px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    font-size: 30px;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* Sprint with stamina ring */
.action-btn.sprint {
    background: rgba(255, 193, 7, 0.15);
    border: 2px solid rgba(255, 193, 7, 0.4);
}

.action-btn.sprint.active {
    background: rgba(255, 193, 7, 0.9);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 15px rgba(255, 193, 7, 0.3); }
    50% { box-shadow: 0 0 25px rgba(255, 193, 7, 0.6); }
}

.stamina-ring {
    position: absolute;
    top: -5px;
    left: -5px;
    width: 74px;
    height: 74px;
    opacity: 0;
    transition: opacity 0.3s;
}

.action-btn.sprint.active .stamina-ring {
    opacity: 1;
}

.stamina-progress {
    transition: stroke-dasharray 0.1s, stroke 0.3s;
}

/* Crouch */
.action-btn.crouch {
    width: 56px;
    height: 56px;
    background: rgba(0, 184, 148, 0.15);
    border: 2px solid rgba(0, 184, 148, 0.4);
    font-size: 22px;
}

.action-btn.crouch.active {
    background: rgba(0, 184, 148, 0.9);
}

/* ---- INTERACT PROMPT ---- */
#interact-prompt {
    position: absolute;
    bottom: 160px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: auto;
    display: none;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-8px); }
}

#btn-interact {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 30px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* ---- MOVEMENT STATE ---- */
#movement-state {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.4);
    padding: 10px;
    border-radius: 12px;
    font-size: 22px;
    backdrop-filter: blur(5px);
}

#movement-state span {
    display: none;
}

/* ---- IDLE FADE ---- */
#mobile-controls.idle #joystick-base,
#mobile-controls.idle #action-pad {
    opacity: 0.4;
    transition: opacity 0.5s;
}

#mobile-controls:not(.idle) #joystick-base,
#mobile-controls:not(.idle) #action-pad {
    opacity: 1;
    transition: opacity 0.2s;
}

/* Responsive */
@media (max-width: 400px) {
    #joystick-area {
        bottom: 20px;
        left: 15px;
        width: 120px;
        height: 120px;
    }
    #joystick-base {
        width: 90px;
        height: 90px;
    }
    #joystick-knob {
        width: 40px;
        height: 40px;
    }
    #action-pad {
        bottom: 20px;
        right: 15px;
        gap: 10px;
    }
    .action-btn {
        width: 56px;
        height: 56px;
        font-size: 22px;
    }
    .action-btn.jump {
        width: 64px;
        height: 64px;
        font-size: 26px;
    }
}