/* Screen 6: the night workshop. The one exuberant moment of the app. */

.screen-full { width: 100%; min-height: 100dvh; }
.machinery {
  --night: #16242b; --night-2: #1d3038; --lamp: #f2c46d; --teal: #3f8f84; --teal-d: #2c6c63;
  --sand: #d9b77a; --sand-d: #b8955a; --slate: #8196aa; --slate-d: #61768a; --paperc: #f4f1e8; --inkc: #0f1b20;
  background: radial-gradient(120% 70% at 50% 0%, var(--night-2), var(--night) 70%);
  color: #e9f0ee; display: flex; flex-direction: column; align-items: center;
  padding: max(var(--sp-4), env(safe-area-inset-top)) var(--sp-4) max(var(--sp-5), env(safe-area-inset-bottom));
}
.mach-head { width: 100%; max-width: 30rem; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.mach-head h1 { font-size: var(--fs-2); color: #f4f1e8; }
.mach-pause { background: transparent; border-color: rgb(255 255 255 / 0.25); color: #e9f0ee; }
.mach-pause .i-play { display: none; }
.mach-pause.is-paused .i-play { display: block; }
.mach-pause.is-paused .i-pause { display: none; }
.machinery :focus-visible { box-shadow: 0 0 0 3px var(--night), 0 0 0 5px var(--lamp); }

.scene { width: 100%; max-width: 30rem; flex: 1; display: grid; place-items: center; min-height: 0; }
.scene-svg { width: 100%; max-height: 66dvh; overflow: visible; }

.mach-foot { width: 100%; max-width: 30rem; display: grid; gap: var(--sp-3); text-align: center; }
.mach-status { font-family: var(--lk-font-display); font-size: var(--fs-1); color: #f4f1e8; min-height: 1.6em; }
.mach-note { color: #b9c9c5; }
.machinery .btn-primary { background: var(--lamp); color: var(--inkc); }
.machinery .btn-primary:hover { background: #f6d48e; }
.machinery .msg { background: rgb(242 196 109 / 0.14); color: #f6dca6; }
.phase-list { list-style: none; padding: 0; margin: 0 auto; display: grid; gap: var(--sp-2); text-align: left; color: #8fa4a0; }
.phase-list li { padding-left: 1.4rem; position: relative; }
.phase-list li::before { content: ""; position: absolute; left: 0; top: 0.45em; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid currentColor; }
.phase-list li.is-active { color: #f4f1e8; }
.phase-list li.is-done { color: #cfe0dc; }
.phase-list li.is-done::before { background: var(--teal); border-color: var(--teal); }

/* ---------- scene art ---------- */
.scene .wire { stroke: #405560; stroke-width: 1.5; }
.scene .lamp { fill: #2b4450; }
.scene .bulb { fill: #6d6250; transition: fill 600ms; }
.scene .lamp-cone { opacity: 0; transition: opacity 1200ms ease; }
.scene.lights-on .lamp-cone { opacity: 1; animation: lamp-breathe 5s ease-in-out 1.2s infinite; }
.scene.lights-on .bulb { fill: var(--lamp); }
@keyframes lamp-breathe { 50% { opacity: 0.82; } }
.scene .shelf line, .scene .floor { stroke: #2f4650; stroke-width: 2; stroke-linecap: round; }
.scene .book.b1 { fill: #3f8f84; } .scene .book.b2 { fill: #c98f4a; } .scene .book.b3 { fill: #6f86a0; } .scene .book.b4 { fill: #d9b77a; }

.scene .board-face { fill: var(--paperc); }
.scene .board-band { fill: #dcede7; }
.scene .board-line { fill: none; stroke: var(--teal-d); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.scene .board-pt { fill: var(--teal-d); }
.scene .board-pt.is-last { fill: var(--lamp); stroke: var(--teal-d); stroke-width: 1.5; }
.scene .board-bar { fill: #c8d6d2; } .scene .board-bar.b2 { fill: #e3cfa6; }
.scene .easel { stroke: #6a5a45; stroke-width: 4; stroke-linecap: round; }
.scene .scanline { fill: #7fd3c4; opacity: 0; }
.scene.scanning .scanline { animation: scan 2.6s ease-in-out infinite alternate; }
@keyframes scan { 0% { opacity: 0.9; transform: translateY(0); } 100% { opacity: 0.9; transform: translateY(96px); } }
.scene .beam { opacity: 0; }
.scene.scanning .beam { animation: beam 2.6s ease-in-out infinite alternate; transform-box: view-box; transform-origin: 270px 108px; }
@keyframes beam { 0% { opacity: 0.55; transform: rotate(-4deg); } 100% { opacity: 0.55; transform: rotate(22deg); } }

.scene .r-head.teal, .scene .r-body.teal { fill: var(--teal); }
.scene .r-head.sand, .scene .r-body.sand { fill: var(--sand); }
.scene .r-head.slate, .scene .r-body.slate { fill: var(--slate); }
.scene .r-visor { fill: var(--inkc); }
.scene .r-eye { fill: #7fe0cf; }
.scene .robot-sort .r-eye { fill: var(--inkc); }
.scene .r-lens { fill: var(--inkc); stroke: #c9d6de; stroke-width: 2; }
.scene .r-pupil { fill: #7fe0cf; }
.scene .r-mouth { fill: var(--inkc); opacity: 0.6; transform-box: fill-box; transform-origin: center; }
.scene .robot-read .r-mouth { fill: #7fe0cf; }
.scene .r-stroke { stroke: #c9d6de; stroke-width: 2; stroke-linecap: round; }
.scene .r-light { fill: #9fb4bf; }
.scene .r-light.warm { fill: var(--lamp); }
.scene .r-light.blink { animation: blink-light 1.4s steps(2) infinite; }
@keyframes blink-light { 50% { fill: var(--lamp); } }
.scene .r-panel { fill: rgb(15 27 32 / 0.35); }
.scene .r-dot { fill: var(--lamp); }
.scene .r-arm { fill: none; stroke: #c9d6de; stroke-width: 5; stroke-linecap: round; }
.scene .r-foot, .scene .r-neck { fill: #2b4450; }
.scene .r-wheel { fill: #2b4450; stroke: #c9d6de; stroke-width: 2; }
.scene .r-hub { fill: #c9d6de; }
.scene .robot-scan .r-wheel, .scene .robot-scan .r-hub { transform-box: fill-box; transform-origin: center; }

.scene .bob { animation: bob 3.2s ease-in-out infinite; }
.scene .robot-sort .bob { animation-duration: 2.7s; animation-delay: -1s; }
.scene .robot-scan .bob { animation-duration: 3.8s; animation-delay: -2s; }
@keyframes bob { 50% { transform: translateY(-2.5px); } }
.scene .eyes { transform-box: fill-box; transform-origin: center; animation: blink 5.5s infinite; }
.scene .robot-sort .eyes { animation-delay: -2.3s; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(0.1); } }
.scene .is-talking .r-mouth { animation: talk 0.28s ease-in-out infinite alternate; }
@keyframes talk { to { transform: scaleY(2.6); } }

.scene .page { fill: var(--paperc); stroke: #d8d2c0; stroke-width: 1; }
.scene .page-lines { stroke: #b9b2a0; stroke-width: 1.2; stroke-linecap: round; }
.scene .page-flip { transform-box: fill-box; transform-origin: left center; opacity: 0; }
.scene.reading .page-flip { animation: flip 2.2s ease-in-out infinite; }
@keyframes flip { 0% { transform: scaleX(1); opacity: 1; } 50% { transform: scaleX(-1); opacity: 1; } 51%, 100% { opacity: 0; transform: scaleX(-1); } }

.scene .tray { fill: #2b4450; stroke: #4c6672; stroke-width: 1.5; }
.scene .acard { stroke: rgb(15 27 32 / 0.25); stroke-width: 1; }
.scene .acard.c1 { fill: #f4f1e8; } .scene .acard.c2 { fill: #f2c46d; } .scene .acard.c3 { fill: #9fd6cb; }
.scene .acard.fly { transform-box: fill-box; transform-origin: center; }

.scene .belt { fill: #22343c; stroke: #3b5560; stroke-width: 1.5; }
.scene .belt-top { stroke: #5c7884; stroke-width: 2; stroke-dasharray: 6 8; }
.scene.belt-on .belt-top { animation: belt 0.9s linear infinite; }
@keyframes belt { to { stroke-dashoffset: -14; } }
.scene .roller circle { fill: #2b4450; stroke: #5c7884; stroke-width: 1.5; }
.scene .roller path { stroke: #5c7884; stroke-width: 1.5; }
.scene .roller { transform-box: fill-box; transform-origin: center; }
.scene.belt-on .roller { animation: roll 1.2s linear infinite; }
@keyframes roll { to { rotate: 360deg; } }
.scene .leg { fill: #22343c; }
.scene .paper { fill: var(--paperc); stroke: #c9c2ad; stroke-width: 1; opacity: 0; }
.scene.belt-on .paper-l { animation: ride-l 6s linear infinite; }
.scene.belt-on .paper-r { animation: ride-r 6s linear infinite; }
.scene .paper.d1 { animation-delay: -1.5s !important; } .scene .paper.d2 { animation-delay: -3s !important; } .scene .paper.d3 { animation-delay: -4.5s !important; }
@keyframes ride-l { 0% { opacity: 0; transform: translateX(0); } 8% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; transform: translateX(146px) scale(0.6); } }
@keyframes ride-r { 0% { opacity: 0; transform: translateX(0); } 8% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; transform: translateX(-146px) scale(0.6); } }

.scene .compass * { transform-box: fill-box; transform-origin: center; }
.scene .c-base { fill: #22343c; stroke: #4c6672; stroke-width: 2; opacity: 0; }
.scene .c-ring { fill: none; stroke: var(--lamp); stroke-width: 3; stroke-dasharray: 100; stroke-dashoffset: 100; opacity: 0; }
.scene .c-ticks line { stroke: #cfe0dc; stroke-width: 1.6; stroke-linecap: round; }
.scene .c-ticks { opacity: 0; }
.scene .c-rose { fill: #cfe0dc; opacity: 0; }
.scene .c-needle { opacity: 0; }
.scene .c-needle-n { fill: var(--lamp); }
.scene .c-needle-s { fill: #7f93a8; }
.scene .c-pin { fill: #f4f1e8; }
.scene.finale .compass { filter: drop-shadow(0 0 14px rgb(242 196 109 / 0.45)); transition: filter 1.2s; }

.scene .bubble-box { fill: #f4f1e8; }
.scene .bubble-tail { fill: #f4f1e8; }
.scene .bubble-text { font-family: var(--lk-font-body); font-size: 12.5px; font-weight: 600; fill: var(--inkc); }

.scene.is-paused *, .scene.is-paused *::before { animation-play-state: paused !important; }
.scene.is-failed { filter: grayscale(0.6) brightness(0.8); transition: filter 600ms; }

/* Reduced motion: lights on, compass complete, nothing moves. */
.scene.is-still .lamp-cone, .scene.is-still .c-base, .scene.is-still .c-ticks, .scene.is-still .c-rose, .scene.is-still .c-needle { opacity: 1; }
.scene.is-still .c-ring { opacity: 1; stroke-dashoffset: 0; }
.scene.is-still .bulb { fill: var(--lamp); }
.scene.is-still .page-flip, .scene.is-still .paper, .scene.is-still .scanline, .scene.is-still .beam, .scene.is-still .bubble { display: none; }
