/* CINÉ training game - dependency-free pixel-inspired interface. */
:root{color-scheme:dark;font-family:system-ui,-apple-system,"Segoe UI",sans-serif;--bg:#12323a;--ink:#f7f6e9;--mint:#b9e6c3;--amber:#f2d49b;--warn:#cf805f;--safe:#2f886a}
*,*::before,*::after{box-sizing:border-box}
html,body{margin:0;width:100%;height:100%;overflow:hidden;background:var(--bg)}
button,input,textarea{font:inherit}
button{cursor:pointer}
button:disabled{cursor:default}
button:focus-visible,textarea:focus-visible{outline:3px solid #ffeba0;outline-offset:3px}
[hidden]{display:none!important}
#game{position:relative;width:100%;height:100dvh;overflow:hidden;background:#7ea39d;color:#173e3f;isolation:isolate}
#view{position:absolute;inset:0;overflow:hidden;background:#8eb1a5;touch-action:none}
#world{position:absolute;top:0;left:0;width:2400px;height:1300px;will-change:transform;background:
repeating-linear-gradient(90deg,#f7ffed12 0 3px,transparent 3px 120px),
linear-gradient(180deg,#b7d3c5 0 42%,#6f9b93 42% 44%,#bfc9ae 44% 100%)}
#world[data-place=office]{background:linear-gradient(180deg,#c1d5c9 0 41%,#6c9895 41% 44%,#cfc9aa 44%)}
#world[data-place=dock]{background:linear-gradient(180deg,#9fc4c2 0 41%,#587c7d 41% 45%,#bbbfa7 45%)}
#world[data-place=meeting]{background:linear-gradient(180deg,#cadcd1 0 41%,#779c91 41% 44%,#d1c9b0 44%)}
#world[data-place=video]{background:radial-gradient(circle at 50% 36%,#397974,#0d303c 85%)}
#world[data-place=end]{background:radial-gradient(circle at 50% 35%,#78ad88 0,#18494a 60%,#123039 100%)}
.floor{position:absolute;left:0;right:0;top:43%;bottom:0;opacity:.43;pointer-events:none;background:repeating-linear-gradient(90deg,transparent 0 147px,#648e844a 147px 150px),repeating-linear-gradient(0deg,transparent 0 116px,#648e8450 116px 119px)}
.wall{position:absolute;left:70px;top:100px;width:2250px;height:430px;border:30px solid #739d91;border-bottom-width:15px;background:transparent;border-radius:18px;box-shadow:inset 0 0 0 8px #c3d6cc}
.window{position:absolute;top:175px;width:270px;height:235px;border:20px solid #648b8a;background:linear-gradient(145deg,#9bc5c4,#eff1df);box-shadow:inset 10px 10px #efffff88;border-radius:10px}
.window.one{left:280px}.window.two{left:1400px}
.desk{position:absolute;left:850px;top:640px;width:630px;height:220px;background:#aa815f;border:20px solid #805d4a;border-radius:14px;box-shadow:0 36px 0 #755b4e}
.monitor{position:absolute;left:1020px;top:548px;width:175px;height:120px;background:#416f75;border:15px solid #305b63;box-shadow:0 20px #365865;border-radius:7px}
.rack{position:absolute;left:155px;top:490px;width:450px;height:560px;border:25px solid #62827c;background:repeating-linear-gradient(0deg,#c39b6e 0 80px,#edcb8b 80px 102px,#678882 102px 154px);border-radius:9px;transform:skewY(-2deg)}
.machine{position:absolute;left:1570px;top:500px;width:430px;height:420px;border:25px solid #557b7b;border-radius:20px;background:linear-gradient(125deg,#a3c4b7,#669ba0);box-shadow:inset -40px 0 #4d797c,0 35px #547470}
.machine::before{content:"";position:absolute;left:40px;top:80px;width:130px;height:100px;border:13px solid #427874;background:#e4ecbc;border-radius:9px}
.machine.stopped::before{background:#f2a986;animation:machine-alert 1.5s infinite}
.conveyor{position:absolute;top:960px;left:900px;width:960px;height:90px;background:repeating-linear-gradient(90deg,#4b7374 0 95px,#719597 95px 110px);border:17px solid #506f73;border-radius:12px;transform:skewX(-6deg)}
.crate{position:absolute;width:112px;height:110px;background:#d9b482;border:14px solid #b18c64;box-shadow:inset 0 0 0 3px #edcc9c;border-radius:3px}
.crate.one{left:960px;top:830px}.crate.two{left:1120px;top:835px}.crate.three{left:1280px;top:820px}
.crate.moving{animation:convey 8s linear infinite alternate}
.truck{position:absolute;width:470px;height:220px;left:1540px;top:770px;background:#e0bd81;border:20px solid #ae8553;border-radius:10px;box-shadow:0 17px 0 #5f8f8e}
.truck::before{content:"";position:absolute;left:-155px;top:33px;width:140px;height:175px;border:19px solid #53839b;border-radius:16px 0 0 6px;background:#89b1bd}
.truck::after{content:"";position:absolute;bottom:-46px;right:90px;border-radius:50%;width:75px;height:75px;background:#284854;box-shadow:-310px 0 #284854}
.truck.extra{left:2080px;top:775px;animation:arrive 4.5s ease-out both}
.truck.queue{left:2240px;top:1020px;transform:scale(.65);opacity:.88}
#world[data-reaction=poor] .truck.queue{animation:congest 1s ease-in-out infinite alternate}
#world[data-reaction=better] .truck.queue{animation:depart 4s ease-in-out forwards}
#world[data-reaction=poor] .machine{box-shadow:inset -40px 0 #4d797c,0 35px #547470,0 0 30px 12px #cb7e676c}
.sign{position:absolute;left:600px;top:210px;border:10px solid #7ba499;border-radius:14px;background:#f0f1dc;color:#33695d;padding:25px 70px;font-size:38px;font-weight:900;letter-spacing:.12em}
.notice{position:absolute;left:1390px;top:245px;width:95px;height:95px;display:grid;place-items:center;border-radius:50%;background:#c0714a;border:8px solid #f0dcc4;color:white;font-size:65px;font-weight:900;animation:alarm 1.5s ease-in-out infinite}
.actor{--shirt:#2a7887;position:absolute;left:0;top:0;width:68px;height:106px;transform:translate(-50%,-82%);z-index:6;filter:drop-shadow(3px 6px 2px #143b3b6b);pointer-events:none}
.actor.sam{--shirt:#c27d5e}
.actor.worker{--shirt:#b6854e}
.actor.boss{--shirt:#526a93}
.actor .hair{position:absolute;left:15px;top:0;width:41px;height:43px;border-radius:12px 12px 7px 7px;background:#2a4149}
.actor.sam .hair{left:10px;width:49px;height:63px;background:#513d36}
.actor .face{position:absolute;left:19px;top:12px;width:31px;height:34px;background:#b57c5d;border-radius:11px;box-shadow:inset 0 -4px #9c664f}
.actor .face::after{content:"· ·";font-size:17px;position:absolute;left:6px;top:1px;color:#263f42}
.actor .torso{position:absolute;left:10px;top:45px;width:49px;height:43px;background:var(--shirt);border-radius:8px;box-shadow:inset -11px 0 #0002}
.actor .arm{position:absolute;top:50px;width:10px;height:40px;background:#b57c5d;border-radius:4px}
.actor .arm.left{left:0}.actor .arm.right{right:0}
.actor .leg{position:absolute;top:86px;width:14px;height:22px;background:#29424a;border-radius:3px}
.actor .leg.left{left:12px}.actor .leg.right{right:12px}
.actor.walking .leg.left{animation:walk-left .23s steps(2,end) infinite alternate}
.actor.walking .leg.right{animation:walk-right .23s steps(2,end) infinite alternate}
.actor.walking .arm.left{animation:walk-right .23s steps(2,end) infinite alternate}
.actor.walking .arm.right{animation:walk-left .23s steps(2,end) infinite alternate}
.actor[data-facing=up] .face{background:#253d43;box-shadow:inset 0 -6px #354c51}
.actor[data-facing=up] .face::after{display:none}
.actor[data-facing=up] .hair{height:44px;left:13px;width:44px}
.actor[data-facing=right] .face{border-radius:8px 13px 13px 8px;transform:translateX(6px)}
.actor[data-facing=left] .face{border-radius:13px 8px 8px 13px;transform:translateX(-5px)}
.actor[data-facing=right] .face::after,.actor[data-facing=left] .face::after{content:"·"}
.actor.worker.carrier .crate-tiny{position:absolute;width:43px;height:32px;background:#d9b482;border:6px solid #a47f52;left:-18px;top:45px;transform:rotate(-10deg);animation:carry 1s ease-in-out infinite alternate}
.actor.worker.rest .torso{background:#6d9994}
.actor.worker.rest{opacity:.88;transform:translate(-50%,-82%) rotate(9deg)}
#hud{position:absolute;left:clamp(8px,1.8vw,25px);top:clamp(8px,1.8vw,25px);z-index:19;display:flex;flex-direction:column;gap:7px}
#tokens{display:flex;gap:6px}
.token{width:43px;height:43px;border:2px solid #aec4b9;background:#244e56b8;color:#f4e2ad;border-radius:50%;font-size:19px;font-weight:900;display:grid;place-items:center;opacity:.72}
.token:disabled{opacity:.45;color:transparent}
.token.earned{opacity:1;background:#e8c98d;color:#2d4a4c;border-color:#ffeed2;animation:pop .5s ease-out}
.token.earned:hover{background:#f2dcaf}
#tools{display:flex;gap:6px}
.tool{width:41px;height:41px;display:grid;place-items:center;border:1px solid #b8d3c2;background:#224f58ed;color:#fff9e5;font-size:20px;border-radius:11px}
.tool[aria-pressed=true]{background:#408b75;box-shadow:inset 0 0 0 2px #bbebc8}
.tool:hover{background:#397a7d}
#tokenInfo{position:absolute;z-index:28;top:115px;left:clamp(8px,1.8vw,25px);max-width:min(350px,calc(100vw - 20px));background:#f8f5e8;color:#214b4d;border:2px solid #82b4a5;border-radius:13px;padding:14px 18px;box-shadow:0 12px 30px #1430375c}
#tokenInfo strong{display:block;margin-bottom:5px}
#tokenInfo p{margin:0;font-size:13px;line-height:1.45}
#dialogue{position:absolute;z-index:15;width:min(405px,calc(100vw - 24px));max-height:min(56dvh,510px);overflow:auto;background:#faf9edef;color:#213f40;border:2.5px solid #a3cbb4;border-radius:15px;box-shadow:0 16px 45px #0b2a3680;padding:clamp(11px,1.7vw,18px);scrollbar-width:thin}
#dialogue::before{content:"";position:absolute;left:-2px;top:24px;width:13px;height:13px;border-left:2px solid #a3cbb4;border-bottom:2px solid #a3cbb4;background:#faf9ed;transform:translate(-58%,-50%) rotate(45deg)}
#dialogue[data-tone=good]{border-color:#6fb494}
#dialogue[data-tone=warn]{border-color:#d4a36e}
#dialogue[data-tone=bad]{border-color:#ca8275}
#dialogue p{font-size:clamp(13px,1.15vw,15px);line-height:1.4;margin:0 0 10px}
#dialogue h1{font-size:clamp(17px,1.55vw,21px);line-height:1.15;margin:0 0 9px}
#dialogue .actions{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end;margin-top:9px}
.primary,.secondary{border:0;border-radius:9px;font-size:13px;font-weight:800;padding:10px 13px;min-height:40px;max-width:100%;line-height:1.25}
.primary{background:#1b7567;color:#fff}
.primary:hover{background:#11574f}
.secondary{background:#e7ebe5;color:#2a5351;border:1px solid #9db9ac}
.secondary:hover{background:#dce7dc}
.choice{display:block;width:100%;border:1px solid #9db8a8;background:#fffef7;color:#254648;font-size:13px;font-weight:675;text-align:left;padding:10px 12px;line-height:1.32;border-radius:9px;margin:6px 0}
.choice:hover{background:#e9f3e8}
.choice[aria-pressed=true]{background:#d8e9e2;border-color:#397e71}
.choice.good{background:#e0f3e6;border-color:#59a17d}
.choice.warn{background:#fff0d9;border-color:#d5a566}
.choice.bad{background:#f9e0d7;border-color:#c67b69}
.choice[disabled]{opacity:.78}
.feedback{padding:9px 11px;border-left:4px solid #c99762;background:#fff0d8;border-radius:7px;color:#3c5149;font-size:13px;line-height:1.4;margin:8px 0}
.feedback.good{background:#e0f0e4;border-color:#3b9b72}
.feedback.bad{background:#fae6de;border-color:#c87d65}
#choices{max-width:100%}
.letterChoices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;margin:8px 0}
.letterChoices button{border:2px solid #aac6b7;border-radius:10px;background:#fffef4;color:#254d4b;display:flex;align-items:center;gap:8px;padding:9px 8px;text-align:left;font-size:12px;min-height:47px;font-weight:690}
.letterChoices button strong{font-size:21px}
.letterChoices button[aria-pressed=true]{border-color:#2b8879;background:#d9ebde}
.order-item{display:flex;align-items:center;justify-content:space-between;gap:8px;background:#eef2e7;border:1px solid #a5beb3;border-radius:8px;margin:5px 0;padding:7px}
.order-item strong{font-size:13px;line-height:1.28}
.order-item button{width:34px;height:34px;border:1px solid #9bb9ac;background:white;color:#315956;border-radius:8px;font-size:19px}
.order-item button:disabled{opacity:.27}
.avatar-choice{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:8px 0}
.avatar-choice button{padding:12px 8px;border:2px solid #a2c7b5;background:#f2f4e7;color:#2c554f;border-radius:10px;font-weight:850}
.avatar-choice button[aria-pressed=true]{background:#d9efdd;border-color:#30846f}
#interact{position:absolute;left:51%;top:34%;z-index:16;border:2px solid #ffedba;background:#1d6170;color:#fff9e8;padding:9px 14px;border-radius:30px;font-weight:850;box-shadow:0 0 0 6px #244a5060;animation:float 1.9s infinite}
#dpad{position:absolute;right:clamp(9px,2vw,23px);bottom:clamp(9px,2vw,23px);display:grid;grid-template-columns:repeat(3,42px);grid-template-rows:repeat(2,42px);gap:5px;z-index:18;touch-action:none}
#dpad button{border:1px solid #aac7bc;background:#215a67d8;color:white;font-size:23px;font-weight:900;border-radius:10px;touch-action:none;user-select:none}
#dpad button.pressed{background:#6ca797;color:#133e45}
#dpad [data-dir=up]{grid-column:2;grid-row:1}
#dpad [data-dir=left]{grid-column:1;grid-row:2}
#dpad [data-dir=down]{grid-column:2;grid-row:2}
#dpad [data-dir=right]{grid-column:3;grid-row:2}
#videolayer{position:absolute;inset:0;z-index:20;background:radial-gradient(circle at 50% 45%,#376e70,#0d303a 85%);display:grid;place-items:center;padding:clamp(12px,2vw,30px)}
.video-card{width:min(900px,100%);display:grid;gap:12px;color:#f5f5e5}
.video-actions{display:flex;align-items:center;justify-content:center;gap:10px;flex-wrap:wrap}
.video-actions button,.video-continue{border:1px solid #a8c9bd;background:#1d5660;color:#fff9e9;padding:10px 16px;border-radius:9px;font-weight:750}
.video-actions button:hover,.video-continue:hover{background:#2b7372}
.video-time{color:#d5e8e0;font-size:14px;font-weight:700;font-variant-numeric:tabular-nums;white-space:nowrap;min-width:98px;text-align:center}
.video-status{text-align:center;color:#f5eed9;margin:0;font-size:14px}
.video-continue{justify-self:end;background:#1a745d;min-height:42px}
#overlay{position:absolute;inset:0;z-index:50;background:#071c24b8;display:grid;place-items:center;padding:15px}
.panel{width:min(455px,100%);max-height:80dvh;overflow:auto;background:#f8f6e9;color:#264e4d;border:2px solid #a8d5bc;border-radius:15px;padding:clamp(16px,2vw,24px);box-shadow:0 15px 65px #0007}
.panel h2{margin:0 0 11px;font-size:23px}
.panel p{font-size:14px;line-height:1.5;margin:8px 0}
.panel button{margin-top:10px}
#celebrate{pointer-events:none;position:absolute;inset:0;z-index:8;overflow:hidden;background:transparent}

/* In-game HUD remains accessible during the video; no external pause icon. */
#hud{z-index:29}
#videoPlayer{width:100%;max-height:64dvh;aspect-ratio:16/9;border-radius:12px;background:#071e24;object-fit:contain}
.video-link{display:inline-flex;align-items:center;border:1px solid #9bbaae;border-radius:9px;color:#f8efda;text-decoration:none;padding:8px 11px;font-size:12px;font-weight:750;background:#244f59}
.video-link:hover,.video-link:focus-visible{background:#347278}
#dialogue{max-width:405px;max-height:min(47dvh,410px)}
#dialogue::before{display:none}
#dialogue[data-speaker="npc"]{border-color:#8ab4ac}
#dialogue[data-speaker="player"]{border-color:#a6cfb6}
#dialogue .player-line{font-weight:700;color:#225c56;border-left:3px solid #8bb6a0;padding-left:9px}
#dialogue .chat-turn{margin:0 0 9px;padding:8px 10px;border-radius:10px;background:#ecf2e7;border:1px solid #c4d7c8}
#dialogue .chat-turn.from-player{background:#e2f2e7;border-color:#91bdaa}
#dialogue .chat-turn.from-npc{background:#edf0e9;border-color:#bbd2c6}
#dialogue .chat-speaker{display:block;font-size:11px;letter-spacing:.01em;color:#3e786a;font-weight:850;margin-bottom:3px}
#dialogue .chat-message{margin:0!important;font-size:13px;line-height:1.43}
#dialogue .chat-turn.from-player .chat-speaker{color:#1d675d}
#dialogue .chat-turn.from-npc .chat-speaker{color:#4a655e}
.actor.driver{--shirt:#e3d96b}
.actor.driver .torso{background:#d8d26f!important;border:3px solid #a9a846}
.actor.driver .torso::after{content:"";position:absolute;inset:1px;background:linear-gradient(49deg,transparent 0 42%,#f7f0cc 43% 50%,#7b8c6d 51% 54%,transparent 55%),linear-gradient(-49deg,transparent 0 42%,#f7f0cc 43% 50%,#7b8c6d 51% 54%,transparent 55%);opacity:.95}
.actor.driver::after{content:"";position:absolute;left:23px;top:-11px;width:22px;height:10px;background:#e0c663;border-radius:5px 5px 1px 1px}
.truck{background:repeating-linear-gradient(0deg,#dabb84 0 13px,#debF8f 13px 22px);border-color:#947659;box-shadow:0 17px 0 #5f8f8e,0 0 0 3px #dfd0a8}
.truck::before{background:linear-gradient(145deg,#90bbc4 0 44%,#355c68 45% 58%,#7aabad 59% 100%);box-shadow:inset 14px 0 #d6c59c}
.truck-label{position:absolute;left:20%;top:28%;background:#f5edd5;color:#46605a;font-size:28px;letter-spacing:.09em;font-weight:900;border:5px solid #8e9980;padding:7px 12px;border-radius:4px}
.truck.extra .truck-label{background:#f5d5a8;color:#6c5233}
.machine{border-color:#507c7a;background:linear-gradient(125deg,#acd2c1,#689b99);box-shadow:inset -40px 0 #4d797c,0 35px #547470}
.machine::after{content:"⚙";position:absolute;right:26px;top:56px;width:104px;height:110px;font-size:94px;line-height:1;color:#375f63;text-shadow:2px 3px #d2dcb9;animation:gear 4.5s linear infinite}
.machine-label{position:absolute;left:28px;bottom:34px;border:6px solid #638a7e;background:#e5eddb;color:#315d58;font-size:30px;font-weight:900;letter-spacing:.06em;padding:8px 18px;border-radius:8px}
.machine.stopped::after{animation:none;color:#aa625a}
.machine.stopped .machine-label{background:#c86e59;color:#fff1e6;border-color:#99574e;animation:alarm 1.1s ease-in-out infinite}
.conveyor{background:repeating-linear-gradient(90deg,#446c70 0 68px,#7fa1a1 68px 82px,#456d72 82px 111px);background-size:111px 90px;animation:belt 1.6s linear infinite;box-shadow:0 15px 0 #54777a}
#world[data-place="boss"] .conveyor{animation:belt 1.6s linear infinite}
.crate.moving{animation:carry-belt 6s linear infinite}
.crate.two.moving{animation:carry-belt 6s linear infinite -3s}
.crate.disrupted{animation:spillage 2s ease-in-out infinite alternate}
.crate.two.disrupted{animation-delay:-1s}
#world[data-place="boss"] .notice{box-shadow:0 0 0 12px #bf715260}
@keyframes gear{to{transform:rotate(360deg)}}
@keyframes belt{to{background-position:111px 0}}
@keyframes carry-belt{0%{transform:translateX(-210px)}95%{transform:translateX(500px)}100%{transform:translateX(-210px)}}
@keyframes spillage{0%{transform:translate(0,0) rotate(-9deg)}55%{transform:translate(60px,65px) rotate(22deg)}100%{transform:translate(155px,145px) rotate(46deg)}}
/* Dialogue grows upward from a frozen bottom anchor near the character.
   Buttons stay at the bottom; only previous turns/choices can scroll. */
#dialogue{
 display:flex;
 flex-direction:column;
 height:max-content;
 overflow:hidden;
 overscroll-behavior:contain;
}
#speechContent{
 display:flex;
 flex-direction:column;
 width:100%;
 min-height:0;
 max-height:inherit;
}
#speechText{
 display:flex;
 flex-direction:column;
 min-height:0;
 overflow-y:auto;
 overscroll-behavior:contain;
 scrollbar-width:thin;
 flex:0 1 auto;
}
#speechText>*{flex:0 0 auto}
#speechText>.chat-turn:first-child{
 position:sticky;
 top:0;
 z-index:1;
}
#choices{
 flex:0 1 auto;
 min-height:0;
 max-height:min(34dvh,260px);
 overflow-y:auto;
 overscroll-behavior:contain;
 scrollbar-width:thin;
}
#feedback{
 flex:0 0 auto;
 max-height:min(15dvh,100px);
 overflow-y:auto;
}
#dialogue #actions{
 display:flex;
 flex-direction:row-reverse;
 flex-wrap:wrap;
 justify-content:flex-start;
 flex:0 0 auto;
 min-height:40px;
 gap:6px;
 margin-top:8px;
}
#dialogue #actions>.primary{min-width:113px}
@media(max-width:680px){
 #speechContent{max-height:100%}
 #choices{max-height:min(26dvh,210px)}
 #dialogue #actions{min-height:36px;margin-top:6px}
 #speechText>.chat-turn:first-child{top:0}
 .video-link{font-size:11px;padding:6px}
 #dialogue{max-height:min(38dvh,350px)}
 .video-actions{flex-wrap:wrap}

 #hud{top:8px;left:8px}
 .token{width:35px;height:35px;font-size:17px}
 .tool{width:36px;height:36px;font-size:18px}
 #dialogue{width:min(365px,calc(100vw - 18px));max-height:53dvh;padding:10px;border-radius:12px}
 #dialogue h1{font-size:17px}
 #dialogue p{font-size:13px;margin-bottom:7px}
 .choice{font-size:12px;padding:8px;min-height:38px}
 .order-item strong{font-size:12px}
 .primary,.secondary{font-size:12px;padding:8px 10px;min-height:36px}
 #interact{top:28%;left:45%;font-size:13px}
 #dpad{right:8px;bottom:9px;grid-template-columns:repeat(3,35px);grid-template-rows:repeat(2,35px);gap:4px}
 #dpad button{font-size:19px}
 .video-card{gap:7px}
}
@media(max-height:610px){#dialogue{max-height:66dvh}#dpad{transform:scale(.8);transform-origin:bottom right}}
/* The old blanket reduced-motion rule disabled every scene animation,
   including the game's conveyor and celebration. Respect an explicit
   learner pause instead; the default game experience keeps motion on. */
:root[data-cine-motion="off"] *,
:root[data-cine-motion="off"] *::before,
:root[data-cine-motion="off"] *::after{
 animation:none!important;transition:none!important;
}
@media(prefers-reduced-motion:reduce){
 :root:not([data-cine-motion="on"]) *,
 :root:not([data-cine-motion="on"]) *::before,
 :root:not([data-cine-motion="on"]) *::after{
  animation:none!important;transition:none!important;
 }
}
@keyframes walk-left{to{transform:translateY(-7px) translateX(-3px)}}@keyframes walk-right{to{transform:translateY(0) translateX(3px)}}
@keyframes machine-alert{50%{background:#edf0bd}}@keyframes float{50%{transform:translateY(-7px)}}@keyframes arrive{from{transform:translateX(600px)}to{transform:translateX(0)}}@keyframes alarm{50%{opacity:.4}}@keyframes carry{to{transform:rotate(9deg) translateY(-5px)}}@keyframes pop{50%{transform:scale(1.3)}}@keyframes convey{to{transform:translateX(360px)}}@keyframes congest{to{transform:translateX(-25px)}}@keyframes depart{to{transform:translateX(320px);opacity:.2}}@keyframes confetti{to{background-position:0 600px,0 670px}}

/* Touch controls: accessible hit areas without scaling the game itself. */
#dpad{grid-template-columns:repeat(3,53px);grid-template-rows:repeat(2,53px);gap:7px}
#dpad button{min-width:53px;min-height:53px;font-size:28px}
#dialogue .chat-turn.typing .chat-message::after{content:"▍";color:#247d6c;animation:cursor-blink .6s steps(2,end) infinite}
@keyframes cursor-blink{50%{opacity:0}}
@media(max-width:680px){
 #dpad{right:12px;bottom:max(10px,env(safe-area-inset-bottom));grid-template-columns:repeat(3,51px);grid-template-rows:repeat(2,51px);gap:6px}
 #dpad button{min-width:51px;min-height:51px;font-size:27px}
}
@media(max-width:360px){
 #dpad{grid-template-columns:repeat(3,47px);grid-template-rows:repeat(2,47px);gap:5px}
 #dpad button{min-width:47px;min-height:47px;font-size:24px}
}


/* Compact retro computer, at the same scale as the player's sprite. */
#world[data-place="office"] .desk{
 left:840px;top:745px;width:286px;height:99px;
 border:11px solid #765944;background:#b68b64;
 border-radius:10px;box-shadow:0 20px 0 #705644;
}
#world[data-place="office"] .monitor{
 left:931px;top:620px;width:110px;height:127px;
 border:9px solid #9d9d8a;border-radius:14px 14px 8px 8px;
 background:#d9d4b8;box-shadow:0 6px 0 #8b8977;z-index:2;
}
#world[data-place="office"] .monitor::before{
 content:"";position:absolute;left:11px;right:11px;top:13px;height:68px;
 border:6px solid #797f77;border-radius:7px;background:
 linear-gradient(135deg,#accbbb,#5e9798 85%);box-shadow:inset 2px 3px 0 #d8eee3;
}
#world[data-place="office"] .monitor::after{
 content:"";position:absolute;right:17px;bottom:13px;width:39px;height:5px;
 border-radius:4px;background:#706f64;
}
#world[data-place="office"] .office-keyboard{
 position:absolute;left:925px;top:812px;width:119px;height:20px;
 transform:skewX(-8deg);border:4px solid #a49f8a;
 border-radius:4px;background:repeating-linear-gradient(90deg,#e5e0c9 0 7px,#a7a68e 7px 9px);
 z-index:3;
}


/* Cargo travels left across the belt, clears its edge before dropping
   to the floor, then fades before reappearing behind the truck. */
#world .conveyor{overflow:visible;z-index:3;isolation:isolate}
.conveyor .cargo-track{
 position:absolute;left:0;right:0;top:-82px;height:84px;
 overflow:visible;pointer-events:none;z-index:2;
}
.conveyor .cargo-box{
 position:absolute;top:3px;left:100%;width:91px;height:79px;
 background:#d7b27c;border:10px solid #ad8659;border-radius:5px;
 box-shadow:inset 0 0 0 3px #eecf9f,0 5px 0 #546c61;
 animation:cargo-across 6.6s linear infinite;will-change:transform;
}
.conveyor .cargo-box::before{content:"";position:absolute;inset:10px 15px;border-left:4px solid #ae855b;border-right:4px solid #ae855b;opacity:.65}
.conveyor .cargo-box.b{animation-delay:-2.2s}
.conveyor .cargo-box.c{animation-delay:-4.4s}
@keyframes cargo-across{
 0%{transform:translate3d(0,0,0);opacity:0}
 5%{opacity:1}
 79%{transform:translate3d(calc(-100% - 960px),0,0);opacity:1}
 90%{transform:translate3d(calc(-100% - 960px),118px,0) rotate(-14deg);opacity:1}
 98%,100%{transform:translate3d(calc(-100% - 960px),195px,0) rotate(-24deg);opacity:0}
}
.conveyor::after{
 content:"";position:absolute;left:-7px;right:-7px;bottom:-7px;height:13px;
 z-index:3;background:#527b7e;border-radius:0 0 9px 9px;
}
/* Safety equipment for every character on the industrial floor. */
#world:is([data-place="factory"],[data-place="dock"],[data-place="meeting"],[data-place="boss"]) .actor .torso{
 background:#dfca59!important;border:2px solid #b49d40;
 box-shadow:inset -7px 0 #b79c3b;
}
#world:is([data-place="factory"],[data-place="dock"],[data-place="meeting"],[data-place="boss"]) .actor .torso::after{
 content:"";position:absolute;inset:0;
 background:linear-gradient(49deg,transparent 0 39%,#fff3ce 40% 48%,#abb99b 49% 52%,transparent 53%),
            linear-gradient(-49deg,transparent 0 39%,#fff3ce 40% 48%,#abb99b 49% 52%,transparent 53%);
}
#world:is([data-place="factory"],[data-place="dock"],[data-place="meeting"],[data-place="boss"]) .actor .hair::before{
 content:"";position:absolute;left:-5px;top:-12px;width:52px;height:21px;
 background:#f1d062;border:3px solid #b6923e;border-radius:18px 18px 5px 5px;z-index:2;
}
#world:is([data-place="factory"],[data-place="dock"],[data-place="meeting"],[data-place="boss"]) .actor .hair::after{
 content:"";position:absolute;left:-11px;top:7px;width:63px;height:7px;
 background:#f1d062;border:2px solid #b6923e;border-radius:4px;z-index:3;
}
/* A goal marker is visible on the NPC while approaching, then disappears
   when the interaction begins. */
#world[data-goal="npc"] #npc{filter:drop-shadow(0 0 7px #f1d372)}
#guide{
 position:absolute;z-index:20;transform:translate(-50%,-50%);
 display:grid;place-items:center;width:41px;height:41px;
 border:3px solid #fff3d2;border-radius:50%;
 background:#d9ae4c;color:#274b46;font-size:28px;font-weight:900;
 box-shadow:0 0 0 5px #e4c05b3a;animation:goal-bob 1.6s ease-in-out infinite;
}
#guide:hover,#guide:focus-visible{background:#f1cf75}
@keyframes goal-bob{50%{filter:brightness(1.17);box-shadow:0 0 0 11px #f1d37225}}
@media(max-width:680px){#guide{width:44px;height:44px;font-size:29px}}


/* Selected avatar: always blue or pink safety vest with white trousers.
   Other factory NPCs keep their existing yellow reflective equipment. */
#world #player .torso{
 background:#287cb8!important;border:3px solid #145985;
 box-shadow:inset -7px 0 #14598555;
}
#world #player.sam .torso{background:#db72a5!important;border-color:#a94e79;box-shadow:inset -7px 0 #a94e7955}
#world #player .torso::after{
 content:"";position:absolute;inset:0;
 background:linear-gradient(50deg,transparent 0 37%,#ecf8f2 38% 46%,transparent 47%),
            linear-gradient(-50deg,transparent 0 37%,#ecf8f2 38% 46%,transparent 47%);
}
#player .leg{background:#f6f5ed;border:1px solid #d0dbd4;box-shadow:inset -3px 0 #d5dfd9}
/* The back of the head is a single hair silhouette, never a second face. */
.actor[data-facing="up"] .face{display:none}
.actor[data-facing="up"] .hair,
.actor.sam[data-facing="up"] .hair{left:12px;top:0;width:45px;height:45px;border-radius:13px 13px 8px 8px}
.avatar-choice button{display:flex;align-items:center;justify-content:center;gap:9px;min-height:72px;text-align:left}
.avatar-choice .avatar-preview{
 position:relative;display:inline-block;width:36px;height:52px;flex:0 0 36px;
 background:radial-gradient(ellipse 11px 12px at 50% 12px,#b57c5d 95%,transparent 100%);
}
.avatar-preview::before{
 content:"";position:absolute;top:24px;left:4px;width:28px;height:19px;border-radius:5px;
 background:var(--vest-preview);border:2px solid #ffffffb8;
}
.avatar-preview::after{
 content:"";position:absolute;top:43px;left:8px;width:7px;height:9px;background:#faf9f1;
 box-shadow:13px 0 #faf9f1;
}
.avatar-preview--blue{--vest-preview:#287cb8}
.avatar-preview--pink{--vest-preview:#db72a5}

/* Put the truck cab on the far (right) side and the unloading doors on
   the left, facing the conveyor belt. */
.truck::before{
 left:auto;right:-155px;border-radius:0 16px 6px 0;
 box-shadow:inset -14px 0 #d6c59c;
}
.truck-rear{
 position:absolute;left:-18px;top:8px;width:39px;height:182px;z-index:1;
 border:7px double #836649;border-radius:5px;
 background:repeating-linear-gradient(0deg,#cfad7d 0 13px,#b28d65 13px 19px);
 box-shadow:4px 0 0 #efdbba;
}
.truck-rear::after{
 content:"";position:absolute;right:5px;top:44%;width:7px;height:23px;
 background:#5d6d67;border-radius:3px;
}

/* The same track is retained and animated during the final mission and ending. */
#world:is([data-place="boss"],[data-place="end"]) .conveyor{animation:belt 1.6s linear infinite}

/* The failed machine flashes, its gear jolts and the warning spark pulses. */
.machine.stopped{animation:broken-machine-flash 1.15s ease-in-out infinite}
.machine.stopped::before{animation:machine-alert .7s steps(2,end) infinite}
.machine.stopped::after{animation:broken-gear .8s steps(2,end) infinite;transform-origin:50% 50%}
.machine-spark{
 position:absolute;right:-22px;top:-46px;z-index:3;font-size:90px;
 color:#ffbd55;text-shadow:0 0 11px #ff663c,0 0 26px #ff5538;
 animation:warning-spark .7s steps(2,end) infinite;
}
@keyframes broken-machine-flash{
 0%,100%{box-shadow:inset -40px 0 #4d797c,0 35px #547470,0 0 0 5px #eb9d4780}
 50%{box-shadow:inset -40px 0 #905044,0 35px #547470,0 0 38px 22px #fd5e3caa}
}
@keyframes broken-gear{
 0%,25%,100%{transform:rotate(0deg)}
 30%,65%{transform:rotate(-8deg) translateX(-5px)}
 40%,80%{transform:rotate(5deg) translateX(5px)}
}
@keyframes warning-spark{
 0%,100%{opacity:1;transform:scale(1) rotate(-8deg)}
 50%{opacity:.25;transform:scale(.84) rotate(9deg)}
}

/* Festive falling pieces animate through the whole viewport, without a
   static wallpaper of dots. Reduced-motion users see a calm still effect. */
#celebrate .confetti-piece{
 position:absolute;top:0;left:var(--x);
 width:11px;height:18px;border-radius:2px;background:var(--color);
 box-shadow:0 0 2px #ffffff66;
 animation:confetti-drop var(--duration) linear var(--delay) infinite;
 pointer-events:none;will-change:transform;
}
#celebrate .confetti-piece:nth-child(3n){width:8px;height:15px;border-radius:50%}
@keyframes confetti-drop{
 from{transform:translate3d(0,-12dvh,0) rotate(0deg)}
 to{transform:translate3d(var(--drift),112dvh,0) rotate(900deg)}
}
:root[data-cine-motion="off"] #celebrate .confetti-piece{top:var(--top);transform:none}



/* Simple opt-in checkbox keeps scene motion settings easy to understand. */
.motion-toggle{
 display:inline-flex;align-items:center;gap:8px;
 color:#24514f;font-size:14px;font-weight:700;cursor:pointer;
 padding:8px 3px;min-height:42px;
}
.motion-toggle input{width:19px;height:19px;accent-color:#1a745d;cursor:pointer}
.motion-toggle:focus-within{outline:2px solid #1a745d;outline-offset:3px;border-radius:5px}
#videoPlayer{display:block;width:100%;aspect-ratio:16/9;max-height:70dvh}
@media(max-width:680px){
 .video-actions button{min-width:60px}
 .video-continue{justify-self:stretch;text-align:center}
}

/* Minimal two-button player. Fullscreen keeps the video and its controls
   together instead of letting a native overlay hide the pause button. */
#videoFullscreen{font-size:23px;line-height:1;min-width:52px}
#videoPlay{font-size:21px;line-height:1;min-width:52px}
#videoCard:fullscreen,
#videoCard:-webkit-full-screen{
 width:100%;height:100%;max-width:none;
 padding:clamp(12px,2vw,28px);margin:0;
 display:flex;flex-direction:column;align-items:center;justify-content:center;
 gap:14px;background:#081a22;box-sizing:border-box;
}
#videoCard:fullscreen #videoPlayer,
#videoCard:-webkit-full-screen #videoPlayer{
 width:100%;height:auto;max-height:calc(100dvh - 125px);
 aspect-ratio:16/9;object-fit:contain;
}
#videoCard:fullscreen .video-actions,
#videoCard:-webkit-full-screen .video-actions{flex:none}
