/* Extend the site's existing creator shell and theme variables. */
#app-actions{margin-left:auto;display:flex;gap:8px;align-items:center;flex-wrap:wrap;justify-content:flex-end}
#app-notice{padding:10px 24px;color:var(--focus-color);background:var(--main-bg-color);border-bottom:1px solid var(--script-line);overflow-wrap:anywhere}
#app-notice.is-error{color:#cb6262}
.app-center-tools{display:flex;flex-wrap:wrap;gap:12px;margin:20px 0 32px}
.app-center-tools .but{display:flex;gap:8px;align-items:center}
.app-editor{display:grid;grid-template-columns:170px minmax(300px,1fr) minmax(280px,400px);max-width:1500px;margin:auto;align-items:start}
.app-editor-nav{position:sticky;top:90px;padding:24px 12px;display:flex;flex-direction:column;gap:8px}
.app-editor-nav .but{text-align:left;background:transparent;color:var(--muted-color)}
.app-editor-nav .is-current{color:var(--focus-color);background:color-mix(in srgb,var(--focus-color) 10%,transparent)}
.app-editor-form{padding:28px;border-inline:1px solid var(--script-line);min-width:0;min-height:calc(100dvh - 80px)}
.app-editor-form h2{margin-bottom:22px}.app-editor-form h3{margin-block:18px 12px}
.app-editor-preview{position:sticky;top:90px;padding:22px 18px;max-height:calc(100dvh - 100px);overflow:auto}
.app-editor-preview>h2{margin-bottom:16px}.app-form,.app-result{display:grid;gap:18px;padding:24px;margin-bottom:18px}
.app-result pre{white-space:pre-wrap;background:transparent;border:0;color:inherit;font:inherit;padding:0;margin:0}
.app-run{max-width:860px;margin:26px auto;padding:0 20px 70px}
.app-history-row{padding:18px 0;border-bottom:1px solid var(--script-line)}.app-history-row p{white-space:pre-wrap}
.app-field-row{padding:16px;border:1px solid var(--script-line);border-radius:12px;margin:16px 0}
.app-code{font-family:ui-monospace,SFMono-Regular,monospace!important;min-height:240px}
.app-save-state{font-size:12px;color:var(--muted-color)}
.app-cover{width:100%;max-width:340px;max-height:200px;object-fit:cover;border-radius:12px}
.mivo-app-sandbox{display:block;width:100%;min-height:480px;border:1px solid var(--script-line);border-radius:14px;background:var(--main-bg-color)}
.app-mobile-preview{display:none}.app-permissions{display:grid;gap:12px;padding:16px 0}.app-runtime-head{display:flex;align-items:center;gap:12px;justify-content:space-between;margin-bottom:22px}
.app-runtime-head h2{overflow-wrap:anywhere}.app-card-meta{display:flex;gap:8px;flex-wrap:wrap;font-size:12px;color:var(--muted-color)}
@media(max-width:1100px){.app-editor{grid-template-columns:150px minmax(280px,1fr)}.app-editor-preview{position:static;grid-column:2}.app-editor-form{border-right:0}}
@media(max-width:640px){#app-actions{gap:5px}.app-editor{display:flex;flex-direction:column}.app-editor-nav{position:sticky;top:66px;z-index:10;flex-direction:row;overflow:auto;max-width:100%;padding:10px 12px;background:var(--main-bg-color)}.app-editor-nav .but{white-space:nowrap}.app-editor-form{padding:20px 16px;border:0;width:100%;min-height:0}.app-editor-preview{width:100%;padding:20px 16px}.app-run{margin:18px auto;padding-inline:12px}.app-form,.app-result{padding:18px}.app-runtime-head{align-items:flex-start}.app-center-tools{gap:8px}.mivo-app-sandbox{min-height:500px}}
@media(prefers-reduced-motion:reduce){.mivo-app-body *{scroll-behavior:auto!important}}
#app-dialog-content{padding:22px;overflow-wrap:anywhere}
#app-dialog-content>.but{margin:6px 8px 6px 0}
@media(max-width:640px){#app-dialog-content{padding:18px}#app-actions{max-width:100%}.app-editor-nav{position:static}}

@media(max-width:640px){#app-actions{flex-basis:100%}#app-actions .but{min-height:34px}.app-editor-nav .but{flex:0 0 auto}}

/* Keep the header, step navigation and primary action in view while each panel scrolls. */
.mivo-authoring #mivo-app-root.role-authoring {
    --role-accent:var(--theme-color,var(--focus-color,#f26799));
    --role-page:var(--body-bg-color,#f3f3f5);
    --role-card:var(--main-bg-color,#fff);
    --role-width:610px;
    --role-screen-height:100vh;
    --role-bottom-gap:max(4px,env(safe-area-inset-bottom,0px),var(--mivo-cutout-bottom,0px));
    --role-action-height:48px;
    --role-action-space:calc(8px + var(--role-action-height) + var(--role-bottom-gap));
    --role-gutter:clamp(14px,4vw,24px);
    position:fixed;inset:var(--role-top,0px) 0 auto;display:flex;flex-direction:column;height:var(--role-height,var(--role-screen-height));min-height:0;max-width:none;margin:0;overflow:hidden;
    background:var(--role-page);
}
@supports (height:100dvh) {
    .mivo-authoring #mivo-app-root.role-authoring {--role-screen-height:100dvh}
}
body.mivo-authoring > #mivo-app-root.role-authoring ~ :is(.footer-tabbar,.footer-tabbar-placeholder) {display:none!important}
.role-authoring .script-header {
    position:sticky;top:0;display:grid;grid-template-columns:1fr auto 1fr;align-items:center;flex:none;
    width:100%;max-width:var(--role-width);margin:0 auto;padding:calc(6px + max(env(safe-area-inset-top,0px),var(--mivo-cutout-top,0px))) var(--role-gutter) 2px;
    border:0;background:var(--role-page);
}
.role-authoring .script-header h1 {margin:0;text-align:center;font-size:18px;line-height:42px;color:var(--main-color)}
.role-authoring .role-close {justify-self:start;display:grid;place-items:center;width:44px;height:44px;margin-left:-10px;border:0;background:transparent;color:var(--main-color)}
.role-authoring .role-close span {font:300 32px/1 system-ui}
.role-authoring #app-actions {display:block;justify-self:end;max-width:100%;margin:0}
.role-authoring .app-save-state {font-size:11px;white-space:nowrap;color:var(--muted-color)}
.role-authoring #app-workspace {flex:1;min-height:0}
.role-author-layout {position:relative;display:grid;grid-template-rows:auto minmax(0,1fr);height:100%}
.role-tabs {position:relative;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));width:min(100%,480px);margin:auto;padding:2px var(--role-gutter) 5px}
.role-tabs button {position:relative;min-width:0;min-height:44px;padding:5px 0 8px;border:0;background:transparent;color:var(--muted-color);font-size:15px;white-space:nowrap}
.role-tabs button[aria-selected="true"] {color:var(--main-color);font-weight:600}
.role-tab-indicator {position:absolute;left:var(--role-gutter);right:var(--role-gutter);bottom:5px;height:4px;pointer-events:none}
.role-tab-indicator i {display:grid;place-items:center;width:25%;height:100%;transform:translateX(var(--role-marker-x,0%))}
.role-tab-indicator i::after {content:'';width:23px;height:4px;border-radius:4px;background:var(--role-accent)}
.role-step-viewport {min-width:0;min-height:0;overflow:hidden;overflow:clip;touch-action:pan-y pinch-zoom}
.role-step-track {display:flex;width:100%;height:100%;transform:translate3d(var(--role-track-x,0%),0,0)}
.role-step-scroll {flex:0 0 100%;min-width:0;min-height:0;overflow:auto;overflow-x:hidden;overscroll-behavior:contain;scroll-padding:10px 0 calc(10px + var(--role-action-space));touch-action:pan-y pinch-zoom}
@media(prefers-reduced-motion:no-preference){
    .role-author-layout:not(.role-dragging) :is(.role-step-track,.role-tab-indicator i) {transition:transform 340ms cubic-bezier(.22,1.13,.36,1)}
}
.role-author-fields,.role-step-footer {width:100%;max-width:var(--role-width);margin-inline:auto;padding-inline:var(--role-gutter)}
.role-author-fields {padding-block:5px calc(10px + var(--role-action-space))}
.role-step-panel,.role-author-tools,.role-scope {display:grid;gap:8px;min-width:0}
.role-authoring[data-role-keyboard] .role-author-layout {--role-action-space:var(--role-keyboard-inset,0px)}
.role-authoring[data-role-keyboard] .role-step-footer {visibility:hidden}
.role-step-footer {position:absolute;z-index:1;inset:auto 0 0;padding-block:8px var(--role-bottom-gap);background:transparent;pointer-events:none}
.role-authoring .role-step-footer .but {pointer-events:auto;width:100%;min-height:var(--role-action-height);border:0;border-radius:999px;font-size:17px;font-weight:650;color:white;background:var(--role-accent);background:color-mix(in srgb,var(--role-accent) 90%,#512739)}
.role-authoring :is(.role-tabs button,.role-term-row,.role-close,.role-cover-pick,.role-step-footer .but):focus-visible,
.role-authoring .role-scope-option:has(input:focus-visible) {outline:2px solid var(--main-color);outline-offset:-3px}
.role-cover-section {margin:0 auto 4px;max-width:100%;text-align:center}
.role-cover-frame,.role-avatar-sheet .cover-drop {box-sizing:border-box;width:clamp(102px,28vw,116px);max-width:100%;height:auto;aspect-ratio:7/11;margin-inline:auto}
.role-cover-frame {position:relative}
.role-cover-pick {position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;width:100%;height:100%;overflow:hidden;border:0;border-radius:16px;color:var(--main-color);background:var(--role-card)}
.role-cover-pick:disabled {cursor:wait}
.role-cover-mark {color:var(--muted-color);font:300 38px/1 system-ui}
.role-cover-caption {font-size:15px;font-weight:550}
.role-authoring [hidden] {display:none!important}
.role-cover-section.has-images {width:min(100%,490px);text-align:left}
.role-image-bar {display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:6px}
.role-image-bar h2 {margin:0;font-size:15px;line-height:1.35;color:var(--main-color)}
.role-image-bar > div {display:flex;gap:5px;flex-wrap:wrap;justify-content:flex-end}
#mivo-app-root.role-authoring .role-image-bar .but {display:inline-flex;align-items:center;justify-content:center;gap:3px;min-height:27px;line-height:1.25;padding:3px 8px;margin:0;border-radius:999px;border:1px solid var(--role-accent);background:var(--role-card);border-color:color-mix(in srgb,var(--role-accent) 36%,transparent);background:color-mix(in srgb,var(--role-accent) 8%,var(--role-card));color:var(--role-accent);font-size:12px}
.role-image-bar .but svg {width:12px;height:12px;flex:none;fill:none;stroke:currentColor}
.role-image-bar .but svg path {fill:none}
.role-image-bar .is-generating svg {animation:role-spin 2s linear infinite}
.role-image-bar .but:disabled {opacity:.55}
html.mivo-role-editor,html.mivo-role-editor body.mivo-authoring {height:100%;overflow:hidden;overscroll-behavior:none}
.role-authoring #app-workspace {margin:0;padding:0;overflow:hidden;width:100%;max-width:none}
.role-image-grid {display:grid;grid-template-columns:minmax(0,2fr) minmax(0,3fr);grid-template-rows:1fr auto;gap:7px}
.role-image-grid > * {position:relative;isolation:isolate;min-width:0;overflow:hidden;padding:0;border:0;border-radius:13px;background:var(--role-card);color:var(--main-color)}
.role-image-grid img {position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.role-image-chat {grid-row:span 2;aspect-ratio:9/16}
.role-image-label strong,.role-image-label small {display:block;line-height:1.5}
.role-image-label strong {font-size:14px;font-weight:600}
.role-image-label small {font-size:11px}
.role-image-grid :is(.role-image-chat,.role-image-detail) .role-image-label {position:absolute;inset:auto 0 0;padding:23px 4px 9px;text-align:center;color:white;background:linear-gradient(transparent,rgba(0,0,0,.76))}
.role-image-grid .role-image-avatar {min-height:46px;display:flex;gap:9px;align-items:center;text-align:left;padding:5px 9px}
.role-image-grid .role-image-avatar img {position:static;width:36px;height:36px;border-radius:50%}
.role-image-avatar small {color:var(--muted-color)}
@media(prefers-reduced-motion:no-preference) {
    .role-image-reveal > *,.role-crop-stage {animation:role-image-in .24s ease-out both}
    .role-image-reveal > :nth-child(2) {animation-delay:35ms}
    .role-image-reveal > :nth-child(3) {animation-delay:65ms}
}
@keyframes role-image-in {from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
#app-dialog[open]:is([data-view="avatar"],[data-view="terms"]) {
    display:flex;flex-direction:column;position:fixed;inset:0;transform:none;margin:auto;
    width:min(460px,calc(100% - 32px));height:fit-content;max-height:calc(var(--sheet-visible-height,100vh) - 24px);
    padding:0;overflow:hidden;border:0;border-radius:20px;background:var(--role-card);color:var(--main-color);
}
#app-dialog:is([data-view="avatar"],[data-view="terms"]) .script-dialog-head {
    position:relative;flex:none;align-items:center;min-height:52px;padding:10px 16px 8px 20px;border:0;touch-action:none;
}
#app-dialog:is([data-view="avatar"],[data-view="terms"]) .script-dialog-head h2 {margin:0;font-size:18px;font-weight:650;line-height:1.4}
#app-dialog[data-view="avatar"] .script-dialog-head {gap:8px}
#app-dialog[data-view="avatar"] .script-dialog-head h2,#app-dialog[data-view="avatar"] [data-app-close] {flex:none}
.role-avatar-price {display:flex;align-items:center;flex-wrap:wrap;gap:2px 6px;margin-inline-end:auto;min-width:0;font-size:11px;line-height:1.45;color:var(--muted-color)}
.role-avatar-price[hidden],.role-avatar-price:empty {display:none}
.role-avatar-price strong {padding:2px 7px;border-radius:20px;background:var(--focus-color-opacity1,rgba(242,103,153,.1));background:color-mix(in srgb,var(--role-accent) 10%,var(--role-card));color:var(--role-accent);font-weight:600;white-space:nowrap}
.role-avatar-price span {white-space:nowrap}
#app-dialog:is([data-view="avatar"],[data-view="terms"]) [data-app-close] {
    display:grid;place-items:center;width:38px;height:38px;padding:0;border:0;border-radius:50%;color:var(--muted-color);background:var(--role-page);line-height:1;
}
#app-dialog:is([data-view="avatar"],[data-view="terms"]) #app-dialog-content {min-height:0;padding:0;overflow:auto;overscroll-behavior:contain}
.role-avatar-sheet,.role-term-picker {padding:4px 20px 18px;color:var(--main-color)}
.role-avatar-sheet [hidden] {display:none!important}
.role-avatar-tabs {display:grid;grid-template-columns:1fr 1fr;gap:4px;padding:4px;border-radius:12px;background:var(--role-page);margin-bottom:14px}
.role-avatar-tabs button {border:0;border-radius:9px;padding:8px;background:transparent;color:var(--muted-color);font-size:14px;font-weight:550}
.role-avatar-tabs button[aria-pressed=true] {color:var(--role-accent);background:var(--role-card);box-shadow:0 1px 4px #0001}
.role-avatar-sheet .cover-drop {display:grid;place-items:center;padding:0;border:1px dashed var(--muted-2-color);border-radius:12px;background:var(--role-page);color:var(--muted-color)}
.role-avatar-sheet .cover-drop span {font:300 38px/1 system-ui}
.role-avatar-sheet .muted-2-color {margin:0 0 12px;font-size:13px;line-height:1.55}
.role-avatar-sheet .but {min-height:40px}
.role-art-form .script-input,.role-term-search .script-input {font-size:16px}
.role-art-options {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.role-art-options .script-field {min-width:0}
.role-art-form textarea.script-input {min-height:72px;line-height:1.5}
.role-art-job {height:clamp(96px,17vh,156px);height:clamp(96px,17dvh,156px);display:grid;place-items:center;overflow:hidden;border:1px solid var(--script-line);border-radius:12px;background:var(--role-page)}
.role-art-placeholder {display:grid;justify-items:center;gap:6px;color:var(--muted-color);font-size:13px}
.role-art-placeholder svg {width:22px;height:22px}
.role-art-job svg {fill:none;stroke:currentColor;stroke-width:1.6}
.role-art-open {position:relative;display:block;width:100%;height:100%;min-height:0;overflow:hidden;padding:0;border:0;background:transparent;cursor:zoom-in}
.role-art-open img {display:block;width:100%;height:100%;object-fit:contain}
.role-art-open span {position:absolute;right:8px;bottom:8px;display:flex;align-items:center;gap:4px;padding:4px 8px;border-radius:20px;background:rgba(28,26,31,.76);color:#fff;font-size:11px}
.role-art-open svg {width:13px;height:13px}
.role-art-viewer[open] {position:fixed;inset:0;display:grid;grid-template-rows:auto minmax(0,1fr);gap:10px;width:100%;max-width:none;height:100%;height:100dvh;max-height:none;margin:0;box-sizing:border-box;padding:max(12px,env(safe-area-inset-top),var(--mivo-cutout-top,0px)) 16px max(14px,env(safe-area-inset-bottom),var(--mivo-cutout-bottom,0px));border:0;background:#161518;color:#fff}
.role-art-viewer header {display:flex;justify-content:space-between;align-items:center}
.role-art-viewer header>:is(button,a) {display:grid;place-items:center;color:#fff;background:#353438;border:0;border-radius:24px;min-height:44px}
.role-art-viewer small {color:#ccc;font-size:12px}
.role-art-viewer button {width:44px;font:26px/1 system-ui}
.role-art-viewer a {padding:0 16px;font-size:14px}
.role-art-viewer>img {display:block;width:100%;height:100%;min-height:0;object-fit:contain}
.role-art-form .script-subtle:empty,.role-term-picker > :empty {display:none}
.role-art-reference-tools {position:relative;width:fit-content}
.role-art-reference {width:48px;height:48px;padding:0;overflow:hidden;display:grid;place-items:center;border:1px solid var(--script-line);border-radius:11px;background:var(--role-page);color:var(--main-color)}
.role-art-reference img {display:block;width:100%;height:100%;object-fit:cover}
.role-art-remove {position:absolute;right:-6px;top:-6px;display:grid;place-items:center;width:23px;height:23px;padding:0;border:2px solid var(--role-card);border-radius:50%;background:#48474c;color:white;font:16px/1 system-ui}
.role-art-reference svg {width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.7}
.role-art-form>.but,.role-term-footer>.but {width:100%;min-height:44px;border-radius:12px}
.role-art-actions {display:flex;gap:8px}
.role-art-actions>.but {flex:1;min-height:44px;border-radius:12px}
.role-avatar-motion video {display:block;max-height:30vh;max-height:30dvh;max-width:100%;border-radius:12px;margin:12px auto}
.role-generating {display:grid;place-content:center;justify-items:center;gap:8px;color:var(--main-color);font-size:13px}
.role-generating i {width:25px;height:25px;border-radius:50%;border:3px solid var(--script-line);border-top-color:var(--role-accent);animation:role-spin .8s linear infinite}
@keyframes role-spin {to{transform:rotate(1turn)}}
@media(max-width:768px){
    #app-dialog[open]:is([data-view="avatar"],[data-view="terms"]) {
        inset:auto 0 var(--sheet-bottom,0px);margin:0 auto;width:100%;max-width:560px;border-radius:22px 22px 0 0;
        max-height:calc(var(--sheet-visible-height,100vh) - max(12px,env(safe-area-inset-top,0px),var(--mivo-cutout-top,0px)));
    }
    #app-dialog:is([data-view="avatar"],[data-view="terms"]) .script-dialog-head {padding-top:18px}
    #app-dialog:is([data-view="avatar"],[data-view="terms"]) .script-dialog-head::before {content:'';position:absolute;top:6px;left:50%;transform:translateX(-50%);width:32px;height:4px;border-radius:4px;background:var(--muted-2-color);opacity:.45}
    .role-avatar-sheet,.role-term-picker {padding-bottom:max(16px,env(safe-area-inset-bottom,0px),var(--mivo-cutout-bottom,0px))}
    #app-dialog[open][data-view="terms"] {height:min(52vh,470px)}
    #app-dialog[data-view="terms"] #app-dialog-content {flex:1}
}
.role-image-save {display:flex;align-items:center;gap:6px;flex-wrap:wrap;color:var(--muted-color);font-size:13px;padding-block:6px}
.role-art-form {display:grid;gap:12px}
.role-art-form .script-field {margin:0}
@media(prefers-reduced-motion:reduce){.role-generating i,.role-image-bar .is-generating svg{animation:none}}
#app-dialog[open][data-view="crop"] {
    --crop-surface:#121214;
    position:fixed;inset:0;transform:none;width:100%;height:100%;height:100dvh;max-width:none;max-height:none;margin:0;
    display:flex;flex-direction:column;overflow:hidden;overscroll-behavior:none;
    border:0;border-radius:0;background:var(--crop-surface);color:#fff;box-shadow:none;color-scheme:dark;
}
#app-dialog[open][data-view="crop"]::backdrop {background:var(--crop-surface,#121214)}
#app-dialog[data-view="crop"] .script-dialog-head {
    position:sticky;top:0;flex:none;display:flex;align-items:center;justify-content:center;min-height:0;
    padding:calc(5px + max(env(safe-area-inset-top,0px),var(--mivo-cutout-top,0px))) 52px 5px;
    border:0;background:var(--crop-surface);color:inherit;
}
#app-dialog[data-view="crop"] .script-dialog-head h2 {margin:0;font-size:18px;font-weight:600;line-height:44px;color:inherit}
#app-dialog[data-view="crop"] [data-app-close] {
    position:absolute;inset:auto auto 5px max(8px,env(safe-area-inset-left,0px));display:block;
    width:44px;height:44px;margin:0;padding:0;border:0;background:transparent;color:inherit;font-size:0;
}
#app-dialog[data-view="crop"] [data-app-close]::before {
    content:'';position:absolute;left:50%;top:50%;width:11px;height:11px;border:solid currentColor;border-width:0 0 2px 2px;transform:translate(-35%,-50%) rotate(45deg);
}
#app-dialog[data-view="crop"] #app-dialog-content {flex:1;min-height:0;padding:0}
.role-crop {
    display:grid;grid-template-rows:minmax(0,1fr) auto auto;height:100%;min-height:0;text-align:center;
    --crop-edge:max(12px,env(safe-area-inset-left,0px),env(safe-area-inset-right,0px));
}
.role-crop-stage {
    grid-row:1;place-self:stretch center;min-height:0;width:calc(100% - 2 * var(--crop-edge));max-width:1000px;
    display:grid;place-items:center;isolation:isolate;container-type:size;overflow:hidden;margin-block:8px 14px;
    touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;cursor:grab;background:#242428;
}
.role-crop-stage:active {cursor:grabbing}
.role-crop-window {position:relative;width:var(--crop-frame-width);aspect-ratio:var(--crop-ratio)}
@supports (width:1cqw) {
    .role-crop-window {width:min(calc(100cqw - 4px),calc((100cqh - 4px) * var(--crop-ratio)))}
}
.role-crop-stage .role-crop-window img {position:absolute;max-width:none;max-height:none;height:auto;pointer-events:none}
.role-crop-grid {
    position:absolute;inset:0;pointer-events:none;border:1px solid #fffd;box-shadow:0 0 0 150vmax rgb(0 0 0 / 50%);
    background:repeating-linear-gradient(to right,transparent 0 calc(33.333% - 1px),#fff4 calc(33.333% - 1px) 33.333%),
        repeating-linear-gradient(to bottom,transparent 0 calc(33.333% - 1px),#fff4 calc(33.333% - 1px) 33.333%);
}
.role-crop-grid i {position:absolute;width:16px;height:16px;border:solid white}
.role-crop-grid .corner-tl {top:-2px;left:-2px;border-width:3px 0 0 3px}
.role-crop-grid .corner-tr {top:-2px;right:-2px;border-width:3px 3px 0 0}
.role-crop-grid .corner-bl {bottom:-2px;left:-2px;border-width:0 0 3px 3px}
.role-crop-grid .corner-br {bottom:-2px;right:-2px;border-width:0 3px 3px 0}
.role-crop-stage.is-avatar .role-crop-grid::after {content:'';position:absolute;inset:0;border:1px solid #fffc;border-radius:50%}
.role-crop-actions {
    grid-row:3;display:grid;grid-template-columns:repeat(3,1fr);border-top:1px solid #ffffff18;
    padding:4px var(--crop-edge) max(6px,env(safe-area-inset-bottom,0px),var(--mivo-cutout-bottom,0px));
}
.role-crop-actions button {display:grid;place-content:center;justify-items:center;gap:2px;min-height:58px;border:0;padding:0;background:transparent;color:#fff;font:inherit;font-size:13px}
.role-crop-actions button:disabled {opacity:.45}
.role-crop-icon {font:300 25px/1 system-ui,sans-serif}
.role-crop-stage:focus-visible,.role-crop-actions button:focus-visible {outline:2px solid #fff;outline-offset:-3px}
.role-crop-status {grid-row:2;margin:0;padding:4px 12px 8px;font-size:13px;color:#eee}
.role-crop-status:empty {display:none}
.role-crop > .script-subtle:only-child,.role-crop > p:first-child {place-self:center;color:#eee}
.role-step-panel > :is(.script-field,.role-name,.role-gender,.role-term-row,.role-intro),.role-scope-option {
    min-width:0;margin:0;border:0;border-radius:13px;padding:11px 13px;background:var(--role-card);color:var(--main-color);
}
.role-author-fields .script-field {display:flex;gap:7px;margin:0}
.role-author-fields .script-field>span,.role-gender legend,.role-term-row strong,.role-scope-option strong {font-size:15px;font-weight:550;color:var(--main-color)}
.role-author-fields .script-input {min-height:30px;padding:0;border:0;box-shadow:none;background:transparent;font-size:16px;line-height:1.6;color:var(--main-color)}
.role-author-fields textarea.script-input {min-height:70px;resize:vertical}
.role-author-fields .script-input::placeholder {font-size:13px;color:var(--muted-2-color,#92959b);opacity:1;font-weight:400}
.role-author-fields .role-field-mark {display:inline;margin-inline-start:3px;color:var(--role-accent);font-size:12px;line-height:1;font-weight:500;vertical-align:baseline}
.role-author-fields .role-field-mark[hidden] {display:none}
.role-authoring .role-step-footer .role-submit:disabled {opacity:.48;cursor:wait}
.role-author-fields .script-input:focus-visible {outline:1px solid var(--role-accent);outline-offset:3px}
.role-author-fields .role-name {flex-direction:row;align-items:center;gap:14px}
.role-name>span {flex:none}
.role-name input {min-width:0}
.role-step-panel > .role-gender {padding-top:0}
.role-gender legend {float:left;width:100%;margin:0;padding:12px 0 7px;border:0}
.role-gender-options {display:flex;clear:both;gap:6px;flex-wrap:wrap}
.role-gender-options label {position:relative;flex:1;margin:0;cursor:pointer;font-weight:400}
.role-authoring .role-gender-options input[type=radio] {position:absolute;width:1px;height:1px;min-width:0;min-height:0;margin:0;padding:0;overflow:hidden;clip-path:inset(50%);appearance:none;-webkit-appearance:none;pointer-events:none;opacity:0}
.role-authoring .role-gender-options input[type=radio]::before,.role-authoring .role-gender-options input[type=radio]::after {content:none}
.role-gender-options span {display:grid;place-items:center;min-height:40px;padding:4px;border:1px solid var(--script-line);border-radius:9px;font-size:14px}
.role-gender-options input:checked+span {border-color:var(--role-accent);background:var(--focus-color-opacity1,rgba(242,103,153,.12));background:color-mix(in srgb,var(--role-accent) 12%,var(--role-card));font-weight:600}
.role-gender-options input:focus-visible+span {outline:2px solid var(--role-accent)}
.role-gender .script-field {margin-top:12px}
.role-term-row {display:flex;align-items:center;gap:12px;min-height:44px;text-align:left}
.role-term-row strong {flex:none}
.role-term-row span {margin-left:auto;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:14px;color:var(--muted-color)}
.role-term-row svg {width:16px;height:16px;flex:none;transform:rotate(-90deg);color:var(--muted-color)}
.role-authoring :is(.role-term-row,.role-scope-option) svg {fill:none;stroke:currentColor;stroke-width:1.7}
.role-intro-options {display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px}
.role-intro-options .but {min-height:40px;font-size:13px}
.role-intro-generator .script-inline-actions {justify-content:flex-end}
.role-intro-result {white-space:pre-wrap;line-height:1.8}
.role-scope-option {display:flex;align-items:center;gap:15px;min-height:74px;padding:15px 18px;cursor:pointer}
.role-scope-option svg {width:22px;height:22px;flex:none}
.role-scope-option span {flex:1;min-width:0}
.role-scope-option strong,.role-scope-option small {display:block}
.role-scope-option small {margin-top:2px;font-size:13px;color:var(--muted-color);font-weight:400}
.role-scope-option input {appearance:none;flex:none;width:22px;height:22px;margin:0;border-radius:50%;border:2px solid var(--muted-color);background:transparent;cursor:pointer}
.role-scope-option input:checked {border-color:var(--role-accent);background:var(--role-accent)}
.role-scope-option input:checked::after {content:'';display:block;width:6px;height:11px;margin:2px auto;border:solid white;border-width:0 2px 2px 0;transform:rotate(45deg)}
.role-authoring .role-publish-info:not(:empty) {margin:0 0 10px;padding:10px 14px;border-left:3px solid var(--role-accent);color:var(--main-color);background:var(--role-card);font-size:14px}
.role-validation:empty,.role-publish-info:empty {display:none}
.role-term-picker {display:flex;flex-direction:column;min-height:100%;box-sizing:border-box;gap:12px}
.role-term-picker .script-inline-actions {gap:6px;margin:0;flex-wrap:wrap}
.role-term-picker .script-inline-actions .but {border-radius:999px;color:var(--role-accent);max-width:100%;overflow-wrap:anywhere}
.role-term-search {display:flex;align-items:end;gap:8px}
.role-term-search .script-field {flex:1;min-width:0;margin:0}
.role-term-search .but {min-height:42px;border-radius:9px;flex:none}
.role-term-list {display:flex;align-content:start;align-items:start;flex-wrap:wrap;gap:8px;flex:1}
.role-term-list .script-check {display:inline-flex;align-items:center;gap:6px;margin:0;min-height:38px;max-width:100%;overflow-wrap:anywhere;padding:6px 11px;border:1px solid var(--script-line);border-radius:12px;color:var(--main-color)}
.role-term-list input {flex:none;margin:0;accent-color:var(--role-accent)}
.role-term-footer {position:sticky;bottom:0;margin-top:auto;padding:6px 0;background:var(--role-card)}
.role-author-tools .but {min-height:44px}
@media(min-width:360px) {
    .role-step-panel > .role-gender {padding-block:10px}
    .role-gender legend {width:auto;margin:0 12px 0 0;padding-block:8px}
    .role-gender-options {clear:none}
    .role-gender .script-field {clear:both}
}
@media(max-width:767px) {
    .role-author-fields textarea.script-input {resize:none}
}
@media(min-width:768px) and (hover:hover) {
    .role-authoring .script-header {padding-top:18px}
    .role-tabs {padding-block:6px 14px}
    .role-step-panel,.role-scope {gap:12px}
    .mivo-authoring #mivo-app-root.role-authoring {--role-bottom-gap:max(22px,env(safe-area-inset-bottom,0px))}
}

#mivo-app-root.role-library-page .script-header {display:flex;flex-flow:row nowrap;align-items:center;justify-content:space-between;gap:12px;padding:calc(8px + max(env(safe-area-inset-top,0px),var(--mivo-cutout-top,0px))) max(16px,calc((100% - 688px)/2)) 8px}
#mivo-app-root.role-library-page .script-header h1 {margin:0;font-size:20px;line-height:1.4}
#mivo-app-root.role-library-page #app-actions {width:auto;margin:0;flex:none}
.role-library {max-width:720px;margin:0 auto;padding:24px 16px calc(30px + var(--mivo-native-tabs,52px))}
.role-library-group + .role-library-group {margin-top:28px}
.role-library .role-library-group h2 {display:flex;align-items:baseline;gap:8px;margin:0 0 12px;font-size:18px;font-weight:650}
.role-library-group h2 small {font-size:13px;font-weight:400;color:var(--muted-color)}
.role-library-card {display:flex;align-items:center;gap:8px;padding:0 10px 0 0;background:var(--main-bg-color);border:1px solid var(--muted-border-color);border-radius:14px}
.role-library-card + .role-library-card {margin-top:8px}
.role-library-link {display:flex;flex:1;align-items:center;gap:12px;min-width:0;padding:12px;color:var(--main-color)}
.role-library-image {display:grid;place-items:center;flex:none;position:relative;overflow:hidden;width:46px;height:54px;border-radius:9px;background:var(--body-bg-color);color:var(--muted-color)}
.role-library-image img {position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.role-library-image svg {width:20px;height:20px}
.role-library-summary {display:grid;gap:4px;min-width:0}
.role-library-summary strong {overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:16px}
.role-library-summary small {font-size:12px;color:var(--muted-color)}
.mivo-script-root .role-library-delete {padding:6px 10px;min-height:44px;background:transparent;color:var(--muted-color);font-size:13px}
#app-dialog[data-view="delete-draft"] {
    box-sizing:border-box;
    width:min(296px, calc(100% - 32px));
}
#app-dialog[data-view="delete-draft"] .script-dialog-head {
    padding:14px 16px 0;
    border:0;
}
#app-dialog[data-view="delete-draft"] .script-dialog-head h2 {margin:0;font-size:17px;line-height:24px}
#app-dialog[data-view="delete-draft"] #app-dialog-content {padding:8px 16px 16px}
#app-dialog[data-view="delete-draft"] p {margin:0;line-height:1.5;overflow-wrap:anywhere}
#app-dialog[data-view="delete-draft"] .script-inline-actions {
    display:grid;
    grid-template-columns:repeat(2, minmax(0, 1fr));
    gap:12px;
    margin:14px 0 0;
}
#app-dialog[data-view="delete-draft"] .script-inline-actions > .but {width:100%;min-height:44px;margin:0;border-radius:9px}
.mivo-script-root .role-library-confirm {color:#fff;background:#b7384a}
.role-library-empty {padding:26px;text-align:center;border:1px dashed var(--muted-border-color);border-radius:14px;color:var(--muted-color)}
#app-actions .role-library-create {display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:40px;padding:6px 14px;border-radius:24px;background:var(--focus-color);color:#fff;font-size:14px;font-weight:600}
.role-library-create svg {width:16px;height:16px}
.mivo-script-root :is(.role-library-link,.role-library-delete,.role-library-create):focus-visible {outline:2px solid var(--focus-color);outline-offset:-2px}
