/* Mobile-only application shell. Desktop layout remains owned by the existing stylesheets. */
@media (max-width:47.99rem) {
  :root {
    --topbar-height:3.75rem;
    --bottom-nav-height:4.7rem;
    --mobile-edge:max(.8rem,var(--safe-left));
    --mobile-card:linear-gradient(145deg,rgba(15,27,58,.92),rgba(6,14,31,.94));
  }

  html,body,#app,.app-shell,.public-site { width:100%; max-width:100%; min-width:0; overflow-x:clip; }
  html { background:#040817; }
  body { min-height:100svh; background:radial-gradient(circle at 50% -10%,rgba(72,80,222,.16),transparent 24rem),#040817; touch-action:manipulation; }
  img,video,canvas,svg { max-width:100%; }
  input,select,textarea { max-width:100%; font-size:16px; }
  button,a,input,select,textarea { -webkit-tap-highlight-color:transparent; }
  button:not(:disabled),a,label[for],select { touch-action:manipulation; }

  /* Signed-in application shell */
  .app-shell { min-height:100svh; padding:0 0 calc(var(--bottom-nav-height) + var(--safe-bottom)); overflow:clip; }
  .app-shell>.sidebar,.app-shell>.context-panel { display:none!important; }
  .topbar {
    position:sticky; top:0; z-index:60; width:100%; min-height:calc(var(--topbar-height) + var(--safe-top));
    padding:calc(.5rem + var(--safe-top)) max(.78rem,var(--safe-right)) .5rem max(.78rem,var(--safe-left)); gap:.55rem;
    border-bottom:1px solid rgba(145,167,234,.13); background:rgba(4,9,23,.9); box-shadow:0 10px 28px rgba(0,0,0,.2); backdrop-filter:blur(22px) saturate(1.25);
  }
  .topbar-brand { min-width:0; font-size:.96rem; letter-spacing:.05em; }
  .topbar-title { display:block; min-width:0; flex:1; }
  .topbar-title h1 { margin:0; overflow:hidden; color:#dfe7fb; font-size:.82rem; font-weight:700; text-align:center; text-overflow:ellipsis; white-space:nowrap; }
  .topbar-actions { min-width:0; margin:0; gap:.4rem; }
  .project-switcher { display:flex; min-width:0; max-width:6.5rem; min-height:2.45rem; padding:.4rem .55rem; border-radius:.75rem; }
  .project-switcher>span { overflow:hidden; font-size:.68rem; text-overflow:ellipsis; white-space:nowrap; }
  .project-switcher .icon:last-child { display:none; }
  .avatar-trigger,.avatar-button { width:2.45rem; min-width:2.45rem; height:2.45rem; }
  .workspace { width:100%; max-width:100%; min-width:0; margin:0; padding:.8rem max(.8rem,var(--safe-right)) calc(var(--bottom-nav-height) + var(--safe-bottom) + 1rem) max(.8rem,var(--safe-left)); overflow-x:clip; }
  .workspace>* { min-width:0; max-width:100%; }

  .bottom-nav {
    z-index:70; min-height:calc(var(--bottom-nav-height) + var(--safe-bottom));
    padding:.38rem max(.48rem,var(--safe-right)) max(.25rem,var(--safe-bottom)) max(.48rem,var(--safe-left)); gap:.18rem;
    border-top:1px solid rgba(140,160,225,.16); background:rgba(4,9,23,.94); box-shadow:0 -14px 35px rgba(0,0,0,.28); backdrop-filter:blur(24px) saturate(1.35);
  }
  .bottom-nav .nav-link { min-width:0; min-height:3.72rem; padding:.32rem .12rem; border-radius:.85rem; }
  .bottom-nav .nav-link .icon { width:1.18rem; height:1.18rem; }
  .bottom-nav .nav-label { max-width:100%; overflow:hidden; font-size:.58rem; text-overflow:ellipsis; white-space:nowrap; }
  .bottom-nav .nav-create { transform:translateY(-.2rem); box-shadow:0 9px 23px rgba(72,83,255,.34); }

  /* Mobile sheets and account surfaces */
  .sheet-backdrop,.account-menu-backdrop,.profile-photo-backdrop,.payment-detail-backdrop { padding:.5rem; align-items:end; backdrop-filter:blur(8px); }
  .create-sheet,.account-menu,.logout-confirm,.payment-detail {
    position:relative; inset:auto; width:100%; max-width:none; max-height:min(82dvh,44rem); margin:0; overflow:auto;
    border-radius:1.35rem 1.35rem .8rem .8rem; transform:none;
  }
  .create-sheet { padding:1rem .85rem calc(1rem + var(--safe-bottom)); }
  .create-grid { grid-template-columns:1fr; gap:.45rem; }
  .create-option { min-height:4.25rem; padding:.7rem .75rem; }
  .account-menu { right:auto; bottom:auto; left:auto; padding:.75rem; }
  .account-menu-identity,.account-menu nav button,.account-menu-signout { min-height:3.15rem; }
  .logout-confirm { top:auto; left:auto; padding:1.15rem; }
  .logout-confirm div { display:grid; grid-template-columns:1fr 1fr; }
  .logout-confirm button { min-height:2.8rem; justify-content:center; }

  /* Home, projects, library, settings, usage and billing */
  .home-command { margin:0; padding:1.05rem; border-radius:1.05rem; background:var(--mobile-card); }
  .home-command-copy h2 { margin:.2rem 0; font-size:clamp(1.55rem,7.3vw,2rem); line-height:1.08; }
  .home-command-copy>p:last-child { margin-top:.45rem; font-size:.86rem; line-height:1.5; }
  .home-command .prompt-bar { margin-top:1rem; padding:.62rem; border-radius:.9rem; }
  .home-command .prompt-bar input { min-height:2.8rem; padding:.5rem .25rem .75rem; }
  .prompt-bar-footer { gap:.45rem; }
  .prompt-project { max-width:calc(100% - 3.2rem); }
  .home-suggestions { width:calc(100% + .25rem); margin:.65rem -.125rem 0; padding:.1rem .125rem .25rem; justify-content:flex-start; flex-wrap:nowrap; overflow-x:auto; overscroll-behavior-inline:contain; scrollbar-width:none; }
  .home-suggestions button { min-height:2.55rem; flex:0 0 auto; white-space:nowrap; }
  .home-section-title { margin:1.25rem 0 .65rem; }
  .home-action-grid { grid-template-columns:1fr 1fr; gap:.5rem; }
  .home-action { min-height:5rem; padding:.65rem; grid-template-columns:2.1rem minmax(0,1fr); border-radius:.9rem; }
  .home-action>.icon { display:none; }
  .home-action:last-child { grid-column:1/-1; }
  .home-recent { margin-top:.85rem; padding:.8rem; border-radius:1rem; }
  .home-recent>header { align-items:center; }
  .home-recent>header button { min-height:2.5rem; white-space:nowrap; }
  .recent-projects { grid-template-columns:1fr; gap:.45rem; }
  .recent-project { min-height:4.35rem; }

  .section-head { margin:.25rem 0 .8rem; align-items:flex-start; gap:.65rem; }
  .section-head h2 { font-size:1.35rem; }
  .section-head p { font-size:.8rem; }
  .section-head>.primary-button { min-width:2.75rem; min-height:2.75rem; padding:.5rem .7rem; }
  .inline-form { padding:.8rem; border-radius:1rem; }
  .inline-form input,.inline-form button { width:100%; min-height:2.9rem; }
  .record-list { gap:.55rem; }
  .record-card { padding:.72rem; grid-template-columns:2.55rem minmax(0,1fr); gap:.65rem; }
  .record-icon { width:2.55rem; height:2.55rem; }
  .record-actions { grid-column:1/-1; justify-content:flex-end; padding-top:.4rem; border-top:1px solid rgba(145,165,230,.1); }
  .record-actions button { min-width:2.65rem; min-height:2.65rem; }

  .library-page { padding:0 0 .35rem; }
  .library-heading { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:.55rem; }
  .library-heading h2 { font-size:1.35rem; }
  .library-heading>div>p:last-child { max-width:17rem; font-size:.78rem; }
  .library-toolbar { gap:.55rem; }
  .library-categories { margin-inline:-.1rem; padding:.1rem .1rem .25rem; }
  .library-categories button { min-height:2.65rem; padding:.5rem .75rem; }
  .library-project-filter { width:100%; }
  .library-project-filter select { min-height:2.8rem; }
  .library-assets { grid-template-columns:1fr; }
  .library-asset { width:100%; min-width:0; grid-template-columns:4.5rem minmax(0,1fr) 2.55rem; padding:.55rem; }
  .library-asset .asset-preview { width:4.5rem; }
  .asset-copy { min-width:0; }
  .asset-copy h3,.asset-copy p { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .asset-delete { width:2.55rem; height:2.55rem; }

  .settings-page,.credits-page,.billing-page,.admin-page { width:100%; max-width:100%; padding:.1rem 0 .75rem; }
  .settings-account-row,.settings-groups section,.settings-profile-editor .profile-form,.settings-language-list { border-radius:.95rem; }
  .settings-row { min-height:4rem; }
  .settings-subpage>header { position:sticky; top:calc(var(--topbar-height) + var(--safe-top)); z-index:3; padding:.45rem 0; background:#050a19; }
  .profile-identity { align-items:flex-start; }
  .usage-metrics { grid-template-columns:1fr; gap:.55rem; }
  .credit-balance,.usage-metrics article,.credit-ledger { border-radius:1rem; }
  .credit-ledger li { grid-template-columns:minmax(0,1fr) auto; gap:.35rem; }
  .credit-ledger li small { grid-column:1/-1; }
  .billing-page>header { grid-template-columns:minmax(0,1fr) auto; }
  .billing-buckets,.billing-products { grid-template-columns:1fr; }
  .billing-security,.billing-profile-card,.billing-package-section,.billing-history { width:100%; min-width:0; }
  .billing-product { grid-template-columns:1fr; }
  .billing-product>div:last-child { align-items:stretch; }
  .billing-product .primary-button { width:100%; }

  /* Chat behaves like a native conversation screen */
  .route-chat { height:var(--visual-height,100dvh); min-height:0; padding:0; display:flex; flex-direction:column; overflow:hidden; }
  .route-chat>.topbar { position:relative; flex:0 0 auto; }
  .route-chat .workspace-chat { flex:1 1 auto; height:auto; min-height:0; padding:0; overflow:hidden; }
  .route-chat>.bottom-nav { position:relative; inset:auto; flex:0 0 auto; width:100%; }
  .chat-layout,.chat-main { height:100%; min-height:0; overflow:hidden; }
  .chat-main { grid-template-rows:auto minmax(0,1fr) auto auto; }
  .chat-header { min-height:4.15rem; padding:.58rem .72rem; gap:.55rem; }
  .chat-header>div { min-width:0; flex:1; }
  .chat-header h2 { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .chat-header p:last-child { max-width:100%; }
  .history-trigger,.chat-new-mobile { width:2.55rem; min-width:2.55rem; height:2.55rem; padding:0; }
  .chat-history { position:fixed; z-index:120; inset:0 auto 0 0; width:min(88vw,22rem); max-width:100%; padding:calc(.75rem + var(--safe-top)) .75rem calc(.75rem + var(--safe-bottom)); transform:translateX(-105%); transition:transform .2s ease; box-shadow:1.25rem 0 3rem rgba(0,0,0,.4); }
  [dir=rtl] .chat-history { inset:0 0 0 auto; transform:translateX(105%); }
  .chat-layout.history-open .chat-history { display:block; transform:none; }
  .history-backdrop { position:fixed; z-index:119; inset:0; display:none; border:0; background:rgba(0,4,14,.66); backdrop-filter:blur(5px); }
  .chat-layout.history-open .history-backdrop { display:block; }
  .history-mobile-head { display:flex; min-height:3rem; align-items:center; justify-content:space-between; }
  .messages { min-height:0; padding:.8rem .72rem .4rem; overscroll-behavior-y:contain; }
  .message { width:100%; grid-template-columns:1.75rem minmax(0,1fr); gap:.5rem; }
  .message-avatar { width:1.75rem; height:1.75rem; }
  .message-bubble { max-width:100%; padding:.72rem .78rem; overflow-wrap:anywhere; font-size:.9rem; line-height:1.58; }
  .message-bubble pre,.message-bubble table { max-width:100%; overflow:auto; }
  .chat-composer { width:calc(100% - 1rem); margin:.25rem .5rem .48rem; padding:.45rem .5rem .5rem; border-radius:1rem; }
  .composer-tools select { max-width:10rem; }
  .composer-input textarea { min-height:2.7rem; max-height:8rem; font-size:16px; }
  .attachment-picker { max-height:42dvh; overflow:auto; grid-template-columns:1fr; }
  .chat-latest { bottom:5.35rem; }

  /* Passwordless authentication */
  .auth-page--rebuild { min-height:100svh; display:flex; flex-direction:column; overflow:auto; background:#050a18; }
  .auth-showcase { min-height:13rem; flex:0 0 auto; padding:calc(1rem + var(--safe-top)) 1rem 1.25rem; border-bottom:1px solid rgba(139,158,225,.13); }
  .auth-wordmark { font-size:.7rem; }
  .auth-showcase-copy { margin:2.4rem 0 0; }
  .auth-showcase-copy h1 { margin:.55rem 0 .7rem; font-size:clamp(2rem,10vw,2.7rem); }
  .auth-showcase-copy>p:last-child,.auth-showcase-products,.auth-showcase-orbit { display:none; }
  .auth-panel { flex:1; min-height:0; align-items:start; padding:1rem max(.8rem,var(--safe-right)) calc(1rem + var(--safe-bottom)) max(.8rem,var(--safe-left)); }
  .auth-card--rebuild { width:100%; max-width:30rem; padding:1.35rem 1rem; border-radius:1.15rem; box-shadow:0 20px 55px rgba(0,0,0,.28); }
  .auth-card--rebuild .brand-mark { display:none; }
  .auth-card--rebuild h2 { margin:.45rem 0; font-size:1.75rem; }
  .auth-form input,.auth-form button,.auth-google { min-height:3.25rem; }
  .auth-mode-tabs button { min-height:2.8rem; }
  .auth-code-form input { letter-spacing:.42em; text-align:center; font-size:1.3rem; }
  .auth-code-actions { gap:.45rem; }
  .auth-code-actions button { min-height:2.75rem; }

  /* Image creator: one clear vertical flow, no cropped controls */
  .route-image .workspace { padding:0 0 calc(var(--bottom-nav-height) + var(--safe-bottom)); }
  .image-creator-v3 { width:100%; max-width:100%; display:block; min-height:0; overflow:visible; }
  .image-v3-controls,.image-v3-workspace { width:100%; min-width:0; padding:.72rem; overflow:visible; }
  .image-v3-controls>header { align-items:center; }
  .image-v3-modes { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .image-v3-modes button { min-height:2.75rem; padding:.55rem .2rem; white-space:normal; }
  .image-v3-modes button:nth-child(n+4) { display:block; }
  .image-v3-prompt textarea { height:auto; min-height:8rem; font-size:16px; }
  .image-v3-config-grid { grid-template-columns:1fr; }
  .image-v3-config-grid select,.image-v3-config-grid input,.image-v3-details select { min-height:2.8rem; }
  .image-v3-segmented span,.image-v3-ratios span { min-height:2.65rem; }
  .image-v3-styles { display:flex; width:calc(100% + .5rem); margin-inline:-.25rem; padding:.15rem .25rem .65rem; overflow-x:auto; scroll-snap-type:x proximity; }
  .image-v3-style { flex:0 0 7.25rem; min-width:7.25rem; scroll-snap-align:start; }
  .image-v3-styles.expanded { display:grid; grid-template-columns:1fr 1fr; overflow:visible; }
  .image-v3-gallery { height:auto; grid-template-columns:1fr; grid-template-rows:none; gap:.55rem; }
  .image-v3-result,.image-v3-result--1,.image-v3-result--2 { grid-column:auto; grid-row:auto; min-height:15rem; }
  .image-v3-result-actions { opacity:1; transform:none; }
  .image-v3-history nav { max-width:100%; overflow-x:auto; }
  .image-v3-history nav button:nth-child(n+3) { display:block; }

  /* Video studio: mobile cards replace the desktop three-column canvas */
  .route-video { width:100%; max-width:100%; height:var(--visual-height,100dvh); min-height:0; padding:0; display:flex; flex-direction:column; overflow:hidden; }
  .route-video>.topbar { position:relative; flex:0 0 auto; }
  .route-video>.bottom-nav { position:fixed; inset:auto 0 0; width:100%; flex:none; }
  .route-video .workspace { flex:1 1 auto; min-height:0; padding:0 0 calc(var(--bottom-nav-height) + var(--safe-bottom) + .65rem); scroll-padding-bottom:calc(var(--bottom-nav-height) + var(--safe-bottom) + 1rem); overflow-x:clip; overflow-y:auto; overscroll-behavior-x:none; overscroll-behavior-y:auto; -webkit-overflow-scrolling:touch; touch-action:pan-y; }
  .video-v2-shell { width:100%; max-width:100%; min-width:0; min-height:0; height:auto; display:block; overflow:visible; }
  .video-v2-shell * { box-sizing:border-box; }
  .vv-frame,.vv-studio { width:100%; max-width:100%; min-width:0; display:block; overflow-x:clip; }
  .vv-compose,.vv-editor,.vv-right { width:100%; max-width:100%; min-width:0; padding:.65rem max(.55rem,env(safe-area-inset-left)); overflow:visible; contain:inline-size; }
  .vv-editor { gap:.45rem; }
  .vv-compose { gap:.65rem; border-right:0; border-bottom:1px solid #142b45; }
  .vv-mode-tabs button,.vv-source select,.vv-settings select,.vv-upload { min-height:2.75rem; }
  .vv-prompt textarea { min-height:8rem; font-size:16px; }
  .vv-prompt footer { flex-wrap:wrap; }
  .vv-models>div { grid-template-columns:1fr 1fr; }
  .vv-model-card { height:7rem; }
  .vv-model-card img { height:4.3rem; }
  .vv-settings>div,.vv-switches { grid-template-columns:1fr; }
  .vv-switches>label:last-child { grid-column:auto; }
  .vv-generate { position:sticky; bottom:.45rem; z-index:8; min-height:3.6rem; }
  .vv-mobile-preview-toggle { width:100%; min-height:2.8rem; display:flex; align-items:center; gap:.5rem; padding:0 .65rem; border:1px solid #1d4064; border-radius:.65rem; color:#eaf3ff; background:linear-gradient(135deg,#0b2039,#101b3f); }
  .vv-mobile-preview-toggle .icon { width:1.15rem; color:#48b5ff; }
  .vv-mobile-preview-toggle span { flex:1; text-align:left; font-weight:750; }
  .vv-mobile-preview-toggle b { color:#8298b7; font-size:.65rem; }
  .vv-preview-card { display:none; }
  .vv-preview-card.is-mobile-open { display:block; }
  .vv-preview-card>header { min-height:2.45rem; gap:.3rem; padding:.3rem .4rem; flex-wrap:wrap; }
  .vv-preview-card>header nav { max-width:100%; overflow-x:auto; }
  .vv-preview-card>header button,.vv-preview-card>header a { min-height:2.5rem; padding-inline:.45rem; }
  .vv-preview { height:clamp(9rem,45vw,11rem); aspect-ratio:auto; }
  .vv-preview-card>footer { min-height:2.8rem; display:grid; grid-template-columns:auto auto minmax(0,1fr) auto auto; gap:.35rem; padding:.3rem .4rem; }
  .vv-preview-card>footer button { width:2.5rem; min-width:2.5rem; height:2.5rem; padding:0; }
  .vv-preview-card>footer b { display:none; }
  .vv-scenes { grid-template-columns:repeat(5,6rem); gap:.32rem; padding-bottom:.2rem; overflow-x:auto; overflow-y:hidden; overscroll-behavior-x:contain; overscroll-behavior-y:auto; scroll-snap-type:x proximity; touch-action:pan-x pan-y; }
  .vv-scene { scroll-snap-align:start; }
  .vv-editbar { width:100%; padding-bottom:.2rem; overflow-x:auto; overflow-y:hidden; overscroll-behavior-x:contain; overscroll-behavior-y:auto; touch-action:pan-x pan-y; }
  .vv-editbar button { flex:0 0 2.5rem; width:2.5rem; height:2.5rem; }
  .vv-timeline { width:100%; max-width:100%; height:13rem; min-height:13rem; max-height:13rem; flex:0 0 13rem; grid-template-rows:1.65rem 3.3rem repeat(4,2rem); overflow-x:auto; overflow-y:hidden; overscroll-behavior-x:contain; overscroll-behavior-y:auto; touch-action:pan-x pan-y; }
  .vv-timeline>header { position:relative; }
  .vv-timeline>header,.vv-track { grid-template-columns:4.5rem minmax(24rem,1fr); min-width:28.5rem; }
  .vv-timeline>header span,.vv-track>strong { display:flex; align-items:center; padding:.25rem .35rem; font-size:.55rem; white-space:nowrap; }
  .vv-timeline>header input { inset:0 0 0 4.5rem; width:calc(100% - 4.5rem); }
  .vv-track>span { margin:.14rem .3rem; padding:.18rem .4rem; font-size:.54rem; }
  .vv-playhead { top:1.65rem; }
  .vv-timeline>header input { touch-action:pan-y; }
  .vv-right { border-left:0; border-top:1px solid #142b45; }
  .vv-right>nav button { min-height:2.75rem; }
  .vv-style-grid,.vv-templates>div { grid-template-columns:1fr 1fr; }

  /* Vera Music keeps its horizontal timeline inside its own scroller */
  .route-music,.route-music .workspace,.music-compact-page,.music-studio,.music-v2,.vera-track-shell { width:100%; max-width:100%; min-width:0; overflow-x:clip; }
  .route-music { height:100dvh; min-height:0; padding:0 0 calc(var(--bottom-nav-height) + var(--safe-bottom)); }
  .route-music .workspace { height:calc(var(--visual-height,100dvh) - var(--bottom-nav-height) - var(--safe-bottom))!important; min-height:0; padding:0!important; overflow:hidden!important; }
  .music-v2 { height:100%; padding:.7rem .65rem 7.6rem!important; overflow-y:auto; }
  .music-v2-top { gap:.5rem; }
  .music-v2-top h2 { font-size:1.25rem; }
  .music-v2-live { max-width:8.5rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .music-v2-rail { width:calc(100% + .2rem); margin-inline:-.1rem; scroll-snap-type:x proximity; }
  .music-v2-rail button { min-height:2.7rem; scroll-snap-align:start; }
  .music-v2-hero { padding:.85rem; border-radius:.9rem; }
  .music-v2-composer textarea { height:8.5rem; font-size:16px; }
  .music-v2-composer-bar { align-items:stretch; }
  .music-v2-composer-bar select { min-height:2.75rem; }
  .music-v2-advanced>div { grid-template-columns:1fr; }
  .music-v2-advanced label:last-child { grid-column:auto; }
  .music-v2-player { left:.45rem; right:.45rem; bottom:calc(var(--bottom-nav-height) + var(--safe-bottom) + .35rem); width:auto; max-width:none; }
  .music-v2-play-controls { min-width:0; }
  .music-v2-progress { min-width:0; }
  .music-studio.is-workspace { height:100%; min-height:0!important; }
  .music-studio.is-workspace .music-timeline-scroll,.vera-stems-workspace .music-timeline-scroll { width:100%; max-width:100%; overflow:auto; overscroll-behavior:contain; }
  .music-studio.is-workspace .vera-studio-player { position:sticky; bottom:0; z-index:9; }
  .music-studio.is-workspace .music-library-panel,.music-studio.is-workspace .music-inspector { inset:auto .4rem calc(var(--bottom-nav-height) + var(--safe-bottom) + .25rem) .4rem; max-height:68dvh; border-radius:1rem; box-shadow:0 -1rem 3rem rgba(0,0,0,.4); }

  /* Immersive Sites owns the full mobile viewport and its two contained scroll regions. */
  .route-sites,.route-sites .workspace,.sites-studio,.sites-builder,.sites-chat,.sites-preview-panel { width:100%; max-width:100%; min-width:0; overflow-x:clip; }
  .route-sites .workspace { height:var(--visual-height,100dvh)!important; padding:0!important; }
  .sites-studio { height:var(--visual-height,100dvh)!important; min-height:0!important; }
  .sites-chat-scroll,.sites-file-list { overscroll-behavior:contain; touch-action:pan-y; }
  .sites-canvas-surface { min-width:0; margin:0; }
  .sites-code,.sites-command-composer textarea { width:100%; min-width:0; font-size:16px!important; }
  .sites-project-form,.sites-template-form,.sites-template-review,.sites-credit-store { margin:.55rem; max-height:75dvh; overflow:auto; }
  .sites-template-form { grid-template-columns:1fr; }
  .sites-template-actions { grid-column:auto; }
  .sites-welcome { margin:.75rem; padding:1.25rem; }

  /* Public site and legal pages */
  .public-site { min-height:100svh; }
  .public-header--premium { position:sticky; top:0; z-index:80; width:100%; height:calc(3.75rem + var(--safe-top)); padding:var(--safe-top) .85rem 0; gap:.55rem; background:rgba(2,8,23,.94); backdrop-filter:blur(22px); }
  .public-brand--premium { min-width:0; flex:1; }
  .public-brand--premium>span:last-child { gap:.35rem; }
  .public-brand--premium strong { font-size:.94rem; }
  .public-brand--premium small { font-size:.65rem; }
  .public-actions { display:none!important; }
  .public-menu { display:grid; place-items:center; flex:0 0 2.6rem; width:2.6rem; height:2.6rem; margin:0; }
  .public-mobile-menu.open { top:calc(3.75rem + var(--safe-top)); max-height:calc(100dvh - 3.75rem - var(--safe-top)); padding:.65rem .8rem calc(.85rem + var(--safe-bottom)); overflow:auto; box-shadow:0 1.2rem 3rem rgba(0,0,0,.42); }
  .public-mobile-menu a { min-height:3.15rem; display:flex; align-items:center; border-bottom:1px solid rgba(139,159,220,.1); }
  .public-search-panel { top:calc(3.75rem + var(--safe-top)); padding:.8rem; }
  .public-search-panel form { grid-template-columns:minmax(0,1fr) auto; }
  .public-search-panel input,.public-search-panel button { min-height:2.8rem; }

  .lp-hero { min-height:0; height:auto; overflow:hidden; }
  .lp-hero-inner { width:100%; height:auto; padding:2.15rem 1rem 1.25rem; grid-template-columns:1fr; gap:1.5rem; }
  .lp-copy { min-width:0; padding:0; }
  .lp-badge { max-width:100%; }
  .lp-copy h1 { font-size:clamp(2.45rem,11vw,3.35rem); line-height:1; }
  .lp-copy>p { font-size:.9rem; line-height:1.6; }
  .lp-actions { grid-template-columns:1fr; }
  .lp-primary,.lp-secondary { min-height:3.1rem; }
  .lp-proof { margin-top:1rem; }
  .lp-app-preview { width:100%; height:auto; min-height:31rem; margin:0; overflow:hidden; }
  .lp-window { position:absolute; inset:0; width:100%; min-width:0; height:100%; transform:none; border-radius:1rem; }
  .lp-window-body { grid-template-columns:1fr; }
  .lp-window-body>aside { display:none; }
  .lp-window-body>main { padding:.65rem; overflow:hidden; }
  .lp-preview-head { gap:.4rem; }
  .lp-preview-head label { width:9.2rem; }
  .lp-module-row { grid-template-columns:repeat(5,6.2rem); gap:.45rem; padding-bottom:.25rem; overflow-x:auto; }
  .lp-module-row a { min-height:4.5rem; }
  .lp-dashboard-grid { grid-template-columns:1fr; gap:.55rem; }
  .lp-dashboard-grid>section { height:10rem; }
  .lp-video-demo,.lp-side-demo { display:none!important; }
  .lp-image-demo>div { height:7.5rem; }
  .lp-dashboard-grid>.lp-mobile-music-player {
    position:relative; height:8.2rem; display:grid!important; grid-template-rows:auto minmax(0,1fr) auto; gap:.35rem; padding:.65rem .7rem;
    overflow:hidden; border-color:rgba(105,122,255,.4); border-radius:.8rem;
    background:radial-gradient(circle at 78% 15%,rgba(128,79,255,.24),transparent 45%),linear-gradient(145deg,#11183b,#071329 72%);
    box-shadow:inset 0 1px 0 rgba(255,255,255,.05),0 .8rem 1.7rem rgba(0,0,0,.18);
  }
  .lp-mobile-music-player>header { height:auto!important; }
  .lp-mobile-music-player>header strong { color:#eef2ff; font-size:.72rem!important; letter-spacing:.03em; }
  .lp-mobile-music-player>header a { min-height:1.5rem; display:flex; align-items:center; color:#73bdff!important; font-size:.62rem!important; }
  .lp-mobile-music-player>.lp-mobile-music-main { min-width:0; display:grid; grid-template-columns:2.45rem minmax(0,1fr); align-items:center; gap:.65rem; margin:0; }
  .lp-mobile-music-player .lp-mobile-play { width:2.45rem; height:2.45rem; border:1px solid rgba(255,255,255,.16); background:linear-gradient(145deg,#7a5cff,#397dff); box-shadow:0 .45rem 1rem rgba(52,73,255,.32); font-size:.72rem; }
  .lp-mobile-music-copy { min-width:0; display:grid; grid-template-columns:minmax(0,1fr) 5.5rem; align-items:center; gap:.05rem .55rem; }
  .lp-mobile-music-copy>strong { overflow:hidden; color:#f2f4ff; font-size:.64rem; line-height:1.25; text-overflow:ellipsis; white-space:nowrap; }
  .lp-mobile-music-copy>small { grid-column:1; color:#8394bd; font-size:.52rem; }
  .lp-mobile-music-wave { grid-column:2; grid-row:1/3; height:2rem!important; display:flex; align-items:center; gap:2px!important; }
  .lp-mobile-music-wave b { width:auto!important; min-width:1px; flex:1; background:linear-gradient(#7ae7ff,#8b5dff)!important; transform-origin:center; }
  .lp-mobile-music-progress { display:grid!important; grid-template-columns:2rem minmax(0,1fr) 2rem; align-items:center; gap:.4rem; margin:0!important; color:#8fa1c9; font-size:.52rem; font-variant-numeric:tabular-nums; }
  .lp-mobile-music-progress span:last-child { text-align:right; }
  .lp-mobile-music-progress input { width:100%; height:1rem; margin:0; padding:0; border:0; appearance:none; background:transparent; cursor:pointer; }
  .lp-mobile-music-progress input::-webkit-slider-runnable-track { height:3px; border-radius:999px; background:linear-gradient(90deg,#4f8dff,#8c5cff); }
  .lp-mobile-music-progress input::-webkit-slider-thumb { width:.8rem; height:.8rem; margin-top:-.32rem; appearance:none; border:2px solid #dce8ff; border-radius:50%; background:#5e7cff; box-shadow:0 0 0 3px rgba(87,107,255,.2); }
  .lp-mobile-music-progress input::-moz-range-track { height:3px; border-radius:999px; background:linear-gradient(90deg,#4f8dff,#8c5cff); }
  .lp-mobile-music-progress input::-moz-range-thumb { width:.65rem; height:.65rem; border:2px solid #dce8ff; border-radius:50%; background:#5e7cff; }
  .lp-metrics { grid-template-columns:1fr 1fr; padding:.65rem; }
  .lp-metrics>div { min-height:3.7rem; }
  .lp-tools { grid-template-columns:1fr; padding:2.5rem 1rem; }
  .lp-tool-grid { grid-template-columns:1fr; gap:.7rem; }
  .lp-tool-card,.lp-tool-card:last-child { grid-column:auto; min-height:8rem; display:grid; grid-template-columns:7.5rem minmax(0,1fr); grid-template-rows:auto 1fr; gap:0 .75rem; }
  .lp-tool-card>header { grid-column:2; }
  .lp-tool-image { grid-column:1; grid-row:1/3; height:100%; margin:0; }
  .lp-tool-card p { grid-column:2; margin:.45rem 0 0; font-size:.76rem; }
  .lp-workflow { grid-template-columns:1fr; padding:1.7rem 1rem; }
  .lp-workflow>div { grid-column:auto; }
  .lp-workflow>a { min-height:3.8rem; }

  .public-page-hero { padding:3.5rem 1rem 2rem; }
  .public-page-hero h1 { font-size:clamp(2rem,10vw,2.8rem); line-height:1.08; overflow-wrap:anywhere; }
  .public-page-hero span { font-size:.92rem; }
  .pricing-controls { padding:0 1rem; justify-content:space-between; }
  .pricing-grid,.story-grid,.contact-grid { width:100%; margin:0 auto 3.5rem; padding:0 1rem; grid-template-columns:1fr; }
  .price-card,.contact-form,.contact-details { padding:1.15rem; border-radius:1.15rem; }
  .price-card ul { min-height:0; }
  .price-card .public-cta,.contact-form .public-cta { width:100%; min-height:3rem; justify-content:center; }
  .payment-state { margin:-2.5rem 1rem 3rem; }
  .legal-document,.legal-warning { width:auto; margin-inline:1rem; padding-inline:0; }
  .legal-warning { padding:1rem; }
  .legal-document { padding-bottom:3rem; }
  .legal-document section { padding:1.25rem 0; }
  .public-footer { width:100%; padding:2.2rem 1rem calc(1.5rem + var(--safe-bottom)); }
  .public-footer nav { grid-template-columns:1fr 1fr; }

  .about-hero { min-height:0; padding:3.5rem 1rem 2.5rem; grid-template-columns:1fr; gap:1.5rem; }
  .about-hero h1 { margin:1rem 0; font-size:clamp(2.35rem,11vw,3.2rem); overflow-wrap:anywhere; }
  .about-hero-copy>p { font-size:.92rem; line-height:1.65; }
  .about-hero-actions { grid-template-columns:1fr; }
  .about-hero-actions a { width:100%; min-height:3rem; }
  .about-principles { padding:1rem; border-radius:1.1rem; }
  .about-principles article { grid-template-columns:2.5rem minmax(0,1fr); padding:1rem 0; }
  .about-statement { padding:3.5rem 1rem; }
  .about-statement h2 { font-size:2rem; }
  .about-projects { padding:3.5rem 1rem; }
  .about-project { grid-template-columns:1fr; min-height:0; border-radius:1.1rem; }
  .about-project-visual { min-height:13rem; }
  .about-project-body { padding:1.25rem; }
  .about-project-body h3 { font-size:1.8rem; }
  .about-project-body ul { grid-template-columns:1fr; }
  .about-project-links { display:grid; }
  .about-project-links a { min-height:3rem; justify-content:space-between; }
  .about-founder { width:auto; margin:3.5rem 1rem; padding:1.25rem; grid-template-columns:1fr; border-radius:1.1rem; }
  .about-cta { padding:3rem 1rem; display:grid; gap:1.25rem; }
  .about-cta>a { width:100%; }
}

/* One calm, persistent mobile dock for every Vera workspace.  Inactive
   destinations are icon-first; the selected destination expands just enough
   to reveal its name without making the navigation visually crowded. */
@media (max-width:47.99rem) {
  .app-shell > .bottom-nav {
    position:fixed!important;
    z-index:90!important;
    right:max(.55rem,var(--safe-right))!important;
    bottom:max(.42rem,calc(var(--safe-bottom) + .25rem))!important;
    left:max(.55rem,var(--safe-left))!important;
    width:auto!important;
    min-height:3.72rem!important;
    padding:.25rem!important;
    display:flex!important;
    align-items:center;
    gap:.22rem!important;
    border:1px solid rgba(130,154,222,.24)!important;
    border-radius:1.05rem!important;
    background:linear-gradient(145deg,rgba(9,18,41,.97),rgba(4,10,25,.98))!important;
    box-shadow:0 1rem 2.8rem rgba(0,0,0,.42),inset 0 1px rgba(255,255,255,.045)!important;
  }
  .app-shell > .bottom-nav .nav-link {
    position:relative;
    flex:1 1 0;
    min-width:2.85rem!important;
    min-height:3.12rem!important;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:0;
    padding:.42rem!important;
    border:1px solid transparent!important;
    border-radius:.78rem!important;
    color:#aab9d7!important;
    background:transparent!important;
    box-shadow:none!important;
    transform:none!important;
    transition:flex .2s ease,color .18s ease,background .18s ease,border-color .18s ease;
  }
  .app-shell > .bottom-nav .nav-link .icon { width:1.34rem!important;height:1.34rem!important;flex:0 0 auto; }
  .app-shell > .bottom-nav .nav-label {
    position:absolute;
    width:1px;
    height:1px;
    overflow:hidden;
    clip:rect(0 0 0 0);
    clip-path:inset(50%);
    white-space:nowrap;
  }
  .app-shell > .bottom-nav .nav-link.active,
  .app-shell > .bottom-nav .nav-create:focus-visible {
    flex:1.7 1 0;
    justify-content:flex-start;
    gap:.42rem;
    padding-inline:.68rem!important;
    border-color:rgba(117,116,255,.72)!important;
    color:#f7f8ff!important;
    background:linear-gradient(125deg,rgba(107,72,245,.58),rgba(37,128,239,.42))!important;
    box-shadow:0 .45rem 1rem rgba(49,82,221,.22)!important;
  }
  .app-shell > .bottom-nav .nav-link.active .nav-label,
  .app-shell > .bottom-nav .nav-create:focus-visible .nav-label {
    position:static;
    width:auto;
    height:auto;
    overflow:visible;
    clip:auto;
    clip-path:none;
    color:inherit;
    font-size:.64rem!important;
    font-weight:800;
  }
  .app-shell > .bottom-nav .nav-link--rewards {
    color:#f2cd59!important;
    border-color:rgba(238,190,63,.78)!important;
    background:rgba(126,88,11,.08)!important;
  }
  .app-shell > .bottom-nav .nav-link--rewards.active {
    border-color:#f1c84b!important;
    background:linear-gradient(125deg,rgba(97,67,16,.5),rgba(71,50,12,.38))!important;
    box-shadow:0 .45rem 1rem rgba(184,133,22,.15)!important;
  }
  .app-shell > .bottom-nav .nav-create { color:#bdc9e6!important; }
  .app-shell > .bottom-nav .nav-create:active { background:rgba(95,111,178,.2)!important; }

  /* The floating dock no longer participates in Chat's flex column. Reserve
     its full footprint so the composer stays comfortably above the dock. */
  .route-chat > .workspace-chat {
    margin-bottom:calc(4.55rem + var(--safe-bottom))!important;
  }
  .route-chat .chat-composer { margin-bottom:.58rem!important; }
}

@media (max-width:23rem) {
  .topbar-title { display:none; }
  .project-switcher { max-width:5rem; }
  .home-action-grid { grid-template-columns:1fr; }
  .home-action:last-child { grid-column:auto; }
  .auth-code-actions { grid-template-columns:1fr; }
  .lp-copy h1 { font-size:2.3rem; }
  .lp-metrics { grid-template-columns:1fr; }
  .lp-tool-card { grid-template-columns:6.5rem minmax(0,1fr); }
  .public-footer nav { grid-template-columns:1fr; }
}

@media (max-width:47.99rem) and (orientation:landscape) and (max-height:31.25rem) {
  :root { --topbar-height:3.25rem; --bottom-nav-height:3.75rem; }
  .topbar { min-height:calc(var(--topbar-height) + var(--safe-top)); padding-block:calc(.25rem + var(--safe-top)) .25rem; }
  .bottom-nav .nav-link { min-height:2.9rem; flex-direction:row; }
  .bottom-nav .nav-create { transform:none; }
  .auth-page--rebuild { display:grid; grid-template-columns:.8fr 1.2fr; }
  .auth-showcase { min-height:100dvh; }
  .auth-showcase-copy { margin-top:1.5rem; }
  .auth-panel { overflow:auto; }
  .route-chat .workspace-chat { height:calc(var(--visual-height,100dvh) - var(--topbar-height) - var(--safe-top) - var(--bottom-nav-height) - var(--safe-bottom)); }
}

/* The compact Music creator is a document-style form, not the old fixed-height
   DAW. Keep its page scrollable on real phones and in DevTools emulation. */
@media (max-width:47.99rem) {
  .app-shell.route-music:has(.simple-music) {
    height:auto!important;
    min-height:100svh;
    overflow:visible!important;
  }
  .route-music:has(.simple-music) .workspace {
    height:auto!important;
    min-height:calc(100svh - var(--bottom-nav-height) - var(--safe-bottom));
    overflow-x:clip!important;
    overflow-y:visible!important;
    overscroll-behavior-y:auto;
    -webkit-overflow-scrolling:touch;
    touch-action:pan-y;
    padding:.8rem max(.8rem,var(--safe-right)) calc(var(--bottom-nav-height) + var(--safe-bottom) + 1.25rem) max(.8rem,var(--safe-left))!important;
  }
}

/* Mobile chat composer: keep the writing surface to one calm, touch-friendly row.
   The model control remains available on desktop; mobile places the attachment
   action immediately before the message field instead. */
.composer-icon--mobile { display:none; }
@media (max-width:47.99rem) {
  .route-chat .composer-tools { display:none!important; }
  .route-chat .composer-input {
    grid-template-columns:auto minmax(0,1fr) auto;
    align-items:center;
    gap:.35rem;
  }
  .route-chat .composer-icon--mobile {
    width:2.45rem;
    min-width:2.45rem;
    min-height:2.45rem;
    height:2.45rem;
    padding:0;
    display:grid;
    place-items:center;
    color:#b8c8f5;
    border:1px solid rgba(146,170,255,.18);
    border-radius:.78rem;
    background:rgba(105,118,212,.09);
    touch-action:manipulation;
  }
  .route-chat .composer-icon--mobile:active { background:rgba(112,100,255,.24); }
  .route-chat .composer-input textarea {
    min-height:2.45rem;
    padding:.55rem .1rem;
  }
}
