/* Main shell escape hatches: portrait animation, simulation stages, archive
   transport and transcript geometry. Header/navigation/forms/theme use canon. */
@import url("./persona-performance.css");
.wwmud-stage-host { min-width: 0; }
#app { min-width: 0; width: 100%; }
#app [hidden] { display: none !important; }
#app .count { margin-inline-end: auto; }
#app .state:empty { display:none; }
#app .list { list-style:none; margin:0; padding:0; }
#app .entry { border-bottom:1px solid var(--border-color); }
#app .row { display:grid; grid-template-columns:auto 5em minmax(0,1fr) 9em 5em auto; gap:var(--space-sm); align-items:center; padding-block:var(--space-sm); }
#app .row > * { min-width:0; }
#app .row a, #app .meta { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#app .entry[data-playing=true] { background:var(--bg-secondary); }
#app .transcript { padding:var(--space-md); white-space:normal; user-select:text; }
#app .state { margin-block:var(--space-sm); }
#app .auto { display:inline-grid; grid-auto-flow:column; align-items:center; gap:var(--space-xs); }
#app .discovery-tools[open] > :not(summary) { margin-block:var(--space-xs); }
#app .tools { min-width:0; }
@media(max-width:650px){#app .row { grid-template-columns:auto 4em minmax(0,1fr) auto; } #app .row .repository,#app .row .source { display:none; }}
#app .head-field{display:grid;grid-template-columns:repeat(auto-fill,minmax(155px,1fr));gap:12px 10px;margin:0;padding:36px 0 12px;list-style:none;overflow:visible;border:0;align-items:start;scroll-margin-top:12px}
#app .head-slot{position:relative;min-width:0;min-height:206px;margin:0;padding:0;overflow:visible;content-visibility:visible;isolation:isolate}
#app .head-slot:has(.speech-bubble:not([hidden])){z-index:3}
#app .mullman-head{display:flex!important;flex-direction:column;align-items:center;justify-content:flex-start;grid-auto-flow:unset;min-width:0;width:100%;min-height:190px;height:auto;padding:0;border:0;background:transparent!important;color:inherit;border-radius:12px;overflow:visible;gap:1px;touch-action:pan-y}
#app .mullman-head:focus-visible{outline:2px solid currentColor;outline-offset:3px}
#app .head-drift{position:relative;display:block;flex:0 0 150px;width:150px;height:150px;max-width:100%;margin:0;clip-path:none;filter:none;animation:head-float var(--float-time,7s) ease-in-out var(--float-delay,0s) infinite}
#app .head-drift img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;clip-path:none;pointer-events:none}
#app .face-talk{visibility:hidden}
#app .head-slot[data-playing=true] .face-rest{animation:rest-jabber var(--talk-time,.35s) steps(1) infinite}
#app .head-slot[data-playing=true] .face-talk{animation:talk-jabber var(--talk-time,.35s) steps(1) infinite}
@keyframes rest-jabber{0%,100%{visibility:visible}50%{visibility:hidden}}
@keyframes talk-jabber{0%,100%{visibility:hidden}50%{visibility:visible}}
#app .head-slot[data-visible=false] *{animation-play-state:paused!important}
#app .head-slot[data-audible=true] .head-drift{filter:drop-shadow(0 0 8px #b9ed6388)}
#app .head-detail{position:relative;font-size:12px;line-height:1.5;text-align:left}
#app .head-detail summary{cursor:pointer;list-style:none;text-align:center;width:40px;min-height:22px;margin:auto;font-size:18px;line-height:18px}
#app .head-detail[open]{z-index:8;background:#fff;box-shadow:0 3px 12px #0002;border-radius:8px;padding:8px}
#app .head-detail p{overflow-wrap:anywhere;margin:6px 0}
#app .speech-bubble{position:absolute;bottom:calc(100% - 16px);left:3%;width:94%;box-sizing:border-box;min-height:28px;padding:7px 9px;color:#17200c;background:#efffd4;border:1px solid #a7ce6e;border-radius:12px;font:inherit;text-align:left;box-shadow:0 3px 8px #0001;pointer-events:none;overflow-wrap:anywhere;z-index:5}
#app .speech-bubble::before{content:'';position:absolute;bottom:-6px;left:48%;width:10px;height:10px;background:#efffd4;border-right:1px solid #a7ce6e;border-bottom:1px solid #a7ce6e;transform:rotate(45deg)}
/* Word joiner keeps the trailing typing cursor attached to the last revealed word. */
#app .speech-bubble::after{content:'\2060';display:inline;border-right:2px solid #477722;margin-left:3px;animation:ao-caret .6s steps(1) infinite}
@keyframes ao-caret{50%{opacity:0}}
#app .head-field[data-layout=float]{display:block;position:relative;margin-top:28px;padding:0}
#app .head-field[data-layout=float] .head-slot{position:absolute;width:160px;min-height:200px;transition:left .5s,top .5s}
#app .head-field[data-layout=float] .head-drift{animation:free-orbit var(--float-time,7s) ease-in-out var(--float-delay,0s) infinite}
@keyframes free-orbit{0%,100%{transform:translate(-7px,-7px) rotate(-4deg)}35%{transform:translate(12px,6px) rotate(4deg)}70%{transform:translate(-10px,12px) rotate(-2deg)}}
#app .head-field[data-frozen=true] .head-drift{animation:none;transform:none}
#app .head-pages{display:flex;justify-content:center;align-items:center;gap:20px;padding:18px 0;font-size:13px}
#app.review-mode{height:100%;min-height:0;display:grid;place-items:start center}
#app .clone-review{width:min(100%,46rem);margin-inline:auto}
#app .clone-review>div{gap:var(--space-md)}
#app .clone-review h2,#app .clone-review .review-hint,#app .clone-review .review-progress-text{text-align:center;margin:0}
#app .review-progress{width:100%;height:.6rem}
#app .review-stage{min-height:0}
#app .review-current{display:grid;gap:var(--space-md);padding:var(--space-md);border:1px solid var(--border-color);background:var(--bg-primary)}
#app .review-current h3{text-align:center;margin:0;font-size:1.25rem}
#app .review-pose{display:block!important;width:min(100%,34rem);height:min(48vh,34rem);margin-inline:auto;padding:0;border:0;background:transparent}
#app .review-pose img{width:100%;height:100%;object-fit:contain;display:block}
#app .review-pose .face-talk{visibility:visible}
#app .review-answer{display:grid;grid-template-columns:1fr 1fr;gap:var(--space-sm)}
#app .review-answer button{min-height:4rem;font-size:1.1rem;font-weight:700}
#app .review-keep[aria-pressed=true],#app .review-remove[aria-pressed=true]{outline:3px solid currentColor;outline-offset:2px}
#app .review-tweak-editor{display:grid;gap:var(--space-sm)}
#app .review-tweak-editor[hidden]{display:none}
#app .review-tweak-editor label{font-weight:700}
#app .review-tweak-editor textarea{width:100%;box-sizing:border-box;min-height:6rem;resize:vertical;font:inherit}
#app .review-card-footer{display:flex;justify-content:space-between;gap:var(--space-sm)}
#app .review-existing-note{margin:0;padding:var(--space-sm);border-inline-start:3px solid currentColor;overflow-wrap:anywhere}
#app .review-status{min-height:1.5em;text-align:center;margin:0}
#app .review-transfer{margin-inline:auto}
#app .review-complete{display:grid;justify-items:center;gap:var(--space-md);padding-block:12vh;text-align:center}
#app .review-clone[data-removed=true]{background:var(--bg-secondary)}
#app .review-clone[data-removed=true] img{opacity:.35;filter:grayscale(1)}
@media(max-width:600px){
 #app .clone-review{width:100%}
 #app .review-current{padding:var(--space-sm)}
 #app .review-pose{height:min(25vh,15rem)}
 #app .review-answer button{min-height:3.5rem}
}
@media(max-width:600px){
 #app .head-field{grid-template-columns:repeat(3,minmax(0,1fr));gap:25px 6px;padding-top:38px}
 #app .head-slot{min-height:158px}
 #app .mullman-head{min-height:138px}
 #app .head-drift{flex-basis:108px;width:108px;height:108px}
 #app .speech-bubble{font-size:10px;line-height:1.3;padding:5px;left:0;width:100%;bottom:calc(100% - 9px)}
 #app .head-field[data-layout=float] .head-slot{width:130px}
 #app .head-field[data-layout=float] .head-drift{width:118px;height:118px}
}
@media(prefers-reduced-motion:reduce){#app .head-drift,#app .face-rest,#app .face-talk,#app .speech-bubble::after{animation:none!important}}

@keyframes head-float{0%,100%{transform:translateY(-3px) rotate(-2deg)}50%{transform:translateY(3px) rotate(2deg)}}
#app .mullman-head:hover .head-drift,#app .mullman-head:focus-visible .head-drift{animation-play-state:paused}
#app .mullman-head{box-shadow:none;text-transform:none;letter-spacing:normal;white-space:normal}

/* Solo keeps the full portrait beside the list, with its own size independent of Chaos. */
.solo-stage{float:left;width:min(44%,440px);position:sticky;top:18px;padding:12px 18px 24px 0}
.solo-stage[hidden]{display:none}
.solo-stage label{display:grid;gap:8px;min-width:0}
.solo-face-picker{max-width:100%;width:100%}
.solo-avatar{padding-top:85px;min-width:0}
#app .solo-avatar .head-slot{width:100%;min-height:0;list-style:none}
#app .solo-avatar .head-drift{display:block;position:relative;flex:0 0 auto;width:100%;height:auto;aspect-ratio:1;max-width:410px;margin:auto}
#app .solo-avatar .persona-pose{display:block;position:relative;width:100%;height:100%}
#app .solo-avatar img{width:100%;height:100%;object-fit:contain}
#app .solo-avatar .speech-bubble{top:auto;bottom:calc(100% + 8px);left:0;width:100%;max-width:100%;max-height:none;height:auto;white-space:normal}
.solo-personality{font-size:.85rem;color:var(--text-secondary)}
.solo-mode .list{margin-left:min(calc(44% + 18px),458px)}
@media(max-width:760px){
 #app .solo-stage{float:none;width:100%;position:relative;top:0;padding:8px 0 18px;display:grid;grid-template-columns:min(62%,240px) minmax(0,1fr);gap:10px;align-items:center}
 #app .solo-stage[hidden]{display:none}
 .solo-stage label,.solo-personality{grid-column:2}
 #app .solo-avatar{grid-column:1;grid-row:1 / 3;width:100%;padding-top:65px}
 #app .solo-avatar .speech-bubble{font-size:12px}
 .solo-mode .list{margin-left:0}
}

#app .solo-soundboard{grid-column:1 / -1;min-width:0;width:100%;font-size:13px}#app .solo-soundboard select{max-width:100%;width:100%;margin:8px 0}

body.debate-cast-stage { display:block; }

/* Domain portrait geometry; navigation and settings remain framework-owned. */
#app .solo-catalog .head-slot{width:100%;min-height:0;display:flex;flex-direction:column;align-items:center}
#app .solo-catalog .head-drift{width:100%;height:auto;aspect-ratio:1;flex-basis:auto}
#app .solo-catalog .persona-pose{display:block;position:relative;width:100%;height:100%}
#app .solo-catalog .speech-bubble{position:relative;inset:auto;width:100%;margin-block:var(--space-md)}

/* Portrait/grid geometry only. Canon detailShell owns padding and available height. */
.detail-body--fill>.wwmud-stage-host{height:100%;min-height:0}
#app:has(>.solo-catalog:not([hidden])),#app.chaos-mode{height:100%;min-height:0;display:flex;flex-direction:column;gap:var(--space-sm)}
#app .solo-catalog{display:flex;flex-direction:column;flex:1;min-height:0;gap:var(--space-sm)}
#app .solo-catalog[hidden]{display:none}
#app .solo-catalog-portrait{height:100%;width:100%;min-height:0;flex:1;display:grid;place-items:center;container-type:size}
#app .solo-catalog-portrait .head-slot{height:min(96cqh,100cqw);width:min(96cqh,100cqw)}
#app .solo-catalog-portrait .head-drift{height:100%;width:100%}
#app .solo-catalog>p:empty{display:none}
#app .solo-catalog>p{margin:0}
#app.chaos-mode .head-field{flex:1;min-height:0;padding:0;column-gap:0;row-gap:var(--space-sm);align-items:stretch;overflow:visible}
#app.chaos-mode .head-field>.head-slot{min-height:0;min-width:0;padding-inline:calc(var(--space-sm)/2);box-sizing:border-box;container-type:size}
#app.chaos-mode .mullman-head{height:100%;min-height:0;padding:0;justify-content:center;gap:var(--space-xs)}
#app.chaos-mode .head-drift{flex:0 0 auto;width:min(96cqh,100cqw);height:min(96cqh,100cqw);animation:none}
#app.chaos-mode .speech-bubble{inset:0 auto auto 0;max-height:20%;overflow:clip;font:inherit}
#app.chaos-mode .head-pages{padding:0;flex-shrink:0;font:inherit}
