/* MABNI 3.8.1 stability: responsive layer + coding dark mode. Loaded last. */
:root{--mabni-r-gap:clamp(8px,1.4vw,16px)}
html,body{max-width:100%;overflow-x:hidden!important}
img,svg,canvas,video,iframe{max-width:100%}
button,a,input,select,textarea{max-width:100%}
.dialog-card{max-height:min(88vh,820px);overflow:auto!important}

/* Home and SEO pages */
.home-shell{min-height:100svh!important;padding:clamp(10px,2vw,22px)!important;align-items:center!important}
.home-card{width:min(1180px,calc(100vw - 20px))!important;padding:clamp(14px,2vw,22px)!important}
.main-grid{grid-template-columns:repeat(auto-fit,minmax(min(260px,100%),1fr))!important;gap:clamp(10px,1.5vw,14px)!important}
.trust-row{grid-template-columns:repeat(auto-fit,minmax(min(220px,100%),1fr))!important}
.quick-row{align-items:flex-start!important}.quick-note{flex:1 1 280px}.quick-links{justify-content:flex-end;flex:1 1 320px}.quick-links a{white-space:nowrap}
.seo-page-v32 main{width:min(980px,calc(100vw - 28px));margin:auto;padding:clamp(18px,4vw,42px)!important}.seo-page-v32 article{overflow-wrap:anywhere}.seo-page-v32 nav{display:flex;flex-wrap:wrap;gap:10px}

/* Coding studio: desktop/laptop/tablet/mobile */
#app{min-height:100svh;display:flex;flex-direction:column}.topbar{flex:0 0 auto;gap:10px!important;min-width:0}.topbar>*{min-width:0}.top-home-logo img{max-width:44px;height:auto}.workspace-concept-brand{min-width:190px!important;max-width:300px!important}.level-row{min-width:0;flex:1 1 420px}.level-strip{min-width:0;overflow-x:auto!important;scrollbar-width:thin}.user-area{flex:0 1 auto;min-width:0}.user-area-restored{gap:7px!important}.user-chip-btn{min-width:fit-content}.game-shell{flex:1 1 auto;min-height:0;width:100%;gap:var(--mabni-r-gap)!important}.left-panel,.right-panel{min-width:0!important;min-height:0!important}.visualization{min-height:260px}.run-dock{display:grid!important;grid-template-columns:repeat(auto-fit,minmax(112px,1fr));gap:8px}.run-dock button{min-height:44px;white-space:normal}.workspace-head{gap:10px;align-items:flex-start}.workspace-meta{min-width:0;flex-wrap:wrap}#blocklyArea{min-height:360px;height:auto}.mission-bar{flex-wrap:wrap!important}.mission-goals{min-width:0;overflow-x:auto;scrollbar-width:thin}.lesson-grid{grid-template-columns:repeat(auto-fit,minmax(min(270px,100%),1fr))!important}.student-login-grid,.restored-student-login-grid{grid-template-columns:repeat(auto-fit,minmax(min(310px,100%),1fr))!important}.class-students-list,.saved-users{max-height:min(38vh,280px)!important}.choice-grid{grid-template-columns:repeat(auto-fit,minmax(88px,1fr))!important}.custom-grid{grid-template-columns:repeat(auto-fit,minmax(min(260px,100%),1fr))!important}.movement-choice{grid-template-columns:repeat(auto-fit,minmax(min(220px,100%),1fr))!important}.top-arrow-toggle,.top-arrow-return{z-index:50}

@media (min-width:1401px){
  .game-shell{grid-template-columns:minmax(460px,48vw) 12px minmax(460px,1fr)!important;padding:14px!important}.visualization{min-height:420px}#blocklyArea{min-height:520px}.topbar{padding-inline:16px!important}
}
@media (min-width:1181px) and (max-width:1400px){
  .game-shell{grid-template-columns:minmax(410px,47vw) 12px minmax(420px,1fr)!important;padding:12px!important}.visualization{min-height:370px}#blocklyArea{min-height:500px}.workspace-concept-brand{max-width:240px!important}.level-row{flex-basis:360px}.level-chip{min-width:34px!important}
}
@media (min-width:1001px) and (max-width:1180px){
  .topbar{display:grid!important;grid-template-columns:auto minmax(190px,250px) minmax(360px,1fr) auto;align-items:center;padding:9px!important}.game-shell{grid-template-columns:minmax(360px,46vw) 10px minmax(390px,1fr)!important;padding:10px!important}.visualization{min-height:330px}#blocklyArea{min-height:460px}.workspace-meta{display:none!important}.brush-label{display:none!important}.avatar-btn{width:44px!important;padding:0!important}.level-chip{min-width:32px!important;height:32px!important}.mission-chip,.goal-pill{font-size:12px!important}
}
@media (min-width:741px) and (max-width:1000px){
  .topbar{display:grid!important;grid-template-columns:auto 1fr auto;grid-template-areas:"logo concept user" "levels levels levels";padding:10px!important;position:sticky!important;top:0;z-index:40}.top-home-logo{grid-area:logo}.workspace-concept-brand{grid-area:concept;max-width:none!important}.level-row{grid-area:levels;width:100%;flex-basis:auto}.user-area{grid-area:user}.brush-label{display:none!important}.game-shell{display:grid!important;grid-template-columns:1fr!important;grid-template-rows:auto auto!important;min-height:auto!important;padding:10px!important;overflow:visible!important}.layout-splitter{display:none!important}.left-panel{min-height:auto!important}.right-panel{min-height:520px!important}.visualization{min-height:380px;height:min(46vh,440px)}#blocklyArea{height:520px!important;min-height:520px}.workspace-head{position:sticky;top:0;z-index:10}.dialog.wide .dialog-card{width:min(94vw,820px)!important}.run-dock{grid-template-columns:repeat(5,minmax(0,1fr))}.run-dock button{font-size:13px;padding-inline:8px}
}
@media (max-width:740px){
  .topbar{display:grid!important;grid-template-columns:auto 1fr;grid-template-areas:"logo user" "concept concept" "levels levels";gap:8px!important;padding:8px!important;position:sticky!important;top:0;z-index:40}.top-home-logo{grid-area:logo}.user-area{grid-area:user;justify-content:flex-end}.workspace-concept-brand{grid-area:concept;width:100%!important;max-width:none!important;min-width:0!important;padding:9px 11px!important}.level-row{grid-area:levels;width:100%;flex-basis:auto}.level-strip{padding-block:4px!important}.level-chip{min-width:34px!important;height:32px!important;font-size:12px!important}.brush-label{display:none!important}.avatar-btn,.user-chip-btn{min-height:40px!important}.user-chip-btn{max-width:145px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.game-shell{display:block!important;padding:8px!important;overflow:visible!important}.layout-splitter{display:none!important}.left-panel,.right-panel{margin-bottom:10px;border-radius:20px!important}.mission-bar{padding:8px!important}.learning-focus-card{font-size:13px!important}.visualization{height:360px!important;min-height:320px!important}.event-game-pad{grid-template-columns:repeat(3,1fr)!important}.run-dock{grid-template-columns:repeat(2,minmax(0,1fr))!important}.run-dock .big-run{grid-column:1/-1}.workspace-head{display:grid!important;grid-template-columns:1fr!important;padding:10px!important}.workspace-meta{display:none!important}#blocklyArea{height:480px!important;min-height:480px!important}.dialog{max-width:100vw!important}.dialog-card{width:calc(100vw - 18px)!important;padding:14px!important;border-radius:20px!important}.student-login-grid,.restored-student-login-grid{grid-template-columns:1fr!important}.local-name-row,.class-code-row{grid-template-columns:1fr!important}.custom-preview{grid-template-columns:1fr!important;text-align:center}.customize-top-tools{justify-content:center}.teacher-summary{grid-template-columns:1fr!important}.home-shell{align-items:flex-start!important}.brand-lock strong{font-size:24px!important}.brand-lock img{width:36px!important;height:40px!important}h1{font-size:clamp(24px,8vw,34px)!important}.lead{font-size:14px!important}.home-btn-card{min-height:0!important}.quick-links{justify-content:center!important}.quick-links a{font-size:12px;padding:8px 9px}.teacher-login-card,.teacher-server-card{width:calc(100vw - 24px)!important}
}
@media (max-width:420px){
  .visualization{height:330px!important}#blocklyArea{height:430px!important;min-height:430px!important}.run-dock{gap:6px}.run-dock button{font-size:12px;padding:8px}.mission-chip,.goal-pill{font-size:11px!important}.brand-lock strong{letter-spacing:.08em!important}.home-card{padding:12px!important}.home-btn-card{padding:14px!important}.topbar{font-size:13px}.level-nav-arrow{width:34px!important}.workspace-concept-brand strong{font-size:16px!important}
}

/* Event games */
body:has(.layout) .layout{gap:clamp(8px,1.4vw,12px)!important}
.layout .panel{min-width:0}.blockly{min-height:360px!important}.top nav{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}.top{min-width:0}.top .brand{min-width:0}.top .brand div{min-width:0}.top .brand strong,.top .brand span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.stageTools{flex-wrap:wrap}.readout{min-width:0}.helperBubble{max-width:min(300px,70vw)!important}
@media (min-width:1181px){.layout{grid-template-columns:minmax(480px,1fr) minmax(520px,1fr)!important}.blockly{height:calc(100vh - 205px)!important}}
@media (min-width:821px) and (max-width:1180px){.layout{grid-template-columns:minmax(390px,47vw) minmax(420px,1fr)!important}.top{height:auto!important;min-height:60px}.blockly{height:calc(100vh - 230px)!important}.controls{grid-template-columns:repeat(2,1fr)!important}.readout{grid-template-columns:repeat(2,1fr)!important}.stageTag{font-size:11px!important}}
@media (max-width:820px){body{overflow:auto!important}.top{position:sticky;top:0;z-index:20;height:auto!important;align-items:flex-start!important;flex-wrap:wrap}.layout{height:auto!important;display:grid!important;grid-template-columns:1fr!important;padding:8px!important}.panel{border-radius:20px!important}.arena,.world{height:410px!important;min-height:410px!important}.blockly{height:520px!important;min-height:520px!important}.controls{grid-template-columns:repeat(2,1fr)!important}.readout{grid-template-columns:repeat(2,1fr)!important}.mascot.right{right:8px!important}.mascot.left{left:8px!important}.helperBubble{left:10px!important;top:52px!important;font-size:12px!important}.event-objective-card{padding:16px!important}.event-objective-card h2{font-size:24px!important}}
@media (max-width:520px){.top .brand img{width:30px!important;height:30px!important}.top .brand strong{font-size:14px!important}.top .brand span{display:none!important}.top nav .btn{padding:8px 10px;font-size:12px}.hud{grid-template-columns:1fr!important;text-align:center}.hud .right{text-align:center!important}.arena,.world{height:340px!important;min-height:340px!important}.blockly{height:455px!important;min-height:455px!important}.controls .btn{font-size:12px;padding:8px}.readout div{font-size:12px}.levelbar{gap:6px!important}.chip{min-width:36px!important;height:32px!important;padding:0 10px!important}.mascot span,.paddleLabel{display:none}.mascotFace{width:46px!important;height:46px!important}.helperBubble{max-width:220px!important}.stageTools .group{width:100%}.stageTools .btn{flex:1}.event-objective-dialog{max-width:calc(100vw - 20px)!important}}

/* Hardware electricity lab */
.app:has(.bench),.app:has(.circuitBoard){min-width:0}.center,.panel{min-width:0}.board,.bench,.circuitBoard,.electricity-board{max-width:100%;min-width:0}.trayBody,.leftBody{min-width:0}.partTray,.partsGrid,.componentTray{grid-template-columns:repeat(auto-fit,minmax(92px,1fr))!important}.wireLayer,svg{max-width:100%}
@media (max-width:1180px){.app:has(.board),.app:has(.bench),.app:has(.circuitBoard){grid-template-columns:260px minmax(420px,1fr)!important}.app:has(.board)>.panel:last-child,.app:has(.bench)>.panel:last-child,.app:has(.circuitBoard)>.panel:last-child{grid-column:1/-1}.top{height:auto!important}}
@media (max-width:860px){.app:has(.board),.app:has(.bench),.app:has(.circuitBoard){display:grid!important;grid-template-columns:1fr!important;padding:8px!important}.top{position:sticky;top:0;z-index:30;flex-wrap:wrap;align-items:flex-start!important}.actions{width:100%;justify-content:flex-start}.center{order:1}.panel{border-radius:20px!important}.board,.bench,.circuitBoard{height:520px!important;min-height:460px!important}.pathBar{overflow-x:auto}.leftBody,.trayBody{max-height:none!important}}
@media (max-width:520px){.brand strong{font-size:15px!important}.brand span{display:none!important}.btn{padding:8px 10px!important;font-size:12px!important}.board,.bench,.circuitBoard{height:430px!important;min-height:390px!important}.step{width:38px!important;height:38px!important}.step.free{width:56px!important}.panelHead{padding:11px!important}.leftBody,.trayBody{padding:10px!important}}

/* Teacher dashboard / PHP pages, class controls */
.teacher-dashboard,.td-shell,.dashboard-shell{max-width:100vw!important}.td-grid,.dashboard-grid,.progress-grid,.control-grid,.health-grid{grid-template-columns:repeat(auto-fit,minmax(min(280px,100%),1fr))!important}.td-table-wrap,.table-wrap{overflow-x:auto!important}.td-card,.dash-card,.progress-card{min-width:0!important}.td-actions,.control-actions{display:flex;flex-wrap:wrap;gap:8px}.td-actions button,.control-actions button{white-space:normal}


/* MABNI 3.8.1 responsive repair */
.home-card{max-width:1180px!important;width:100%!important}.download-support-section{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:18px;align-items:center;margin:12px 0;padding:16px;border-radius:22px;border:1px solid var(--line);background:linear-gradient(135deg,#f7fbff,#eef7ff)}.download-support-section span{display:block;color:#006cff;font-weight:1000;font-size:12px;letter-spacing:.08em;text-transform:uppercase}.download-support-section h2{margin:3px 0 5px;font-size:22px}.download-support-section p{margin:0;color:var(--muted);font-weight:750;line-height:1.4}.download-support-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}.download-support-actions button,.download-support-actions a{border:0;border-radius:14px;padding:12px 14px;background:#0b1f3a;color:#fff;text-decoration:none;font-weight:1000;cursor:pointer}.download-support-actions a{background:#fff;color:#10213d;border:1px solid var(--line)}.support-card{max-width:560px!important}.support-actions-inline{display:flex}.support-actions-inline .email-btn{display:inline-flex;justify-content:center;border-radius:14px;padding:12px 14px;background:#0b5cff;color:#fff;text-decoration:none;font-weight:1000}.support-block,.support-method{padding:12px 14px;border-radius:16px;background:#f8fbff;border:1px solid var(--line)}.support-block h3,.support-method strong{margin:0 0 5px;display:block;color:#10213d}.support-method p{margin:0;color:#475569!important;font-weight:850!important;line-height:1.5!important}.teacher-server-card.support-card{gap:10px!important}
@media(max-width:980px){.download-support-section{grid-template-columns:1fr}.download-support-actions{justify-content:flex-start}.main-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}.home-shell{align-items:flex-start!important}}
@media(max-width:640px){.download-support-actions{display:grid;grid-template-columns:1fr;width:100%}.main-grid{grid-template-columns:1fr!important}.download-support-section{padding:14px}.download-support-section h2{font-size:19px}.quick-row{justify-content:center!important}.quick-note{text-align:center}.quick-links{justify-content:center!important}.teacher-server-card.support-card{width:calc(100vw - 24px)!important}}


/* MABNI 3.8.1: old data-theme dark block removed. Clean dark mode lives in mabni-clean-theme.css and mabni-v38-stability.css. */

/* MABNI 3.8.1 support section polish */
.support-download-pro{grid-template-columns:minmax(0,1.1fr) minmax(320px,.9fr)!important;background:linear-gradient(135deg,#f7fbff,#fffdf2)!important;border:1px solid rgba(11,31,58,.12)!important;box-shadow:0 14px 32px rgba(11,31,58,.07)}.support-download-pro .support-action{background:#16a34a!important;color:#fff!important}.support-download-pro .guide-action{background:#eef2ff!important;color:#10213d!important;border:1px solid var(--line)!important}.support-option-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:12px;margin:12px 0}.bank-box p{margin:8px 0 0!important;font-size:.92rem!important;line-height:1.55!important;color:#475569!important}.contact-support-pro{border:1px solid rgba(11,31,58,.12);box-shadow:0 14px 32px rgba(11,31,58,.07)}.teacher-server-card.support-card .teacher-server-actions{display:grid!important;grid-template-columns:repeat(auto-fit,minmax(150px,1fr))!important}.support-method.bank-method p b{color:#10213d}.support-card .support-method{font-size:14px}@media(max-width:780px){.support-download-pro{grid-template-columns:1fr!important}.download-support-actions{justify-content:flex-start!important}}


/* MABNI 3.8.1 homepage two-section layout + sticky footer */
.utility-grid-section{margin:14px 0 8px;padding:16px;border-radius:24px;background:linear-gradient(135deg,#f8fbff,#fff7ed);border:1px solid var(--line)}
.utility-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.section-title-row{display:flex;align-items:end;justify-content:space-between;gap:12px;margin-bottom:12px}.section-title-row span{color:#7c3aed;font-size:12px;font-weight:1000;text-transform:uppercase;letter-spacing:.08em}.section-title-row h2{margin:0;font-size:clamp(18px,2.4vw,25px)}.tone-guide{--tone:#7c3aed}.tone-contact{--tone:#0891b2}.tone-support{--tone:#16a34a}.tone-download{--tone:#f97316}.sticky-footer{position:fixed;left:0;right:0;bottom:0;z-index:90;display:flex;justify-content:space-between;align-items:center;gap:12px;padding:10px clamp(12px,3vw,28px);background:rgba(255,255,255,.92);backdrop-filter:blur(14px);border-top:1px solid var(--line);box-shadow:0 -12px 28px rgba(11,31,58,.08);font-size:13px;font-weight:900;color:var(--muted)}.sticky-footer nav{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.sticky-footer a,.sticky-footer button{border:1px solid var(--line);background:#f8fbff;color:var(--text);border-radius:999px;padding:8px 11px;text-decoration:none;font-weight:1000;cursor:pointer}.sticky-footer button{background:#16a34a;color:white;border-color:#16a34a}@media(max-width:980px){.utility-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.sticky-footer{position:sticky}.home-shell{padding-bottom:0!important}body{padding-bottom:0}.section-title-row{display:block}}@media(max-width:640px){.utility-grid{grid-template-columns:1fr}.sticky-footer{display:grid;text-align:center;justify-items:center}.sticky-footer nav{justify-content:center}}
