/* Hallmark · pre-emit critique: P5 H5 E4 S5 R5 V4 */
/* Hallmark · macrostructure: comic playbill, split scene and dialogue, ending ticket. */
:root:has(.theatre) {
  --t-paper:#fffaf1; --t-white:#fffefb; --t-ink:#293d46; --t-muted:#586570;
  --t-action:#b6422d; --t-action-hover:#923722; --t-blue:#28688a; --t-honey:#f5cf72;
  --t-cream:#fff0c6; --t-sky:#eaf4f7; --t-mint:#eaf3eb; --t-rose:#fbe8e1;
  --t-line:#cbbfae; --t-wash:#f4efe5; --t-focus:#176f8a;
  --t-font:system-ui,-apple-system,"Segoe UI","Microsoft JhengHei",sans-serif;
}
body:has(.theatre){margin:0;background:var(--t-paper)}
.theatre-skip{position:fixed;left:12px;top:-100px;z-index:9999;padding:12px;background:var(--t-white);color:var(--t-ink)}
.theatre-skip:focus{top:8px;outline:3px solid var(--t-focus);outline-offset:4px}
.theatre{max-width:1120px;margin:auto;padding:16px 18px 48px;color:var(--t-ink);font-family:var(--t-font);line-height:1.6;scroll-margin-top:88px}
.theatre *{box-sizing:border-box}
.theatre h1,.theatre h2,.theatre p,.theatre figure{margin:0}
.theatre h1{font-size:clamp(28px,4vw,44px);font-weight:850;line-height:1.25;letter-spacing:-.035em;margin:8px 0 24px;text-wrap:balance;min-width:0;overflow-wrap:anywhere;font-style:normal}
.theatre h2{font-size:22px;line-height:1.35;margin:16px 0;font-style:normal}
.theatre a{color:var(--t-blue);text-underline-offset:4px}
.theatre button{font:inherit;font-weight:650;line-height:1.4;cursor:pointer;background:var(--t-white);border:2px solid var(--t-ink);border-radius:12px;padding:12px 18px;min-height:48px;color:var(--t-ink);box-shadow:0 3px 0 var(--t-ink);transition:transform .14s ease}
.theatre button:active{transform:translateY(3px);box-shadow:none}
.theatre button:disabled{opacity:.5;cursor:not-allowed;transform:none}
.theatre button:focus-visible,.theatre a:focus-visible,.theatre summary:focus-visible,.theatre input:focus-visible{outline:3px solid var(--t-focus);outline-offset:4px}
.theatre button.theatre-primary{display:inline-flex;align-items:center;justify-content:center;gap:12px;background:var(--t-action);color:var(--t-white);white-space:nowrap}
.theatre-toolbar{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:24px;font-size:14px}
.theatre-toolbar a{display:inline-flex;align-items:center;min-height:44px;text-decoration:none;white-space:nowrap}
.theatre-eyebrow{font-size:12px;font-weight:750;letter-spacing:.07em;color:var(--t-muted)}
.theatre-chip{display:inline-flex;gap:8px;align-items:center;background:var(--t-honey);border:2px solid var(--t-ink);padding:4px 12px;font-size:12px;font-weight:800;letter-spacing:.08em;border-radius:6px;transform:rotate(-2deg)}
.theatre-intro{display:grid;gap:20px;margin-bottom:32px;border-bottom:2px dashed var(--t-line);padding-bottom:28px}
.theatre-intro h1{font-size:clamp(38px,6vw,62px);margin:16px 0 12px}
.theatre-intro h1 span{color:var(--t-action)}
.theatre-intro>div>p:last-child{font-size:15px;color:var(--t-muted)}
.theatre-cast{display:flex;justify-content:center;gap:8px}
.theatre-cast figure{width:68px;min-width:0;text-align:center}
.theatre-cast img{display:block;width:100%;height:78px;object-fit:contain;background:var(--t-white);border:2px solid var(--t-ink);border-radius:48% 48% 12px 12px;box-shadow:0 3px 0 var(--t-ink)}
.theatre-cast figure:nth-child(2n){transform:translateY(8px)}
.theatre-cast figcaption{font-size:11px;font-weight:750;margin-top:8px}
.theatre-episodes{display:grid;gap:28px;grid-template-columns:minmax(0,1fr)}
.theatre-episode{min-width:0;border:2px solid var(--t-ink);border-radius:20px;overflow:hidden;background:var(--t-white);box-shadow:5px 5px 0 var(--t-ink)}
.theatre-cover{position:relative;isolation:isolate;background:var(--t-cream);height:206px;overflow:hidden;border-bottom:2px solid var(--t-ink)}
.theatre-cover>img{width:100%;height:100%;display:block;object-fit:cover;opacity:.78}
.theatre-episode-number{position:absolute;top:12px;left:12px;z-index:2;background:var(--t-ink);color:var(--t-white);font-size:13px;font-weight:800;padding:6px 12px;border-radius:8px;letter-spacing:.06em}
.theatre-cover-icon{position:absolute;top:12px;right:14px;font-size:34px;filter:drop-shadow(0 2px 0 var(--t-white));transform:rotate(10deg)}
.theatre-players{position:absolute;bottom:0;left:0;right:0;display:flex;justify-content:center;align-items:end;gap:8px;padding:0 12px}
.theatre-player{width:66px;min-width:0;text-align:center;position:relative}
.theatre-player img{display:block;width:100%;height:74px;object-fit:contain;background:var(--t-white);border:2px solid var(--t-ink);border-radius:44% 44% 0 0}
.theatre-player span{display:block;font-size:10px;font-weight:750;background:var(--t-white);border:2px solid var(--t-ink);border-top:0;padding:2px}
.theatre-player:nth-child(2n){transform:translateY(8px)}
.theatre-cover .theatre-player{width:76px}
.theatre-cover .theatre-player img{height:86px}
.theatre-cover .theatre-players{bottom:10px;gap:8px}
.theatre-episode-copy{padding:22px 20px}
.theatre-episode h2{min-height:2.7em;font-size:25px;margin:8px 0 24px;text-wrap:balance}
.theatre-episode .theatre-primary{width:100%}
.theatre-note{text-align:center;font-size:12px;color:var(--t-muted);margin-top:28px!important}
.theatre-progress{display:flex;gap:8px;margin-bottom:20px;align-items:center}
.theatre-progress>span{display:flex;flex:1;gap:6px;align-items:center;justify-content:center;font-size:12px;font-weight:650;padding:8px 4px;border-bottom:3px solid var(--t-line);white-space:nowrap}
.theatre-progress b{display:inline-grid;place-items:center;width:24px;height:24px;border:1px solid var(--t-line);border-radius:50%;font-size:11px;background:var(--t-white)}
.theatre-progress [aria-current]{border-color:var(--t-action);color:var(--t-action)}
.theatre-progress [aria-current] b{background:var(--t-action);border-color:var(--t-action);color:var(--t-white)}
.theatre-progress .is-complete b{background:var(--t-ink);color:var(--t-white);border-color:var(--t-ink)}
.theatre-comic{display:grid;grid-template-columns:minmax(0,1fr);gap:24px;align-items:start}
.theatre-scene-column{min-width:0}
.theatre-stage{position:relative;border:2px solid var(--t-ink);border-radius:18px;background:var(--t-cream);overflow:hidden;box-shadow:4px 4px 0 var(--t-line)}
.theatre-stage>img{display:block;width:100%;height:220px;object-fit:cover}
.theatre-stage>figcaption{position:absolute;top:12px;left:12px;background:var(--t-white);border:1px solid var(--t-ink);padding:4px 12px;border-radius:6px;font-size:11px;font-weight:650}
.theatre-stage .theatre-players{bottom:10px}
.theatre-stage .theatre-player{width:58px}
.theatre-stage .theatre-player img{height:60px}
.theatre-player.is-speaking img{border-color:var(--t-action);background:var(--t-cream)}
.theatre-player.is-speaking span{background:var(--t-cream);border-color:var(--t-action)}
.theatre-trail{display:flex;align-items:center;justify-content:center;gap:12px;padding-top:16px;color:var(--t-muted);font-size:12px}
.theatre-trail ol{display:flex;gap:6px;list-style:none;margin:0;padding:0}
.theatre-trail li{display:grid;place-items:center;width:28px;height:28px;border:1px dashed var(--t-line);border-radius:8px;font-size:12px;font-weight:800}
.theatre-trail .is-chosen{border:1px solid var(--t-ink);color:var(--t-ink);background:var(--t-honey)}
.theatre-script{min-width:0}
.theatre-transition{position:relative;font-size:14px;color:var(--t-muted);padding:0 0 16px;margin-bottom:16px!important;border-bottom:1px dashed var(--t-line)}
.theatre-dialogue{display:grid;gap:20px}
.theatre-line{display:grid;grid-template-columns:52px minmax(0,1fr);gap:10px;align-items:start}
.theatre-line>img{display:block;width:52px;height:88px;object-fit:contain;border-radius:12px}
.theatre-line>div{position:relative;min-width:0;background:var(--t-rose);border:2px solid var(--t-ink);border-radius:14px;padding:10px 12px;box-shadow:0 3px 0 var(--t-ink)}
.theatre-line>div::before{content:"";position:absolute;left:-7px;top:18px;width:10px;height:10px;transform:rotate(45deg);border-left:2px solid var(--t-ink);border-bottom:2px solid var(--t-ink);background:inherit}
.theatre-line[data-speaker=Dennis],.theatre-line[data-speaker=Hazel]{grid-template-columns:minmax(0,1fr) 52px}
.theatre-line[data-speaker=Dennis]>img,.theatre-line[data-speaker=Hazel]>img{grid-column:2;grid-row:1}
.theatre-line[data-speaker=Dennis]>div,.theatre-line[data-speaker=Hazel]>div{grid-column:1;grid-row:1;background:var(--t-sky)}
.theatre-line[data-speaker=Hazel]>div{background:var(--t-cream)}
.theatre-line[data-speaker=Maria]>div{background:var(--t-mint)}
.theatre-line[data-speaker=Dennis]>div::before,.theatre-line[data-speaker=Hazel]>div::before{left:auto;right:-7px;border:0;border-top:2px solid var(--t-ink);border-right:2px solid var(--t-ink)}
.theatre-line strong{display:block;color:var(--t-ink);font-size:11px;font-weight:800;margin-bottom:3px}
.theatre-line p{font-size:15px;line-height:1.6}
.theatre-line p.theatre-direction{font-size:12px;color:var(--t-muted);margin-bottom:4px}
.theatre-narrator{padding:16px;border-radius:12px;background:var(--t-wash);font-size:15px;line-height:1.75}
.theatre-choice-heading{font-size:20px!important;margin:28px 0 14px!important}
.theatre-choice-heading>span{color:var(--t-action)}
.theatre-choices{display:grid;gap:12px}
.theatre-choices>button{display:flex;align-items:center;gap:12px;text-align:left;padding:14px 12px;font-size:15px;font-weight:600;background:var(--t-white)}
.theatre-choices>button>span:first-child{display:grid;place-items:center;flex:0 0 32px;height:32px;background:var(--t-honey);border:1px solid var(--t-ink);border-radius:8px;font-weight:850}
.theatre-choices>button[data-choice=B]>span:first-child{background:var(--t-mint)}
.theatre-choices>button[data-choice=C]>span:first-child{background:var(--t-sky)}
.theatre-selected{font-size:13px;background:var(--t-cream);border:1px dashed var(--t-ink);padding:10px 12px;border-radius:8px}
.theatre-reaction-heading{font-size:22px!important;margin:18px 0!important}
.theatre-script>.theatre-primary{width:100%;margin-top:28px}
.theatre-actions{display:flex;flex-wrap:wrap;align-items:center;gap:12px;margin-top:24px}
.theatre-actions>a{display:inline-flex;align-items:center;min-height:44px}
.theatre .theatre-secondary-actions button,.theatre .theatre-ending-links button{border:0;box-shadow:none;background:transparent;padding:8px 4px;font-size:13px;font-weight:550;color:var(--t-muted);white-space:nowrap}
.theatre-secondary-actions{justify-content:space-between;border-top:1px dashed var(--t-line);padding-top:12px;margin-top:28px}
.theatre-ending{--ending-color:var(--t-cream);position:relative;max-width:740px;margin:auto;background:var(--t-white);border:2px solid var(--t-ink);border-radius:24px;padding:24px 20px;box-shadow:6px 6px 0 var(--t-ink);text-align:center;overflow:hidden}
.theatre-ending[data-ending=B]{--ending-color:var(--t-mint)}
.theatre-ending[data-ending=C]{--ending-color:var(--t-rose)}
.theatre-ending[data-ending=D]{--ending-color:var(--t-sky)}
.theatre-ending-ticket{display:flex;justify-content:space-between;align-items:center;font-size:12px;letter-spacing:.1em;font-weight:800;padding-bottom:16px;border-bottom:2px dashed var(--t-line);margin-bottom:24px}
.theatre-medal{display:grid;place-items:center;width:100px;height:100px;margin:0 auto 20px;border:2px solid var(--t-ink);border-radius:50%;background:var(--ending-color);font-size:48px;box-shadow:4px 4px 0 var(--t-honey);position:relative}
.theatre-medal::before,.theatre-medal::after{content:"✦";position:absolute;font-size:26px;color:var(--t-action)}
.theatre-medal::before{left:-30px;top:6px;transform:rotate(-14deg)}
.theatre-medal::after{right:-28px;bottom:4px;font-size:18px}
.theatre-ending h1{font-size:clamp(28px,4vw,42px);margin:8px 0 16px}
.theatre-ending-copy{text-align:left;font-size:16px;line-height:1.85;max-width:52ch;margin:auto!important}
.theatre-ending .theatre-cast{margin:28px 0}
.theatre-ending .theatre-actions{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px}
.theatre-ending .theatre-actions button{padding:12px 8px;font-size:14px;white-space:nowrap}
.theatre-ending-links{display:flex;justify-content:center;gap:16px;align-items:center;margin-top:12px}
.theatre-ending-links a{font-size:13px;text-decoration:none;min-height:48px;display:inline-flex;align-items:center;white-space:nowrap}
.theatre-rules{margin-top:16px;text-align:left;border-top:1px dashed var(--t-line);font-size:12px;color:var(--t-muted)}
.theatre-rules summary{cursor:pointer;min-height:44px;display:flex;align-items:center;justify-content:center;gap:8px;list-style:none}
.theatre-rules summary::after{content:"+";font-size:18px}
.theatre-rules[open] summary::after{content:"−"}
.theatre-rules p{padding-bottom:8px;line-height:1.8}
.theatre input{width:100%;font:inherit;font-size:14px;padding:12px;border:2px solid var(--t-ink);border-radius:8px;background:var(--t-white);color:var(--t-ink)}
.theatre label{display:block;font-size:13px;text-align:left;margin-top:12px}
.theatre [role=status]{font-size:13px;margin-top:12px}
.theatre [role=status]:empty{display:none}
.theatre h1:focus{outline:none}
@media(max-width:359px){.theatre-ending .theatre-actions{grid-template-columns:minmax(0,1fr)}}
@media(hover:hover) and (pointer:fine){
  .theatre button:hover{transform:translateY(-2px)}
  .theatre button.theatre-primary:hover{background:var(--t-action-hover);transform:none}
  .theatre .theatre-secondary-actions button:hover,.theatre .theatre-ending-links button:hover{color:var(--t-action);transform:none}
  .theatre-choices>button:hover{background:var(--t-cream);transform:none}
}
@media(min-width:640px){
  .theatre{padding:24px 28px 64px}
  .theatre-intro{grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);align-items:center;gap:32px;padding:12px 0 32px}
  .theatre-intro .theatre-cast{gap:12px}
  .theatre-intro .theatre-cast figure{width:76px}
  .theatre-intro .theatre-cast img{height:90px}
  .theatre-episodes{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
  .theatre-cover{height:230px}
  .theatre-stage>img{height:320px}
  .theatre-stage .theatre-player{width:70px}
  .theatre-stage .theatre-player img{height:80px}
  .theatre-ending{padding:28px 40px 24px}
  .theatre-ending-copy{font-size:18px}
  .theatre-ending .theatre-actions{max-width:440px;margin:24px auto 0}
}
@media(min-width:960px){
  .theatre-comic{grid-template-columns:minmax(0,.95fr) minmax(0,1fr);gap:36px}
  .theatre-scene-column{position:sticky;top:104px}
  .theatre-stage>img{height:auto;min-height:300px}
  .theatre-stage .theatre-player{width:80px}
  .theatre-stage .theatre-player img{height:90px}
  .theatre-line p{font-size:16px}
  .theatre-dialogue{gap:22px}
  .theatre-episode-copy{padding:24px 28px}
}
@media(prefers-reduced-motion:no-preference){
  #theatre-app[data-view=reaction] .theatre-dialogue{animation:theatre-reveal .24s ease-out both}
  #theatre-app[data-view=ending] .theatre-medal{animation:theatre-reveal .32s ease-out both}
  @keyframes theatre-reveal{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}
}
@media(prefers-reduced-motion:reduce){html:has(.theatre){scroll-behavior:auto}.theatre button{transition:none}.theatre button:hover,.theatre button:active{transform:none}}
