/* Keep the demonstration in one stable workspace, including on a 720p projector. */
.pisga.demo-page{padding:0 18px 10px;font-size:18px;line-height:1.35}
.demo-page h1,.demo-page h2,.demo-page h3,.demo-page button,.demo-page select,.demo-page .feedback,.demo-page .course-home,.demo-page .lesson-tabs a{font-weight:700}
.demo-page .course-header{max-width:1440px;padding:9px 0 8px;margin:0 auto 8px;border-bottom-width:2px}
.demo-page .course-brand{font-size:20px}
.demo-page main.lesson-main{max-width:1440px!important;margin:0 auto;padding:0;display:flex;flex-direction:column;gap:10px}
.demo-page main>.demo-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:0;padding:0}
.demo-page h1{font-size:26px;margin:0;letter-spacing:0}
.demo-page .lesson-tabs{margin:0;gap:6px;flex-wrap:nowrap}
.demo-page .lesson-tabs a{font-size:14px;padding:6px 9px;white-space:nowrap}
.demo-workspace{border:3px solid var(--navy);padding:12px;background:#83d6ed;box-shadow:var(--shadow);display:grid;grid-template-rows:auto auto minmax(0,1fr) auto;gap:10px;min-height:0}
.demo-topbar{display:flex;align-items:center;justify-content:space-between;gap:12px;min-width:0}
.demo-topbar h2{margin:0;font-size:22px}
.phase-heading{display:flex;align-items:center;gap:12px;min-width:0}
.phase-heading select{font-size:15px!important;min-height:36px!important;padding:5px 8px!important;max-width:240px}
.parts-bar{display:flex;align-items:center;justify-content:center;gap:14px;min-width:0}
.demo-page .parts-bar>button{font-size:15px;min-height:36px;padding:5px 9px}
.route-heading{display:flex;align-items:center;gap:14px;justify-content:space-between}
.route-heading .text-button{font-size:14px;white-space:nowrap}
.legend label{display:inline-flex;align-items:center;gap:5px}
.legend input{margin:0}
.demo-page.demo-hard .graph-svg .node-label{font-size:26px}
.demo-page.demo-hard .graph-svg .edge-text{font-size:18px;stroke-width:5px}
.demo-hard #demo-graph:not(.all-labels) .edge-group:not(.selected) .edge-text{opacity:0}
.demo-hard #demo-graph:not(.all-labels) .edge-group:not(.selected):not(.related){opacity:.55}
.demo-hard #demo-graph .edge-group:hover,.demo-hard #demo-graph .edge-group:focus{opacity:1}
.demo-hard #demo-graph:not(.all-labels) .edge-group:hover .edge-text,.demo-hard #demo-graph:not(.all-labels) .edge-group:focus .edge-text{opacity:1}
.demo-hard .remaining-list{gap:5px}
.demo-hard .remaining-list button{font-size:16px;padding:4px 6px;min-height:34px}
.demo-hard .demo-output{grid-template-columns:minmax(0,1fr) auto;gap:7px 18px}
.demo-hard .sequence-output{grid-row:1;grid-column:1/-1;display:flex;align-items:center;gap:16px}
.demo-hard .sequence-output h3{white-space:nowrap;margin:0}
.demo-hard .sequence-output .sequence-display{flex:1;font-size:24px;min-height:39px;letter-spacing:.06em}
.demo-hard .route-output{grid-row:2}
.demo-hard .demo-output>.output-actions{grid-row:2}
.output-actions{display:flex;flex-direction:column;align-items:start;gap:5px}
.demo-hard .output-actions{flex-direction:row;align-items:center;gap:15px}
.demo-hard #output-help{display:none}
.demo-hard .demo-output .route-display{font-size:18px}
.demo-hard .demo-output h3{font-size:16px}
.demo-hard .edge-line{stroke-width:1.6}
.demo-hard .edge-group.used .edge-line{stroke-width:1.8}
.demo-hard .edge-group.selected .edge-line{stroke-width:3}
.demo-hard .node-circle{stroke-width:1.8}
.demo-hard .node-group.current .node-circle{stroke-width:3}
.demo-hard .parts-bar,.demo-hard .choice-label,.demo-hard #inline-choices,.demo-hard #walk-route{display:none}
.demo-hard .route-output{display:flex;align-items:center}
.demo-hard .route-heading{gap:18px}
.demo-hard .demo-stage{grid-template-columns:minmax(0,1fr) 260px;gap:12px}
.demo-hard .demo-workspace{grid-template-rows:auto minmax(0,1fr) auto;gap:8px}
.demo-hard.has-walk .start-controls{display:none}
.demo-hard .current-step{font:700 20px/1.4 Consolas,monospace;direction:ltr;text-align:center;border:1px solid var(--navy);background:var(--amber);padding:7px 3px;margin:0 0 12px;white-space:nowrap}
.demo-hard .demo-topbar h2{font-size:19px}
.demo-hard .phase-heading{gap:10px}
.demo-hard .phase-heading select{font-size:14px!important;min-height:34px!important}
.demo-hard .demo-tools{gap:6px;flex-wrap:nowrap}
.demo-hard .demo-tools button{font-size:13px;min-height:34px;padding:4px 7px}
.demo-hard .demo-side button{font-size:15px;min-height:38px;padding:6px 7px}
.demo-hard #manual-choice{display:block;width:100%;margin:12px 0 8px;background:var(--amber)}
.demo-hard .demo-side .feedback{font-size:16px;line-height:1.4}
.demo-hard .build-explanation{font-size:16px}
.demo-hard .build-mapping{font-size:23px;min-height:48px}
.demo-hard .legend{font-size:12px;gap:12px}
.demo-hard .sequence-output .sequence-display{font-size:22px;min-height:35px}
.demo-hard .demo-output h3{font-size:14px}
.demo-hard .output-actions button{font-size:14px;min-height:30px;padding:3px 6px}
.demo-hard .demo-output{padding-top:6px;gap:6px 16px}
.demo-dialog #walk-choices{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;min-height:0}
.demo-dialog #walk-choices button{font-size:20px;min-height:48px;white-space:nowrap}
.demo-dialog #all-parts-list{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.demo-dialog #all-parts-list .fragment{font-size:18px}
#full-route-list{display:flex;flex-wrap:wrap;gap:8px 20px;padding:0;list-style:none;counter-reset:route;max-width:100%}
#full-route-list li{counter-increment:route;font:700 18px/1.4 Consolas,monospace;border:1px solid var(--navy);padding:5px;background:var(--amber)}
#full-route-list li:before{content:counter(route) '. ';font-size:14px}
.demo-tools{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.demo-page button,.demo-page select{font-size:17px;padding:7px 10px;min-height:42px}
.demo-tools button{font-size:15px;min-height:36px;padding:5px 9px}
.demo-page #demo-parts{gap:9px;margin:0;justify-content:center}
.demo-page .fragment{font-size:22px;padding:5px 11px;line-height:1.1}
.demo-stage{display:grid;grid-template-columns:minmax(0,1fr) 350px;direction:ltr;gap:14px;min-height:0}
.demo-stage>*{direction:rtl;min-width:0;min-height:0}
.demo-visual{display:flex;flex-direction:column;gap:6px}
.demo-page #demo-graph-card{flex:1;min-height:0}
.demo-page #demo-graph{height:100%;min-height:0;aspect-ratio:auto;touch-action:pan-y}
.demo-page .graph-svg .edge-text{font-size:25px}
.demo-page .graph-svg .node-label{font-size:28px}
.demo-page .node-group{cursor:pointer}
.demo-page .legend{font-size:14px;gap:16px;justify-content:center}
.demo-page #graph-empty{position:absolute;inset:0;display:grid;place-content:center;text-align:center;font-size:22px;margin:0;pointer-events:none;line-height:1.6}
.demo-side{display:flex;flex-direction:column;justify-content:center}
.demo-side section{min-width:0}
.demo-page .feedback{font-size:18px;line-height:1.4;margin:6px 0;padding:0;min-height:0}
.demo-page #build-status{min-height:52px}
.demo-page .build-mapping{font-size:29px;min-height:58px;margin:8px 0;border:2px solid var(--navy);background:var(--amber)}
.demo-page .build-explanation{font-size:18px;margin:8px 0 14px}
.step-controls{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.step-controls>button:first-child{grid-column:1/-1}
.start-controls{display:grid;grid-template-columns:auto 80px 1fr;align-items:center;gap:10px}
.start-controls select{width:100%;direction:ltr;text-align:center}
.start-controls{margin-bottom:10px}
.demo-page .walk-rule{font-size:17px;margin:8px 0}
.demo-page .choice-label{font-size:16px;margin:10px 0 5px}
.demo-page .remaining-list{display:flex;flex-wrap:wrap;gap:8px;min-height:42px;align-items:center;direction:ltr}
.remaining-list button{font-family:Consolas,monospace;flex:1}
.demo-page #walk-status{min-height:51px}
.demo-page .text-button{border:0;box-shadow:none;background:transparent;min-height:28px;padding:2px;font-size:15px;text-decoration:underline}
.demo-output{display:grid;grid-template-columns:minmax(0,1fr) 250px auto;gap:18px;align-items:center;border-top:2px solid var(--navy);padding-top:9px;min-width:0}
.demo-output>div{min-width:0}
.demo-output h3{margin:0 0 5px;font-size:17px}
.demo-output .route-display{font-size:19px;line-height:1.3;min-height:25px;overflow-wrap:normal}
.demo-output .sequence-display{font-size:30px;min-height:48px;line-height:1.2;padding:5px 10px;text-align:center}
.demo-page #output-help{font-size:14px;margin:5px 0 0}
.pisga .demo-dialog{width:660px;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto;padding:22px;font-size:20px;line-height:1.5}
.demo-dialog .dialog-heading{display:flex;align-items:start;justify-content:space-between;gap:18px;margin-bottom:12px}
.demo-dialog h2{margin:0;font-size:25px}
.demo-dialog .dialog-heading button{flex:0 0 42px}
.demo-dialog .degree-table{font-size:20px;margin:10px 0}
.demo-dialog .degree-table td,.demo-dialog .degree-table th{padding:5px 12px}
@media(min-width:1000px) and (min-height:580px){
  .demo-page main.lesson-main{height:calc(100dvh - 59px)}
  .demo-heading{flex:0 0 36px}
  .demo-workspace{flex:1}
}
@media(min-width:1000px) and (max-height:650px){
  .demo-workspace{padding:9px;gap:8px}
  .demo-page .feedback{font-size:17px;line-height:1.3}
  .demo-page .walk-rule{margin:6px 0;font-size:16px}
  .demo-page .choice-label{margin:7px 0 4px}
  .demo-page button,.demo-page select{min-height:38px;padding-top:4px;padding-bottom:4px}
  .demo-page .remaining-list{min-height:38px}
  .demo-page #walk-status{min-height:45px}
  .demo-page .step-controls{gap:6px}
  .demo-page .text-button{min-height:25px}
  .demo-output{padding-top:7px}
  .demo-hard .demo-side .feedback{font-size:16px}
  .demo-hard #walk-status{min-height:38px}
  .demo-hard .remaining-list button{min-height:30px;font-size:15px}
  .demo-hard .step-controls button{min-height:34px}
}
@media(max-width:999px),(max-height:579px){
  .demo-page main>.demo-heading{flex-wrap:wrap;gap:10px}
  .demo-topbar{flex-wrap:wrap}
  .demo-stage{grid-template-columns:minmax(0,1fr) 310px}
  .demo-page #demo-graph{height:320px}
  .demo-page .demo-output{grid-template-columns:minmax(0,1fr) 200px}
  .demo-output>.output-actions{grid-column:1/-1;justify-self:start}
}
@media(max-width:700px){
  .pisga.demo-page{padding:0 12px 16px}
  .demo-page h1{font-size:23px}
  .demo-page .lesson-tabs{flex-wrap:wrap}
  .demo-page .lesson-tabs a{font-size:13px}
  .demo-workspace{padding:9px}
  .demo-topbar h2{font-size:21px}
  .demo-tools{gap:7px}
  .demo-tools button{font-size:13px;min-height:38px}
  .demo-page #demo-parts{gap:7px}
  .demo-page .fragment{font-size:19px;padding:4px 7px}
  .demo-stage{grid-template-columns:1fr;gap:10px}
  .demo-page #demo-graph{height:230px}
  .demo-page .legend{font-size:12px;gap:10px}
  .demo-page .demo-output{grid-template-columns:1fr;gap:12px}
  .demo-output .route-display{overflow-wrap:anywhere;font-size:17px}
  .demo-output>.output-actions{grid-column:auto}
  .demo-page #graph-empty{font-size:18px}
  .phase-heading{flex-wrap:wrap;gap:8px}
  .parts-bar{flex-wrap:wrap;gap:8px}
  .demo-page.demo-hard .demo-output{grid-template-columns:1fr}
  .demo-hard .sequence-output{display:block;grid-row:auto;grid-column:auto}
  .demo-hard .sequence-output .sequence-display{font-size:19px;margin-top:6px}
  .demo-hard .route-output,.demo-hard .demo-output>.output-actions{grid-row:auto}
  .demo-hard .legend{gap:6px;flex-wrap:wrap}
  .demo-dialog #all-parts-list{grid-template-columns:repeat(3,minmax(0,1fr))}
  .demo-dialog #all-parts-list .fragment{font-size:15px;padding:4px}
  .demo-hard .demo-stage{grid-template-columns:1fr}
  .demo-hard .demo-tools{flex-wrap:wrap}
  .demo-hard .demo-workspace{display:flex;flex-direction:column}
  .demo-hard .route-output,.demo-hard .route-heading{flex-wrap:wrap}
  .demo-dialog #walk-choices{grid-template-columns:repeat(2,minmax(0,1fr))}
}
