body {
    margin: 0;
    overflow: hidden;
    background: #000;
    font-family: sans-serif;
}

#build-badge {
    position: fixed;
    right: 14px;
    bottom: 12px;
    z-index: 1400;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid rgba(122, 255, 224, 0.4);
    background: rgba(6, 14, 18, 0.78);
    color: #cffff3;
    font-size: 11px;
    letter-spacing: 0.04em;
    user-select: none;
    pointer-events: none;
}

#loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    background:
        radial-gradient(circle at center, rgba(12, 36, 42, 0.55) 0%, rgba(2, 8, 10, 0.92) 45%, rgba(0, 0, 0, 0.98) 100%);
    color: white;
    transition: opacity 0.45s ease;
}

#loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

#loading-logo {
    width: min(280px, 58vw);
    max-width: 280px;
    filter: drop-shadow(0 0 28px rgba(122, 255, 224, 0.22));
}

#loading-title {
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.loading-progress {
    width: min(420px, calc(100vw - 48px));
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 0 0 1px rgba(122, 255, 224, 0.16);
}

.loading-progress-bar {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #41f2c6 0%, #7affdf 45%, #d8fff5 100%);
    box-shadow: 0 0 18px rgba(122, 255, 224, 0.35);
    transition: width 0.28s ease;
}

.mode-selector {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    width: calc(100vw - 32px);
}

.mode-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 160px;
    padding: 12px 18px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(10, 23, 29, 0.96), rgba(4, 12, 15, 0.92));
    color: white;
    border: 1px solid rgba(122, 255, 224, 0.34);
    box-shadow: 0 16px 24px rgba(0, 0, 0, 0.28);
    text-decoration: none;
}

.mode-btn.compact {
    min-width: 92px;
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.mode-input.compact {
    min-width: 70px;
    width: 74px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(122, 255, 224, 0.34);
    background: linear-gradient(180deg, rgba(10, 23, 29, 0.96), rgba(4, 12, 15, 0.92));
    color: #eafff8;
    box-shadow: 0 16px 24px rgba(0, 0, 0, 0.28);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
    outline: none;
}

.mode-input.compact:focus {
    border-color: rgba(122, 255, 224, 0.78);
    box-shadow: 0 0 0 1px rgba(122, 255, 224, 0.24), 0 16px 24px rgba(0, 0, 0, 0.32);
}

.mode-btn.active,
.mode-btn[aria-pressed="true"] {
    border-color: rgba(122, 255, 224, 0.78);
    box-shadow: 0 0 0 1px rgba(122, 255, 224, 0.24), 0 16px 24px rgba(0, 0, 0, 0.32);
    background: linear-gradient(180deg, rgba(20, 69, 62, 0.96), rgba(7, 29, 25, 0.94));
}

.mode-selector.hidden {
    display: none;
}

#loading-status {
    font-size: 13px;
    opacity: 0.78;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
}

#app-canvas {
    position: fixed;
    inset: 0;
    display: block;
    width: 100vw;
    height: 100vh;
    touch-action: none;
    z-index: 0;
}

#btn-toggle-panel {
    position: absolute;
    right: 16px;
    top: 16px;
    z-index: 12;
    background: rgba(0, 0, 0, 0.82);
    color: #62f6ff;
    border: 1px solid rgba(98, 246, 255, 0.5);
    box-shadow: 0 0 18px rgba(72, 219, 251, 0.22);
}

#view-mode-switcher {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 12;
    display: flex;
    gap: 8px;
    padding: 6px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.48);
    border: 1px solid rgba(122, 255, 224, 0.18);
    backdrop-filter: blur(10px);
}

#runtime-worlds-bar {
    position: absolute;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 12;
    display: flex;
    justify-content: center;
    width: min(560px, calc(100vw - 24px));
    pointer-events: auto;
}

.runtime-world-profile-chip {
    width: min(560px, calc(100vw - 24px));
    background: rgba(0, 0, 0, 0.52);
    border: 1px solid rgba(122, 255, 224, 0.18);
    backdrop-filter: blur(10px);
}

.runtime-world-profile-chip span {
    color: #d6fff3;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.runtime-world-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
    width: 100%;
}

.runtime-world-select {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(122, 255, 224, 0.32);
    background: rgba(9, 23, 30, 0.9);
    color: #e8fff7;
    font-size: 13px;
}

.runtime-world-actions {
    margin-top: 8px;
}

.runtime-world-portals {
    position: fixed;
    inset: 0;
    z-index: 24;
    pointer-events: none;
}

.runtime-world-portal-card {
    position: fixed;
    width: 156px;
    min-height: 74px;
    border-radius: 18px;
    border: 1px solid rgba(122, 255, 224, 0.32);
    background: linear-gradient(180deg, rgba(8, 19, 24, 0.95), rgba(4, 11, 14, 0.92));
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.34), inset 0 0 0 1px rgba(122, 255, 224, 0.08);
    color: #ecfff7;
    pointer-events: auto;
    user-select: none;
    touch-action: none;
    overflow: hidden;
}

.runtime-world-portal-card.empty {
    opacity: 0.62;
    border-style: dashed;
}

.runtime-world-portal-card.dragging {
    opacity: 0.84;
    box-shadow: 0 20px 38px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(122, 255, 224, 0.28);
}

.runtime-world-portal-card.selected {
    border-color: rgba(255, 226, 130, 0.92);
    box-shadow: 0 0 0 1px rgba(255, 226, 130, 0.4), 0 16px 30px rgba(0, 0, 0, 0.34);
}

.runtime-world-portal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 10px 6px;
    background: rgba(122, 255, 224, 0.06);
    cursor: grab;
}

.runtime-world-portal-card.pinned .runtime-world-portal-header {
    cursor: default;
}

.runtime-world-portal-title {
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #bfffee;
}

.runtime-world-portal-pin {
    min-width: 52px;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid rgba(122, 255, 224, 0.26);
    background: rgba(8, 18, 24, 0.88);
    color: #d8fff6;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.runtime-world-portal-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
}

.runtime-world-portal-name {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.15;
}

.runtime-world-portal-meta {
    font-size: 11px;
    color: rgba(224, 255, 247, 0.72);
    line-height: 1.3;
}

.runtime-world-portal-enter {
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(122, 255, 224, 0.3);
    background: linear-gradient(180deg, rgba(23, 69, 61, 0.96), rgba(8, 28, 24, 0.94));
    color: #f4fff9;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.runtime-world-portal-card.empty .runtime-world-portal-enter {
    opacity: 0.58;
}

.runtime-house-modules {
    position: fixed;
    right: 12px;
    top: 148px;
    z-index: 34;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    padding: 4px 2px 8px 8px;
    pointer-events: auto;
}

.runtime-house-modules .module-panel {
    position: relative;
    transform: none;
    min-width: 92px;
    width: 122px;
    min-height: 92px;
    border: 1px solid rgba(122, 255, 224, 0.42);
    border-radius: 999px;
    padding: 10px 12px;
    background: radial-gradient(circle at 30% 28%, rgba(20, 39, 47, 0.95), rgba(7, 14, 18, 0.96));
    color: #dffdf4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 5px;
    cursor: pointer;
    pointer-events: auto;
    user-select: none;
    touch-action: none;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(122, 255, 224, 0.12);
    transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.runtime-house-modules .module-panel.dragging {
    opacity: 0.46;
    transform: scale(0.98);
}

.runtime-house-modules .module-panel.active {
    border-color: rgba(255, 234, 125, 0.95);
    color: #fff5c7;
    box-shadow: 0 0 0 1px rgba(255, 234, 125, 0.5), 0 10px 24px rgba(0, 0, 0, 0.45);
}

.runtime-house-modules .module-panel:hover {
    transform: scale(1.08);
    border-color: rgba(118, 255, 46, 0.95);
    box-shadow: 0 0 18px rgba(57, 255, 20, 0.9), 0 0 38px rgba(57, 255, 20, 0.48), 0 12px 30px rgba(0, 0, 0, 0.5);
}

.runtime-house-modules .module-panel:active {
    transform: scale(1.12);
    border-color: rgba(118, 255, 46, 1);
    box-shadow: 0 0 22px rgba(57, 255, 20, 0.95), 0 0 46px rgba(57, 255, 20, 0.62), 0 14px 32px rgba(0, 0, 0, 0.56);
}

.runtime-house-modules .module-panel.hover-neon {
    transform: scale(1.08) !important;
    border-color: rgba(118, 255, 46, 0.95) !important;
    box-shadow: 0 0 18px rgba(57, 255, 20, 0.9), 0 0 38px rgba(57, 255, 20, 0.48), 0 12px 30px rgba(0, 0, 0, 0.5) !important;
}

.runtime-house-modules .module-panel.pressed-large {
    transform: scale(1.14) !important;
    border-color: rgba(118, 255, 46, 1) !important;
    box-shadow: 0 0 24px rgba(57, 255, 20, 0.98), 0 0 50px rgba(57, 255, 20, 0.66), 0 16px 34px rgba(0, 0, 0, 0.6) !important;
}

.runtime-house-modules .module-panel.press-hold {
    box-shadow: 0 0 0 2px rgba(255, 220, 122, 0.72), 0 12px 28px rgba(0, 0, 0, 0.5);
}

.runtime-house-modules .module-panel.drag-unlocked {
    border-color: rgba(118, 255, 46, 1);
    box-shadow: 0 0 18px rgba(57, 255, 20, 0.92), 0 0 42px rgba(57, 255, 20, 0.55), 0 12px 30px rgba(0, 0, 0, 0.52);
}

.runtime-house-modules .module-panel.view-locked {
    opacity: 0.28;
    pointer-events: none;
    filter: saturate(0.42);
}

.runtime-house-modules .module-panel-badge {
    display: inline-block;
    width: fit-content;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #9ee8d9;
    border: 1px solid rgba(122, 255, 224, 0.26);
    border-radius: 999px;
    padding: 2px 7px;
}

.runtime-house-modules .module-panel-name {
    font-size: 11px;
    line-height: 1.2;
    color: #f3fffb;
    text-transform: none;
    max-width: 92px;
    overflow-wrap: anywhere;
}

.runtime-house-modules .module-panel-create {
    border: 1px solid rgba(122, 255, 224, 0.35);
    border-radius: 999px;
    padding: 4px 10px;
    background: rgba(16, 48, 58, 0.78);
    color: #ebfffa;
    font-size: 10px;
    font-weight: 700;
    pointer-events: auto;
}

.runtime-house-modules .module-panel-empty {
    position: relative;
    opacity: 0.7;
}

.runtime-world-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(122, 255, 224, 0.22);
    background: linear-gradient(180deg, rgba(8, 20, 26, 0.9), rgba(4, 12, 15, 0.92));
    color: #ecfffa;
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.2);
    text-align: left;
    cursor: pointer;
}

.runtime-world-card strong {
    font-size: 13px;
    letter-spacing: 0.04em;
}

.runtime-world-card small {
    font-size: 11px;
    opacity: 0.78;
}

.runtime-world-card ul {
    margin: 2px 0 0;
    padding-left: 16px;
    font-size: 11px;
    opacity: 0.84;
}

.runtime-world-card li {
    margin: 0;
}

.world-glb-slot {
    width: 100%;
    margin-top: 6px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px dashed rgba(122, 255, 224, 0.45);
    background: rgba(6, 17, 22, 0.72);
    color: #cffff3;
    font-size: 11px;
    letter-spacing: 0.03em;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.world-glb-state {
    margin-top: 6px;
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 11px;
    letter-spacing: 0.02em;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(234, 255, 248, 0.8);
}

.world-glb-state.ok {
    border-color: rgba(88, 214, 141, 0.62);
    background: rgba(10, 46, 33, 0.62);
    color: #b7ffd8;
}

.world-glb-state.error {
    border-color: rgba(255, 122, 122, 0.62);
    background: rgba(62, 15, 15, 0.62);
    color: #ffd0d0;
}

.world-glb-state.loading {
    border-color: rgba(122, 255, 224, 0.74);
    background: rgba(8, 36, 35, 0.7);
    color: #d9fff5;
    animation: world-glb-pulse 1.1s ease-in-out infinite alternate;
}

@keyframes world-glb-pulse {
    from {
        box-shadow: 0 0 0 rgba(122, 255, 224, 0.0);
    }
    to {
        box-shadow: 0 0 12px rgba(122, 255, 224, 0.26);
    }
}

.world-glb-slot:hover,
.world-glb-slot.drag-over {
    border-color: rgba(122, 255, 224, 0.88);
    background: rgba(12, 39, 34, 0.88);
    box-shadow: 0 0 0 1px rgba(122, 255, 224, 0.22);
}

.runtime-world-card.active {
    border-color: rgba(122, 255, 224, 0.78);
    box-shadow: 0 0 0 1px rgba(122, 255, 224, 0.22), 0 16px 24px rgba(0, 0, 0, 0.32);
    background: linear-gradient(180deg, rgba(20, 69, 62, 0.96), rgba(7, 29, 25, 0.94));
}

.runtime-world-card.drag-over {
    border-color: rgba(122, 255, 224, 0.88);
    box-shadow: 0 0 0 1px rgba(122, 255, 224, 0.32), 0 16px 24px rgba(0, 0, 0, 0.32);
}

#btn-runtime-toggle-gravity.active,
#btn-runtime-toggle-gravity[aria-pressed="true"] {
    border-color: rgba(255, 94, 136, 0.82);
    box-shadow: 0 0 0 1px rgba(255, 94, 136, 0.22), 0 16px 24px rgba(0, 0, 0, 0.32);
    background: linear-gradient(180deg, rgba(104, 24, 45, 0.95), rgba(54, 10, 21, 0.92));
}

#instrucciones,
#planta-hud,
#placement-hud,
#placement-help,
#mobile-note {
    position: absolute;
    color: white;
    background: rgba(0, 0, 0, 0.55);
    padding: 8px 12px;
    border-radius: 10px;
    z-index: 10;
}

#instrucciones {
    top: 10px;
    left: 10px;
    max-width: min(420px, calc(100vw - 20px));
}

#planta-hud {
    top: 10px;
    right: 10px;
    pointer-events: none;
}

#placement-hud {
    top: 58px;
    right: 10px;
    display: none;
    max-width: min(280px, calc(100vw - 20px));
    background: rgba(16, 70, 120, 0.8);
}

#placement-hud.visible {
    display: block;
}

#placement-help {
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    display: none;
    background: rgba(0, 0, 0, 0.78);
    border: 1px solid rgba(101, 255, 207, 0.38);
    box-shadow: 0 0 16px rgba(101, 255, 207, 0.18);
    font-size: 12px;
    white-space: nowrap;
}

#placement-help.visible {
    display: block;
}

#mobile-note {
    top: 106px;
    right: 10px;
    display: none;
    max-width: min(280px, calc(100vw - 20px));
}

#mobile-note.visible {
    display: block;
}

#panel {
    position: absolute;
    top: 68px;
    right: 16px;
    width: min(390px, calc(100vw - 20px));
    height: min(520px, calc(100vh - 130px));
    min-width: 300px;
    min-height: 240px;
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 80px);
    overflow: auto;
    resize: both;
    background: rgba(0, 0, 0, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 12px;
    color: white;
    z-index: 10;
    box-sizing: border-box;
}

#panel.dragging {
    user-select: none;
    cursor: grabbing;
}

#panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: -2px -2px 10px;
    padding: 2px 2px 8px;
    cursor: default;
    touch-action: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.panel-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

#btn-place-control-panel {
    background: rgba(21, 101, 192, 0.88);
    color: #fff;
    padding: 7px 10px;
    font-size: 12px;
}

#panel-drag-hint {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #62f6ff;
    opacity: 0.82;
}

#panel.hidden {
    display: none;
}

#crosshair {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 34px;
    height: 34px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 11;
}

.crosshair-h,
.crosshair-v {
    position: absolute;
    background: #65ffcf;
    box-shadow: 0 0 6px #65ffcf, 0 0 14px rgba(101, 255, 207, 0.95);
    border-radius: 999px;
}

.crosshair-h {
    left: 3px;
    top: 50%;
    width: 28px;
    height: 2px;
    transform: translateY(-50%);
}

.crosshair-v {
    left: 50%;
    top: 3px;
    width: 2px;
    height: 28px;
    transform: translateX(-50%);
}

#panel h3 {
    margin: 0 0 8px;
    font-size: 15px;
}

#status {
    font-size: 12px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.upload-card {
    margin: 8px 0 12px;
    padding: 10px;
    border: 1px solid rgba(98, 246, 255, 0.22);
    border-radius: 10px;
    background: rgba(7, 17, 22, 0.58);
}

.edit-card {
    border-color: rgba(120, 188, 255, 0.28);
    background: linear-gradient(180deg, rgba(10, 18, 30, 0.86), rgba(8, 16, 24, 0.72));
}

.room-edit-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
}

.field-chip {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 9px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.field-chip span {
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.8;
}

.field-chip input {
    width: 100%;
}

.field-chip select,
.field-chip button {
    width: 100%;
}
.checkbox-chip {
    justify-content: space-between;
}
.checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.checkbox-row input {
    width: 18px;
    height: 18px;
}
.checkbox-row strong {
    font-size: 12px;
    font-weight: 700;
    color: #eaf6ff;
}

.field-chip strong {
    font-size: 12px;
    color: #d8fff5;
}

.map-view-chip {
    justify-content: space-between;
}

.speed-chip {
    justify-content: space-between;
}

#btn-toggle-map-view {
    background: rgba(21, 101, 192, 0.88);
    color: #fff;
}

#btn-toggle-map-view.active {
    background: rgba(255, 171, 64, 0.92);
    color: #1a1106;
}

#btn-toggle-speed-mode {
    background: rgba(0, 150, 136, 0.9);
    color: #fff;
}

#btn-toggle-speed-mode.fast {
    background: rgba(255, 183, 77, 0.95);
    color: #1d1203;
}

.constructor-scale-chip {
    margin-top: 10px;
}

#btn-preview-room {
    background: #455a64;
    color: white;
    flex: 1 1 150px;
}

#btn-save-room {
    background: #1565c0;
    color: white;
    flex: 1 1 150px;
}

#btn-open-webview,
#btn-open-camera-view {
    background: #0b6b57;
    color: #fff;
}

#btn-refresh-webview,
#btn-open-webview-external {
    background: #1565c0;
    color: #fff;
}

#btn-close-webview,
#btn-close-webview-overlay {
    background: #6d4c41;
    color: #fff;
}

#btn-clear-runtime-cache {
    background: #8e24aa;
    color: #fff;
}

.webview-overlay {
    position: fixed;
    inset: 10px;
    z-index: 26;
    display: none;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(122, 255, 224, 0.32);
    background: rgba(5, 12, 16, 0.96);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.46);
}

.webview-overlay.visible {
    display: flex;
}

.webview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    background: rgba(10, 21, 30, 0.95);
    border-bottom: 1px solid rgba(122, 255, 224, 0.24);
    color: #dff9ff;
}

#webview-frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: #0b1118;
}

#btn-sync-image-floor {
    background: rgba(21, 101, 192, 0.88);
    color: white;
}

.image-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.image-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.09);
}

.image-card.drop-enabled {
    cursor: pointer;
    border-style: dashed;
}

.image-card.drop-enabled:hover {
    border-color: rgba(122, 255, 224, 0.55);
    background: rgba(122, 255, 224, 0.09);
}

.image-card.drag-over {
    border-color: rgba(24, 255, 166, 0.85);
    background: rgba(24, 255, 166, 0.16);
    box-shadow: 0 0 0 1px rgba(24, 255, 166, 0.28) inset;
}

.image-card-title {
    font-size: 13px;
    font-weight: 700;
}

.constructor-card {
    border-color: rgba(255, 183, 77, 0.28);
    background: linear-gradient(180deg, rgba(28, 19, 10, 0.86), rgba(14, 12, 9, 0.72));
}

#btn-add-cube,
#btn-add-constructor-object {
    background: #ff8f00;
    color: #101010;
    flex: 1 1 160px;
}

#btn-remove-cube,
#btn-clear-builder {
    background: #6d4c41;
    color: #fff;
    flex: 1 1 160px;
}

#btn-save-builder {
    background: #2e7d32;
    color: #fff;
    flex: 1 1 160px;
}

#constructor-object-library {
    flex: 1 1 210px;
}

.receptionist-slots {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.receptionist-slot-row {
    display: flex;
    gap: 6px;
    align-items: stretch;
}

.receptionist-slot-btn {
    background: #1b5e20;
    color: #fff;
    min-height: 38px;
    font-size: 12px;
    flex: 1 1 auto;
}

.receptionist-slot-btn:hover {
    background: #2e7d32;
}

.receptionist-slot-btn.drag-over {
    background: #43a047;
    box-shadow: 0 0 0 2px rgba(67, 160, 71, 0.35) inset;
}

.receptionist-slot-clear-btn {
    background: rgba(198, 40, 40, 0.92);
    color: #fff;
    min-height: 38px;
    font-size: 11px;
    padding: 9px 10px;
    white-space: nowrap;
}

.receptionist-slot-clear-btn:hover {
    background: rgba(211, 47, 47, 0.98);
}

.world-profiles-row {
    margin-top: 8px;
}

.world-profile-chip {
    min-width: 220px;
}

#world-profile-select {
    min-width: 210px;
}

#runtime-worlds-bar #world-profile-select {
    width: 100%;
    min-width: 0;
}

.constructor-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.constructor-stat {
    padding: 9px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 12px;
}

.constructor-object-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.constructor-object-row strong {
    display: block;
    font-size: 13px;
}

.constructor-object-row span {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    opacity: 0.78;
}

.portal-url-field {
    display: block;
    margin-top: 8px;
}

.portal-url-field span {
    margin-top: 0;
    margin-bottom: 4px;
    opacity: 0.92;
}

.portal-url-field input {
    width: min(100%, 250px);
    font-size: 12px;
    padding: 7px 9px;
}

.object-scale-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(72px, 1fr));
    gap: 8px;
    margin-top: 8px;
    width: min(100%, 280px);
}

.object-scale-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.object-scale-field span {
    margin: 0;
}

.object-scale-field input {
    width: 100%;
    font-size: 12px;
    padding: 7px 9px;
}

.object-color-field input {
    width: 72px;
    min-width: 72px;
    padding: 4px;
    height: 34px;
    background: transparent;
}

.constructor-delete-btn {
    background: rgba(198, 40, 40, 0.92);
    color: #fff;
    padding: 7px 10px;
    white-space: nowrap;
}

@media (max-width: 720px) {
    .constructor-object-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .receptionist-slots {
        grid-template-columns: 1fr;
    }
}

.image-card-meta {
    font-size: 11px;
    opacity: 0.74;
    line-height: 1.4;
}

.image-card button {
    width: 100%;
    background: #00695c;
    color: white;
}

.tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.tab-btn.active {
    background: #1565c0;
    color: white;
}

.guided-demo-focus {
    position: relative;
    z-index: 2;
    box-shadow: 0 0 0 2px rgba(255, 243, 108, 0.95), 0 0 18px rgba(255, 225, 107, 0.72) !important;
    animation: guided-focus-pulse 0.9s ease-in-out infinite alternate;
}

@keyframes guided-focus-pulse {
    from {
        transform: translateZ(0) scale(1);
    }
    to {
        transform: translateZ(0) scale(1.025);
    }
}

.tab-panel {
    display: none;
}

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

.row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.row.wrap {
    flex-wrap: wrap;
}

button,
input,
select {
    border: 0;
    border-radius: 8px;
    padding: 9px 11px;
    box-sizing: border-box;
    font: inherit;
}

button {
    cursor: pointer;
    font-weight: 700;
}

input,
select {
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

input::placeholder {
    color: rgba(255, 255, 255, 0.55);
}

select option {
    color: #111;
}

#btn-planta,
#btn-install,
#btn-add-switch,
#btn-add-led-panel {
    color: white;
    width: 100%;
}

#btn-planta {
    background: #455a64;
}

#btn-install {
    background: #00695c;
}

#btn-add-switch {
    background: #1565c0;
}

#btn-add-led-panel {
    background: #ef6c00;
}

#new-switch-name {
    flex: 1 1 190px;
}

#new-switch-pin {
    flex: 0 0 92px;
}

#new-led-name {
    flex: 1 1 190px;
}

#new-led-switch {
    flex: 0 0 150px;
}

.helper {
    font-size: 11px;
    opacity: 0.72;
    margin: -2px 0 8px;
}

.section-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.82;
    margin: 14px 0 8px;
}

.sw {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 6px;
    box-sizing: border-box;
}

.sw-main {
    min-width: 0;
    flex: 1;
}

.sw-name {
    font-size: 13px;
}

.sw-meta {
    font-size: 11px;
    opacity: 0.75;
    margin-top: 2px;
}

.sw-state-chip {
    display: inline-block;
    margin-top: 6px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.sw-state-chip.on {
    background: rgba(46, 204, 113, 0.18);
    color: #86efac;
}

.sw-state-chip.off {
    background: rgba(239, 68, 68, 0.18);
    color: #fca5a5;
}

.sw-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.sw-btn {
    min-width: 118px;
    color: #fff;
    background: linear-gradient(180deg, #1565c0 0%, #0d47a1 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 6px 14px rgba(8, 22, 48, 0.26);
}

.sw-btn.pulse-toggle:active {
    transform: translateY(1px) scale(0.99);
    box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.16), 0 2px 6px rgba(8, 22, 48, 0.2);
}

.manage-btn {
    color: white;
    background: #546e7a;
}

.manage-btn.delete {
    background: #6d1b1b;
}

.manage-btn.place.active {
    background: #1565c0;
}

.assign-select {
    min-width: 132px;
    font-size: 12px;
    max-width: 100%;
}

.panel-chip {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    background: rgba(255, 193, 7, 0.18);
    color: #ffd54f;
}

.sw-actions .assign-select {
    flex: 1 1 150px;
}

#mobile-controls {
    position: absolute;
    inset: auto 0 16px 0;
    z-index: 15;
    display: none;
    padding: 0 16px;
    box-sizing: border-box;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: none;
}

#mobile-controls.visible {
    display: flex;
}

.mobile-joystick,
.mobile-actions {
    pointer-events: auto;
}

.mobile-joystick {
    position: relative;
    width: 124px;
    height: 124px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, rgba(26, 43, 48, 0.45), rgba(4, 10, 14, 0.84));
    border: 1px solid rgba(130, 255, 218, 0.22);
    box-shadow: 0 18px 32px rgba(0, 0, 0, 0.32), inset 0 0 24px rgba(72, 255, 197, 0.08);
    touch-action: none;
}

.mobile-joystick-ring {
    position: absolute;
    inset: 12px;
    border-radius: 50%;
    border: 1px solid rgba(130, 255, 218, 0.2);
}

.mobile-joystick-thumb {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle at 35% 35%, rgba(116, 255, 210, 0.95), rgba(23, 111, 92, 0.95));
    box-shadow: 0 0 18px rgba(101, 255, 207, 0.35);
}

.mobile-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.mobile-actions button {
    min-width: 132px;
    min-height: 56px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(7, 20, 28, 0.94), rgba(2, 8, 12, 0.88));
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 14px 24px rgba(0, 0, 0, 0.3);
}

#btn-mobile-interact {
    min-width: 180px;
    background: linear-gradient(180deg, rgba(18, 89, 79, 0.96), rgba(7, 46, 40, 0.94));
    border-color: rgba(101, 255, 207, 0.32);
}

#btn-mobile-interact:disabled {
    opacity: 0.52;
}

body.mobile-game #panel,
body.mobile-game #btn-toggle-panel {
    display: none !important;
}

body.mobile-game-desktop-controls #btn-toggle-panel {
    display: inline-flex !important;
}

body.mobile-game #instrucciones {
    top: 10px;
    left: 10px;
    right: 10px;
    max-width: calc(100vw - 20px);
    font-size: 12px;
    background: rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(8px);
}

body.mobile-game #planta-hud {
    top: auto;
    right: 16px;
    bottom: 166px;
    background: rgba(0, 0, 0, 0.46);
}

body.mobile-game #mobile-note {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: 152px;
    max-width: none;
    background: rgba(0, 0, 0, 0.46);
    backdrop-filter: blur(8px);
}

body.mobile-game #crosshair {
    width: 42px;
    height: 42px;
}

body.mobile-game .crosshair-h,
body.mobile-game .crosshair-v {
    box-shadow: 0 0 10px #65ffcf, 0 0 18px rgba(101, 255, 207, 0.95);
}

@media (max-width: 820px) {
    #loading-logo {
        width: min(220px, 64vw);
    }

    #runtime-worlds-bar {
        top: 118px;
        width: calc(100vw - 20px);
    }

    .runtime-world-profile-chip {
        width: 100%;
    }

    #loading-status {
        font-size: 11px;
        text-align: center;
        max-width: calc(100vw - 48px);
    }

    .mode-selector {
        width: calc(100vw - 32px);
    }

    .mode-btn {
        min-width: 0;
        flex: 1 1 160px;
    }

    #btn-toggle-panel {
        right: 10px;
        top: 10px;
    }

    #view-mode-switcher {
        top: 10px;
        max-width: calc(100vw - 96px);
    }

    #panel {
        width: calc(100vw - 20px);
        max-height: min(48vh, calc(100vh - 220px));
        top: 58px;
        right: 10px;
    }

    .sw {
        flex-direction: column;
        align-items: stretch;
    }

    .sw-actions {
        justify-content: flex-start;
    }

    .room-edit-grid,
    .image-cards {
        grid-template-columns: 1fr;
    }

    #instrucciones {
        max-width: calc(100vw - 20px);
        font-size: 12px;
    }

    #mobile-controls {
        bottom: max(12px, env(safe-area-inset-bottom));
        padding: 0 12px;
    }

    .mobile-joystick {
        width: 112px;
        height: 112px;
    }

    .mobile-joystick-thumb {
        width: 48px;
        height: 48px;
    }

    .mobile-actions button {
        min-height: 52px;
        min-width: 120px;
    }

    #btn-mobile-interact {
        min-width: 166px;
    }
}
