/* Portrait asset is untouched; its original transparent canvas is cropped in the layout. */
.character-stage{display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;gap:38px;isolation:isolate;height:auto;min-height:clamp(250px,39dvh,360px);padding:12px 0 0;overflow:hidden}
#portrait-frame{position:relative;order:1;align-self:flex-end;flex:none;margin-top:auto;width:46%;max-width:232px;aspect-ratio:444/465;overflow:hidden;pointer-events:none;z-index:1}
#portrait-frame #portrait{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;object-position:right bottom}
#portrait-frame.is-source-canvas #portrait{inset:auto;left:-135.36036%;top:-244.08602%;width:243.24324%;height:auto;max-width:none;object-fit:fill}
#portrait-placeholder{position:relative;order:1;align-self:flex-end;flex:none;margin-top:auto;margin-right:12px;margin-bottom:12px;width:42%;font-size:16px;z-index:0}
.character-stage .stage-bubble,.character-stage .stage-thought{position:relative;z-index:2;display:grid;width:76%;max-width:100%;min-height:94px;margin:0 0 0 12px;flex:none;padding:14px 15px;border:2px solid #48413d;border-radius:32% 28% 29% 25% / 28% 29% 26% 27%;background:#fffdfb;color:#333;font-family:inherit;font-size:clamp(14px,4.1vw,18px);font-weight:500;line-height:1.6;white-space:pre-wrap;overflow-wrap:anywhere;text-align:center;align-items:center;justify-items:center;box-shadow:0 2px 0 #00000010}
/* The speech outline and tail are one continuous SVG path. The button keeps its
   original border box so text measurement and portrait spacing do not change. */
.character-stage .stage-bubble{appearance:none;-webkit-appearance:none;overflow:visible}
.character-stage .stage-bubble.has-vector-outline{border-color:transparent;background:transparent;box-shadow:none}
.stage-bubble .stage-bubble-outline{position:absolute;inset:-2px;width:calc(100% + 4px);height:calc(100% + 4px);overflow:visible;pointer-events:none;z-index:0;filter:drop-shadow(0 2px 0 #00000010)}
.stage-bubble .stage-bubble-outline path{fill:#fffdfb;stroke:#48413d;stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
.stage-bubble #bubble-reserve,.stage-bubble #bubble-line{position:relative;z-index:1}
#bubble-reserve,#bubble-line{grid-area:1/1;min-width:0;max-width:100%;white-space:pre-wrap;overflow-wrap:anywhere}
#bubble-reserve{visibility:hidden;pointer-events:none}
.stage-bubble:focus-visible{outline:2px solid #536d7b;outline-offset:3px}
.character-stage .stage-thought{width:72%;padding:10px 12px;border-radius:35% 30% 30% 30% / 28% 28% 30% 28%;gap:4px}
.stage-thought::before,.stage-thought::after{content:"";position:absolute;background:#fffdfb;border:2px solid #48413d;border-radius:50%}
.stage-thought::before{right:3%;bottom:-17px;width:15px;height:15px}
.stage-thought::after{right:-5%;bottom:-29px;width:8px;height:8px}
.character-stage #thought-image{display:block;width:100%;height:clamp(82px,25vw,148px);object-fit:contain;object-position:center;border-radius:10px}
.character-stage #thought-label{color:#57504a;font-size:11px;line-height:1.35;white-space:normal;overflow-wrap:anywhere}
#stage-thought[hidden],#stage-bubble[hidden],#portrait-frame[hidden]{display:none!important}
#stage-bubble[aria-hidden=true]{cursor:default}
.stage-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
.dialogue #line{white-space:pre-wrap;overflow-wrap:anywhere}
@media(prefers-reduced-motion:reduce){.character-stage *{animation:none!important;transition:none!important}}

/* Pose 02: measured display-only crop, same portrait frame; source PNG is untouched. */
#portrait-frame.is-pose-crop #portrait{inset:auto;left:var(--pose-left);top:var(--pose-top);width:var(--pose-width);height:auto;max-width:none;object-fit:fill}

/* EM-10–12 answer controls occupy the left side of the portrait row. Grid only while visible. */
.character-stage:has(#mind-answer:not([hidden])){display:grid;grid-template-columns:minmax(0,1fr) minmax(0,46%);grid-template-rows:auto 1fr;column-gap:8px;row-gap:32px;align-items:end}
.character-stage:has(#mind-answer:not([hidden])) .stage-bubble,.character-stage:has(#mind-answer:not([hidden])) .stage-thought{grid-column:1/-1;grid-row:1;align-self:start}
.character-stage:has(#mind-answer:not([hidden])) #portrait-frame,.character-stage:has(#mind-answer:not([hidden])) #portrait-placeholder{grid-column:2;grid-row:2;width:100%;max-width:232px;align-self:end;justify-self:end;margin:0}
#mind-answer{grid-column:1;grid-row:2;align-self:end;min-width:0;position:relative;z-index:4;padding:0 0 10px 10px;color:var(--ink);text-align:left;display:flex;flex-direction:column;gap:4px}
#mind-answer-options{display:grid;gap:4px}#mind-answer-options:empty{display:none}#mind-answer .quiet{font-size:13px;line-height:1.2;margin:0;padding:7px 3px;min-height:42px;background:#fffdfb;overflow-wrap:anywhere}#mind-answer-form{display:grid;gap:4px}#mind-answer-text{font-size:16px;min-width:0;width:100%;padding:6px}#mind-answer-skip{border-color:#bfb8b0}#mind-answer .mind-answer-privacy{font-size:10px;line-height:1.3}body.edel-watch #mind-answer{display:none!important}
