:root{font-family:system-ui,sans-serif;color:#e6eefc;background:#0b1226;--border:#283653;--cyan:#53e0cc}*{box-sizing:border-box}body{margin:0;background:radial-gradient(ellipse at top left,#1b2c50,transparent 65%),#0b1226}main{max-width:1250px;margin:auto;padding:25px}header{display:flex;justify-content:space-between;align-items:center;gap:20px}h1{font-size:clamp(26px,4vw,42px);margin:6px 0;letter-spacing:-1px}h2{font-size:22px;margin:6px 0}p{line-height:1.6}.eyebrow{font-size:11px;font-weight:850;letter-spacing:2px;color:var(--cyan);margin:0}.badge{font-size:12px;border:1px solid #3d516e;background:#22334d;border-radius:30px;padding:8px 12px;white-space:nowrap}button,select{font:inherit}button{border:0;background:var(--cyan);color:#092c34;padding:11px 15px;border-radius:10px;font-weight:800;cursor:pointer;touch-action:manipulation}button:hover{filter:brightness(1.1)}button:focus-visible,select:focus-visible{outline:3px solid #ffd074;outline-offset:3px}button:disabled{opacity:.5;cursor:default}.subtle{background:#293850;color:#e6eefc;border:1px solid #40516b}nav{display:flex;gap:8px;flex-wrap:wrap;margin:22px 0}nav button{background:#17253e;color:#d3dff3;border:1px solid var(--border);min-width:43px}nav button.selected{border-color:var(--cyan);color:var(--cyan)}nav button.done:after{content:' ✓';color:var(--cyan)}.layout{display:grid;grid-template-columns:1.1fr 1fr;gap:22px;align-items:start}.panel{border:1px solid var(--border);border-radius:22px;padding:22px;background:#121e35;box-shadow:0 15px 45px #03081544}.mission-head{display:flex;justify-content:space-between;align-items:center;gap:10px}.mission-head .badge{font-size:11px}#brief{color:#bdcbe1;margin:12px 0 18px;min-height:50px}#map{display:grid;grid-template-columns:repeat(6,1fr);gap:5px;background:#091125;border-radius:17px;padding:10px;max-width:540px;margin:auto}.cell{aspect-ratio:1;position:relative;display:grid;place-items:center;border-radius:8px;background:#24334d;border:1px solid #31435d;font-size:clamp(19px,3vw,29px)}.cell.wall{background:repeating-linear-gradient(135deg,#364c66 0,#364c66 7px,#2b3f57 7px,#2b3f57 14px);border-color:#64748b}.cell.goal{background:#254c4f;border-color:#53e0cc}.cell .energy{position:absolute;font-size:23px}.cell .robot{position:absolute;z-index:2;font-size:32px;filter:drop-shadow(0 3px 2px #0008)}.cell .heading{position:absolute;right:1px;bottom:0;color:#feda80;font-size:17px;font-weight:900;z-index:3}.legend{font-size:12px;color:#a5b6d0;margin-top:15px;text-align:center}#status{background:#1e304a;border-left:3px solid var(--cyan);padding:12px;border-radius:8px;min-height:70px;font-size:14px}.muted{color:#9fafd0;font-size:13px}#palette{display:flex;flex-wrap:wrap;gap:9px;margin:15px 0}.block{display:flex;gap:10px;align-items:center;border-radius:9px;padding:10px 12px;font-size:14px;background:#3678b9;color:white;border:1px solid #70a3d9;box-shadow:0 3px 0 #153c68}.block.turn{background:#7951b8;border-color:#b595e3}.block.collect{background:#b97a22;border-color:#e9b860}.block.loop{background:#136d66;border-color:#55bdb0}.block[draggable=true]{cursor:grab}.program-head{display:flex;align-items:center;justify-content:space-between;margin:20px 0 10px}.program-head h3{font-size:15px;margin:0}.program-head span{font-size:12px;color:#a4b4c8}#program{min-height:190px;border:2px dashed #415370;border-radius:13px;padding:12px;max-height:550px;overflow:auto}.empty{font-size:13px;text-align:center;color:#9aadc9;padding:20px}.node{margin:0 0 10px}.node>.block{justify-content:space-between;flex-wrap:wrap}.node.active>.block{outline:3px solid #ffe297;box-shadow:0 0 15px #ffe29777}.mini{display:inline-flex;gap:4px}.mini button{padding:3px 7px;border:1px solid #ffffff55;background:#0a172b44;color:white;font-size:12px}.loop-body{min-height:60px;margin:8px 0 0 15px;border-left:3px solid #55bdb0;padding:8px 0 1px 12px;background:#0e192b;border-radius:0 0 10px 10px}.loop-body.chosen{outline:2px solid #ffd074}.controls{display:flex;gap:8px;flex-wrap:wrap;margin-top:16px}.speed{display:block;margin:16px 0;font-size:13px;color:#acbcd3}select{background:#20334e;color:white;border:1px solid #536880;border-radius:6px;padding:5px}details{font-size:13px;color:#b8c8df;border-top:1px solid var(--border);padding-top:15px}summary{cursor:pointer;font-weight:750}footer{color:#8297b8;font-size:12px;margin-top:25px}#next{margin-top:5px}@media(max-width:850px){.layout{grid-template-columns:1fr}main{padding:16px}header{display:block}header>.badge{display:inline-block;margin-top:4px}.panel{padding:17px}.cell{font-size:26px}.cell .robot{font-size:30px}#brief{min-height:0}#map{max-width:420px}.mission-head{flex-wrap:wrap}#program{max-height:450px}}

/* V2: asociación visual estable en paleta y programa */
.block.forward{background:#17723e;border-color:#74d49a;box-shadow:0 3px 0 #0a4023}.block.backward{background:#ac2939;border-color:#f19ba6;box-shadow:0 3px 0 #681a25}.block.left{background:#7440a8;border-color:#c3a0e6;box-shadow:0 3px 0 #40235e}.block.right{background:#245bad;border-color:#91b7f2;box-shadow:0 3px 0 #173764}.block.collect{background:#795208;border-color:#e1b961}.block.loop{background:#146d73;border-color:#71cfd5}.command-icon{font-size:30px;line-height:1;min-width:32px;text-align:center;display:inline-block;vertical-align:middle;margin-right:8px;font-weight:900}.node>.block>span:first-child{display:flex;align-items:center}.cell{background:#172b4888;border-color:#ceeaff55;box-shadow:inset 0 0 10px #d8edff11}.cell.goal{background:#146d5daa}.cell.wall{background:repeating-linear-gradient(135deg,#657c9a 0,#657c9a 7px,#31496e 7px,#31496e 14px)}#map{background-size:cover;background-position:center;padding:12px;border:1px solid #587397}.cell .robot{width:85%;height:90%;display:grid;place-items:center;bottom:3%}.robot img{width:100%;height:100%;object-fit:contain}.cell .heading{display:grid;place-items:center;background:#ffdf69;color:#12233e;border:2px solid #fff2ba;border-radius:7px;right:-3px;bottom:-3px;width:29px;height:29px;font-size:24px;line-height:1;box-shadow:0 2px 5px #0008}.legend{line-height:1.6}#success[hidden]{display:none}#success{position:fixed;inset:0;z-index:100;background:#07132be8;display:flex;align-items:center;justify-content:center;padding:20px;overflow:auto;backdrop-filter:blur(5px)}.success-card{width:100%;max-width:500px;background:linear-gradient(145deg,#24375c,#12233c);border:2px solid #68e5ca;border-radius:28px;padding:30px;text-align:center;box-shadow:0 0 80px #42dfb52b}.success-icon{font-size:65px}.success-card h2{font-size:clamp(30px,6vw,42px);color:#8cf3d5}.success-card button{display:block;width:100%;margin-top:14px;padding:14px}.success-card p{color:#c7d9ed}@media(max-width:600px){.command-icon{font-size:29px;min-width:30px}.cell .heading{width:25px;height:25px;font-size:21px}.success-card{padding:24px}}

.success-icon img{width:145px;height:145px;object-fit:contain;filter:drop-shadow(0 8px 12px #0004)}.cell .robot{width:93%;height:96%;bottom:1%}.cell .heading{z-index:5}

/* Movimiento del personaje sin archivos de animación pesados. */
.cell .robot img{animation:robot-idle 2.8s ease-in-out infinite;transform-origin:50% 85%;will-change:transform}.executing .cell .robot img{animation:robot-work .6s ease-in-out infinite}.success-icon img{animation:robot-celebrate 1.5s ease-in-out infinite;transform-origin:50% 90%}
@keyframes robot-idle{0%,100%{transform:translateY(0) rotate(-1deg)}50%{transform:translateY(-3px) rotate(1deg)}}@keyframes robot-work{0%,100%{transform:translateY(0) rotate(-2deg)}50%{transform:translateY(-3px) rotate(2deg)}}@keyframes robot-celebrate{0%,100%{transform:translateY(0) rotate(0)}25%{transform:translateY(-9px) rotate(-5deg)}50%{transform:translateY(0) rotate(0)}75%{transform:translateY(-7px) rotate(5deg)}}
.app-actions{display:flex;gap:10px;align-items:center}.app-actions button{white-space:nowrap;font-size:13px}.panel,.layout,.world,.workshop{min-width:0}body.app-mode{height:100dvh;overflow:hidden}body.app-mode main{height:100%;padding:10px 16px;display:flex;flex-direction:column}body.app-mode header h1,body.app-mode header>div>p:not(.eyebrow),body.app-mode header>.app-actions>.badge,body.app-mode footer{display:none}body.app-mode header{flex-shrink:0;gap:10px}body.app-mode #levels{margin:8px 0;flex-shrink:0}body.app-mode .layout{flex:1;min-height:0;grid-template-columns:minmax(0,1fr) minmax(0,1fr);align-items:stretch;gap:12px}body.app-mode .panel{overflow:auto;padding:14px;border-radius:16px}body.app-mode #map{width:min(100%,calc(100dvh - 290px));min-width:180px}body.app-mode #program{max-height:none;min-height:120px}body.app-mode .workshop{display:flex;flex-direction:column}body.app-mode #program{flex:1;overflow:auto}body.app-mode .workshop>.muted{margin:4px 0}body.app-mode #palette{margin:9px 0}body.app-mode .controls{flex-shrink:0}body.app-mode .speed{margin:10px 0}body.app-mode details{flex-shrink:0}
@media(orientation:portrait) and (max-width:650px){body.app-mode .layout{display:flex;flex-direction:column;overflow:auto}body.app-mode .panel{overflow:visible;flex-shrink:0}body.app-mode #map{width:min(100%,350px)}body.app-mode .workshop{min-height:460px}body.app-mode #program{max-height:350px;flex:auto}body.app-mode header .eyebrow{font-size:9px;letter-spacing:1px}.app-actions>.badge{display:none}}
/* El modo horizontal se adapta al giro sin reiniciar el programa. */
@media(orientation:landscape) and (max-height:600px){body{height:100dvh;overflow:hidden}main,body.app-mode main{height:100%;padding:6px max(10px,env(safe-area-inset-right)) 6px max(10px,env(safe-area-inset-left));display:flex;flex-direction:column}header{display:flex;justify-content:space-between;flex-shrink:0}header h1,header>div>p:not(.eyebrow),header .badge,footer{display:none}header .eyebrow{font-size:9px;letter-spacing:1px}.app-actions button{font-size:11px;padding:6px 9px}nav,body.app-mode #levels{margin:5px 0;gap:5px;flex-shrink:0}nav button{padding:5px 9px;min-width:32px;font-size:12px}.layout,body.app-mode .layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.08fr);gap:9px;flex:1;min-height:0;align-items:stretch}.panel,body.app-mode .panel{padding:10px;overflow:auto;border-radius:13px}.mission-head h2{font-size:16px}.mission-head .badge{font-size:9px;padding:5px}.mission-head .eyebrow{font-size:9px}#brief{font-size:11px;line-height:1.4;margin:5px 0 8px}#map,body.app-mode #map{width:min(100%,calc(100dvh - 170px));min-width:130px;padding:6px;gap:3px;margin:auto}.cell .heading{width:19px;height:19px;font-size:17px;border-width:1px}.cell .energy{font-size:18px}.legend{font-size:9px;margin-top:7px}#status{font-size:11px;min-height:0;padding:7px;margin:7px 0}.workshop,body.app-mode .workshop{display:flex;flex-direction:column}.workshop h2{font-size:17px}.workshop>.muted{font-size:10px;line-height:1.35;margin:2px 0}#palette,body.app-mode #palette{gap:5px;margin:7px 0}.block{padding:6px 8px;font-size:11px;border-radius:7px}.command-icon{font-size:22px;min-width:23px;margin-right:4px}#program,body.app-mode #program{flex:1;min-height:90px;max-height:none;padding:7px;overflow:auto}.program-head{margin:5px 0}.program-head h3{font-size:12px}.program-head button{font-size:11px;padding:5px 9px}.node{margin-bottom:7px}.mini button{padding:3px 5px}.controls,body.app-mode .controls{gap:6px;margin-top:8px;flex-shrink:0}.controls button{font-size:11px;padding:7px 10px}.speed,body.app-mode .speed{font-size:10px;margin:6px 0}details{font-size:11px;padding-top:7px;flex-shrink:0}#next{padding:8px;font-size:12px}.success-card{padding:16px;max-height:95dvh;overflow:auto}.success-icon img{width:90px;height:90px}.success-card h2{font-size:28px}.success-card p{font-size:13px;margin:8px}.success-card button{padding:9px;margin-top:8px}}
@media(prefers-reduced-motion:reduce){.cell .robot img,.executing .cell .robot img,.success-icon img{animation:none;will-change:auto}}

/* V2.3 · Bienvenida y lectura de instrucciones */
:root{background:#020707}body{background:radial-gradient(ellipse at 0 0,#063e3d88,transparent 60%),radial-gradient(ellipse at 100% 90%,#063c4e66,transparent 60%),#020707}.panel{background:linear-gradient(145deg,#0a2024ed,#071217f5);border-color:#21434a}body:not(.app-mode) main{max-width:1450px}#brief{color:#ffed9a;font-size:17px;line-height:1.65;background:#ffdf6510;border-left:3px solid #ead46e;border-radius:8px;padding:12px 14px;min-height:0}.workshop>.muted{color:#ffedaa;font-size:15px;line-height:1.6}#status{color:#fff1ae;font-size:16px;line-height:1.65;padding:16px 18px;background:#0f292a;border-left-color:#e8d46f;min-height:82px}.empty{color:#ffedaa;font-size:15px}.world .mission-head h2{line-height:1.3}.speed{color:#c6dadb}#welcome[hidden]{display:none}#welcome{min-height:100dvh;max-width:1280px;margin:auto;display:grid;grid-template-columns:1.12fr 1fr;gap:30px;align-items:center;padding:50px 35px}.on-welcome main,.on-welcome #success{display:none!important}body.on-welcome{height:auto;overflow:auto}.welcome-copy h1{font-size:clamp(35px,5vw,65px);line-height:1.1;letter-spacing:-2px;margin:22px 0;color:#f0fffc}.welcome-description{font-size:18px;line-height:1.75;color:#bdd9d6;max-width:570px}.welcome-tags{display:flex;gap:10px;flex-wrap:wrap;margin:25px 0}.welcome-tags span{font-size:13px;padding:9px 13px;border:1px solid #2b5859;border-radius:25px;color:#a9eadf;background:#0b2322}.welcome-copy button{font-size:18px;padding:17px 25px;margin:8px 0}.welcome-tip{font-size:13px;color:#ffeaa0}.welcome-art{position:relative;display:grid;place-items:center;min-height:400px;isolation:isolate}.welcome-art:before{content:'';position:absolute;width:80%;height:80%;border-radius:50%;background:#24ddc537;filter:blur(45px);z-index:-1}.welcome-robot{width:100%;max-width:440px;filter:drop-shadow(0 20px 30px #0008);animation:welcome-float 4s ease-in-out infinite}.orbit{position:absolute;border:1px solid #35b6a944;border-radius:50%;width:100%;aspect-ratio:1;z-index:-1}.orbit-two{width:76%;border-style:dashed}.welcome-star{position:absolute;color:#ffe594;font-size:35px;animation:star-glow 3s ease-in-out infinite}.star-one{left:3%;top:16%}.star-two{right:2%;bottom:12%;font-size:24px;animation-delay:1s}@keyframes welcome-float{0%,100%{transform:translateY(0) rotate(-1deg)}50%{transform:translateY(-12px) rotate(1deg)}}@keyframes star-glow{0%,100%{opacity:.4;scale:.8}50%{opacity:1;scale:1.1}}.app-actions{flex-wrap:wrap}
@media(min-width:1000px) and (min-height:650px){body:not(.app-mode) .layout{grid-template-columns:1.06fr 1fr;gap:26px}body:not(.app-mode) .panel{padding:26px}body:not(.app-mode) #program{min-height:250px}body:not(.app-mode) #map{max-width:580px}}
@media(max-width:700px){#welcome{grid-template-columns:1fr;padding:35px 24px;gap:10px}.welcome-copy h1{font-size:39px}.welcome-description{font-size:16px}.welcome-art{min-height:230px;grid-row:1}.welcome-robot{max-width:240px}.orbit{width:250px}.orbit-two{width:190px}.welcome-copy .eyebrow{font-size:10px}.welcome-copy button{width:100%;font-size:17px}.welcome-star.star-one{left:15%}.welcome-star.star-two{right:17%}#brief{font-size:15px;padding:10px 12px}#status{font-size:14px;padding:12px;min-height:65px}.workshop>.muted{font-size:13px}}
/* Conserva las medidas compactas del espacio de trabajo móvil. */
@media(orientation:landscape) and (max-height:600px){#welcome{grid-template-columns:1.2fr 1fr;min-height:100dvh;padding:20px 28px;gap:20px}.welcome-art{grid-row:auto;min-height:220px}.welcome-robot{max-width:245px}.orbit{width:250px}.orbit-two{width:185px}.welcome-copy h1{font-size:32px;margin:12px 0}.welcome-description{font-size:13px;margin:8px 0}.welcome-tags{margin:12px 0;gap:7px}.welcome-tags span{font-size:11px;padding:5px 9px}.welcome-copy button{font-size:14px;padding:10px 16px}.welcome-tip{font-size:11px}#brief{font-size:11px;line-height:1.4;padding:6px 8px;margin:5px 0 8px}#status{font-size:11px;min-height:0;padding:7px;margin:7px 0}.workshop>.muted{font-size:10px;line-height:1.35}.empty{font-size:11px}}
@media(prefers-reduced-motion:reduce){.welcome-robot,.welcome-star{animation:none}}

/* V2.4: atlas real de poses, seis cuadros en una sola imagen. */
.robot-sprite{display:block;background-image:url('robot-poses.png');background-size:300% 200%;background-repeat:no-repeat;aspect-ratio:1}.board-sprite{width:100%;height:100%;background-position:0 0;animation:sprite-breathe 2.8s ease-in-out infinite}.executing .board-sprite{animation:sprite-step .5s ease-in-out infinite}.welcome-art>.robot-sprite{width:100%;max-width:440px;height:auto;aspect-ratio:1;background-position:50% 0;animation:pose-greeting 3.6s steps(1,end) infinite,sprite-breathe 3s ease-in-out infinite}.success-icon>.celebration-sprite{width:160px;height:160px;margin:auto;background-position:50% 100%;animation:pose-celebrate 2s steps(1,end) infinite,robot-celebrate 1.5s ease-in-out infinite}
@keyframes pose-greeting{0%,65%{background-position:50% 0}66%,100%{background-position:0 0}}@keyframes pose-celebrate{0%,65%{background-position:50% 100%}66%,100%{background-position:100% 100%}}@keyframes sprite-breathe{0%,100%{transform:translateY(0)}50%{transform:translateY(-3px)}}@keyframes sprite-step{0%,100%{transform:translateY(0)}50%{transform:translateY(-2px)}}
@media(max-width:700px){.welcome-art>.robot-sprite{max-width:240px}}@media(orientation:landscape) and (max-height:600px){.welcome-art>.robot-sprite{max-width:245px}.success-icon>.celebration-sprite{width:90px;height:90px}}@media(prefers-reduced-motion:reduce){.board-sprite,.executing .board-sprite,.welcome-art>.robot-sprite,.success-icon>.celebration-sprite{animation:none}}

/* V2.5 · Piezas de construcción: geometría CSS, sin imágenes adicionales. */
.block{position:relative;border-radius:8px 8px 6px 6px;border-width:2px;box-shadow:inset 0 3px 0 #ffffff30,inset 0 -4px 0 #0003,0 3px 0 #071322;padding-top:17px;padding-bottom:12px;isolation:isolate}.block:before{content:'';position:absolute;left:15px;top:-7px;width:23px;height:10px;border:2px solid #ffffff55;border-bottom:0;border-radius:5px 5px 0 0;background:inherit;box-shadow:38px 0 0 -1px currentColor;opacity:.9;z-index:-1}.block:after{content:'';position:absolute;right:18px;top:7px;width:11px;height:5px;border:1px solid #ffffff28;border-radius:50%;box-shadow:-18px 0 0 #ffffff1a;pointer-events:none}#palette{gap:16px 11px;padding-top:7px}#palette .block{min-height:64px}#program{padding-top:14px;background:linear-gradient(#07131fcc,#07131fcc),radial-gradient(#54738155 1px,transparent 1px);background-size:auto,12px 12px}.start-brick{display:flex;gap:13px;align-items:center;background:linear-gradient(#f9d779,#ddb24b);border:2px solid #ffebad;border-radius:20px 20px 5px 5px;padding:14px 17px 18px;color:#2b260e;position:relative;margin:0 0 5px;box-shadow:inset 0 3px 0 #fff5,inset 0 -4px 0 #0002}.start-brick:after{content:'';position:absolute;bottom:-8px;left:25px;width:40px;height:12px;background:#ddb24b;border:2px solid #ffebad;border-top:0;border-radius:0 0 5px 5px;z-index:3}.start-brick strong{display:block;font-size:19px}.start-brick small{display:block;font-size:11px;margin-top:3px}.start-symbol{font-size:28px}.start-brick.active{outline:3px solid #fff1ad;box-shadow:0 0 20px #ffd85e66}#program>.node{margin:0 0 3px;padding-top:8px}#program>.node>.block{border-radius:5px;padding-left:15px}#program>.node>.block:before{left:23px;top:-9px;width:40px;height:12px;box-shadow:none;background:#0b1d2d;border-color:#ffffff55;border-radius:0 0 5px 5px;z-index:1}#program>.node>.block:after{top:auto;bottom:-8px;left:24px;width:40px;height:12px;border:2px solid #ffffff55;border-top:0;border-radius:0 0 5px 5px;background:inherit;box-shadow:none;z-index:3}#program>.node:last-child>.block:after{bottom:-7px}.loop-body{margin-top:12px;padding-top:13px;padding-bottom:9px;border-radius:0 0 12px 12px}.loop-body>.node{margin-top:8px}.node>.block>.mini{position:relative;z-index:4}.empty{padding:25px 12px 18px}.node.active>.block{outline-offset:2px}.mini button{min-width:27px;min-height:26px;border-radius:6px}@media(orientation:landscape) and (max-height:600px){.block{padding-top:12px;padding-bottom:9px}#palette{gap:12px 7px}#palette .block{min-height:46px}.start-brick{padding:9px 11px 13px}.start-brick strong{font-size:15px}.start-brick small{font-size:9px}.start-symbol{font-size:22px}}

#levels>select{max-width:230px;border-color:#3d8d86;background:#102c2f;color:#bff9ed;padding:9px 12px;border-radius:10px} @media(orientation:landscape) and (max-height:600px){#levels>select{max-width:185px;font-size:11px;padding:4px 7px}}

/* V2.7 · Imágenes optimizadas y unión continua en el programa. */
#palette .block:not(.loop){background:none!important;border:0;box-shadow:none;padding:0;min-height:0;display:block;width:calc(50% - 7px);max-width:220px}#palette .block:not(.loop):before,#palette .block:not(.loop):after{display:none}.brick-art{display:block;width:100%;height:auto;pointer-events:none;user-select:none}#program>.node,.loop-body>.node{padding-top:0;margin:0}#program>.node>.block:not(.loop),.loop-body>.node>.block:not(.loop){display:flex;flex-wrap:nowrap;gap:0;border:0;border-radius:0;box-shadow:none;background:none!important;padding:0;min-height:54px;position:relative}#program .node>.block:not(.loop):before,#program .node>.block:not(.loop):after{display:none}#program .node>.block:not(.loop)>span:first-child{flex:1;min-width:0;display:block;line-height:0}#program .node>.block:not(.loop) .brick-art{width:100%;height:68px;object-fit:fill}#program .mini{align-self:stretch;display:flex;align-items:center;justify-content:center;padding:4px;gap:3px;background:#172739;border-left:1px solid #ffffff22;flex-shrink:0;width:91px}#program .mini button{min-width:24px;padding:4px}#program .start-brick{border:0;box-shadow:none;border-radius:0;background:none;padding:0;margin:0;display:block;padding-right:91px}#program .start-brick:after{display:none}.start-art{display:block;width:100%;height:68px;object-fit:fill}#program .node.active>.block{outline:3px solid #fff0a8;outline-offset:-3px;z-index:7}#program .node>.block{position:relative}#program .node>.block:before{box-shadow:none}#program>.repeat-node,.loop-body>.repeat-node{border-left:15px solid #11acb8;border-bottom:17px solid #11acb8;border-radius:8px 8px 8px 8px;background:linear-gradient(90deg,#0c6570,#0e8d97);padding:0;box-shadow:inset 3px 0 #94f4f366}#program .repeat-node>.loop{border-radius:5px 5px 0 0;padding:10px 8px;background:linear-gradient(#1dd6db,#079da9);border:1px solid #8df3ed;box-shadow:inset 0 3px #b1fffa44;margin-left:-15px;min-height:65px;color:white;gap:7px;flex-wrap:wrap}#program .repeat-node>.loop:before,#program .repeat-node>.loop:after{display:none}#program .repeat-node>.loop>.mini{background:#087782;min-height:30px;align-self:center}#program .repeat-node>.loop select{font-size:14px;background:#f6fffd;color:#123c42;font-weight:800;border:2px solid #91e6de;padding:5px 8px}#program .loop-body{border:0;margin:0;padding:10px 0 0 10px;background:#07131f;border-radius:0;min-height:80px}#program .loop-body>button{font-size:11px;padding:6px;margin:0 0 8px}#palette .loop{width:calc(50% - 7px);max-width:220px;background:linear-gradient(#19cad3,#0499a5);min-height:62px;font-size:14px}#program .repeat-node .command-icon{font-size:26px}#program .empty{padding-top:20px}#program{padding-left:12px;padding-right:12px}.snapped{animation:brick-snap .22s ease-out}@keyframes brick-snap{from{transform:translateY(-7px);filter:brightness(1.3)}to{transform:translateY(0);filter:brightness(1)}}@media(max-width:600px){#program .node>.block:not(.loop) .brick-art,.start-art{height:58px}#program .mini{width:82px;padding:2px}#program .start-brick{padding-right:82px}#program .mini button{min-width:23px;min-height:27px;font-size:11px}}@media(orientation:landscape) and (max-height:600px){#palette .block:not(.loop),#palette .loop{max-width:180px}#program .node>.block:not(.loop) .brick-art,.start-art{height:48px}#program .node>.block:not(.loop){min-height:48px}#program .mini{width:75px;padding:2px;gap:2px}#program .mini button{min-width:21px;min-height:24px;font-size:10px;padding:2px}#program .start-brick{padding-right:75px}#program .repeat-node>.loop{min-height:49px}#program .repeat-node>.loop select{font-size:11px;padding:3px}}
@media(prefers-reduced-motion:reduce){.snapped{animation:none}}

/* V2.8 · Laboratorio compacto, máxima superficie para el programa. */
.workshop{display:flex;flex-direction:column;min-height:620px}.workshop>h2{font-size:20px;margin:0 0 4px}.workshop>.muted{margin:2px 0 6px;font-size:12px;line-height:1.4}#palette,body.app-mode #palette{display:flex;align-items:center;gap:7px 9px;padding:4px 0 0;margin:7px 0 8px;flex-shrink:0;max-height:130px;overflow:auto}#palette .block:not(.loop){width:125px;max-width:125px;flex:0 0 125px}#palette .block:not(.loop) .brick-art{height:48px;width:125px;object-fit:contain}#palette .loop{width:125px;max-width:125px;min-height:43px;padding:7px 8px;font-size:12px;flex:0 0 125px}#palette .loop .command-icon{font-size:23px;min-width:24px}#palette .loop:before{display:none}.program-head{margin:5px 0 7px;flex-shrink:0}.program-head h3{font-size:13px}.program-head>button{padding:6px 10px;font-size:12px}#program,body.app-mode #program{box-sizing:border-box;flex:1 1 auto;min-height:280px;max-height:650px;overflow:auto;overscroll-behavior:contain;padding:9px 8px 22px;scroll-padding:8px}#program>.node,.loop-body>.node{flex-shrink:0;min-height:0}#program .node>.block:not(.loop){min-height:40px;height:40px;width:100%;max-width:455px;margin:0;flex-shrink:0}#program .node>.block:not(.loop) .brick-art{height:40px;object-fit:fill}#program .node>.block:not(.loop)>span:first-child{height:40px;min-width:0;max-width:365px}#program .mini{height:40px;width:80px;min-width:80px;max-width:80px;flex:0 0 80px;gap:2px;padding:2px}#program .mini button{min-width:23px;min-height:26px;font-size:11px;padding:2px 4px}#program .start-brick{width:100%;max-width:455px;padding:0 80px 0 0;min-height:40px;height:40px;flex-shrink:0}.start-art{height:40px;width:100%;object-fit:fill}#program>.repeat-node,.loop-body>.repeat-node{max-width:455px;border-left-width:11px;border-bottom-width:12px;flex-shrink:0}#program .repeat-node>.loop{margin-left:-11px;padding:6px 7px;min-height:43px;gap:6px}#program .repeat-node>.loop>span:first-child{font-size:12px}#program .repeat-node .command-icon{font-size:22px;min-width:23px}#program .repeat-node>.loop>.mini{height:30px;min-width:80px;width:80px}#program .repeat-node>.loop select{font-size:12px;padding:4px}#program .loop-body{padding:7px 0 0 7px}#program .loop-body>button{font-size:10px;padding:4px 6px;margin-bottom:5px}.controls,body.app-mode .controls{gap:7px;margin-top:9px;flex-shrink:0}.controls button{padding:9px 12px;font-size:12px}.speed,body.app-mode .speed{margin:7px 0;font-size:11px}.workshop details{font-size:11px;padding-top:8px;flex-shrink:0}body.app-mode .workshop{min-height:0;overflow:hidden}body.app-mode #program{min-height:80px;max-height:none;flex:1 1 0}body.app-mode .workshop details{max-height:80px;overflow:auto}
@media(min-width:851px){body:not(.app-mode) .workshop{min-height:760px}body:not(.app-mode) #program{min-height:390px;max-height:660px}}
@media(orientation:landscape) and (max-height:600px){.workshop,body.app-mode .workshop{min-height:0;overflow:hidden;display:flex;flex-direction:column}.workshop>h2{font-size:15px;margin:0 0 2px}.workshop>.muted{font-size:10px;line-height:1.25;margin:0 0 3px}#palette,body.app-mode #palette{gap:4px 7px;margin:4px 0 5px;padding:0;max-height:86px}#palette .block:not(.loop){width:108px;max-width:108px;flex-basis:108px}#palette .block:not(.loop) .brick-art{width:108px;height:39px}#palette .loop{width:108px;max-width:108px;flex-basis:108px;min-height:35px;font-size:11px;padding:4px 6px}.program-head{margin:2px 0 4px}.program-head h3{font-size:11px}.program-head>button{padding:4px 7px;font-size:10px}#program,body.app-mode #program{flex:1 1 0;min-height:70px;max-height:none;padding:6px 6px 18px}#program .node>.block:not(.loop),#program .node>.block:not(.loop)>span:first-child,#program .node>.block:not(.loop) .brick-art,#program .start-brick,.start-art{height:34px;min-height:34px}#program .mini{height:34px;width:73px;min-width:73px;max-width:73px;flex-basis:73px}#program .mini button{min-width:21px;min-height:25px;font-size:10px}#program .start-brick{padding-right:73px}#program .repeat-node>.loop{min-height:36px;padding:4px 5px}#program .repeat-node>.loop select{font-size:11px;padding:3px}.controls,body.app-mode .controls{margin-top:6px;gap:6px}.controls button{padding:6px 9px;font-size:11px}.speed,body.app-mode .speed{margin:4px 0;font-size:10px}.workshop details{max-height:60px;overflow:auto;padding-top:4px;font-size:10px}.workshop .empty{padding:12px;font-size:11px}}
@media(orientation:portrait) and (max-width:650px){body.app-mode .workshop{min-height:500px;overflow:visible}body.app-mode #program{min-height:250px;max-height:450px;flex:auto}}

/* Coding RBT · Identidad y bienvenida compacta, v2.9 */
.sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}.coding-welcome-logo{display:block;width:100%;max-width:600px;height:auto;margin:0 0 12px}.welcome-copy .welcome-description{font-size:19px;line-height:1.6;max-width:500px;margin:12px 0 22px}.coding-header-logo{display:block;width:230px;height:70px;object-fit:contain;object-position:left center}.coding-brand{min-width:0}#welcome{gap:25px;padding-top:30px;padding-bottom:30px}.welcome-copy button{margin-top:0}.app-actions{align-items:center}
@media(max-width:850px){.coding-header-logo{width:205px;height:62px}.coding-welcome-logo{max-width:520px;margin-left:auto;margin-right:auto}}
@media(max-width:550px){.coding-header-logo{width:170px;height:52px}.coding-welcome-logo{max-width:440px}.welcome-copy .welcome-description{font-size:16px;margin:10px 0 18px}#welcome{padding:20px 18px;gap:10px}}
@media(orientation:landscape) and (max-height:600px){.coding-header-logo,body.app-mode .coding-header-logo{width:160px;height:45px}.coding-welcome-logo{max-width:400px}.welcome-copy .welcome-description{font-size:15px}}

/* v2.9.1: entrada sin desplazamiento y paneles accesibles en ventanas bajas */
html{scroll-behavior:auto}body:not(.on-welcome):not(.app-mode){height:auto;min-height:100dvh;overflow:auto}body:not(.on-welcome):not(.app-mode) main{height:auto;min-height:100dvh}body:not(.on-welcome):not(.app-mode) .layout{overflow:visible}
@media(orientation:landscape) and (max-height:650px){body:not(.on-welcome):not(.app-mode) .workshop{min-height:0;overflow:visible}body:not(.app-mode) #program{min-height:180px;max-height:360px;flex:1 1 auto}body:not(.app-mode) .layout{align-items:start}body:not(.app-mode) .world{overflow:visible}body:not(.app-mode) #map{width:min(100%,360px)}}
@media(min-width:851px){body.app-mode .layout{min-height:0}body.app-mode .workshop{min-height:0;overflow:auto}body.app-mode .world{min-height:0;overflow:auto}body.app-mode #program{min-height:80px}}

/* v2.10: navegación en encabezado y laboratorio con altura completa */
header{display:grid;grid-template-columns:minmax(135px,1fr) auto minmax(135px,1fr);gap:10px;align-items:center}.coding-header-logo{width:190px;height:55px}.app-actions{justify-self:end;justify-content:flex-end;gap:7px}.app-actions>.badge{display:none}header #levels,body.app-mode header #levels{justify-content:center;align-items:center;margin:0;gap:5px;flex-wrap:nowrap;min-width:0}header #levels button{padding:7px 9px;min-width:32px;font-size:12px}header #levels>select{max-width:165px;padding:7px 8px;font-size:12px}.app-actions button{font-size:12px;padding:8px 10px}.layout,body.app-mode .layout{grid-template-columns:minmax(0,1fr) minmax(0,1.08fr);gap:12px;align-items:stretch}.world,.workshop,body.app-mode .workshop{min-height:0}.workshop{display:flex;flex-direction:column}.workshop>h2{font-size:16px;margin:0 0 3px}.workshop>.muted{font-size:11px;margin:0 0 3px;line-height:1.4}#palette,body.app-mode #palette{gap:5px 7px;margin:4px 0 6px;max-height:102px;padding:0;flex-shrink:0}#palette .block:not(.loop){width:104px;max-width:104px;flex:0 0 104px;min-height:42px;height:42px}#palette .block:not(.loop) .brick-art{width:104px;height:42px;object-fit:contain}#palette .loop{width:104px;max-width:104px;flex:0 0 104px;min-height:34px;height:34px;padding:4px 6px;font-size:11px}#palette .loop .command-icon{font-size:20px}.program-head{margin:4px 0 5px}#program,body.app-mode #program{flex:1 1 0;min-height:220px;max-height:none;padding:8px 7px 20px;overflow:auto;scrollbar-width:thin}#program .node>.block:not(.loop){width:218px;max-width:100%;min-height:34px;height:34px;gap:4px;padding:0;justify-content:flex-start}#program .node>.block:not(.loop)>span:first-child{width:138px;max-width:calc(100% - 80px);min-width:0;height:34px;flex:0 1 138px}#program .node>.block:not(.loop) .brick-art{width:100%;height:34px;object-fit:contain;object-position:left center}#program .mini{height:34px;min-width:76px;width:76px;max-width:76px;flex:0 0 76px;padding:2px;gap:2px}#program .mini button{min-width:22px;min-height:26px;padding:2px 3px;font-size:11px}#program .start-brick{width:138px;max-width:100%;height:34px;min-height:34px;padding:0}.start-art{height:34px;width:100%;object-fit:contain;object-position:left center}#program>.repeat-node,.loop-body>.repeat-node{width:260px;max-width:100%;border-left-width:10px;border-bottom-width:10px}#program .repeat-node>.loop{margin-left:-10px;min-height:34px;padding:4px 6px;gap:5px}#program .repeat-node>.loop select{padding:3px;font-size:11px}#program .repeat-node>.loop .mini{height:30px}#program .repeat-node .command-icon{font-size:20px;min-width:20px}#program .loop-body{padding:5px 0 0 6px}.controls,body.app-mode .controls{margin-top:6px;gap:6px}.controls button{padding:7px 10px;font-size:12px}.speed,body.app-mode .speed{margin:5px 0;font-size:11px}.workshop details{padding-top:5px;max-height:75px;overflow:auto;font-size:11px}body:not(.on-welcome):not(.app-mode) footer{display:none}
@media(min-width:900px) and (min-height:650px){body:not(.on-welcome) main,body.app-mode main{max-width:none!important;height:100dvh;min-height:0;padding:8px 12px;display:flex;flex-direction:column;gap:8px}body:not(.on-welcome) .layout,body.app-mode .layout{flex:1;min-height:0;overflow:visible}body:not(.on-welcome) .panel,body.app-mode .panel{padding:12px;border-radius:15px}body:not(.on-welcome) .workshop,body.app-mode .workshop{min-height:0!important;height:100%;overflow:hidden}body:not(.on-welcome) .world,body.app-mode .world{min-height:0;overflow:auto;display:flex;flex-direction:column}body:not(.on-welcome) #program,body.app-mode #program{min-height:120px;max-height:none;flex:1 1 0}body:not(.on-welcome) #map,body.app-mode #map{width:min(100%,calc(100dvh - 245px));max-width:560px;min-width:160px;flex-shrink:0;margin:6px auto}#brief{font-size:13px;line-height:1.5;padding:8px 10px;margin:7px 0;min-height:0}.legend{font-size:10px;margin:5px 0}#status{font-size:12px;line-height:1.45;min-height:0;padding:9px 11px;margin:6px 0}.mission-head h2{font-size:18px}.mission-head .eyebrow{font-size:10px}.mission-head .badge{font-size:10px;padding:6px 8px}}
@media(min-width:900px) and (max-height:649px){body:not(.on-welcome):not(.app-mode) main{max-width:none!important;padding:8px 12px}.workshop,body:not(.app-mode) .workshop{min-height:460px!important}body:not(.app-mode) #program{min-height:240px;max-height:none;flex:1 1 0}body.app-mode .workshop{min-height:0!important}body.app-mode #program{min-height:70px;flex:1 1 0}body.app-mode .workshop details{max-height:45px}}
@media(max-width:1100px){.coding-header-logo{width:155px;height:48px}header{grid-template-columns:155px minmax(0,1fr) auto;gap:7px}header #levels,body.app-mode header #levels{gap:3px}header #levels button{padding:6px;min-width:27px;font-size:11px}header #levels>select{max-width:140px;padding:6px;font-size:11px}.app-actions button{padding:7px;font-size:11px}}
@media(max-width:899px){header{grid-template-columns:1fr auto;gap:7px}.coding-brand{grid-column:1;grid-row:1}.app-actions{grid-column:2;grid-row:1}header #levels,body.app-mode header #levels{grid-row:2;grid-column:1/-1;flex-wrap:wrap;margin:0 0 6px;justify-content:center}.layout,body.app-mode .layout{grid-template-columns:1fr}.workshop,body:not(.app-mode) .workshop{min-height:520px}#program,body:not(.app-mode) #program{min-height:300px;max-height:520px;flex:1 1 auto}}
@media(max-width:899px) and (orientation:landscape) and (max-height:600px){.layout,body.app-mode .layout{grid-template-columns:minmax(0,1fr) minmax(0,1.1fr)}header{grid-template-columns:1fr auto}.workshop,body:not(.app-mode) .workshop,body.app-mode .workshop{min-height:0!important}#program,body:not(.app-mode) #program,body.app-mode #program{min-height:90px;max-height:none;flex:1 1 0}.coding-header-logo,body.app-mode .coding-header-logo{width:140px;height:38px}}

/* Capítulo 3 · Explorador espacial */
.route-progress{color:#7af1da;background:#10363c;border-radius:8px;padding:7px 10px;margin:5px 0;font-size:12px;line-height:1.4}.route-progress[hidden],.motion-hint[hidden]{display:none}.motion-hint{font-size:11px;color:#ffe6a1;line-height:1.5;margin:4px 0 7px}.space-map .cell{background:#16304488;border-color:#71869877}.space-map .cell.wall{background:#59647255}.space-map .cell.goal{background:#3bc9bc22}.space-map .robot{z-index:6}.space-rover{display:block;width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 2px 3px #0008);transition:transform .2s}.station-marker{display:grid;place-items:center;position:absolute;left:3%;top:3%;width:43%;height:43%;border-radius:50%;color:#fff;font-size:15px;font-weight:900;border:2px solid #fff9;z-index:4}.station-0{background:#246de4}.station-1{background:#b88000}.station-2{background:#24885b}.station-3{background:#cb496d}.station-marker.visited,.arena-station.visited{background:#255852;opacity:.7}.station-marker.next,.arena-station.next{box-shadow:0 0 0 3px #fff6,0 0 13px #77ecf2}.open-arena{display:block!important;padding:0!important;aspect-ratio:1;position:relative;overflow:hidden}.arena-stage{position:absolute;inset:0}.arena-station,.arena-base,.arena-rover,.arena-rock{position:absolute;transform:translate(-50%,-50%);display:grid;place-items:center}.arena-station{width:12%;height:12%;border:2px solid #e3f7ff;border-radius:50%;font-size:clamp(13px,2vw,22px);font-weight:900;color:#fff;z-index:2}.arena-base{font-size:23px;width:16%;height:16%;border:2px dashed #82dccd;border-radius:50%;background:#48a89722;z-index:1}.arena-rover{width:14%;height:14%;z-index:5}.arena-rock{font-size:28px;z-index:3}.arena-ruler{position:absolute;bottom:1.5%;width:100%;text-align:center;font-size:10px;color:#b7d5e2;letter-spacing:1px}.space-map .cell .heading{font-size:15px}.block.timed{background:#175792;color:#fff;border:1px solid #74b8ff}#palette .block.timed{width:182px;max-width:182px;flex-basis:182px;font-size:12px;gap:5px;white-space:normal;line-height:1.2}#palette .block.timed .command-icon{font-size:20px;min-width:23px}#program .node>.block.timed{width:410px;max-width:100%;height:auto;min-height:38px;padding:5px;gap:5px;flex-wrap:wrap}#program .node>.block.timed>span:first-child{display:flex;align-items:center;gap:5px;flex:1 1 130px;width:auto;max-width:none;height:auto;font-size:11px}#program .node>.block.timed select{padding:4px;font-size:11px;max-width:90px;background:#123149;color:white;border:1px solid #6795b5;border-radius:5px}#program .node>.block.timed .mini{height:30px}.space-map{background-size:cover!important;background-position:center!important}body:not(.on-welcome) .world:has(.space-map) #map{width:min(100%,calc(100dvh - 300px));min-width:170px}body:not(.on-welcome) .world:has(.space-map) #brief{font-size:12px}body:not(.on-welcome) .world:has(.space-map) .legend{display:none}@media(max-width:650px){body:not(.on-welcome) .world:has(.space-map) #map{width:min(100%,380px)}.station-marker{font-size:12px}.arena-ruler{font-size:8px;letter-spacing:0}.route-progress{font-size:11px}}@media(orientation:landscape) and (max-height:600px){body:not(.on-welcome) .world:has(.space-map) #map{width:min(100%,300px)}.world:has(.space-map){overflow:auto!important}}

/* v3.1: movimiento temporal, potencia antes del tiempo */
#palette .block.timed,#program .node>.block.timed{background:linear-gradient(180deg,#42d841,#12a51d 68%,#078713);color:white;border:2px solid #78ec70;border-radius:12px;box-shadow:inset 0 3px 3px #b2ff8c88,inset 0 -4px 2px #006d21,0 3px 0 #045515;position:relative}
#palette .block.timed{min-height:56px;margin-top:8px;font-weight:800;font-size:15px}
#palette .block.timed:before,#program .node>.block.timed:before{content:'';position:absolute;top:-8px;left:22px;width:27px;height:8px;border-radius:5px 5px 0 0;background:#31c838;border:1px solid #84ed79;border-bottom:0;box-shadow:45px 0 0 #31c838;pointer-events:none}
#program .node>.block.timed{width:410px;max-width:100%;box-sizing:border-box;gap:8px;padding:8px;margin-top:8px;align-items:center}
#program .node>.block.timed>span:first-child{flex:1 1 90px;font-size:16px;font-weight:800}
#program .node>.block.timed .command-icon,#palette .block.timed .command-icon{font-size:29px}
#program .node>.block.timed .timed-field{display:flex;flex-direction:column;align-items:center;gap:2px;font-size:10px;font-weight:800;color:#fff;flex:0 0 auto}
#program .node>.block.timed select{background:#fff;color:#16321e;border:2px solid #c5e5c4;font-size:13px;font-weight:800;padding:3px;cursor:pointer;text-align:center;max-width:none}
#program .node>.block.timed .power-field select{width:57px;height:57px;border-radius:50%}
#program .node>.block.timed .time-field select{width:65px;height:36px;border-radius:10px}
#program .node>.block.timed .mini{flex:0 0 auto;margin-left:auto}
/* v3.2: pieza gráfica compacta con controles reales sobre el bloque. */
#palette .block.timed{width:180px;max-width:180px;flex:0 0 180px;height:42px;min-height:0;padding:0;margin:0;background:none;border:0;box-shadow:none;overflow:visible}
#palette .block.timed:before,#program .node>.block.timed:before{display:none}
#palette .block.timed .timed-art{width:100%;height:100%;object-fit:contain}
#program .node>.block.timed{display:grid;grid-template-columns:minmax(0,1fr) 58px;position:relative;width:418px;max-width:100%;height:64px;min-height:0;padding:0;margin:0;gap:0;background:none;border:0;border-radius:0;box-shadow:none;overflow:visible}
#program .node>.block.timed>span:first-child{display:block;width:100%;max-width:none;height:64px;grid-column:1;grid-row:1;overflow:visible}
#program .node>.block.timed .timed-art{display:block;width:100%;height:64px;object-fit:fill}
#program .node>.block.timed .timed-field{position:absolute;top:50%;transform:translateY(-50%);z-index:1;gap:0}
#program .node>.block.timed .timed-field>span{position:absolute;top:-9px;font-size:8px;color:white;text-shadow:0 1px #006500;line-height:1}
#program .node>.block.timed .power-field{left:54%}
#program .node>.block.timed .time-field{left:69%}
#program .node>.block.timed select{box-sizing:border-box;background:#fff;color:#16321e;border:1px solid #d7edcd;padding:0;font-size:11px;text-align:center;box-shadow:inset 0 -2px 2px #9bb59b66}
#program .node>.block.timed .power-field select{width:40px;height:40px;border-radius:50%}
#program .node>.block.timed .time-field select{width:49px;height:31px;border-radius:10px}
#program .node>.block.timed .mini{grid-column:2;grid-row:1;margin:0;display:flex;flex-wrap:wrap;align-self:center;height:auto}
#palette{min-height:45px;max-height:none;overflow:visible;flex-shrink:0}
@media(max-width:520px){#program .node>.block.timed{height:58px;grid-template-columns:minmax(0,1fr) 35px}#program .node>.block.timed>span:first-child,#program .node>.block.timed .timed-art{height:58px}#program .node>.block.timed .power-field{left:50%}#program .node>.block.timed .time-field{left:68%}#program .node>.block.timed .power-field select{width:33px;height:33px;font-size:10px}#program .node>.block.timed .time-field select{width:41px;height:28px;font-size:10px}}
/* v3.3: misma altura y acabado del resto de piezas. */
#palette .block.timed{width:160px;max-width:160px;flex-basis:160px;height:36px}
#program .node>.block.timed{width:310px;height:36px;grid-template-columns:minmax(0,1fr) 58px}
#program .node>.block.timed>span:first-child,#program .node>.block.timed .timed-art{height:36px}
#program .node>.block.timed .timed-field>span{top:-5px;font-size:6px}
#program .node>.block.timed .power-field{left:54%}
#program .node>.block.timed .time-field{left:69%}
#program .node>.block.timed .power-field select{width:26px;height:26px;font-size:9px}
#program .node>.block.timed .time-field select{width:36px;height:23px;font-size:9px;border-radius:7px}
@media(max-width:520px){#program .node>.block.timed{width:295px;grid-template-columns:minmax(0,1fr) 45px}#program .node>.block.timed .power-field{left:54%}#program .node>.block.timed .time-field{left:70%}}
/* v3.4: imagen y selectores comparten el mismo origen, sin sangría. */
#program .node>.block.timed:not(.loop){display:flex;justify-content:flex-start;align-items:center;flex-wrap:nowrap;width:330px;max-width:100%;height:36px;min-height:36px;gap:4px;padding:0;margin:0;transform:none}
#program .node>.block.timed:not(.loop)>span:first-child{position:relative;display:block;flex:0 1 252px;width:252px;max-width:calc(100% - 78px);min-width:0;height:36px;margin:0;padding:0;line-height:normal;transform:none}
#program .node>.block.timed:not(.loop) .timed-art{width:100%;height:36px;margin:0;object-fit:fill;object-position:left center}
#program .node>.block.timed:not(.loop) .power-field{left:65%;right:auto}
#program .node>.block.timed:not(.loop) .time-field{left:84%;right:auto}
#program .node>.block.timed:not(.loop) .timed-field select{appearance:none;-webkit-appearance:none;text-align:center;text-align-last:center;padding:0;cursor:pointer}
#program .node>.block.timed:not(.loop) .mini{position:relative;display:inline-flex;flex:0 0 74px;flex-wrap:nowrap;width:74px;margin:0;padding:0;gap:3px;align-self:center}
#program .node>.block.timed:not(.loop) .mini button{padding:3px 6px}

#palette{display:block}.palette-group{margin:6px 0;border:1px solid #3b506b;border-radius:10px;overflow:hidden}.palette-group>summary{padding:9px 12px;cursor:pointer;background:#15263c;color:#e3f8ff;font-weight:700}.palette-items{display:flex;flex-wrap:wrap;gap:8px;padding:8px}.palette-items .block{max-width:100%}.block.sensor{background:#4a267b;color:white;border:2px solid #b58de7;padding:12px;border-radius:10px;font-weight:700}#sensorReadout{padding:9px;background:#20354d;border-radius:8px;color:#bdeaff}.palette-group summary:focus-visible{outline:3px solid #55e7da}

/* v3.6: una categoría visible, sin recortar las piezas. */
#palette,body.app-mode #palette{display:block;max-height:none;min-height:100px;overflow:visible;padding:0;margin:6px 0 10px;flex:0 0 auto}
.category-picker{display:flex;align-items:center;gap:10px;font-size:12px;color:#cce5ec;margin-bottom:7px}.category-picker select{flex:1;max-width:260px;padding:7px 10px;border-color:#4a8e8b;background:#102e34;color:#e6ffff}
.category-blocks{display:flex;flex-wrap:wrap;align-items:center;gap:8px 10px;min-height:46px;padding:2px 0 4px}
#palette .block.sensor{width:196px;max-width:196px;flex:0 0 196px;height:45px;min-height:45px;margin:0;padding:0;background:none;border:0;box-shadow:none}.sensor-art{display:block;width:100%;height:100%;object-fit:fill;pointer-events:none}
#program .node>.block.sensor:not(.loop){display:flex;flex-wrap:nowrap;width:330px;max-width:100%;height:38px;min-height:38px;gap:4px;padding:0}
#program .node>.block.sensor:not(.loop)>span:first-child{display:block;position:relative;flex:0 1 250px;width:250px;max-width:calc(100% - 80px);height:38px;line-height:normal}
#program .sensor-range{position:absolute;right:4%;top:19%;height:62%;width:27%;border:1px solid #ba9f47;border-radius:7px;padding:0 2px;background:#fffdf0;color:#433a17;font-size:10px;font-weight:750;appearance:auto}
#program .node>.block.sensor .mini{height:38px}
@media(orientation:landscape) and (max-height:600px){#palette,body.app-mode #palette{min-height:86px;margin:3px 0 6px}.category-picker{margin-bottom:3px}.category-picker select{padding:4px 8px}}

#palette .block.continuous,#palette .block.halt{width:180px;max-width:180px;flex:0 0 180px;height:42px}#palette .block.continuous .brick-art,#palette .block.halt .brick-art{width:100%;height:42px}#program .node>.block.continuous:not(.loop),#program .node>.block.halt:not(.loop){width:290px}#program .node>.block.continuous:not(.loop)>span:first-child,#program .node>.block.halt:not(.loop)>span:first-child{width:210px;flex-basis:210px}

/* v3.8: prioridad al programa, paleta plegable y consignas breves. */
#palette[hidden],body.app-mode #palette[hidden]{display:none!important;min-height:0;margin:0;padding:0}
.palette-toggle{align-self:flex-start;padding:6px 10px;font-size:12px;margin:3px 0 5px;flex:0 0 auto}
.workshop .program-head{flex:0 0 auto;margin:4px 0 6px}.workshop>.controls,.workshop>.speed,.workshop>details{flex:0 0 auto}
#brief{line-height:1.45;min-height:0}#sensorReadout{font-size:11px;padding:6px 9px;margin:4px 0}
body.app-mode .workshop>.muted,body.app-mode .workshop>h2,body.app-mode .workshop>details{display:none}
body.app-mode .workshop{display:flex;flex-direction:column;overflow:auto!important;min-height:0!important}
body.app-mode #program{flex:1 0 260px!important;min-height:260px!important;max-height:none!important;overflow:auto}
body.app-mode .controls{margin-top:6px}body.app-mode .speed{margin:4px 0 0}
@media(min-width:900px), (orientation:landscape){body.app-mode .workshop{height:100%;min-height:0}body.app-mode #program{flex:1 1 0!important;min-height:180px!important}body.app-mode .layout{min-height:0!important}body.app-mode .workshop>.palette-toggle{margin-top:0}}
@media(max-width:899px) and (orientation:portrait){body.app-mode .workshop{height:85dvh;min-height:480px!important}body.app-mode #program{min-height:300px!important;flex:1 1 0!important}}
@media(orientation:landscape) and (max-height:600px){body.app-mode #program{min-height:160px!important}body.app-mode .workshop{overflow:auto!important}.palette-toggle{font-size:11px;padding:4px 8px}body.app-mode .controls button{padding:5px 9px}body.app-mode .speed{font-size:10px}}

/* v4.0 · Simulador libre y edición de escenarios */
#welcome .welcome-copy>button{margin:6px 10px 6px 0}#welcome .mode-description{color:#b5dbdf;font-size:15px}
#freeEditor[hidden]{display:none}#freeEditor{flex:0 0 auto;padding:7px 0;margin:4px 0 7px;max-height:none;overflow:visible}#freeEditor summary{font-size:12px;color:#8be9dc}#editorHint{font-size:11px;line-height:1.4;margin:6px 0}#editorTools{display:flex;align-items:center;flex-wrap:wrap;gap:6px}#editorTools button{font-size:11px;padding:6px 8px}#editorTools button.selected{outline:2px solid #60e4cf;background:#174c51}#editorTools label{font-size:11px}#editorTools select{font-size:11px;padding:4px}
#map.free-map{display:block!important;position:relative;aspect-ratio:1;padding:0!important;overflow:hidden;border:1px solid #538087;isolation:isolate;background-color:#17353c}
.free-stage{position:absolute;inset:0}.free-cell{position:absolute;margin:0;padding:0;border:1px solid #b0ebe32b;border-radius:0;background:transparent!important;box-shadow:none;z-index:2;opacity:1!important}.free-cell:disabled{cursor:default}.free-cell:enabled{cursor:crosshair}.free-cell:enabled:hover{background:#70e8dd44!important}.free-cell:focus-visible{outline:3px solid #ffe182;outline-offset:-3px}.free-no-grid .free-cell{border-color:transparent}.free-no-grid .free-cell:enabled{border:1px dashed #ffdd9a22}
.free-object{position:absolute;transform:translate(-50%,-50%);display:grid;place-items:center;font-size:clamp(15px,2.3vw,28px);pointer-events:none;z-index:3}.free-robot{z-index:4}.free-goal{border:2px dashed #86f5ce;border-radius:50%;background:#7bdfb622}.free-rock{filter:drop-shadow(0 3px 2px #0007)}
#map.theme-solar{background:radial-gradient(circle at 20% 25%,#4b817450,transparent 24%),linear-gradient(140deg,#214f54,#112f3c)!important}#map.theme-harbor{background:repeating-linear-gradient(0deg,#30667d20 0 9px,#153e5c20 9px 18px),linear-gradient(135deg,#194a61,#102c48)!important}#map.theme-mars{background:radial-gradient(ellipse at 30% 35%,#683b32 0 12%,transparent 13%),radial-gradient(ellipse at 75% 70%,#63372b 0 15%,transparent 16%),linear-gradient(135deg,#a06645,#3d292c)!important}
body.free-mode .legend{font-size:10px}body.free-mode #map{flex-shrink:0}body.free-mode .world #brief{font-size:12px}body.free-mode #sensorReadout{min-height:0;font-size:10px}

/* v4.1 · Pseudocódigo */
#codeWorkspace[hidden]{display:none!important}#codeWorkspace{display:flex;flex-direction:column;min-height:300px;flex:1 1 auto;gap:6px}#codeWorkspace>label{font-size:12px;font-weight:750}.code-intro{font-size:11px;color:#93d7de;margin:0}.code-tools{display:flex;flex-wrap:wrap;gap:7px}.code-tools button{font-size:11px;padding:6px 9px}#codeInput{display:block;box-sizing:border-box;width:100%;flex:1 1 auto;min-height:220px;resize:vertical;border:1px solid #5b91a3;border-radius:10px;padding:14px;background:#091b29;color:#d5f5e7;font:16px/1.7 ui-monospace,SFMono-Regular,Consolas,monospace;tab-size:2;white-space:pre;overflow:auto}#codeInput:focus{outline:2px solid #58dacb;outline-offset:1px}#codeFeedback{font-size:12px;line-height:1.4;margin:2px 0;color:#ffe49d;min-height:20px}.code-help{font-size:11px;max-height:160px;overflow:auto;padding:5px 0}.code-help pre{font:12px/1.55 ui-monospace,monospace;color:#bcf0dd}.code-help p{line-height:1.4}
body.code-mode #program,body.code-mode #palette,body.code-mode #togglePalette,body.code-mode #clear,body.code-mode .workshop>.muted,body.code-mode .workshop>details{display:none!important}body.code-mode .program-head{margin-top:0}body.code-mode .workshop{overflow:auto!important}body.code-mode #map .cell{background:#1c475b88}body.code-mode .code-help{display:block}body.code-mode.app-mode #codeWorkspace{min-height:260px}body.code-mode.app-mode #codeInput{min-height:170px}body.code-mode.app-mode .workshop{overflow:auto!important}
@media(orientation:landscape) and (max-height:600px){body.code-mode #codeWorkspace{min-height:240px}body.code-mode #codeInput{min-height:150px;font-size:13px}.code-intro{font-size:10px}}

#palette .block.infrared{width:196px;max-width:196px;flex:0 0 196px;height:45px;min-height:45px;margin:0;padding:0;background:none;border:0;box-shadow:none}.infrared-art{display:block;width:100%;height:100%;object-fit:fill;pointer-events:none}
#program .node>.block.infrared:not(.loop){display:flex;flex-wrap:nowrap;width:330px;max-width:100%;height:38px;min-height:38px;gap:4px;padding:0}
#program .node>.block.infrared:not(.loop)>span:first-child{display:block;position:relative;flex:0 1 250px;width:250px;max-width:calc(100% - 80px);height:38px;line-height:normal}
#program .node>.block.infrared .mini{height:38px}
.floor-lines{position:absolute;inset:0;pointer-events:none}.floor-lines svg{display:block;width:100%;height:100%}

.robot-picker{position:fixed;inset:0;margin:auto;width:min(760px,calc(100% - 28px));box-sizing:border-box;max-height:88dvh;overflow:auto;padding:26px;border:1px solid #4aa98d;border-radius:20px;background:#102c32;color:#ecfff5;font:15px/1.6 system-ui}.robot-picker::backdrop{background:#03131bd9}.robot-picker h2{font-size:26px;margin:0 0 9px}.robot-picker>p{color:#b9d9d1}.robot-models{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin:20px 0}.robot-models article{padding:16px 12px;background:#15383d;border:1px solid #3f6564;border-radius:15px;text-align:center}.robot-models img,.picker-original{display:block;width:120px;height:120px;max-width:100%;margin:0 auto 12px;object-fit:contain}.picker-original{background:url(robot-poses.png) 0 0/300% 200% no-repeat}.robot-models h3{font-size:19px;margin:0 0 8px}.robot-models small{display:block;color:#f1d282;font-size:10px;font-weight:700}.robot-models p{font-size:12px;color:#b4d2cc;min-height:38px}.robot-models button{width:100%;padding:9px 5px;font-size:12px}.robot-models button[aria-pressed=true]{background:#5cdec4;color:#092c24;border-color:#8cffe2}.cell .custom-rover{width:85%;height:85%;object-fit:contain;position:absolute;inset:0;margin:auto}.app-actions #changeRobot{white-space:nowrap}@media(max-width:650px){.robot-models{grid-template-columns:1fr}.robot-models article{display:grid;grid-template-columns:100px 1fr;column-gap:14px;align-items:center}.robot-models img,.picker-original{grid-row:1/4;width:95px;height:95px;margin:0}.robot-models h3,.robot-models p{margin:0;min-height:0}.robot-models button{margin-top:10px}.robot-picker{padding:20px}.app-actions{flex-wrap:wrap}}

@media(max-width:650px){.app-actions{max-width:min(55vw,230px);gap:5px}.app-actions button{font-size:11px;padding:6px 8px}.coding-header-logo{max-width:100%;height:45px}}

.program-mode-tools{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:10px 0}.program-mode-tools>button{width:auto!important;margin:0!important;flex:0 1 auto}.program-mode-tools>button[hidden]{display:none!important}

.editor-toolbar{display:flex;align-items:center;gap:6px;flex-wrap:wrap}.editor-toolbar #editorTools{display:contents}.editor-toolbar #changeRobot{font-size:11px;padding:6px 8px;margin:0;min-height:0;width:auto;flex:0 0 auto;background:#493c68;color:#f3eaff;border:1px solid #8f77ba}.editor-toolbar #changeRobot:hover{background:#5b4982}

#program .color-choice{position:absolute;right:4%;top:19%;height:62%;width:29%;border:1px solid #b493ef;border-radius:7px;padding:0 2px;background:#fcf6ff;color:#3b205e;font-size:10px;font-weight:750}#palette .block.color{background:transparent;border:0}#program .block.color{background:transparent;border:0}#program .block.color>span:first-child{position:relative}.robot-models{grid-template-columns:repeat(auto-fit,minmax(190px,1fr))}@media(max-width:650px){.robot-models{grid-template-columns:1fr}}

#palette .block.color{width:196px;max-width:196px;flex:0 0 196px;height:45px;min-height:45px;margin:0;padding:0;box-shadow:none}#program .node>.block.color:not(.loop){display:flex;flex-wrap:nowrap;width:330px;max-width:100%;height:38px;min-height:38px;gap:4px;padding:0}#program .node>.block.color:not(.loop)>span:first-child{display:block;position:relative;flex:0 1 250px;width:250px;max-width:calc(100% - 80px);height:38px;line-height:normal}#program .node>.block.color .mini{height:38px}
