/* Shared Batch 2 materials/world. Every rule is scoped to the three tailored modes. */
body.tailored-pilot,body:has(.arena.bubble-mode){--chamber-text:#eefaff;--chamber-muted:#b9d4e3;--chamber-energy:#84e8ef;--chamber-gold:#ffe195;background:#030c1b;color:var(--chamber-text)}
body.tailored-pilot:before,body.tailored-pilot:after,body:has(.arena.bubble-mode):before,body:has(.arena.bubble-mode):after{display:none!important}
.tailored-world{position:fixed;inset:0;z-index:0;overflow:hidden;pointer-events:none}
.tailored-world>div{position:absolute;inset:-20px;pointer-events:none}
.tailored-world-base{background:linear-gradient(180deg,#02091683,#02102322 40%,#020a19d9),url('assets/hub-cosmos.webp') 60% 30%/cover;animation:arena-world-drift 18s linear infinite alternate}
.tailored-world-structures{background:url('assets/hub-cosmos.webp') 60% 30%/cover;opacity:.15;mask-image:linear-gradient(150deg,transparent 35%,#000 58%,transparent 80%);-webkit-mask-image:linear-gradient(150deg,transparent 35%,#000 58%,transparent 80%);animation:arena-structures-drift 13s ease-in-out infinite alternate}
.tailored-world-haze{background:radial-gradient(ellipse at 16% 55%,#69e6e92a,transparent 50%),radial-gradient(ellipse at 80% 70%,#766eec22,transparent 55%);animation:arena-atmosphere 10s ease-in-out infinite alternate}
.tailored-world-particles{background:radial-gradient(circle at 12% 32%,#d6f9ff 0 1px,transparent 2px),radial-gradient(circle at 83% 62%,#c5f7ff 0 1px,transparent 2px),radial-gradient(circle at 24% 76%,#ffe7a6 0 1px,transparent 2px),radial-gradient(circle at 94% 22%,#bdeaff 0 1px,transparent 2px);animation:arena-world-particles 8s ease-in-out infinite alternate;opacity:.65}
body.tailored-ambient-paused .tailored-world>div,body.tailored-ambient-paused .tailored-writing-frame:after,body.tailored-ambient-paused .word-bubble:before{animation-play-state:paused!important}
body.tailored-pilot .creator-credit,body.tailored-pilot .mission-nav{display:none!important}
.tailored-tools{display:flex;align-items:center;gap:8px}
.tailored-tools .language-picker{margin:0}
body.tailored-pilot .tailored-tools select{background:#071d32;border:0;color:#bbdeeb;font-size:14px;min-height:44px;padding:8px;max-width:98px}
body.tailored-pilot .tailored-tools .language-picker>span{display:none}
/* Bubble geometry and transforms remain in BubbleField. CSS applies when the
   owner adds bubble-mode BEFORE place(), so the initial bounds match the field. */
body.game-world:has(.arena.bubble-mode) .app{max-width:1000px;margin:auto;padding:0 14px;position:relative;z-index:1}
body.game-world:has(.arena.bubble-mode) :is(.app>header,.app>footer,.mission-header,.home-deck,.home-controls,.topline,#launch,#journey,#leaderboard){display:none!important}
body.game-world:has(.arena.bubble-mode) :is(main,#game-workspace){padding:0;margin:0;display:block;width:100%}
body.game-world .arena.bubble-mode{position:relative;display:grid;grid-template-rows:auto auto auto minmax(340px,1fr) auto auto auto;gap:8px;min-height:100dvh;padding:calc(12px + env(safe-area-inset-top)) 0 calc(8px + env(safe-area-inset-bottom));border:0;border-radius:0;background:none;box-shadow:none;overflow:visible}
body.game-world .arena.bubble-mode .hud{grid-row:1;display:grid;grid-template-columns:minmax(0,1fr) auto auto auto;align-items:center;gap:6px 12px;padding:10px 12px 19px;min-height:74px;clip-path:polygon(10px 0,calc(100% - 10px) 0,100% 10px,100% calc(100% - 10px),calc(100% - 10px) 100%,10px 100%,0 calc(100% - 10px),0 10px);background:#05172bdf;border:0;box-shadow:inset 0 1px #75bbd966,inset 0 -1px #75bbd933}
body.game-world .arena.bubble-mode .hud>div{display:flex;flex-direction:column;gap:0;align-items:flex-end}
body.game-world .arena.bubble-mode .hud .session-identity{align-items:flex-start}
body.game-world .arena.bubble-mode .session-mode{font-size:17px;color:#eefaff}
body.game-world .arena.bubble-mode .session-hsk{font-size:14px;color:#8de3ee;background:none;border:0;padding:0}
body.game-world .arena.bubble-mode .hud strong{font:700 20px/1.3 Arial;color:#ffe195}
body.game-world .arena.bubble-mode .hud small{font-size:12px;color:#b4d0e1}
body.game-world .arena.bubble-mode .timer{position:absolute;top:72px;left:12px;width:calc(100% - 24px);height:3px;background:#294457;border:0;margin:0;z-index:2}
body.game-world .arena.bubble-mode .question{grid-row:2;min-height:84px;padding:12px 18px;position:relative;background:linear-gradient(145deg,#0c2d43dc,#051a30b5);border:0;box-shadow:inset 0 1px #6bd4e25c;clip-path:polygon(14px 0,calc(100% - 14px) 0,100% 14px,100% calc(100% - 14px),calc(100% - 14px) 100%,14px 100%,0 calc(100% - 14px),0 14px);text-align:center}
body.game-world .arena.bubble-mode .question #prompt{font:750 28px/1.3 Tahoma,Arial,sans-serif;margin:5px 0;color:#effaff;overflow-wrap:anywhere}
body.game-world .arena.bubble-mode .question #question-label{font-size:14px;color:#b8ddea}
body.game-world .arena.bubble-mode .question :is(.signal-display,.target-caption,.scope){display:none}
body.game-world .arena.bubble-mode #bubble-status{grid-row:3;display:flex;align-items:center;justify-content:space-between;background:none;border:0;padding:0 4px;color:#b8d3e3;font-size:12px}
body.game-world .arena.bubble-mode #bubble-pause{min-height:44px;background:none;border:0;color:#cee6f0;font-size:14px;padding:6px 12px}
body.game-world .arena.bubble-mode #field{grid-row:4;position:relative;min-height:340px;padding:0;border:0;background:none;box-shadow:none;overflow:hidden;isolation:isolate}
body.game-world .arena.bubble-mode #field:before{content:'';position:absolute;inset:auto -10px -14px;height:220px;background:url('assets/practice-arena-stage.webp') center bottom/contain no-repeat;opacity:.62;z-index:0;pointer-events:none}
body.game-world .arena.bubble-mode #targets{display:block;position:relative;z-index:1;width:100%;height:100%;min-height:340px;padding:0;margin:0}
body.game-world .arena.bubble-mode .target.word-bubble{border:1px solid #81e8f2;padding:15px 7px 10px;background:radial-gradient(circle at 30% 20%,#8cedf84a,transparent 44%),radial-gradient(circle,#103e66cf,#052238ed 75%);box-shadow:inset 0 0 18px #67dcfa50,inset 0 0 0 3px #72def238,0 0 12px #40b7e84a;animation:none!important;transition:none!important;color:#f1fcff;clip-path:none}
body.game-world .arena.bubble-mode .word-bubble:before{content:'';position:absolute;inset:4px;border-radius:50%;border:1px solid #a4f1ff79;pointer-events:none;animation:arena-terminal-light 4.2s ease-in-out infinite}
body.game-world .arena.bubble-mode .word-bubble .hanzi{font-size:25px;line-height:1.15;text-shadow:0 0 8px #3fcbf64d}
body.game-world .arena.bubble-mode .word-bubble .pinyin{font-size:13px;line-height:1.2;color:#c8eef5;overflow-wrap:anywhere}
body.game-world .arena.bubble-mode .word-bubble .key{font:400 11px/1 Arial;color:#b6dfe8;top:5px;left:0;right:0;width:auto;background:none;border:0;box-shadow:none}
body.game-world .arena.bubble-mode .word-bubble.correct{background:radial-gradient(circle,#286356,#0a3034);border-color:#bdffdb;box-shadow:inset 0 0 0 2px #9bf2c5,0 0 20px #69e9c477}
body.game-world .arena.bubble-mode .word-bubble.wrong{background:radial-gradient(circle,#652540,#24172f);border-color:#ffadc5;box-shadow:inset 0 0 0 2px #ffa8bf,0 0 16px #f180ad55}
body.game-world .arena.bubble-mode .word-bubble.correct:after{content:'✓';position:absolute;top:4px;right:16px;color:#c7ffe4}
body.game-world .arena.bubble-mode .word-bubble.wrong:after{content:'×';position:absolute;top:4px;right:16px;color:#ffd1de}
body.game-world .arena.bubble-mode .bottom{grid-row:5;background:none;border:0;min-height:28px;padding:0 4px;box-shadow:none;font-size:13px}
body.game-world .arena.bubble-mode #feedback{font-size:13px;color:#b7d1df;line-height:1.4}
body.game-world .arena.bubble-mode #overdrive-panel{grid-row:6;background:#06182bcc;border:0;box-shadow:inset 0 1px #d6ba6b55;margin:0;padding:10px 12px;clip-path:polygon(10px 0,calc(100% - 10px) 0,100% 10px,100% calc(100% - 10px),calc(100% - 10px) 100%,10px 100%,0 calc(100% - 10px),0 10px)}
body.game-world .arena.bubble-mode #overdrive-panel>div{display:flex;align-items:center;gap:12px}
body.game-world .arena.bubble-mode #overdrive-label{color:#ffe195;font-size:12px;white-space:nowrap}
body.game-world .arena.bubble-mode #overdrive-help{font-size:12px;color:#b9cfdd;line-height:1.3;text-align:right}
body.game-world .arena.bubble-mode #overdrive-meter{width:100%;height:5px;accent-color:#ffe195;margin:6px 0 0}
body.game-world .arena.bubble-mode .arena-foot{grid-row:7;display:flex;justify-content:space-between;align-items:center;gap:4px;background:none;border:0;box-shadow:none;padding:0;flex-wrap:wrap}
body.game-world .arena.bubble-mode .arena-foot :is(button,#exit:not([hidden])){position:static;background:none;border:0;box-shadow:none;font-size:13px;color:#c0d9e6;padding:6px;min-height:44px;margin:0}
body.game-world .arena.bubble-mode #mode-text{display:none}
body.game-world .arena.bubble-mode #combo{font:700 12px Arial;position:static;color:#d6ebef;z-index:1}
body.game-world .arena.bubble-mode #mini-event{grid-row:5;padding:0;color:#ffe195;background:none;border:0;font-size:13px}
body.game-world .arena.bubble-mode #bubble-cover{z-index:10;background:#05172be8;border:0;backdrop-filter:none;color:#deeff6}
/* Dialog owners retained; cinematic full viewport replaces legacy modal chrome. */
body.game-world #sentence-dialog,body.game-world #writing-lab{position:fixed;inset:0;width:100%;max-width:none;height:100dvh;max-height:none;margin:0;padding:calc(12px + env(safe-area-inset-top)) 16px calc(12px + env(safe-area-inset-bottom));border:0;border-radius:0;background:#030d1c;color:#effaff;box-shadow:none;overflow:auto;overscroll-behavior:contain}
body.game-world #sentence-dialog::backdrop,body.game-world #writing-lab::backdrop{background:#030b19}
body.game-world #sentence-dialog>:not(.tailored-world):not(.tailored-tools):not(#sentence-close),body.game-world #writing-lab>:not(.tailored-world){position:relative;z-index:1}
body.game-world #sentence-dialog .tailored-world{opacity:.78}
body.game-world #sentence-dialog .tailored-world-base{animation-duration:26s}
body.game-world #sentence-dialog .tailored-world-structures{animation-duration:22s}
body.game-world #sentence-dialog .tailored-world-particles{animation-duration:16s}
body.game-world #sentence-close{float:none;margin:0;position:absolute;top:calc(12px + env(safe-area-inset-top));right:16px;z-index:5;background:#0d273bbd;border:0;box-shadow:none;color:#c4deea;min-height:44px;font-size:14px;padding:8px}
body.game-world #sentence-dialog>.tailored-tools{position:absolute;top:calc(12px + env(safe-area-inset-top));left:16px;z-index:4}
body.game-world #sentence-body{width:100%;max-width:900px;margin:0 auto;padding-top:48px;min-height:calc(100dvh - 24px);font-size:16px;line-height:1.5}
body.game-world #sentence-body[data-tailored-phase="question"]{display:grid;grid-template-rows:auto 4px minmax(270px,1fr) auto auto auto;gap:12px}
body.game-world #sentence-dialog .sentence-hud{padding:6px 0;background:none;border:0;gap:8px 12px;align-items:center;flex-wrap:nowrap;font-size:14px;color:#d4e8ef}
body.game-world #sentence-dialog .sentence-levels{display:flex;flex-direction:column;gap:2px}
body.game-world #sentence-dialog .sentence-levels>span:last-child{font-size:12px;color:#b6d0df}
body.game-world #sentence-dialog .sentence-hud b{color:#ffe09a;white-space:nowrap;font-size:18px}
body.game-world #sentence-dialog progress{height:3px;accent-color:#ffe195;margin:0;width:100%}
body.game-world #sentence-dialog .tailored-scroll{position:relative;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:8px;min-height:270px;padding:68px 42px 62px;background:url('assets/golden-scroll.webp') center/100% 100% no-repeat;color:#102340;text-align:center;isolation:isolate}
body.game-world #sentence-dialog .tailored-scroll .eyebrow{order:3;font-size:14px;color:#24425b;line-height:1.4;letter-spacing:0}
body.game-world #sentence-dialog .tailored-scroll .sentence-zh{font:750 clamp(26px,7.7vw,38px)/1.4 'PingFang SC','Microsoft YaHei',sans-serif;color:#0b2740;margin:0;overflow-wrap:anywhere}
body.game-world #sentence-dialog .tailored-scroll .sentence-py{font:400 16px/1.5 Arial,sans-serif;color:#234a65;text-align:center;margin:0;overflow-wrap:anywhere}
body.game-world #sentence-dialog .tailored-scroll .sentence-context{order:4;background:none;border:0;margin:0;padding:0;font-size:15px;line-height:1.45;color:#1d3e5b;overflow-wrap:anywhere}
body.game-world #sentence-dialog .sentence-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:0;align-items:stretch}
body.game-world #sentence-dialog #sentence-body .sentence-options button{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;min-width:0;min-height:96px;padding:24px 12px 14px;font-size:22px;line-height:1.4;text-align:center;overflow-wrap:anywhere;border:0;border-radius:0;clip-path:polygon(12px 0,calc(100% - 12px) 0,100% 12px,100% calc(100% - 12px),calc(100% - 12px) 100%,12px 100%,0 calc(100% - 12px),0 12px);background:linear-gradient(155deg,#113451ed,#061b30f2),url('assets/hub-cosmos.webp') center/400px auto;color:#eefaff;box-shadow:inset 0 2px #80d8ed,inset 0 -2px #7ac5d9;transition:background .12s}
body.game-world #sentence-dialog #sentence-body[data-exercise="meaning"] .sentence-options button,body.game-world #sentence-dialog #sentence-body[data-exercise="dialogue"] .sentence-options button{font-size:17px;line-height:1.45;align-items:center;text-align:center}
body.game-world #sentence-dialog .sentence-options button:active{background:#15425b}
body.game-world #sentence-dialog .sentence-options small{position:absolute;left:10px;top:6px;font-size:12px;color:#ffe5a2}
body.game-world #sentence-dialog .sentence-option-py{font-size:14px;color:#c0e7ec}
body.game-world #sentence-dialog .sentence-actions{display:flex;justify-content:center;flex-wrap:wrap;gap:8px;margin:0;padding:4px 0}
body.game-world #sentence-dialog .sentence-actions button{min-height:44px;border:0;box-shadow:none;background:#0c293bbd;color:#cce7ee;font-size:14px;padding:8px 12px;border-radius:8px}
body.game-world #sentence-dialog .sentence-actions .primary{background:linear-gradient(#ffe6a1,#dfb854);color:#122640;font-weight:700}
body.game-world #sentence-dialog #sentence-status{font-size:14px;color:#bcd8e4;line-height:1.45;text-align:center;margin:0;padding:0 4px}
body.game-world #sentence-dialog .sentence-verdict{border:0;background:#0a3634e8;box-shadow:inset 0 2px #99f0c4;border-radius:0;margin:18px 0;padding:14px;animation:arena-confirm .5s ease-out}
body.game-world #sentence-dialog .sentence-verdict.is-wrong{border:0;background:#452034e8;box-shadow:inset 0 2px #ffafc3;animation:arena-reject .25s ease-out}
body.game-world #sentence-dialog .sentence-answer-detail{padding:18px 14px;background:#05172be6;box-shadow:inset 0 1px #70b5c84a;margin-bottom:16px}
body.game-world #sentence-dialog .sentence-answer-detail .sentence-zh{font-size:28px;color:#effaff;line-height:1.5;margin:0}
body.game-world #sentence-dialog .sentence-answer-detail .sentence-py{font-size:17px;color:#99e7ec}
body.game-world #sentence-dialog .sentence-explanation{border:0;background:none;padding:0;font-size:16px;color:#bfdbe6}
body.game-world #sentence-dialog h2{color:#ffe3a0;font-size:28px}
body.game-world #sentence-dialog select{min-height:48px;border:0;background:#0e3045;color:#effaff}
/* Jade chamber. NO transforms/animations on the canvas, SVG or their ancestors. */
body.game-world #writing-lab{padding:calc(12px + env(safe-area-inset-top)) 16px calc(12px + env(safe-area-inset-bottom));isolation:isolate}
body.game-world #writing-lab .tailored-world{opacity:.6}
body.game-world #writing-lab .tailored-world-haze{background:radial-gradient(ellipse at 35% 48%,#58dfbd30,transparent 60%)}
body.game-world #writing-lab .writing-head{max-width:900px;margin:auto;min-height:58px;padding:0 0 10px;background:none;border:0;gap:10px;align-items:center}
body.game-world #writing-lab .writing-head>div:first-child{flex:1}
body.game-world #writing-lab .writing-head h2{font-size:23px;color:#d7fff0;font-weight:800}
body.game-world #writing-lab .writing-head .eyebrow{font-size:12px;color:#9cded7}
body.game-world #writing-lab .writing-head button{order:3;background:#0d2836bd;box-shadow:none;border:0;color:#bfdcde;width:44px;min-width:44px;min-height:44px;font-size:18px}
body.game-world #writing-lab .writing-body{display:grid;grid-template-columns:1fr;grid-template-rows:auto auto minmax(0,1fr) auto auto auto;gap:10px;max-width:900px;min-height:calc(100dvh - 96px);margin:auto;padding:8px 0 0;align-content:start}
body.game-world #writing-lab .writing-prompt{grid-row:1;display:flex;align-items:center;justify-content:center;gap:5px 16px;padding:12px 14px;background:#071e2ddd;border:0;box-shadow:inset 0 1px #88daca44;min-height:80px}
body.game-world #writing-lab .writing-prompt>strong{font-size:36px;color:#e9fff9}
body.game-world #writing-lab .writing-prompt>.eyebrow{font-size:12px;color:#a8d8d0;flex-basis:100%;text-align:center}
body.game-world #writing-lab .writing-reading{font-size:16px;line-height:1.4;max-width:70%;color:#d5eae6}
body.game-world #writing-lab .writing-pinyin{font-size:18px;color:#8ee8d9}
body.game-world #writing-lab .writing-progress{grid-row:2;width:100%;max-width:390px;margin:0 auto;padding:0 8px;min-height:32px;color:#b4e7dc}
body.game-world #writing-lab .writing-characters>span{color:#9cdace}
body.game-world #writing-lab .writing-characters>span.current{color:#ffe39a}
body.game-world #writing-lab .writing-strokes{font-size:14px;color:#c2ece5}
body.game-world #writing-lab .writing-surface{grid-row:3;grid-column:1;align-self:center;z-index:1;width:min(100%,340px);max-width:100%;height:auto;aspect-ratio:1;margin:22px auto 46px;border:2px solid #79dcd0;box-shadow:inset 0 0 24px #061423;background:linear-gradient(90deg,transparent calc(50% - 1px),#68b4a82e 50%,transparent calc(50% + 1px)),linear-gradient(transparent calc(50% - 1px),#68b4a82e 50%,transparent calc(50% + 1px)),#061c2ef2;transform:none;animation:none}
body.game-world #writing-lab .writing-surface:after{border-color:#70b9a847}
body.game-world #writing-lab .tailored-writing-frame{grid-row:3;grid-column:1;z-index:0;align-self:stretch;justify-self:center;width:min(calc(100% + 16px),408px);min-height:100%;border:40px solid transparent;border-bottom-width:68px;border-image:url('assets/jade-writing-frame.webp') 240 220 300 220 fill/40px 32px 68px;pointer-events:none;position:relative}
body.game-world #writing-lab .tailored-writing-frame:after{content:'';position:absolute;left:15%;right:15%;bottom:-44px;height:12px;border-radius:50%;background:#58efd43b;animation:arena-platform-pulse 3.6s ease-in-out infinite;pointer-events:none}
body.game-world #writing-lab .writing-actions{grid-row:4;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin:0}
body.game-world #writing-lab .writing-actions button{min-width:0;min-height:64px;padding:8px 5px;font-size:14px;line-height:1.4;overflow-wrap:anywhere;background:linear-gradient(145deg,#0d383cf2,#071e30f0);border:0;border-radius:0;box-shadow:inset 0 1px #7acac0,inset 0 -1px #467e80;clip-path:polygon(8px 0,calc(100% - 8px) 0,100% 8px,100% calc(100% - 8px),calc(100% - 8px) 100%,8px 100%,0 calc(100% - 8px),0 8px)}
body.game-world #writing-lab .writing-actions button.primary{background:linear-gradient(145deg,#c7ead8,#75c9b9);color:#082c34;box-shadow:none;margin:0;flex-basis:auto;font-weight:700}
body.game-world #writing-lab .writing-actions button:disabled{opacity:.45}
body.game-world #writing-lab .writing-message{grid-row:5;font-size:14px;color:#b6dbd9;text-align:center;margin:0;min-height:24px;line-height:1.4}
body.game-world #writing-lab .writing-credit{grid-row:6;margin:0;font-size:12px;color:#8fb6ba}
body.game-world #writing-lab .writing-finish{display:flex;min-height:calc(100dvh - 90px);justify-content:center;align-items:center;text-align:center;padding:32px 10px}
body.game-world #writing-lab .writing-finish .writing-actions{width:100%;display:flex;justify-content:center;flex-wrap:wrap}
body.game-world #writing-lab .writing-finish .writing-actions button{padding:12px 18px}
body.game-world #writing-lab .writing-finish .writing-reading{max-width:100%;font-size:20px}
body.game-world #writing-lab .tailored-stroke-pulse{animation:chamber-stroke .45s ease-out;color:#bfffdf}
body.game-world #writing-lab .tailored-character-complete .writing-progress{color:#d1ffe3;box-shadow:0 1px #baffd866}
body.game-world #writing-lab .stroke-miss{animation:writing-miss .22s ease-out}
@keyframes chamber-stroke{50%{color:#fff0a8;text-shadow:0 0 12px #83fbd9}}
@media(min-width:700px) and (min-height:600px){
 body.game-world .arena.bubble-mode{max-width:960px;margin:auto;gap:12px;grid-template-rows:auto auto auto minmax(480px,1fr) auto auto auto}
 body.game-world .arena.bubble-mode .question #prompt{font-size:36px}
 body.game-world .arena.bubble-mode #targets{min-height:480px}
 body.game-world .arena.bubble-mode .word-bubble .hanzi{font-size:28px}
 body.game-world #sentence-body[data-tailored-phase="question"]{grid-template-rows:auto 4px minmax(360px,1fr) auto auto auto;gap:16px}
 body.game-world #sentence-dialog .tailored-scroll{padding:84px 100px 80px;min-height:360px}
 body.game-world #sentence-dialog .tailored-scroll .sentence-zh{font-size:42px}
 body.game-world #sentence-dialog .tailored-scroll .sentence-py{font-size:20px}
 body.game-world #sentence-dialog .tailored-scroll .sentence-context{font-size:18px}
 body.game-world #sentence-dialog #sentence-body .sentence-options button{min-height:116px;font-size:28px}
 body.game-world #sentence-dialog #sentence-body[data-exercise="meaning"] .sentence-options button,body.game-world #sentence-dialog #sentence-body[data-exercise="dialogue"] .sentence-options button{font-size:21px}
 body.game-world #writing-lab .writing-surface{width:390px}
 body.game-world #writing-lab .tailored-writing-frame{width:458px}
 body.game-world #writing-lab .writing-progress{max-width:458px}
 body.game-world #writing-lab .writing-actions{max-width:640px;width:100%;margin:auto}
}
@media(max-height:500px) and (min-width:700px) and (orientation:landscape){
 body.game-world .arena.bubble-mode{grid-template-columns:minmax(0,.38fr) minmax(0,.62fr);grid-template-rows:auto auto auto minmax(0,1fr) auto auto;gap:6px 18px;height:100dvh;padding:8px 0}
 body.game-world .arena.bubble-mode .hud{grid-column:1;grid-row:1;min-height:56px;padding:4px 12px 10px}
 body.game-world .arena.bubble-mode .timer{top:50px;width:calc(38% - 24px);right:auto}
 body.game-world .arena.bubble-mode .question{grid-column:1;grid-row:2;min-height:75px;padding:10px}
 body.game-world .arena.bubble-mode .question #prompt{font-size:24px}
 body.game-world .arena.bubble-mode #bubble-status{grid-column:1;grid-row:3;align-self:start;flex-wrap:wrap;gap:0}
 body.game-world .arena.bubble-mode #field{grid-column:2;grid-row:1/7;min-height:340px}
 body.game-world .arena.bubble-mode #targets{min-height:340px}
 body.game-world .arena.bubble-mode .bottom{grid-column:1;grid-row:4;align-self:start}
 body.game-world .arena.bubble-mode #overdrive-panel{grid-column:1;grid-row:5}
 body.game-world .arena.bubble-mode .arena-foot{grid-column:1;grid-row:6;gap:0}
 body.game-world .arena.bubble-mode #combo{position:static}
 body.game-world .arena.bubble-mode .arena-foot :is(button,#exit:not([hidden])){font-size:12px;padding:4px}
 body.game-world #sentence-body[data-tailored-phase="question"]{grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-rows:auto 3px 1fr auto;padding-top:40px;gap:8px 20px;min-height:calc(100dvh - 24px)}
 body.game-world #sentence-dialog .sentence-hud,body.game-world #sentence-dialog progress{grid-column:1/-1}
 body.game-world #sentence-dialog .tailored-scroll{grid-column:1;grid-row:3/5;padding:45px 42px;min-height:230px}
 body.game-world #sentence-dialog .tailored-scroll .sentence-zh{font-size:26px}
 body.game-world #sentence-dialog .tailored-scroll .sentence-py{font-size:15px}
 body.game-world #sentence-dialog .tailored-scroll .sentence-context{font-size:14px}
 body.game-world #sentence-dialog .sentence-options{grid-column:2;grid-row:3}
 body.game-world #sentence-dialog #sentence-body .sentence-options button{min-height:72px;font-size:19px;padding:20px 8px 8px}
 body.game-world #sentence-dialog .sentence-actions{grid-column:2;grid-row:4}
 body.game-world #sentence-dialog #sentence-status{display:none}
 body.game-world #writing-lab .writing-head{min-height:44px;padding:0}
 body.game-world #writing-lab .writing-body:not(.writing-finish){grid-template-columns:minmax(0,1fr) 310px;grid-template-rows:auto auto auto auto auto;gap:6px 24px;min-height:calc(100dvh - 68px);padding:8px 0}
 body.game-world #writing-lab .writing-prompt{grid-column:1;grid-row:1;min-height:60px;padding:6px 12px}
 body.game-world #writing-lab .writing-progress{grid-column:1;grid-row:2}
 body.game-world #writing-lab .writing-surface{grid-column:2;grid-row:1/6;width:260px;height:260px;margin:14px auto 36px;align-self:start}
 body.game-world #writing-lab .tailored-writing-frame{grid-column:2;grid-row:1/6;width:310px;align-self:stretch}
 body.game-world #writing-lab .writing-actions{grid-column:1;grid-row:3;gap:6px}
 body.game-world #writing-lab .writing-actions button{min-height:54px;font-size:14px}
 body.game-world #writing-lab .writing-message{grid-column:1;grid-row:4}
 body.game-world #writing-lab .writing-credit{grid-column:1;grid-row:5}
}
@media(prefers-reduced-motion:reduce){
 body.tailored-pilot .tailored-world>div,body.tailored-pilot .tailored-writing-frame:after,body.tailored-pilot .word-bubble:before{animation:none!important;will-change:auto}
 body.tailored-pilot #sentence-dialog *,body.tailored-pilot #writing-lab *{animation:none!important;transition:none!important;scroll-behavior:auto!important}
 body.tailored-pilot #writing-lab .stroke-miss{border-color:#f8b5ab}
}

body.game-world #sentence-dialog>.tailored-tools select{margin:0;width:auto;min-height:44px}
body.game-world .arena.bubble-mode .word-bubble:not(.correct):not(.wrong):after{content:'';position:absolute;left:7%;top:34%;width:86%;height:30%;border:1px solid #b4eeff88;border-radius:50%;pointer-events:none;transform:rotate(-18deg);animation:chamber-bubble-orbit 8s ease-in-out infinite alternate}
@keyframes chamber-bubble-orbit{to{transform:rotate(18deg);opacity:.45}}
body.tailored-ambient-paused .word-bubble:after{animation-play-state:paused!important}
body.game-world #sentence-dialog #sentence-body .sentence-options button{background:linear-gradient(180deg,#09233de8,#071b30b5),url('assets/hub-cosmos.webp') 65% 42%/480px auto}
@media(prefers-reduced-motion:reduce){body.tailored-pilot .word-bubble:after{animation:none!important}}

body.game-world .arena.bubble-mode #round-pause{display:none}
@media(max-height:500px) and (min-width:700px) and (orientation:landscape){
 body.game-world .arena.bubble-mode .hud{grid-template-columns:minmax(0,1.4fr) repeat(3,minmax(0,1fr));gap:6px}
 body.game-world .arena.bubble-mode .hud>div{min-width:0}
 body.game-world .arena.bubble-mode .session-mode{font-size:14px;white-space:nowrap}
 body.game-world .arena.bubble-mode .session-hsk{font-size:11px}
 body.game-world .arena.bubble-mode .hud small{font-size:10px;white-space:nowrap}
 body.game-world .arena.bubble-mode .hud strong{font-size:16px}
 body.game-world .arena.bubble-mode .arena-foot{flex-wrap:nowrap;gap:2px}
 body.game-world .arena.bubble-mode .arena-foot :is(button,#exit:not([hidden])){font-size:11px;padding:4px 2px;white-space:nowrap}
 body.game-world .arena.bubble-mode #combo{font-size:10px;white-space:nowrap}
 body.game-world .arena.bubble-mode .tailored-tools select{width:80px;font-size:11px;padding:4px}
 body.game-world .arena.bubble-mode #feedback{font-size:11px}
 body.game-world .arena.bubble-mode #overdrive-panel{padding:6px 8px}
}

body.game-world #sentence-dialog .sentence-levels{flex-direction:row;align-items:center;flex-wrap:wrap;gap:4px 8px}
body.game-world #sentence-dialog .sentence-levels>span:last-child{flex-basis:100%;line-height:1.25}
body.game-world #sentence-dialog .tailored-scroll[data-long="true"]{background:none;border:26px solid transparent;border-top-width:20px;border-bottom-width:20px;border-image:url('assets/golden-scroll.webp') 190 190 220 190 fill/40px 44px 48px;padding:24px 22px;gap:6px;min-height:290px}
body.game-world #sentence-dialog .tailored-scroll[data-long="true"] .sentence-zh{font-size:24px;line-height:1.35}
body.game-world #sentence-dialog .tailored-scroll[data-long="true"] .sentence-py{font-size:14px;line-height:1.4}
body.game-world #sentence-dialog .tailored-scroll[data-long="true"] :is(.eyebrow,.sentence-context){font-size:14px;line-height:1.35}
@media(min-width:700px) and (min-height:600px){body.game-world #sentence-dialog .tailored-scroll[data-long="true"]{padding:44px 62px;border-image-width:50px 65px 55px;min-height:360px}body.game-world #sentence-dialog .tailored-scroll[data-long="true"] .sentence-zh{font-size:36px}body.game-world #sentence-dialog .tailored-scroll[data-long="true"] .sentence-py{font-size:18px}}
@media(max-height:500px) and (min-width:700px) and (orientation:landscape){body.game-world #sentence-dialog .tailored-scroll[data-long="true"]{padding:14px 16px;min-height:230px}body.game-world #sentence-dialog .tailored-scroll[data-long="true"] .sentence-zh{font-size:21px}body.game-world #sentence-dialog .tailored-scroll[data-long="true"] .sentence-py{font-size:13px}}

body.game-world #sentence-dialog .sentence-levels>.session-mode{flex-basis:auto;font-size:14px}
@media(max-width:600px){
 body.game-world #sentence-body.tailored-long-answers[data-tailored-phase="question"]{grid-template-rows:auto 4px minmax(220px,1fr) auto auto auto;gap:10px}
 body.game-world #sentence-body.tailored-long-answers .tailored-scroll{background:none;border:26px solid transparent;border-top-width:20px;border-bottom-width:20px;border-image:url('assets/golden-scroll.webp') 190 190 220 190 fill/40px 44px 48px;padding:20px 22px;min-height:220px;gap:4px}
 body.game-world #sentence-body.tailored-long-answers .tailored-scroll .sentence-zh{font-size:24px;line-height:1.35}
 body.game-world #sentence-body.tailored-long-answers .tailored-scroll .sentence-py{font-size:14px;line-height:1.35}
 body.game-world #sentence-body.tailored-long-answers .tailored-scroll :is(.eyebrow,.sentence-context){font-size:14px;line-height:1.35}
 body.game-world #sentence-dialog #sentence-body.tailored-long-answers .sentence-options button{font-size:16px;line-height:1.4;padding:24px 10px 12px;gap:4px}
 body.game-world #sentence-dialog #sentence-body.tailored-long-answers .sentence-option-py{font-size:12px;line-height:1.4}
}
/* Text scales with the size already chosen by BubbleField, including its later
   8/10-object stages. This never sets physical width/height or movement. */
body.game-world .arena.bubble-mode .target.word-bubble{container-type:size;padding:12px 5px 8px;gap:4px}
body.game-world .arena.bubble-mode .word-bubble .hanzi{font-size:22px;margin:0;max-width:100%;min-width:0}
body.game-world .arena.bubble-mode .word-bubble .pinyin{font-size:12px;margin:0;max-width:100%;min-width:0}
@supports(font-size:1cqi){
 body.game-world .arena.bubble-mode .word-bubble .hanzi{font-size:clamp(15px,24cqi,27px)}
 body.game-world .arena.bubble-mode .word-bubble .pinyin{font-size:clamp(10px,13cqi,13px)}
}

/* V4 Word Bubbles polish: presentation derives from existing authoritative DOM
   state. Nothing below sizes, moves or transforms a live bubble surface. */
body.game-world .arena.bubble-mode .hud{overflow:visible}
body.game-world .arena.bubble-mode .health{min-width:58px;padding:3px 5px;border-left:1px solid #82dce64a;background:#071d31a8;box-shadow:inset 0 0 0 1px #6ac9da18}
body.game-world .arena.bubble-mode .health strong{color:#ffbfd0;font-size:21px;letter-spacing:1px;text-shadow:0 0 10px #ff789755}
body.game-world .arena.bubble-mode.bubble-life-low .health{background:#351828d6;border-left-color:#ff93b1;box-shadow:inset 0 0 0 1px #ff8eae66,0 0 12px #fa4f7b2e}
body.game-world .arena.bubble-mode.bubble-life-change .health{animation:bubble-life-signal .48s ease-out}
body.game-world .arena.bubble-mode .timer{height:5px;overflow:visible;box-shadow:0 0 0 1px #6cc8dc24}
body.game-world .arena.bubble-mode #timebar{height:100%;transition:none!important;box-shadow:0 0 8px #67ddf455}
body.game-world .arena.bubble-mode.bubble-time-pressure .timer{background:#512032;box-shadow:0 0 0 1px #ff87a0a3,0 0 12px #ff547057;animation:bubble-time-pressure .62s ease-in-out infinite alternate}
body.game-world .arena.bubble-mode.bubble-target-change .question{box-shadow:inset 0 1px #8bedf0b5,inset 0 -1px #5aaecb73,0 0 16px #5fdcea24}
body.game-world .arena.bubble-mode .question:after{content:'';position:absolute;inset:4px 18%;border-top:1px solid transparent;border-bottom:1px solid transparent;pointer-events:none;opacity:0}
body.game-world .arena.bubble-mode.bubble-target-change .question:after{border-color:#94eef5a3;animation:bubble-target-signal .46s ease-out}
body.game-world .arena.bubble-mode.bubble-target-change #prompt{animation:bubble-target-copy .46s ease-out}
body.game-world .arena.bubble-mode #field:after{content:'';position:absolute;inset:6px;z-index:3;border:1px solid transparent;pointer-events:none;opacity:0;clip-path:polygon(12px 0,calc(100% - 12px) 0,100% 12px,100% calc(100% - 12px),calc(100% - 12px) 100%,12px 100%,0 calc(100% - 12px),0 12px)}
body.game-world .arena.bubble-mode[data-bubble-verdict="correct"] #field:after{border-color:#8ff2c5b8;box-shadow:inset 0 0 42px #4ce0b322,0 0 18px #75eac73d;opacity:.58;animation:bubble-correct-field .54s ease-out}
body.game-world .arena.bubble-mode[data-bubble-verdict="wrong"] #field:after{border-color:#ff94b2b8;box-shadow:inset 0 0 48px #ff4e7b24,0 0 15px #ff739739;opacity:.62;animation:bubble-wrong-field .38s ease-out}
body.game-world .arena.bubble-mode .bottom{min-height:42px;padding:7px 10px;clip-path:polygon(8px 0,100% 0,100% calc(100% - 8px),calc(100% - 8px) 100%,0 100%,0 8px)}
body.game-world .arena.bubble-mode #feedback{font-size:14px;font-weight:650;line-height:1.45;color:#c5dce7}
body.game-world .arena.bubble-mode[data-bubble-verdict="correct"] .bottom{background:#0a332fd6;box-shadow:inset 3px 0 #78ebbb,inset 0 1px #8cebc244}
body.game-world .arena.bubble-mode[data-bubble-verdict="correct"] #feedback{color:#caffdf!important}
body.game-world .arena.bubble-mode[data-bubble-verdict="wrong"] .bottom{background:#3b1d2edb;box-shadow:inset 3px 0 #ff8baa,inset 0 1px #ff91ae42}
body.game-world .arena.bubble-mode[data-bubble-verdict="wrong"] #feedback{color:#ffd1dd!important}
body.game-world .arena.bubble-mode #overdrive-panel{position:relative;overflow:hidden}
body.game-world .arena.bubble-mode #overdrive-panel:before{content:'';position:absolute;left:10px;right:10px;top:0;height:1px;background:linear-gradient(90deg,transparent,#ffe19b,#7ce8ef,transparent);opacity:.35;pointer-events:none}
body.game-world .arena.bubble-mode.overdrive #overdrive-panel{background:linear-gradient(110deg,#302817e8,#09243adf 47%,#102b43e8);box-shadow:inset 0 1px #ffe09ab3,inset 0 -1px #74e6ef91,0 0 20px #6edfea2e;animation:bubble-overdrive-panel 1.15s ease-in-out infinite alternate}
body.game-world .arena.bubble-mode.overdrive #overdrive-label{color:#fff0b2;text-shadow:0 0 12px #ffd66f8c}
body.game-world .arena.bubble-mode.overdrive #overdrive-meter{accent-color:#78edf0;filter:drop-shadow(0 0 4px #70e8ec87)}
body.game-world .arena.bubble-mode.overdrive #field{box-shadow:inset 0 0 36px #5fe5e717}
body.game-world.bubble-results #results:not([hidden]){position:relative;z-index:1;overflow:hidden;background:linear-gradient(145deg,#0a2a3ae8,#07192cec 58%,#13243be8);border-color:#74cddd;box-shadow:inset 0 1px #8de9e9a3,0 18px 70px #010712b8}
body.game-world.bubble-results #results:not([hidden]):before{content:'';position:absolute;left:0;right:0;top:0;height:3px;background:linear-gradient(90deg,transparent,#7ce9e5 28%,#ffe296 62%,transparent);pointer-events:none}
body.game-world.bubble-results #result-title{color:#efffff;text-shadow:0 0 18px #75e7eb5e;animation:bubble-result-arrival .58s ease-out}
body.game-world.bubble-results .result-stats>div{background:#09283bd4;border-top-color:#83e3d3}

@keyframes bubble-target-signal{0%{opacity:.95;inset-inline:7%}100%{opacity:0;inset-inline:18%}}
@keyframes bubble-target-copy{0%{color:#fff0af;text-shadow:0 0 16px #ffe38b99}100%{color:#effaff;text-shadow:none}}
@keyframes bubble-correct-field{0%{opacity:.95;box-shadow:inset 0 0 70px #52e5b63b,0 0 24px #75eac75e}100%{opacity:.58}}
@keyframes bubble-wrong-field{0%,42%{opacity:.94;box-shadow:inset 0 0 72px #ff4e7b3a,0 0 22px #ff73975e}100%{opacity:.62}}
@keyframes bubble-life-signal{0%{background:#6a2740;box-shadow:inset 0 0 0 1px #ffc2d1,0 0 18px #ff668875}100%{background:#071d31a8}}
@keyframes bubble-time-pressure{to{box-shadow:0 0 0 1px #ff9db1c7,0 0 18px #ff547080}}
@keyframes bubble-overdrive-panel{to{box-shadow:inset 0 1px #ffe8a9e0,inset 0 -1px #82f3f4b8,0 0 28px #6edfea47}}
@keyframes bubble-result-arrival{0%{opacity:.45;text-shadow:0 0 28px #fff2b5}100%{opacity:1;text-shadow:0 0 18px #75e7eb5e}}

body.tailored-ambient-paused .arena.bubble-mode.bubble-target-change .question:after,body.tailored-ambient-paused .arena.bubble-mode.bubble-target-change #prompt,body.tailored-ambient-paused .arena.bubble-mode.bubble-life-change .health,body.tailored-ambient-paused .arena.bubble-mode.bubble-time-pressure .timer,body.tailored-ambient-paused .arena.bubble-mode.overdrive #overdrive-panel{animation-play-state:paused!important}
@media(max-height:500px) and (min-width:700px) and (orientation:landscape){
 body.game-world .arena.bubble-mode .bottom{min-height:34px;padding:4px 7px}
 body.game-world .arena.bubble-mode #feedback{font-size:12px;line-height:1.35}
 body.game-world .arena.bubble-mode .health{min-width:48px;padding:2px 4px}
 body.game-world .arena.bubble-mode .health strong{font-size:16px}
}
@media(prefers-reduced-motion:reduce){
 body.game-world .arena.bubble-mode.bubble-target-change .question:after,body.game-world .arena.bubble-mode.bubble-target-change #prompt,body.game-world .arena.bubble-mode.bubble-life-change .health,body.game-world .arena.bubble-mode.bubble-time-pressure .timer,body.game-world .arena.bubble-mode.overdrive #overdrive-panel,body.game-world.bubble-results #result-title{animation:none!important}
 body.game-world .arena.bubble-mode.bubble-target-change .question:after{opacity:.5}
}

/* V4.2C Focus continuity. Static emphasis only; no input-plane geometry,
   timing, answer ownership or shared/Bubbles selector changes. */
body.game-world #sentence-body:focus,body.game-world #writing-lab .writing-body:focus{outline:none}
body.game-world #sentence-dialog [data-tailored-phase="answer"] .sentence-actions [data-sentence="continue"],body.game-world #sentence-dialog [data-tailored-phase="answer"] .sentence-actions [data-sentence="resume"]{background:linear-gradient(#ffe6a1,#dfb854);color:#122640;font-weight:700}
body.game-world #sentence-dialog [data-tailored-phase="answer"] #sentence-status{display:block;padding:8px 10px;border-left:2px solid #83dbdf;background:#081f30;color:#d4eaf1}
/* Keep existing summary controls above the optional, potentially long review.
   Only flex order changes; result counts, lesson text and handlers are intact. */
body.game-world #sentence-body[data-tailored-phase="result"]{display:flex;flex-direction:column;gap:10px;min-height:0;padding-bottom:calc(24px + env(safe-area-inset-bottom))}
body.game-world #sentence-body[data-tailored-phase="result"]>*{order:4;min-width:0}
body.game-world #sentence-body[data-tailored-phase="result"]>.eyebrow:first-child{order:0;color:#a5efc7;margin:0}
body.game-world #sentence-body[data-tailored-phase="result"]>h2{order:1;margin:0;padding:16px 14px;background:#0a2d35;box-shadow:inset 3px 0 #8de2b8;color:#e7fff0;overflow-wrap:anywhere}
body.game-world #sentence-body[data-tailored-phase="result"]>p:first-of-type{order:2;margin:0;color:#c6dde7}
body.game-world #sentence-body[data-tailored-phase="result"]>.sentence-actions{order:3;justify-content:flex-start;padding:8px 0 12px;border-bottom:1px solid #7dc4ca55}
body.game-world #sentence-body[data-tailored-phase="result"] .sentence-review{margin:0;padding:12px 0;border-bottom-color:#6da7b64a}
body.game-world #writing-lab .tailored-character-complete .writing-message{color:#d8ffe8;background:#0a3036;box-shadow:inset 2px 0 #9aebc7;padding:8px 10px;font-weight:700}
body.game-world #writing-lab .tailored-character-complete [data-write="advance"]{box-shadow:inset 0 0 0 1px #e0fff0,0 0 12px #6cdbbb33}
body.game-world #writing-lab .writing-finish[data-focus-stage="complete"]>h3{color:#ddffed;padding:14px 18px;box-shadow:inset 0 2px #8ce3be;background:#092d34;overflow-wrap:anywhere}
body.game-world #writing-lab .writing-finish[data-focus-stage="complete"]>.eyebrow{color:#9de5c4}
body.game-world #writing-lab .writing-finish .writing-actions button{max-width:100%;flex:0 1 auto}
@media(max-height:500px) and (min-width:700px) and (orientation:landscape){
 body.game-world #sentence-dialog [data-tailored-phase="answer"] #sentence-status{margin:8px 0 0;font-size:14px}
 body.game-world #writing-lab .writing-finish{min-height:calc(100dvh - 68px);padding:18px 10px}
}
