/* RC5 mobile fixes: a continuous root background, one safe-area/header offset,
   a genuinely scrollable field surface; keyboard takes priority over preview. */
html{min-height:100%;background:#10161f;overscroll-behavior-y:none}
body.studio{display:flow-root!important;min-height:100dvh!important;padding:0!important;background:var(--st-bg,#10161f)!important;overflow-x:clip!important}
body.studio>.st-top{height:calc(78px + env(safe-area-inset-top,0px))!important;padding-top:env(safe-area-inset-top,0px)!important;box-sizing:border-box;background:var(--st-bg,#10161f)!important}
body.studio #main.layout{margin-top:calc(78px + env(safe-area-inset-top,0px))!important;background:var(--st-bg,#10161f)!important}
.studio #backupBanner{display:none!important}.studio .vzc-backup{display:flex!important;align-items:center;justify-content:center;gap:7px;font-size:12px!important;padding:8px 10px!important;min-width:44px;min-height:44px;border:1px solid var(--st-line)!important;color:var(--st-muted)!important;background:transparent!important}
.vzc-backup svg{width:22px;height:22px}.st-ico svg{width:25px;height:25px}.category-icon svg{width:32px;height:32px;color:var(--st-accent,#d8b783)}
.studio [data-save-category]{display:flex;align-items:center;gap:8px}.studio [data-save-category] svg{flex-shrink:0;width:22px;height:22px}
.studio .vzc-editor-launch{width:100%;border:1px solid var(--st-accent)!important;color:var(--st-accent)!important;min-height:46px!important;margin:4px 0 9px;background:var(--st-panel)!important}
.vzc-channel-picker{border:1px solid var(--st-line);padding:12px;border-radius:16px;margin-top:12px}.vzc-channel-picker summary{font-size:16px;font-weight:600;padding:10px 2px;cursor:pointer}.vzc-channel-picker .vf-other-channels{padding-top:12px}.vzc-channel-picker:not([open]) .vf-channels{display:none}
.studio #vzcShareFull{width:100%;font-size:14px!important;min-height:46px!important;background:var(--st-panel2)!important;color:var(--st-ink)!important}
.studio input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),.studio textarea,.studio select{font-size:max(16px,1em)!important}
.studio .vf-form-mount,.studio #cardForm,.studio #createFormBody{min-height:0!important;flex:1 1 0!important;overflow:hidden!important}
.studio .vf-step{min-height:0!important;overflow-y:auto!important;scroll-padding:18px 0 40px;flex:1 1 0!important}
.studio .vf-footer{flex:0 0 auto!important;z-index:1}.studio .vf-live-wrap{max-height:34vh;flex:0 0 auto!important}
.vzc-contact-help{font-size:14px;line-height:1.6;color:var(--st-muted);border:1px solid var(--st-line);border-radius:14px;padding:14px}.vzc-contact-help summary{cursor:pointer;color:var(--st-accent)}
.vzc-handoff{padding:18px;border:1px solid var(--st-line);border-radius:18px;margin-bottom:18px;background:var(--st-panel)}.vzc-handoff p{font-size:14px;line-height:1.5}.vzc-handoff button{margin:5px;min-height:44px}.vzc-handoff details{margin-top:12px}.vzc-handoff textarea{width:100%;max-height:100px}
@media(max-width:820px){body.studio>.st-top{height:calc(66px + env(safe-area-inset-top,0px))!important;padding:env(safe-area-inset-top,0px) 14px 0!important}body.studio #main.layout{margin-top:calc(66px + env(safe-area-inset-top,0px))!important}.studio .vzc-backup span{display:none}.studio .vzc-backup{padding:9px!important}.st-top-actions{gap:7px!important}.studio.vf-editing #main.layout{height:calc(var(--vzc-vh,100dvh) - 66px - 76px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px))!important}.studio .vf-live-wrap{max-height:25vh;padding:4px 0!important}.studio #vfLive{width:min(100%,360px)!important;min-height:0!important;max-height:180px!important;padding:0!important;aspect-ratio:1000/610;overflow:hidden!important}.studio .vf-live-caption{display:none}.studio #vfLive>.vz-face{width:100%;height:100%;min-height:0!important;max-height:180px}.studio .vf-footer-hint{font-size:11px!important}.studio .vf-icon-button{min-width:44px;min-height:44px}.studio .vf-segments{overflow-x:auto}.studio .vf-segments button{min-height:44px!important}}
@media(max-width:390px){.studio .st-brand{font-size:16px!important;gap:8px!important;letter-spacing:.15em!important}.studio .st-brand-mark{font-size:30px!important}.studio #stTheme{font-size:12px!important;padding:8px!important}.studio>.st-top{padding-left:12px!important;padding-right:12px!important}}
body.studio.vzc-keyboard.vf-editing>.st-top,body.studio.vzc-keyboard.vf-editing>.st-side{display:none!important}
body.studio.vzc-keyboard.vf-editing #main.layout{position:fixed!important;top:var(--vzc-top,0px)!important;left:0!important;right:0!important;width:100%!important;max-width:none!important;margin:0!important;height:var(--vzc-vh,100dvh)!important;padding:8px 12px!important;overflow:hidden!important}
body.studio.vzc-keyboard.vf-editing .vf-workflow{display:flex!important;flex-direction:column!important;gap:5px!important}
body.studio.vzc-keyboard.vf-editing .vf-live-wrap,body.studio.vzc-keyboard.vf-editing .vf-steps,body.studio.vzc-keyboard.vf-editing .vf-kicker,body.studio.vzc-keyboard.vf-editing .vf-footer-hint,body.studio.vzc-keyboard.vf-editing .vx-wizard-help{display:none!important}
body.studio.vzc-keyboard.vf-editing .vf-head h1{font-size:18px!important;margin:0!important}
body.studio.vzc-keyboard.vf-editing .vf-head{min-height:44px;flex-shrink:0}.studio.vzc-keyboard .vf-form-mount{height:auto!important;grid-column:auto!important;grid-row:auto!important}
.studio.vzc-keyboard .vf-footer{height:auto!important;min-height:50px!important;padding:4px 0!important;justify-content:space-between!important}
.studio.vzc-keyboard .modal{top:var(--vzc-top,0px)!important;bottom:auto!important;height:var(--vzc-vh,100dvh)!important;max-height:var(--vzc-vh,100dvh)!important}
.studio.vzc-keyboard .modal-card{max-height:calc(var(--vzc-vh,100dvh) - 20px)!important}
@media(max-height:520px) and (min-width:621px){body.studio.vf-editing:not(.vzc-keyboard) #main.layout{margin:0!important;height:var(--vzc-vh,100dvh)!important}.studio.vf-editing .vf-live-wrap{max-height:220px!important}}
@media(prefers-reduced-motion:reduce){.studio *{scroll-behavior:auto!important}}

/* RC6: text links follow the selected surface, never browser-default blue. */
body.studio a:not(.button-link):not(.ghost-link):not(.skip-link){color:var(--st-accent);text-decoration-thickness:1px;text-underline-offset:3px;overflow-wrap:anywhere}
body.studio a:not(.button-link):not(.ghost-link):not(.skip-link):visited{color:var(--st-accent)}
body.studio a:focus-visible{outline:2px solid currentColor;outline-offset:4px}
.language-gate{height:100dvh;padding:12px;overflow:hidden}
.language-gate-card{max-height:calc(100dvh - 24px);display:flex;flex-direction:column;overflow:hidden}
.language-gate-card .language-grid{flex:1 1 auto;min-height:70px;overflow-y:auto;overscroll-behavior:contain}
.language-gate-card .language-continue{flex:none;position:sticky;bottom:0;z-index:2;margin-top:10px;min-height:48px}
.language-gate-card .language-gate-note{font-size:11px;margin:6px 0;flex:none}
.language-gate-card h2{flex:none}
@media(max-height:620px){.language-gate-card .language-gate-subtitle,.language-gate-card .language-gate-recommended,.language-gate-card .language-gate-note{display:none}.language-gate-card{padding:12px}}


/* RC8: keep first-run legal acceptance fully usable on 320×568-class screens. */
@media (max-width: 380px) and (max-height: 600px) {
  .studio #termsModal {
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .studio #termsModal .modal-card {
    max-height: calc(100dvh - 12px - env(safe-area-inset-bottom, 0px)) !important;
    padding: 12px !important;
  }
  .studio #termsModal .section-head { margin-bottom: 5px; }
  .studio #termsModal .section-head h2 { font-size: 19px; line-height: 1.18; margin-bottom: 4px; }
  .studio #termsModal .hint,
  .studio #termsModal .status,
  .studio #termsModal .terms-check { font-size: 12px; line-height: 1.35; }
  .studio #termsModal .status.warning { margin-top: 6px; }
  .studio #termsModal .compact-links { margin: 7px 0 8px; font-size: 12px; line-height: 1.45; }
  .studio #termsModal .terms-check { margin-top: 5px; }
  .studio #termsModal .modal-actions {
    display: grid;
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
    gap: 6px;
    margin-top: 7px;
  }
  .studio #termsModal .modal-actions button { min-height: 44px !important; padding: 8px 6px !important; font-size: 12px !important; }
  .studio #termsModal #termsStatus { min-height: 0; margin-top: 4px; }
}
