﻿* {
    box-sizing: border-box;
}
body {
    margin: 0;
    background: #091723;
    color: #e9f3f6;
    font: 15px system-ui, sans-serif;
}
.shell {
    max-width: 1500px;
    margin: auto;
    padding: 20px;
}
h1 {
    margin: 0 0 16px;
    font-size: 24px;
}
h1 span {
    margin-left: 12px;
    color: #9db8c6;
    font-size: 15px;
    font-weight: 400;
}
.scene {
    position: relative;
    container-type: inline-size;
    overflow: hidden;
    border-radius: 12px;
    background: #142637;
    aspect-ratio: 1672 / 941;
}
canvas {
    display: block;
    width: 100%;
    height: 100%;
}
.device-card {
    position: absolute;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.18cqw;
    width: max-content;
    padding: 0.45cqw 0.8cqw;
    border: 1.5px solid #4bb6e2;
    border-radius: 0.85cqw;
    background: rgba(30, 42, 49, 0.96);
    box-shadow: 0 0.3cqw 1cqw #0005, inset 0 0 0 2px #ffffff06;
    font-size: clamp(9px, 1.3cqw, 20px);
    transform: translateX(-50%);
    pointer-events: none;
}
.card-label {
    color: #b4bdc3;
    font-weight: 500;
    white-space: nowrap;
}
.device-card strong {
    font-size: clamp(10px, 1.75cqw, 27px);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    white-space: nowrap;
}
.temperature {
    color: #2196f3;
}
.temperature::before {
    content: '';
    display: inline-block;
    width: 0.6em;
    height: 0.9em;
    margin-right: 0.28em;
    vertical-align: -0.02em;
    background: currentColor;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 24'%3E%3Cpath d='M8 1a4 4 0 0 0-4 4v9a6 6 0 1 0 8 0V5a4 4 0 0 0-4-4Zm0 2a2 2 0 0 1 2 2v10l1 .6a4 4 0 1 1-6 0l1-.6V5a2 2 0 0 1 2-2Zm-1 4v11h2V7Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.system-card {
    left: 51%;
    top: 8.5%;
}
.boiler-card {
    left: 70.7%;
    top: 28.6%;
}
.valve-card {
    left: 51.25%;
    top: 44%;
    border-color: #d45b65;
    color: #f0858b;
}
.valve-card[data-state="open"] {
    border-color: #46bd8b;
    color: #65dda7;
}
.valve-card[data-state="moving"] {
    border-color: #dbb66c;
    color: #ffd093;
}
.valve-card[data-state="moving"] strong {
    font-size: clamp(8px, 1.25cqw, 19px);
}
.description, .controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 16px;
}
.description {
    justify-content: space-between;
    min-height: 56px;
    margin: 0 0 16px;
    padding: 12px 16px;
    border-left: 3px solid #ffba6b;
    border-radius: 4px 8px 8px 4px;
    background: #142b3b;
    font-size: clamp(17px, 1.8vw, 25px);
}
#state {
    color: #ffc785;
    font-size: 15px;
    font-weight: 600;
}
button {
    padding: 10px 16px;
    border: 1px solid #496578;
    border-radius: 8px;
    background: #193346;
    color: inherit;
    font: inherit;
    cursor: pointer;
}
button:hover {
    background: #274d63;
}
button:disabled {
    cursor: default;
    opacity: 0.55;
}
.scene-footer {
    position: absolute;
    z-index: 2;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 2.2cqw 1.2cqw 1cqw;
    background: linear-gradient(transparent, #001a2bd9 30%, #001523f5);
}
.scene-footer .controls {
    gap: 0.6cqw;
    margin-top: 0.6cqw;
}
.timeline {
    overflow: hidden;
    border: 1px solid #1483ae;
    border-radius: 0.85cqw;
    background: linear-gradient(135deg, #032439, #031827);
}
.phase-callouts {
    position: absolute;
    z-index: 2;
    inset: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    pointer-events: none;
}
.phase-callouts li {
    position: absolute;
    width: max-content;
    max-width: 26%;
}
.phase-callouts li:nth-child(1),
.phase-callouts li:nth-child(4) {
    left: 13%;
    top: 9%;
}
.phase-callouts li:nth-child(2),
.phase-callouts li:nth-child(5) {
    left: 46%;
    top: 21.5%;
}
.phase-callouts li:nth-child(3) {
    left: 67.5%;
    top: 52%;
}
.phase-callout {
    --stage-color: #ffc42b;
    display: flex;
    align-items: center;
    gap: 0.6cqw;
    padding: 0.65cqw 0.85cqw;
    border: 1px solid var(--stage-color);
    border-radius: 0.7cqw;
    background: linear-gradient(135deg, #032439f5, #031827eb);
    box-shadow: 0 0.3cqw 1cqw #0005;
    text-align: left;
    font-size: max(9px, 1.1cqw);
    line-height: 1.4;
    opacity: 0;
    visibility: hidden;
}
.phase-callouts li:nth-child(2) .phase-callout {
    --stage-color: #17dfc1;
}
.phase-callouts li:nth-child(3) .phase-callout {
    --stage-color: #ff7c28;
}
.phase-callouts li:nth-child(4) .phase-callout {
    --stage-color: #1da7ff;
}
.phase-callouts li:nth-child(5) .phase-callout {
    --stage-color: #00dfae;
}
.step-number {
    display: grid;
    flex: 0 0 2.2cqw;
    width: 2.2cqw;
    height: 2.2cqw;
    place-items: center;
    border: 1px solid #4db9ff;
    border-radius: 50%;
    background: linear-gradient(#109aff, #0064e6);
    color: #fff;
    font-size: 1.4cqw;
    font-weight: 700;
}
.step-icon {
    flex: 0 0 2.2cqw;
    width: 2.2cqw;
    height: 2.5cqw;
    overflow: visible;
    color: var(--stage-color);
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.timeline-track {
    padding: 0.35cqw 1cqw 0.65cqw;
}
#seek {
    --progress: 0%;
    display: block;
    appearance: none;
    width: 100%;
    height: max(4px, 0.6cqw);
    min-width: 0;
    margin: 0.3cqw 0;
    border: 1px solid #386278;
    border-radius: 10px;
    background: linear-gradient(to right, #ffc42b 0%, #00dfae var(--progress), #375365 var(--progress), #375365 100%);
    cursor: pointer;
}
#seek::-webkit-slider-thumb {
    appearance: none;
    width: max(10px, 1.2cqw);
    height: max(10px, 1.2cqw);
    border: max(2px, 0.24cqw) solid #00dfae;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 12px #00dfae99;
}
#seek::-moz-range-thumb {
    width: max(6px, 0.72cqw);
    height: max(6px, 0.72cqw);
    border: max(2px, 0.24cqw) solid #00dfae;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 12px #00dfae99;
}
.controls button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6cqw;
    min-width: 9cqw;
    padding: 0.6cqw 1cqw;
    border-radius: 0.7cqw;
    border-color: #1483ae;
    background: #032439;
    font-weight: 600;
    font-size: max(9px, 1.1cqw);
}
.controls button:hover {
    background: #14435c;
}
.controls button > [aria-hidden] {
    font-size: max(11px, 1.4cqw);
    line-height: 1;
}
:focus-visible {
    outline: 2px solid #70d7ed;
    outline-offset: 4px;
}
@media (min-width: 601px) and (max-width: 1000px) {
    .phase-callouts li:nth-child(2),
    .phase-callouts li:nth-child(5) {
        left: 38%;
    }
}
@media (max-width: 600px) {
    .shell {
        padding: 10px;
    }
    h1 span {
        display: block;
        margin: 4px 0 0;
    }
    .description {
        font-size: 17px;
        gap: 6px;
    }
    .phase-callout {
        gap: 1cqw;
        padding: 1cqw;
    }
    .phase-callouts li {
        max-width: 36%;
    }
    .phase-callouts li:nth-child(1),
    .phase-callouts li:nth-child(4) {
        left: 5%;
        top: 7%;
    }
    .phase-callouts li:nth-child(2),
    .phase-callouts li:nth-child(5) {
        left: 6%;
        top: 31%;
    }
    .phase-callouts li:nth-child(3) {
        left: 61%;
        top: 55%;
    }
    .step-number {
        flex-basis: 14px;
        width: 14px;
        height: 14px;
        font-size: 9px;
    }
    .step-icon {
        display: none;
    }
}
