html,body{height:100%;width:100%;margin:0;overflow:hidden;background:#071c35;font-family:system-ui,-apple-system,"Microsoft YaHei",sans-serif}
*{box-sizing:border-box}
#app-stage-shell{display:flex;flex-direction:column;width:100%;height:100vh;height:100dvh;overflow:hidden}
#app-stage-shell[hidden]{display:none!important}
#app-stage-frame{display:block;flex:1 1 auto;width:100%;height:0;min-height:0;border:0;background:#071c35}
#endless-embedded-recovery{position:relative;flex:0 0 auto;display:flex;justify-content:center;align-items:center;flex-wrap:wrap;gap:6px;width:100%;min-height:42px;padding:5px 12px;padding-top:max(5px,env(safe-area-inset-top));padding-left:max(12px,env(safe-area-inset-left));padding-right:max(12px,env(safe-area-inset-right));background:#fff8e8;color:#285f62}
#endless-embedded-recovery[hidden]{display:none!important}
#endless-embedded-recovery a{display:inline-flex;align-items:center;justify-content:center;min-height:32px;padding:6px 14px;border:1px solid #d6c799;border-radius:999px;background:#fffdf5;color:#285f62;text-decoration:none;font:700 12px/1.2 system-ui,sans-serif}
#endless-embedded-recovery a:focus-visible{outline:3px solid #dd9a2e;outline-offset:2px}
#endless-embedded-recovery span{max-width:100%;text-align:center;font:600 12px/1.35 system-ui,sans-serif;overflow-wrap:anywhere}
#app-stage-shell[data-native-home="true"] #endless-embedded-recovery{display:none!important}

/* Shared corner recovery control: game viewport never shrinks behind a banner. */
#app-stage-shell.family-course-shell{position:relative;display:block!important;width:100%;height:100vh;height:100dvh;overflow:hidden}
#app-stage-shell.family-course-shell #app-stage-frame{position:absolute!important;inset:0!important;display:block!important;width:100%!important;height:100%!important;min-height:0!important;flex:none!important;border:0}
#app-stage-shell.family-course-shell #endless-embedded-recovery{position:absolute!important;inset:auto!important;left:max(8px,env(safe-area-inset-left))!important;top:max(8px,env(safe-area-inset-top))!important;z-index:1010;display:flex;justify-content:flex-start!important;align-items:flex-start!important;flex:none!important;gap:6px;width:auto!important;max-width:calc(100% - 16px);min-height:0!important;padding:0!important;background:transparent!important;box-shadow:none!important;pointer-events:none}
#app-stage-shell.family-course-shell #endless-embedded-recovery[hidden],#app-stage-shell.family-course-shell[data-native-home="true"] #endless-embedded-recovery{display:none!important}
#app-stage-shell.family-course-shell #endless-embedded-recovery a,#app-stage-shell.family-course-shell #endless-embedded-recovery button{display:inline-flex;align-items:center;justify-content:center;pointer-events:auto;min-height:40px;padding:8px 12px;border:1px solid #c9d9ce;border-radius:14px;background:#fffdf5eb;color:#285f62;text-decoration:none;font:700 14px/1.2 system-ui;box-shadow:0 2px 7px #1f4e4a12}
#app-stage-shell.family-course-shell #course-shell-status{position:absolute;left:0;top:46px;width:max-content;max-width:min(300px,calc(100vw - 24px));padding:6px 9px;border-radius:10px;background:#fffdf5eb;color:#285f62;text-align:left;font:500 13px/1.4 system-ui;pointer-events:none}
#app-stage-shell.family-course-shell #course-shell-status:empty{display:none}

#app-stage-shell.family-course-shell[data-corner-return="numbers"] #endless-embedded-recovery{left:max(44px,env(safe-area-inset-left))!important}

/* Single outer fullscreen toggle keeps the return button visible in fullscreen. */
#app-stage-shell #course-fullscreen-toggle{position:absolute;z-index:1020;top:max(8px,env(safe-area-inset-top));left:max(188px,calc(env(safe-area-inset-left) + 180px));display:inline-flex;align-items:center;justify-content:center;gap:6px;width:104px;min-height:40px;padding:7px 9px;border:1px solid #c9d9ce;border-radius:14px;background:#fffdf5eb;color:#285f62;box-shadow:0 2px 7px #1f4e4a12;font:700 14px/1.2 system-ui;cursor:pointer;pointer-events:auto}
#course-fullscreen-toggle svg{width:18px;height:18px;flex:0 0 18px}#course-fullscreen-toggle:focus-visible{outline:3px solid #e4a441;outline-offset:3px}
#course-fullscreen-status{position:absolute;z-index:1030;left:12px;top:56px;max-width:min(400px,calc(100% - 24px));padding:8px 12px;border:1px solid #d6dfd3;border-radius:12px;background:#fffdf5;color:#285f62;font:14px/1.5 system-ui;box-shadow:0 3px 12px #204c4518}#course-fullscreen-status[hidden]{display:none}#course-fullscreen-status a{color:#286d83;text-decoration:underline}
#app-stage-shell:fullscreen{width:100vw!important;height:100vh!important;height:100dvh!important;max-width:none!important;max-height:none!important;background:#071c35}
#app-stage-shell:-webkit-full-screen{width:100vw!important;height:100vh!important;max-width:none!important;max-height:none!important;background:#071c35}

#app-stage-shell:fullscreen{position:fixed!important;inset:0!important;transform:none!important}
@media(orientation:portrait){
html:not([data-landscape-upright="true"]) #app-stage-shell.family-course-shell{position:fixed!important;inset:auto!important;left:50%!important;top:50%!important;width:var(--endless-landscape-width,100dvh)!important;height:var(--endless-landscape-height,100dvw)!important;transform:translate(-50%,-50%) rotate(90deg)!important;transform-origin:center!important}
html[data-landscape-upright="true"] #app-stage-shell:fullscreen{inset:0!important;left:0!important;top:0!important;width:100vw!important;height:100dvh!important;transform:none!important}
}

/* Keep Reader fullscreen in the reserved home corner, never beside the
   floating meaning/translation controls on the right. */
#app-stage-shell[data-course-controls="reader"] #course-fullscreen-toggle{left:max(8px,env(safe-area-inset-left));top:calc(max(8px,env(safe-area-inset-top)) + 48px);width:82px;min-height:40px;padding:7px 5px;font-size:13px;gap:4px}
#app-stage-shell[data-course-controls="reader"] #course-fullscreen-status{top:104px}

/* All courses share a compact left-corner fullscreen control. */
#app-stage-shell #course-fullscreen-toggle{left:max(8px,env(safe-area-inset-left));top:calc(max(8px,env(safe-area-inset-top)) + 48px);width:82px;padding:7px 5px;font-size:13px;gap:4px}
#app-stage-shell[data-corner-return="numbers"] #course-fullscreen-toggle{left:44px}

/* Wordplay library: sound sits before the native four-character level picker. */
#app-stage-shell[data-course-controls="wordplay"]>.endless-audio-settings-open{left:auto!important;right:calc(max(18px,env(safe-area-inset-right,0px)) + clamp(56px,7.2vw,80px) + 60px)!important;top:max(16px,env(safe-area-inset-top,0px))!important}


@media (pointer:coarse) and (max-height:600px),(pointer:coarse) and (max-width:1000px){
#app-stage-shell[data-course-controls="reader"] #course-fullscreen-toggle{left:8px!important;top:8px!important;width:48px!important;height:48px!important;min-height:48px!important;padding:3px 0 0!important;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:0;border:0!important;border-radius:10px;background:transparent!important;box-shadow:none!important;color:#176d75}
#app-stage-shell[data-course-controls="reader"] #course-fullscreen-toggle svg{width:28px!important;height:28px!important;flex:0 0 28px!important}
#app-stage-shell[data-course-controls="reader"] #course-fullscreen-toggle span{display:none!important}
#app-stage-shell.family-course-shell[data-course-controls="reader"] #endless-embedded-recovery{left:8px!important;top:64px!important;max-width:160px!important}
#app-stage-shell[data-course-controls="reader"] #endless-embedded-recovery a,#app-stage-shell[data-course-controls="reader"] #endless-embedded-recovery button{min-height:32px!important;padding:6px 12px!important;font-size:12px!important;border-radius:11px!important}
#app-stage-shell[data-course-controls="reader"] #course-fullscreen-status{left:8px!important;top:104px!important}
}


#app-stage-shell[data-course-controls="reader"][data-reader-scene="library"] #course-fullscreen-toggle,
#app-stage-shell[data-course-controls="reader"][data-reader-scene="loading"] #course-fullscreen-toggle,
#app-stage-shell[data-course-controls="reader"][data-reader-scene="library"] .endless-audio-settings-open,
#app-stage-shell[data-course-controls="reader"][data-reader-scene="loading"] .endless-audio-settings-open,
#app-stage-shell[data-course-controls="reader"][data-reader-scene="library"] #course-fullscreen-status{display:none!important}
#app-stage-shell.family-course-shell[data-course-controls="reader"][data-reader-scene="library"] #endless-embedded-recovery{top:8px!important}

@media (pointer:coarse) and (max-height:600px),(pointer:coarse) and (max-width:1000px){
#app-stage-shell[data-course-controls="reader"] #course-fullscreen-toggle{gap:2px;color:#126370}
#app-stage-shell[data-course-controls="reader"] #course-fullscreen-toggle span{display:block!important;font:800 10px/12px "PingFang SC","Hiragino Sans GB",system-ui,sans-serif!important;white-space:nowrap;pointer-events:none}
#app-stage-shell.family-course-shell[data-course-controls="reader"]>.endless-audio-settings-open{left:120px!important;right:auto!important;top:8px!important;width:48px!important;height:48px!important;padding:3px 0 0!important;align-items:center;justify-content:flex-start;flex-direction:column;border:0!important;border-radius:10px;background:transparent!important;box-shadow:none!important;color:#126370}
#app-stage-shell[data-course-controls="reader"]>.endless-audio-settings-open .endless-audio-settings-icon,#app-stage-shell[data-course-controls="reader"]>.endless-audio-settings-open svg{width:28px!important;height:28px!important;flex:0 0 28px}
}

#app-stage-shell:is([data-alphabet-scene="library"],[data-alphabet-scene="loading"]) :is(#course-fullscreen-toggle,#course-fullscreen-status,.endless-audio-settings-open){
  display:none!important;
}

#app-stage-shell[data-alphabet-scene] #course-fullscreen-toggle{left:8px!important;top:8px!important;width:48px!important;height:48px!important;min-height:48px!important;padding:3px 0 0!important;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:2px;border:0!important;border-radius:10px;background:transparent!important;box-shadow:none!important;color:#126370}
#app-stage-shell[data-alphabet-scene] #course-fullscreen-toggle svg{width:28px!important;height:28px!important;flex:0 0 28px}
#app-stage-shell[data-alphabet-scene] #course-fullscreen-toggle span{display:block!important;font:800 10px/12px "PingFang SC","Hiragino Sans GB",system-ui,sans-serif!important;white-space:nowrap}
#app-stage-shell.family-course-shell[data-alphabet-scene] #endless-embedded-recovery{left:8px!important;top:64px!important}
#app-stage-shell[data-alphabet-scene] #endless-embedded-recovery a{min-height:32px!important;padding:6px 12px!important;font-size:12px!important;border-radius:11px!important}
#app-stage-shell.family-course-shell:is([data-alphabet-scene="library"],[data-alphabet-scene="loading"]) #endless-embedded-recovery{top:8px!important}
#app-stage-shell[data-alphabet-scene]>.endless-audio-settings-open{display:none!important}
#app-stage-shell[data-alphabet-scene] #course-fullscreen-status{left:8px!important;top:104px!important}

#app-stage-shell[data-course-controls="wordplay"] #course-fullscreen-toggle{
  left:auto!important;
  right:8px!important;
  top:8px!important;
  width:82px!important;
  min-height:40px!important;
}
#app-stage-shell.family-course-shell[data-course-controls="wordplay"] #endless-embedded-recovery{
  left:auto!important;
  right:8px!important;
  top:56px!important;
  max-width:140px!important;
}
#app-stage-shell[data-course-controls="wordplay"] #course-fullscreen-status{
  left:auto!important;
  right:8px!important;
  top:104px!important;
}

#app-stage-shell[data-course-controls="wordplay"] #course-fullscreen-toggle{
  left:8px!important;
  right:auto!important;
  top:8px!important;
}
#app-stage-shell.family-course-shell[data-course-controls="wordplay"] #endless-embedded-recovery{
  left:8px!important;
  right:auto!important;
  top:56px!important;
}
#app-stage-shell[data-course-controls="wordplay"] #course-fullscreen-status{
  left:8px!important;
  right:auto!important;
  top:104px!important;
}


#app-stage-shell[data-corner-return="numbers"] #course-fullscreen-toggle{left:8px!important;right:auto!important;top:8px!important;width:48px!important;height:48px!important;min-height:48px!important;padding:3px 0 0!important;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:2px;border:0!important;border-radius:10px;background:transparent!important;box-shadow:none!important;color:#126370}
#app-stage-shell[data-corner-return="numbers"] #course-fullscreen-toggle svg{width:28px!important;height:28px!important;flex:0 0 28px}
#app-stage-shell[data-corner-return="numbers"] #course-fullscreen-toggle span{display:block!important;font:800 10px/12px "PingFang SC","Hiragino Sans GB",system-ui,sans-serif!important;white-space:nowrap}
#app-stage-shell.family-course-shell[data-corner-return="numbers"] #endless-embedded-recovery{left:8px!important;right:auto!important;top:64px!important}
#app-stage-shell[data-corner-return="numbers"] #endless-embedded-recovery a{min-height:32px!important;padding:6px 12px!important;font-size:12px!important;border-radius:11px!important}
#app-stage-shell[data-corner-return="numbers"] #course-fullscreen-status{left:8px!important;top:104px!important}
#app-stage-shell[data-corner-return="numbers"]>.endless-audio-settings-open{display:none!important}

#app-stage-shell[data-corner-return="numbers"][data-numbers-scene="menu"] #course-fullscreen-toggle,
#app-stage-shell[data-corner-return="numbers"][data-numbers-scene="menu"] #course-fullscreen-status{
  display:none!important;
}
#app-stage-shell.family-course-shell[data-corner-return="numbers"][data-numbers-scene="menu"] #endless-embedded-recovery{
  top:8px!important;
}
