/* Approved free-play refinement: calm readouts, readable controls, one primary action. */
:root{--accent:#ad3e26;--muted:#716b65}
.page-header{gap:22px;padding:0 2.6%}
.page-header .hall-link{font-size:16px;display:flex;align-items:center;gap:12px}
.hall-link>span{font-size:25px;font-weight:400}
.page-header .brand{font-size:18px;font-weight:600;gap:20px}
.page-header .icon-button{width:36px;height:36px}
.data-handle{border:1px solid #e4dfda;border-top:0;border-radius:0 0 10px 10px;box-shadow:0 3px 8px #34231405;font-size:12px;height:40px;padding:0 18px}
.intro{top:14%;left:3.5%}
.intro>span{font:600 17px/1.5 "PingFang SC","Microsoft YaHei",sans-serif;letter-spacing:0;color:#302c29;display:flex;align-items:center;gap:10px}
.intro>span:before{content:"";width:10px;height:10px;border-radius:50%;background:var(--accent);flex:none}
.intro p{font-size:14px;line-height:1.9;margin-top:14px;color:#645e58;max-width:400px}
.start-experiment{gap:16px}
.start-experiment strong{font-size:22px;font-weight:600;letter-spacing:0}
.start-experiment small{font-size:12px;color:#756c64;line-height:1.7}
.start-disc{width:48px;height:48px;border:1.5px solid var(--accent);background:#fffaf5;box-shadow:none;color:var(--accent)}
.start-disc svg{width:23px;height:23px;fill:currentColor}
.start-experiment:hover .start-disc{box-shadow:none;background:#f5e9df;transform:scale(1.03)}
.metrics{border:1px solid #e2ddd8;border-radius:12px;background:#fffefd;box-shadow:0 4px 16px #3a2a1e06}
.metrics>div{padding:0 13px;min-width:66px;border-color:#e8e3de}
.metrics span{font-size:11px;color:#625c56;margin-bottom:10px}
.metrics strong{font-size:21px;color:#302c29;font-weight:600;letter-spacing:-.3px}
.metrics>div:nth-child(n+4) strong{color:var(--accent)}
.machine-title{font-size:27px;letter-spacing:0}
.machine-stats{font-size:12px}
.machine-status{display:none}
.factory-running .machine-status{display:block}
.factory-actions{padding:12px 14px;gap:14px;background:#fffefcf5;border:1px solid #e2ddd8;border-radius:12px;box-shadow:0 5px 18px #3a2a1e08}
.factory-actions .control-dock{background:none;border:0;box-shadow:none;padding:0;gap:16px;max-width:100%;min-width:0}
.factory-actions .control-dock label{font-size:12px;color:#3d3731;margin-bottom:10px}
.factory-actions .segmented button{font-size:13px;padding:8px 11px;min-height:36px;border-color:#ded7d0;border-radius:5px;background:#fffdfb}
.factory-actions .segmented button.active{background:var(--accent);color:white;box-shadow:none;border-color:var(--accent)}
.factory-actions .buffer-info{max-width:120px;color:#79716a;font-size:10px;line-height:1.65;border-left:0;padding:0}
.factory-actions .speed-controls{padding-left:16px;border-left:1px solid #e3dcd5}
.factory-actions .playback-controls{border-left:1px solid #e3dcd5;padding-left:16px;gap:8px}
#playback-options{font-size:12px;font-weight:600;color:var(--accent)}
#playback-options:after{content:'⌄';margin-left:5px}
.factory-actions .dock-hint{font-size:10px;color:#847b72}
.factory-actions .next-period{background:var(--accent);color:white;border:1px solid var(--accent);min-height:54px;min-width:150px;padding:13px 15px;font-size:15px;font-weight:600;box-shadow:none;border-radius:8px}
.factory-actions .next-period:hover{background:#93351f}
.factory-actions .next-period kbd{color:#f9e5da;border-color:#ffffff55;padding:3px 4px;letter-spacing:.5px}
.factory-actions .next-period:disabled{opacity:.5}
@media(min-width:1401px){.start-experiment{top:19%}.metrics{top:94px}.data-handle{height:43px}}
@media(min-width:701px) and (max-width:1100px){.intro>span{font-size:15px}.intro p{font-size:12px;max-width:285px}.metrics>div{padding:0 8px;min-width:53px}.metrics span{font-size:10px}.metrics strong{font-size:18px}.start-experiment strong{font-size:21px}.factory-actions{gap:12px;padding:11px 12px}.factory-actions .control-dock{gap:11px}.factory-actions .segmented button{font-size:12px;padding:7px 9px}.factory-actions .buffer-info{max-width:94px}.factory-actions .playback-controls{padding-left:11px}.factory-actions .next-period{min-width:140px}.factory-actions .dock-hint{display:block;white-space:normal;max-width:96px}}
@media(max-width:700px){
 .page-header{padding:0 12px;gap:10px}.page-header .hall-link{font-size:12px;gap:5px}.hall-link>span{font-size:18px}.page-header .brand{font-size:14px}.page-header .icon-button{width:28px;height:32px}
 .intro{top:102px;left:4%}.intro>span{font-size:13px;gap:7px}.intro>span:before{width:7px;height:7px}.intro p{display:none}
 .data-handle{height:35px;font-size:10px;padding:0 12px}.metrics{top:140px}.metrics>div{padding:0 3px;min-width:0}.metrics span{font-size:10px}.metrics strong{font-size:18px}
 .start-experiment{top:242px;gap:12px}.start-experiment strong{font-size:18px}.start-experiment small{font-size:10px}.start-disc{width:40px;height:40px}
 .factory-actions{padding:10px;gap:9px;max-width:92%;width:max-content}.factory-actions .control-dock{flex-wrap:wrap;justify-content:space-between;gap:10px;width:100%}.factory-actions .control-dock label{font-size:11px;margin-bottom:6px}.factory-actions .segmented button{font-size:11px;padding:7px 8px;min-height:32px}.factory-actions .speed-controls{padding-left:10px}.factory-actions .buffer-info{display:block;order:4;max-width:none;width:auto;font-size:10px}.factory-actions .playback-controls{order:3;border:0;padding:0}.factory-actions .dock-hint{display:none}.factory-actions .next-period{min-height:44px;min-width:140px;font-size:13px}.factory-actions .next-period kbd{display:none}
 .factory-actions #formal-controls{max-width:100%}
}
@media(max-height:560px) and (min-width:701px){.start-experiment{top:155px}.intro p{font-size:11px}.factory-actions{padding:8px 10px}.factory-actions .next-period{min-height:44px}.factory-actions .control-dock label{margin-bottom:5px}}
@media(min-width:701px) and (max-width:1100px) and (min-height:561px){body:not(.lesson-visible) .metrics{top:110px}body:not(.lesson-visible) .start-experiment{top:205px}}
@media(pointer:coarse) and (max-width:700px){.factory-actions .segmented button{min-height:40px}#playback-options{min-height:32px}}
/* Resolution-independent blocks; each side retains its own aspect ratio. */
#asset-stage{background:radial-gradient(ellipse at 50% 22%,#f5f5f5,transparent 68%),#f7f7f7;overflow:hidden}
.factory-backdrop{position:absolute;inset:0;pointer-events:none;user-select:none}
.factory-backdrop::before,.factory-backdrop::after{content:"";position:absolute;top:33%;background-repeat:no-repeat;background-size:contain}
.factory-backdrop::before{left:0;width:12.56%;aspect-ratio:210/280;background-image:url('./perfect-factory-blocks-left.svg')}
.factory-backdrop::after{right:0;width:21.53%;aspect-ratio:360/280;background-image:url('./perfect-factory-blocks-right.svg')}
.factory-watermark{position:absolute;left:3.5%;right:auto;bottom:5%;font-family:Arial,Helvetica,sans-serif;font-size:clamp(32px,5.5vw,88px);font-weight:700;line-height:1;letter-spacing:-.045em;white-space:nowrap;opacity:.12;pointer-events:none;user-select:none}
.factory-watermark span:first-child{color:#b44029}
.factory-watermark span:last-child{color:#373b40}
@media(max-width:1100px){.factory-watermark{bottom:16%;font-size:clamp(32px,5.5vw,60px)}}
@media(max-width:700px){.factory-backdrop::before,.factory-backdrop::after{top:45%}.factory-watermark{left:5%;right:auto;bottom:210px;font-size:32px;opacity:.1}}
@media(max-height:560px){.factory-watermark{bottom:110px;font-size:30px;opacity:.1}}

/* Running progress is anchored to the five settled metrics, never the factory floor. */
.metrics .phase-indicator{position:absolute;top:calc(100% + 9px);bottom:auto;left:0;right:0;width:100%;transform:none;padding:12px 14px;background:#fffefcf5;border:1px solid #e5dfd9;border-radius:10px;box-shadow:0 4px 14px #3a2a1e05;text-align:left;pointer-events:none}
.phase-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;min-width:0}
.phase-heading b{font-size:12px;font-weight:600;color:var(--accent);white-space:nowrap}
.metrics .phase-heading span{font-size:11px;line-height:1.5;margin:0;color:#716b65;text-align:right}
.metrics .phase-indicator progress{display:block;appearance:none;width:100%;height:3px;border:0;border-radius:3px;overflow:hidden;margin:10px 0 0;background:#eee8e2;color:var(--accent)}
.metrics .phase-indicator progress::-webkit-progress-bar{background:#eee8e2;border-radius:3px}
.metrics .phase-indicator progress::-webkit-progress-value{background:var(--accent);border-radius:3px}
.metrics .phase-indicator progress::-moz-progress-bar{background:var(--accent);border-radius:3px}
.factory-running .start-experiment{visibility:hidden}
@media(max-width:700px){.metrics .phase-indicator{padding:10px 12px;top:calc(100% + 8px)}.phase-heading{gap:8px}.phase-heading b{font-size:11px}.metrics .phase-heading span{font-size:10px}}
@media(max-height:560px){.metrics .phase-indicator{padding:8px 10px;top:calc(100% + 6px)}}

/* Keep the opening title and explanation separate from the background brand. */
.intro{top:16.5vh;left:2.6vw}
.factory-intro-title{font-size:4.6vh;line-height:1;letter-spacing:-.04em;font-weight:800;color:var(--accent);margin:3.55vh 0 1.2vh}
.intro p{margin-top:0}
@media(max-width:700px){.intro{top:99px;left:4%;width:92%}.factory-intro-title{position:absolute;right:0;top:0;margin:0;font-size:22px}.intro p{display:block;position:absolute;top:207px;left:0;width:100%;max-width:none;text-align:center;font-size:10px;line-height:1.5}.factory-running .intro p{display:none}}
@media(max-height:560px) and (min-width:701px){.intro{top:110px}.factory-intro-title{font-size:25px;margin:12px 0 8px}}

@media(max-width:700px) and (max-height:740px){
 .intro p{top:27px;text-align:left;font-size:9px;line-height:1.4}
 body:not(.lesson-visible) .metrics{top:166px}
 body:not(.lesson-visible) .start-experiment{top:62%;gap:10px}
 .factory-watermark{bottom:3px;font-size:20px}
 .metrics .phase-indicator{top:calc(100% + 5px);padding:6px 10px}
 .metrics .phase-indicator progress{margin-top:5px}
}

/* Let the short introduction flow naturally rather than forcing a second line. */
#intro-copy{white-space:normal}
@media(min-width:1101px){.intro p{max-width:70vw;width:max-content}}
@media(min-width:701px) and (max-width:1100px){.intro p{max-width:33vw}.formal .intro p{max-width:75vw}}

/* Inset the heading into the space above the production line. */
@media(min-width:1101px){
 .intro{left:9vw;top:max(112px,12vh);width:76vw}
 .factory-intro-title{margin-top:2vh}
 .intro p{width:auto;max-width:38vw}
 .formal .intro p{max-width:76vw}
}
@media(min-width:701px) and (max-width:1100px){
 .intro{left:6vw;top:110px}
 .factory-intro-title{margin-top:18px}
 .intro p{max-width:32vw}
 .formal .intro p{max-width:84vw}
}

/* White data tab with a geometrically centered chevron, independent of font baselines. */
.data-handle{background:#fff;border-color:#e5e5e5;box-shadow:0 2px 4px #24242404,0 8px 22px #24242408,inset 0 1px 0 #fff;align-items:center;line-height:1}
.data-handle>svg{display:block;flex-shrink:0}
.data-handle .chevron{width:16px;height:16px;padding:0;margin-left:5px;align-self:center;color:var(--accent);stroke-width:1.8}

#selection{width:360px;min-width:0;max-width:calc(100vw - 32px);padding:20px 22px;background:#fff;border:1px solid #e4ded8;box-shadow:0 8px 28px #30251c0c;border-radius:12px}
#selection #order-id{font-size:17px;display:block;padding-right:20px}
#selection #order-summary{font-size:11px;line-height:1.6;letter-spacing:0;color:#77716c;margin:8px 0 16px}
.order-route-caption{font-size:11px;color:#77716c}
#selection #order-route{display:flex;align-items:center;gap:9px;letter-spacing:0;margin:9px 0 14px}
#order-route span{display:grid;place-items:center;width:34px;height:32px;border:1px solid #e3ded9;background:#f7f5f3;border-radius:6px;font-size:14px;color:#716b65}
#order-route span.finished{background:#eaf0e8;border-color:#d4dfcf;color:#52654b}
#order-route span.current{background:#f8e9e2;border-color:#ad3e26;color:#ad3e26}
#selection #order-status{display:block;font-size:12px;line-height:1.8;white-space:pre-line;background:#f7f5f2;padding:10px 12px;border-radius:7px;color:#4e4944}
#selection .order-explanation{font-size:10px;line-height:1.6;letter-spacing:0;color:#847c74;margin:12px 0 0}
@media(max-width:700px){#selection{top:225px;max-height:calc(100vh - 450px);min-height:180px;overflow:auto;padding:16px}}

@media(min-width:701px){#selection{left:auto;right:3.5%;transform:none}}

.experiment-objective,.experiment-takeaway{background:#f7f1eb;border-radius:8px;padding:12px 14px;color:#66564b!important}
#complete-results section{border-top:1px solid #e6ddd4;padding:12px 0}
#complete-results h3{font-size:15px;margin:0 0 7px;color:var(--accent)}
#complete-results section p{font-size:12px;line-height:1.8;margin:0}
#complete-dialog{width:min(620px,92vw)}

@media(max-width:700px) and (max-height:740px){body.lesson-visible .factory-actions{visibility:hidden}}
