
.map-live-wrap {
    display: grid;
    gap: 14px;
}

.map-live-head,
.map-live-card,
.map-node,
.map-pipe,
.panel-card {
    background: rgba(18, 28, 48, 0.96);
    border: 1px solid rgba(120, 170, 255, 0.18);
    border-radius: 16px;
    box-shadow: 0 0 18px rgba(0, 0, 0, 0.18);
}

.map-live-head {
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.map-live-title {
    font-size: 22px;
    font-weight: bold;
}

.map-live-sub {
    font-size: 13px;
    color: #9fb4d9;
    margin-top: 4px;
}

.map-live-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.map-live-card {
    padding: 14px;
    overflow: hidden;
}

.panel-card {
    padding: 14px;
}

.panel-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 12px;
}

#mapDebugContent {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    color: #dce9ff;
}

.map-stage {
    position: relative;
    width: 100%;
    min-height: calc(100vh - 220px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: auto;
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(12,20,36,0.98), rgba(8,14,26,0.98));
    border: 1px solid rgba(120,170,255,0.16);
    padding: 14px;
}

.schema-fit {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.schema {
    position: relative;
    width: 1600px;
    height: 900px;
    min-width: 1600px;
    min-height: 900px;
    transform-origin: top center;
    border-radius: 20px;
    background:
        linear-gradient(180deg, rgba(12,20,36,0.98), rgba(8,14,26,0.98));
    border: 1px solid rgba(120,170,255,0.16);
    overflow: hidden;
}

.schema::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
    z-index: 0;
}

.map-layer {
    position: absolute;
    inset: 0;
}

#bgLayer { z-index: 1; }
#pipeLayer { z-index: 2; }
#nodeLayer { z-index: 3; }
#toolLayer { z-index: 4; }
#labelLayer { z-index: 5; }

.bg-image {
    position: absolute;
    transform-origin: top left;
    pointer-events: none;
    filter: grayscale(1) contrast(1.15) brightness(0.8) hue-rotate(170deg);
}

.map-node {
    position: absolute;
    min-width: 120px;
    min-height: 80px;
    padding: 10px;
    z-index: 3;
    user-select: none;
    background: rgba(18, 28, 48, 0.96);
    border: 1px solid rgba(120, 170, 255, 0.18);
    border-radius: 16px;
    box-shadow: 0 0 18px rgba(0, 0, 0, 0.18);
}

.map-node-title {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 6px;
}

.map-node-temp {
    font-size: 22px;
    font-weight: bold;
}

.map-node-meta {
    margin-top: 6px;
    font-size: 12px;
    color: #9fb4d9;
    line-height: 1.45;
}

.map-pipe {
    position: absolute;
    z-index: 2;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.10);
    box-shadow: inset 0 0 10px rgba(255,255,255,0.05);
}

.map-pipe .flow {
    position: absolute;
    inset: 0;
    opacity: 0;
}

.map-pipe.active .flow {
    opacity: 0.75;
}

.map-pipe.horizontal .flow.forward {
    background: repeating-linear-gradient(
        90deg,
        rgba(255,255,255,0) 0,
        rgba(255,255,255,0) 10px,
        rgba(126,240,255,0.85) 10px,
        rgba(126,240,255,0.85) 20px
    );
    animation: flow-x-forward 1s linear infinite;
}

.map-pipe.horizontal .flow.reverse {
    background: repeating-linear-gradient(
        90deg,
        rgba(255,255,255,0) 0,
        rgba(255,255,255,0) 10px,
        rgba(126,240,255,0.85) 10px,
        rgba(126,240,255,0.85) 20px
    );
    animation: flow-x-reverse 1s linear infinite;
}

.map-pipe.vertical .flow.forward {
    background: repeating-linear-gradient(
        180deg,
        rgba(255,255,255,0) 0,
        rgba(255,255,255,0) 10px,
        rgba(126,240,255,0.85) 10px,
        rgba(126,240,255,0.85) 20px
    );
    animation: flow-y-forward 1s linear infinite;
}

.map-pipe.vertical .flow.reverse {
    background: repeating-linear-gradient(
        180deg,
        rgba(255,255,255,0) 0,
        rgba(255,255,255,0) 10px,
        rgba(126,240,255,0.85) 10px,
        rgba(126,240,255,0.85) 20px
    );
    animation: flow-y-reverse 1s linear infinite;
}

.map-tool {
    position: absolute;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    z-index: 4;
}

.tool-title {
    font-size: 11px;
    color: #dce9ff;
    text-align: center;
    white-space: nowrap;
}

.tool-drawing.pump {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    background: rgba(10,16,26,0.95);
    border: 2px solid rgba(255,255,255,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-drawing.pump svg {
    width: 24px;
    height: 24px;
}

.tool-drawing.pump.on svg {
    animation: pump-spin 1s linear infinite;
}

.tool-drawing.valve-3way {
    width: 46px;
    height: 46px;
}

.tool-drawing.valve-3way svg {
    width: 100%;
    height: 100%;
}

.map-label {
    position: absolute;
    padding: 4px 8px;
    border-radius: 8px;
    background: rgba(8,14,26,0.55);
    border: 1px solid rgba(255,255,255,0.08);
    z-index: 5;
}

@keyframes flow-x-forward {
    from { transform: translateX(-40px); }
    to { transform: translateX(0px); }
}
@keyframes flow-x-reverse {
    from { transform: translateX(0px); }
    to { transform: translateX(-40px); }
}
@keyframes flow-y-forward {
    from { transform: translateY(-40px); }
    to { transform: translateY(0px); }
}
@keyframes flow-y-reverse {
    from { transform: translateY(0px); }
    to { transform: translateY(-40px); }
}
@keyframes pump-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

:fullscreen .map-stage,
.map-stage.is-fullscreen {
    min-height: calc(100vh - 30px);
    height: calc(100vh - 30px);
}

.asset-box {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 10px;
}

.asset-title {
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 8px;
    color: #eaf1ff;
}

.asset-drawing {
    position: relative;
    width: 100%;
    height: calc(100% - 24px);
}

.asset-drawing.atmos {
    background: linear-gradient(180deg, rgba(60,36,18,0.95), rgba(34,20,10,0.98));
    border-radius: 14px;
    border: 2px solid rgba(255,255,255,0.14);
}

.asset-drawing.atmos .door {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 14px;
    height: 38%;
    border: 2px solid rgba(255,255,255,0.18);
    border-radius: 10px;
}

.asset-drawing.atmos .chimney {
    position: absolute;
    right: 18px;
    top: -8px;
    width: 24px;
    height: 26px;
    background: rgba(90,110,130,0.95);
    border-radius: 6px 6px 0 0;
}

.asset-drawing.atmos .label {
    position: absolute;
    left: 16px;
    top: 12px;
    font-weight: bold;
    color: #ffd166;
}

.tank-h .body,
.tank-v .body {
    position: absolute;
    inset: 8px;
    border: 3px solid rgba(180,230,255,0.28);
    background: linear-gradient(180deg, rgba(26,62,92,0.96), rgba(14,28,40,0.98));
}

.tank-h .body { border-radius: 999px; }
.tank-v .body { border-radius: 40px; }

.hex .plate-stack {
    position: absolute;
    inset: 10px 22px;
    background: repeating-linear-gradient(
        180deg,
        rgba(180,190,210,0.10) 0,
        rgba(180,190,210,0.10) 10px,
        rgba(220,230,255,0.32) 10px,
        rgba(220,230,255,0.32) 14px
    );
    border-radius: 12px;
    border: 2px solid rgba(220,230,255,0.25);
}

.solar .tube-wrap {
    position: absolute;
    inset: 12px;
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 6px;
}

.solar .tube-wrap span {
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(140,220,255,0.98), rgba(30,70,120,0.98));
    border: 1px solid rgba(255,255,255,0.18);
}

.radiator {
    position: absolute;
    inset: 12px;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.radiator span {
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(210,220,230,0.96), rgba(120,140,165,0.96));
}

.room-shape,
.generic-shape {
    position: absolute;
    inset: 10px;
    border-radius: 14px;
    border: 2px dashed rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.03);
}

.map-node-temp-badge {
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(10,16,26,0.86);
    font-size: 12px;
    border: 1px solid rgba(255,255,255,0.10);
}

.tool-drawing.sensor-dot {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: #7ef0ff;
    box-shadow: 0 0 10px rgba(126,240,255,0.55);
    margin-top: 10px;
}

.tool-drawing.gpio-box {
    min-width: 44px;
    min-height: 28px;
    border-radius: 8px;
    padding: 6px 8px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.14);
    font-size: 11px;
}
