@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@400;500;600;700;800&family=Mulish:wght@400;500;600;700&display=swap');

:root {
    --gold: #b47e37;
    --gold-bright: #d49a52;
    --bg: #030303;
    --bg-soft: #0a0a0a;
    --bg-card: rgba(255, 255, 255, 0.04);
    --border: rgba(255, 255, 255, 0.08);
    --text: #ffffff;
    --text-dim: rgba(255, 255, 255, 0.6);
    --text-faint: rgba(255, 255, 255, 0.3);
    --danger: #ef4444;
    --success: #22c55e;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--text); font-family: 'Mulish', system-ui, sans-serif; min-height: 100vh; overflow-x: hidden; }
h1, h2, h3, h4 { font-family: 'Unbounded', system-ui, sans-serif; font-weight: 600; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-bright); }

button, .btn { background: var(--gold); color: var(--bg); border: none; padding: 12px 24px; border-radius: 8px; font-family: 'Mulish', system-ui, sans-serif; font-weight: 600; font-size: 14px; cursor: pointer; transition: all 0.15s; }
button:hover, .btn:hover { background: var(--gold-bright); transform: translateY(-1px); }
button.ghost, .btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
button.ghost:hover, .btn.ghost:hover { background: var(--bg-card); }
button.danger { background: var(--danger); color: white; }
button.icon { padding: 10px 12px; background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
button.icon:hover { background: rgba(180, 126, 55, 0.2); }
button.icon.active { background: var(--gold); color: var(--bg); }
button.icon.muted { background: var(--danger); color: white; }

input, textarea, select { background: var(--bg-soft); color: var(--text); border: 1px solid var(--border); padding: 12px 16px; border-radius: 8px; font-family: 'Mulish', system-ui, sans-serif; font-size: 14px; width: 100%; }
input:focus, textarea:focus { outline: none; border-color: var(--gold); }

.container { max-width: 1200px; margin: 0 auto; padding: 32px; }
.container.dash {
    max-width: 1080px;
    padding: 56px 32px;
}
.container.dash .dash-head {
    text-align: center;
    margin-bottom: 40px;
    display: block;
}
.container.dash .dash-head h1 {
    font-size: 36px;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}
.container.dash .dash-sub {
    color: var(--text-dim);
    font-size: 15px;
    max-width: 520px;
    margin: 0 auto;
    line-height: 1.55;
}
.container.dash .rooms-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 340px));
    justify-content: center;
}
@media (min-width: 760px) {
    .container.dash .rooms-grid {
        gap: 28px;
    }
}
.brand { font-family: 'Unbounded', sans-serif; font-weight: 700; font-size: 20px; color: var(--text); }
.brand .accent { color: var(--gold); }
.nav { display: flex; justify-content: space-between; align-items: center; padding: 20px 32px; border-bottom: 1px solid var(--border); }
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 24px; }

/* ===== LANDING / AUTH (unchanged from V1) ===== */
.landing-hero { min-height: 90vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 48px 32px; background: radial-gradient(ellipse at 30% 20%, rgba(180, 126, 55, 0.15), transparent 50%), radial-gradient(ellipse at 70% 80%, rgba(146, 114, 75, 0.1), transparent 50%); }
.landing-hero h1 { font-size: clamp(36px, 6vw, 72px); line-height: 1.05; margin-bottom: 24px; max-width: 900px; }
.landing-hero h1 .accent { color: var(--gold); }
.landing-hero p { font-size: 20px; color: var(--text-dim); max-width: 600px; margin-bottom: 40px; line-height: 1.5; }
.landing-cta { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.landing-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; margin-top: 80px; max-width: 1100px; width: 100%; }
.feature h3 { color: var(--gold); font-size: 16px; margin-bottom: 8px; }
.feature p { color: var(--text-dim); font-size: 14px; line-height: 1.5; }

.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 28px; margin-bottom: 8px; }
.auth-card p.sub { color: var(--text-dim); margin-bottom: 32px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.error { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); color: #fca5a5; padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.auth-foot { margin-top: 24px; text-align: center; color: var(--text-dim); font-size: 13px; }

.dash-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; }
.dash-head h1 { font-size: 28px; }
.rooms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.room-card { cursor: pointer; transition: all 0.2s; display: block; }
.room-card:hover { transform: translateY(-4px); border-color: var(--gold); }
.room-card .thumb { width: 100%; aspect-ratio: 16 / 9; border-radius: 8px; margin-bottom: 16px; position: relative; overflow: hidden; background-size: cover; background-position: center; background-color: #150e08; border: 1px solid rgba(0,0,0,0.3); }
.room-card h3 { color: var(--text); margin-bottom: 6px; font-size: 16px; }
.room-card .meta { color: var(--text-faint); font-size: 12px; }
.create-room { background: rgba(180, 126, 55, 0.1); border: 1px dashed rgba(180, 126, 55, 0.4); cursor: pointer; transition: all 0.2s; min-height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--gold); font-weight: 600; }
.create-room:hover { background: rgba(180, 126, 55, 0.15); border-color: var(--gold); }
.create-room svg { width: 36px; height: 36px; }

.modal-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.78); backdrop-filter: blur(12px); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.modal-bg.show { display: flex; }
.modal {
    background: linear-gradient(180deg, var(--bg-soft), #1a120a);
    border: 1px solid rgba(180, 126, 55, 0.25);
    border-radius: 20px;
    padding: 48px 56px 40px;
    max-width: 880px;
    width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.04);
    margin: 0 auto;
}
.modal h2 { margin: 0 0 8px 0; font-size: 30px; font-weight: 600; letter-spacing: -0.5px; text-align: center; line-height: 1.2; }
.modal .modal-sub { color: var(--text-dim); font-size: 15px; margin: 0 auto 36px; text-align: center; max-width: 480px; line-height: 1.5; }
.modal.compact { padding: 40px 48px 32px; max-width: 520px; }
.modal.compact h2 { font-size: 24px; }
.modal.compact p { text-align: center; }
.modal label { font-size: 12px; font-weight: 600; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-dim); margin-bottom: 10px; display: block; }
.modal .field { margin-bottom: 28px; }
.modal input[name="name"] {
    width: 100%; padding: 14px 18px; font-size: 16px;
    background: rgba(10,6,4,0.5);
    border: 1px solid rgba(180,126,55,0.2);
    color: var(--text);
    border-radius: 12px;
    transition: border-color 0.15s;
}
.modal input[name="name"]:focus { outline: none; border-color: var(--gold); }
.modal .section-title { font-size: 12px; font-weight: 600; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-dim); margin: 0 0 14px 0; }
.capacity-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 32px; }
.capacity-option {
    background: rgba(20,12,8,0.6); border: 1px solid rgba(180,126,55,0.15); border-radius: 14px;
    padding: 22px 16px; cursor: pointer; transition: all 0.18s; text-align: center;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.capacity-option:hover { border-color: rgba(180,126,55,0.5); transform: translateY(-2px); }
.capacity-option.selected { border-color: var(--gold); background: rgba(180,126,55,0.12); box-shadow: 0 0 0 1px var(--gold); }
.capacity-option .cap-icon {
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(180,126,55,0.12); border-radius: 50%;
    color: var(--gold);
}
.capacity-option .cap-icon svg { width: 24px; height: 24px; }
.capacity-option .cap-name { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.3; }
.capacity-option .cap-detail { font-size: 12px; color: var(--text-dim); }

.room-card-wrap { position: relative; padding: 0; background: transparent; border: none; }
.room-card-wrap .room-card { padding: 24px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; cursor: pointer; transition: all 0.2s; display: block; }
.room-card-wrap .room-card:hover { transform: translateY(-4px); border-color: var(--gold); }
.room-delete-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: rgba(239, 68, 68, 0.9);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, background 0.15s, transform 0.15s;
    z-index: 10;
}
.room-card-wrap:hover .room-delete-btn { opacity: 1; }
.room-delete-btn:hover { background: var(--danger); color: white; transform: scale(1.1); }

.theme-picker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 36px; }
.theme-option {
    background: rgba(20,12,8,0.6); border: 1px solid rgba(180,126,55,0.15); border-radius: 14px;
    padding: 18px; cursor: pointer; transition: all 0.18s; text-align: left;
    display: flex; flex-direction: column;
}
.theme-option:hover { border-color: rgba(180,126,55,0.5); transform: translateY(-2px); }
.theme-option.selected { border-color: var(--gold); background: rgba(180,126,55,0.1); box-shadow: 0 0 0 1px var(--gold); }
.theme-option .thumb { width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; margin-bottom: 14px; background-size: cover; background-position: center; border: 1px solid rgba(0,0,0,0.4); }
.theme-option h4 { font-size: 16px; margin-bottom: 6px; font-weight: 600; }
.theme-option p { font-size: 13px; color: var(--text-dim); line-height: 1.45; margin: 0; }
.modal-actions { display: flex; gap: 12px; justify-content: center; padding-top: 12px; border-top: 1px solid rgba(180,126,55,0.12); margin-top: 8px; }
.modal-actions button { padding: 13px 28px; font-size: 14px; font-weight: 600; border-radius: 10px; min-width: 140px; }
.modal.compact .modal-actions { border-top: none; padding-top: 0; }

/* ===== ROOM — THE NEW WORLD ===== */
body.room-mode { overflow: hidden; height: 100vh; background: #0d0a06; }
#space { position: fixed; inset: 0; }
#map {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background:
        radial-gradient(ellipse at center, #1a140d 0%, #050302 80%),
        repeating-linear-gradient(45deg, transparent 0px, transparent 8px, rgba(180, 126, 55, 0.02) 8px, rgba(180, 126, 55, 0.02) 9px);
}

.world {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: 0 0;
    will-change: transform;
    background-size: 100% 100%;
    background-position: 0 0;
    background-repeat: no-repeat;
    background-color: #150e08;
}

/* === FLOOR TEXTURES (SVG-pattern based) === */
.floor {
    position: absolute;
    overflow: hidden;
}

/* Hardwood plank — natural wood with grain */
.floor.hardwood {
    background-color: #8b6f47;
    background-image:
        repeating-linear-gradient(
            90deg,
            rgba(0, 0, 0, 0.15) 0px,
            rgba(0, 0, 0, 0.15) 1px,
            transparent 1px,
            transparent 140px
        ),
        repeating-linear-gradient(
            0deg,
            rgba(0, 0, 0, 0.06) 0px,
            rgba(0, 0, 0, 0.06) 1px,
            transparent 1px,
            transparent 22px
        ),
        repeating-linear-gradient(
            90deg,
            #9a7c52 0px,
            #876b44 70px,
            #8e7048 140px,
            #806640 210px,
            #92744a 280px
        );
}

/* Dark wood — premium */
.floor.darkwood {
    background-color: #3a2818;
    background-image:
        repeating-linear-gradient(90deg, rgba(0,0,0,0.25) 0px, rgba(0,0,0,0.25) 1px, transparent 1px, transparent 130px),
        repeating-linear-gradient(0deg, rgba(0,0,0,0.1) 0px, rgba(0,0,0,0.1) 1px, transparent 1px, transparent 22px),
        repeating-linear-gradient(90deg, #4a3424 0px, #3d2a1a 65px, #43301f 130px, #382518 195px);
}

/* Marble — premium, smooth */
.floor.marble {
    background-color: #e8e4dc;
    background-image:
        radial-gradient(ellipse at 30% 20%, rgba(180, 165, 140, 0.3), transparent 60%),
        radial-gradient(ellipse at 70% 80%, rgba(200, 180, 150, 0.2), transparent 50%),
        repeating-linear-gradient(40deg, transparent 0px, transparent 80px, rgba(150, 130, 100, 0.08) 80px, rgba(150, 130, 100, 0.08) 81px, transparent 81px, transparent 200px);
}

/* Carpet — soft texture */
.floor.carpet {
    background-color: #5a4f3f;
    background-image:
        radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.04) 1px, transparent 2px),
        radial-gradient(circle at 75% 75%, rgba(0, 0, 0, 0.06) 1px, transparent 2px);
    background-size: 8px 8px;
}

/* Grass — outdoor green */
.floor.grass {
    background-color: #4a7c3a;
    background-image:
        radial-gradient(circle at 30% 40%, rgba(60, 100, 50, 0.5) 2px, transparent 3px),
        radial-gradient(circle at 70% 70%, rgba(80, 130, 70, 0.4) 1px, transparent 2px),
        radial-gradient(circle at 50% 20%, rgba(50, 90, 40, 0.6) 1px, transparent 2px);
    background-size: 14px 14px, 18px 18px, 12px 12px;
}

/* Sand — beach */
.floor.sand {
    background-color: #e6d4a8;
    background-image:
        radial-gradient(circle at 30% 40%, rgba(180, 150, 100, 0.4) 1px, transparent 2px),
        radial-gradient(circle at 70% 70%, rgba(220, 200, 150, 0.5) 1px, transparent 2px);
    background-size: 8px 8px, 10px 10px;
}

/* Ocean — animated water */
.floor.ocean {
    background:
        linear-gradient(180deg, #1e6e9c 0%, #0e4c6e 100%);
    position: relative;
}
.floor.ocean::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(45deg, transparent 0px, transparent 40px, rgba(255, 255, 255, 0.06) 40px, rgba(255, 255, 255, 0.06) 42px),
        repeating-linear-gradient(-45deg, transparent 0px, transparent 60px, rgba(255, 255, 255, 0.04) 60px, rgba(255, 255, 255, 0.04) 62px);
    animation: oceanShift 20s linear infinite;
}
@keyframes oceanShift {
    0% { background-position: 0 0, 0 0; }
    100% { background-position: 200px 0, -200px 0; }
}

/* Concrete — modern */
.floor.concrete {
    background-color: #6e6863;
    background-image:
        radial-gradient(circle at 30% 40%, rgba(80, 75, 70, 0.4) 2px, transparent 3px),
        radial-gradient(circle at 70% 70%, rgba(120, 115, 110, 0.3) 1px, transparent 2px);
    background-size: 22px 22px, 16px 16px;
}

/* Deck wood — outdoor planks */
.floor.deck {
    background-color: #b89968;
    background-image:
        repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.18) 0px, rgba(0, 0, 0, 0.18) 2px, transparent 2px, transparent 160px),
        repeating-linear-gradient(90deg, #c6a674 0px, #ab8e5d 80px, #b89968 160px);
}

/* === WALLS === */
.wall {
    position: absolute;
    background: linear-gradient(180deg, #2a2118 0%, #1a1410 100%);
    box-shadow:
        inset 0 -2px 4px rgba(0, 0, 0, 0.4),
        inset 0 2px 4px rgba(255, 255, 255, 0.04),
        4px 4px 12px rgba(0, 0, 0, 0.5);
    border-radius: 2px;
    z-index: 5;
}

.wall.light {
    background: linear-gradient(180deg, #d8cfc0 0%, #b9ae9b 100%);
    box-shadow:
        inset 0 -2px 4px rgba(0, 0, 0, 0.15),
        inset 0 2px 4px rgba(255, 255, 255, 0.4),
        4px 4px 12px rgba(0, 0, 0, 0.25);
}

/* === RUGS === */
.rug {
    position: absolute;
    border-radius: 4px;
    z-index: 2;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
}
.rug.persian {
    background:
        radial-gradient(ellipse at center, #8b3a3a 0%, #6e2a2a 50%, #4a1818 100%);
    border: 4px solid #3a1010;
}
.rug.cream {
    background: linear-gradient(135deg, #d8cfb8 0%, #c4b89e 100%);
    border: 4px solid #a8987e;
}
.rug.jute {
    background-color: #c4a878;
    background-image: repeating-linear-gradient(45deg, transparent 0px, transparent 4px, rgba(0, 0, 0, 0.06) 4px, rgba(0, 0, 0, 0.06) 5px);
    border: 3px solid #a08658;
}

/* === FURNITURE (SVG-based sprites) === */
.furniture {
    position: absolute;
    z-index: 3;
    pointer-events: none;
    filter: drop-shadow(4px 6px 8px rgba(0, 0, 0, 0.45));
}
.furniture svg { display: block; overflow: visible; }
.furniture .label { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-size: 9px; color: rgba(255, 255, 255, 0.5); font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; white-space: nowrap; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); }

/* === PEER AVATAR (Kumospace-style: rounded rectangle + halo) === */
.peer-tile {
    position: absolute;
    width: 92px;
    height: 92px;
    border-radius: 18px;
    overflow: hidden;
    transform: translate(-50%, -50%);
    transition: box-shadow 0.2s, width 0.2s, height 0.2s;
    cursor: pointer;
    z-index: 50;
    box-shadow:
        0 0 0 3px var(--peer-color, #b47e37),
        0 8px 24px rgba(0, 0, 0, 0.55),
        0 2px 4px rgba(0, 0, 0, 0.3);
    background: var(--peer-color, #b47e37);
    will-change: transform, left, top;
}
.peer-tile.me {
    z-index: 60;
    box-shadow:
        0 0 0 3px var(--peer-color, #b47e37),
        0 0 32px rgba(212, 154, 82, 0.5),
        0 8px 24px rgba(0, 0, 0, 0.55);
}
.peer-tile.focused {
    width: 180px;
    height: 180px;
    z-index: 80;
}
.peer-tile video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scaleX(-1);
}
.peer-tile.cam-off video { display: none; }
.peer-tile.cam-off::after {
    content: attr(data-initials);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Unbounded', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
}

/* Zone dim overlay — Kumospace "current room is bright, rest is grey" effect */
.zone-dim {
    position: absolute;
    pointer-events: none;
    z-index: 4;
    background: rgba(20, 14, 8, 0);
    transition: background 0.35s ease;
}
.zone-dim.dimmed { background: rgba(8, 5, 2, 0.45); }
.corridor-dim.dimmed {
    /* Bigger dim for the corridor (it's the whole world) but a touch lighter
     * so peer avatars are still visible. */
    background: rgba(8, 5, 2, 0.42);
}

.peer-halo.zone-hidden { opacity: 0; }

/* Audio halo — translucent radial gradient showing audio range
 * NO transition: must move in lockstep with the avatar tile (which has none either)
 * so it never lags behind during walk + stop. */
.peer-halo {
    position: absolute;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 40;
    background: radial-gradient(circle, rgba(180, 126, 55, 0.22) 0%, rgba(180, 126, 55, 0.1) 40%, transparent 70%);
    will-change: left, top;
}
.peer-halo.me {
    background: radial-gradient(circle, rgba(212, 154, 82, 0.28) 0%, rgba(212, 154, 82, 0.14) 40%, transparent 70%);
}
/* Dim the halo when peer is in a different zone — visually shows audio is gated. */
.peer-halo.different-zone {
    background: radial-gradient(circle, rgba(120, 120, 120, 0.08) 0%, rgba(120, 120, 120, 0.04) 40%, transparent 70%);
}

.peer-label {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    z-index: 11;
    backdrop-filter: blur(4px);
}
.peer-mic-off { position: absolute; bottom: 4px; right: 4px; background: var(--danger); color: white; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; z-index: 12; }

/* Reaction floating */
.reaction-float { position: absolute; font-size: 36px; pointer-events: none; animation: floatUp 2s ease-out forwards; z-index: 100; }
@keyframes floatUp { 0% { opacity: 1; transform: translate(-50%, 0) scale(0.6); } 100% { opacity: 0; transform: translate(-50%, -120px) scale(1.4); } }

/* === ZONES === */
/* Visible boundary of each enclosed room — soft border so users see where audio cuts off */
.zone-outline {
    position: absolute;
    border: 2px solid rgba(180, 126, 55, 0.18);
    border-radius: 6px;
    pointer-events: none;
    z-index: 2;
    box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.12);
}
.zone-label {
    position: absolute;
    font-family: 'Unbounded', sans-serif;
    font-size: 10px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.55);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    pointer-events: none;
    z-index: 3;
    background: rgba(0, 0, 0, 0.4);
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid rgba(180, 126, 55, 0.18);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
}

/* Zone-change toast — "You entered Conference Room" */
#zone-toast {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    color: var(--gold);
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid rgba(180, 126, 55, 0.4);
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
    z-index: 300;
    font-family: 'Unbounded', sans-serif;
    letter-spacing: 0.5px;
}
#zone-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== HUD (V5 Kumospace-style) ===== */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 200; }
#hud > * { pointer-events: auto; }

/* Top header — workspace | room | invite ... zoom + map */
#top-bar { position: absolute; top: 12px; left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; pointer-events: none; }
#top-bar > * { pointer-events: auto; }
.top-left { display: flex; align-items: center; gap: 10px; background: rgba(20, 14, 8, 0.78); backdrop-filter: blur(14px); border: 1px solid var(--border); border-radius: 12px; padding: 8px 14px; }
.top-left .workspace-name { font-family: 'Unbounded', sans-serif; font-size: 13px; font-weight: 700; }
.top-left .workspace-name .accent { color: var(--gold); }
.top-left .sep { color: rgba(255,255,255,0.25); font-weight: 300; }
.top-left .room-name { font-size: 13px; color: var(--text-dim); font-weight: 500; }
.invite-pill { background: var(--gold); color: var(--bg); border: none; padding: 6px 14px; border-radius: 8px; font-size: 12px; font-weight: 700; cursor: pointer; margin-left: 4px; }
.invite-pill:hover { filter: brightness(1.08); }

.top-right { display: flex; gap: 6px; background: rgba(20, 14, 8, 0.78); backdrop-filter: blur(14px); border: 1px solid var(--border); border-radius: 12px; padding: 6px; }
.icon-btn { width: 34px; height: 34px; padding: 0; background: transparent; border: none; border-radius: 8px; color: rgba(255,255,255,0.85); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.15s; }
.icon-btn:hover { background: rgba(255,255,255,0.08); color: var(--gold); }

/* Bottom toolbar — full-width Kumospace style */
#toolbar {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    background: rgba(18, 14, 10, 0.94);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(180, 126, 55, 0.16);
    padding: 8px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    z-index: 250;
}
.cluster { display: flex; gap: 4px; align-items: stretch; }
.tb-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 62px;
    height: 56px;
    padding: 4px 10px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.88);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.tb-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--gold); }
.tb-btn.active { color: var(--gold); background: rgba(180, 126, 55, 0.14); }
.tb-btn.muted { color: rgba(255, 90, 90, 0.85); }
.tb-btn.danger { color: rgba(255, 110, 110, 0.95); }
.tb-btn.danger:hover { background: rgba(255, 90, 90, 0.14); color: rgba(255, 140, 140, 1); }
.tb-btn svg { width: 22px; height: 22px; }
.tb-btn .lbl { font-size: 10.5px; line-height: 1; font-weight: 500; letter-spacing: 0.2px; }
.tb-btn .badge { position: absolute; top: 4px; right: 6px; background: var(--gold); color: var(--bg); font-size: 9px; font-weight: 700; min-width: 14px; height: 14px; padding: 0 4px; border-radius: 7px; display: flex; align-items: center; justify-content: center; }
.tb-btn .status-dot { width: 12px; height: 12px; border-radius: 50%; display: block; }
.status-dot.status-available { background: #3fcf6c; }
.status-dot.status-away { background: #f5b94a; }
.status-dot.status-focusing { background: #e54848; }

/* Status popup */
.popup {
    position: absolute;
    bottom: 76px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(28, 22, 16, 0.97);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 18px;
    min-width: 280px;
    z-index: 300;
    box-shadow: 0 16px 40px rgba(0,0,0,0.55);
}
.popup.hidden { display: none; }
.popup::after { content: ''; position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%) rotate(45deg); width: 14px; height: 14px; background: rgba(28, 22, 16, 0.97); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.popup-title { font-size: 13px; font-weight: 700; margin-bottom: 12px; color: rgba(255,255,255,0.95); }
.status-options { display: flex; gap: 6px; margin-bottom: 10px; }
.status-opt { flex: 1; display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: 8px; color: rgba(255,255,255,0.85); font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.15s; }
.status-opt:hover { background: rgba(255,255,255,0.08); }
.status-opt.active { background: rgba(180, 126, 55, 0.18); border-color: var(--gold); color: white; }
.status-opt .dot { width: 8px; height: 8px; border-radius: 50%; }
.status-opt .dot.dot-available { background: #3fcf6c; }
.status-opt .dot.dot-away { background: #f5b94a; }
.status-opt .dot.dot-focusing { background: #e54848; }
#status-text { width: 100%; padding: 8px 10px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; color: white; font-size: 12px; }

/* Owner-only EDIT FAB */
.edit-fab {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(180deg, #4cc46e 0%, #38a657 100%);
    color: white;
    border: none;
    padding: 14px 10px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
    z-index: 220;
}
.edit-fab svg { width: 18px; height: 18px; }
.edit-fab:hover { filter: brightness(1.1); transform: translateY(-50%) scale(1.04); }

/* Map modal (in-room only — scoped so it does not leak into dashboard modals) */
body.room-mode .modal { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.55); z-index: 400; }
body.room-mode .modal.hidden { display: none; }
body.room-mode .modal-card { background: rgba(24, 18, 12, 0.97); backdrop-filter: blur(24px); border: 1px solid var(--border); border-radius: 16px; padding: 14px; box-shadow: 0 20px 60px rgba(0,0,0,0.7); }
body.room-mode .modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; padding: 0 4px; font-size: 13px; font-weight: 700; color: var(--gold); text-transform: uppercase; letter-spacing: 1px; }
body.room-mode .modal-head .icon-btn { width: 28px; height: 28px; }
#map-modal-canvas { display: block; background: rgba(0,0,0,0.3); border-radius: 8px; cursor: crosshair; }

/* People list */
#people-list { display: flex; flex-direction: column; gap: 8px; }
.person-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: rgba(255,255,255,0.03); border-radius: 8px; font-size: 12px; }
.person-row .tile-mini { width: 32px; height: 32px; border-radius: 6px; background: var(--peer-color, #b47e37); overflow: hidden; flex-shrink: 0; }
.person-row .tile-mini video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.person-row .who { flex: 1; font-weight: 600; }
.person-row .person-dot { width: 8px; height: 8px; border-radius: 50%; background: #3fcf6c; }

/* Utilities */
.muted { color: var(--text-dim); }
.small { font-size: 12px; }
.spaced { margin-top: 16px; margin-bottom: 8px; }
.ghost.full { width: 100%; margin-bottom: 12px; }

/* Doors */
.door {
    position: absolute;
    background: rgba(180, 126, 55, 0);
    border: 2px dashed rgba(180, 126, 55, 0.35);
    z-index: 6;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    pointer-events: auto;
}
.door:hover { background: rgba(180, 126, 55, 0.18); border-color: rgba(180, 126, 55, 0.85); }
.door.closed {
    background: #3a2418;
    border: 2px solid #1a0e06;
    box-shadow: 0 2px 6px rgba(0,0,0,0.7), inset 0 2px 4px rgba(255,255,255,0.08);
}
.door.closed::after {
    content: '🔒';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
}

/* Placed furniture (EDIT-mode drops) */
.placed-furniture {
    position: absolute;
    z-index: 8;
    pointer-events: auto;
    filter: drop-shadow(0 3px 5px rgba(0,0,0,0.45));
    cursor: default;
}
.placed-furniture svg, .placed-furniture img { width: 100%; height: 100%; display: block; }
.placed-furniture.kind-radio { cursor: pointer; }
.placed-furniture.kind-radio:hover { filter: drop-shadow(0 0 12px rgba(212,154,82,0.85)); }
/* Owner: drag-to-move on hover */
body.is-owner .placed-furniture { cursor: grab; }
body.is-owner .placed-furniture.dragging { cursor: grabbing; opacity: 0.85; z-index: 30; }
/* Ghost preview while in place-mode */
.placed-furniture.ghost {
    opacity: 0.75;
    z-index: 40;
    pointer-events: none;
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.5));
    outline: 2px dashed rgba(212,154,82,0.9);
    outline-offset: 4px;
    border-radius: 8px;
}

/* EDIT panel (Customize Floor) */
#edit-panel {
    position: fixed;
    top: 60px;
    right: -400px;
    width: 360px;
    bottom: 80px;
    background: rgba(24, 18, 12, 0.97);
    backdrop-filter: blur(18px);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: 16px 0 0 16px;
    padding: 16px;
    overflow-y: auto;
    z-index: 280;
    transition: right 0.3s ease;
    box-shadow: -16px 0 40px rgba(0,0,0,0.6);
}
#edit-panel.open { right: 0; }
.edit-head { display: flex; justify-content: space-between; align-items: center; font-size: 15px; font-weight: 700; color: var(--gold); margin-bottom: 12px; letter-spacing: 0.5px; }
#edit-search { width: 100%; padding: 9px 12px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; color: white; font-size: 12px; margin-bottom: 16px; }
.edit-cat-head { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.3px; color: var(--text-dim); margin: 14px 0 8px; padding-bottom: 4px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.edit-cat-items { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.edit-tile { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: 8px; padding: 8px; cursor: pointer; transition: all 0.15s; text-align: center; }
.edit-tile:hover { background: rgba(180,126,55,0.14); border-color: var(--gold); }
.edit-tile .thumb { width: 100%; aspect-ratio: 1; margin-bottom: 4px; }
.edit-tile .thumb svg { width: 100%; height: 100%; }
.edit-tile .lbl { font-size: 10.5px; color: white; font-weight: 500; }

/* Context menu (peer right-click) */
.context-menu {
    position: fixed;
    background: rgba(24, 18, 12, 0.97);
    backdrop-filter: blur(14px);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px;
    z-index: 500;
    box-shadow: 0 10px 30px rgba(0,0,0,0.65);
    min-width: 160px;
}
.context-menu button {
    width: 100%;
    text-align: left;
    background: transparent;
    color: white;
    border: none;
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 6px;
}
.context-menu button:hover { background: rgba(180,126,55,0.18); color: var(--gold); }

/* Knock badge near closed doors */
.peer-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #3fcf6c; display: inline-block; }
.peer-status-dot.status-available { background: #3fcf6c; }
.peer-status-dot.status-away { background: #f5b94a; }
.peer-status-dot.status-focusing { background: #e54848; }

#side-panel {
    position: absolute;
    top: 64px;
    left: 16px;
    width: 340px;
    max-height: calc(100vh - 160px);
    background: rgba(20, 14, 8, 0.92);
    backdrop-filter: blur(18px);
    border: 1px solid var(--border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    transform: translateX(calc(-100% - 24px));
    transition: transform 0.3s ease;
    z-index: 230;
}
#side-panel.show { transform: translateX(0); }
#side-tabs { display: flex; border-bottom: 1px solid var(--border); }
.side-tab { flex: 1; background: transparent; color: var(--text-dim); padding: 14px; border-radius: 0; font-size: 13px; font-weight: 600; }
.side-tab.active { color: var(--gold); border-bottom: 2px solid var(--gold); }
.side-content { padding: 16px; overflow-y: auto; flex: 1; }
.side-pane { display: none; }
.side-pane.active { display: block; }

#chat-messages { height: 360px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; }
.chat-msg { font-size: 13px; line-height: 1.4; }
.chat-msg .who { font-weight: 700; color: var(--gold); margin-right: 6px; }
#chat-form { display: flex; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
#chat-form input { padding: 10px 12px; }
#chat-form button { padding: 0 16px; }

.invite-row { display: flex; gap: 8px; margin-bottom: 12px; }
.invite-row input { padding: 10px 12px; font-size: 12px; }
.invite-link { background: var(--bg-card); border: 1px dashed var(--border); padding: 10px 12px; border-radius: 6px; word-break: break-all; font-size: 11px; font-family: monospace; color: var(--text-dim); margin-bottom: 12px; }

.theme-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.theme-pick .theme-option { padding: 10px; }
.theme-pick .theme-option .thumb { aspect-ratio: 16 / 9; margin-bottom: 6px; border-radius: 4px; }
.theme-pick .theme-option h4 { font-size: 12px; }
.theme-pick .theme-option p { display: none; }

#reactions-bar { position: absolute; bottom: 88px; right: 16px; display: flex; gap: 6px; background: rgba(20, 14, 8, 0.85); backdrop-filter: blur(14px); border: 1px solid var(--border); padding: 8px; border-radius: 12px; z-index: 210; }
#reactions-bar button { width: 36px; height: 36px; padding: 0; font-size: 18px; background: transparent; border: none; color: white; cursor: pointer; border-radius: 8px; }
#reactions-bar button:hover { background: rgba(255, 255, 255, 0.1); transform: scale(1.15); }

.thumb-biohacker { background: url(/static/img/themes/biohacker.svg) center/cover, #2a2118; position: relative; overflow: hidden; }
.thumb-bali      { background: url(/static/img/themes/bali.svg) center/cover, #1c4862; position: relative; overflow: hidden; }
.thumb-penthouse { background: url(/static/img/themes/penthouse.svg) center/cover, #050510; position: relative; overflow: hidden; }
.thumb-classic   { background: url(/static/img/themes/classic.svg) center/cover, #2a1a10; position: relative; overflow: hidden; }

@media (max-width: 768px) {
    .landing-hero h1 { font-size: 36px; }
    #side-panel { width: 92vw; left: 4vw; top: 60px; }
    .peer-tile { width: 72px; height: 72px; border-radius: 14px; }
    .peer-tile.focused { width: 140px; height: 140px; }
    .peer-halo { width: 220px; height: 220px; }
    .tb-btn { min-width: 50px; height: 50px; padding: 4px 6px; }
    .tb-btn .lbl { display: none; }
    .top-left .workspace-name { font-size: 12px; }
    #toolbar { padding: 6px 8px; gap: 6px; }
}

.hint { position: absolute; bottom: 88px; left: 50%; transform: translateX(-50%); background: rgba(0, 0, 0, 0.7); padding: 8px 14px; border-radius: 8px; font-size: 11.5px; color: var(--text-dim); pointer-events: none; transition: opacity 0.5s; backdrop-filter: blur(6px); z-index: 210; }
.hint.hide { opacity: 0; }
.hint kbd { background: var(--bg-card); padding: 2px 6px; border-radius: 4px; font-family: monospace; color: var(--gold); }

.copy-toast { position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%); background: var(--gold); color: var(--bg); padding: 12px 24px; border-radius: 8px; font-weight: 600; font-size: 13px; pointer-events: none; opacity: 0; transition: opacity 0.3s; z-index: 1000; }
.copy-toast.show { opacity: 1; }
