/* Six beats share this town, these road labels, and the same notebook. */
#app.commuting{height:100svh;height:100dvh;min-height:0;padding:28px 32px 74px;align-items:center;overflow:visible}
.sam-stage{width:min(1130px,100%);height:100%;max-height:610px;display:flex;flex-direction:column;justify-content:center;gap:28px;animation:none}
/* The later generic .scene entrance must not fade the whole town on each render. */
.scene.sam-stage{animation:none;opacity:1;transform:none}
.stage-heading>.narrator{font-size:clamp(34px,4vw,53px);line-height:1.08;margin:0;min-height:2.2em;display:flex;align-items:center;justify-content:center;text-wrap:balance}
.stage-body{display:grid;grid-template-columns:minmax(0,2.2fr) minmax(260px,1fr);gap:36px;align-items:center;min-height:0;flex:1;max-height:450px}
.town-stage{position:relative;width:100%;aspect-ratio:2;isolation:isolate;border:3px solid var(--ink);border-radius:20px;background:var(--yellow);box-shadow:5px 6px 0 var(--ink)}
.town-stage>.town{width:100%;height:100%;display:block;overflow:visible;border-radius:16px}
.road-trace{fill:none;stroke:var(--road);stroke-width:7;opacity:.24;stroke-linecap:round;stroke-linejoin:round;transition:opacity .2s,stroke-width .2s}
.road-trace.predicted{opacity:.85;stroke-width:10;stroke-dasharray:8 12}.road-trace.travelled,.road-trace.walking-route{opacity:1;stroke-width:10}.road-trace.remembering{stroke-width:14;opacity:1}
.sam-walker ellipse{fill:#242b3655}.sam-walker image{filter:drop-shadow(0 2px 1px #242b3622)}
.fork-clock{fill:none;stroke:var(--paper);stroke-width:6;stroke-dasharray:163;stroke-dashoffset:calc(163 * var(--remaining,1));transform:rotate(-90deg);transform-origin:90px 213px;opacity:0}
.sam-stage[data-chapter-stage="approaching"] .fork-clock,.sam-stage[data-chapter-stage="committed"] .fork-clock{opacity:.95}
.rain{stroke:#d7efff;stroke-width:3;opacity:.95;pointer-events:none}.rain line{animation:town-rain .8s linear infinite;animation-delay:var(--delay)}
@keyframes town-rain{from{transform:translate(4px,-8px);opacity:0}25%{opacity:1}to{transform:translate(-8px,15px);opacity:0}}
.morning-weather{position:absolute;left:7%;top:5%;font-size:35px;line-height:1;filter:drop-shadow(1px 2px 0 var(--paper));pointer-events:none}.rain-strength{display:flex;gap:3px;justify-content:center;margin:4px 0 0}.rain-strength i{width:5px;height:5px;border-radius:50%;background:var(--ink)}
.scene-detail{position:absolute;left:var(--x);top:var(--y);transform:translate(-50%,-50%);font-size:29px;line-height:1;filter:drop-shadow(0 2px 0 var(--paper));pointer-events:none}.scene-detail small{display:block;font:700 10px DM;margin-top:3px;color:var(--ink)}
.route-choice{position:absolute;z-index:2;transform:translate(-50%,-50%);border:2px solid var(--ink);border-radius:8px;background:var(--road);box-shadow:2px 3px 0 var(--ink);font:700 14px DM;min-height:44px;min-width:84px;padding:7px 12px;line-height:1.2;color:var(--ink);transition:box-shadow .15s,filter .15s}
.route-market{left:56%;top:26%}.route-arcade{left:50%;top:51%}.route-park{left:52%;top:83%}.route-canal{left:49%;top:68%;font-size:12px;min-width:72px}
.route-choice:disabled{cursor:default;opacity:1}.route-choice:not(:disabled):hover,.route-choice:not(:disabled):focus-visible{filter:brightness(1.06);box-shadow:3px 5px 0 var(--ink);outline:3px solid var(--paper);outline-offset:3px}.chosen-route{border-style:dashed}.sam-route{border-style:solid;box-shadow:0 0 0 3px var(--paper),2px 3px 0 var(--ink)}
.route-choice b{display:block;font-size:11px;font-weight:400;margin-top:2px}.route-arrival{position:absolute;right:-12px;top:-13px;border-radius:50%;background:var(--paper);border:2px solid var(--ink);font-size:13px;width:25px;height:25px;display:grid;place-items:center}
.stage-notebook{position:relative;align-self:stretch;min-height:0;max-height:430px;background:#fff4cb;border:2px solid var(--ink);border-radius:4px 9px 7px 4px;box-shadow:4px 5px 0 var(--ink);padding:16px;display:flex;flex-direction:column;gap:14px;transform:rotate(1deg);text-align:left}
.stage-notebook:before{content:'';position:absolute;inset:-7px 7px 7px -6px;background:var(--paper);border:1px solid var(--ink);border-radius:4px;z-index:-1;opacity:0;transition:opacity .2s}.stage-notebook.spilling:before{opacity:1}
.notebook-top{display:flex;justify-content:space-between;align-items:center;height:26px;flex:none}.notebook-top>span:first-child{font-size:22px}.walk-score{font:700 20px DM;font-variant-numeric:tabular-nums}
.written-rules{display:flex;flex-direction:column;gap:7px;min-height:205px}.hand-rule{font:700 22px/1.05 Caveat;margin:0;letter-spacing:-.01em}.written-rules.two-pages{display:grid;grid-template-columns:1fr 1fr;grid-auto-flow:column;grid-template-rows:repeat(5,min-content);gap:9px 10px;align-content:start}.two-pages .hand-rule{font-size:19px}.new-rule{animation:scribble .45s both}
@keyframes scribble{from{clip-path:inset(0 100% 0 0)}to{clip-path:inset(0 0 0 0)}}
.morning-cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin-top:auto;flex:none;perspective:600px}.morning-card{position:relative;min-height:29px;border:1px solid #242b3666;border-radius:3px;background:var(--paper);padding:4px;transition:background .15s;transform-style:preserve-3d}
.card-front{display:flex;gap:1px;align-items:center;flex-wrap:wrap;font-size:13px;line-height:1.1;min-height:19px;backface-visibility:hidden}.memory-route{font:700 8px DM;color:var(--ink);margin-left:auto;width:12px;height:12px;border-radius:50%;background:var(--road);display:grid;place-items:center}.card-back{display:none;font:700 18px/1.05 Caveat}
.remembering.morning-card{background:var(--yellow);outline:2px solid var(--ink);outline-offset:1px}.new-memory{animation:memory-ink .4s both}@keyframes memory-ink{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:none}}
.weight-notes{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;min-height:105px;max-height:105px;flex:none}.weight-note{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;border-bottom:1px dashed #242b3644;padding:3px 0 10px}.weight-note>span:first-child{font-size:29px;grid-row:1/3}.weight-note b{font:700 32px/1 Caveat;letter-spacing:-.02em}.weight-note.sparse-weight b{text-decoration:underline;text-decoration-style:wavy;text-decoration-color:#242b3655;text-underline-offset:5px}.evidence-dots,.occurrences{display:flex;justify-content:flex-start;align-items:center;gap:3px;flex-wrap:wrap;margin-top:7px}.evidence-dots i,.occurrences i{display:block;width:4px;height:4px;background:var(--ink);border-radius:50%;flex:none}.written-equation{font:700 19px/1.2 Caveat;text-wrap:balance;margin-top:-4px}
.has-funnel>.town{opacity:.3;filter:saturate(.55);transition:opacity .35s}.has-funnel .morning-weather{opacity:.3}
.stage-funnel{position:absolute;left:51%;top:52%;transform:translate(-50%,-50%);width:28%;height:85%;min-width:90px;z-index:3}
.stage-funnel>svg{width:100%;height:100%;overflow:visible}.stage-funnel path{fill:#ffda59;stroke:var(--ink);stroke-width:3;stroke-linejoin:round}.stage-funnel .funnel-lip{fill:none;stroke-width:5}
.weight-slots{position:absolute;left:16%;right:16%;top:11%;height:61%;display:flex;flex-direction:column;align-items:center;justify-content:space-around;pointer-events:none}.weight-slot{width:45px;min-height:40px;display:flex;align-items:center;justify-content:center;gap:4px;font-size:25px}.weight-slot i{width:14px;height:14px;border:2px dashed var(--ink);border-radius:50%;opacity:.35}.weight-slot b{font:700 21px/1 Caveat}.weight-slot.filled{animation:weight-arrives .45s both}@keyframes weight-arrives{from{transform:translateY(-17px) scale(.6);opacity:.3}to{transform:none;opacity:1}}
.factor-orbit{position:absolute;z-index:4;left:clamp(30px,var(--x),calc(100% - 30px));top:clamp(27px,var(--y),calc(100% - 29px));transform:translate(-50%,-50%);width:54px;display:flex;flex-direction:column;align-items:center}
.memory-token{width:48px;height:48px;border:0;border-radius:50%;background:var(--paper);box-shadow:0 0 0 2px var(--ink),2px 3px 0 var(--ink);font-size:28px;display:grid;place-items:center;padding:0;color:var(--ink);touch-action:none;user-select:none;cursor:grab}.memory-token:disabled{cursor:default}.memory-token:not(:disabled):hover,.memory-token:focus-visible{background:var(--yellow);outline:3px solid var(--paper);outline-offset:4px}.occurrences{justify-content:center;max-width:50px;min-height:6px;margin-top:8px;gap:2px}.occurrences i{width:3px;height:3px}
.retained-icon{position:absolute;z-index:5;left:51%;top:calc(21% + var(--slot)*18%);transform:translate(-50%,-50%);width:44px;height:44px;border:0;border-radius:50%;background:transparent;font-size:29px;touch-action:none;padding:0}.retained-icon:focus-visible{outline:3px solid var(--ink);outline-offset:1px}
.drop-hover path{fill:var(--mint)}.lost-cause .memory-token{background:var(--pink);animation:remember-the-missing 1.4s ease-in-out infinite}.lost-cause:before{content:'';position:absolute;inset:-8px 1px 7px;border:2px solid var(--pink);border-radius:50%;animation:missing-ring 1.4s ease-out infinite;pointer-events:none}@keyframes remember-the-missing{50%{transform:scale(1.12);box-shadow:0 0 0 3px var(--ink),2px 4px 0 var(--ink)}}@keyframes missing-ring{to{transform:scale(1.7);opacity:0}}
.sam-stage[data-chapter-stage="compressing"] .factor-orbit{animation:dropped-detail 1.4s .15s both}@keyframes dropped-detail{to{transform:translate(-90%,70%) rotate(-12deg);opacity:.25}}
.remembered-flight,.dragged-icon{position:fixed;z-index:25;pointer-events:none;font-size:30px;line-height:1;filter:drop-shadow(1px 2px 0 var(--paper))}.dragged-icon{font-size:38px}
.feedback-output{position:absolute;left:50%;top:74%;transform:translate(-50%,0);display:flex;flex-direction:column;align-items:center;font-size:43px;line-height:1;animation:feedback-lands .8s .5s both}.feedback-output b{font:700 33px DM;background:var(--paper);border:2px solid var(--ink);border-radius:6px;margin-top:5px;padding:2px 8px}@keyframes feedback-lands{from{opacity:0;transform:translate(-50%,-25px)}to{opacity:1;transform:translate(-50%,0)}}
.flipping-feedback .morning-card{animation:reply-flip 1.5s both;animation-delay:calc(var(--i,0)*30ms)}.flipping-feedback .card-front,.feedback-notebook .card-front{display:none}.feedback-notebook .card-back{display:block}.feedback-notebook .written-equation{visibility:hidden}.feedback-notebook .weight-note>span:first-child{font-size:27px}@keyframes reply-flip{0%{transform:rotateY(180deg);opacity:.2}60%,100%{transform:rotateY(0);opacity:1}}
body.story-paused .sam-stage *,body.story-paused .remembered-flight{animation-play-state:paused!important}
@media(max-width:700px){
 #app.commuting{padding:16px 18px calc(64px + env(safe-area-inset-bottom,0px))}
 .sam-stage{gap:18px;max-height:720px}.stage-heading>.narrator{font-size:clamp(27px,6.5vw,37px);min-height:2.25em;flex:none}
 .stage-body{display:flex;flex-direction:column;gap:20px;flex:none;max-height:none;align-items:center}.town-stage{width:100%;max-width:470px;box-shadow:3px 4px 0 var(--ink);border-width:2px;border-radius:13px}
 .stage-notebook{width:100%;max-width:470px;height:220px;padding:12px 14px;gap:9px;transform:rotate(.6deg);box-shadow:3px 4px 0 var(--ink)}.notebook-top{height:20px}.notebook-top>span:first-child{font-size:17px}.walk-score{font-size:16px}
 .written-rules{min-height:99px;gap:4px}.hand-rule{font-size:19px}.written-rules.two-pages{min-height:99px;gap:5px 12px}.two-pages .hand-rule{font-size:16px}
 .morning-cards{grid-template-columns:repeat(5,minmax(0,1fr));gap:4px}.morning-card{min-height:25px;padding:3px}.card-front{font-size:10px;min-height:17px}.memory-route{width:10px;height:10px;font-size:7px}.card-back{font-size:13px}
 .weight-notes{grid-template-columns:repeat(3,minmax(0,1fr));gap:9px;min-height:83px;max-height:83px}.weight-note{display:flex;flex-direction:column;gap:3px;padding:3px 0 8px;justify-content:center}.weight-note>span:first-child{font-size:24px}.weight-note b{font-size:27px}.evidence-dots{margin-top:4px;gap:2px;max-width:48px;justify-content:center}.evidence-dots i{width:3px;height:3px}.written-equation{text-align:center;font-size:16px;margin:0}
 .route-choice{font-size:11px;min-width:65px;min-height:44px;padding:5px 7px;border-width:1.5px;box-shadow:1px 2px 0 var(--ink)}.route-choice b{font-size:9px}.route-canal{font-size:9px;min-width:55px;min-height:34px;left:28%;top:62%}.route-arrival{width:18px;height:18px;font-size:10px;right:-9px;top:-10px;border-width:1.5px}
 .scene-detail{font-size:23px}.scene-detail small{font-size:8px}.morning-weather{font-size:25px;left:5%;top:3%}.rain-strength{gap:2px;margin-top:2px}.rain-strength i{width:3px;height:3px}
 .memory-token{width:40px;height:40px;font-size:24px}.factor-orbit{width:47px;left:clamp(25px,var(--x),calc(100% - 25px));top:clamp(25px,var(--y),calc(100% - 30px))}.occurrences{margin-top:6px;max-width:44px;gap:2px}
 .stage-funnel{width:31%;height:91%;min-width:80px;top:52%}.weight-slot{min-height:28px;width:44px;font-size:21px}.weight-slot b{font-size:17px}.weight-slots{height:62%;top:8%}.retained-icon{width:34px;height:34px;font-size:24px;top:calc(21% + var(--slot)*18%)}.feedback-output{font-size:29px;top:72%}.feedback-output b{font-size:22px;padding:1px 5px}
}
@media(max-height:650px) and (min-width:701px){
 #app.commuting{padding:14px 28px 64px}.sam-stage{gap:14px;max-height:510px}.stage-heading>.narrator{font-size:36px;min-height:1.6em}.stage-body{gap:24px;grid-template-columns:minmax(0,2.1fr) minmax(240px,1fr);max-height:350px}.stage-notebook{height:100%;max-height:350px;padding:12px;gap:9px}.written-rules{min-height:148px;gap:4px}.hand-rule{font-size:19px}.two-pages .hand-rule{font-size:17px}.written-rules.two-pages{gap:5px 8px}.morning-cards{gap:4px}.morning-card{min-height:23px;padding:2px}.card-front{font-size:11px;min-height:17px}.weight-notes{min-height:92px;max-height:92px;gap:7px}.weight-note{padding-bottom:6px}.weight-note b{font-size:28px}.weight-note>span:first-child{font-size:25px}.written-equation{font-size:16px}.notebook-top{height:20px}
 .memory-token{width:42px;height:42px;font-size:25px}.factor-orbit{width:48px}.scene-detail{font-size:25px}.route-choice{font-size:12px;min-width:74px}
}
@media(max-height:620px) and (max-width:479px){
 #app.commuting{padding-top:12px}.sam-stage{gap:12px}.stage-heading>.narrator{font-size:27px;min-height:2.1em}.stage-body{gap:15px}.stage-notebook{height:218px;padding:10px 12px;gap:7px}.written-rules{min-height:101px}.written-rules.two-pages{min-height:101px;gap:4px 7px}.two-pages .hand-rule{font-size:15px}.hand-rule{font-size:18px}.weight-notes{min-height:80px;max-height:80px}.morning-card{min-height:24px}.card-front{font-size:10px}.written-equation{font-size:15px}.memory-token{width:38px;height:38px;font-size:23px}.factor-orbit{left:clamp(25px,var(--x),calc(100% - 25px));top:clamp(24px,var(--y),calc(100% - 27px))}.weight-slot{min-height:25px;font-size:19px}.weight-slot b{font-size:15px}.weight-slots{left:6%;right:6%}.retained-icon{font-size:23px}
}
@media(max-height:420px) and (min-width:480px){
 #app.commuting{padding:8px 16px 56px}.sam-stage{gap:8px;max-height:none}.stage-heading>.narrator{font-size:25px;min-height:1.3em}.stage-body{display:grid;grid-template-columns:minmax(0,1.45fr) minmax(190px,1fr);gap:20px;max-height:none;flex:1;align-items:center}.town-stage{max-width:none}.stage-notebook{height:100%;min-height:200px;max-height:225px;padding:8px;gap:5px}.notebook-top{height:16px}.notebook-top>span:first-child{font-size:15px}.walk-score{font-size:13px}.written-rules{min-height:100px;gap:3px}.hand-rule{font-size:15px}.written-rules.two-pages{min-height:100px;gap:3px 5px}.two-pages .hand-rule{font-size:13px}.morning-cards{grid-template-columns:repeat(5,minmax(0,1fr));gap:3px}.morning-card{min-height:21px;padding:1px}.card-front{font-size:8px;min-height:16px}.memory-route{width:8px;height:8px;font-size:6px}.card-back{font-size:11px}
 .weight-notes{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;min-height:74px;max-height:74px}.weight-note{display:flex;flex-direction:column;gap:3px;padding:3px 0 7px;justify-content:center}.weight-note>span:first-child{font-size:21px}.weight-note b{font-size:24px}.evidence-dots{justify-content:center;gap:2px;max-width:42px;margin-top:3px}.evidence-dots i{width:3px;height:3px}.written-equation{font-size:14px;text-align:center;margin:0}.route-choice{font-size:10px;min-height:40px;min-width:62px;padding:4px 6px}.route-choice b{font-size:8px}.route-canal{font-size:8px;min-height:30px;min-width:49px;left:28%;top:62%}
 .scene-detail{font-size:21px}.morning-weather{font-size:23px}.memory-token{width:36px;height:36px;font-size:23px}.factor-orbit{width:43px;left:clamp(23px,var(--x),calc(100% - 23px));top:clamp(23px,var(--y),calc(100% - 28px))}.occurrences{margin-top:5px;gap:2px;max-width:43px}.stage-funnel{width:30%;height:89%;min-width:79px}.weight-slot{min-height:26px;width:38px;font-size:19px}.weight-slot b{font-size:15px}.retained-icon{font-size:22px;width:32px;height:32px}.feedback-output{font-size:27px}.feedback-output b{font-size:20px}
}
@media(prefers-reduced-motion:reduce){.rain line,.new-memory,.new-rule,.weight-slot,.lost-cause .memory-token,.lost-cause:before,.factor-orbit,.feedback-output,.flipping-feedback .morning-card{animation:none!important}.road-trace,.morning-card{transition:none}}
@media(max-width:479px){
 .town-stage{aspect-ratio:1.75}
 .route-market{top:22%}
 .factor-orbit[data-orbit="weather"]{--x:14%!important;--y:14%!important}
 .factor-orbit[data-orbit="bread"]{--x:86%!important;--y:14%!important}
 .factor-orbit[data-orbit="time"]{--x:10%!important;--y:53%!important}
 .factor-orbit[data-orbit="works"]{--x:88%!important;--y:48%!important}
 .factor-orbit[data-orbit="birthday"]{--x:73%!important;--y:87%!important}
 .factor-orbit[data-orbit="friend"]{--x:88%!important;--y:79%!important}
 .factor-orbit[data-orbit="scarf"]{--x:14%!important;--y:87%!important}
}
@media(max-height:420px) and (min-width:480px){.stage-notebook{min-height:188px;max-height:215px}}

.stage-notebook:has(.weight-notes) .morning-cards{grid-template-columns:repeat(5,minmax(0,1fr))}
.evidence-dots{justify-content:center;gap:2px;max-width:50px}.evidence-dots i{width:3px;height:3px}
.sam-stage[data-chapter-stage="cost"] .factor-orbit:not(.lost-cause){opacity:.45}

/* Explanations are authored after observation; only real collisions are selectable. */
.condition-detail{display:grid;place-items:center;width:44px;min-height:44px;border:2px solid var(--ink);border-radius:50%;background:var(--paper);color:var(--ink);padding:4px;pointer-events:auto;font-family:DM;line-height:1;box-shadow:1px 2px 0 var(--ink)}
.condition-detail:disabled{border-color:transparent;background:transparent;box-shadow:none;cursor:default;pointer-events:none}
.condition-detail:not(:disabled):hover,.condition-detail:not(:disabled):focus-visible{background:var(--yellow);outline:3px solid var(--paper);outline-offset:2px}
.scene-detail.condition-detail{height:44px}.condition-detail .rain-strength{margin:2px 0 0}
.bread-quantity{position:absolute;right:-2px;bottom:-2px;width:16px;height:16px;display:grid;place-items:center;border:1px solid var(--ink);border-radius:50%;background:var(--yellow);font:700 11px DM}
.conflict-rule{border:1px solid #242b3666;background:var(--paper);padding:7px 9px;border-radius:8px;min-height:44px;text-align:left;color:var(--ink)}
.conflict-rule:hover,.conflict-rule:focus-visible{background:var(--yellow);outline:2px solid var(--ink);outline-offset:2px}
.amount-rule{color:#ad263c}.road-pulls{pointer-events:none}.road-pulls path{opacity:.9;filter:drop-shadow(0 1px 1px #242b36)}.road-pulls text{font-size:23px;paint-order:stroke;stroke:var(--paper);stroke-width:4px}
.route-choice{min-height:44px}.route-choice small{display:block;font:600 9px DM;min-height:11px}.route-bar{display:block;height:5px;width:100%;min-width:50px;background:#fffdf788;border-radius:4px;margin-top:4px;overflow:hidden}.route-bar i{display:block;height:100%;background:var(--ink);transition:width .15s}
.route-canal{left:28%;top:62%;min-width:100px}.weight-notes{display:flex;flex-direction:column;gap:5px;min-height:0;max-height:none;flex:none}
.weight-note{display:grid;grid-template-columns:60px 1fr;align-items:center;gap:2px 7px;border-bottom:1px dashed #242b3644;padding:4px 0;min-height:40px}
.weight-note label{display:flex;align-items:center;gap:8px;grid-row:1/3}.weight-note label span{font-size:22px}.weight-note label b{font:700 26px/1 Caveat;font-variant-numeric:tabular-nums}
.weight-note small{font:500 10px/1.15 DM}.weight-note .evidence-dots{justify-content:flex-start;margin:2px 0 0;max-width:none}
.replay-score{display:grid;grid-template-columns:1fr 1fr;gap:5px;font:500 12px DM;text-align:center;border-top:1px solid #242b3644;padding-top:8px}.replay-score b{display:block;font:700 25px Caveat}.replay-score small{grid-column:1/-1;font-size:9px;color:#59595c}
.replay-check{font:700 10px DM}.weight-note input{width:100%;margin:0;min-width:0;height:36px;accent-color:var(--ink);cursor:ew-resize;touch-action:pan-y}.repair-controls .weight-note label{grid-row:auto}.repair-controls .weight-note{min-height:44px}
.paired-mornings{display:grid;grid-template-columns:1fr 1fr;gap:7px;border-top:1px solid #242b3655;padding-top:10px;margin-top:auto}.pair-morning{background:var(--paper);border:1px solid #242b3677;border-radius:5px;padding:7px;display:flex;flex-direction:column;gap:5px;font:500 10px/1.2 DM;min-width:0}.pair-morning strong{min-height:2.4em;text-wrap:balance}.pair-prediction{font-size:10px}
.restore-detail{position:absolute;left:12%;top:50%;z-index:5;display:flex;flex-direction:column;align-items:center;gap:5px;border:2px solid var(--ink);border-radius:10px;background:var(--paper);padding:8px;color:var(--ink);min-width:80px;box-shadow:2px 3px var(--ink)}.restore-detail span{font-size:28px}.restore-detail small{font:600 10px DM}.restore-detail:disabled{opacity:.65}.restore-detail:not(:disabled):hover,.restore-detail:focus-visible{background:var(--yellow);outline:3px solid var(--paper);outline-offset:2px}
@media(max-width:700px){
 .stage-notebook{gap:6px}.written-rules{min-height:105px;gap:4px}.written-rules.two-pages{gap:5px 9px}.two-pages .hand-rule{font-size:16px}.hand-rule{font-size:19px}.conflict-rule{font-size:17px;padding:4px 6px;min-height:36px}
 .numerical-book .notebook-top{height:16px}.weight-notes{display:flex;gap:2px;min-height:0;max-height:none}.weight-note{grid-template-columns:60px 1fr;min-height:29px;padding:1px 0}.weight-note label span{font-size:19px}.weight-note label b{font-size:23px}.weight-note small{font-size:9px}.weight-note .evidence-dots{margin:0}.replay-score{font-size:10px;gap:2px;padding-top:4px}.replay-score b{display:inline;font-size:21px}.replay-score small{font-size:8px}.numerical-book .morning-card{min-height:20px;padding:2px}.numerical-book .card-front{min-height:15px;font-size:9px}
 .repair-controls .weight-note{min-height:31px;padding:0}.weight-note input{height:30px}.paired-mornings{padding-top:4px;gap:4px}.pair-morning{font-size:9px;gap:3px;padding:4px}.pair-prediction{font-size:9px}.pair-morning strong{min-height:1.2em}.restore-detail{left:8%;top:37%;min-width:60px;padding:5px}.restore-detail small{font-size:8px}.restore-detail span{font-size:22px}
 .route-choice small{font-size:8px;min-height:9px}.route-bar{min-width:36px;height:4px;margin-top:2px}.route-canal{min-width:80px;font-size:9px;min-height:40px}
}
@media(max-height:420px) and (min-width:480px){
 .written-rules{min-height:0;gap:3px}.written-rules.two-pages{gap:3px 5px}.hand-rule,.two-pages .hand-rule{font-size:14px}.conflict-rule{min-height:30px;font-size:14px;padding:3px 4px}.weight-note{min-height:28px;padding:0;grid-template-columns:52px 1fr}.weight-note label b{font-size:21px}.weight-note label span{font-size:18px}.weight-note small{font-size:8px}.weight-notes{gap:2px}.replay-score{font-size:9px}.replay-score b{font-size:19px}.replay-score small{font-size:8px}.numerical-book .morning-cards{gap:2px}.numerical-book .morning-card{min-height:18px}.numerical-book .card-front{font-size:8px;min-height:13px}.repair-controls .weight-note{min-height:28px}.weight-note input{height:28px}.paired-mornings{padding-top:3px}.pair-morning{font-size:8px;padding:3px}.pair-prediction{font-size:8px}.route-canal{min-height:34px;min-width:72px}.route-choice small{font-size:7px}.restore-detail{min-width:56px}.condition-detail{font-size:22px}
}

.pair-inputs{display:flex;gap:3px;min-height:15px}.pair-inputs i{font-style:normal}.inactive-input{opacity:.2}

@media(max-width:700px){.repair-book{height:260px}.sam-stage:has(.repair-book) .town-stage{aspect-ratio:2}}
@media(max-width:479px) and (max-height:620px){.repair-book{height:254px}}
@media(max-height:420px) and (min-width:480px){.repair-book{height:225px;min-height:225px;max-height:225px;padding:6px;gap:3px}.repair-book .pair-morning{gap:2px}.repair-book .pair-inputs{min-height:12px}}

.written-rules.two-pages{grid-auto-flow:row;grid-template-rows:none}

@media(max-width:700px){.exception-prefix{display:none}}

.written-rules{flex-shrink:0}
@media(max-width:700px){.stage-notebook:has(.conflict-rule){height:242px}.sam-stage:has(.conflict-rule) .town-stage{aspect-ratio:2}}
@media(max-height:420px) and (min-width:480px){.stage-notebook:has(.conflict-rule){height:100%;max-height:225px}}

.chapter-advance-cue{position:absolute;right:14px;bottom:10px;font:700 30px Caveat;color:var(--ink);background:var(--paper);border-radius:50%;width:34px;text-align:center;z-index:5}
.chapter-restart{position:absolute;right:10px;bottom:10px;z-index:6;min-height:44px;padding:7px 12px;border:2px solid var(--ink);border-radius:10px;background:var(--paper);color:var(--ink);font:700 16px Caveat;cursor:pointer;box-shadow:2px 3px var(--ink)}.chapter-restart:hover,.chapter-restart:focus-visible{background:var(--yellow);outline:3px solid var(--ink);outline-offset:3px}

/* Show the actual conflict, and make the notebook score inspectable. */
.conflict-morning{font:400 clamp(13px,1.4vw,17px)/1.35 DM;color:#565a62;text-align:center;margin:4px 0 0;text-wrap:balance}
.conflict-rule{border-left:5px solid var(--rule-road);display:flex;flex-direction:column;justify-content:center;gap:2px}
.conflict-condition{display:flex;align-items:center;gap:5px;font:500 11px/1.15 DM}
.conflict-condition i{font-style:normal;font-size:15px}.conflict-rule strong{font:700 22px/1 Caveat}
.inactive-rule{opacity:.35}.notebook-top{position:relative;z-index:6}
.score-help{position:relative;align-self:center;flex:none}.walk-score{border:0;border-bottom:1px dotted currentColor;background:transparent;color:var(--ink);padding:4px 0;min-width:44px;min-height:36px;cursor:help;line-height:1.1}
.walk-score:focus-visible{outline:2px solid var(--ink);outline-offset:3px;border-radius:3px}
.notebook-tooltip{position:fixed;width:260px;max-height:calc(100dvh - 24px);overflow:auto;max-width:calc(100vw - 24px);z-index:100;padding:13px 15px;background:var(--paper);color:var(--ink);border:2px solid var(--ink);border-radius:8px;box-shadow:3px 4px 0 var(--ink);font:400 13px/1.45 DM;text-align:left;cursor:default}
.notebook-tooltip[hidden]{display:none}.notebook-tooltip strong,.notebook-tooltip>span{display:block}.notebook-tooltip p{margin:7px 0 0;color:#565a62}.notebook-tooltip>span:not(:empty){margin-top:7px}.rule-note{border:0;padding:0;background:transparent;text-align:left;color:var(--ink);cursor:help}.morning-card{color:var(--ink);font:inherit;text-align:left;cursor:help}.morning-card:hover,.morning-card:focus-visible,.rule-note:hover,.rule-note:focus-visible{outline:2px solid var(--ink);outline-offset:2px}.rule-note.inactive-rule:hover,.rule-note.inactive-rule:focus-visible{opacity:1}

@media(max-width:700px){.conflict-condition{font-size:10px;gap:3px}.conflict-condition i{font-size:12px}.conflict-rule strong{font-size:19px}.conflict-rule{padding:4px 5px;min-height:40px}.conflict-morning{font-size:12px;margin-top:2px}.notebook-tooltip{font-size:12px}}
@media(max-height:420px) and (min-width:480px){.conflict-morning{font-size:11px;margin-top:0}.conflict-rule{padding:2px 4px;min-height:32px;gap:1px}.conflict-condition{font-size:9px}.conflict-condition i{font-size:10px}.conflict-rule strong{font-size:17px}}

@media(max-width:700px){.stage-notebook:has(.written-rules){height:auto;min-height:242px;max-height:none}}

/* The run grows; the stage does not. Keep the notebook readable and editable. */
.stream-book .written-rules{display:flex;flex-direction:column;min-height:0;flex:1;overflow-y:auto;overscroll-behavior:contain;gap:5px;padding:3px;max-height:240px}
.rule-row{display:flex;gap:5px;align-items:center;min-width:0;flex:none}.rule-row>.hand-rule{flex:1;min-width:0;min-height:30px}.rule-pencil{flex:none;border:0;background:transparent;color:var(--ink);font:700 22px Caveat;width:36px;min-height:36px;border-radius:5px;cursor:pointer}.rule-pencil:hover,.rule-pencil:focus-visible{background:var(--yellow);outline:2px solid var(--ink)}
.run-score{display:flex;align-items:baseline;gap:5px}.run-score small{font:400 10px DM}.history-window{font:400 9px DM;color:#565a62;margin-top:auto}.history-window+.morning-cards{margin-top:0}.stream-book .morning-cards{grid-template-columns:repeat(4,minmax(0,1fr))}
.weights-invitation{border:2px solid var(--ink);background:var(--yellow);color:var(--ink);font:700 19px Caveat;min-height:40px;border-radius:8px;flex:none;cursor:pointer}.weights-invitation:hover,.weights-invitation:focus-visible{outline:2px solid var(--ink);outline-offset:2px}
.keep-rules{border:1px solid var(--ink);border-radius:6px;background:var(--paper);color:var(--ink);font:700 17px Caveat;min-height:34px;flex:none;cursor:pointer}.keep-rules:hover,.keep-rules:focus-visible{background:var(--yellow);outline:2px solid var(--ink)}
.rule-editor{display:flex;flex-direction:column;gap:10px;min-height:0}.editor-rule{font:700 24px Caveat;margin:0}.editor-terms{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px}.editor-terms button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;border:1px solid #242b3666;border-radius:6px;background:var(--paper);color:var(--ink);min-height:48px;padding:4px;font:400 9px DM;cursor:pointer}.editor-terms i{font-style:normal;font-size:20px}.editor-terms [aria-pressed="true"]{background:var(--yellow);border:2px solid var(--ink)}
.editor-roads,.editor-actions{display:flex;gap:5px}.editor-roads button,.editor-actions button{flex:1;min-height:36px;padding:5px;border:1px solid var(--ink);border-radius:6px;color:var(--ink);font:700 13px DM;background:var(--paper);cursor:pointer}.editor-roads button{background:var(--road)}.editor-roads [aria-pressed="true"]{outline:2px solid var(--ink);outline-offset:1px}.editor-actions [data-rule-save]{background:var(--yellow)}.editor-actions button:disabled{opacity:.35;cursor:default}.editor-actions [data-rule-remove]{font-size:11px;color:#ad263c}.editor-terms button:focus-visible,.editor-actions button:focus-visible{outline:2px solid var(--ink);outline-offset:2px}
.dot-total{font:600 9px DM;margin-left:3px}.editing-book{max-height:none}.stream-book .two-pages .hand-rule{font-size:20px}
@media(max-width:700px){.stream-book{min-height:240px;max-height:310px!important;height:280px!important;padding:10px 12px}.stream-book .written-rules{max-height:150px;flex-shrink:1}.stream-book .hand-rule,.stream-book .two-pages .hand-rule{font-size:18px}.stream-book .rule-pencil{min-height:32px;width:32px}.stream-book .morning-cards{grid-template-columns:repeat(6,minmax(0,1fr))}.stream-book .history-window{font-size:8px}.stream-book.editing-book{height:auto!important;min-height:0;max-height:none!important}.rule-editor{gap:7px}.editor-terms button{min-height:36px;font-size:8px;padding:2px}.editor-terms i{font-size:16px}.editor-rule{font-size:21px}.editor-roads button,.editor-actions button{min-height:32px;font-size:10px}.weights-invitation{min-height:34px;font-size:17px}.stream-book.repair-book{height:260px!important}.sam-stage[data-stream="true"]{gap:18px}.stream-book.numerical-book{height:280px!important}.stream-book .replay-score{flex:none}}
@media(max-width:479px) and (max-height:650px){.stream-book{height:220px!important;min-height:0}.stream-book .written-rules{max-height:110px}.stream-book .hand-rule,.stream-book .two-pages .hand-rule{font-size:16px}.stream-book .rule-row>.hand-rule{min-height:26px}.stream-book .rule-pencil{min-height:28px}.stream-book .morning-card{min-height:20px;padding:1px}.stream-book .card-front{min-height:15px;font-size:8px}.stream-book.editing-book{padding:7px 9px}.rule-editor{gap:5px}.editor-terms button{min-height:30px}.editor-terms i{font-size:14px}.editor-terms button span{font-size:7px}.editor-rule{font-size:18px}.editor-roads button,.editor-actions button{min-height:28px}.sam-stage[data-stream="true"]{gap:10px}.stream-book.numerical-book{height:248px!important}.stream-book.repair-book{height:254px!important}}
@media(max-height:420px) and (min-width:480px){.stream-book{max-height:210px;min-height:0;padding:7px;gap:4px}.stream-book .written-rules{max-height:110px}.stream-book .hand-rule,.stream-book .two-pages .hand-rule{font-size:14px}.stream-book .rule-pencil{min-height:26px;width:26px}.stream-book .rule-row>.hand-rule{min-height:26px}.stream-book .morning-card{min-height:17px}.stream-book .card-front{font-size:8px;min-height:12px}.stream-book .history-window{font-size:7px}.editor-rule{font-size:16px}.rule-editor{gap:4px}.editor-terms{grid-template-columns:repeat(4,minmax(0,1fr));gap:3px}.editor-terms button{min-height:28px;padding:1px;font-size:6px}.editor-terms i{font-size:12px}.editor-roads button,.editor-actions button{min-height:26px;font-size:8px}.weights-invitation{min-height:28px;font-size:14px}.stream-book.editing-book{max-height:225px}.dot-total{font-size:7px}}
@media(max-width:479px) and (max-height:650px){
 .sam-stage[data-stream="true"]:has(.editing-book) .conflict-morning{display:none}
 .sam-stage[data-stream="true"]:has(.editing-book) .town-stage{aspect-ratio:2.6}
 .sam-stage[data-stream="true"]:has(.editing-book) .narrator{font-size:24px;min-height:1.3em}
 .editing-book .editor-terms{grid-template-columns:repeat(4,minmax(0,1fr));gap:4px}
 .editing-book .editor-terms button{line-height:1.1;gap:2px;min-height:36px;padding:2px}
 .editing-book .editor-terms i{line-height:1;font-size:16px}
 .editing-book .editor-terms button span{font-size:8px}
}

/* A first-action cue, retired as soon as the player writes a rule. */
.first-rule-goal{margin:auto 0;font:700 25px/1.2 Caveat;text-wrap:balance;color:var(--ink)}
.first-rule-target{z-index:3;outline:2px solid var(--yellow);outline-offset:3px}
.first-rule-nudge{position:absolute;left:calc(100% + 10px);top:50%;transform:translateY(-50%);white-space:nowrap;background:var(--paper);color:var(--ink);border-radius:5px;padding:6px 8px;font:500 13px/1.2 DM;pointer-events:none}
.first-rule-nudge:before{content:"← ";}
@media(max-width:700px){.first-rule-goal{font-size:23px}.first-rule-nudge{left:-12px;top:calc(100% + 5px);transform:none;white-space:normal;width:92px;font-size:12px;padding:5px 6px}.first-rule-nudge:before{content:"↑ ";}}
