/* =========================================================
   STUDIO — the Content Studio's Studio tab, ported from the approved
   prototype (docs/design/content-studio-prototype.html): light aurora,
   Bricolage Grotesque for display, Hanken Grotesk for text, Mukta for
   Devanagari. Everything is prefixed ps- so nothing here collides with the
   app's own .btn, .tag, .modal or .tile. The campaign agent on the Campaigns
   page (cag-) reuses the agent-panel pieces.
========================================================= */

.ps, .ps-modalbg, .ps-sblight, .cag, .cag-viewer, #page-campaigns, #page-autopilot, #content-library {
    --ps-paper: #FBFCFF;
    --ps-mist: #F2F5FD;
    --ps-line: #E3E8F5;
    --ps-line-2: #D3DAEE;
    --ps-ink: #141B3C;
    --ps-ink-2: #4A5378;
    --ps-ink-3: #8A92B2;
    --ps-blue: #1E5BFF;
    --ps-blue-soft: #E8EFFF;
    --ps-violet: #9B7BFF;
    --ps-mint: #19B996;
    --ps-mint-soft: #E3F7F1;
    --ps-saffron: #F07A2A;
    --ps-saffron-soft: #FFF0E4;
    --ps-rose: #E0435F;
    --ps-aurora: linear-gradient(115deg, #1E5BFF 0%, #9B7BFF 45%, #22C9A6 100%);
    --ps-display: "Bricolage Grotesque", system-ui, sans-serif;
    --ps-body: "Hanken Grotesk", system-ui, sans-serif;
    --ps-deva: "Mukta", "Hanken Grotesk", sans-serif;
    --ps-r-panel: 22px;
    --ps-r-tile: 14px;
    --ps-r-ctl: 10px;
    /* names the library and autopilot pages share */
    --as-aurora: var(--ps-aurora);
    --as-violet: #6f5cff;
    --as-line: var(--border);
    --as-radius: 16px;
}

.ps { font: 14px/1.45 var(--ps-body); color: var(--ps-ink); }
.ps.hidden { display: none !important; }
.ps [hidden], .ps-modalbg[hidden] { display: none !important; }
.ps *, .ps-modalbg * { box-sizing: border-box; }
.ps button, .ps input, .ps textarea, .ps select, .ps-modalbg button, .ps-modalbg input, .ps-modalbg select { font: inherit; color: inherit; }
.ps button, .ps-modalbg button { cursor: pointer; border: 0; background: none; padding: 0; }
.ps :focus-visible, .ps-modalbg :focus-visible { outline: 2px solid var(--ps-blue); outline-offset: 2px; border-radius: 6px; }
.ps h1, .ps h2, .ps h3, .ps-modalbg h1, .ps-modalbg h3 { font-family: var(--ps-display); margin: 0; letter-spacing: -0.01em; color: var(--ps-ink); }
.ps h1, .ps-modalbg h1 { font-size: 26px; font-weight: 700; }
.ps h2 { font-size: 18px; font-weight: 600; }
.ps h3, .ps-modalbg h3 { font-size: 15px; font-weight: 600; }
.ps-deva { font-family: var(--ps-deva); }
.ps-muted { color: var(--ps-ink-2); margin: 0; }
.ps-faint { color: var(--ps-ink-3); font-size: 12.5px; }
.ps-scroll { overflow-y: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--ps-line-2) transparent; }
.ps svg { flex: none; }

/* ---------- frame ---------- */
.ps-frame {
    position: relative; display: grid; grid-template-columns: 84px 1fr; grid-template-rows: minmax(0, 1fr);
    height: calc(100vh - var(--topbar) - 186px); min-height: 680px; overflow: hidden;
    border: 1px solid var(--ps-line); border-radius: 24px; background: var(--ps-paper);
    box-shadow: 0 20px 50px #141B3C12; isolation: isolate;
}
.ps-frame::before { content: ""; position: absolute; inset: -20% -10% auto auto; width: 60%; height: 80%; background: radial-gradient(closest-side, #9B7BFF1f, transparent 70%); pointer-events: none; z-index: -1; }
.ps-frame::after { content: ""; position: absolute; inset: auto auto -25% -15%; width: 55%; height: 80%; background: radial-gradient(closest-side, #1E5BFF14, transparent 70%); pointer-events: none; z-index: -1; }
/* studio rail: the highlight is a pill behind the icon, the label sits clear below it */
.ps-nav { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 20px 0 16px; border-right: 1px solid var(--ps-line); background: #ffffffb8; backdrop-filter: blur(10px); }
.ps-navbtn { width: 72px; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 5px; color: var(--ps-ink-3); font-size: 11.5px; font-weight: 500; letter-spacing: .01em; line-height: 1.2; background: none; transition: color .15s; }
.ps-navbtn svg { width: 52px; height: 32px; padding: 6px 15px; box-sizing: border-box; border-radius: 99px; transition: background .15s, color .15s; }
.ps-navbtn:hover { color: var(--ps-ink); }
.ps-navbtn:hover svg { background: var(--ps-mist); }
.ps-navbtn:focus-visible { outline: none; }
.ps-navbtn:focus-visible svg { box-shadow: 0 0 0 2px var(--ps-blue); }
.ps-navbtn.is-on { color: var(--ps-ink); font-weight: 650; }
.ps-navbtn.is-on svg { background: var(--ps-blue-soft); color: var(--ps-blue); }
.ps-navsp { flex: 1; }
.ps-workspace { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.ps-topbar { display: flex; align-items: center; gap: 14px; padding: 12px 22px; border-bottom: 1px solid var(--ps-line); background: #ffffffa6; backdrop-filter: blur(10px); }
.ps-brandsw { display: flex; align-items: center; gap: 9px; padding: 5px 10px 5px 5px; border-radius: 12px; }
.ps-brandlogo { width: 30px; height: 30px; border-radius: 9px; background: var(--ps-ink); color: #fff; display: grid; place-items: center; font: 700 13px var(--ps-display); }
.ps-crumb { color: var(--ps-ink-3); }
.ps-crumbtitle { font: 600 16px var(--ps-display); color: var(--ps-ink); }
.ps-topsp { flex: 1; }
.ps .ps-agenttoggle { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 12px; font-weight: 600; background: var(--ps-ink); color: #fff; }
.ps-pulse { width: 8px; height: 8px; border-radius: 50%; background: #5ff0cf; }
.ps-agenttoggle.is-busy .ps-pulse { animation: ps-pulse 1.2s infinite; }
@keyframes ps-pulse { 0%, 100% { box-shadow: 0 0 0 0 #5ff0cf88; } 50% { box-shadow: 0 0 0 6px #5ff0cf00; } }
.ps-stage { flex: 1; display: grid; grid-template-columns: 1fr auto; grid-template-rows: minmax(0, 1fr); min-height: 0; position: relative; }
.ps-screen { min-width: 0; min-height: 0; overflow: hidden; display: grid; grid-template-rows: minmax(0, 1fr); }

/* ---------- shared controls ---------- */
.ps .ps-btn, .ps-modalbg .ps-btn, .cag .ps-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 15px; border-radius: var(--ps-r-ctl); font-weight: 600; white-space: nowrap; border: 0; cursor: pointer; font-family: var(--ps-body); }
.ps-btn:disabled { opacity: .55; cursor: default !important; }
.ps .ps-btn-primary, .ps-modalbg .ps-btn-primary, .cag .ps-btn-primary { background: var(--ps-blue); color: #fff; box-shadow: 0 6px 16px #1E5BFF38; }
.ps-btn-primary:hover:not(:disabled) { background: #1749d6 !important; }
.ps .ps-btn-ghost, .ps-modalbg .ps-btn-ghost, .cag .ps-btn-ghost { border: 1px solid var(--ps-line-2); background: #fff; color: var(--ps-ink); }
.ps-btn-ghost:hover { border-color: var(--ps-ink-3) !important; }
.ps .ps-btn-dark, .ps-modalbg .ps-btn-dark, .cag .ps-btn-dark { background: var(--ps-ink); color: #fff; }
.ps .ps-btn-sm, .ps-modalbg .ps-btn-sm, .cag .ps-btn-sm { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
.ps-iconbtn { display: grid !important; place-items: center; width: 32px; height: 32px; border-radius: 9px; color: var(--ps-ink-2); }
.ps-iconbtn:hover { background: var(--ps-mist) !important; color: var(--ps-ink); }
.ps .ps-pill, .cag .ps-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 99px; border: 1px solid var(--ps-line); background: #fff; font-size: 12.5px; white-space: nowrap; color: var(--ps-ink); }
.ps-pill:hover { border-color: var(--ps-line-2) !important; }
.ps .ps-pill.is-on, .cag .ps-pill.is-on { background: var(--ps-ink); color: #fff; border-color: var(--ps-ink); }
.ps-cost { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 99px; background: var(--ps-mint-soft); color: #0b7a5c; font-size: 12px; font-weight: 600; white-space: nowrap; }
.ps-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; font-family: var(--ps-body, inherit); }
.ps-tag-blue { background: var(--ps-blue-soft); color: var(--ps-blue); }
.ps-tag-saffron { background: var(--ps-saffron-soft); color: #b8530f; }
.ps-tag-mint { background: var(--ps-mint-soft); color: #0b7a5c; }
.ps-tag-ink { background: #141B3Cd0; color: #fff; backdrop-filter: blur(4px); }
.ps-tag-rose { background: #fde7eb; color: var(--ps-rose); }
.ps-seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--ps-mist); gap: 2px; }
.ps .ps-seg button, .cag .ps-seg button { padding: 6px 11px; border-radius: 8px; font-size: 12.5px; color: var(--ps-ink-2); border: 0; background: none; }
.ps .ps-seg button.is-on, .cag .ps-seg button.is-on { background: #fff; color: var(--ps-ink); font-weight: 600; box-shadow: 0 1px 3px #141B3C1f; }
.ps .ps-switch, .cag .ps-switch { width: 34px; height: 20px; border-radius: 99px; background: var(--ps-line-2); position: relative; transition: background .2s; flex: none; border: 0; padding: 0; }
.ps-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px #0003; }
.ps .ps-switch.is-on, .cag .ps-switch.is-on { background: var(--ps-blue); }
.ps-switch.is-on::after { transform: translateX(14px); }
.ps-field { display: flex; flex-direction: column; gap: 7px; }
.ps-flabel { font-size: 12.5px; font-weight: 600; color: var(--ps-ink-2); }
.ps-ctl { position: relative; flex: none; }
.ps .ps-ctl > button, .cag .ps-ctl > button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 9px; font-size: 12.5px; color: var(--ps-ink-2); border: 1px solid transparent; background: none; }
.ps-ctl > button:hover, .ps-ctl > button[aria-expanded="true"] { background: var(--ps-mist) !important; color: var(--ps-ink) !important; }
.ps-ctl > button b { color: var(--ps-ink); font-weight: 600; }
.ps-menu { position: absolute; bottom: calc(100% + 8px); left: 0; min-width: 230px; max-height: 320px; overflow-y: auto; background: #fff; border: 1px solid var(--ps-line); border-radius: 14px; box-shadow: 0 18px 40px #141B3C24; padding: 6px; z-index: 30; }
.ps-menu.is-down { bottom: auto; top: calc(100% + 8px); }
.ps .ps-menu button, .cag .ps-menu button { display: flex; width: 100%; text-align: left; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 9px; background: none; border: 0; }
.ps-menu button:hover { background: var(--ps-mist) !important; }
.ps .ps-menu .is-sel, .cag .ps-menu .is-sel { background: var(--ps-blue-soft); }
.ps-menu small { display: block; color: var(--ps-ink-3); font-size: 11.5px; }
.ps-menu b { font-weight: 600; }
.ps-menu hr { border: 0; border-top: 1px solid var(--ps-line); margin: 5px 4px; }
.ps-menu .ps-faint { margin-left: auto; }

/* ---------- image studio ---------- */
.ps-istudio { display: grid; grid-template-columns: 232px 1fr; grid-template-rows: minmax(0, 1fr); height: 100%; min-height: 0; }
.ps-rail { border-right: 1px solid var(--ps-line); padding: 18px 14px; display: flex; flex-direction: column; gap: 18px; background: #ffffff80; }
.ps-group h3 { font-size: 13px; color: var(--ps-ink-3); font-family: var(--ps-body); font-weight: 600; margin: 0 6px 6px; }
.ps .ps-tool { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 9px; border-radius: 11px; text-align: left; color: var(--ps-ink-2); }
.ps-tool:hover { background: var(--ps-mist) !important; color: var(--ps-ink); }
.ps .ps-tool.is-on { background: #fff; color: var(--ps-ink); font-weight: 600; box-shadow: 0 1px 2px #141B3C14, 0 0 0 1px var(--ps-line); }
.ps-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--ps-mist); color: var(--ps-ink-2); flex: none; }
.ps-tool.is-on .ps-ico { background: var(--ps-blue); color: #fff; }
.ps .ps-feature { position: relative; display: block; width: 100%; text-align: left; border-radius: 16px; padding: 10px; border: 1px solid var(--ps-line); background: #fff; margin-bottom: 8px; }
.ps-feature:hover { border-color: var(--ps-line-2) !important; }
.ps .ps-feature.is-on { border-color: transparent; box-shadow: 0 0 0 2px var(--ps-blue), 0 10px 24px #1E5BFF26; }
.ps-ba { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; height: 70px; border-radius: 10px; overflow: hidden; margin-bottom: 8px; }
.ps-ba div { position: relative; }
.ps-ba span { position: absolute; left: 5px; bottom: 5px; font-size: 10px; padding: 1px 6px; border-radius: 99px; background: #fffd; color: var(--ps-ink); font-weight: 600; }
.ps-art-a { background: linear-gradient(160deg, #e7d8c6, #a98466); }
.ps-art-b { background: radial-gradient(circle at 70% 30%, #ffd58a 0 14%, transparent 15%), linear-gradient(170deg, #ff9f5a, #c23f6b 60%, #3b2a6b); }
.ps-art-c { background: repeating-linear-gradient(135deg, #eef1f6 0 8px, #e2e7ef 8px 16px); }
.ps-art-d { background: linear-gradient(160deg, var(--ps-blue), var(--ps-violet)); }
.ps-feature b { font-family: var(--ps-display); font-size: 14.5px; }
.ps-feature p { margin: 2px 0 0; font-size: 12px; color: var(--ps-ink-2); }
.ps-pick-insp { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin: -2px 0 8px; }
.ps .ps-pick-insp button { aspect-ratio: 1; border-radius: 8px; overflow: hidden; border: 2px solid transparent; background: var(--ps-mist); }
.ps .ps-pick-insp button.is-on { border-color: var(--ps-blue); }
.ps-pick-insp img, .ps-pick-insp span { width: 100%; height: 100%; object-fit: cover; display: block; }
.ps-ctxrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.ps-ctxrow b { font-weight: 600; }
.ps-ctxrow select, .ps-ctxrow input { max-width: 150px; border: 1px solid var(--ps-line); border-radius: 8px; padding: 4px 6px; background: #fff; font-size: 12px; }
.ps-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.ps .ps-minichip { font-size: 11.5px; padding: 3px 8px; border-radius: 99px; background: #fff; border: 1px solid var(--ps-line); display: inline-flex; align-items: center; gap: 4px; }
.ps .ps-minichip.is-on { background: var(--ps-blue-soft); border-color: var(--ps-blue); color: var(--ps-blue); }
.ps .ps-minichip.is-trend.is-on { background: var(--ps-saffron-soft); border-color: var(--ps-saffron); color: #b8530f; }
.ps-insp { display: flex; gap: 5px; flex-wrap: wrap; }
.ps .ps-insp button { width: 38px; height: 38px; border-radius: 8px; overflow: hidden; border: 2px solid transparent; background: var(--ps-mist); }
.ps .ps-insp button.is-on { border-color: var(--ps-blue); }
.ps-insp img, .ps-insp span { width: 100%; height: 100%; object-fit: cover; display: block; }
.ps-canvas { display: flex; flex-direction: column; min-height: 0; height: 100%; position: relative; }
.ps-canvashead { display: flex; align-items: center; gap: 12px; padding: 18px 24px 10px; flex-wrap: wrap; }
.ps-canvashead .ps-sp { flex: 1; }
/* setup step and results scroll together; the bottom padding clears the floating composer */
.ps-canvasbody { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 230px; }
.ps-results { padding: 6px 24px 0; }
.ps-masonry { columns: 4 200px; column-gap: 14px; }
.ps-tile { break-inside: avoid; margin: 0 0 14px; border-radius: var(--ps-r-tile); overflow: hidden; position: relative; background: var(--ps-mist); display: block; }
.ps-tile .ps-media { width: 100%; display: block; min-height: 120px; }
.ps-tile img, .ps-tile video { display: block; width: 100%; height: 100%; object-fit: cover; }
.ps-badges { position: absolute; top: 9px; left: 9px; display: flex; gap: 5px; flex-wrap: wrap; }
.ps-acts { position: absolute; left: 9px; right: 9px; bottom: 9px; display: flex; gap: 6px; opacity: 0; transform: translateY(6px); transition: .18s; }
.ps-tile:hover .ps-acts, .ps-tile:focus-within .ps-acts { opacity: 1; transform: none; }
.ps .ps-acts button { flex: 1; padding: 7px 0; border-radius: 9px; background: #ffffffe6; backdrop-filter: blur(6px); font-size: 12.5px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 5px; }
.ps .ps-acts button:hover { background: #fff; }
.ps .ps-acts button.is-go { background: var(--ps-blue); color: #fff; }
.ps-tile.is-picked { box-shadow: 0 0 0 3px var(--ps-blue); }
.ps .ps-keep { position: absolute; right: 9px; top: 9px; display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px 5px 6px; border-radius: 99px; background: #ffffffe6; font-size: 12px; font-weight: 600; box-shadow: 0 4px 12px #141B3C1f; }
.ps-keep i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ps-line-2); display: grid; place-items: center; }
.ps .ps-keep.is-on { background: var(--ps-blue); color: #fff; }
.ps-keep.is-on i { border-color: #fff; background: #fff; color: var(--ps-blue); }
.ps-tile.is-pending { aspect-ratio: 4/5; }
.ps-tile.is-pending::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, #ffffffb0 50%, transparent 70%), var(--ps-aurora); background-size: 200% 100%, 100% 100%; opacity: .5; animation: ps-sheen 1.4s linear infinite; }
@keyframes ps-sheen { from { background-position: 150% 0, 0 0; } to { background-position: -50% 0, 0 0; } }
.ps-empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 40px 20px; color: var(--ps-ink-2); }
.ps-empty h2 { font-size: 22px; }
.ps-empty p { max-width: 460px; margin: 0; line-height: 1.6; }
.ps-starters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 4px; }
.ps-media-note { display: grid; place-items: center; min-height: 120px; color: var(--ps-ink-3); font-size: 12px; }

/* composer */
.ps-composer { position: absolute; left: 24px; right: 24px; bottom: 18px; border-radius: 20px; background: #fff; border: 1px solid var(--ps-line); box-shadow: 0 24px 50px #141B3C1f; padding: 12px 14px; z-index: 5; }
/* while the agent works: a thin indeterminate bar on the box's top edge, nothing louder */
.ps-composer.is-running::before { content: ""; position: absolute; top: -1px; left: 18px; right: 18px; height: 3px; border-radius: 0 0 3px 3px; background: linear-gradient(var(--ps-blue), var(--ps-blue)) no-repeat, var(--ps-blue-soft); background-size: 35% 100%, 100% 100%; animation: ps-progress 1.4s ease-in-out infinite; pointer-events: none; }
@keyframes ps-progress { from { background-position: -60% 0, 0 0; } to { background-position: 160% 0, 0 0; } }
.ps-ctop { display: flex; gap: 12px; align-items: flex-start; }
.ps-refs { display: flex; gap: 6px; }
.ps-ref { width: 48px; height: 48px; border-radius: 11px; position: relative; border: 1px solid var(--ps-line); background: var(--ps-mist); flex: none; }
.ps-ref img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; display: block; }
.ps-ref.has-role { margin-right: 24px; }
.ps .ps-role { position: absolute; bottom: -2px; left: 50%; transform: translate(-50%, 100%); width: 70px; height: 20px; padding: 0 4px; border-radius: 6px; border: 1px solid var(--ps-line-2); background: var(--ps-paper); color: var(--ps-ink-2); font: 600 11px var(--ps-body); cursor: pointer; }
.ps .ps-role:focus-visible { outline: 2px solid var(--ps-blue); outline-offset: 1px; }
.ps-ref small { position: absolute; bottom: -2px; left: 50%; transform: translate(-50%, 100%); font-size: 10px; color: var(--ps-ink-3); white-space: nowrap; }
.ps .ps-unref { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; background: var(--ps-ink); color: #fff; display: grid; place-items: center; }
.ps .ps-ref.is-add { display: grid; place-items: center; border: 1.5px dashed var(--ps-line-2); color: var(--ps-ink-3); background: var(--ps-paper); }
.ps-prompt { flex: 1; border: 0; resize: none; outline: none; min-height: 50px; font-size: 15px; background: transparent; line-height: 1.5; }
.ps-prompt::placeholder { color: var(--ps-ink-3); }
.ps-cbottom { display: flex; align-items: center; gap: 4px; margin-top: 14px; flex-wrap: wrap; }
.ps-cbottom .ps-sp { flex: 1; }
.ps-draftbox { display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 9px; font-size: 12.5px; color: var(--ps-ink-2); cursor: pointer; }

/* ---------- agent panel (the chat) ---------- */
.ps-agent { width: 0; overflow: hidden; transition: width .28s ease; border-left: 1px solid var(--ps-line); background: #fff; }
.ps-agent.is-open { width: 344px; }
.ps-agentin { width: 344px; height: 100%; display: flex; flex-direction: column; }
.ps-agenthead { padding: 16px 14px 12px 18px; display: flex; align-items: center; gap: 8px; }
.ps-agenthead > div:not(.ps-orb) { flex: 1; min-width: 0; }
.ps-agenthead h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* the agent's mark: a quiet sparkle badge at rest, a plain spinner while it works */
.ps-orb { width: 34px; height: 34px; border-radius: 50%; background: var(--ps-blue-soft); position: relative; flex: none; display: inline-block; box-sizing: border-box; }
.ps-orb::after { content: ""; position: absolute; inset: 0; margin: auto; width: 52%; height: 52%; background: var(--ps-blue);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z'/%3E%3C/svg%3E") center / contain no-repeat; }
.ps-orb.is-busy { background: none; border: 3px solid var(--ps-blue-soft); border-top-color: var(--ps-blue); animation: ps-spin .8s linear infinite; }
.ps-orb.is-busy::after { display: none; }
.ps-orb-sm { width: 14px; height: 14px; }
.ps-orb-sm.is-busy { border-width: 2px; }
@keyframes ps-spin { to { transform: rotate(360deg); } }
.ps-agentbody { flex: 1; padding: 0 18px 18px; display: flex; flex-direction: column; gap: 14px; }
.ps-agentbody > * { flex: none; }
.ps-goal { border-radius: 16px; padding: 12px 14px; background: var(--ps-mist); font-size: 13.5px; }
.ps-goal .ps-faint { margin-bottom: 3px; }
.ps-steps { display: flex; flex-direction: column; }
.ps-step { display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding-bottom: 12px; position: relative; font-size: 13px; }
.ps-step::before { content: ""; position: absolute; left: 10px; top: 20px; bottom: 0; width: 1.5px; background: var(--ps-line); }
.ps-step:last-child::before { display: none; }
.ps-sdot { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--ps-mist); color: var(--ps-ink-3); font-size: 11px; }
.ps-step.is-done .ps-sdot { background: var(--ps-mint); color: #fff; }
.ps-step.is-run .ps-sdot { background: var(--ps-blue); color: #fff; box-shadow: 0 0 0 4px #1E5BFF26; }
.ps-step.is-fail .ps-sdot { background: var(--ps-rose); color: #fff; }
.ps-step.is-run .ps-stext { font-weight: 600; }
.ps-step .ps-sub { font-size: 12px; color: var(--ps-ink-3); }
.ps-qc { border-radius: 16px; border: 1px solid var(--ps-line); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.ps-qcrow { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--ps-ink); }
.ps-qcrow svg { margin-top: 1px; }
.ps-ok { color: var(--ps-mint); }
.ps-warn { color: var(--ps-saffron); }
.ps-picks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ps .ps-picks button, .cag .ps-picks button { position: relative; aspect-ratio: 4/5; border-radius: 9px; overflow: hidden; background: var(--ps-mist); border: 2px solid transparent; padding: 0; }
.ps .ps-picks button.is-on, .cag .ps-picks button.is-on { border-color: var(--ps-blue); }
.ps-picks button i { position: absolute; right: 4px; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: #fffe; border: 1.5px solid var(--ps-line-2); display: grid; place-items: center; z-index: 1; }
.ps-picks button.is-on i { background: var(--ps-blue); border-color: var(--ps-blue); color: #fff; }
.ps-picks [data-as-media], .ps-picks img, .ps-picks video { width: 100%; height: 100%; object-fit: cover; display: block; }
.ps-picks .ps-score { position: absolute; left: 4px; bottom: 4px; z-index: 1; font-size: 10px; padding: 0 5px; }
.ps-errnote { border-radius: 14px; padding: 10px 12px; background: #fde7eb; color: #a3263c; font-size: 12.5px; display: flex; gap: 8px; }
.ps-idle { display: flex; flex-direction: column; gap: 8px; }
.ps .ps-suggest, .cag .ps-suggest { text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--ps-line); font-size: 13px; background: #fff; color: var(--ps-ink); }
.ps-suggest:hover { border-color: var(--ps-blue) !important; background: var(--ps-blue-soft) !important; }
.ps-umsg { align-self: flex-end; max-width: 88%; padding: 9px 13px; border-radius: 14px 14px 4px 14px; background: var(--ps-ink); color: #fff; font-size: 13px; line-height: 1.45; }
.ps-umsg small { display: block; font-size: 10.5px; opacity: .65; margin-top: 2px; }
.ps-turnsep { height: 1px; background: var(--ps-line); margin: 4px 0; }
.ps-steer { margin: 0 18px 18px; border: 1px solid var(--ps-line); border-radius: 14px; padding: 8px 8px 8px 12px; display: grid; gap: 8px; }
.ps-steerrow { display: flex; align-items: center; gap: 8px; }
.ps-steer input { flex: 1; border: 0; outline: 0; background: none; min-width: 0; }
.ps-replyto { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 10px; background: var(--ps-blue-soft); font-size: 12px; }
.ps-replyto > span:first-child { width: 30px; height: 30px; border-radius: 7px; overflow: hidden; flex: none; }
.ps-replyto img, .ps-replyto video { width: 100%; height: 100%; object-fit: cover; display: block; }
.ps-replyto b { flex: 1; color: var(--ps-blue); }
.ps-chatlist { display: flex; flex-direction: column; gap: 4px; }
.ps .ps-chatitem { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 9px 10px; border-radius: 12px; text-align: left; border: 1px solid transparent; width: 100%; }
.ps .ps-chatitem:hover { background: var(--ps-mist); }
.ps .ps-chatitem.is-on { background: var(--ps-blue-soft); border-color: #cddbff; }
.ps-chatitem b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-chatitem small { grid-column: 1; font-size: 11.5px; color: var(--ps-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-chatitem time { font-size: 11px; color: var(--ps-ink-3); }
.ps-chatitem .ps-del { grid-row: 2; grid-column: 2; justify-self: end; color: var(--ps-ink-3); opacity: 0; }
.ps-chatitem:hover .ps-del, .ps-del:focus-visible { opacity: 1; }
.ps-del:hover { color: var(--ps-rose) !important; }
.ps-score { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 99px; font-size: 11px; font-weight: 700; }
.ps-score-ok { background: var(--ps-mint-soft); color: #0b7a5c; }
.ps-score-bad { background: var(--ps-saffron-soft); color: #b8530f; }

/* ---------- video studio ---------- */
.ps-vstudio { display: grid; grid-template-columns: 1fr 300px; grid-template-rows: minmax(0, 1fr); height: 100%; min-height: 0; }
.ps-frames { display: grid; grid-template-columns: 1fr 24px 1fr; gap: 6px; align-items: center; }
.ps .ps-frame-slot { aspect-ratio: 9/12; border-radius: 12px; position: relative; border: 1px solid var(--ps-line); overflow: hidden; background: var(--ps-mist); }
.ps-frame-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ps-frame-slot .ps-tag { position: absolute; left: 6px; top: 6px; }
.ps .ps-frame-slot.is-empty { display: grid; place-items: center; border: 1.5px dashed var(--ps-line-2); color: var(--ps-ink-3); font-size: 12px; background: var(--ps-paper); text-align: center; padding: 6px; }
.ps-styles3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ps .ps-stylecard { border-radius: 12px; border: 1px solid var(--ps-line); padding: 6px; text-align: left; background: #fff; font-size: 12.5px; font-weight: 600; }
.ps-stylecard div { height: 54px; border-radius: 8px; margin-bottom: 5px; }
.ps .ps-stylecard.is-on { box-shadow: 0 0 0 2px var(--ps-blue); border-color: transparent; }
.ps-st-commercial { background: radial-gradient(circle at 70% 35%, #ffd58a 0 12%, transparent 13%), linear-gradient(160deg, #3b2a6b, #c23f6b 70%, #ff9f5a); }
.ps-st-presenter { background: radial-gradient(circle at 50% 42%, #f2c9a5 0 16%, transparent 17%), linear-gradient(180deg, #dfe7ff 60%, #3c4f86 60%); }
.ps-st-ugc { background: radial-gradient(circle at 50% 38%, #f6d2b4 0 18%, transparent 19%), linear-gradient(160deg, #19B996, #9B7BFF); }
.ps-cams { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ps .ps-cam { border-radius: 11px; border: 1px solid var(--ps-line); background: #fff; padding: 5px; font-size: 11px; text-align: center; }
.ps .ps-cam.is-on { box-shadow: 0 0 0 2px var(--ps-blue); border-color: transparent; font-weight: 600; }
.ps-camviz { height: 38px; border-radius: 7px; overflow: hidden; position: relative; background: linear-gradient(#cfe0ff, #eef3ff); margin-bottom: 4px; }
.ps-camviz i { position: absolute; left: 50%; top: 50%; width: 16px; height: 20px; margin: -10px 0 0 -8px; border-radius: 4px 4px 2px 2px; background: var(--ps-ink); }
.ps-camviz b { position: absolute; left: 0; right: 0; bottom: 0; height: 9px; background: #9db6ea; }
.ps-cam:hover .ps-camviz i, .ps-cam.is-on .ps-camviz i, .ps-preset:hover .ps-camviz i { animation: var(--cam) 1.6s ease-in-out infinite; }
@keyframes ps-dolly { 50% { transform: scale(1.6); } }
@keyframes ps-crash { 0%, 40% { transform: scale(1); } 55%, 100% { transform: scale(2.2); } }
@keyframes ps-orbit { 50% { transform: scaleX(-1) translateX(4px); } }
@keyframes ps-fpv { 0% { transform: translate(-30px, 8px) scale(.6); } 100% { transform: translate(30px, -4px) scale(1.4); } }
@keyframes ps-pan { 50% { transform: translateX(-18px); } }
@keyframes ps-tilt { 50% { transform: translateY(10px); } }
@keyframes ps-hand { 25% { transform: translate(2px, -1px) rotate(2deg); } 75% { transform: translate(-2px, 1px) rotate(-2deg); } }
@keyframes ps-push { 0% { transform: scale(.7); opacity: 1; } 100% { transform: scale(3); opacity: 0; } }
.ps-optrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ps .ps-voice { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; border: 1px solid var(--ps-line); background: #fff; width: 100%; text-align: left; }
.ps .ps-voice.is-on { box-shadow: 0 0 0 2px var(--ps-blue); border-color: transparent; }
.ps-play { width: 28px; height: 28px; border-radius: 50%; background: var(--ps-mist); display: grid; place-items: center; flex: none; }
.ps-wave { display: flex; gap: 2px; align-items: center; height: 16px; }
.ps-wave i { width: 2px; border-radius: 2px; background: var(--ps-ink-3); }
.ps-toggles { display: flex; flex-direction: column; border: 1px solid var(--ps-line); border-radius: 14px; background: #fff; }
.ps-toggles > div { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--ps-line); font-size: 13.5px; }
.ps-toggles > div:first-child { border-top: 0; }
.ps-toggles .ps-sp { flex: 1; }
.ps-board { padding: 18px 22px 30px; display: flex; flex-direction: column; gap: 12px; }
.ps-brief { position: relative; border: 1px solid var(--ps-line); border-radius: 18px; background: #fff; padding: 12px 14px; box-shadow: 0 10px 30px #141B3C0f; display: grid; gap: 10px; }
.ps-brief.is-running::before { content: ""; position: absolute; top: -1px; left: 18px; right: 18px; height: 3px; border-radius: 0 0 3px 3px; background: linear-gradient(var(--ps-blue), var(--ps-blue)) no-repeat, var(--ps-blue-soft); background-size: 35% 100%, 100% 100%; animation: ps-progress 1.4s ease-in-out infinite; pointer-events: none; }
.ps-brief textarea { border: 0; outline: 0; resize: none; font-size: 15px; line-height: 1.5; min-height: 60px; background: none; }
.ps-scene { display: grid; grid-template-columns: 112px 1fr auto; gap: 14px; padding: 10px; border-radius: 16px; border: 1px solid var(--ps-line); background: #fff; align-items: start; }
.ps-sthumb { aspect-ratio: 9/12; width: 112px; border-radius: 11px; position: relative; overflow: hidden; background: var(--ps-aurora); }
.ps-sthumb .ps-tag { position: absolute; left: 6px; bottom: 6px; }
.ps-sbody { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.ps-sline { border: 1px solid transparent; border-radius: 10px; padding: 7px 9px; background: var(--ps-paper); font-size: 15px; outline: none; width: 100%; resize: none; }
.ps-sline:focus { border-color: var(--ps-blue); background: #fff; }
.ps-preview { border-left: 1px solid var(--ps-line); padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 14px; background: linear-gradient(180deg, #fff, var(--ps-mist)); }
.ps-phone { width: 220px; aspect-ratio: 9/16; border-radius: 30px; padding: 8px; background: #141B3C; box-shadow: 0 30px 60px #141B3C40; flex: none; }
.ps-phone.is-wide { width: 264px; aspect-ratio: 16/9; border-radius: 18px; }
.ps-phonein { position: relative; width: 100%; height: 100%; border-radius: 23px; overflow: hidden; background: var(--ps-aurora); display: grid; place-items: center; }
.ps-phone.is-wide .ps-phonein { border-radius: 12px; }
.ps-phonein video { width: 100%; height: 100%; object-fit: cover; display: block; }
.ps-phonein > span { width: 100%; height: 100%; }
.ps-phonein .ps-grad { position: absolute; inset: 0; background: linear-gradient(transparent 50%, #0009); pointer-events: none; }
.ps-capline { position: absolute; left: 12px; right: 12px; bottom: 54px; text-align: center; color: #fff; font: 600 18px/1.25 var(--ps-deva); text-shadow: 0 2px 8px #0008; }
.ps-capline em { font-style: normal; color: #FFD66B; }
.ps-phonenote { position: absolute; top: 14px; left: 12px; right: 12px; text-align: center; color: #fffc; font-size: 12px; }
.ps-engine { width: 100%; border-radius: 14px; border: 1px solid var(--ps-line); background: #fff; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.ps-engine .ps-seg { flex-wrap: wrap; }

/* ---------- apps ---------- */
.ps-apps { padding: 24px 28px 40px; display: flex; flex-direction: column; gap: 26px; height: 100%; }
.ps-apps > section { flex: none; }
.ps-presets { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.ps .ps-preset { flex: none; width: 150px; text-align: left; }
.ps-preset .ps-camviz { height: 92px; border-radius: 14px; margin-bottom: 6px; }
.ps-preset .ps-camviz i { width: 26px; height: 34px; margin: -17px 0 0 -13px; }
.ps-preset .ps-camviz b { height: 20px; }
.ps-g1 { background: linear-gradient(140deg, #ff9f5a, #c23f6b); }
.ps-g2 { background: linear-gradient(140deg, #1E5BFF, #9B7BFF); }
.ps-g3 { background: linear-gradient(140deg, #19B996, #1E5BFF); }
.ps-g4 { background: linear-gradient(140deg, #F07A2A, #FFD66B); }
.ps-g5 { background: linear-gradient(140deg, #141B3C, #4A5378); }
.ps-g6 { background: linear-gradient(140deg, #9B7BFF, #22C9A6); }

/* ---------- asset to post ---------- */
.ps-post { display: grid; grid-template-columns: 1fr 380px; grid-template-rows: minmax(0, 1fr); height: 100%; min-height: 0; }
.ps-editor { display: flex; flex-direction: column; min-height: 0; padding: 18px 24px; gap: 14px; overflow-y: auto; scrollbar-width: thin; }
.ps-edittools { display: flex; gap: 6px; flex-wrap: wrap; }
.ps .ps-edittools button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 10px; border: 1px solid var(--ps-line); background: #fff; font-size: 12.5px; }
.ps .ps-edittools button:hover:not(:disabled) { border-color: var(--ps-line-2); }
.ps-edittools button:disabled { opacity: .5; cursor: default !important; }
.ps-big { flex: 1 0 min(46vh, 420px); min-height: 0; border-radius: var(--ps-r-panel); background: repeating-conic-gradient(#f1f3fa 0 25%, #fff 0 50%) 0 0 / 22px 22px; position: relative; overflow: hidden; }
.ps-bigmedia { position: absolute; inset: 18px; display: flex; align-items: center; justify-content: center; }
.ps-bigmedia img, .ps-bigmedia video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 12px; box-shadow: 0 20px 50px #141B3C30; display: block; }
.ps-busy { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 99px; background: #fff; box-shadow: 0 10px 30px #141B3C26; font-size: 12.5px; font-weight: 600; }
.ps-change { display: flex; gap: 8px; align-items: center; border: 1px solid var(--ps-line); border-radius: 14px; padding: 6px 6px 6px 14px; background: #fff; }
.ps-change input { flex: 1; border: 0; outline: 0; background: none; min-width: 0; }
.ps-versions { display: flex; gap: 8px; align-items: center; overflow-x: auto; }
.ps .ps-ver { width: 58px; height: 58px; flex: none; border-radius: 11px; position: relative; border: 2px solid transparent; overflow: hidden; background: var(--ps-mist); }
.ps .ps-ver.is-on { border-color: var(--ps-blue); }
.ps-ver > span:first-child, .ps-ver img, .ps-ver video { width: 100%; height: 100%; object-fit: cover; display: block; }
.ps-ver small { position: absolute; bottom: 3px; left: 3px; font-size: 10px; padding: 0 5px; border-radius: 6px; background: #fffd; font-weight: 600; }
.ps-side { border-left: 1px solid var(--ps-line); background: #fff; display: flex; flex-direction: column; min-height: 0; }
.ps-sidein { flex: 1; padding: 18px 20px; display: flex; flex-direction: column; gap: 22px; }
.ps-channels { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.ps .ps-chan { position: relative; display: grid; grid-template-rows: 56px auto auto; align-content: start; gap: 6px; padding: 10px 10px 9px; border-radius: 14px; border: 1px solid var(--ps-line); background: #fff; text-align: left; font-size: 12px; transition: border-color .15s, box-shadow .15s; }
.ps .ps-chan:hover { border-color: var(--ps-line-2); box-shadow: 0 6px 16px -10px #141B3C40; }
.ps .ps-chan.is-on { border-color: var(--ps-blue); box-shadow: 0 0 0 1px var(--ps-blue), 0 8px 18px -12px #1E5BFF80; background: #F7FAFF; }
/* one fixed frame per card; the channel's shape sits centred in it */
.ps-chan-frame { display: grid; place-items: center; height: 56px; border-radius: 10px; background: var(--ps-mist); }
.ps-chan .ps-shape { border-radius: 5px; background: var(--ps-aurora); overflow: hidden; box-shadow: 0 2px 6px -2px #141B3C40; }
.ps-chan-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ps-chan-name b { font-size: 12.5px; font-weight: 600; color: var(--ps-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-chan-logo { flex: none; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; color: #fff; }
.ps-chan-logo svg, .ps-chan-logo img { width: 11px; height: 11px; fill: currentColor; }
.ps-chan-fmt { font-size: 11px; color: var(--ps-ink-3); }
.ps-chan-tick { position: absolute; top: 6px; right: 6px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: #fff; box-shadow: inset 0 0 0 1.5px var(--ps-line-2); color: #fff; }
.ps .ps-chan.is-on .ps-chan-tick { background: var(--ps-blue); box-shadow: none; }
.ps-chan .ps-shape img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ps-caption { border: 1px solid var(--ps-line); border-radius: 14px; overflow: hidden; }
.ps-caption input { width: 100%; border: 0; border-bottom: 1px solid var(--ps-line); outline: 0; padding: 10px 12px; font-weight: 600; }
.ps-caption textarea { width: 100%; border: 0; outline: 0; padding: 12px; min-height: 108px; resize: vertical; font-size: 15px; line-height: 1.6; display: block; }
.ps-caption .ps-tags { border-top: 1px solid var(--ps-line); border-bottom: 0; font-weight: 500; color: var(--ps-blue); }
.ps-capbar { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--ps-line); background: var(--ps-paper); flex-wrap: wrap; }
.ps-check { display: flex; flex-direction: column; border: 1px solid var(--ps-line); border-radius: 14px; overflow: hidden; }
.ps-chk { display: grid; grid-template-columns: 20px 1fr auto; gap: 8px; padding: 10px 12px; align-items: start; font-size: 13px; border-top: 1px solid var(--ps-line); }
.ps-chk:first-child { border-top: 0; }
.ps-chk.is-flag { background: var(--ps-saffron-soft); }
.ps-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ps-when { display: flex; gap: 8px; }
.ps-when-f { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px; border: 1px solid var(--ps-line); border-radius: 12px; background: #fff; color: var(--ps-ink-3); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.ps-when-f:hover { border-color: var(--ps-line-2); }
.ps-when-f:focus-within { border-color: var(--ps-blue); box-shadow: 0 0 0 3px var(--ps-blue-soft); color: var(--ps-blue); }
.ps-when-f svg { flex: none; }
.ps-when-f input { flex: 1; min-width: 0; border: 0; padding: 0; background: transparent; font: inherit; font-weight: 600; color: var(--ps-ink); outline: 0; }
/* the whole field opens the picker; the browser's own icon sits invisibly over it */
.ps-when-f input::-webkit-calendar-picker-indicator { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.ps-when-f.is-off { background: var(--ps-mist); cursor: default; }
.ps-when-sum { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 9px 12px; border-radius: 12px; background: var(--ps-blue-soft); color: var(--ps-ink); font-size: 13px; }
.ps-when-sum svg { color: var(--ps-blue); flex: none; }
.ps-when-sum span { margin-left: auto; color: var(--ps-ink-2); }
.ps-besttime { font-size: 12.5px; color: var(--ps-ink-2); display: flex; gap: 6px; align-items: center; }
.ps-sent { display: grid; gap: 8px; font-size: 12.5px; }
.ps-ptile { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; column-gap: 10px; row-gap: 8px; align-items: center; padding: 12px; border: 1px solid var(--ps-line); border-radius: var(--ps-r-tile); background: #fff; }
.ps-ptile.is-failed { border-color: #F3C9D2; }
.ps-ptic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--ps-blue-soft); color: var(--ps-blue); }
.is-live .ps-ptic { background: var(--ps-mint-soft); color: #0b7a5c; }
.is-failed .ps-ptic { background: #FDE8EC; color: #B4233F; }
.ps-pthead { display: grid; min-width: 0; line-height: 1.3; }
.ps-pthead b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-pthead .ps-faint { font-size: 12px; }
.ps-ptpill { padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--ps-blue-soft); color: var(--ps-blue); }
.is-live .ps-ptpill { background: var(--ps-mint-soft); color: #0b7a5c; }
.is-failed .ps-ptpill { background: #FDE8EC; color: #B4233F; }
.ps-ptlink, .ps-ptfail { grid-column: 2 / -1; }
.ps-ptlink { display: inline-flex; align-items: center; gap: 5px; justify-self: start; font-weight: 600; color: var(--ps-blue); text-decoration: none; }
.ps-ptlink:hover { text-decoration: underline; }
.ps-ptlink svg { transition: transform .15s; }
.ps-ptlink:hover svg { transform: translateX(2px); }
.ps-ptfail { display: grid; gap: 8px; min-width: 0; }
.ps-ptfail p { margin: 0; color: var(--ps-ink-2); line-height: 1.4; }
.ps-ptfail p b { color: #B4233F; font-weight: 650; }
.ps-ptfail-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ps-ptfail-acts .ps-btn { display: inline-flex; align-items: center; gap: 6px; }
.ps-ptlinkbtn { margin-left: auto; padding: 4px 2px; background: none; border: 0; color: var(--ps-ink-2); font: inherit; font-size: 12px; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.ps-ptlinkbtn:hover { color: var(--ps-ink); }
.ps-ptfail code { padding: 8px 10px; border-radius: 8px; background: var(--ps-mist); color: var(--ps-ink-2); font: 12px/1.45 ui-monospace, monospace; overflow-wrap: anywhere; user-select: all; }
.ps-ptfail code[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .ps-ptlink svg { transition: none; } }
.ps-sidefoot { display: flex; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--ps-line); }
.ps-sidefoot .ps-btn { flex: 1; }
.ps-sidefoot .ps-resched { flex: 0 0 auto; }
.ps-done { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600; color: #0b7a5c; background: var(--ps-mint-soft); border-radius: 12px; }

/* ---------- connections ---------- */
.ps-modalbg { position: fixed; inset: 0; background: #141B3C55; backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 1200; padding: 16px; font: 14px/1.45 var(--ps-body); color: var(--ps-ink); }
.ps-modal { width: min(720px, 100%); max-height: 88vh; background: #fff; border-radius: 24px; box-shadow: 0 40px 80px #141B3C40; display: flex; flex-direction: column; overflow: hidden; }
.ps-modalhead { padding: 22px 24px 14px; display: flex; gap: 12px; align-items: flex-start; }
.ps-modalhead .ps-sp { flex: 1; }
.ps-modalhead p { margin: 4px 0 0; }
.ps-conns { padding: 0 24px 10px; display: flex; flex-direction: column; gap: 10px; }
.ps-conn { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; padding: 12px; border-radius: 16px; border: 1px solid var(--ps-line); }
.ps-conn select { border: 1px solid var(--ps-line); border-radius: 8px; padding: 5px 7px; background: #fff; font-size: 12.5px; max-width: 160px; }
.ps-conn-acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.ps-clogo { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font: 700 15px var(--ps-display); color: #fff; text-transform: uppercase; }
.ps-addmcp { margin: 6px 24px 24px; padding: 14px; border-radius: 16px; background: var(--ps-mist); display: flex; flex-direction: column; gap: 10px; }
.ps-addmcp .ps-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ps-addmcp input, .ps-addmcp select { flex: 1; min-width: 140px; border: 1px solid var(--ps-line); border-radius: 10px; padding: 9px 11px; background: #fff; }
.ps-addmcp select { flex: 0 0 130px; min-width: 0; }

/* ---------- campaign agent (Campaigns page) ---------- */
.cag { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; margin-bottom: 22px; font: 14px/1.45 var(--ps-body); color: var(--ps-ink); }
.cag * { box-sizing: border-box; }
.cag button { font: inherit; cursor: pointer; color: inherit; }
.cag-hero { position: relative; overflow: hidden; border-radius: 22px; border: 1px solid var(--ps-line); background: #fff; padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; isolation: isolate; }
.cag-hero::before { content: ""; position: absolute; inset: -40% -20% auto auto; width: 60%; height: 140%; background: radial-gradient(closest-side, #9B7BFF24, transparent 70%); pointer-events: none; z-index: -1; }
.cag-hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--ps-aurora); }
.cag-head { display: flex; gap: 14px; align-items: flex-start; }
.cag-head h2 { font: 700 24px/1.15 var(--ps-display); margin: 2px 0 4px; letter-spacing: -.01em; color: var(--ps-ink); }
.cag-head p { margin: 0; color: var(--ps-ink-2); max-width: 640px; font-size: 13.5px; line-height: 1.55; }
.cag-box { position: relative; border: 1px solid var(--ps-line); border-radius: 18px; background: #fff; padding: 12px 14px; box-shadow: 0 16px 40px #141B3C14; display: grid; gap: 12px; }
.cag-box.is-running::before { content: ""; position: absolute; top: -1px; left: 18px; right: 18px; height: 3px; border-radius: 0 0 3px 3px; background: linear-gradient(var(--ps-blue), var(--ps-blue)) no-repeat, var(--ps-blue-soft); background-size: 35% 100%, 100% 100%; animation: ps-progress 1.4s ease-in-out infinite; pointer-events: none; }
.cag-box textarea { border: 0; outline: 0; resize: none; font: 15px/1.5 var(--ps-body); min-height: 54px; background: none; color: var(--ps-ink); }
.cag-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cag-row .ps-sp { flex: 1; }
.cag-label { font-size: 12.5px; font-weight: 600; color: var(--ps-ink-2); margin-right: 2px; }
.cag-side { border-radius: 22px; border: 1px solid var(--ps-line); background: #fff; display: flex; flex-direction: column; min-height: 0; max-height: 660px; overflow: hidden; }
.cag-side .ps-agenthead { padding-bottom: 8px; }
.cag-runs { display: flex; flex-direction: column; gap: 4px; }
.cag .ps-chatitem { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 9px 10px; border-radius: 12px; text-align: left; border: 1px solid transparent; width: 100%; background: none; }
.cag .ps-chatitem:hover { background: var(--ps-mist); }
.cag .ps-chatitem.is-on { background: var(--ps-blue-soft); border-color: #cddbff; }

/* ---------- smaller screens ---------- */
@media (max-width: 1440px) {
    .ps-vstudio { grid-template-columns: 1fr 270px; }
    .ps-masonry { columns: 3 180px; }
}
@media (max-width: 1280px) {
    .ps-agent.is-open { position: absolute; right: 0; top: 0; bottom: 0; z-index: 40; box-shadow: -20px 0 50px #141B3C26; }
    .ps-vstudio { grid-template-columns: 1fr; }
    .ps-preview { display: none; }
    .ps-post { grid-template-columns: 1fr 340px; }
    .cag { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
    .ps-frame { grid-template-columns: 1fr; height: auto; min-height: 0; }
    .ps-nav { flex-direction: row; justify-content: space-around; padding: 6px; border-right: 0; border-bottom: 1px solid var(--ps-line); overflow-x: auto; }
    .ps-navbtn { width: auto; min-width: 60px; }
    .ps-navsp { display: none; }
    .ps-topbar { padding: 10px 14px; flex-wrap: wrap; }
    .ps-crumb, #psCrumb { display: none; }
    .ps-stage, .ps-istudio, .ps-vstudio, .ps-post { grid-template-columns: 1fr; height: auto; }
    .ps-screen { overflow: visible; }
    .ps-rail { border-right: 0; border-bottom: 1px solid var(--ps-line); }
    .ps-composer { position: sticky; left: 0; right: 0; margin: 0 14px 14px; bottom: 8px; }
    .ps-canvasbody { padding-bottom: 20px; }
    .ps-results { padding: 6px 14px 0; }
    .ps-setupwrap { padding: 0 14px; }
    .ps-masonry { columns: 2 130px; }
    .ps-canvashead, .ps-board, .ps-apps, .ps-editor { padding-left: 14px; padding-right: 14px; }
    .ps-scene { grid-template-columns: 80px 1fr; }
    .ps-sthumb { width: 80px; }
    .ps-scene > :last-child { grid-column: 1 / -1; }
    .ps-big { min-height: 60vh; }
    .ps-agent.is-open { position: fixed; inset: 0; width: 100%; z-index: 1100; }
    .ps-agentin { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .ps *, .ps *::before, .ps *::after, .cag *, .cag *::before { animation: none !important; transition: none !important; }
}

/* ---------- shared with the Library and Autopilot pages ---------- */
.as-orb {
    width: 18px; height: 18px; flex: none; border-radius: 50%; display: inline-block; position: relative;
    background: linear-gradient(125deg, #0071db, #6f5cff 48%, #19b996);
    box-shadow: 0 0 0 3px rgba(111, 92, 255, .14), 0 4px 14px rgba(0, 113, 219, .35);
}
.as-orb::after { content: ""; position: absolute; inset: 22% 30% 46% 22%; border-radius: 50%; background: rgba(255, 255, 255, .55); filter: blur(1px); }
.as-orb-sm { width: 12px; height: 12px; box-shadow: 0 0 0 2px rgba(111, 92, 255, .14); }
.as-orb-lg { width: 46px; height: 46px; box-shadow: 0 0 0 6px rgba(111, 92, 255, .10), 0 14px 34px rgba(0, 113, 219, .35); }
.as-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); display: inline-block; flex: none; }
.as-dot-running { background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.as-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-soft); border: 1px solid var(--border); }
.as-seg button { border: 0; background: none; padding: 6px 10px; border-radius: 8px; font: 600 12px inherit; color: var(--text-2); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.as-seg button:hover { color: var(--text); }
.as-seg button.is-on { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.lib-card-top .ps-tag { backdrop-filter: blur(6px); }

/* ---------- references, post types, creators (studio-refs.js) ---------- */
.ps .ps-kitlink { margin-top: auto; display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 14px; border: 1px solid var(--ps-line); background: linear-gradient(160deg, #fff, var(--ps-mist)); text-align: left; color: var(--ps-ink-2); }
.ps .ps-kitlink:hover { border-color: var(--ps-line-2); color: var(--ps-ink); }
.ps-kitlink b { display: block; font-size: 13px; color: var(--ps-ink); }
.ps-kitlink small { font-size: 11.5px; color: var(--ps-ink-3); }
.ps .ps-refsbtn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 99px; border: 1px dashed var(--ps-line-2); font-size: 12.5px; font-weight: 600; color: var(--ps-ink); margin-right: 4px; }
.ps .ps-refsbtn:hover { border-style: solid; background: var(--ps-mist); }
.ps-refsbtn b { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--ps-blue); color: #fff; font-size: 11px; display: grid; place-items: center; }
.sr-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.ps-cgo { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.sr-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 4px 0 3px; border-radius: 99px; background: var(--ps-mist); border: 1px solid var(--ps-line); font-size: 12px; }
.sr-chip img, .sr-chip .sr-dot, .sr-chip .sr-sw { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex: none; }
.sr-chip b { font-weight: 600; white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.sr-chip button { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: var(--ps-ink-3); }
.sr-chip button:hover { background: #fff; color: var(--ps-ink); }
.sr-dot { display: grid; place-items: center; background: #fff; color: var(--ps-ink-2); font-style: normal; }
.sr-sw { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; }
.sr-sw u, .sr-bars u { display: block; text-decoration: none; }

.ps-modal.sr-modal { width: min(1060px, 100%); height: min(760px, 88vh); max-height: none; }
.sr-body { display: grid; grid-template-columns: 210px 1fr; height: 100%; min-height: 0; }
.sr-cats { border-right: 1px solid var(--ps-line); padding: 18px 10px; display: flex; flex-direction: column; gap: 2px; background: var(--ps-paper); }
.sr-modal .sr-cats button { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 11px; color: var(--ps-ink-2); text-align: left; font-size: 13.5px; }
.sr-modal .sr-cats button:hover { background: var(--ps-mist); color: var(--ps-ink); }
.sr-modal .sr-cats button.is-on { background: #fff; color: var(--ps-ink); font-weight: 600; box-shadow: 0 1px 3px #141B3C1a, inset 0 0 0 1px var(--ps-line); }
.sr-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.sr-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px 10px; }
.sr-head .ps-sp, .sr-foot .ps-sp, .mg-bar .ps-sp, .mg-askrow .ps-sp { flex: 1; }
.sr-panel { flex: 1; padding: 4px 22px 18px; }
.sr-foot { display: flex; align-items: center; gap: 12px; padding: 12px 22px; border-top: 1px solid var(--ps-line); }
.sr-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.sr-sub { font-size: 13.5px !important; margin: 16px 0 10px !important; display: flex; gap: 8px; align-items: baseline; }
.sr-sub:first-child { margin-top: 2px !important; }
.sr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 14px 12px; }
.sr-grid-wide { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.ps .sr-card { display: flex; flex-direction: column; gap: 6px; text-align: left; position: relative; min-width: 0; }
.sr-card b { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-card small { font-size: 11.5px; color: var(--ps-ink-3); margin-top: -4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sr-art { aspect-ratio: 1; border-radius: 14px; overflow: hidden; position: relative; background: var(--ps-mist); display: grid; place-items: center; box-shadow: inset 0 0 0 1px #141B3C0d; transition: box-shadow .15s, transform .15s; }
.sr-grid-wide .sr-art { aspect-ratio: 16 / 7; }
.sr-art img, .sr-art > span[data-as-media], .sr-art > span[data-as-media] img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sr-card:hover .sr-art { transform: translateY(-1px); box-shadow: 0 8px 20px #141B3C1f; }
.sr-card.is-on .sr-art { box-shadow: 0 0 0 2.5px var(--ps-blue), 0 8px 20px #1E5BFF33; }
.sr-tick { position: absolute; right: 7px; top: 7px; width: 22px; height: 22px; border-radius: 50%; background: var(--ps-blue); color: #fff; display: grid; place-items: center; font-style: normal; }
.sr-noimg { color: var(--ps-ink-3); }
.sr-bars { display: flex; width: 100%; height: 100%; }
.sr-bars u { flex: 1; }
.sr-add .sr-art { border: 1.5px dashed var(--ps-line-2); background: var(--ps-paper); color: var(--ps-ink-3); box-shadow: none; }
.sr-remove { position: absolute; right: 6px; top: 6px; width: 22px; height: 22px; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: 0 2px 6px #141B3C33; }
.sr-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.sr-modal .sr-row { text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--ps-line); display: flex; flex-direction: column; gap: 2px; }
.sr-modal .sr-row small { color: var(--ps-ink-3); font-size: 11.5px; }
.sr-modal .sr-row.is-on { border-color: var(--ps-blue); background: var(--ps-blue-soft); }
.sr-kit { display: flex; flex-direction: column; gap: 16px; max-width: 620px; }
.sr-kit .ps-ctxrow { font-size: 13px; }
.sr-kit .ps-ctxrow select, .sr-kit .ps-ctxrow input { max-width: 280px; width: 280px; padding: 7px 9px; }
.sr-kit .ps-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sr-kit .ps-ctxrow .ps-chips { justify-content: flex-end; }

.sr-avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font: 700 17px var(--ps-display); flex: none; overflow: hidden; position: relative; }
.sr-avatar.is-big { width: 64px; height: 64px; font-size: 26px; }
.sr-art .sr-avatar.is-big { width: 58%; height: 58%; font-size: 30px; box-shadow: 0 10px 24px #141B3C33; }
.sr-avatar.is-photo { background: var(--ps-mist); }
.sr-avatar.is-photo img { width: 100%; height: 100%; object-fit: cover; }
.sr-avatar.is-any { background: var(--ps-mist); color: var(--ps-ink-2); }

.sr-appshead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sr-appshead p { margin-top: 4px !important; }
.ps-apps > .sr-filters { margin: -8px 0 -10px; }
.sr-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 20px 16px; }
.ps .sr-type { display: flex; flex-direction: column; gap: 4px; text-align: left; }
.sr-typeart { aspect-ratio: 4 / 3; border-radius: 16px; overflow: hidden; position: relative; margin-bottom: 6px; background: var(--ps-mist); transition: box-shadow .15s; }
.sr-typeart img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.sr-typeart .ps-tag { position: absolute; left: 9px; top: 9px; display: inline-flex; gap: 4px; align-items: center; }
.sr-type:hover .sr-typeart { box-shadow: 0 14px 30px #141B3C26; }
.sr-type:hover .sr-typeart img { transform: scale(1.04); }
.sr-type b { font-size: 14px; font-family: var(--ps-display); font-weight: 600; }
.sr-type small { font-size: 12.5px; color: var(--ps-ink-2); }
.sr-crsec { display: flex; flex-direction: column; gap: 14px; }
.sr-crhead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.sr-crhead p { margin-top: 2px !important; }
.sr-creators { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.sr-creator { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 18px; border: 1px solid var(--ps-line); background: #fff; }
.sr-creator.is-on { border-color: var(--ps-blue); box-shadow: 0 0 0 3px var(--ps-blue-soft); }
.sr-crtext { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sr-crtext b { font-size: 14px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sr-crtext small { font-size: 12px; color: var(--ps-ink-3); }
.ps .sr-crempty { border-style: dashed; color: var(--ps-ink-2); text-align: left; min-height: 88px; }
.sr-vcreators { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; }
.ps .sr-vcr { flex: none; width: 54px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.sr-vcr small { font-size: 11px; color: var(--ps-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.sr-vcr.is-on .sr-avatar { box-shadow: 0 0 0 2.5px #fff, 0 0 0 4.5px var(--ps-blue); }
.sr-vcr.is-on small { color: var(--ps-ink); font-weight: 600; }

.ps-modal.sr-crform { width: min(640px, 100%); }
.sr-crfields { display: grid; grid-template-columns: 150px 1fr; gap: 18px; padding: 4px 24px 8px; }
.ps .sr-crphoto { aspect-ratio: 3 / 4; border-radius: 16px; border: 1.5px dashed var(--ps-line-2); background: var(--ps-paper); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--ps-ink-3); font-size: 12.5px; overflow: hidden; }
.sr-crphoto img { width: 100%; height: 100%; object-fit: cover; }
.sr-crcol { display: flex; flex-direction: column; gap: 10px; }
.sr-crcol label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--ps-ink-2); }
.sr-crcol input:not([type=checkbox]) { border: 1px solid var(--ps-line-2); border-radius: 10px; padding: 8px 10px; font-weight: 400; color: var(--ps-ink); }
.sr-crcol fieldset { border: 0; padding: 0; margin: 0; display: flex; gap: 14px; align-items: center; font-size: 12.5px; }
.sr-crcol legend { float: left; font-weight: 600; color: var(--ps-ink-2); margin-right: 6px; }
.sr-crcol .sr-check { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; color: var(--ps-ink); }
.sr-consent { display: flex; gap: 10px; align-items: flex-start; margin: 6px 24px 0; padding: 12px; border-radius: 12px; background: var(--ps-saffron-soft); font-size: 12.5px; }
.sr-consent input { margin-top: 2px; }
.sr-crfoot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px 20px; }

/* ---------- Magic Text and area edits (studio-magic.js) ---------- */
.ps-toolsep { width: 1px; align-self: stretch; background: var(--ps-line); margin: 2px 4px; }
.ps .ps-edittools button.is-new { border-color: #9B7BFF66; }
.ps .ps-edittools button.is-on { background: var(--ps-ink); color: #fff; border-color: var(--ps-ink); }
.mg-bar { display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 14px; background: #fff; box-shadow: 0 8px 22px #141B3C1a; border: 1px solid var(--ps-line); flex-wrap: wrap; font-size: 12.5px; }
.mg-bar > span:first-child { display: inline-flex; align-items: center; gap: 8px; padding: 0 8px; }
.mg-bar select { border: 1px solid var(--ps-line); border-radius: 8px; padding: 5px 6px; background: #fff; font-size: 12.5px; }
.ps .mg-ic { min-width: 30px; height: 30px; padding: 0 6px; border-radius: 8px; display: grid; place-items: center; font-size: 12.5px; color: var(--ps-ink-2); }
.ps .mg-ic:hover { background: var(--ps-mist); color: var(--ps-ink); }
.ps .mg-ic.is-on { background: var(--ps-ink); color: #fff; }
.mg-sep { width: 1px; height: 22px; background: var(--ps-line); }
.mg-color { width: 30px; height: 30px; border-radius: 8px; overflow: hidden; display: grid; place-items: center; border: 1px solid var(--ps-line); }
.mg-color input { width: 40px; height: 40px; border: 0; padding: 0; cursor: pointer; }
.mg-align button { padding: 4px 8px !important; }
.mg-stage { position: absolute; z-index: 4; }
.mg-stage.is-area { cursor: crosshair; touch-action: none; }
.mg-layer { position: absolute; line-height: 1.2; outline: 1px dashed #ffffff99; outline-offset: 2px; border-radius: 3px; box-shadow: 0 0 0 1px #141B3C33; }
.mg-layer:hover { outline-color: #fff; }
.mg-layer.is-sel { outline: 2px solid var(--ps-blue); box-shadow: none; }
.mg-text { outline: 0; min-height: 1em; white-space: pre-wrap; word-break: break-word; cursor: text; caret-color: var(--ps-blue); }
.mg-grip { position: absolute; left: -12px; top: -12px; width: 22px; height: 22px; border-radius: 7px; background: var(--ps-blue); color: #fff; display: grid; place-items: center; cursor: grab; opacity: 0; transition: opacity .12s; touch-action: none; }
.mg-resize { position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px; border-radius: 3px; background: #fff; border: 2px solid var(--ps-blue); cursor: ew-resize; opacity: 0; touch-action: none; }
.mg-layer:hover .mg-grip, .mg-layer.is-sel .mg-grip, .mg-layer:hover .mg-resize, .mg-layer.is-sel .mg-resize { opacity: 1; }
.mg-stage.is-area:not(.is-adding) { cursor: default; }
.mg-region { position: absolute; border: 2px solid #fff; border-radius: 6px; background: #141B3C33; box-shadow: inset 0 0 0 1px var(--ps-violet), 0 0 0 1px #141B3C55; }
.mg-region[data-mg-box] { cursor: pointer; }
.mg-region.is-sel { border-color: var(--ps-blue); background: #4B6BFF22; }
.mg-region:focus-visible { outline: 2px solid var(--ps-blue); outline-offset: 2px; }
.mg-badge { display: inline-grid; place-items: center; flex: none; min-width: 22px; height: 22px; border-radius: 11px; background: var(--ps-violet); color: #fff; font-size: 12px; font-weight: 700; }
.mg-region .mg-badge { position: absolute; left: -2px; top: -2px; border-radius: 6px 0 6px 0; }
.mg-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mg-item { display: flex; align-items: center; gap: 6px; }
.mg-ask [aria-disabled="true"] { opacity: .5; }
.mg-ask { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.mg-ask input { flex: 1; min-width: 0; border: 1px solid var(--ps-line-2); border-radius: 10px; padding: 9px 11px; outline: 0; }
.mg-ask input:focus { border-color: var(--ps-blue); }
.mg-ideas { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.mg-askrow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

@media (max-width: 900px) {
    .sr-body { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
    .sr-cats { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--ps-line); padding: 10px; }
    .sr-modal .sr-cats button { flex: none; }
    .sr-crfields { grid-template-columns: 1fr; }
    .ps .sr-crphoto { width: 140px; }
}

/* ---------- voices and caption styles (studio-voice.js) ---------- */
.sv-group { display: flex; flex-direction: column; gap: 6px; }
.sv-group > .ps-faint { margin-top: 2px; }
.sv-row { display: flex; align-items: center; gap: 4px; }
.sv-row .ps-voice { flex: 1; min-width: 0; }
.sv-row .ps-voice b, .sv-row .ps-voice .ps-faint { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps .sv-clonebtn { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1.5px dashed var(--ps-line-2); text-align: left; color: var(--ps-ink-2); }
.ps .sv-clonebtn:hover { border-style: solid; background: var(--ps-mist); color: var(--ps-ink); }
.sv-clonebtn b { display: block; color: var(--ps-ink); font-size: 13px; }
.sv-clonebtn small { font-size: 11.5px; color: var(--ps-ink-3); }

.sv-capfield { display: flex; flex-direction: column; gap: 10px; padding: 4px 0 2px; }
.sv-caps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ps .sv-cap { display: flex; flex-direction: column; gap: 4px; text-align: left; min-width: 0; }
.sv-cap b { font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sv-capart { aspect-ratio: 16 / 10; border-radius: 10px; display: grid; place-items: center; overflow: hidden; padding: 4px;
    background: linear-gradient(160deg, #3a4a6b, #1b2238 60%, #4a2f2a); box-shadow: inset 0 0 0 1px #141B3C14; }
.sv-cap.is-on .sv-capart { box-shadow: 0 0 0 2.5px var(--ps-blue); }
.sv-capline { font: 700 13px/1.25 var(--ps-deva); color: #fff; text-align: center; }
.sv-capline em { font-style: normal; }
.sv-cap-classic { text-shadow: -1px -1px 0 #141B3C, 1px -1px 0 #141B3C, -1px 1px 0 #141B3C, 1px 1px 0 #141B3C, 0 2px 4px #0008; }
.sv-cap-bold { color: #FFC233; font-size: 16px; font-weight: 800; text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000, 0 3px 0 #000; }
.sv-cap-karaoke { text-shadow: -1px -1px 0 #141B3C, 1px -1px 0 #141B3C, -1px 1px 0 #141B3C, 1px 1px 0 #141B3C; }
.sv-cap-karaoke em { color: #FFC233; }
.sv-cap-social { font-weight: 800; font-size: 15px; text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000, 0 3px 6px #000a; }
.sv-cap-social em { color: #FFD600; display: inline-block; transform: scale(1.08); }
.sv-phonecap .sv-cap-social { font-size: 22px; }
.ps .sv-postvoice { gap: 8px; }
.ps .sv-postvoices { max-height: 240px; overflow-y: auto; }
.sv-cap-boxed { background: #000000b3; padding: 2px 7px; border-radius: 4px; }
.sv-cap-minimal { font-weight: 500; font-size: 11.5px; text-shadow: 0 1px 4px #000c; }
.sv-cap-banner { background: var(--ps-blue); padding: 3px 9px; border-radius: 3px; }
.sv-phonecap { position: absolute; left: 12px; right: 12px; display: flex; justify-content: center; pointer-events: none; }
.sv-phonecap.sv-dragcap { pointer-events: auto; cursor: grab; touch-action: none; user-select: none; }
.sv-phonecap.sv-dragcap:active { cursor: grabbing; }
.sv-phonecap.sv-dragcap .sv-capline { transform: scale(calc(var(--cap-scale, 1) * var(--cap-sx, 1)), calc(var(--cap-scale, 1) * var(--cap-sy, 1))); outline: 1px dashed #ffffff66; outline-offset: 4px; }
.sv-phonecap.is-custom { transform: translateY(-50%); }
.sv-phonecap.is-bottom { bottom: 54px; }
.sv-phonecap.is-middle { top: 50%; transform: translateY(-50%); }
.sv-phonecap.is-top { top: 44px; }
.sv-phonecap .sv-capline { font-size: 17px; }
.sv-phonecap .sv-cap-bold { font-size: 21px; }
.sv-phonecap .sv-cap-minimal { font-size: 14px; }

.ps-modal.sv-modal { width: min(760px, 100%); }
.sv-cols { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; padding: 4px 24px 8px; }
.sv-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.sv-label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--ps-ink-2); }
.sv-label .ps-seg { align-self: flex-start; }
.sv-label input { border: 1px solid var(--ps-line-2); border-radius: 10px; padding: 8px 10px; font-weight: 400; color: var(--ps-ink); }
.sv-read { border-radius: 14px; background: var(--ps-mist); padding: 12px; }
.sv-read p { margin: 6px 0 0; font-size: 14.5px; line-height: 1.6; }
.sv-recorder { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 16px; border: 1px solid var(--ps-line); }
.sv-recorder.is-rec { border-color: var(--ps-rose); background: #E0435F0d; }
.ps .sv-recbtn { width: 58px; height: 58px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--ps-rose); color: #fff; box-shadow: 0 8px 20px #E0435F55; }
.sv-recorder.is-rec .sv-recbtn { animation: sv-pulse 1.4s ease-in-out infinite; }
.sv-stop { width: 18px; height: 18px; border-radius: 4px; background: #fff; display: block; }
@keyframes sv-pulse { 50% { box-shadow: 0 0 0 10px #E0435F22; } }
.sv-meter { height: 6px; border-radius: 99px; background: var(--ps-mist); overflow: hidden; }
.sv-meter i { display: block; height: 100%; background: var(--ps-aurora); transition: width .4s; }
.sv-clips { display: flex; flex-direction: column; gap: 6px; }
.sv-clip { display: flex; align-items: center; gap: 4px; }
.sv-clip audio { flex: 1; min-width: 0; height: 34px; }
.sv-modal .sr-consent { margin-top: 8px; }

@media (max-width: 900px) {
    .sv-cols { grid-template-columns: 1fr; }
}
.sv-capart .sv-capline { white-space: nowrap; }

/* the Voice screen */
.sv-page { padding: 24px 28px 40px; display: flex; flex-direction: column; gap: 26px; height: 100%; }
.sv-page > * { flex: none; }
.sv-pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sv-pagehead p { margin-top: 4px !important; }
.sv-try { border-radius: var(--ps-r-panel); padding: 18px 20px; background: linear-gradient(135deg, #fff, var(--ps-mist)); border: 1px solid var(--ps-line); display: flex; flex-direction: column; gap: 10px; }
.sv-tryhead { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.sv-try textarea { width: 100%; border: 1px solid var(--ps-line-2); border-radius: 14px; padding: 12px 14px; font-size: 16px; line-height: 1.5; resize: vertical; background: #fff; outline: 0; }
.sv-try textarea:focus { border-color: var(--ps-blue); }
.sv-note { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--ps-saffron-soft); font-size: 13px; }
.sv-section { display: flex; flex-direction: column; gap: 12px; }
.sv-section p { margin-top: 2px !important; }
.sv-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.sv-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; border: 1px solid var(--ps-line); background: #fff; min-width: 0; }
.sv-card.is-on { border-color: var(--ps-blue); box-shadow: 0 0 0 3px var(--ps-blue-soft); }
.sv-avatar { width: 44px; height: 44px; border-radius: 14px; flex: none; display: grid; place-items: center; color: #fff; }
.sv-cardtext { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sv-cardtext b { font-size: 14px; }
.sv-cardtext small { font-size: 12px; color: var(--ps-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }


.sv-cardacts { display: flex; align-items: center; gap: 4px; flex: none; }
.ps .sv-cardempty { border-style: dashed; color: var(--ps-ink-2); text-align: left; min-height: 72px; }
.sv-cardempty b { display: block; color: var(--ps-ink); }
.sv-cardempty small { font-size: 12px; color: var(--ps-ink-3); }
@media (max-width: 900px) {
    .sv-page { padding: 18px 14px 30px; }
    .sv-cards { grid-template-columns: 1fr; }
}
.sv-providers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 24px 6px; }
.ps .sv-provider { text-align: left; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--ps-line); display: flex; flex-direction: column; gap: 2px; }
.ps .sv-provider.is-on { border-color: var(--ps-blue); background: var(--ps-blue-soft); }
.sv-provider small { font-size: 11.5px; color: var(--ps-ink-3); }
.sv-consentclip { border-top: 1px solid var(--ps-line); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.sv-statement { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--ps-mist); font-size: 14px; line-height: 1.55; }
.ps .sv-recbtn:disabled { opacity: .4; box-shadow: none; }
.sv-consentclip .sv-recorder { padding: 10px; }
.sv-consentclip .sv-recbtn { width: 46px; height: 46px; }

/* Video settings as sections; the one box that makes, changes or steers */
.ps-vsec { border-radius: 16px; border: 1px solid var(--ps-line); background: #fff; flex: none; }
.ps-vsec.is-open { border-color: var(--ps-line-2); box-shadow: 0 8px 22px #141B3C0f; }
.ps .ps-vsechead { width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px 14px; text-align: left; color: var(--ps-ink-3); }
.ps-vsechead > span { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ps-vsechead b { color: var(--ps-ink); font-size: 14px; font-family: var(--ps-display); font-weight: 600; }
.ps-vsechead small { font-size: 12px; color: var(--ps-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-vsechead svg { transition: transform .15s; flex: none; }
.ps-vsec.is-open .ps-vsechead svg { transform: rotate(180deg); }
.ps-vsec.is-open .ps-vsechead small { display: none; }
.ps-vsecbody { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 16px; }
.ps-boardhead { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.ps-vpick { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.ps .ps-vpick button { flex: none; width: 64px; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.ps-vpick span { width: 64px; height: 84px; border-radius: 10px; overflow: hidden; background: var(--ps-aurora); display: block; box-shadow: inset 0 0 0 1px #141B3C14; }
.ps-vpick video, .ps-vpick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ps-vpick small { font-size: 11px; color: var(--ps-ink-3); }
.ps-vpick button.is-on span { box-shadow: 0 0 0 2.5px var(--ps-blue); }
.ps-vpick button.is-on small { color: var(--ps-ink); font-weight: 600; }
.ps-briefmode { align-self: flex-start; margin-bottom: 2px; }
.ps-intent { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--ps-ink-2); padding: 6px 10px; border-radius: 10px; background: var(--ps-mist); margin-bottom: 8px; }
.ps-intent.is-steer { background: none; padding: 0 2px; flex-wrap: nowrap; color: var(--ps-ink-2); }
.ps-intent > span:not(.ps-orb) { flex: 1; min-width: 0; }
.ps-intent.is-steer > span:not(.ps-orb) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-intent.is-steer b { color: var(--ps-ink); font-weight: 600; }
.ps-intent.is-steer button { flex: none; }
.ps-intent .ps-faint { text-decoration: underline; text-underline-offset: 2px; }
.ps .ps-addscene { align-self: stretch; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; border-radius: 14px; border: 1.5px dashed var(--ps-line-2); color: var(--ps-ink); font-weight: 600; font-size: 13px; }
.ps .ps-addscene:hover { border-style: solid; background: var(--ps-mist); }
.sv-trybtns { display: flex; gap: 6px; align-items: center; }
.sv-takes { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--ps-line); padding-top: 10px; margin-top: 4px; }
.sv-take { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 12px; }
.sv-take:hover, .sv-take.is-playing { background: #fff; box-shadow: inset 0 0 0 1px var(--ps-line); }
.sv-taketext { flex: 1; min-width: 0; display: flex; gap: 8px; align-items: baseline; }
.sv-taketext b { flex: none; font-size: 13px; }
.sv-taketext span { font-size: 13.5px; color: var(--ps-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sv-take time { flex: none; font-size: 12px; }

/* ---------- step 1: the reference comes first ---------- */
/* a small mark on tools that start from a reference; a tick once it's chosen */
.ps-needmark { margin-left: auto; width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; background: var(--ps-mist); color: var(--ps-ink-3); flex: none; }
.ps-needmark.is-ready { background: #E5F5EE; color: #12855F; }
.ps-tool.is-on .ps-needmark { background: var(--ps-blue-soft); color: var(--ps-blue); }
.ps-tool.is-on .ps-needmark.is-ready { background: #E5F5EE; color: #12855F; }

.ps-setupwrap { padding: 0 24px; }
.ps-setupwrap:empty { display: none; }
.ps-setup {
    position: relative; margin: 6px 0 10px; padding: 20px 22px 22px; border-radius: 20px;
    background: radial-gradient(70% 120% at 100% 0%, #9B7BFF1a, transparent 60%), radial-gradient(60% 100% at 0% 100%, #1E5BFF14, transparent 60%), #fff;
    border: 1px solid var(--ps-line); box-shadow: 0 16px 40px -24px #141B3C40;
}
.ps-setup h2 { font-size: 20px; margin: 10px 0 2px; }
.ps-setup > p { margin: 0 0 14px; color: var(--ps-ink-2); font-size: 13.5px; max-width: 560px; }
.ps .ps-setupsteps { display: flex; flex-direction: row; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.ps .ps-setupsteps li { flex: none; width: auto; display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px 4px 4px; border-radius: 999px; background: var(--ps-mist); color: var(--ps-ink-3); font-size: 12px; font-weight: 600; }
.ps-setupsteps li i { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 11px; font-weight: 800; background: #fff; color: var(--ps-ink-3); box-shadow: inset 0 0 0 1px var(--ps-line); }
.ps-setupsteps li.is-on { background: var(--ps-blue-soft); color: var(--ps-blue); }
.ps-setupsteps li.is-on i { background: var(--ps-blue); color: #fff; box-shadow: none; }

.ps .ps-drop {
    width: 100%; display: grid; justify-items: center; gap: 6px; padding: 26px 16px; border-radius: 16px;
    border: 2px dashed #C9D4F2; background: #F7F9FF; color: var(--ps-ink); text-align: center;
    transition: border-color .15s, background .15s, transform .15s;
}
.ps .ps-drop:hover, .ps .ps-drop.is-over { border-color: var(--ps-blue); background: var(--ps-blue-soft); }
.ps .ps-drop.is-over { transform: scale(1.01); }
.ps-drop-ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: #fff; color: var(--ps-blue); box-shadow: 0 8px 20px -10px #1E5BFF80; margin-bottom: 4px; }
.ps-drop b { font-size: 14px; }
.ps-drop small { color: var(--ps-ink-3); font-size: 12px; }

.ps-setup-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.ps .ps-setup-card { display: grid; gap: 6px; padding: 0; text-align: left; background: none; }
.ps-setup-art { position: relative; display: block; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--ps-mist); box-shadow: inset 0 0 0 1px var(--ps-line); transition: box-shadow .15s, transform .15s; }
.ps-setup-art > span { display: block; width: 100%; height: 100%; }
.ps-setup-art img, .ps-setup-art video { width: 100%; height: 100%; object-fit: cover; display: block; }
.ps-setup-card:hover .ps-setup-art { transform: translateY(-2px); box-shadow: 0 0 0 2px var(--ps-blue), 0 10px 22px -12px #1E5BFF80; }
.ps-setup-card.is-on .ps-setup-art { box-shadow: 0 0 0 3px var(--ps-blue); }
.ps-setup-art i { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--ps-blue); color: #fff; }
.ps-setup-card b { font-size: 12px; font-weight: 600; color: var(--ps-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps .ps-setup-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; padding: 6px 10px; border-radius: 9px; font-size: 12.5px; font-weight: 600; color: var(--ps-blue); }
.ps .ps-setup-link:hover { background: var(--ps-blue-soft); }
.ps-setup-empty { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px; border-radius: 14px; background: var(--ps-mist); }
.ps-setup-empty p { margin: 0; flex: 1; min-width: 220px; color: var(--ps-ink-2); font-size: 13px; }

/* once chosen: one slim strip, with a way to change it */
.ps-setup.is-done { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 4px 0 8px; border-radius: 14px; background: #F3FBF7; border-color: #CDEBDD; box-shadow: none; }
.ps-setup-ok { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #12855F; color: #fff; flex: none; }
.ps-setup-picked { display: flex; gap: 4px; flex: none; }
.ps-setup-thumb { width: 36px; height: 36px; border-radius: 9px; overflow: hidden; display: block; background: var(--ps-mist); box-shadow: 0 0 0 2px #fff; }
.ps-setup-thumb > span, .ps-setup-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ps-setup-txt { flex: 1; min-width: 0; font-size: 13px; color: var(--ps-ink-2); }
.ps-setup-txt b { color: var(--ps-ink); }
.ps .ps-setup-change { padding: 6px 11px; border-radius: 9px; font-size: 12.5px; font-weight: 600; color: var(--ps-ink-2); background: #fff; box-shadow: inset 0 0 0 1px var(--ps-line); }
.ps .ps-setup-change:hover { color: var(--ps-ink); box-shadow: inset 0 0 0 1px var(--ps-ink-3); }

/* the prompt waits for step 1 */
.ps-composer.is-locked { background: var(--ps-paper); }
.ps-composer.is-locked .ps-prompt { cursor: not-allowed; }
.ps-composer.is-locked .ps-prompt::placeholder { color: var(--ps-blue); font-weight: 600; }

/* ---------- the agent, folded into a side toolbar ---------- */
.ps-stage { grid-template-columns: 1fr auto auto; }
.ps-agentrail {
    width: 60px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 0 12px;
    border-left: 1px solid var(--ps-line); background: #fff;
}
.ps-agentrail.is-hidden { display: none; }
.ps .ps-railopen { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 52px; padding: 6px 0 7px; border-radius: 14px; background: none; color: var(--ps-ink-2); }
.ps .ps-railopen:hover { background: var(--ps-mist); color: var(--ps-ink); }
.ps-railorb {
    position: relative; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
    background: linear-gradient(135deg, #1E5BFF, #9B7BFF 60%, #22C9A6);
    box-shadow: 0 6px 14px -8px #1E5BFFb3;
}
.ps-railorb::before {
    content: ""; width: 16px; height: 16px; background: #fff;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* ready: a calm green dot; working: a soft ring turning round the icon; picks waiting: a count */
.ps-railorb::after {
    content: ""; position: absolute; right: -2px; bottom: -2px; width: 9px; height: 9px; border-radius: 50%;
    background: #22C9A6; box-shadow: 0 0 0 2px #fff;
}
.ps-agentrail.is-busy .ps-railorb::after, .ps-agentrail.is-waiting .ps-railorb::after { display: none; }
.ps-agentrail.is-busy .ps-railorb { box-shadow: 0 0 0 2px #fff, 0 0 0 4px transparent; }
.ps-agentrail.is-busy .ps-railorb > .ps-railbadge { display: none; }
.ps-agentrail.is-busy .ps-railopen::before {
    content: ""; position: absolute; top: 2px; left: 50%; width: 42px; height: 42px; margin-left: -21px; border-radius: 15px;
    background: conic-gradient(from 0deg, #1E5BFF00, #1E5BFF 30%, #9B7BFF 55%, #1E5BFF00 70%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
            mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
    padding: 2px; animation: ps-spin 1.6s linear infinite;
}
.ps-railbadge {
    position: absolute; top: -6px; right: -7px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    display: grid; place-items: center; font: 700 10.5px/1 var(--ps-body, inherit); color: #fff;
    background: var(--ps-blue); box-shadow: 0 0 0 2px #fff;
}
.ps-raillabel { font-size: 11px; font-weight: 600; letter-spacing: .01em; line-height: 1.1; text-align: center; white-space: nowrap; }
.ps-agentrail.is-busy .ps-raillabel { color: var(--ps-blue); }
.ps-agentrail.is-waiting .ps-raillabel { color: var(--ps-blue); }
.ps-raildiv { width: 28px; height: 1px; margin: 4px 0; background: var(--ps-line); }
.ps-railsp { flex: 1; }
.ps .ps-railbtn { position: relative; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--ps-ink-3); background: none; }
.ps .ps-railbtn:hover { background: var(--ps-mist); color: var(--ps-ink); }
.ps .ps-railbtn.is-picks { color: var(--ps-blue); background: var(--ps-blue-soft); }
.ps .ps-railbtn.is-picks:hover { background: #dbe6ff; }
.ps .ps-railbtn[hidden] { display: none; }
.ps .ps-railopen:focus-visible, .ps .ps-railbtn:focus-visible { outline: 2px solid var(--ps-blue); outline-offset: 2px; }
/* tooltips to the left of the rail, on hover or keyboard focus */
.ps-agentrail [data-tip]::after {
    content: attr(data-tip); position: absolute; right: calc(100% + 10px); top: 50%; transform: translate(4px, -50%);
    padding: 6px 9px; border-radius: 8px; background: var(--ps-ink); color: #fff; font-size: 12px; font-weight: 500;
    white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s, transform .12s; z-index: 50;
}
.ps-agentrail .ps-railopen[data-tip]::after { top: 24px; }
.ps-agentrail [data-tip]:hover::after, .ps-agentrail [data-tip]:focus-visible::after { opacity: 1; transform: translate(0, -50%); }
.ps-foldbtn svg { transition: transform .2s; }
@media (max-width: 820px) {
    .ps-agentrail { position: absolute; right: 10px; bottom: 120px; width: auto; padding: 6px; border: 1px solid var(--ps-line); border-radius: 18px; z-index: 30; box-shadow: 0 12px 30px -14px #141B3C59; }
    .ps-raillabel, .ps-raildiv, .ps-railsp, .ps-railbtn { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
    .ps-agentrail.is-busy .ps-railopen::before { animation: none; }
}
}

/* video: the product and mascot kept in every scene, and the 3-reference counter */
.ps-keeprow { display: flex; flex-wrap: wrap; gap: 8px; }
.ps .ps-keepslot { aspect-ratio: auto; width: 96px; height: 96px; flex: none; display: grid; place-items: center; align-content: center; gap: 4px; text-align: center; font-size: 11.5px; position: relative; overflow: hidden; }
.ps .ps-keepslot > span[data-as-media] { position: absolute; inset: 0; }
.ps .ps-keepslot > span[data-as-media] img { width: 100%; height: 100%; object-fit: cover; }
.ps .ps-keepslot .ps-tag { position: absolute; left: 6px; right: auto; top: auto; bottom: 6px; z-index: 1; max-width: calc(100% - 12px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps .ps-keepslot.is-on { box-shadow: 0 0 0 3px var(--ps-blue); }
.ps .ps-keepslot.is-static { cursor: default; color: var(--ps-ink-3); }
.ps-refcount { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--ps-ink-2); }
.ps-refcount.is-over { color: #B4232F; font-weight: 600; }

/* ---------- campaign board: what the open campaign made, piece by piece ---------- */
.cag-board:empty { display: none; }
.cag-board { display: grid; gap: 14px; padding-top: 6px; border-top: 1px dashed var(--ps-line); }
.cag-boardhead { display: flex; align-items: flex-start; gap: 12px; }
.cag-boardhead > div { flex: 1; min-width: 0; }
.cag-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ps-blue); }
.cag-boardhead h2 { font: 700 18px/1.3 var(--ps-display); margin: 2px 0 0; color: var(--ps-ink); }
.cag-stepper { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.cag-stepper li { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--ps-mist); color: var(--ps-ink-3); font-size: 12px; font-weight: 600; }
.cag-stepper li i { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 11px; font-weight: 800; background: #fff; box-shadow: inset 0 0 0 1px var(--ps-line); }
.cag-stepper li.is-done { color: #12855F; background: #E5F5EE; }
.cag-stepper li.is-done i { background: #12855F; color: #fff; box-shadow: none; }
.cag-stepper li.is-on { color: var(--ps-blue); background: var(--ps-blue-soft); }
.cag-stepper li.is-on i { background: var(--ps-blue); color: #fff; box-shadow: none; }
.cag-stepper li.is-fail { color: #B4232F; background: #FDECEE; }
.cag-stage { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13.5px; color: var(--ps-ink-2); }
.cag-stage.is-fail { color: #B4232F; }
.cag-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; align-items: start; }
.cag-card { display: grid; align-content: start; gap: 6px; padding: 12px; border-radius: 16px; border: 1px solid var(--ps-line); background: #fff; }
.cag-card header { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cag-kind, .cag-chan { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.cag-kind { background: var(--ps-blue-soft); color: var(--ps-blue); }
.cag-chan { background: var(--ps-mist); color: var(--ps-ink-2); }
.cag-card h3 { font: 600 14px/1.35 var(--ps-body); margin: 2px 0 0; color: var(--ps-ink); }
.cag-line { margin: 0; font-size: 12.5px; color: var(--ps-ink-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cag-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 4px; }
.cag-tiles.is-video { grid-template-columns: minmax(0, 160px); }
.cag-tile { position: relative; margin: 0; display: grid; gap: 6px; }
.cag-tiles:has(> .cag-tile:only-child):not(.is-video) { grid-template-columns: minmax(0, 220px); }
.ps .cag-media, .cag-media { position: relative; display: block; width: 100%; aspect-ratio: 4 / 5; padding: 0; border-radius: 12px; overflow: hidden; background: var(--ps-mist); box-shadow: inset 0 0 0 1px var(--ps-line); cursor: pointer; transition: box-shadow .15s, transform .15s; }
.cag-tiles.is-video .cag-media { aspect-ratio: 9 / 16; }
.cag-media > span[data-as-media] { position: absolute; inset: 0; }
.cag-media img, .cag-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cag-media:hover { transform: translateY(-2px); box-shadow: 0 0 0 2px var(--ps-blue), 0 10px 22px -12px #1E5BFF80; }
.cag-tile.is-picked .cag-media { box-shadow: 0 0 0 3px var(--ps-blue); }
.cag-keep { position: absolute; top: 7px; right: 7px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: #ffffffe0; color: #fff; box-shadow: inset 0 0 0 1.5px var(--ps-ink-3); }
.cag-tile.is-picked .cag-keep { background: var(--ps-blue); box-shadow: none; }
.cag-badges { position: absolute; left: 7px; bottom: 7px; display: flex; gap: 4px; align-items: center; }
.cag-badge { padding: 2px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 700; background: #141B3Cc8; color: #fff; }
.cag-badge.is-final { background: #12855F; }
.ps .cag-open, .cag-open { justify-content: center; width: 100%; }
.cag-tile.is-pending { aspect-ratio: 4 / 5; border-radius: 12px; overflow: hidden; background: linear-gradient(110deg, var(--ps-mist) 30%, #ffffff 50%, var(--ps-mist) 70%); background-size: 200% 100%; animation: ps-sheen 1.4s linear infinite; }
.cag-tiles.is-video .cag-tile.is-pending { aspect-ratio: 9 / 16; }
.cag-card.is-pending { min-height: 220px; }
.cag-card.is-pending > span { display: block; height: 12px; border-radius: 6px; background: var(--ps-mist); }
.cag-card.is-pending > span:first-child { width: 40%; }
.cag-none { margin: 4px 0; grid-column: 1 / -1; }
.cag-actions { position: sticky; bottom: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 12px; border-radius: 14px; background: #ffffffee; border: 1px solid var(--ps-line); box-shadow: 0 10px 26px -18px #141B3C59; backdrop-filter: blur(6px); }
.cag-actions .ps-sp { flex: 1; }
.cag-price { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 12px; background: var(--ps-mist); font-size: 13px; color: var(--ps-ink-2); margin-bottom: 10px; }
.cag-price b { color: var(--ps-ink); }
@media (prefers-reduced-motion: reduce) { .cag-tile.is-pending { animation: none; } }


/* =========================================================
   CAMPAIGNS: one place to start, one list of everything
   ========================================================= */
/* .cag gives it the Studio controls (pills, toggles, buttons); .cpx is the single-column layout */
.cag.cpx { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-bottom: 26px; font: 14px/1.45 var(--ps-body); color: var(--ps-ink); }
.cpx * { box-sizing: border-box; }
.cpx button { font: inherit; cursor: pointer; color: inherit; }
.cpx .btn-primary { color: #fff; }
.cpx-compose {
    position: relative; overflow: hidden; isolation: isolate; display: grid; gap: 16px;
    padding: 24px 26px 22px; border-radius: 24px; border: 1px solid var(--ps-line);
    background: radial-gradient(60% 120% at 100% 0%, #9B7BFF14, transparent 60%), radial-gradient(50% 90% at 0% 100%, #1E5BFF0d, transparent 60%), #fff;
    box-shadow: 0 18px 44px -28px #141B3C40;
}
.cpx-eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ps-blue); }
.cpx-head h2 { font: 700 24px/1.2 var(--ps-display); margin: 4px 0 0; letter-spacing: -.01em; }
.cpx-label { font-size: 12px; font-weight: 600; color: var(--ps-ink-3); }

/* starting points */
.cpx-starters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cpx-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.cpx .cpx-start { display: grid; gap: 1px; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--ps-line); background: #fff; text-align: left; transition: border-color .15s, background .15s, transform .15s; }
.cpx .cpx-start b { font-size: 13px; font-weight: 600; }
.cpx .cpx-start small { font-size: 11.5px; color: var(--ps-ink-3); }
.cpx .cpx-start:hover { border-color: var(--ps-blue); background: var(--ps-blue-soft); transform: translateY(-1px); }
.cpx .cpx-start.is-festival { border-color: #F6C9A0; background: #FFF6EC; }
.cpx .cpx-start.is-festival b { color: #A4500C; }
.cpx .cpx-start.is-festival.is-soon { box-shadow: 0 0 0 3px #FFE3C4; }

/* the goal box */
.cpx-box { position: relative; display: grid; gap: 14px; padding: 14px 16px; border-radius: 18px; border: 1px solid var(--ps-line); background: #fff; box-shadow: 0 12px 30px -22px #141B3C59; }
.cpx-box:focus-within { border-color: var(--ps-blue); box-shadow: 0 0 0 4px var(--ps-blue-soft); }
.cpx-box.is-running::before { content: ""; position: absolute; top: -1px; left: 18px; right: 18px; height: 3px; border-radius: 0 0 3px 3px; background: linear-gradient(var(--ps-blue), var(--ps-blue)) no-repeat, var(--ps-blue-soft); background-size: 35% 100%, 100% 100%; animation: ps-progress 1.4s ease-in-out infinite; }
.cpx-box textarea { border: 0; outline: 0; resize: vertical; min-height: 70px; font: 15px/1.55 var(--ps-body); color: var(--ps-ink); background: none; }
.cpx-box textarea::placeholder { color: var(--ps-ink-3); }

/* how it runs */
.cpx-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cpx .cpx-mode { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: 14px; border: 1px solid var(--ps-line); background: var(--ps-paper); text-align: left; transition: border-color .15s, background .15s; }
.cpx .cpx-mode i { flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; border: 2px solid var(--ps-line-2, #C9D2EA); }
.cpx .cpx-mode b { display: block; font-size: 13.5px; }
.cpx .cpx-mode small { display: block; margin-top: 2px; font-size: 12px; line-height: 1.45; color: var(--ps-ink-2); }
.cpx .cpx-mode:hover { border-color: var(--ps-blue); }
.cpx .cpx-mode.is-on { border-color: var(--ps-blue); background: var(--ps-blue-soft); }
.cpx .cpx-mode.is-on i { border: 5px solid var(--ps-blue); background: #fff; }

/* ideas, inside the same card */
.cpx-ideas { display: grid; gap: 4px; padding-top: 14px; border-top: 1px dashed var(--ps-line); }
.cpx-ideas-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cpx .cpx-ideas-btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--ps-line); background: #fff; font-size: 13px; font-weight: 600; color: var(--ps-blue); }
.cpx .cpx-ideas-btn svg { width: 15px; height: 15px; }
.cpx .cpx-ideas-btn:hover { background: var(--ps-blue-soft); border-color: var(--ps-blue); }
.cpx .cpx-ideas-btn:disabled { opacity: .6; cursor: wait; }
.cpx-ideas .cpx-label { margin-left: 6px; }

/* the open "made now" campaign */
.cpx-board:empty { display: none; }
.cpx-board { border-top: 0; padding: 22px 24px; border-radius: 24px; border: 1px solid var(--ps-line); background: #fff; box-shadow: 0 18px 44px -28px #141B3C40; }
.cpx-board .cag-boardhead { align-items: center; }
.cag-how { border-radius: 14px; background: var(--ps-paper); border: 1px solid var(--ps-line); padding: 8px 12px; }
.cag-how summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--ps-ink-2); }
.cag-how[open] summary { margin-bottom: 8px; }

/* one list for both kinds */
.cpx-listhead { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 4px 0 12px; }
.cpx-listhead h2 { font: 700 18px/1.2 var(--ps-display); margin: 0 6px 0 0; color: var(--ps-ink); }
#page-campaigns .cmp-chip.is-alert:not(.is-on) { border-color: #F7B9C8; color: #B4234E; }
#page-campaigns .cmp-chip.is-alert small { color: inherit; }
.cmp-kindtag { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; background: #EEF1F8; color: #4A5378; }
.cmp-kindtag.is-now { background: var(--ps-blue-soft); color: var(--ps-blue); }
#page-campaigns .cmp-card { display: grid; align-content: start; gap: 8px; }
#page-campaigns .cmp-card h3 { margin: 0; font-size: 15px; line-height: 1.35; }
#page-campaigns .cmp-card.is-agent { cursor: pointer; }
#page-campaigns .cmp-card.is-open { border-color: var(--ps-blue); box-shadow: 0 0 0 3px var(--ps-blue-soft); }
#page-campaigns .cmp-state { margin-left: auto; }
#page-campaigns .cmp-state.is-needs { color: #B4234E; }
#page-campaigns .cmp-state.is-needs::before { animation: cmp-pulse 2s infinite; }

@media (max-width: 760px) {
    .cpx-modes { grid-template-columns: 1fr; }
    .cpx-compose, .cpx-board { padding: 18px 16px; }
}


/* ---------- the big picture on the Post screen: zoom, pan, fullscreen ---------- */
.ps-big.is-zoomable { outline: none; }
.ps-big.is-zoomable:focus-visible { box-shadow: inset 0 0 0 2px var(--ps-blue); }
.ps-big .ps-bigmedia { transform-origin: center center; transition: transform .12s ease-out; will-change: transform; }
.ps-big.is-zoomed { cursor: grab; touch-action: none; }
.ps-big.is-zoomable .ps-bigmedia img { -webkit-user-drag: none; user-select: none; }
.ps-big.is-panning { cursor: grabbing; }
.ps-big.is-panning .ps-bigmedia { transition: none; }
.ps-big.is-zoomed .ps-bigmedia img { box-shadow: none; border-radius: 0; }
.ps-zoombar {
    position: absolute; right: 14px; bottom: 14px; z-index: 4;
    display: inline-flex; align-items: center; gap: 2px; padding: 4px;
    border-radius: 12px; background: #ffffffeb; border: 1px solid var(--ps-line);
    box-shadow: 0 10px 24px -14px #141B3C80; backdrop-filter: blur(6px);
}
.ps .ps-zoombar button { display: grid; place-items: center; min-width: 32px; height: 32px; padding: 0 6px; border-radius: 9px; border: 0; background: none; color: var(--ps-ink-2); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ps .ps-zoombar button:hover { background: var(--ps-mist); color: var(--ps-ink); }
.ps .ps-zoombar .ps-zoompct { min-width: 50px; }
.ps-zoomsep { width: 1px; height: 18px; margin: 0 3px; background: var(--ps-line); }
/* fullscreen: the picture on a dark stage, the controls still there */
.ps-big:fullscreen { border-radius: 0; background: #0E1222; }
.ps-big:fullscreen .ps-bigmedia { inset: 24px; }
.ps-big:fullscreen .ps-zoombar { right: 24px; bottom: 24px; }
@media (prefers-reduced-motion: reduce) { .ps-big .ps-bigmedia { transition: none; } }


/* ---------- campaign viewer: one draft large, with its copy, check and a decision ---------- */
.cag-viewer { position: fixed; inset: 0; z-index: 260; display: grid; grid-template-columns: minmax(0, 1fr) 380px; background: rgba(10, 14, 30, .86); backdrop-filter: blur(4px); font: 14px/1.5 var(--ps-body); color: var(--ps-ink); animation: cag-viewer-in .18s ease-out; }
.cag-viewer[hidden] { display: none; }
.cag-viewer:focus { outline: none; }
@keyframes cag-viewer-in { from { opacity: 0; } }
.cag-viewer-stage { position: relative; display: grid; place-items: center; padding: 28px 72px; min-height: 0; }
.cag-viewer-media { position: relative; width: 100%; height: calc(100vh - 56px); min-height: 0; }
.cag-viewer-media > span[data-as-media], .cag-viewer-media > * { position: absolute; inset: 0; }
/* fill the stage at the picture's own shape (drafts are small; showing them at pixel size hid the detail) */
.cag-viewer-media img, .cag-viewer-media video { width: 100%; height: 100%; object-fit: contain; display: block; filter: drop-shadow(0 24px 50px rgba(0, 0, 0, .55)); }
.cag-viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 0; background: #ffffff1f; color: #fff; font-size: 30px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.cag-viewer-nav:hover:not(:disabled) { background: #ffffff38; }
.cag-viewer-nav:disabled { opacity: .25; cursor: default; }
.cag-viewer-nav.is-prev { left: 16px; }
.cag-viewer-nav.is-next { right: 16px; }
.cag-viewer-side { display: flex; flex-direction: column; gap: 12px; padding: 20px 22px; background: #fff; overflow-y: auto; }
.cag-viewer-top { display: flex; align-items: center; justify-content: space-between; }
.cag-viewer-count { font-size: 12px; font-weight: 700; color: var(--ps-ink-3); }
.cag-viewer-close { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--ps-line); background: #fff; font-size: 22px; line-height: 1; cursor: pointer; color: var(--ps-ink-2); }
.cag-viewer-close:hover { color: var(--ps-ink); border-color: var(--ps-line-2); }
.cag-viewer-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cag-viewer-tags .cag-badge { background: #141B3C; }
.cag-viewer-tags .cag-badge.is-final { background: #12855F; }
.cag-viewer-side h3 { margin: 0; font: 700 19px/1.3 var(--ps-display); }
.cag-viewer-headline { margin: 0; font-size: 15px; font-weight: 600; color: var(--ps-ink-2); }
.cag-viewer-caption { padding: 10px 12px; border-radius: 12px; background: var(--ps-mist); font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; color: var(--ps-ink); }
.cag-viewer-tagsline { margin: 0; font-size: 12.5px; color: var(--ps-blue); }
.cag-viewer-issues { margin: 0; padding: 10px 12px 10px 28px; border-radius: 12px; background: #FFF6E3; font-size: 12.5px; color: #8A5300; }
.cag-viewer-ok { margin: 0; font-size: 12.5px; font-weight: 600; color: #12855F; }
.cag-viewer-actions { display: grid; gap: 8px; margin-top: auto; padding-top: 8px; }
.cag-viewer .ps-btn { display: inline-flex; align-items: center; justify-content: center; padding: 11px 15px; border-radius: 12px; font: 600 14px var(--ps-body); cursor: pointer; border: 0; }
.cag-viewer .ps-btn-primary { background: var(--ps-blue); color: #fff; }
.cag-viewer .ps-btn-ghost { background: #fff; color: var(--ps-ink); border: 1px solid var(--ps-line-2, #C9D2EA); }
.cag-viewer-keys { margin: 0; font-size: 11.5px; color: var(--ps-ink-3); text-align: center; }

/* the magnifier on each board tile */
.cag .cag-view { position: absolute; top: 7px; left: 7px; width: 28px; height: 28px; border-radius: 9px; border: 0; display: grid; place-items: center; background: #141B3Cb3; color: #fff; opacity: 0; transition: opacity .15s; }
.cag-tile:hover .cag-view, .cag .cag-view:focus-visible { opacity: 1; }
@media (hover: none) { .cag .cag-view { opacity: 1; } }

@media (max-width: 900px) {
    .cag-viewer { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
    .cag-viewer-stage { padding: 16px 52px; }
    .cag-viewer-side { max-height: 45vh; }
}

/* ---------- storyboard first: script and key frames, approved before the render ---------- */
.ps .ps-sb { display: flex; flex-direction: column; gap: 14px; }
.ps .ps-sbhead { display: flex; align-items: flex-start; gap: 16px; justify-content: space-between; flex-wrap: wrap; padding: 16px 18px; border-radius: var(--ps-r-panel); background: #fff; border: 1px solid var(--ps-line); box-shadow: 0 10px 30px -22px rgba(20, 27, 60, .35); }
.ps .ps-sbhead > div { flex: 1; min-width: 220px; }
.ps .ps-sbhead .ps-btn { white-space: nowrap; }
.ps .ps-sbhead h2 { margin: 2px 0 4px; font-family: var(--ps-display); font-size: 20px; line-height: 1.2; color: var(--ps-ink); }
.ps .ps-sbhead p { margin: 0; font-size: 13px; }
.ps .ps-sbhead .ps-btn { flex: none; display: inline-flex; align-items: center; gap: 7px; }
.ps .ps-sbeyebrow { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: var(--ps-aurora); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ps .ps-sbwork { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--ps-blue-soft); color: var(--ps-ink); font-size: 13.5px; font-weight: 600; }
.ps .ps-sbbible { border: 1px solid var(--ps-line); border-radius: 14px; background: var(--ps-paper); padding: 10px 14px; font-size: 13px; }
.ps .ps-sbbible summary { cursor: pointer; font-weight: 600; color: var(--ps-ink-2); }
.ps .ps-sbbible dl { display: grid; gap: 8px; margin: 10px 0 2px; }
.ps .ps-sbbible dl div { display: grid; grid-template-columns: 64px 1fr; gap: 10px; }
.ps .ps-sbbible dt { color: var(--ps-ink-3); font-weight: 600; }
.ps .ps-sbbible dd { margin: 0; color: var(--ps-ink-2); line-height: 1.45; }
.ps .ps-sbscenes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.ps .ps-sbscenes.is-working { opacity: .72; pointer-events: none; }
.ps .ps-sbscene { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 14px; border-radius: 18px; background: #fff; border: 1px solid var(--ps-line); align-items: start; }
.ps .ps-sbframes { display: flex; align-items: center; gap: 8px; justify-content: center; padding: 10px; border-radius: 14px; background: var(--ps-mist); }
.ps .ps-sbarrow { color: var(--ps-ink-3); display: grid; place-items: center; }
.ps .ps-sbframe { margin: 0; flex: 0 1 150px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ps .ps-sbframe.is-wide { flex-basis: 220px; }
.ps .ps-sbimg { position: relative; display: block; width: 100%; aspect-ratio: 9 / 16; padding: 0; border: 1px solid var(--ps-line); border-radius: 12px; overflow: hidden; background: var(--ps-mist); cursor: zoom-in; }
.ps .ps-sbframe.is-wide .ps-sbimg { aspect-ratio: 16 / 9; }
.ps .ps-sbimg > span, .ps .ps-sbimg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.ps .ps-sbimg:hover { border-color: var(--ps-blue); box-shadow: 0 0 0 3px var(--ps-blue-soft); }
.ps .ps-sbimg.is-empty { cursor: default; display: grid; place-items: center; align-content: center; gap: 4px; color: var(--ps-ink-3); font-size: 12px; }
.ps .ps-sbimg.is-pending::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, var(--ps-mist) 30%, #ffffff 50%, var(--ps-mist) 70%); background-size: 200% 100%; animation: ps-sheen 1.4s linear infinite; }
.ps .ps-sbframe figcaption { display: flex; align-items: center; justify-content: space-between; gap: 4px; font-size: 11.5px; color: var(--ps-ink-2); font-weight: 600; min-height: 24px; }
.ps .ps-sbframe figcaption small { color: var(--ps-ink-3); font-weight: 500; }
.ps .ps-sbredo { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--ps-line); background: #fff; color: var(--ps-ink-2); cursor: pointer; }
.ps .ps-sbredo:hover { color: var(--ps-blue); border-color: var(--ps-blue); }
.ps .ps-sbtext { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ps .ps-sbnum { font-family: var(--ps-display); font-weight: 700; font-size: 15px; color: var(--ps-ink); }
.ps .ps-sbnum small { font-family: var(--ps-body); font-weight: 500; font-size: 12px; color: var(--ps-ink-3); margin-left: 6px; }
.ps .ps-sbvisual { margin: 0 0 4px; font-size: 13.5px; line-height: 1.5; color: var(--ps-ink-2); }
.ps .ps-sbtext .ps-sline:disabled { opacity: .7; }
.ps .ps-sbask { display: flex; gap: 6px; margin-top: 4px; }
.ps .ps-sbask input { flex: 1; min-width: 0; border: 1px solid var(--ps-line); border-radius: 10px; padding: 7px 10px; font: inherit; font-size: 13px; background: var(--ps-paper); outline: none; }
.ps .ps-sbask input:focus { border-color: var(--ps-blue); background: #fff; }
.ps .ps-sbrevs { display: flex; flex-direction: column; gap: 4px; padding: 10px 14px; border-radius: 14px; background: var(--ps-mint-soft); }
.ps .ps-sbrevs p { margin: 0; display: flex; gap: 6px; align-items: flex-start; font-size: 12.5px; color: var(--ps-ink-2); }
.ps .ps-sbrevs svg { color: var(--ps-mint); flex: none; margin-top: 2px; }
.ps .ps-sbfoot { margin: 0; text-align: center; }
.ps .ps-sbback { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; background: var(--ps-mist); font-size: 13px; }
.ps .ps-sbback span { flex: 1; }
.ps .ps-sbphone { bottom: 14px; top: auto; }
.ps .ps-phonein > span[data-as-media] img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (min-width: 1680px) {
    .ps .ps-sbscene { grid-template-columns: auto minmax(0, 1fr); gap: 16px; }
}

/* a frame large, stepping through the storyboard */
.ps-sblight { position: fixed; inset: 0; z-index: 1300; background: rgba(10, 14, 32, .9); display: grid; grid-template-rows: minmax(0, 1fr) auto; padding: 24px 24px 18px; outline: none; font-family: var(--ps-body); }
.ps-sblight[hidden] { display: none; }
.ps-sblight-stage { display: grid; grid-template-columns: 52px minmax(0, 1fr) 52px; align-items: center; gap: 12px; min-height: 0; }
.ps-sblight-img { position: relative; height: 100%; min-height: 0; }
.ps-sblight-img > span, .ps-sblight-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.ps-sblight-nav, .ps-sblight-close { width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .1); color: #fff; font-size: 26px; line-height: 1; cursor: pointer; }
.ps-sblight-nav:disabled { opacity: .3; cursor: default; }
.ps-sblight-close { position: absolute; top: 18px; right: 18px; }
.ps-sblight-cap { max-width: 720px; margin: 14px auto 0; text-align: center; color: #fff; }
.ps-sblight-cap small { color: rgba(255, 255, 255, .6); margin-left: 6px; }
.ps-sblight-cap p { margin: 6px 0 0; color: rgba(255, 255, 255, .8); font-size: 14px; line-height: 1.5; }

/* ---------- "Write from": the content pillar and knowledge folders a run draws on ---------- */
.ps .ps-kbctl > button { border-color: var(--ps-line); background: #fff; max-width: 320px; }
.ps .ps-kbctl > button b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ps .ps-kbctl > button.is-set { border-color: #C9D7FF; background: var(--ps-blue-soft); }
.ps .ps-kbctl > button.is-set svg:first-child { color: var(--ps-blue); }
.ps .ps-kbmenu { width: 320px; max-height: 420px; }
.ps .ps-kbsec { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px 4px; }
.ps .ps-kbsec .ps-faint { font-size: 11.5px; line-height: 1.4; }
.ps .ps-kbmenu .ps-kbfolder { align-items: center; }
.ps .ps-kbfolder i { flex: none; width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid var(--ps-line-2); display: grid; place-items: center; color: #fff; }
.ps .ps-kbfolder.is-sel i { background: var(--ps-blue); border-color: var(--ps-blue); }
.ps .ps-kbnone { margin: 2px 10px 6px; font-size: 12px; }
.ps .ps-kbmenu .ps-kbfoot { display: flex; gap: 4px; flex-wrap: wrap; padding: 2px 4px; }
.ps .ps-kbmenu .ps-kbfoot button { width: auto; padding: 5px 8px; font-size: 12px; color: var(--ps-blue); font-weight: 600; }
.ps .ps-kbrow { justify-content: flex-start; }

/* A video in fullscreen shows whole at its own shape (a 9:16 reel on a landscape screen gets black bars),
   never cropped by the cover fit its small preview frame uses. Covers every player in the app. */
video:fullscreen { object-fit: contain !important; background: #000; width: 100%; height: 100%; }
video:-webkit-full-screen { object-fit: contain !important; background: #000; width: 100%; height: 100%; }

/* the storyboard's cast portrait: who appears in every frame and scene */
.ps .ps-sbcast { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px; background: #fff; border: 1px solid var(--ps-line); }
.ps .ps-sbcastimg { flex: none; position: relative; width: 64px; height: 64px; border-radius: 12px; overflow: hidden; background: var(--ps-mist); }
.ps .ps-sbcastimg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ps .ps-sbcast b { display: block; font-size: 13.5px; color: var(--ps-ink); }
.ps .ps-sbcast .ps-faint { font-size: 12px; line-height: 1.4; }
.ps .ps-chan:disabled { cursor: not-allowed; opacity: .65; box-shadow: none; }

/* ---------- swap & transform (a finished video) ---------- */
.ss-panel { border: 1px solid var(--ps-line); border-radius: 14px; background: #fff; overflow: hidden; }
.ps .ss-head { width: 100%; display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: none; border: 0; font-size: 13px; font-weight: 600; text-align: left; cursor: pointer; }
.ss-head .ps-faint { font-weight: 400; font-size: 12px; }
.ss-body { display: flex; flex-direction: column; gap: 10px; padding: 4px 14px 14px; }
.ss-body p { margin: 0; }
.ss-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.ps .ss-tool { padding: 7px 12px; border-radius: 10px; border: 1px solid var(--ps-line); background: #fff; font-size: 12.5px; cursor: pointer; }
.ps .ss-tool.is-on { border-color: var(--ps-blue); color: var(--ps-blue); font-weight: 600; }
.ss-chips { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; }
.ps .ss-chip { flex: none; width: 58px; display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: 0; cursor: pointer; }
.ss-chip small { font-size: 11px; color: var(--ps-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ss-chip.is-on .sr-avatar { box-shadow: 0 0 0 2.5px #fff, 0 0 0 4.5px var(--ps-blue); }
.ss-chip.is-on small { color: var(--ps-ink); font-weight: 600; }
.ss-pics { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ss-pic { position: relative; width: 56px; height: 56px; border-radius: 10px; overflow: hidden; border: 1px solid var(--ps-line); }
.ss-pic img { width: 100%; height: 100%; object-fit: cover; }
.ps .ss-pic button { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; line-height: 1; cursor: pointer; }
.ps .ss-add { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; border: 1.5px dashed var(--ps-line-2); background: none; font-size: 12.5px; cursor: pointer; }
.ss-add:disabled { opacity: .5; cursor: default; }
.ss-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ss-body input[type="text"], .ss-body #ssText { width: 100%; border: 1px solid var(--ps-line); border-radius: 10px; padding: 9px 12px; font: inherit; }

/* ---------- the effects library ---------- */
/* one compact row on the video screen and under a video; the cards live in a gallery on top */
.se-row { display: flex; align-items: center; gap: 12px; padding: 8px; border: 1px solid var(--ps-line); border-radius: 12px; background: #fff; }
.se-thumb { flex: none; width: 44px; height: 62px; border-radius: 8px; overflow: hidden; background: var(--ps-paper); display: grid; place-items: center; color: var(--ps-ink-3); }
.se-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.se-rowtext { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.se-rowtext b { font-size: 13px; }
.se-rowtext span { font-size: 12px; color: var(--ps-ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.se-rowbtns { display: flex; gap: 6px; flex: none; }
.se-empty-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border: 1.5px dashed var(--ps-line-2); border-radius: 12px; }

/* the gallery */
.ps-modal.sp-modal { width: min(860px, 100%); height: min(700px, 90vh); }
.sp-body { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 24px 18px; }
.sp-foot { display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-top: 1px solid var(--ps-line); }
.sp-cell { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sp-manage { display: flex; gap: 4px; align-items: center; }
.ps .sp-manage select { flex: 1; min-width: 0; height: 26px; border: 1px solid var(--ps-line-2); border-radius: 7px; background: #fff; font-size: 12px; padding: 0 4px; }
.ps .sr-card:disabled { opacity: .55; cursor: default; }
.ps-modal.se-modal { width: min(1040px, 100%); height: min(780px, 90vh); max-height: none; }
.se-modal .ps-modalhead { align-items: center; gap: 14px; }
.se-search { width: 220px; max-width: 34%; border: 1px solid var(--ps-line); border-radius: 10px; padding: 8px 12px; font: inherit; font-size: 13px; }
.se-tabs { display: flex; gap: 6px; padding: 4px 24px 12px; overflow-x: auto; scrollbar-width: thin; flex: none; }
.ps .se-tab { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--ps-line); background: #fff; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.ps .se-tab small { color: var(--ps-ink-3); font-size: 11px; }
.ps .se-tab.is-on { background: var(--ps-ink); border-color: var(--ps-ink); color: #fff; }
.ps .se-tab.is-on small { color: #ffffffb0; }
.se-body { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; padding: 6px 24px 18px; align-content: start; }
.ps .se-card { display: flex; flex-direction: column; gap: 6px; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; }
.se-art { position: relative; display: block; aspect-ratio: 9 / 14; border-radius: 14px; overflow: hidden; background: var(--ps-paper); border: 2px solid transparent; transition: transform .15s; }
.se-card:hover .se-art { transform: translateY(-2px); }
.se-card.is-focus .se-art { border-color: var(--ps-ink); }
.se-card.is-on .se-art { border-color: var(--ps-blue); }
.se-art img.se-poster, .se-art video { width: 100%; height: 100%; object-fit: cover; display: block; }
.se-art video { position: absolute; inset: 0; opacity: 0; transition: opacity .15s; }
.se-card.is-playing .se-art video { opacity: 1; }
.se-nopreview { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--ps-ink-3); }
.se-nopreview small { font-size: 11px; }
.se-tick { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border-radius: 50%; background: var(--ps-blue); color: #fff; display: grid; place-items: center; }
.se-card b { font-size: 12.5px; font-weight: 600; padding: 0 2px; }
.se-empty { grid-column: 1 / -1; padding: 40px 0; text-align: center; color: var(--ps-ink-2); font-size: 13.5px; }
.se-detail { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; border-top: 1px solid var(--ps-line); background: var(--ps-paper); min-height: 76px; }
.se-dtext { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.se-dtext b { font-size: 14px; }
.se-dtext span { font-size: 12.5px; color: var(--ps-ink-2); }
.se-dtext small { font-size: 11.5px; color: var(--ps-ink-3); }
.se-dbtns { display: flex; gap: 8px; flex: none; }
.se-prompt { margin: 6px 0 0; padding: 10px 12px; max-height: 120px; overflow: auto; border-radius: 10px; background: #fff; font-size: 12px; line-height: 1.5; color: var(--ps-ink-2); }
@media (max-width: 640px) {
    .se-search { max-width: 100%; width: 100%; order: 3; }
    .se-modal .ps-modalhead { flex-wrap: wrap; position: relative; }
    .se-modal .ps-modalhead [data-se-close] { position: absolute; top: 18px; right: 18px; }
    .se-modal .ps-modalhead .ps-sp { padding-right: 40px; }
    .se-detail { flex-direction: column; align-items: stretch; }
    .se-body { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

/* ---------- swap & transform, prompt first ---------- */
.ss-body textarea#ssText { width: 100%; box-sizing: border-box; border: 1px solid var(--ps-line); border-radius: 12px; padding: 10px 12px; font: inherit; font-size: 13.5px; resize: vertical; min-height: 56px; }
.ss-body textarea#ssText:focus { outline: 2px solid var(--ps-blue); outline-offset: -1px; }
.ss-attach { display: flex; gap: 8px; flex-wrap: wrap; }
.ps .ss-add { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; border: 1.5px dashed var(--ps-line-2); background: none; font-size: 12.5px; cursor: pointer; }
.ss-add small { color: var(--ps-ink-3); font-size: 11px; }
.ps .ss-add.is-on { border-style: solid; border-color: var(--ps-blue); color: var(--ps-blue); }
.ss-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.ps .ss-qchip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--ps-line); background: #fff; font-size: 12.5px; cursor: pointer; }
.ps .ss-qchip:hover:not(:disabled) { border-color: var(--ps-line-2); }
.ps .ss-qchip.is-on { background: var(--ps-ink); border-color: var(--ps-ink); color: #fff; }
.ps .ss-qchip.ss-more { border-style: dashed; color: var(--ps-ink-2); }
.ps .ss-link { background: none; border: 0; padding: 0; color: var(--ps-blue); font-size: 12px; cursor: pointer; }
.ss-actions { border-top: 1px solid var(--ps-line); padding-top: 12px; }

/* ---------- genjutsu: modes, before/after examples, numbered steps ---------- */
.gj .ss-body { gap: 12px; }
.gj-modes { display: flex; gap: 4px; padding: 3px; border-radius: 12px; background: var(--ps-paper); }
.ps .gj-mode { flex: 1; padding: 8px 10px; border-radius: 9px; border: 0; background: none; font-size: 13px; cursor: pointer; color: var(--ps-ink-2); }
.ps .gj-mode.is-on { background: #fff; color: var(--ps-ink); font-weight: 600; box-shadow: 0 1px 4px #141B3C1f; }
.gj-hint { margin: 0; font-size: 12.5px; color: var(--ps-ink-2); }
.gj-examples-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.gj-examples { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: thin; }
.ps .gj-ex { flex: none; width: 188px; display: flex; flex-direction: column; gap: 4px; text-align: left; background: #fff; border: 1.5px solid var(--ps-line); border-radius: 14px; padding: 6px; cursor: pointer; }
.ps .gj-ex:hover { border-color: var(--ps-line-2); }
.ps .gj-ex.is-on { border-color: var(--ps-blue); }
.gj-pair { display: flex; gap: 4px; }
.gj-half { position: relative; flex: 1; aspect-ratio: 9 / 14; border-radius: 9px; overflow: hidden; background: var(--ps-paper); }
.gj-half img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gj-half em { position: absolute; left: 5px; bottom: 5px; padding: 1px 6px; border-radius: 999px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 10px; font-style: normal; }
.gj-ex b { font-size: 12.5px; padding: 0 2px; }
.gj-ex small { font-size: 11px; color: var(--ps-ink-2); line-height: 1.3; padding: 0 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gj-recreate { margin-top: 2px; align-self: flex-start; padding: 4px 11px; border-radius: 999px; background: var(--ps-ink); color: #fff; font-size: 11.5px; }
.gj-ex.is-on .gj-recreate { background: var(--ps-blue); }
.gj-steps { display: flex; flex-direction: column; gap: 14px; }
.gj-step { display: flex; gap: 12px; align-items: flex-start; }
.gj-num { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--ps-ink); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600; margin-top: 1px; }
.gj-stepbody { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.gj-stepbody > b { font-size: 13px; }
.gj-sub { font-size: 12.5px; }
.gj-source { display: flex; align-items: center; gap: 12px; }
.gj-thumb { flex: none; width: 54px; height: 76px; border-radius: 9px; overflow: hidden; background: var(--ps-paper); display: block; }
.gj-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 640px) { .ps .gj-ex { width: 160px; } .gj-modes { flex-direction: column; } }

/* the panels under the video must never be clipped: the column scrolls, and nothing in it (the video included) shrinks */
.ps-editor > * { flex-shrink: 0; }

/* ---------- the Edit | Genjutsu switch, and the Genjutsu workspace: video beside its controls ---------- */
.ps-edittools:has(.gj-viewtabs) { align-items: center; gap: 12px; }
.gj-viewtabs { display: inline-flex; gap: 4px; padding: 3px; border-radius: 12px; background: var(--ps-paper); }
.ps .ps-edittools .gj-vtab { display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px; border-radius: 9px; border: 0; background: none; font-size: 13px; cursor: pointer; color: var(--ps-ink-2); }
.ps .ps-edittools .gj-vtab.is-on { background: #fff; color: var(--ps-ink); font-weight: 600; box-shadow: 0 1px 4px #141B3C1f; }
.ps-editor.is-gj { overflow: hidden; }
.gj-work { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(200px, 32%) 1fr; gap: 16px; }
.gj-work .ps-big { flex: none; height: 100%; min-height: 0; }
.gj-pane { min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.gj-pane .ss-panel { border: 0; background: none; overflow: visible; }
.gj-pane .ss-body { padding: 0 4px 12px 0; }
@media (max-width: 900px) {
    .ps-editor.is-gj { overflow-y: auto; }
    .gj-work { grid-template-columns: 1fr; flex: none; }
    .gj-work .ps-big { height: auto; min-height: 42vh; }
    .gj-pane { overflow: visible; }
}

/* a tighter row of examples, so the steps are in view without scrolling */
.ps .gj-ex { width: 150px; padding: 5px; gap: 3px; }
.gj-half { aspect-ratio: 1 / 1.2; }
.gj-ex small { -webkit-line-clamp: 1; }
.gj-recreate { padding: 3px 10px; font-size: 11px; }
.gj .gj-steps { gap: 12px; }

/* Apply stays in view at the bottom of the Genjutsu pane, however long the pane is */
.gj-pane .ss-actions { position: sticky; bottom: 0; margin-top: 4px; padding: 10px 12px; border: 1px solid var(--ps-line); border-radius: 12px; background: #fff; box-shadow: 0 -6px 14px #141B3C0f; }

/* the card's one-line description is in its tooltip; the card is just the picture, the name and Recreate */
.gj-ex small { display: none; }
.ps .gj-ex { width: 140px; }

/* ---------- the saved research card: what the script was based on ---------- */
.rs-card { border: 1px solid var(--ps-line); border-radius: 12px; background: #fff; margin: 8px 0; }
.rs-card summary { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-size: 13px; font-weight: 600; cursor: pointer; list-style: none; }
.rs-card summary::-webkit-details-marker { display: none; }
.rs-card summary .ps-faint { font-weight: 400; font-size: 12px; }
.rs-body { display: flex; flex-direction: column; gap: 8px; padding: 0 12px 12px; font-size: 12.5px; }
.rs-summary { margin: 0; color: var(--ps-ink-2); }
.rs-product { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; border-radius: 10px; background: var(--ps-paper); }
.rs-product ul { margin: 2px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 2px; }
.rs-price { margin-top: 2px; font-weight: 600; }
.ps .rs-src { color: var(--ps-blue); font-size: 11.5px; margin-left: 4px; text-decoration: none; }
.ps .rs-src:hover { text-decoration: underline; }

.rs-used { font-style: normal; font-size: 11px; color: var(--ps-ok, #1a7f4b); margin-left: 6px; }

/* Look section: format, then a template of that format, then what the template set */
.se-tpl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-height: 420px; overflow-y: auto; padding: 4px 2px 4px 0; scrollbar-width: thin; }
.se-tpltabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.se-tplart video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .15s; }
.se-tplcard.is-playing .se-tplart video { opacity: 1; }
.ps .se-tplcard { display: flex; flex-direction: column; gap: 5px; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; min-width: 0; }
.se-tplart { position: relative; display: grid; place-items: center; aspect-ratio: 9 / 12; border-radius: 12px; overflow: hidden; background: var(--ps-paper);
    border: 2px solid transparent; box-shadow: 0 0 0 1px var(--ps-line); color: var(--ps-ink-3); transition: transform .15s; }
.se-tplcard:hover .se-tplart { transform: translateY(-2px); }
.se-tplcard.is-on .se-tplart { border-color: var(--ps-blue); }
.se-tplart img { width: 100%; height: 100%; object-fit: cover; display: block; }
.se-tplcard b { font-size: 12px; font-weight: 600; padding: 0 2px; line-height: 1.25; }
.se-tplmore .se-tplart strong { font-size: 18px; color: var(--ps-ink-2); }
.se-set { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.se-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.se-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--ps-mist); border: 1px solid var(--ps-line); font-size: 12px; color: var(--ps-ink-2); }
.se-chip button { border: 0; background: none; padding: 0; cursor: pointer; font-size: 14px; line-height: 1; color: var(--ps-ink-3); }
.se-chip button:hover { color: var(--ps-rose); }

.sv-range { flex: 1; min-width: 0; accent-color: var(--ps-blue); }
.sv-rangeval { flex: none; width: 42px; text-align: right; font-size: 12px; color: var(--ps-ink-2); }

/* Post screen: the sample captions over the original video, to drag and resize */
.sv-editcap { position: absolute; pointer-events: none; z-index: 3; }
.sv-editcap-box { position: absolute; left: 50%; transform: translate(-50%, -50%); max-width: 96%; padding: 4px 10px; text-align: center; line-height: 1.25;
    pointer-events: auto; cursor: grab; touch-action: none; user-select: none; outline: 1.5px dashed #ffffffcc; outline-offset: 3px; }
.sv-editcap-box:active { cursor: grabbing; }
.sv-editcap-box .sv-capline { font-size: inherit; display: block; }
.sv-editcap-grip { position: absolute; right: -9px; bottom: -9px; width: 14px; height: 14px; border-radius: 4px; background: var(--ps-blue); border: 2px solid #fff; cursor: nwse-resize; }
.sv-editcap-edge { position: absolute; background: var(--ps-blue); border: 2px solid #fff; border-radius: 4px; }
.sv-editcap-edge.is-h { right: -9px; top: 50%; width: 10px; height: 26px; margin-top: -13px; cursor: ew-resize; }
.sv-editcap-edge.is-v { bottom: -9px; left: 50%; height: 10px; width: 26px; margin-left: -13px; cursor: ns-resize; }

/* Cut: a timeline under the video, like a phone editor */
.ps-editor.is-cut .ps-big { flex: 1 1 280px; min-height: 240px; max-height: 52vh; }
.cut-tl { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 12px; border: 1px solid var(--ps-line); border-radius: 16px; background: #fff; }
.cut-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.cut-btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 12.5px; padding: 6px 10px; border-radius: 9px; border: 1px solid var(--ps-line); background: #fff; color: var(--ps-ink); cursor: pointer; }
.cut-btn:hover:not(:disabled) { border-color: var(--ps-ink-3); }
.cut-btn:disabled { opacity: .4; cursor: default; }
.cut-sep { width: 1px; height: 22px; background: var(--ps-line); margin: 0 4px; }
.cut-grow { flex: 1; }
.cut-time { font-size: 12.5px; color: var(--ps-ink-2); min-width: 86px; font-variant-numeric: tabular-nums; }
.cut-time b { color: var(--ps-ink); }
.cut-zoom { display: inline-flex; align-items: center; gap: 6px; color: var(--ps-ink-3); }
.cut-zoom input { width: 90px; accent-color: var(--ps-blue); }
.cut-scroll { overflow-x: auto; overflow-y: hidden; padding-bottom: 6px; border-radius: 12px; background: var(--ps-mist); scrollbar-width: thin; user-select: none; -webkit-user-select: none; }
.cut-canvas { position: relative; padding: 0 14px 10px; min-width: 100%; }
.cut-ruler { position: relative; height: 24px; margin: 0 -14px; padding: 0 14px; cursor: ew-resize; }
.cut-ruler span { position: absolute; top: 5px; font-size: 10.5px; color: var(--ps-ink-3); padding-left: 4px; border-left: 1px solid var(--ps-line-2); line-height: 14px; transform: translateX(14px); }
.cut-track { position: relative; height: 64px; margin: 0; cursor: ew-resize; }
.cut-clip { position: absolute; top: 0; height: 64px; border-radius: 9px; overflow: hidden; background: #fff; border: 2px solid transparent; box-shadow: 0 0 0 1px var(--ps-line-2); cursor: grab; touch-action: none; }
.cut-clip:active { cursor: grabbing; }
.cut-clip.is-on { border-color: var(--ps-blue); box-shadow: 0 0 0 2px #1E5BFF33; }
.cut-film { display: flex; height: 100%; }
.cut-film img, .cut-film span { flex: 1 1 0; min-width: 0; height: 100%; object-fit: cover; background: #d9def0; }
.cut-label { position: absolute; left: 6px; bottom: 4px; font-size: 10.5px; padding: 1px 6px; border-radius: 6px; background: #141B3Ccc; color: #fff; pointer-events: none; }
.cut-handle { position: absolute; top: 0; bottom: 0; width: 12px; background: var(--ps-blue); opacity: 0; cursor: col-resize; display: grid; place-items: center; }
.cut-handle::after { content: ""; width: 2px; height: 22px; border-radius: 2px; background: #fff; }
.cut-handle.is-l { left: 0; border-radius: 7px 0 0 7px; }
.cut-handle.is-r { right: 0; border-radius: 0 7px 7px 0; }
.cut-clip:hover .cut-handle, .cut-clip.is-on .cut-handle { opacity: 1; }
.cut-playhead { position: absolute; top: 0; bottom: 0; width: 0; pointer-events: none; margin-left: 14px; }
.cut-playhead i { position: absolute; top: 0; bottom: 4px; left: -1px; width: 2px; background: var(--ps-rose); }
.cut-playhead i::before { content: ""; position: absolute; top: -1px; left: -5px; width: 12px; height: 12px; border-radius: 3px 3px 6px 6px; background: var(--ps-rose); }
.cut-help { margin: 0; font-size: 12px; color: var(--ps-ink-2); line-height: 1.5; }
.cut-help kbd { font: inherit; font-size: 11px; padding: 0 5px; border: 1px solid var(--ps-line-2); border-bottom-width: 2px; border-radius: 5px; background: #fff; }
.gj-segment { display: inline-block; padding: 6px 10px; border-radius: 10px; background: var(--ps-saffron-soft); color: var(--ps-ink); font-size: 12.5px; }
.cut-ask { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border: 1px solid var(--ps-line-2); border-radius: 12px; background: var(--ps-paper); color: var(--ps-ink-3); }
.cut-ask:focus-within { border-color: var(--ps-blue); }
.cut-ask input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font: inherit; font-size: 13.5px; color: var(--ps-ink); padding: 6px 0; }
.cut-hint { margin: 0 2px; font-size: 12.5px; color: var(--ps-ink-2, #3b4256); line-height: 1.45; padding: 7px 10px; border-radius: 9px; background: var(--ps-mist); }
.cut-hint b { color: var(--ps-ink); font-weight: 600; }
.cut-note { margin: -2px 2px 0; font-size: 12px; color: var(--ps-ink-3); line-height: 1.4; }
.ps-change.ps-clipnote { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; color: var(--ps-ink-2); font-size: 13px; }
.ps-change.ps-clipnote span { flex: 1; min-width: 200px; }

/* ---------- video settings: every setting visible in one row, the open one opens as a dialog ---------- */
.ps-setcard { border: 1px solid var(--ps-line); border-radius: 18px; background: #fff; overflow: hidden; }
.ps-setrow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ps .ps-setcol { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; text-align: left; border-right: 1px solid var(--ps-line); min-width: 0; transition: background .12s; }
.ps .ps-setcol:last-child { border-right: 0; }
.ps .ps-setcol:hover { background: var(--ps-mist); }
.ps .ps-setcol.is-open { background: var(--ps-blue-soft); box-shadow: inset 0 -3px 0 var(--ps-blue); }
.ps-sethead { display: flex; align-items: center; gap: 7px; color: var(--ps-ink-2); font-size: 13px; }
.ps-sethead svg { color: var(--ps-blue); }
.ps-sethead b { font-weight: 700; }
.ps-sethead em { margin-left: auto; font-style: normal; font-weight: 600; font-size: 12.5px; color: var(--ps-blue); }
.ps-setval { font-weight: 700; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-setkv { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--ps-ink-2); }
.ps-setkv b { color: var(--ps-ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-setpanel { padding: 16px 18px; border-top: 1px solid var(--ps-line); display: flex; flex-direction: column; gap: 16px; background: #fff; }
.ps-keepstrip { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--ps-line); background: var(--ps-mist); }
.ps-setlabel { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ps-ink-3); }
.ps-keepstrip .ps-keepslot { width: 64px; height: 64px; }
.ps-keepstrip .ps-keepslot.is-empty { font-size: 11px; line-height: 1.2; }
@media (max-width: 900px) { .ps-setrow { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ps-keepstrip .ps-keeprow { display: flex; flex-flow: row nowrap; gap: 8px; flex: none; }
.ps-keepstrip .ps-keepslot { flex: none; width: 64px; height: 64px; padding: 4px; }
.ps-keepstrip > .ps-faint, .ps-keepstrip > p { flex: 1 1 200px; margin: 0; }

/* the open setting is a dialog over the page, so nothing has to be scrolled to reach it */
.ps-vmodalbg { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; background: #141B3C66; backdrop-filter: blur(2px); }
.ps-vmodal { width: min(560px, 100%); max-height: min(88vh, 760px); display: flex; flex-direction: column; background: #fff; border-radius: 20px; box-shadow: 0 30px 80px #141B3C55; overflow: hidden; }
.ps-vmodal.is-wide { width: min(1080px, 100%); }
.ps-vmodalhead { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--ps-line); }
.ps-vmodalbody { padding: 18px 20px; display: flex; flex-direction: column; gap: 18px; min-height: 0; }
.ps-vmodalfoot { display: flex; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--ps-line); background: var(--ps-mist); }
.ps-vmodal .se-tpl { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); max-height: none; overflow: visible; }
.ps-vmodal .ps-styles3 { gap: 10px; }
.ps-vmodal.is-wide .ps-styles3 { max-width: 520px; }

/* ---------- every video, as one row of tiles at the top (all one size, so a wide video never leaves a gap) ---------- */
.ps-vgrid-sec { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ps-vgrid-head { display: flex; align-items: center; gap: 8px; }
.ps-vgrid-head .ps-vpager { margin-left: auto; }
.ps-vgrid { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 8px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.ps-vtile { flex: none; width: 124px; margin: 0; cursor: pointer; background: #fff; border: 1px solid var(--ps-line); scroll-snap-align: start; }
.ps-vtile .ps-media { min-height: 0; aspect-ratio: 9 / 13; background: var(--ps-aurora); overflow: hidden; }
.ps-vtile.is-picked { box-shadow: 0 0 0 3px var(--ps-blue); border-color: transparent; }
.ps-vtile.is-pending { height: 190px; }
.ps-vtile figcaption { display: flex; flex-direction: column; gap: 1px; padding: 7px 9px 8px; min-width: 0; }
.ps-vtile figcaption b { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-vtile figcaption span { font-size: 11px; color: var(--ps-ink-3); }
.ps-vtile .ps-acts { bottom: 46px; }
