.mobile-settings-toggle{display:none}
.mobile-settings{display:none}
@media(max-width:640px){
 html{-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent;overscroll-behavior:none}
 :root{--timeline-height:96px;--mobile-bottom:calc(8px + env(safe-area-inset-bottom,0px))}
 body,body .editor,body .editor:fullscreen,body[data-player-story]{height:var(--mobile-viewport-height,100dvh);background:#fff}
 body .editor>.comparison,body[data-player-story] main,body[data-player-story]:has(.presentation-typing:not([hidden])) main,body:has(.presentation-typing:not([hidden])) .editor>.comparison{
  top:calc(58px + env(safe-area-inset-top,0px));bottom:calc(var(--timeline-height) + var(--mobile-bottom) + 8px);padding:0;background:#fff;
 }
 body[data-player-story] main{inset-inline:0;align-items:center}
 body[data-presentation=wabi] .comparison{display:flex;align-items:center;justify-content:center}
 /* A real phone already has a bezel and status bar. Preserve the mini-app bounds. */
 body[data-presentation=wabi] .comparison .lane,
 body[data-player-story]:not([data-presentation=split]) #stage,
 body[data-player-story]:not([data-presentation=split]) .phone-space{
  width:var(--mobile-phone-width,100%);height:var(--mobile-phone-height,100%);max-width:100%;
 }
 body[data-presentation=wabi] .phone-shell,
 body[data-player-story]:not([data-presentation=split]) .phone-shell{
  position:relative;top:0;width:100%;height:100%;padding:0;border-radius:0;background:#fff;box-shadow:none;transform:none;left:0!important;overflow:clip;
 }
 body[data-presentation=wabi] .phone-shell .screen,
 body[data-player-story]:not([data-presentation=split]) .phone-shell .screen{
  position:absolute;top:-58px;width:100%;height:calc(100% + 58px);border-radius:0;box-shadow:none;
 }
 body[data-presentation=wabi] :is(.device-button,.phone-status,.dynamic-island,.home-indicator),
 body[data-player-story]:not([data-presentation=split]) :is(.device-button,.phone-status,.dynamic-island,.home-indicator){display:none}
 body[data-presentation=wabi] .phone-shell :is(.wabi-compose,.chat-compose,.presence-compose),
 body[data-player-story]:not([data-presentation=split]) .presence-compose{bottom:6px}
 body[data-presentation=wabi] .phone-shell :is(.wabi-content,.messages){bottom:74px}
 body[data-presentation=wabi] .phone-shell .conversation{bottom:calc(var(--compose-height,52px) + 18px)}
 body[data-presentation=wabi] .phone-shell .pet-chat-compose{bottom:6px}
 body[data-presentation=wabi] .widget-app .app-surface{inset:62px 8px 50px}
 body[data-presentation=wabi] .widget-app{border-radius:0;outline:none}
 body[data-presentation=wabi] .widget-app .app-status{display:none}
 body[data-presentation=wabi] .widget-app .app-collapse{bottom:4px;min-height:44px}
 body[data-presentation=wabi] .pixel-app{inset:62px 8px 50px}
 body[data-player-story]:not([data-presentation=split]) .collection-app{inset:62px 8px 50px}
 body[data-player-story]:not([data-presentation=split]) .app-collapse{bottom:4px;min-height:44px}
 /* Two compact rows: playback + story, then the always-on timeline. */
 body .timeline,body[data-player-story] .timeline{
  position:fixed;inset:auto 8px var(--mobile-bottom);height:var(--timeline-height);display:flex;flex-wrap:wrap;align-content:center;align-items:center;gap:0 6px;padding:4px 8px;border-radius:22px;
 }
 body .timeline .transport{display:contents}
 body .timeline .transport-left{display:flex;align-items:center;order:0;flex:0 0 calc(100% - 50px);min-width:0;gap:7px;height:44px}
 body .timeline .transport-right{display:none}
 body .timeline .play-button{width:36px;height:36px;margin:4px;box-shadow:inset 0 1px 1px #ffffff5c,0 1px 3px #0002}
 body .timeline .play-button::after{content:'';position:absolute;inset:-4px;border-radius:50%}
 body .timeline .play-button svg{inset:6px}
 body .timeline .story-menu-trigger{height:36px;flex:1;width:auto;max-width:230px;min-width:0;font-size:13px;padding-inline:11px;position:relative}
 body .timeline .story-menu-trigger::after{content:'';position:absolute;inset:-4px 0}
 body .timeline #timecode{display:block;font-size:11px;min-width:35px;text-align:right}
 body .timeline #timecode>span:last-child{display:none}
 body .timeline .story-select{height:44px;max-width:160px;font-size:16px}
 body .timeline .mobile-settings-toggle{display:grid;place-items:center;order:1;width:44px;height:44px;flex:none;border:0;background:transparent;border-radius:50%;color:#444;cursor:pointer}
 .mobile-settings-toggle svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round}
 .mobile-settings-toggle[aria-expanded=true],.mobile-settings-toggle:active{background:#e7e7e7}
 body .timeline .timeline-seek{order:3;flex:1;min-width:70px;margin:0;height:44px;display:flex;align-items:center;width:auto}
 body .timeline .scrub-wrap{height:44px;width:calc(100% - 14px);margin-inline:7px}
 body .timeline .scrub-track{top:20px;height:4px}
 body .timeline .tick-lines{height:4px}
 body .timeline #scrubber{height:44px}
 body .timeline #playhead{top:13px;height:18px}
 body .timeline:not(:has(.presentation-bar)) .timeline-seek{flex-basis:100%}
 /* Existing controls move here, retaining their values and event handlers. */
 .mobile-settings:popover-open{display:block}
 .mobile-settings{position:fixed;inset:auto 8px calc(var(--timeline-height) + var(--mobile-bottom) + 8px);margin:0 0 0 auto;width:min(360px,calc(100vw - 16px));max-height:calc(var(--mobile-viewport-height,100dvh) - var(--timeline-height) - var(--mobile-bottom) - env(safe-area-inset-top,0px) - 24px);overflow:auto;overscroll-behavior:contain;box-sizing:border-box;padding:12px;border:1px solid #fff;border-radius:24px;color:#222;background:linear-gradient(145deg,#fffffff5,#f4f4f4ed);backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);box-shadow:0 0 0 1px #0000000b,0 12px 36px #0002;font:13px/1.4 Selecta,sans-serif;transform-origin:bottom right;opacity:0;transform:translateY(6px) scale(.98);transition:opacity 120ms cubic-bezier(.22,1,.36,1),transform 120ms cubic-bezier(.22,1,.36,1),display 120ms allow-discrete,overlay 120ms allow-discrete}
 .mobile-settings:popover-open{opacity:1;transform:none;transition-duration:160ms}
 @starting-style{.mobile-settings:popover-open{opacity:0;transform:translateY(6px) scale(.98)}}
 .mobile-settings[data-instant=true]{transition:none}
 .mobile-settings::backdrop{background:transparent}
 .mobile-settings>header{display:flex;align-items:center;justify-content:space-between;padding-left:8px;margin-bottom:8px}
 .mobile-settings h2{margin:0;font-size:17px;font-weight:500}
 .mobile-settings>header button{border:0;border-radius:50%;width:44px;height:44px;background:#ebebeb;color:#555;font:26px/1 Selecta,sans-serif}
 .mobile-scenario-tools .chat-suggestions{position:static;display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
 .mobile-scenario-tools .chat-suggestions>button{min-height:44px;padding:0 14px;font-size:13px}
 .mobile-options{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
 .mobile-options :is(button,select){display:grid;place-items:center;min-width:44px;height:44px;padding:0 12px;border:1px solid #ddd;border-radius:14px;background:#fff;color:#444;font:16px/1 Selecta,sans-serif}
 .mobile-options .speed-control{display:block}
 .mobile-options .composition-toggle span{display:none}
 .mobile-options #composition-toggle{display:none}
 .mobile-options .composition-toggle svg{width:20px;height:20px}
 .mobile-typing:not(:has([hidden])){margin-top:12px}
 .mobile-settings .typing-reaction-toggle{width:100%;justify-content:space-between;min-height:44px;font-size:13px;padding:10px 12px}
 .mobile-settings .style-dock{position:static;inset:auto;display:flex;flex-direction:column;width:auto;gap:8px;margin-top:12px;--dock-height:0px;pointer-events:auto}
 .mobile-settings .style-dock>aside{position:static;pointer-events:auto;display:flex;flex-direction:column}
 .mobile-settings .style-dock .bts-trigger{height:44px;font-size:13px}
 body .editor .mobile-settings .style-dock .bts-panel{display:none;position:static;inset:auto;width:100%;max-width:none;max-height:none;transform:none;opacity:1;visibility:visible;margin:8px 0 0;box-shadow:none;transition:none;order:1}
 body .editor .mobile-settings .style-dock .is-open>.bts-panel{display:flex}
 .mobile-settings .style-dock .bts-body{max-height:none;overflow:visible;padding:16px}
 .mobile-settings .style-dock .bts-header{padding:12px 16px}
 .mobile-settings .style-dock .bts-header h2{font-size:17px}
 .mobile-settings .style-dock .bts-footer{padding:12px;gap:8px}
 .mobile-settings .style-dock .bts-footer button{min-height:44px;padding:8px;font-size:12px}
 .mobile-scenes{margin-top:12px;border-top:1px solid #dedede}
 .mobile-scenes summary{padding:12px 8px;min-height:44px;cursor:pointer}
 .mobile-settings .scene-sections{display:grid;grid-template-columns:1fr 1fr;overflow:visible}
 .mobile-settings .scene-section{min-height:48px}
 .mobile-settings :is(button,select,input,summary):focus-visible,.mobile-settings-toggle:focus-visible{outline:2px solid #246bfe;outline-offset:2px}
 .mobile-settings :is(button,select,summary),.timeline button{touch-action:manipulation;-webkit-user-select:none;user-select:none}
 .mobile-settings button:active{background-color:#e5e5e5}
 .composition-panel{inset:auto 8px calc(var(--timeline-height) + var(--mobile-bottom) + 8px) auto;max-height:calc(var(--mobile-viewport-height,100dvh) - var(--timeline-height) - var(--mobile-bottom) - 24px);overflow:auto}
}
@media(max-width:640px) and (prefers-reduced-motion:reduce){.mobile-settings{transition:none}}
@media(max-width:640px) and (prefers-reduced-transparency:reduce){.mobile-settings,body .timeline{background:#fafafa;backdrop-filter:none;-webkit-backdrop-filter:none}}
@media(max-width:640px) and (forced-colors:active){.mobile-settings,body .timeline{border:1px solid CanvasText}.mobile-settings-toggle{color:ButtonText}}

@media(max-width:600px){body[data-presentation=wabi] .pixel-collapse{bottom:4px;min-height:44px}}
