*{box-sizing:border-box}body{margin:0;background:#f1f5f1;color:#284335;font:15px system-ui,-apple-system,"Segoe UI",sans-serif;min-height:100dvh}body.in-game{height:100dvh;display:flex;flex-direction:column}button,select,input,a{font:inherit}button,select,input{min-height:44px;border:1px solid #cddccf;border-radius:9px;background:#fff;color:inherit;padding:8px 11px}button{cursor:pointer}button:disabled{opacity:.45;cursor:default}button:hover:enabled{filter:brightness(.97)}button,a,select{touch-action:manipulation}:focus-visible{outline:3px solid #ad7f2c;outline-offset:3px}[hidden]{display:none!important}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}.topbar{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:8px 22px;background:#fff;border-bottom:1px solid #dce5dc;flex-shrink:0}.topbar a{display:flex;align-items:center;min-height:44px;color:#516953;text-decoration:none}.topbar strong{font-size:20px}.topbar strong span{color:#539a72;margin-right:8px}.lobby{max-width:1240px;margin:auto;padding:34px 24px 60px}.lobby-heading{display:flex;justify-content:space-between;align-items:end;gap:20px;margin-bottom:26px}.eyebrow{font-size:11px;letter-spacing:2px;font-weight:750;color:#648568}.lobby h1{font-size:clamp(26px,3.5vw,42px);letter-spacing:-1px;margin:10px 0}.lobby p{color:#677a68;line-height:1.6;margin:5px 0}#progressSummary{background:#e4ede1;color:#4d704e;padding:12px 18px;border-radius:24px;font-size:13px;white-space:nowrap}.character-panel{display:flex;align-items:center;justify-content:space-between;gap:20px;background:#fff;border:1px solid #dce5d9;border-radius:18px;padding:18px 22px;margin-bottom:28px}.character-panel h2{font-size:17px;margin:0}.character-panel p{font-size:13px}#characters{display:flex;gap:8px;max-width:65%;overflow:auto;padding:5px}.character-card{display:flex;flex-direction:column;gap:4px;align-items:center;min-width:80px;max-width:130px;font-size:12px;flex-shrink:0}.character-card img{width:42px;height:42px;object-fit:contain;image-rendering:pixelated}.robot-icon{font-size:30px}.character-card[aria-pressed=true]{border:2px solid #559167;background:#eef5ea}.character-card span:last-child{max-width:110px;overflow-wrap:anywhere}.level-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:18px}.level-card{position:relative;aspect-ratio:1;display:flex;flex-direction:column;align-items:start;justify-content:end;padding:20px;border:1px solid #d4e0d1;background:#fff;border-radius:20px;overflow:hidden;transition:transform .16s,box-shadow .16s;text-align:left}.level-card:hover{transform:translateY(-3px);box-shadow:0 12px 25px #38523712}.level-card strong{font-size:17px;margin-top:12px;z-index:1}.level-number{position:absolute;top:16px;left:18px;color:#71966d;font-size:25px;font-weight:800}.level-status{font-size:12px;margin-top:7px;color:#758272}.level-card.completed{border-color:#82b17e;background:#f2f8ee}.level-card.completed .level-status{color:#32704b}.level-card.played .level-status{color:#986d29}.mini-map{display:grid;gap:2px;width:57%;aspect-ratio:4/3;align-self:end;margin-top:22px;opacity:.8}.mini-map i{border-radius:2px;background:#cadcc6}.mini-map .road{background:#f6e9c6}.account-notice{display:flex;justify-content:center;gap:12px;align-items:center;background:#fff0c9;padding:8px;font-size:13px}.account-notice button{flex-shrink:0}
main{padding:12px 18px;flex:1;min-height:0;display:flex;flex-direction:column;gap:10px}.taskbar{display:flex;justify-content:space-between;align-items:center;gap:10px}.taskbar p{margin:6px 0 0;font-size:14px}.taskbar select{margin-left:8px}.task-actions{display:flex;gap:8px}.studio{display:grid;grid-template-columns:minmax(0,3fr) minmax(340px,2fr);gap:14px;min-height:0;flex:1}.world-panel,.editor{min-width:0;background:#fff;border:1px solid #d7e3d9;border-radius:18px;padding:12px;display:flex;flex-direction:column;min-height:0}.panel-head,.program-heading{display:flex;justify-content:space-between;align-items:center;gap:8px}.panel-head h1,.panel-head h2,.program-heading h2{margin:0;font-size:17px}.panel-head>span,.program-heading>span{font-size:12px;color:#72806f}.map-scroll{overflow:auto;flex:1;min-height:0;margin:8px 0;touch-action:pan-x pan-y;overscroll-behavior:contain;border-radius:12px;background:#f6f8f4}#mapScale{min-width:100%;height:100%;min-height:100%}#map{width:100%;height:100%;display:block}.map-controls{display:flex;align-items:center;gap:6px;flex-wrap:wrap;font-size:12px}.map-controls button{font-size:12px;min-width:44px}.map-controls output{min-width:40px;text-align:center}#position{margin-left:auto}#sensorReadings{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px}#sensorReadings span{font-size:11px;border-radius:7px;background:#edf4e9;padding:5px 7px}#palette{display:flex;flex-wrap:wrap;gap:7px;margin:12px 0;max-height:155px;overflow:auto;flex-shrink:0;padding-bottom:5px}#palette button{background:#5b9f88;color:#fff;border:1px solid #478e76;border-radius:5px;font-size:13px;font-weight:600;text-align:left;position:relative}#palette .palette-control{background:#60a75c;border-color:#4a9046}.editor-guide{font-size:11px;line-height:1.5;color:#71806e;margin:7px 0}.program-heading{border-top:1px solid #e3eae0;padding-top:8px}.program-heading>button{margin-left:auto;font-size:12px}.program-heading>span{margin-left:auto}.program{--workspace:#fafcf8;flex:1;min-height:120px;overflow:auto;overscroll-behavior:contain;background:radial-gradient(#dce5d7 1px,transparent 1px) 0 0/18px 18px,var(--workspace);border-radius:10px;padding:20px 16px 50px}.start{position:relative;display:table;background:#dfb451;border:1px solid #cba03d;color:#4a411f;font-weight:750;padding:10px 20px;border-radius:16px 16px 3px 3px;min-height:44px;cursor:pointer;margin-bottom:3px}.block{--block:#5ba58b;--edge:#478e74;position:relative;background:var(--block);border:1px solid var(--edge);border-radius:4px;margin:3px 0 0;width:max-content;min-width:165px;max-width:100%;color:#fff;padding-bottom:1px}.block.control-block{--block:#63a65b;--edge:#4d8b46;min-width:220px;padding-bottom:9px}.block:before{content:"";position:absolute;top:-1px;left:18px;width:24px;height:6px;background:var(--workspace);border-radius:0 0 5px 5px;z-index:2;border-bottom:1px solid var(--edge)}.block:after,.start:after{content:"";position:absolute;bottom:-6px;left:18px;width:24px;height:7px;background:var(--block,#dfb451);border:1px solid var(--edge,#cba03d);border-top:0;border-radius:0 0 5px 5px;z-index:3}.block-head{display:flex;align-items:center;gap:6px;min-height:48px;padding:5px 10px 5px 6px;border-radius:3px;touch-action:none;cursor:grab;user-select:none;flex-wrap:wrap;max-width:100%}.block-head strong{font-size:13px;font-weight:650}.block-head>span{font-size:13px}.grip{color:#ffffff80;font-size:19px!important}.block-head select,.block-head input{padding:6px;min-height:44px;max-width:100%;background:#ffffffd4;border:1px solid #ffffff6b;color:#285443;border-radius:4px;font-size:13px;touch-action:manipulation;cursor:pointer}.block-head input{width:65px}.branch{display:grid;grid-template-columns:44px minmax(0,1fr);margin:0 -1px 0 0}.branch-label{font-size:12px;min-height:44px;padding:12px 3px;color:#eff9eb;cursor:pointer;align-self:start;overflow-wrap:anywhere}.branch-body{background:var(--workspace);border-radius:5px 0 0 5px;min-width:70px;min-height:48px;padding:4px 0 7px 0;box-shadow:inset 1px 1px 0 #43774230}.branch-body>.block{margin-left:0}.empty-cavity{min-height:44px;min-width:70px;cursor:pointer}.selected{box-shadow:inset 0 0 0 2px #f6d464!important}.block-head.selected{background:#ffffff16}.empty-cavity.selected{background:#f2e9b5}.executing{outline:3px solid #e5b630;outline-offset:0}.drop-after{box-shadow:0 5px 0 0 #e1ac32!important}.drop-inside{outline:3px dashed #e1ac32;outline-offset:-3px}.drag-source{opacity:.25}.drag-ghost{position:fixed!important;z-index:9999;pointer-events:none;opacity:.85;box-shadow:0 12px 28px #183f3340;max-height:65vh;overflow:hidden;transform:rotate(1deg);--workspace:#fff}.execution{display:flex;flex-wrap:wrap;gap:6px;border-top:1px solid #deeadf;padding-top:8px;margin-top:8px}.execution button,.execution label{font-size:12px}.execution label{display:flex;align-items:center;gap:4px}.primary{background:#467d55;color:#fff;border:0}#feedback{margin:0;background:#fff4d9;border-radius:10px;padding:10px 14px;font-size:13px;min-height:44px}#feedback.success{background:#d9f0df;color:#235d38}#feedback.error{background:#ffe8df;color:#8a392b}#hint{margin:0;padding:10px 14px;background:#e8eeda;border-radius:10px;font-size:13px}#mazeFullscreenStatus{margin:0;text-align:center}#mazeFullscreenStatus:not(:empty){padding:8px;background:#ffeab9}
@media(max-width:1000px){.level-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.lobby-heading{align-items:start;flex-direction:column;gap:10px}}
@media(max-width:1000px) and (orientation:portrait){body.in-game{height:auto;min-height:100dvh}.studio{grid-template-columns:1fr;flex:none}.world-panel{height:600px;flex-shrink:0}.editor{height:760px}main{flex:none}.taskbar{flex-wrap:wrap}}
@media(max-width:650px){body.in-game{height:auto}.topbar{padding:6px 10px}.topbar strong{font-size:15px}.topbar a,.topbar button{font-size:12px}.lobby{padding:25px 14px}.level-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.level-card{padding:12px;border-radius:14px}.level-card strong{font-size:13px}.level-number{font-size:20px;left:12px;top:10px}.level-status{font-size:11px}.mini-map{width:55%;margin-top:20px}.character-panel{padding:14px;align-items:start;flex-direction:column;gap:10px}#characters{max-width:100%}main{padding:10px}.studio{grid-template-columns:1fr}.world-panel{height:390px}.editor{height:740px}.taskbar{flex-wrap:wrap}.taskbar select{max-width:210px;margin-left:4px;font-size:13px}.taskbar>div:first-child{display:flex;flex-wrap:wrap;gap:5px}.taskbar p{width:100%}#position{margin-left:0}.program{padding:15px 8px 40px}.block.control-block{min-width:190px}.branch{grid-template-columns:35px minmax(0,1fr)}.branch-label{min-width:44px}.account-notice{flex-wrap:wrap}}

button,select,input{min-width:44px}.branch-label{min-width:44px}@media(max-width:650px){.branch{grid-template-columns:44px minmax(0,1fr)}}

/* Compact cards and blocks: content determines width, not empty fixed boxes. */
.block-actions{display:flex;gap:4px;flex-shrink:0}
.block-actions button{display:grid;place-items:center;width:44px;height:44px;padding:5px}
.block-actions svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.block-actions #deleteSelected{color:#934332}
@media (pointer:fine) and (hover:hover) and (not (any-pointer:coarse)){.block-actions button{width:28px;height:28px;min-width:28px;min-height:28px;border-radius:5px}}
.lobby{max-width:1240px;padding:20px 22px 32px}
.lobby-heading{margin-bottom:14px;gap:12px;align-items:center;flex-direction:row}
.lobby h1{font-size:26px;letter-spacing:-.5px;margin:5px 0}
.lobby p{font-size:13px;margin:2px 0}
.eyebrow{font-size:10px;letter-spacing:1.3px}
#progressSummary{padding:8px 12px;font-size:12px}
.character-panel{padding:8px 12px;margin-bottom:16px;border-radius:10px;gap:12px}
.character-panel h2{font-size:14px}.character-panel p{font-size:12px}
#characters{padding:2px;gap:6px}
.character-card{flex-direction:row;min-width:44px;max-width:170px;padding:5px 8px;gap:6px}
.character-card img{width:28px;height:28px}
.level-grid{grid-template-columns:repeat(auto-fill,minmax(138px,1fr));gap:10px}
.level-card{padding:10px;border-radius:10px;aspect-ratio:1;justify-content:end}
.level-number{top:9px;left:10px;font-size:18px;line-height:1}
.mini-map{width:58px;gap:1px;margin:12px 0 7px;flex-shrink:0}
.mini-map i{border-radius:1px}
.level-card strong{font-size:13px;line-height:1.25;margin-top:0}
.level-status{font-size:10px;margin-top:5px}
.program{padding:10px 9px 28px;border-radius:5px}
.block,.block.control-block{min-width:0;width:max-content;border-radius:3px;margin-top:-1px}
.start{margin-bottom:0}
.block.control-block{padding-bottom:5px}
.block-head{gap:4px;padding:2px 6px;min-height:44px}
.block-head strong{font-weight:500}.grip{display:none}
.block-head select,.block-head input{border:0;border-radius:2px;padding:2px 4px}
.block-head input{width:52px}
.block:before{left:12px;width:18px;height:5px;border-radius:0 0 4px 4px}
.block:after,.start:after{left:12px;width:18px;height:5px;bottom:-5px;border-radius:0 0 4px 4px}
.branch-body{position:relative;min-width:48px;padding:0 0 4px;border-radius:3px 0 0 3px}
.branch-body>.block:first-child{margin-top:0}
/* The cavity's connector shares the child's notch geometry. */
.branch-body:before{content:"";position:absolute;top:0;left:13px;width:18px;height:5px;background:var(--block);border:1px solid var(--edge);border-top:0;border-radius:0 0 4px 4px;z-index:3;pointer-events:none}
.empty-cavity{min-width:48px}
.branch-label{padding:8px 3px;line-height:1.2}
.program-heading{padding-top:5px}.program-heading h2,.panel-head h2{font-size:14px}
.editor-guide{margin:4px 0;font-size:10px;line-height:1.4}
#palette{gap:5px;margin:7px 0;max-height:120px;padding-bottom:3px}
#palette button{font-size:12px;padding:4px 7px;border-radius:3px;font-weight:500}
.execution{gap:5px;padding-top:6px;margin-top:6px}
@media (pointer:fine) and (hover:hover) and (not (any-pointer:coarse)){
  .block-head{min-height:26px}
  .block-head select,.block-head input{min-height:20px;height:20px;min-width:28px;font-size:13px;line-height:16px}
  .branch{grid-template-columns:22px minmax(0,1fr)}
  .branch-label{min-width:22px;min-height:26px;padding:5px 2px}
  .branch-body{min-height:28px}.empty-cavity{min-height:26px}
  .start{min-height:26px;padding:4px 12px;border-radius:10px 10px 3px 3px;font-size:13px;font-weight:600}
  #palette button{min-height:28px;min-width:28px}
  .editor .panel-head button,.program-heading button,.execution button,.execution select{min-height:28px;min-width:28px;padding:4px 8px;border-radius:5px}
}
@media(max-width:650px){
  .lobby{padding:16px 12px}.lobby-heading{flex-direction:column;align-items:start;gap:7px}
  .lobby h1{font-size:22px}.level-grid{grid-template-columns:repeat(auto-fill,minmax(130px,1fr));gap:8px}
  .character-panel{flex-direction:row;flex-wrap:wrap;gap:8px}.character-panel p{max-width:230px}
  .block.control-block{min-width:0}.program{padding:10px 6px 24px}
}
@media (pointer:fine) and (hover:hover) and (not (any-pointer:coarse)){
  .branch{grid-template-columns:max-content minmax(0,1fr)}
  .branch-label{min-width:26px;white-space:nowrap;overflow-wrap:normal;padding:5px 3px}
}

/* Short, non-blocking goal celebration. */
.maze-celebration{position:fixed;inset:0;z-index:100;pointer-events:none;overflow:hidden}
.victory-badge{position:absolute;top:18%;left:50%;transform:translateX(-50%);display:flex;flex-direction:column;align-items:center;gap:4px;padding:16px 28px;background:#fffdf3;border:2px solid #e6bd54;border-radius:18px;box-shadow:0 12px 40px #28433526;color:#355d3e;white-space:nowrap;animation:victory-arrive 3.5s both}
.victory-badge strong{font-size:28px}.victory-badge>span:last-child{font-size:14px}.victory-star{font-size:42px;line-height:1;color:#dda72b}
.victory-confetti{position:absolute;left:var(--x);top:-20px;width:8px;height:13px;border-radius:2px;animation:victory-fall 2.8s var(--delay) ease-in both}
.goal-sparkle{fill:#f8d56230;stroke:#e7b637;stroke-width:3;transform-box:fill-box;transform-origin:center;animation:victory-ring .8s ease-out 4}
@keyframes victory-arrive{0%{opacity:0;transform:translate(-50%,15px) scale(.75)}12%,85%{opacity:1;transform:translate(-50%,0) scale(1)}100%{opacity:0;transform:translate(-50%,-10px)}}
@keyframes victory-fall{0%{opacity:0;transform:translate(0,-20px) rotate(0)}10%{opacity:1}100%{opacity:0;transform:translate(var(--drift),100vh) rotate(600deg)}}
@keyframes victory-ring{0%{opacity:1;transform:scale(.75)}100%{opacity:0;transform:scale(1.7)}}
@media(prefers-reduced-motion:reduce){.victory-confetti{display:none}.victory-badge,.goal-sparkle{animation:none}}

.game-navigation,.topbar-actions{display:flex;align-items:center;gap:12px}.game-navigation a{font-size:13px;white-space:nowrap}.game-navigation a+a{border-left:1px solid #dce5dc;padding-left:12px}.topbar-actions{gap:6px}.help-button{width:44px;height:44px;padding:10px;display:grid;place-items:center}.help-button svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round}.level-task{font-size:13px;line-height:1.5;margin:6px 0 0}.game-feedback{display:flex;gap:8px;align-items:center}.game-feedback #feedback{flex:1}.game-feedback button{flex-shrink:0;font-size:13px}.game-help{width:min(660px,calc(100% - 24px));max-height:85dvh;padding:18px;border:1px solid #cddccf;border-radius:16px;color:#284335;background:#fafcf8;overflow:auto;overscroll-behavior:contain}.game-help::backdrop{background:#142a2266}.game-help>header{display:flex;align-items:center;justify-content:space-between;gap:12px}.game-help h2{font-size:20px;margin:0}.game-help>p{font-size:13px;line-height:1.6}.game-help #helpClose{font-size:24px;width:44px;padding:0}.help-items{display:grid;grid-template-columns:1fr 1fr;gap:10px}.help-item{display:flex;align-items:start;gap:10px;padding:10px;background:#fff;border:1px solid #dce5dc;border-radius:10px}.help-item svg{width:52px;height:52px;flex-shrink:0}.help-item h3{font-size:14px;margin:0 0 4px}.help-item p{font-size:12px;line-height:1.5;margin:0}.help-tip{background:#edf4e9;padding:10px;border-radius:8px}
@media(max-width:950px){.topbar{flex-wrap:wrap;gap:4px 10px}.topbar>strong{display:none}}
@media(max-width:520px){.game-navigation{gap:7px}.game-navigation a{font-size:11px}.game-navigation a+a{padding-left:7px}.topbar-actions{margin-left:auto}.help-items{grid-template-columns:1fr}.game-feedback{flex-wrap:wrap}.game-feedback #feedback{flex-basis:100%}}
.crash-dialog{width:min(350px,calc(100% - 24px));padding:24px;text-align:center;border:2px solid #db856c;border-radius:18px;background:#fff8f2;color:#763d32;box-shadow:0 18px 60px #522b3440;animation:crash-arrive .5s ease-out}.crash-dialog::backdrop{background:#4e202866}.crash-dialog h2{margin:8px 0;font-size:28px}.crash-dialog p{margin:8px 0 20px}.crash-dialog button{margin:4px;font-size:13px}.crash-mark{display:block;color:#dc7454;font-size:70px;line-height:1;animation:crash-burst .65s ease-out}.crash-dialog .primary{background:#9b503d}@keyframes crash-arrive{0%{transform:translateX(-15px);opacity:0}25%{transform:translateX(12px)}50%{transform:translateX(-8px)}75%{transform:translateX(4px)}100%{transform:translateX(0);opacity:1}}@keyframes crash-burst{0%{transform:scale(.3) rotate(-35deg)}70%{transform:scale(1.2) rotate(10deg)}100%{transform:scale(1) rotate(0)}}@media(prefers-reduced-motion:reduce){.crash-dialog,.crash-mark{animation:none}}
