/* v140: one viewport for the rep, with independent scrolling for long content. */
body:is([data-rep-layout="ready"],[data-rep-layout="active"],[data-rep-layout="finisher"]){
  --app-header:64px;
  display:flex;flex-direction:column;height:100svh;height:100dvh;
  min-height:0;margin:0 auto;border:0;border-radius:0;overflow:hidden;
}
body[data-rep-layout]:not([data-rep-layout=""]) #header{flex:0 0 var(--app-header);height:var(--app-header);width:100%}
body[data-rep-layout]:not([data-rep-layout=""]) #main{
  flex:1;min-height:0;overflow:hidden;padding:4px 14px max(12px,env(safe-area-inset-bottom));
}
body[data-rep-layout]:not([data-rep-layout=""]) .sp-shell{
  height:100%;min-height:0;padding:0;gap:6px;
}

/* v152: an explicit flex height keeps the start action at the viewport bottom,
   including mobile Safari. No tools or empty grid row sit below the button. */
body[data-rep-layout="ready"] #main{display:flex;flex-direction:column;flex:1 1 0px;height:0;margin:0 auto}
body[data-rep-layout="ready"] #main>:is(.sp-guided-ready,.sp-guide-sequence){display:flex;flex-direction:column;flex:1 1 0px;height:auto;min-height:0;gap:0}
.sp-guided-ready .sp-ready-content{flex:1 1 0px;min-height:0;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;gap:10px;padding:4px 3px 16px;scroll-padding-block:16px}
.sp-guided-ready .sp-ready-content>*{flex-shrink:0}
.sp-guided-ready .sp-ready-content .sp-demo-goal{margin:0!important;font-size:17px;line-height:1.45;text-align:left;max-width:none;color:#f4f8ff}
.sp-start-dock{display:flex;flex:0 0 auto;align-items:center;justify-content:center;width:100%;margin-top:auto;padding:10px 14px 10px;border:0}
.electric-theme .sp-guided-ready .sp-start-dock .sp-button{margin:0;width:100%;max-width:420px;min-height:clamp(112px,18svh,156px);min-height:clamp(112px,18dvh,156px);padding:20px 12px;border:2px solid #e1ff9e;border-radius:3px;background:#c6ff40;color:#102143;box-shadow:0 7px 0 #6a9620,0 12px 26px #07132f66;font:900 clamp(36px,10vw,54px)/1.05 'Barlow Condensed',sans-serif;letter-spacing:.015em;transform:skewX(-7deg)!important}
.sp-start-dock .sp-button>span{display:block;transform:skewX(7deg)}
.electric-theme .sp-guided-ready .sp-start-dock .sp-button:hover{background:#d5ff73}
/* v148: Start Set stays still, including when the global button press rule runs. */
.sp-start-dock,.sp-start-dock .sp-button,.sp-start-dock .sp-button>span{animation:none;transition:none}
.electric-theme .sp-guided-ready .sp-start-dock .sp-button:active{background:#b2eb35}
.electric-theme .sp-guided-ready .sp-start-dock .sp-button:focus-visible{outline:3px solid #fff;outline-offset:5px}
.sp-ready-tools{display:flex;flex:0 0 auto;flex-wrap:wrap;justify-content:center;align-items:center;gap:6px 14px;margin-top:auto;padding:10px 3px 3px}
.sp-ready-tools>*{flex-shrink:0}
.sp-ready-tools .sp-test-button{width:auto;max-width:100%;font-size:12px}
.sp-play-guide{display:flex;flex-direction:column;gap:12px;padding-top:16px;border-top:1px solid #ffffff29}
.sp-instruction-lines{display:flex;flex-direction:column;gap:12px}
.sp-instruction-lines .sp-instruction-option{padding-left:12px;border-left:3px solid #c6ff40}
.sp-guide-body{display:flex;flex-direction:column;flex:1 1 0px;min-height:0;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;gap:22px;padding:24px 6px}
.sp-guide-body>*{flex-shrink:0}
.sp-guide-body>:first-child{margin-top:auto}
.sp-guide-body>:last-child{margin-bottom:auto}
.sp-guide-heading{font:900 14px/1.3 'Nunito',sans-serif;letter-spacing:.12em;color:#c6ff40}
.sp-guide-body .sp-instruction-lines{gap:22px;text-align:left}
.sp-guide-body .sp-demo-goal{font:800 clamp(23px,6.5vw,30px)/1.4 'Nunito',sans-serif;color:#fff;text-wrap:pretty}
.sp-guide-body .sp-instruction-lines,.sp-guide-sequence .sp-start-scene{animation:stage-title-arrive .3s ease-out both}
.sp-guide-sequence .sp-start-scene{display:flex;flex-direction:column;gap:20px;background:none;border:0;box-shadow:none;padding:0;margin:0}
.sp-guide-sequence .sp-start-scene>.sp-art{width:88px;height:88px;color:#57edfa}
.sp-guide-sequence .sp-scene-description{font:900 clamp(27px,7.5vw,35px)/1.2 'Nunito',sans-serif;color:#fff;text-wrap:balance}
.sp-guide-sequence .sp-scene-where{font:600 18px/1.4 'Nunito',sans-serif;color:#e0ebff;margin-top:16px}
.sp-guide-footer{flex:0 0 auto;padding:14px 4px 10px}
.sp-guide-count{margin-bottom:14px!important;font:800 12px/1.3 'Nunito',sans-serif;color:#e0ebff}
.sp-guide-options{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}
.sp-guide-options .sp-guide-count{flex:0 0 auto;margin:0!important}
.sp-sentence-support{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:48px;max-width:100%;padding:8px 12px;border:1px solid #7197c9;border-radius:6px;background:#102143;color:#f4f8ff;font:800 14px/1.3 'Nunito',sans-serif;text-align:left;touch-action:manipulation}
.sp-sentence-support strong{flex:0 0 auto;min-width:44px;padding:5px 8px;border-radius:4px;background:#c6ff40;color:#102143;font-size:12px;text-align:center}
.sp-sentence-support[aria-checked="false"] strong{background:#304b75;color:#f4f8ff}
.sp-sentence-support:focus-visible{outline:3px solid #fff;outline-offset:3px}
.sp-ready-content>.sp-sentence-support{width:100%;margin-top:12px}
.sp-guide-actions{display:flex;align-items:center;gap:16px}
.sp-guide-next{display:flex;align-items:center;justify-content:space-between;flex:1;min-height:68px;padding:14px 22px;background:#c6ff40;color:#102143;border:2px solid #e1ff9e;border-radius:3px;font:900 30px/1 'Barlow Condensed',sans-serif;box-shadow:0 5px 0 #6a9620}
.sp-guide-back{min-height:48px;padding:10px 4px;background:none;color:#e0ebff;font:800 15px 'Nunito',sans-serif}
.sp-ready-message{font:900 28px/1.2 'Barlow Condensed',sans-serif;color:#c6ff40;text-align:left}
@media(prefers-reduced-motion:reduce){.sp-guide-body .sp-instruction-lines,.sp-guide-sequence .sp-start-scene{animation:none}}
.sp-guided-ready .sp-how-to-heading{font:900 13px/1.3 'Nunito',sans-serif;letter-spacing:.12em;text-align:left;color:#f4f8ff;margin:0}
.electric-theme .sp-inline-example{display:flex;flex-direction:column;gap:10px;padding:4px 0 0;background:transparent;color:#f4f8ff;border:0;border-radius:0;box-shadow:none}
.sp-inline-example .sp-demo-frames{overflow:visible;flex:none}
.sp-inline-example .sp-demo-frame-sizing{display:none}
.sp-inline-example .sp-example-frame{min-height:0;padding:12px 4px;gap:12px}
.sp-inline-example .sp-demo-footer{display:flex;align-items:center;gap:12px;padding:0 0 4px}
.sp-inline-example .sp-demo-advance{display:flex;align-items:center;justify-content:space-between;gap:12px;flex:1;width:100%;min-height:48px;padding:8px 14px;border:2px solid #101e45;border-radius:4px 16px 4px 16px;background:#ffe04b;color:#101e45;box-shadow:0 4px 0 #101e45;font:900 18px/1.2 'Nunito',sans-serif;cursor:pointer;touch-action:manipulation}
.sp-inline-example .sp-demo-advance:hover{background:#ffec80}
.sp-inline-example .sp-demo-advance:focus-visible{outline:3px solid #fff;outline-offset:3px}
.sp-inline-example .sp-demo-advance-icon{font-size:26px}
.sp-example-back{min-height:48px;padding:8px;background:none;color:#e0ebff;text-decoration:underline;font:800 14px 'Nunito',sans-serif}
.electric-theme .sp-inline-example .sp-demo-window-top{color:#f4f8ff}
.sp-guided-ready .sp-scene-banner.sp-start-scene{display:flex;align-items:center;gap:14px;margin:0;padding:8px 0 14px;text-align:left;background:none;border:0;box-shadow:none;width:100%}
.sp-start-scene>.sp-art{width:52px;height:52px;color:#57edfa;flex-shrink:0}
.sp-guided-ready .sp-start-scene>div{min-width:0}
.sp-guided-ready .sp-start-scene .sp-scene-where{font:600 15px/1.4 'Nunito',sans-serif;color:#e0ebff;margin-top:6px}
.sp-guided-ready .sp-start-scene .sp-scene-description{font:800 clamp(20px,5.8vw,25px)/1.25 'Nunito',sans-serif;color:#fff;text-wrap:pretty}
.sp-guided-ready .sp-cue-set-title{text-align:left;font-size:23px;margin:2px 0 0}
/* Examples belong to the dark page, including the smaller swipe demonstration. */
.electric-theme .sp-inline-example :is(.sp-example-frame p,.sp-example-frame .sp-demo-task,.sp-example-words,.sp-frame){color:#f4f8ff}
.electric-theme .sp-inline-example :is(.sp-example-frame .sp-example-label,.sp-example-say){color:#c6ff40}
.electric-theme .sp-inline-example .sp-example-frame .sp-example-call{background:#17366b;color:#c6ff40}
.sp-inline-example .sp-tone-demo-card{background:none;border:0;border-radius:0;box-shadow:none}
.sp-inline-example .sp-example-picture svg{color:#57edfa}
.electric-theme .sp-inline-example .sp-point-scene .is-marked{background:#17366b;border-color:#57edfa}
.electric-theme .sp-inline-example :is(.sp-mini-plate,.sp-demo-plate){background:#17366b;color:#f4f8ff;border-color:#57edfa}
.sp-inline-example .sp-tone-demo-buttons span{background:#17366b;color:#e0ebff;border-color:#7197c9}
.sp-inline-example .sp-tone-demo-buttons .is-chosen{background:#c6ff40;color:#102143;border-color:#c6ff40}

/* Top status stays compact; descriptions live on the start page. */
:is(.sp-active,.sp-true-round)>.sp-top{align-items:center;gap:8px;letter-spacing:.03em;min-height:44px}
:is(.sp-active,.sp-true-round) .sp-top .sp-test-button{width:auto;max-width:98px;flex:0 0 auto;min-height:44px;padding:4px 8px;font-size:10px;line-height:1.25}
.sp-active>.sp-scoreboard{flex:0 0 auto;min-height:52px;padding:4px 8px;box-shadow:none}
.sp-active .sp-scoreboard strong{font-size:30px}
.sp-active .sp-scoreboard small{font-size:9px}
.sp-active>.sp-time{flex:0 0 4px}
.sp-scene-status{display:flex;justify-content:space-between;align-items:center;gap:12px;min-height:22px;font:700 13px/1.3 'Nunito',sans-serif;color:#e0ebff;flex:0 0 auto}
.sp-goal-count{font-variant-numeric:tabular-nums;white-space:nowrap;color:#c6ff40}
.sp-scene-status.sp-goal-progress{flex-direction:column;align-items:stretch;gap:4px}
.sp-goal-heading{display:flex;justify-content:space-between;align-items:baseline;gap:10px;text-align:left}
.sp-goal-heading strong{min-width:0;font-size:12px;line-height:1.35}
.sp-goal-heading strong span{font-weight:600}
.sp-goal-track{height:8px;overflow:hidden;background:#07132f;border:1px solid #7197c9;border-radius:4px}
.sp-goal-track i{display:block;height:100%;background:linear-gradient(90deg,#57edfa,#c6ff40);border-radius:3px}
:is(.sp-active,.sp-true-round)>.sp-speak-banner{flex:0 0 auto;margin:0!important;padding:3px 4px;font-size:14px;line-height:1.3}
.sp-active>:is(.sp-boss-group,.sp-mountain-progress,.sp-gold-tokens,.sp-lap,.sp-beat,.sp-kahore-bar,.sp-call,.sp-note){flex:0 0 auto}
.sp-active>.sp-boss-group{margin:0;gap:4px}
.sp-active>.sp-mountain-progress{margin:0;gap:8px;font-size:12px;justify-content:center}
.sp-active>.sp-mountain-progress svg{width:24px;height:24px}
.sp-active>.sp-beat{padding:3px;font-size:12px}
.sp-active>.sp-kahore-bar{margin:0;gap:4px;font-size:11px}
.sp-active>.sp-kahore-bar span{padding:3px}

/* One stable card area for prompt and answer, independent of text length. */
body[data-rep-layout]:not([data-rep-layout=""]) :is(.sp-active,.sp-true-round)>.sp-card{
  display:flex;flex:1 1 0;min-height:0;max-height:none;margin:0;
  padding:28px 10px 10px;overflow:hidden;justify-content:flex-start;
}
body[data-rep-layout]:not([data-rep-layout=""]) .sp-card-stage{display:flex;flex:1;min-height:0;height:100%;width:100%;overflow:hidden}
body[data-rep-layout]:not([data-rep-layout=""]) .sp-card-sizing{display:none}
body[data-rep-layout]:not([data-rep-layout=""]) :is(.sp-card-live,.sp-card-scroll){
  display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:6px;
  flex:1;min-height:0;width:100%;height:100%;overflow-y:auto;overflow-x:hidden;
  padding:4px;overscroll-behavior:contain;scrollbar-gutter:stable;touch-action:pan-y;
}
:is(.sp-card-live,.sp-card-scroll)>*{flex-shrink:0;max-width:100%}
body[data-rep-layout] :is(.sp-card-live,.sp-card-scroll)>:first-child{margin-top:auto}
body[data-rep-layout] :is(.sp-card-live,.sp-card-scroll)>:last-child{margin-bottom:auto}
.sp-card-question[role="button"]{cursor:pointer}
.sp-card-question[role="button"]:focus-visible{outline:3px solid #1d4fc6;outline-offset:-3px}
.sp-active .sp-card h2{font-size:clamp(21px,5.8vw,28px);line-height:1.3;margin:4px 0}
.sp-active .sp-card .sp-answer{font-size:clamp(20px,5.5vw,26px);line-height:1.35}
.sp-active .sp-card-face>.sp-art{width:60px;height:60px}
.sp-active .sp-story-strip .sp-art{height:52px}
.sp-active .sp-card .sp-call{font-size:18px}
.sp-active .sp-gesture{font-size:14px}
.sp-active .sp-tap-hint{font-size:12px}
.sp-gesture-card[data-swipe-axis="horizontal"]{touch-action:pan-y}
.sp-gesture-card[data-swipe-axis="all"],.sp-gesture-card[data-swipe-axis="all"] .sp-card-live{touch-action:none}

/* Choices do not move when text changes or feedback appears. */
.sp-controls{flex:0 0 auto;display:flex;flex-direction:column;gap:6px;width:100%}
.sp-controls .sp-mark-slot{gap:5px}
.sp-controls .sp-self-check{font-size:12px;line-height:1.35;margin:0!important}
.sp-controls .sp-marks{grid-template-columns:1fr 1fr;gap:10px}
.sp-controls .sp-mark{height:58px;min-height:48px;font-size:26px}
.sp-controls .sp-mark span{font-size:13px}
.sp-controls .sp-directions{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:8px}
.sp-controls .sp-direction{min-height:50px;font-size:14px;overflow-wrap:anywhere}
.sp-controls .sp-help-row{gap:4px;min-height:0}
.sp-controls .sp-help-row button{min-height:44px;padding:6px 8px;font-size:12px}
.sp-feedback{height:28px;min-height:28px;overflow-y:auto;font:600 12px/1.15 'Nunito',sans-serif;color:#e0ebff;touch-action:pan-y}
.sp-true-round>h1{flex:0 0 auto;font-size:32px;margin:0}
.sp-true-round>h1 br{display:none}
.sp-true-round>h1 em::before{content:' '}
.sp-true-round>.sp-kicker{margin:0;font-size:10px;flex:0 0 auto}
.sp-true-round .sp-card-scroll h2{font-size:20px}
.sp-true-round .sp-card-scroll .sp-answer{font-size:20px}
.sp-true-round .sp-controls .sp-rest-options{margin:0;padding:0}
.sp-true-round .sp-rest-options summary{min-height:40px;padding:8px;font-size:12px}
@media(max-height:650px){
  body:is([data-rep-layout="ready"],[data-rep-layout="active"],[data-rep-layout="finisher"]){--app-header:56px}
  .sp-active .sp-card-face>.sp-art{width:48px;height:48px}
  .sp-controls .sp-mark{height:50px}
  .sp-active .sp-scoreboard strong{font-size:26px}
}
/* Very short landscape windows keep the choices usable while the card scrolls. */
@media(max-height:440px){
  .electric-theme .sp-guided-ready .sp-start-dock .sp-button{min-height:84px;padding:14px 12px;font-size:36px}
  body[data-rep-layout="active"] #header,body[data-rep-layout="finisher"] #header{--app-header:48px}
  body[data-rep-layout="active"] .sp-active,body[data-rep-layout="finisher"] .sp-true-round{position:relative;padding-right:42%;gap:4px}
  :is(.sp-active,.sp-true-round)>.sp-controls{position:absolute;right:0;top:0;bottom:0;width:39%;overflow-y:auto;padding:4px;justify-content:flex-end}
  .sp-controls .sp-marks,.sp-controls .sp-directions{grid-auto-flow:row;grid-template-columns:1fr}
  .sp-active>.sp-scoreboard{min-height:44px}
  :is(.sp-active,.sp-true-round)>.sp-top{min-height:0;font-size:9px}
  :is(.sp-active,.sp-true-round) .sp-top .sp-test-button{max-width:70px;min-height:44px;font-size:9px}
  .sp-true-round>h1{font-size:24px}
}

/* v166: keep all pause actions together and reachable on shorter phones. */
.sp-shell.sp-paused{gap:14px;padding-bottom:max(16px,env(safe-area-inset-bottom))}
.sp-paused .sp-top{position:static;width:100%;max-width:none;margin-bottom:8px}
.sp-paused h1{font-size:clamp(38px,10vw,56px)}
.sp-pause-actions{display:grid;gap:10px;width:100%;margin-top:6px}
.sp-pause-actions .sp-text{min-height:44px}
