/* ISM Explorer: school navy and gold, with distinct blue, teal and amber learning areas. */
:root{--navy:#10264b;--blue:#1e5bb8;--sky:#e9f3ff;--gold:#f3bd32;--ink:#142a49;--muted:#536984;--line:#d5dfeb;--green:#087f72;--paper:#f2f6fb;--white:#fff;--shadow:0 10px 28px rgba(16,38,75,.09);--teal:#087f72;--blue-soft:#eaf3ff;--teal-soft:#e5f6f2;--gold-soft:#fff5d8}
body{background:var(--paper);color:var(--ink)}
.topbar{border-bottom:5px solid var(--gold);background:var(--navy)}
.brand small{color:#d5e1f2}
.welcome h1{color:var(--navy)}
.rory-card{border-color:#e7ca78;box-shadow:0 5px 18px rgba(16,38,75,.07)}
.rory-face{background:var(--gold-soft)}
.year-tab{border-color:#cbd8e7;color:#344e6c}
.year-tab:hover{border-color:var(--blue);background:#f7fbff}
.year-tab.active{background:var(--blue);border-color:var(--blue);box-shadow:0 5px 0 #163f7f;color:white}
.lesson-panel{background:var(--blue-soft);border-color:#c2d7f2;box-shadow:inset 5px 0 #2870c9,var(--shadow)}
.lesson-panel .eyebrow{color:#335f91}
.lesson-card:hover{background:#dcecff}
.lesson-card.active{background:#fff;border-color:#8bb4e7;box-shadow:0 2px 8px rgba(30,91,184,.1)}
.lesson-card.active .lesson-num{background:#1e5bb8;color:#fff}
.lesson-num{background:#d7e8fc;color:#234f83}
.count-pill{background:#d4e6fb;color:#244d79}
.thinking-card{background:#fff;border-color:#c8d9ed}
.thinking-card b{color:var(--navy)}
.challenge-panel{border-color:#d5dfeb;box-shadow:inset 5px 0 var(--gold),var(--shadow)}
.challenge-head h2,.builder-title h3,.panel-heading h2{color:var(--navy)}
.lesson-meta{color:#1e5bb8}
.maze-wrap{background:#e5f1ff;border-color:#a9c9f0}
.maze-label{color:#244d79}
.maze-hint{color:#385a7d}
.cell{background:#fff;border-color:#cadcf0}
.cell.path-ghost{background:#d6e8ff}
.cell.goal{background:#ffe28a;border-color:#d89e15}
.cell.rock{background:#7b8ca2;border-color:#64758a}
.cell.current{outline-color:#1e5bb8}
.cell.current:after{background:#1e5bb8}
.legend-star{color:#a76e00}
.legend-wall{background:#7b8ca2}
.builder{background:var(--teal-soft);border-color:#9bcfc4}
.builder-title p{color:#355f5a}
.editor-tabs{display:flex;gap:7px;margin:12px 0 8px;padding:4px;background:#d9ebe6;border-radius:11px}
.editor-tab{flex:1;min-height:40px;border:0;border-radius:8px;background:transparent;color:#315e57;font:800 13px 'Nunito',sans-serif;cursor:pointer}
.editor-tab.active{background:#fff;color:#123e38;box-shadow:0 2px 7px #173b7020}
.editor-tab:focus-visible{outline:3px solid #1e5bb8;outline-offset:2px}
.editor-panel{min-width:0}
#blockly-workspace{width:100%;height:340px;min-height:300px;border:1px solid #a8c5bd;border-radius:10px;overflow:hidden;background:#f8fbff}
.editor-hint{margin:7px 2px 10px;color:#355f5a;font-size:11px;line-height:1.45}
.editor-clear{margin:8px 0}
.python-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 10px;background:#18365e;color:#fff;border-radius:9px 9px 0 0;font:800 10px 'Nunito',sans-serif;letter-spacing:.8px}
.python-heading .text-button{color:#fff}
.python-code{min-height:288px;max-height:340px;overflow:auto;margin:0;padding:14px;background:#10233f;color:#e4f2ff;border-radius:0 0 9px 9px;font:13px/1.7 'SFMono-Regular',Consolas,monospace;white-space:pre}
.python-code code{font:inherit}
.blocklyToolboxDiv{border-radius:10px 0 0 10px}
.blocklyText{font-family:'Nunito',Arial,sans-serif!important}
.blocklyWidgetDiv,.blocklyDropDownDiv,.blocklyTooltipDiv{z-index:30}
.step-count{color:#245b54}
.code-block.forward{background:#1e5bb8}
.code-block.left{background:#6740a0}
.code-block.right{background:#b65b0c}
.code-block.repeat{background:#087f72}
.code-block{box-shadow:0 3px 0 rgba(16,38,75,.22)}
.program-box{border-color:#8ebfb5;background:#fff}
.program-token{background:#e6efff;color:#164c9a}
.program-token.left{background:#f0e9fb;color:#57358b}
.program-token.right{background:#fff0df;color:#8e4505}
.program-token.repeat{background:#ddf2ec;color:#075f55}
.run-button{background:#087f72;box-shadow:0 4px 0 #045b53}
.run-button:hover{background:#066e64}
.step-button{border-color:#9bcfc4;color:#145e55}
.step-button:hover{border-color:#087f72;color:#064f49;background:#f3fffc}
.feedback{color:#344f68}
.feedback.good{color:#075e4b}
.feedback.try{color:#854100}
.challenge-bottom{border-color:#dce3ec}
.concept-icon{background:var(--gold-soft);color:#916100}
.concept b{color:var(--navy)}
.concept p{color:#4d6178}
.next-button{background:var(--gold);color:#162b48;box-shadow:0 3px 0 #c28e11}
.next-button:hover{background:#ffcf49}
.reset-button{border-color:#cad7e6;color:#34516f}
.reset-button:hover{background:#f1f6fc;color:#10264b}
.logic-panel{background:var(--gold-soft);border-color:#e7ce83;border-left:5px solid #e0aa1b}
.logic-icon{background:#f3bd32}
.logic-heading h3{color:var(--navy)}
.logic-status{color:#5c491a;border-color:#e6d49c}
.logic-question{color:#273b56}
.logic-option{border-color:#e1d29f;color:#2d3d55}
.logic-option:hover{border-color:#bd8c15;background:#fffdf6}
.logic-option.correct{background:#e5f5ed;border-color:#65b993;color:#075e4b}
.logic-option.incorrect{background:#fff0e9;border-color:#e49b77;color:#8b3e1b}
.logic-feedback{color:#5e5a4c}
.logic-feedback.correct{color:#075e4b}
.logic-feedback.try{color:#854100}
.logic-credit{color:#746c57}
.cell.checkpoint{background:#ffe6a2;border-color:#c99820}
.cell.checkpoint.visited{background:#dff2e9;border-color:#70b88c}
.cell .marker-done{color:#087f72}
footer{color:#50647c}
footer a{color:#1b538e}
footer a:hover{color:#10264b}
@media(prefers-contrast:more){.lesson-panel,.challenge-panel,.maze-wrap,.builder,.logic-panel{border-width:2px}.cell{border-width:2px}}
.maze{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));grid-template-rows:repeat(5,minmax(0,1fr));width:min(100%,310px);aspect-ratio:1/1;align-content:stretch;justify-content:stretch;min-width:0}
.cell{aspect-ratio:1/1;min-width:0;min-height:0;width:100%;height:100%;padding:0;overflow:hidden;line-height:1;font-size:clamp(18px,5vw,27px)}

[hidden]{display:none!important}
.top-actions{display:flex;align-items:center;gap:10px}
.top-action{border:1px solid #8ba0bc;border-radius:10px;background:#203b64;color:white;min-height:38px;padding:8px 12px;font:800 12px 'Nunito',sans-serif;cursor:pointer}
.top-action:hover{background:#2d4e7c}
.top-action.teacher-action{background:var(--gold);border-color:var(--gold);color:#172c4a}
.top-action.teacher-action:hover{background:#ffcf49}
.student-gate{min-height:calc(100vh - 76px);padding:32px 16px;display:grid;place-items:center;background:radial-gradient(circle at 50% 10%,#fff8df 0,#f3f8ff 46%,#eaf2fc 100%)}
.gate-card{width:min(100%,520px);background:#fff;border:2px solid #d5e1ef;border-top:8px solid var(--gold);border-radius:22px;padding:32px;box-shadow:0 18px 48px rgba(16,38,75,.13);text-align:center}
.gate-lion{display:grid;place-items:center;width:66px;height:66px;margin:0 auto 18px;border-radius:20px;background:var(--gold-soft);font-size:42px}
.gate-card h1,.teacher-heading h1{font:900 clamp(25px,5vw,34px) 'Nunito',sans-serif;color:var(--navy);line-height:1.15;margin:0}
.gate-card>p:not(.eyebrow){color:var(--muted);line-height:1.55;margin:12px auto 22px;max-width:390px}
.gate-card form,.teacher-login{display:grid;gap:8px;text-align:left}
.gate-card label,.teacher-login label{font:800 13px 'Nunito',sans-serif;color:var(--navy)}
.code-entry{display:flex;gap:9px}
.code-entry input{min-width:0;flex:1;border:2px solid #bdcde0;border-radius:10px;padding:10px 12px;font:800 16px 'DM Sans',sans-serif;letter-spacing:1.5px;text-transform:uppercase;color:var(--navy);outline:none}
.code-entry input:focus{border-color:var(--blue);box-shadow:0 0 0 3px #1e5bb827}
.code-entry .run-button{white-space:nowrap;font-size:13px}
.gate-error{min-height:20px;color:#a23b26;font-size:13px;margin:10px 0 0}
.gate-card>small{display:block;color:#677b95;font-size:12px;margin-top:8px}
.teacher-screen{min-height:calc(100vh - 76px);background:#eef4fb;padding:30px 18px 54px}
.teacher-shell{max-width:1050px;margin:0 auto;background:#fff;border:1px solid #d5e1ef;border-radius:20px;padding:26px;box-shadow:var(--shadow)}
.teacher-heading,.teacher-dashboard-head{display:flex;justify-content:space-between;align-items:flex-start;gap:20px}
.teacher-heading p:not(.eyebrow),.teacher-dashboard-head p{color:var(--muted);margin:7px 0 0;line-height:1.45}
.teacher-heading .text-button,.teacher-dashboard-head .text-button{font-size:13px;white-space:nowrap}
.teacher-login{max-width:500px;margin:30px 0 4px;background:#f2f7ff;border:1px solid #ceddf0;border-radius:15px;padding:18px}
.teacher-login .code-entry input{text-transform:none;letter-spacing:.04em}
.teacher-login .gate-error{margin:0}
.teacher-dashboard-head{align-items:center;margin:4px 0 17px;padding-top:5px}
.teacher-dashboard-head h2{font:900 22px 'Nunito',sans-serif;color:var(--navy);margin:0}
.add-student-form{display:grid;grid-template-columns:minmax(190px,1fr) 170px auto;gap:12px;align-items:end;padding:16px;background:#eaf3ff;border:1px solid #c3d9f2;border-radius:14px}
.add-student-form label{display:grid;gap:6px;font:800 12px 'Nunito',sans-serif;color:var(--navy)}
.add-student-form input,.add-student-form select{min-height:40px;border:1px solid #afc3db;border-radius:9px;background:#fff;padding:8px 10px;font:600 14px 'DM Sans',sans-serif;color:var(--ink)}
.add-student-form input:focus,.add-student-form select:focus{outline:3px solid #1e5bb827;border-color:var(--blue)}
.add-student-form .run-button{min-height:40px}
.tracker-message{min-height:20px;color:#35634f;font-size:13px;font-weight:700;margin:12px 2px}
.student-cards{display:flex;flex-wrap:wrap;gap:12px;margin:8px 0 20px}
.print-code-card{width:230px;border:2px solid #d9e3ef;border-radius:16px;padding:15px;text-align:center;background:#fff;box-shadow:0 4px 15px rgba(16,38,75,.08)}
.print-code-card h3{font:900 15px 'Nunito',sans-serif;color:var(--navy);margin:0 0 9px}
.student-qr{display:block;width:176px;height:176px;max-width:100%;margin:0 auto;border:6px solid white}
.student-code-display{font:900 20px 'DM Sans',sans-serif;letter-spacing:2px;line-height:1.5;color:#173b70;margin:8px 0;overflow-wrap:anywhere}
.print-instruction{font-size:11px;color:#596e87;line-height:1.4;margin:6px 0 12px}
.print-code-card .run-button{min-height:35px;font-size:11px;padding:7px 12px}
.roster-wrap{overflow-x:auto;border:1px solid #dce4ee;border-radius:12px}
.roster-table{width:100%;min-width:820px;border-collapse:collapse;text-align:left}
.roster-table th{background:#f2f6fb;color:#304a6b;font:800 12px 'Nunito',sans-serif;padding:12px;border-bottom:1px solid #dce4ee}
.roster-table td{padding:12px;border-bottom:1px solid #e9eef5;color:#233b5a;font-size:13px;vertical-align:middle}
.roster-table tr:last-child td{border-bottom:0}
.roster-table td:first-child{font-weight:800}
.roster-table td strong,.roster-table td small{display:block}
.roster-table td small{color:#5d7189;font-size:11px;margin-top:3px}
.student-name-button{border:0;padding:0;background:none;color:#174f94;font:800 14px 'Nunito',sans-serif;text-align:left;text-decoration:underline;text-decoration-color:#a7c0df;text-underline-offset:3px;cursor:pointer}
.student-name-button:hover{color:#0d3769;text-decoration-color:currentColor}
.student-name-button:focus-visible{outline:3px solid #1e5bb8;border-radius:3px;outline-offset:3px}
.teacher-actions{display:flex;align-items:center;gap:14px}
.teacher-actions .run-button{font-size:12px;min-height:38px;white-space:nowrap}
.rotate-code-button{color:#1d579d;font-size:12px}
.lesson-done.partial{color:#b26b00}
.roster-table td .lesson-state-line{color:#344f6b;line-height:1.5;white-space:normal}
.roster-login-code{display:inline-block;padding:7px 9px;border-radius:7px;background:#eaf3ff;border:1px solid #c6d9ef;color:#173b70;font:900 14px 'DM Sans',sans-serif;letter-spacing:.04em;white-space:normal;overflow-wrap:anywhere}
.year-tab:disabled{opacity:.52;cursor:not-allowed}
@media(max-width:640px){
  .topbar{height:auto;min-height:64px;padding:8px 12px;gap:8px}
  .top-actions{gap:6px}
  .top-actions .top-note{display:none}
  .top-action{font-size:10px;padding:7px 8px;min-height:34px}
  .student-gate{min-height:calc(100vh - 64px);padding:20px 12px}
  .gate-card{padding:24px 18px;border-radius:18px}
  .code-entry{flex-direction:column}
  .code-entry .run-button{width:100%}
  .teacher-screen{min-height:calc(100vh - 64px);padding:15px 10px 35px}
  .teacher-shell{padding:18px 13px;border-radius:15px}
  .teacher-heading,.teacher-dashboard-head{gap:10px}
  .teacher-heading{flex-direction:column}
  .teacher-dashboard-head{align-items:flex-start}
  .teacher-actions{align-items:flex-end;flex-direction:column;gap:8px}
  .add-student-form{grid-template-columns:1fr;gap:10px}
  .add-student-form .run-button{width:100%}
  #blockly-workspace{height:310px;min-height:290px}
  .python-code{min-height:260px;font-size:12px}
  .lesson-card .lesson-done{display:block!important}
}
@media print{
  @page{size:A4 portrait;margin:10mm}
  body *{visibility:hidden!important}
  .teacher-screen,.teacher-screen *{visibility:visible!important}
  .teacher-screen{position:absolute;inset:0;background:#fff!important;padding:0!important}
  .teacher-shell{max-width:none;border:0;box-shadow:none;padding:0}
  .teacher-heading,.teacher-login,.teacher-dashboard-head,.add-student-form,.tracker-message,.roster-wrap,.no-print{display:none!important}
  .student-cards{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:7mm;margin:0}
  .print-code-card{width:auto;max-width:none;margin:0;border:1.5pt solid #12305a;box-shadow:none;padding:6mm;break-inside:avoid-page}
  .print-code-card h3{font-size:13pt}
  .student-qr{width:38mm;height:38mm}
  .student-code-display{font-size:17pt}
  .print-instruction{font-size:9pt}
  body.printing-roster .student-cards{display:none!important}
  body.printing-roster .roster-wrap{display:block!important;visibility:visible!important;overflow:visible;border:0}
  body.printing-roster .roster-wrap *{visibility:visible!important}
  body.printing-roster .roster-table{width:100%;min-width:0;table-layout:auto;font-size:9pt}
  body.printing-roster .roster-table th{font-size:9pt;padding:5px 6px;background:#eaf0f7!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
  body.printing-roster .roster-table td{font-size:8.5pt;padding:5px 6px}
  body.printing-roster .roster-table td small{font-size:7pt}
  body.printing-roster .roster-login-code{font-size:9pt;padding:3px 5px;letter-spacing:.03em}
  body.printing-roster .roster-table .text-button{display:none}
  @page{size:A4 landscape;margin:8mm}
}
