/* Compact mobile controls leave the remaining viewport to falling words. */
@media(max-width:600px){
body[data-page=falling] .toolbar,body[data-page=falling].is-playing .toolbar{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));align-items:center;gap:4px 6px;padding:4px 6px}
body[data-page=falling] .toolbar>div{display:flex;align-items:center;justify-content:center;gap:3px;min-width:0;white-space:nowrap;font-size:10px;line-height:1.2}
body[data-page=falling] .toolbar strong{font-size:17px;line-height:1.2}
body[data-page=falling] .toolbar #exitGame{width:100%;min-width:0;min-height:32px;height:32px;padding:4px 5px;font-size:11px;white-space:nowrap}
body[data-page=falling] .toolbar #start{grid-column:1 / 3}
body[data-page=falling] .toolbar #pause{grid-column:3 / 5}
body[data-page=falling] .toolbar #start,body[data-page=falling] .toolbar #pause{width:100%;margin:0;min-height:32px;height:32px;padding:4px 8px;font-size:12px}
body[data-page=falling].is-playing main{padding:2px}
body[data-page=falling].is-playing .stage{margin:0 5px;min-height:50px}
body[data-page=falling].is-playing #answerForm{padding:2px 6px max(2px,env(safe-area-inset-bottom,0px))}
body[data-page=falling].is-playing #feedback,body[data-page=falling].is-playing #feedback.answer-result{height:24px;min-height:24px;max-height:24px;margin:1px 6px;padding:0 4px}
body[data-page=falling].is-playing .level-track{margin:2px 6px;height:3px}
body[data-page=falling].is-playing .bottom-game-select{padding:2px 6px}
body[data-page=falling].is-playing .bottom-game-select a{height:30px;min-height:30px;padding:3px 12px}
}

/* Restore the original game toolbar; move only mode selection above input. */
body[data-page=falling] .setup h1{font-size:24px;margin:0 0 8px}
body[data-page=falling] .setup .micro-demo{font-size:15.5px;margin:0 auto 6px}
body[data-page=falling] .game>.modes{width:calc(100% - 20px);max-width:none;margin:4px 10px 2px;flex-shrink:0;padding:2px;gap:4px}
body[data-page=falling] .game>.modes button{min-height:36px;padding:5px 7px;font-size:12px;line-height:1.25}
body[data-page=falling] .game>.modes button:disabled{opacity:.85;cursor:default}
body[data-page=falling] .endline{border-top:2px solid #c998a3;box-shadow:none}
body[data-page=falling] .endline span{font-size:11px;font-weight:650;color:#966674;background:#fcf4f6;border-radius:5px;padding:0 4px;line-height:17px}
@media(max-width:600px){
 body[data-page=falling] main{padding-top:6px}
 body[data-page=falling] .setup{margin-bottom:6px}
 body[data-page=falling] .setup h1{font-size:21px;margin:0 0 6px}
 body[data-page=falling] .setup .micro-demo{font-size:14.5px;min-height:36px;padding:5px 14px;margin:0 auto 4px}
 body[data-page=falling] .stage-choices{margin:6px 0;gap:6px}
 body[data-page=falling] .game>.modes{width:calc(100% - 12px);margin:2px 6px 0}
 body[data-page=falling] .game>.modes button{min-height:32px;padding:4px;font-size:10.5px}
 body[data-page=falling].is-playing #answerForm{padding-top:1px}
}

/* Explain both practice methods without consuming the word field. */
body[data-page=falling] main{padding-top:4px}
body[data-page=falling] .setup .micro-demo{display:flex;align-items:center;justify-content:center;gap:12px;max-width:380px;min-height:32px;padding:4px 12px;margin:0 auto 3px}
body[data-page=falling] .micro-demo .demo-divider{color:#a591bc;font-weight:400}
body[data-page=falling] .setup>p.practice-methods{display:flex;justify-content:center;align-items:center;gap:8px;margin:2px 0 6px;font-size:12px;color:#674795;letter-spacing:0;line-height:1.4}
body[data-page=falling] .game>.modes{display:grid;grid-template-columns:1fr 1fr;gap:8px;border:0;background:transparent;padding:0}
body[data-page=falling] .game>.modes button{border:1px solid #d4c5e8;background:#fff;border-radius:12px;color:#62458d}
body[data-page=falling] .game>.modes button.selected{border:2px solid #a17be2;background:#f0e8fb;color:#39235a;box-shadow:none}
@media(max-width:600px){
 body[data-page=falling]>header{min-height:48px;padding-top:6px;padding-bottom:6px}
 body[data-page=falling] main{padding-top:1px}
 body[data-page=falling] .setup h1{margin-top:0;margin-bottom:4px}
 body[data-page=falling] .setup .micro-demo{font-size:14.5px;gap:10px;max-width:340px}
 body[data-page=falling] .setup>p.practice-methods{font-size:10.5px;gap:5px;margin:2px 0 4px}
 body[data-page=falling] .setup #reviewWords{margin-bottom:0}
 body[data-page=falling] .game>.modes{gap:8px;margin-top:3px;margin-bottom:1px}
}

body[data-page=falling] .toolbar #reviewWords{min-height:32px;padding:4px 7px;font-size:11px;white-space:nowrap;margin:0;border:1px solid #d8c8eb;background:#fff;color:#604584}
body[data-page=falling] .setup{margin-bottom:4px}
@media(max-width:600px){
 body[data-page=falling] .toolbar,body[data-page=falling].is-playing .toolbar{grid-template-columns:repeat(4,minmax(0,1fr)) minmax(88px,1.5fr);gap:3px 4px;padding:3px 5px}
 body[data-page=falling] .toolbar #reviewWords{grid-column:5;grid-row:1;font-size:10px;min-height:30px;padding:3px 4px}
 body[data-page=falling] .toolbar #start{grid-column:1/4;grid-row:2}
 body[data-page=falling] .toolbar #pause{grid-column:4/6;grid-row:2}
 body[data-page=falling] .toolbar>div{font-size:9px;gap:2px}
 body[data-page=falling] .toolbar strong{font-size:16px}
 body[data-page=falling] .toolbar #exitGame{font-size:10px;padding:3px;min-height:30px;height:30px}
 body[data-page=falling] .setup{margin-bottom:2px}
 body[data-page=falling] .stage-choices{margin-bottom:3px}
}

body[data-page=falling] .game>.modes button{position:relative;display:flex;align-items:center;justify-content:center;gap:6px;padding-left:30px;padding-right:6px}
body[data-page=falling] .game-number{position:absolute;left:6px;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:20px;height:20px;border-radius:50%;border:1px solid #c7b2e4;background:#f2ecfa;color:#71509d;font-size:12px;font-weight:800;line-height:1}
body[data-page=falling] .modes .selected .game-number{background:#9365d7;border-color:#9365d7;color:#fff}
@media(max-width:600px){body[data-page=falling] .game>.modes button{font-size:10.5px;min-height:34px;padding-left:27px;gap:3px}body[data-page=falling] .game-number{width:18px;height:18px;left:5px;font-size:11px}}

body[data-page=falling] .mode-choice-guide{font-size:12px;font-weight:750;line-height:1.5;color:#6538a2;text-align:center;margin:3px 10px 4px;padding:5px 8px;border-radius:8px;background:#f1eafa}
body[data-page=falling].is-playing .mode-choice-guide{display:none}
@media(max-width:600px){
body[data-page=falling] .mode-choice-guide{font-size:10.5px;margin:2px 6px 3px;padding:5px 4px}
body[data-page=falling].mobile-game-controls .toolbar,body[data-page=falling].mobile-game-controls.is-playing .toolbar{grid-template-columns:repeat(3,minmax(0,1fr)) minmax(88px,1.3fr);gap:4px;padding:4px 6px}
body[data-page=falling].mobile-game-controls .toolbar #reviewWords{grid-column:4;grid-row:1}
body[data-page=falling].mobile-game-controls header #exitGame{min-height:34px;padding:5px 12px;border-radius:22px;background:#faf8ff;color:#59348f;border:1px solid #d5c8e8;font-size:12px}
body[data-page=falling].mobile-game-controls .stage #start,body[data-page=falling].mobile-game-controls .stage #pause{position:absolute;right:8px;z-index:5;width:46px;height:46px;min-height:46px;padding:0;border-radius:50%;display:grid;place-items:center;box-shadow:0 3px 9px #bea5df66;font-size:0}
body[data-page=falling].mobile-game-controls .stage #start:after,body[data-page=falling].mobile-game-controls .stage #pause:after{content:attr(data-mobile-label);font-size:12px;font-weight:750;line-height:1.2;white-space:pre;text-align:center}
body[data-page=falling].mobile-game-controls .stage #start{bottom:33px;background:linear-gradient(140deg,#a16afa,#7933e2);color:white;border:1px solid #be99f3}
body[data-page=falling].mobile-game-controls .stage #pause{bottom:89px;background:#faf8ff;border:1px solid #cab7e4;color:#8055b1}
body[data-page=falling].mobile-game-controls.is-playing>header{display:flex;position:fixed;top:var(--play-top,0px);left:0;right:0;z-index:10;height:40px;min-height:40px;padding:3px 10px;background:#f6f2ff}
body[data-page=falling].mobile-game-controls.is-playing main{padding-top:42px}
}

/* Keep the visible label centered independently of the hidden native text node. */
@media(max-width:600px){
body[data-page=falling].mobile-game-controls .stage #start:after,
body[data-page=falling].mobile-game-controls .stage #pause:after{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:0;margin:0;text-align:center;line-height:1.2;white-space:pre;pointer-events:none}
}

/* Raised circular buttons, matching the supplied depth and lower shadow. */
@media(max-width:600px){
body[data-page=falling].mobile-game-controls .stage #start,
body[data-page=falling].mobile-game-controls .stage #pause{border:1px solid #b396d5;background:linear-gradient(145deg,#996dce,#8357b8);color:#fff;box-shadow:0 2px 2px #43206388,0 5px 9px #78549630,inset 0 1px 1px #ddc5fb80;transition:box-shadow .15s,filter .15s}
body[data-page=falling].mobile-game-controls .stage #start{background:linear-gradient(145deg,#a574e0,#8d5bc8)}
body[data-page=falling].mobile-game-controls .stage #pause{background:linear-gradient(145deg,#a991bd,#967baa);border-color:#c8b4d8}
body[data-page=falling].mobile-game-controls .stage #start:after,
body[data-page=falling].mobile-game-controls .stage #pause:after{text-shadow:0 1px 2px #52336c55}
body[data-page=falling].mobile-game-controls .stage #start:active,
body[data-page=falling].mobile-game-controls .stage #pause:active{box-shadow:0 1px 1px #43206366,inset 0 2px 4px #58317444;filter:brightness(.95)}
}

/* Avoid native rectangular tap flashes and active filter layers on circular controls. */
@media(max-width:600px){
body[data-page=falling].mobile-game-controls .stage #start,
body[data-page=falling].mobile-game-controls .stage #pause{-webkit-tap-highlight-color:transparent;-webkit-appearance:none;appearance:none;overflow:hidden;isolation:isolate}
body[data-page=falling].mobile-game-controls .stage #start:active,
body[data-page=falling].mobile-game-controls .stage #pause:active{filter:none}
body[data-page=falling].mobile-game-controls .stage #start:focus:not(:focus-visible),
body[data-page=falling].mobile-game-controls .stage #pause:focus:not(:focus-visible){outline:none}
body[data-page=falling].mobile-game-controls .stage #start:focus-visible,
body[data-page=falling].mobile-game-controls .stage #pause:focus-visible{outline:2px solid #9368bd;outline-offset:3px;border-radius:50%}
}

/* White power controls with a soft lower-left cast shadow. */
@media(max-width:600px){
body[data-page=falling].mobile-game-controls .endline .mode-choice-guide{position:absolute;top:2px;left:0;right:40px;margin:0;padding:0;background:transparent;border-radius:0;font-size:clamp(9px,2.6vw,10.5px);line-height:17px;white-space:nowrap;text-align:center}
}
@media(max-width:600px){
body[data-page=falling].mobile-game-controls .stage #start,
body[data-page=falling].mobile-game-controls .stage #pause{border:1.5px solid #9b71c6;background:#fff;color:#67636d;box-shadow:-2px 3px 3px #36303925,-9px 12px 10px #36303922,-18px 23px 18px #36303918;overflow:hidden;transition:box-shadow .15s;opacity:1}
body[data-page=falling].mobile-game-controls .stage #start{bottom:53px}
body[data-page=falling].mobile-game-controls .stage #pause{bottom:109px}
body[data-page=falling].mobile-game-controls .stage #start:before,
body[data-page=falling].mobile-game-controls .stage #pause:before{content:'';position:absolute;top:5px;left:50%;transform:translateX(-50%);width:13px;height:13px;background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237b7b7b' stroke-width='2.8' stroke-linecap='round'%3E%3Cpath d='M12 3v8M7 5.7a9 9 0 1 0 10 0'/%3E%3C/svg%3E") center/contain no-repeat;pointer-events:none}
body[data-page=falling].mobile-game-controls .stage #start:after,
body[data-page=falling].mobile-game-controls .stage #pause:after{inset:19px 0 3px;font-size:10.5px;line-height:1.05;font-weight:700;text-shadow:none}
body[data-page=falling].mobile-game-controls .stage #start:active,
body[data-page=falling].mobile-game-controls .stage #pause:active{background:#fff;filter:none;box-shadow:-1px 2px 3px #36303925,inset 0 1px 3px #36303915}
body[data-page=falling].mobile-game-controls .stage #start:disabled,
body[data-page=falling].mobile-game-controls .stage #pause:disabled{color:#999;opacity:1;cursor:default;box-shadow:-2px 3px 3px #36303918,-8px 10px 10px #36303914}
}

@media(max-width:600px){
body[data-page=falling].mobile-game-controls .stage #start{bottom:43px}
body[data-page=falling].mobile-game-controls .stage #pause{bottom:99px}
body[data-page=falling].mobile-game-controls .stage #start:before,
body[data-page=falling].mobile-game-controls .stage #pause:before{display:none;content:none}
body[data-page=falling].mobile-game-controls .stage #start:after,
body[data-page=falling].mobile-game-controls .stage #pause:after{inset:0;padding:0;display:flex;align-items:center;justify-content:center;font-size:11px;line-height:1.2}
}

.mode-notice{position:fixed;left:50%;top:calc(var(--play-top,0px) + var(--play-height,100dvh)*.45);transform:translate(-50%,-50%);z-index:100;max-width:calc(100vw - 32px);width:max-content;padding:15px 20px;border:1px solid #cbb5e4;border-radius:16px;background:#fff;color:#59348f;font-size:15px;font-weight:700;line-height:1.5;text-align:center;box-shadow:0 8px 28px #55367530;opacity:0;visibility:hidden;pointer-events:none;transition:opacity .18s,visibility .18s}
.mode-notice.visible{opacity:1;visibility:visible}
@media(prefers-reduced-motion:reduce){.mode-notice{transition:none}}

/* Give mode selection and answer controls identical horizontal edges. */
body[data-page=falling] .game{--answer-edge:20px}
body[data-page=falling] .game>#answerForm{padding-left:var(--answer-edge);padding-right:var(--answer-edge)}
body[data-page=falling] .game>.modes{width:calc(100% - 2 * var(--answer-edge));margin-left:var(--answer-edge);margin-right:var(--answer-edge)}
@media(max-width:600px){
body[data-page=falling] .game{--answer-edge:16px}
body[data-page=falling].is-playing .game{--answer-edge:10px}
}

/* Align every message below the answer field to its left edge. */
body[data-page=falling] .game>#feedback,
body[data-page=falling] .game>#feedback.answer-result,
body[data-page=falling] .game>.keyboard-guide,
body[data-page=falling] .game>#levelInfo{margin-left:var(--answer-edge);margin-right:var(--answer-edge);padding-left:0;padding-right:0;text-align:left}
body[data-page=falling].is-playing .game>#feedback,
body[data-page=falling].is-playing .game>#feedback.answer-result{margin-left:var(--answer-edge);margin-right:var(--answer-edge);padding-left:0;padding-right:0;height:32px;min-height:32px;max-height:32px;font-size:12px;line-height:1.25}
@media(max-width:600px){
body[data-page=falling].is-playing .game>#feedback,
body[data-page=falling].is-playing .game>#feedback.answer-result{font-size:10.5px;line-height:1.25}
}

@media(max-width:600px){body[data-page=falling] .game>.level-track{margin-left:var(--answer-edge);margin-right:var(--answer-edge)}}
