/* One workspace: commands, a full-height script editor, then the stage. */
body{height:100dvh;overflow:hidden}
.topbar{height:64px;min-height:0;padding:0 18px;gap:16px;flex-wrap:nowrap}
.brand img{width:100px;height:38px}.brand>span:last-child{font-size:8px}.brand b{font-size:10px}
.level-nav{order:0;width:auto;flex-basis:auto;margin:0;gap:5px}
.level-button{min-width:31px;width:31px;height:34px;font-size:12px;border-radius:12px}
.header-tools .icon-button{min-width:34px;width:34px;height:34px}
.workspace{height:calc(100dvh - 64px);min-height:0;max-width:none;margin:0;padding:14px;gap:14px;display:grid;grid-template-columns:148px minmax(310px,.667fr) minmax(390px,1.633fr);grid-template-rows:minmax(0,1fr)}
.coding-panel{display:contents}.panel-intro{display:none}
.toolbox{grid-column:1;grid-row:1;min-width:0;padding:14px 8px;border:0;border-radius:13px;background:#f7faef}
.section-label{margin-bottom:14px;padding:0 3px}.section-label h2{font-size:12px}.section-label span{display:none}
#palette{display:grid;grid-template-columns:minmax(0,1fr);gap:14px}
.command{min-height:38px;font-size:12px;padding:7px 10px;gap:7px}.command .icon{width:16px;height:16px}
.editor-panel{grid-column:2;grid-row:1;display:flex;flex-direction:column;min-width:0;min-height:0;border:1px solid #d6e3ce;border-radius:14px;background:#f9fcf3;box-shadow:0 3px 0 #d8e4cf;overflow:hidden}
.program-section{display:flex;flex-direction:column;flex:1;min-height:0;min-width:0;padding:13px 12px 0}
.program-heading{margin-bottom:6px;min-height:30px}.program-title{font-size:13px}.text-button{min-height:30px}
.program-meta{display:flex;margin-bottom:8px;font-size:10px}.program-meta>span:first-child{font-size:10px}
.program{flex:1;min-height:0;max-height:none;padding:12px 10px 18px;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable;border-radius:9px 9px 0 0;background-color:#edf4e7}
.program>.block,.program>.root-target{width:min(100%,340px)}
.program-empty{min-height:90px}.program-empty small{display:none}
.run-area{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:8px;flex:0 0 auto;padding:12px;border:0;border-top:1px solid #dae6d0}
.play-controls{gap:7px}.run-button{min-height:40px;padding:9px 12px;font-size:13px}.secondary-button{min-width:38px;min-height:40px;padding:5px 9px;font-size:19px}.step-button span{font-size:8px}
.run-footer{margin:0}.speed-button{min-height:36px;font-size:10px;gap:4px}
.play-panel{grid-column:3;grid-row:1;order:0;display:flex;flex-direction:column;min-width:0;min-height:0;position:relative}
.mission{min-height:64px;flex:0 0 auto;gap:9px;align-items:center;padding:0 0 12px}
.mission-number{display:none}.mission .eyebrow{display:none}.mission-copy{min-width:0}
.mission h2{font-size:22px;margin:0 0 6px;padding:5px 12px}.mission p{font-size:11px;line-height:1.35;margin:0}
.hint-button{min-width:50px;min-height:36px;font-size:11px;padding:6px 8px;margin-left:auto;flex:none}.hint-button span{display:none}
.farm-world{flex:1;min-height:0;border-radius:17px;overflow:hidden}
.world-top{padding:12px 14px 0}.location{font-size:8px;letter-spacing:.8px}.weather{font-size:23px}.weather span,.world-note,.learning-footer{display:none}
.objectives{top:40px;gap:7px}.objective{font-size:10px;padding:5px 9px}.objective .icon{width:14px;height:14px}
.scene{position:absolute;inset:58px 0 37px;width:100%;height:calc(100% - 95px);min-width:0;min-height:0;max-height:none;margin:0}
.world-bottom{position:absolute;inset:auto 0 0;padding:0 10px 10px;margin:0}.direction-tag{font-size:9px;padding:6px 8px}
.feedback{flex:0 0 auto;min-height:43px;margin-top:10px;padding:6px 10px;gap:8px;border-radius:10px;box-shadow:none}.feedback>img{height:29px;width:23px}.feedback b{display:none}.feedback p{margin:0;font-size:11px;line-height:1.35}.feedback-decoration{display:none}
.has-thought .feedback{visibility:hidden}
/* An action label lives over the scene, so the farm never changes height mid-run. */
.action-notice{position:absolute;z-index:4;top:104px;left:50%;transform:translateX(-50%);max-width:calc(100% - 24px);width:max-content;margin:0;padding:6px 11px;gap:6px;border-radius:12px;pointer-events:none;box-shadow:0 2px 8px #36574019}
.action-notice>span{min-width:18px;font-size:19px}.action-notice strong{font-size:11px}.action-notice p{display:none}
/* Compact landscape tablet keeps all three areas side by side. */
@media(min-width:960px) and (max-width:1150px){
 .workspace{padding:10px;gap:10px;grid-template-columns:122px 312px minmax(330px,1fr)}
 .toolbox{padding:13px 7px}.command{font-size:11px;padding:7px 8px}.mission h2{font-size:19px}
 .program-section{padding:11px 9px 0}.program{padding:12px 6px 16px}.header-tools{gap:6px}.brand-divider,.brand>span:last-child{display:none}
}
/* Small landscape tablet: editor and stage share the width; commands use the drawer. */
@media(min-width:600px) and (max-width:959px){
 .topbar{height:96px;padding:6px 14px;flex-wrap:wrap;gap:5px}.level-nav{order:3;flex-basis:100%;width:100%;justify-content:space-between}.level-button{height:30px}.header-tools{margin-left:auto}
 .workspace{height:calc(100dvh - 96px);grid-template-columns:minmax(278px,1fr) minmax(280px,1.05fr);padding:10px;gap:10px}
 .toolbox{display:none}.editor-panel{grid-column:1}.play-panel{grid-column:2}
 .add-command{display:inline-flex;align-items:center;margin-left:auto;min-height:30px;padding:4px 8px;border:1px solid #a8c396;border-radius:7px;background:#e7f2db;color:#42683b;font-size:11px;font-weight:800}
 .program-section{padding:10px 7px 0}.program{padding:10px 4px 16px}.program-heading{gap:6px}.text-button{font-size:10px}.run-area{padding:9px 7px;gap:5px}
 .mission{min-height:72px}.mission h2{font-size:18px;padding:4px 7px}.mission p{font-size:10px}.location{font-size:7px}.objective{font-size:9px;padding:5px 7px;gap:4px}.objectives{gap:5px}
 .scene{inset:61px 0 34px;height:calc(100% - 95px)}.feedback p{font-size:10px}.action-notice{top:111px}
}
.program .block-row{touch-action:pan-y}
.program .drag-handle{touch-action:none}
.command-dialog[open]{display:flex;flex-direction:column;overflow:hidden;padding-bottom:max(16px,env(safe-area-inset-bottom))}
.command-dialog-heading{flex:none}
.command-dialog .palette{min-height:0;overflow:auto;overscroll-behavior:contain;padding:0 3px 8px}
.command-dialog .command{touch-action:pan-y;flex-shrink:0}
@media(max-width:599px){
 .program{scroll-padding:8px;scrollbar-color:#819b6b #edf4e7}
}
/* Phone: the stage stays visible over a wide editor; one-column command drawer. */
@media(max-width:599px){
 .topbar{height:84px;min-height:0;flex-wrap:wrap;padding:6px 11px;gap:4px 8px}.brand img{width:84px;height:29px}.brand-divider,.brand>span:last-child{display:none}.header-tools{margin-left:auto}
 .header-tools .icon-button{min-width:28px;width:28px;height:28px}.level-nav{order:3;width:100%;flex-basis:100%;justify-content:space-between;gap:2px}.level-button{min-width:25px;width:25px;height:27px;font-size:10px;border-radius:9px}
 .workspace{height:calc(100dvh - 84px);display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) clamp(236px,48dvh,420px);gap:9px;padding:9px 9px max(9px,env(safe-area-inset-bottom))}
 .toolbox{display:none}.play-panel{grid-column:1;grid-row:1}.editor-panel{grid-column:1;grid-row:2;order:1;border-radius:12px}
 .program-section{padding:7px 8px 0}.program-heading{margin-bottom:5px}.program-meta{display:none}.program{padding:9px 3px 13px}.program>.block,.program>.root-target{width:100%}
 .add-command{display:inline-flex}.run-area{padding:8px;gap:6px}.run-button{min-height:35px;padding:7px 10px;font-size:12px}.secondary-button{min-height:35px;min-width:34px;padding:3px 7px}.speed-button{font-size:9px}
 .mission{min-height:53px;padding-bottom:8px;gap:7px}.mission h2{font-size:16px;padding:3px 7px;margin-bottom:4px}.mission p{font-size:9px}.hint-button{min-width:42px;min-height:30px;font-size:10px}
 .world-top{padding:8px 10px 0}.location{font-size:7px}.weather{font-size:19px}.objectives{top:26px}.objective{font-size:9px;padding:4px 6px}.scene{inset:47px 0 26px;height:calc(100% - 73px)}.world-bottom{padding:0 8px 7px}.direction-tag{font-size:8px;padding:4px 6px}
 .feedback{display:none}.action-notice{top:83px;padding:4px 8px}.action-notice strong{font-size:10px}.action-notice>span{font-size:15px;min-width:15px}
}
@media(max-width:599px) and (max-height:650px){.workspace{grid-template-rows:minmax(0,1fr) 236px}.mission p{display:none}.mission{min-height:36px}.action-notice{top:66px}.scene{inset:43px 0 24px;height:calc(100% - 67px)}}
@media(min-width:600px) and (max-height:500px){.topbar{height:63px;padding:3px 10px}.level-button{height:23px;min-width:24px;width:24px}.workspace{height:calc(100dvh - 63px)}.feedback{display:none}.mission{min-height:44px;padding-bottom:7px}.mission h2{font-size:15px}.mission p{display:none}.action-notice{top:83px}}
.command-dialog .palette{grid-template-columns:minmax(0,1fr);gap:11px}.command-dialog{max-height:85dvh;padding:14px 18px 20px}.command-dialog .command{min-height:36px;font-size:12px}.command-dialog-heading{margin-bottom:10px}.command-dialog p{font-size:11px}
.farm-world{background:radial-gradient(ellipse at 20% 12%,var(--world-glow,#fff5ce),transparent 55%),linear-gradient(155deg,var(--world-sky,#e7f4d9),var(--world-floor,#b5d7b3))}
.farm-world>.action-notice{top:72px;bottom:auto}
@media(max-width:599px){.farm-world>.action-notice{top:51px}}
/* Portrait tablets use the available width for the farm and a broad editor below. */
@media(min-width:600px) and (max-width:1100px) and (orientation:portrait){
 .topbar{height:96px;padding:6px 14px;flex-wrap:wrap;gap:5px}.level-nav{order:3;flex-basis:100%;width:100%;justify-content:space-between}.level-button{height:30px}.header-tools{margin-left:auto}
 .workspace{height:calc(100dvh - 96px);grid-template-columns:130px minmax(0,1fr);grid-template-rows:minmax(0,1fr) minmax(365px,1fr);gap:12px;padding:12px}
 .play-panel{grid-column:1 / 3;grid-row:1}.toolbox{display:block;grid-column:1;grid-row:2;padding:12px 7px}.editor-panel{grid-column:2;grid-row:2}
 .add-command{display:none}.mission{min-height:51px;padding-bottom:8px}.mission h2{font-size:20px}.mission p{font-size:11px}.scene{inset:43px 0 28px;height:calc(100% - 71px)}.objectives{top:31px}.world-top{padding-top:8px}.feedback{display:none}
 .farm-world>.action-notice{top:59px}.program-section{padding:9px 10px 0}.run-area{padding:9px 10px}
}

/* Ten buttons at a time keep all twenty lessons reachable on small screens. */
#chapter{width:72px;min-width:72px;height:32px;padding:3px 5px;border:1px solid #c4d6b9;border-radius:9px;background:#f3f8e9;color:#426343;font-size:11px;font-weight:800}
@media(max-width:599px){
 .level-nav{display:grid;grid-template-columns:54px repeat(10,minmax(0,1fr));gap:2px}
 #chapter{width:54px;min-width:0;height:27px;font-size:10px;padding:2px}
 .level-button{width:100%;min-width:0;font-size:10px}
}

/* The countryside fills the stage at every aspect ratio, behind the moving camera. */
.landscape{position:absolute;inset:0;pointer-events:none;overflow:hidden;border-radius:inherit}
.landscape>svg{width:100%;height:100%;display:block}
.world-top,.objectives,.world-bottom{z-index:2}
.world-top{position:relative}.location{background:#f5fae6c9;padding:5px 7px;border-radius:8px}
.farm-world{background:#89b96b}.scene{z-index:1}

.level-button.locked{position:relative;background:#edf0e6;color:#82907c;box-shadow:none}
.level-button.locked:after{content:'🔒';position:absolute;right:-3px;bottom:-5px;font-size:9px;line-height:12px}
.access-dialog{width:min(380px,calc(100vw - 24px));max-height:calc(100dvh - 24px);overflow:auto;padding:25px;border:1px solid #d8dfbc;border-radius:20px;background:#fffcef;color:#385c45;box-shadow:0 12px 60px #193f5040}
.access-dialog::backdrop{background:#204c4b88;backdrop-filter:blur(5px)}
#access-close{position:absolute;right:12px;top:12px}.access-dialog>img{display:block;margin:0 auto 10px;object-fit:contain}
.access-dialog h2{text-align:center;margin:0 0 8px;font-size:24px}.access-dialog p{text-align:center;font-size:14px}.access-note{color:#71806a;font-size:12px!important;line-height:1.5}
.access-dialog form{display:flex;flex-direction:column;gap:7px;margin-top:18px}.access-dialog label{font-size:12px;font-weight:700}.access-dialog input{width:100%;min-height:42px;border:1px solid #b9cca7;border-radius:9px;background:white;padding:9px;font:inherit;font-size:16px}.access-dialog .run-button{justify-content:center}
#access-error{color:#a34426;min-height:18px;margin:2px 0;font-size:12px}#access-back{display:block;margin:12px auto 0}
.access-unavailable{padding:40px;max-width:500px;margin:auto}.access-unavailable a{display:block;margin-top:20px}

/* Celebration stays inside the field and never intercepts touch controls. */
.harvest-confetti{position:absolute;inset:0;width:100%;height:100%;z-index:15;pointer-events:none;border-radius:inherit}
.harvest-confetti[hidden]{display:none}
