/* The player dossier follows the active script's paper, ink and accent. */
.mivo-play-design #script-dialog.script-dialog[open].is-ot-portrait {
    --portrait-accent:var(--focus-color,#a36394);
    --portrait-paper:var(--script-surface,var(--main-bg-color,#fff));
    --portrait-wash:var(--minor-bg-color,#f7f4f7);
    --portrait-rule:var(--main-border-color,#dcd7dd);
    box-sizing:border-box;inset:0;margin:auto;width:min(380px,calc(100% - 44px));
    min-width:0;max-width:100%;height:fit-content;max-height:min(532px,74vh);
    padding:0;border:1px solid var(--portrait-rule);border-radius:20px;overflow:auto;
    color:var(--main-color);background:var(--portrait-paper);box-shadow:0 18px 64px #12101d45;
    scrollbar-width:none;
}
#script-dialog.is-ot-portrait::-webkit-scrollbar{display:none}
#script-dialog.is-ot-portrait::backdrop{background:rgb(22 19 32 / 48%)}
.mivo-play-design #script-dialog.is-ot-portrait .script-dialog-head{
    position:sticky;top:0;z-index:2;display:flex;align-items:center;
    padding:9px 14px;border-bottom:1px solid var(--portrait-rule);background:var(--portrait-paper);
}
#script-dialog.is-ot-portrait #script-dialog-title{display:flex;align-items:center;gap:8px;min-width:0;font-size:17px}
#script-dialog.is-ot-portrait #script-dialog-title>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#script-dialog.is-ot-portrait #script-dialog-title small{flex:none;font-size:12px;font-weight:400;color:var(--muted-color)}
#script-dialog.is-ot-portrait .ot-profile-avatar{
    width:38px;height:38px;flex:none;padding:0;margin:0;border:1px solid var(--portrait-rule);border-radius:50%;
}
#script-dialog.is-ot-portrait .ot-profile-avatar img{border-radius:inherit}
#script-dialog.is-ot-portrait #script-dialog-content{padding:11px 14px 12px}
#script-dialog .ot-portrait-studio{min-width:0;padding:9px 11px;border:1px solid var(--portrait-rule);border-radius:14px;background:var(--portrait-wash)}
.ot-portrait-studio>header,.ot-portrait-studio h3,.ot-portrait-tools,.ot-portrait-tabs{display:flex;align-items:center;gap:8px}
.ot-portrait-studio>header{justify-content:space-between}
.ot-portrait-studio h3,.ot-portrait-stage strong,.ot-portrait-source h4{margin:0;font-size:14px;font-weight:650}
.ot-portrait-studio h3 svg{width:17px;height:17px;color:var(--portrait-accent)}
.ot-custom-strip:empty{display:none}
.ot-custom-tile{position:relative;display:grid;place-content:center;box-sizing:border-box;flex:0 0 56px;height:70px;
    overflow:hidden;padding:0;border:1px solid var(--portrait-rule);border-radius:10px;background:var(--portrait-paper);color:var(--main-color)}
.ot-custom-tile img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:center 16%}
.ot-custom-tile>span{position:absolute;inset:auto 0 0;padding:10px 3px 4px;color:white;background:linear-gradient(transparent,#16121cb8);
    font-size:11px;line-height:1.4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ot-custom-tile[aria-pressed=true]{outline:2px solid var(--portrait-accent);outline-offset:-2px}
.ot-custom-tile[aria-pressed=true]::after{content:"";position:absolute;inset:0;border:2px solid var(--portrait-accent);border-radius:inherit;pointer-events:none}
.ot-portrait-tools{flex-wrap:wrap;gap:5px}
#script-dialog :is(.ot-portrait-studio,.ot-portrait-view) .but{
    min-height:36px;margin:0;padding:5px 11px;border:1px solid var(--portrait-rule);border-radius:9px;
    color:var(--main-color);background:var(--portrait-paper);white-space:normal;font-size:13px;line-height:1.4;
}
#script-dialog :is(.ot-portrait-studio,.ot-portrait-view) .but.c-theme{background:var(--portrait-accent);color:var(--beauty-on-accent,#fff);border-color:transparent}
.ot-portrait-stage{display:grid;grid-template-columns:62px minmax(0,1fr);gap:11px;align-items:center;margin-top:12px;padding-top:12px;border-top:1px solid var(--portrait-rule)}
.ot-checker{background-color:var(--portrait-paper);background-image:repeating-conic-gradient(var(--portrait-rule) 0% 25%,transparent 0% 50%);background-size:14px 14px}
.ot-stage-swatch{display:grid;place-items:center;overflow:hidden;width:62px;height:82px;padding:0;border:1px solid var(--portrait-rule);border-radius:9px}
.ot-stage-swatch img,.ot-portrait-large img,.ot-generated img{width:100%;height:100%;object-fit:contain}
.ot-stage-swatch svg{width:20px;height:20px;color:var(--muted-color)}
#script-dialog .ot-portrait-hint{margin:4px 0 8px;font-size:12px;line-height:1.5;color:var(--muted-color);overflow-wrap:anywhere}
#script-dialog.is-ot-portrait .ot-profile-sheet{gap:0}
#script-dialog.is-ot-portrait .ot-profile-sheet .ot-sheet-card{padding:4px 2px;border:0;border-bottom:1px solid var(--portrait-rule);border-radius:0;background:transparent}
#script-dialog.is-ot-portrait .ot-profile-sheet .ot-sheet-card:last-child{border:0}
#script-dialog.is-ot-portrait .ot-profile-sheet .script-status-attributes{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 12px;margin:4px 0}
#script-dialog.is-ot-portrait .ot-profile-sheet .ot-profile-row{align-items:baseline;min-height:34px}
#script-dialog .ot-profile-row>span{flex:none;max-width:40%}
.ot-portrait-tabs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:2px;padding:3px;border-radius:11px;background:var(--portrait-wash)}
.ot-portrait-tabs button{min-height:38px;border:0;border-radius:8px;background:transparent;color:var(--main-color);font-size:13px}
.ot-portrait-tabs button[aria-pressed=true]{background:var(--portrait-paper);color:var(--portrait-accent);font-weight:650;box-shadow:0 1px 4px #0002}
.ot-portrait-view,.ot-portrait-source,.ot-portrait-form{display:grid;gap:10px;min-width:0}
.ot-portrait-view [hidden]{display:none!important}
.ot-portrait-form label{margin:0}.ot-portrait-view>.but,.ot-portrait-source>.but,.ot-portrait-form>.but{justify-self:start}
.ot-portrait-large,.ot-generated img{height:min(51vh,420px);height:min(51dvh,420px);border-radius:12px;overflow:hidden}
.ot-generated{display:grid;gap:10px}
.ot-portrait-view[aria-busy=true],.ot-portrait-studio[aria-busy=true]{cursor:progress}
@media(max-width:360px){#script-dialog.is-ot-portrait #script-dialog-content{padding:10px}.ot-portrait-stage{grid-template-columns:48px minmax(0,1fr)}.ot-stage-swatch{width:48px}.ot-portrait-tabs button{font-size:12px}}


@supports (color:color-mix(in srgb,red,blue)){
    .mivo-play-design #script-dialog.script-dialog[open].is-ot-portrait{
        --portrait-wash:color-mix(in srgb,var(--portrait-accent) 6%,var(--portrait-paper));
        --portrait-rule:color-mix(in srgb,var(--main-color) 15%,var(--portrait-paper));
    }
}
#script-dialog.is-ot-portrait .script-dialog-head [data-dialog-close]::before{display:none}
#script-dialog.is-ot-portrait .script-dialog-head [data-dialog-close]{color:var(--main-color);background:var(--portrait-paper);border:1px solid var(--portrait-rule);border-radius:50%}

@supports(height:100dvh){
    .mivo-play-design #script-dialog.script-dialog[open].is-ot-portrait{
        max-height:min(532px,74dvh,calc(100dvh - 28px - var(--mivo-cutout-top,0px) - var(--mivo-cutout-bottom,0px)));
    }
}

#script-dialog.is-ot-portrait summary::-webkit-details-marker{display:none}
#script-dialog.is-ot-portrait .ot-profile-row strong{font-weight:500}
#script-dialog .ot-profile-row>svg{width:13px;height:13px;opacity:.65}
.ot-upload-zone{width:100%;min-width:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;min-height:140px;box-sizing:border-box;padding:14px;border:1px dashed var(--portrait-rule);border-radius:12px;background:var(--portrait-wash);color:var(--main-color);cursor:pointer}
.ot-upload-zone:focus-visible,.ot-upload-zone:hover,.ot-upload-zone.is-dragging{border-color:var(--portrait-accent)}
.ot-upload-zone:disabled{opacity:.65}
.ot-upload-icon{display:grid;place-items:center;color:var(--portrait-accent);width:36px;height:36px;border:1px solid var(--portrait-rule);border-radius:10px;background:var(--portrait-paper)}
.ot-upload-icon svg{width:19px;height:19px}
.ot-upload-zone strong{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px}
.ot-upload-zone small,.ot-file-limits{font-size:12px;color:var(--muted-color)}
.ot-upload-zone.has-image{min-height:0}
.ot-upload-zone.has-image .ot-upload-icon{display:none}
.ot-upload-zone.has-image small{color:var(--portrait-accent)}
.ot-upload-preview{width:100%;height:105px;object-fit:contain;border-radius:6px}
.ot-upload-footer,.ot-model-line{display:flex;align-items:center;justify-content:space-between;gap:8px}
.ot-file-limits{min-width:0;line-height:1.5}
#script-dialog .ot-upload-footer .but{flex:none}
#script-dialog .ot-portrait-view>.ot-picker-back{justify-self:center;padding:4px 10px;min-height:30px;font-size:12px;background:transparent;border:0;color:var(--muted-color)}
.ot-model-line{font-size:13px}.ot-model-line strong{font-weight:550}
.ot-format-field{min-width:0;margin:0;padding:0;border:0}
.ot-format-field legend,.ot-portrait-form .script-field>span{padding:0;margin:0 0 5px;font-size:13px;font-weight:550}
.ot-format-choices{display:flex;flex-wrap:wrap;gap:6px}
.ot-format-choices button{min-height:32px;padding:4px 10px;border:1px solid var(--portrait-rule);border-radius:8px;background:var(--portrait-paper);color:var(--main-color);font-size:12px}
.ot-format-choices button[aria-pressed=true]{color:var(--portrait-accent);border-color:var(--portrait-accent);background:var(--portrait-wash)}
#script-dialog .ot-portrait-form>.but{justify-self:stretch}
#script-dialog .ot-portrait-form textarea{height:74px;min-height:54px;resize:vertical}
.ot-generation-result:empty{display:none}

.ot-sheet-count{margin-left:auto;font-size:11px;font-weight:400;color:var(--muted-color)}
#script-dialog.is-ot-portrait .ot-portrait-studio{padding:8px 10px;border-radius:11px}
.ot-portrait-studio h3 small{color:var(--muted-color);font-weight:450;font-size:11px}
.mivo-play-design #script-dialog.is-ot-portrait[aria-describedby="ot-portraits-heading"][open]{width:min(490px,calc(100% - 24px))}
.ot-portrait-studio .ot-custom-strip{margin:3px 0 0}
#script-dialog.is-ot-portrait .ot-portrait-studio{padding:7px 10px 10px}
.ot-portrait-studio>header{flex-wrap:wrap;column-gap:8px;row-gap:0}
.ot-portrait-studio .ot-gallery-actions{margin-inline-start:auto}
#script-dialog .ot-portrait-studio :is(.ot-pose-toolbar,.ot-portrait-tools) button{
    min-height:32px;padding:3px 2px;border:0;border-radius:2px;box-shadow:none;background:transparent;color:var(--portrait-accent)
}
#script-dialog .ot-portrait-studio .ot-pose-delete{color:var(--muted-color)}
.ot-portrait-studio :is(.ot-pose-toolbar,.ot-portrait-tools){column-gap:10px}
.ot-portrait-studio .ot-custom-tile{flex-basis:clamp(44px,7vw,55px);height:auto;aspect-ratio:4/5;border-radius:7px}
.ot-custom-tile>span{font-size:10px;padding-bottom:2px}
.ot-pose-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:4px;margin-top:6px;padding-top:6px;border-top:1px solid var(--portrait-rule)}
.ot-pose-toolbar>strong{min-width:0;flex:1 1 55px;font-size:12px;line-height:1.4;overflow-wrap:anywhere}
#script-dialog .ot-portrait-studio .but,#script-dialog .ot-pose-delete{min-height:28px;padding:3px 7px;font-size:12px;border-radius:7px}
#script-dialog .ot-pose-delete{color:var(--muted-color);background:transparent;border:0}
#script-dialog .ot-portrait-stage{display:flex;gap:8px;align-items:center;margin:6px 0 0;padding:0;border:0}
.ot-portrait-stage small{display:block;font-size:11px;color:var(--muted-color);margin-bottom:3px}
#script-dialog .ot-stage-swatch{width:38px;height:46px;flex:none;border-radius:7px}
.ot-pose-editor{display:grid;gap:6px;margin:8px 0}
.ot-pose-editor[hidden]{display:none}
.ot-pose-editor .script-field{margin:0}
.ot-pose-editor .but{justify-self:start}
#script-dialog .ot-pose-editor .ot-portrait-hint{margin:0}
#script-dialog.is-ot-portrait .ot-profile-sheet .ot-sheet-card{padding:6px 1px}
#script-dialog .ot-sheet-card>h3{display:flex;align-items:center;gap:7px;min-height:28px;margin:0}
#script-dialog .ot-sheet-card>h3 svg{width:15px;height:15px;color:var(--portrait-accent)}
#script-dialog .ot-sheet-card li{overflow-wrap:anywhere}


.ot-portrait-studio .ot-look-slot{position:relative;flex:0 0 clamp(45px,7vw,55px);min-width:0;display:flex;flex-direction:column;align-items:stretch}
.ot-portrait-studio .ot-look-slot .ot-custom-tile{display:block;position:relative;width:100%;height:auto;aspect-ratio:1;min-height:44px;flex:none;border-radius:7px;overflow:hidden}
.ot-portrait-studio .ot-look-slot>small{font-size:10px;line-height:1.6;color:var(--main-color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:center}
.ot-custom-tile .ot-alpha-badge{position:absolute;left:2px;bottom:2px;padding:0 3px;border-radius:4px;font-size:9px;font-style:normal;line-height:1.5;background:#307359;color:white}
#script-dialog .ot-look-slot .ot-pose-delete{position:absolute;top:-2px;right:-2px;display:grid;place-items:center;width:18px;height:18px;min-height:18px;padding:0;border:1px solid var(--portrait-paper);border-radius:50%;background:#a63b55;color:#fff}
.ot-look-slot .ot-pose-delete svg{display:block;width:10px;height:10px;stroke:currentColor;fill:none}
#script-dialog .ot-portrait-stage{align-items:center}
.ot-stage-info{display:grid;gap:4px;min-width:0}.ot-stage-info strong,.ot-draft-pair>strong{font-size:12px}
.ot-stage-info strong small{display:inline;margin-left:6px;font-size:10px;font-weight:400}
.ot-draft-pair{display:grid;gap:7px;min-width:0;padding:9px 10px;background:var(--portrait-wash);border:1px solid var(--portrait-rule);border-radius:9px}
.ot-pair-preview,.ot-reference-preview:not(:empty){border:1px solid var(--portrait-rule);border-radius:7px;padding:4px}
.ot-pair-preview img,.ot-reference-preview img{display:block;width:100%;height:84px;object-fit:contain}
.ot-draft-pair .ot-portrait-hint:empty,.ot-reference-preview:empty{display:none}
.ot-portrait-form .cover-form-field{min-width:0;margin:0;padding:0;border:0}
.ot-portrait-form .cover-form-field legend{padding:0;margin:0 0 5px;font-size:13px;font-weight:550}
.ot-portrait-form .cover-choices{display:flex;flex-wrap:wrap;gap:5px}
.ot-portrait-form .cover-choices button{min-height:30px;padding:4px 8px;border:1px solid var(--portrait-rule);border-radius:7px;color:var(--main-color);background:var(--portrait-paper);font-size:12px}
.ot-portrait-form .cover-choices [aria-pressed=true]{border-color:var(--portrait-accent);color:var(--portrait-accent);background:var(--portrait-wash)}
#script-dialog .ot-carry-toggle{display:inline-flex;align-items:center;gap:6px;width:100%;margin-top:8px;padding:7px 0 0;border:0;border-top:1px solid var(--portrait-rule);background:none;color:var(--main-color);font-size:12px;text-align:left}
.ot-carry-toggle i{display:flex;align-items:center;width:25px;height:15px;padding:2px;box-sizing:border-box;background:var(--portrait-rule);border-radius:20px}
.ot-carry-toggle i::before{content:'';width:11px;height:11px;border-radius:50%;background:var(--portrait-paper);box-shadow:0 0 2px #0005}
.ot-carry-toggle[aria-checked=true] i{justify-content:flex-end;background:var(--portrait-accent)}


/* File picking stays in the foreground while the underlying player card stays centered. */
@media(max-width:768px){
    .mivo-play-design #script-dialog.script-dialog[open].is-ot-portrait[aria-describedby="ot-portrait-picker-help"]{
        position:fixed;inset:auto 0 0;margin:0;width:100%;max-width:100%;height:auto;
        max-height:90vh;max-height:calc(100dvh - max(18px,env(safe-area-inset-top,0px)));
        border:0;border-radius:18px 18px 0 0;overscroll-behavior:contain;
    }
    #script-dialog.is-ot-portrait[aria-describedby="ot-portrait-picker-help"] #script-dialog-content{
        padding:12px max(16px,env(safe-area-inset-right)) max(18px,calc(env(safe-area-inset-bottom,0px) + 12px)) max(16px,env(safe-area-inset-left));
    }
}
#script-dialog .ot-look-slot .ot-add-portrait,#script-dialog .ot-reference-add{
    display:grid;place-content:center;justify-items:center;padding:0;color:var(--main-color);
    background:var(--portrait-paper);border:1.5px dashed var(--muted-color);border-radius:8px;cursor:pointer;
}
.ot-custom-tile.ot-add-portrait>span{position:static;inset:auto;padding:0;background:none;color:inherit}
.ot-custom-tile.ot-add-portrait>span,.ot-reference-add span{font-size:22px;line-height:1;font-weight:400}
.ot-add-portrait:disabled{opacity:.45;cursor:default}
.ot-portrait-picker .ot-file-limits{display:block;color:var(--muted-color);font-size:12px;line-height:1.5}
.ot-upload-zone .ot-file-limits{margin-top:2px}
.ot-reference-field{min-width:0;padding:0;margin:0;border:0}
.ot-reference-field legend{padding:0;margin-bottom:6px;color:var(--main-color);font-size:13px;font-weight:600}
.ot-reference-list{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:0 0 6px}
.ot-reference-add,.ot-reference-thumb{flex:none;position:relative;width:58px;height:58px;box-sizing:border-box}
.ot-reference-add small{font-size:11px;color:var(--muted-color)}
.ot-reference-thumb img{display:block;width:100%;height:100%;object-fit:cover;border-radius:7px}
#script-dialog .ot-reference-remove{position:absolute;top:-3px;right:-3px;display:grid;place-items:center;width:19px;height:19px;min-height:0;padding:0;border:1px solid var(--portrait-paper);border-radius:50%;background:var(--main-color);color:var(--portrait-paper)}
.ot-reference-remove svg{display:block;width:12px;height:12px;fill:none;stroke:currentColor;stroke-width:2}

