:root {
  --ink: #171512;
  --paper: #f7f0de;
  --pink: #ef3c78;
  --blue: #49bdf2;
  --yellow: #ffd338;
  --red: #e8472e;
  --violet: #7455d7;
  --mint: #7fe0bd;
  --white: #fffdf7;
  --shadow: 5px 5px 0 var(--ink);
  --thin-shadow: 3px 3px 0 var(--ink);
  color-scheme: light;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { background: var(--paper); scroll-behavior: smooth; }
body { margin: 0; min-width: 0; overflow-x: hidden; color: var(--ink); background:
  radial-gradient(circle at 22% 10%, rgba(239,60,120,.12) 0 1px, transparent 2px) 0 0/17px 17px,
  var(--paper); font-family: "Arial Narrow", "Aptos Narrow", Impact, system-ui, sans-serif; }
button, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, textarea:focus-visible, a:focus-visible { outline: 4px solid var(--violet); outline-offset: 4px; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.skip-link { position: fixed; left: 12px; top: 12px; z-index: 99; padding: 10px 14px; background: var(--white); border: 3px solid var(--ink); transform: translateY(-180%); }
.skip-link:focus { transform: translateY(0); }
.sr-only { position: absolute!important; width: 1px!important; height: 1px!important; padding: 0!important; margin: -1px!important; overflow: hidden!important; clip: rect(0,0,0,0)!important; white-space: nowrap!important; border: 0!important; }

.app { width: min(1420px, 100%); margin: 0 auto; padding: 18px clamp(14px, 2.6vw, 40px) 28px; }
.mast { min-height: 138px; display: grid; grid-template-columns: 86px minmax(430px, 1.2fr) minmax(250px, .65fr); gap: clamp(18px, 3vw, 48px); align-items: center; border-bottom: 5px solid var(--ink); }
.date-mark { display: grid; place-items: center; width: 76px; height: 76px; color: var(--ink); text-decoration: none; font-weight: 950; font-size: 1.25rem; letter-spacing: .04em; background: var(--yellow); border: 4px solid var(--ink); border-radius: 50%; box-shadow: var(--thin-shadow); transform: rotate(-8deg); }
.title-lockup { display: flex; align-items: end; gap: 20px; }
.kicker, .eyebrow { margin: 0; font: 800 .72rem/1.15 ui-monospace, "SFMono-Regular", Consolas, monospace; text-transform: uppercase; letter-spacing: .16em; }
.title-lockup .kicker { width: 105px; padding-bottom: 7px; }
h1 { margin: 0; text-transform: uppercase; font: 950 clamp(2.65rem, 5.1vw, 5.6rem)/.72 Impact, "Arial Black", sans-serif; letter-spacing: -.045em; }
h1 em { display: inline-block; color: var(--pink); font-style: normal; text-shadow: 2px 2px 0 var(--ink); transform: skew(-5deg); }
.mast .intro { max-width: 32ch; margin: 0; font: 750 clamp(1rem, 1.5vw, 1.24rem)/1.2 system-ui, sans-serif; }

.line-desk { display: grid; grid-template-columns: minmax(160px,.38fr) minmax(360px,1.25fr) minmax(170px,.35fr); gap: 18px; align-items: stretch; padding: 16px 0; border-bottom: 3px solid var(--ink); }
h2 { margin: 4px 0 0; font: 900 clamp(1rem, 1.8vw, 1.45rem)/1.05 system-ui, sans-serif; letter-spacing: -.03em; }
.line-copy p { margin: 6px 0 0; max-width: 30ch; font: 650 .78rem/1.25 system-ui, sans-serif; }
.sentence-wrap { display: flex; flex-direction: column; min-width: 0; background: var(--white); border: 3px solid var(--ink); box-shadow: var(--thin-shadow); }
#sentence { width: 100%; min-height: 60px; resize: none; overflow: auto; padding: 9px 12px 3px; border: 0; background: transparent; font: 800 clamp(.95rem, 1.6vw, 1.2rem)/1.2 system-ui, sans-serif; }
#sentence:focus { outline: 0; }
.sentence-wrap:focus-within { outline: 4px solid var(--violet); outline-offset: 3px; }
.sentence-foot { display: flex; justify-content: space-between; gap: 10px; padding: 1px 12px 7px; font: 750 .61rem/1 ui-monospace, monospace; text-transform: uppercase; letter-spacing: .08em; }
.split-line { min-height: 64px; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 15px; border: 3px solid var(--ink); background: var(--yellow); box-shadow: var(--thin-shadow); font: 900 .9rem/1 system-ui, sans-serif; text-transform: uppercase; text-align: left; }
.split-line span:last-child { font-size: 1.6rem; }
.split-line:hover { transform: translate(-1px,-1px); box-shadow: 5px 5px 0 var(--ink); }

.cast-bar { display: grid; grid-template-columns: minmax(230px,.5fr) minmax(500px,1fr); gap: 20px; align-items: center; padding: 13px 0; }
.cast-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cast-card { min-height: 62px; display: grid; grid-template-columns: 43px 1fr; gap: 10px; align-items: center; padding: 7px 10px; border: 3px solid var(--ink); background: var(--white); box-shadow: 2px 2px 0 var(--ink); text-align: left; }
.cast-card:hover, .cast-card[aria-pressed="true"] { transform: rotate(-1deg) translateY(-2px); box-shadow: 4px 4px 0 var(--ink); }
.cast-card strong, .cast-card small { display: block; }
.cast-card strong { font: 950 1rem/1 system-ui, sans-serif; text-transform: uppercase; }
.cast-card small { margin-top: 3px; font: 700 .67rem/1 system-ui, sans-serif; }
.mini-face { position: relative; display: block; width: 39px; height: 39px; border: 3px solid var(--ink); }
.mini-face i::before, .mini-face i::after { content: ""; position: absolute; width: 4px; height: 5px; top: 13px; border-radius: 50%; background: var(--ink); }
.mini-face i::before { left: 10px; } .mini-face i::after { right: 10px; }
.face-mara { background: var(--pink); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.face-oona { background: var(--blue); border-radius: 4px; }
.face-pip { background: var(--yellow); border-radius: 50%; }

.comic-section { border-top: 5px solid var(--ink); }
.comic-head { min-height: 66px; display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 9px 0; }
.key-hint { margin: 0; font: 700 .67rem/1.5 ui-monospace, monospace; text-align: right; }
kbd { display: inline-grid; min-width: 22px; height: 22px; place-items: center; margin: 0 2px; border: 2px solid var(--ink); border-bottom-width: 4px; border-radius: 3px; background: var(--white); font: inherit; }
.comic { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); border: 4px solid var(--ink); background: var(--ink); gap: 4px; box-shadow: 7px 7px 0 var(--ink); }
.panel { --panel-bg: var(--yellow); --accent: var(--pink); position: relative; min-width: 0; height: clamp(260px, 22.5vw, 340px); overflow: hidden; background: var(--panel-bg); isolation: isolate; cursor: pointer; }
.panel::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .22; background-image: radial-gradient(circle, var(--ink) 0 1px, transparent 1.5px); background-size: 12px 12px; transform: rotate(-3deg) scale(1.08); }
.panel.p0 { --panel-bg: #ffd338; --accent: #ef3c78; }
.panel.p1 { --panel-bg: #6bd5ff; --accent: #e8472e; }
.panel.p2 { --panel-bg: #ef6b45; --accent: #fff0a4; }
.panel.p3 { --panel-bg: #82dfbd; --accent: #7455d7; }
.panel.p4 { --panel-bg: #c6a5ff; --accent: #ffdd38; }
.panel.p5 { --panel-bg: #ff86aa; --accent: #4ad1df; }
.panel.selected { z-index: 2; outline: 7px solid var(--white); outline-offset: -12px; }
.panel.selected::after { content: "SELECTED"; position: absolute; right: 8px; bottom: 62px; padding: 4px 6px; color: var(--white); background: var(--ink); font: 900 .54rem/1 ui-monospace, monospace; letter-spacing: .12em; transform: rotate(-3deg); }
.panel.active { z-index: 3; outline: 9px solid var(--white); outline-offset: -14px; }
.panel-number { position: absolute; z-index: 7; left: 10px; top: 10px; display: grid; width: 34px; height: 34px; place-items: center; border: 3px solid var(--ink); border-radius: 50%; background: var(--white); font: 950 .73rem/1 ui-monospace, monospace; box-shadow: 2px 2px 0 var(--ink); }
.balloon { position: absolute; z-index: 5; left: 16%; top: 13px; width: 70%; min-height: 43%; display: grid; place-items: center; padding: 20px 19px 24px; border: 4px solid var(--ink); border-radius: 52% 48% 45% 50% / 48% 47% 53% 49%; background: var(--white); box-shadow: var(--thin-shadow); transform: rotate(-1.5deg); transition: left .25s ease, top .25s ease, width .25s ease, min-height .25s ease, transform .25s ease; }
.balloon::after { content: ""; position: absolute; left: var(--tail, 16%); bottom: -23px; width: 27px; height: 30px; background: var(--white); border-right: 4px solid var(--ink); border-bottom: 4px solid var(--ink); transform: skew(-28deg) rotate(28deg); }
.balloon p { max-width: 100%; margin: 0; overflow-wrap: anywhere; font: 950 clamp(1.05rem, 2.35vw, 2.15rem)/.92 Impact, "Arial Black", sans-serif; text-align: center; text-transform: none; letter-spacing: -.02em; }
.delivery-mutter .balloon { left: 34%; top: 47px; width: 48%; min-height: 30%; padding: 13px 12px 18px; border-width: 3px; border-radius: 50%; box-shadow: 2px 2px 0 var(--ink); transform: rotate(2deg); }
.delivery-mutter .balloon p { font-family: Georgia, serif; font-size: clamp(.75rem, 1.4vw, 1.16rem); font-weight: 700; font-style: italic; line-height: 1.02; }
.delivery-bellow .balloon { left: 5%; top: 7px; width: 90%; min-height: 58%; padding: 23px 13px 27px; border-width: 6px; border-radius: 42% 48% 40% 52% / 47% 38% 55% 45%; box-shadow: 6px 6px 0 var(--ink); transform: rotate(-1deg); }
.delivery-bellow .balloon p { font-size: clamp(1.35rem, 3.25vw, 3.05rem); line-height: .83; text-transform: uppercase; }
.panel .balloon p.long-phrase { font-size: var(--fit-font-size); line-height: .94; }
.sound-lines { position: absolute; inset: 0; opacity: 0; background: repeating-conic-gradient(from 5deg at 52% 43%, transparent 0deg 8deg, var(--accent) 8deg 9deg, transparent 9deg 18deg); }
.delivery-bellow .sound-lines { opacity: .55; }
.stage { position: absolute; z-index: 4; left: 0; right: 0; bottom: 56px; height: 45%; transition: opacity .24s ease, transform .24s ease; }
.actor { --skin: #ffd0a7; --clothes: var(--pink); --body: 42px; position: absolute; left: calc(var(--actor-x, 50) * 1%); bottom: 0; width: var(--body); height: calc(var(--body) * 1.6); translate: -50% 0; transform-origin: 50% 100%; transition: left .3s ease, transform .25s ease, opacity .2s ease; }
.actor::before { content: ""; position: absolute; z-index: 2; left: 50%; top: 0; width: calc(var(--body) * .67); height: calc(var(--body) * .67); transform: translateX(-50%); border: 3px solid var(--ink); border-radius: 50%; background: var(--skin); }
.actor::after { content: ""; position: absolute; left: 50%; bottom: 0; width: var(--body); height: calc(var(--body) * 1.05); transform: translateX(-50%); border: 3px solid var(--ink); border-radius: 45% 45% 12% 12%; background: var(--clothes); }
.actor span::before, .actor span::after { content: ""; position: absolute; z-index: 3; top: calc(var(--body) * .23); width: 4px; height: 5px; border-radius: 50%; background: var(--ink); }
.actor span::before { left: calc(50% - 9px); } .actor span::after { right: calc(50% - 9px); }
.actor.mara { --clothes: var(--pink); }
.actor.mara::before { border-radius: 48% 48% 55% 55%; clip-path: polygon(50% 0, 97% 100%, 3% 100%); background: #f6b998; }
.actor.oona { --clothes: #269bcf; }
.actor.oona::before { border-radius: 12%; background: #8b5b38; }
.actor.pip { --clothes: #f5b800; }
.actor.pip::before { background: #efd6be; }
.actor.speaking { transform: scale(1.12) translateY(-2px); }
.delivery-mutter .actor.speaking { transform: scale(.88) translateY(3px) rotate(-4deg); }
.delivery-bellow .actor.speaking { transform: scale(1.38) translateY(-1px); }
.delivery-bellow .actor.listener { transform: scale(.83) translateX(var(--flinch, 5px)) rotate(4deg); }
.actor.reacting::before { box-shadow: 0 -5px 0 var(--accent); }
.actor.reaction-stunned span::after { width: 8px; height: 8px; right: calc(50% - 4px); top: calc(var(--body) * .38); border: 2px solid var(--ink); background: transparent; }
.actor.reaction-delighted { transform: translateY(-8px) rotate(5deg); }
.actor.reaction-delighted::after { border-radius: 50% 50% 12% 12%; }
.actor.reaction-suspicious { transform: rotate(-8deg); }
.actor.reaction-suspicious::before { border-top-width: 7px; }
.comic.is-performing .panel:not(.is-performed) .balloon,
.comic.is-performing .panel:not(.is-performed) .sound-lines { opacity: 0; transform: scale(.18) rotate(-7deg); }
.comic.is-performing .panel:not(.is-performed) .stage { opacity: 0; transform: translateY(32px); }
.comic.is-performing .panel:not(.is-performed) .actor { opacity: 0; }
.panel-controls { position: absolute; z-index: 8; left: 0; right: 0; bottom: 0; height: 56px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 4px; background: var(--ink); }
.panel-controls button { min-width: 0; min-height: 44px; border: 0; background: var(--white); font: 900 .72rem/1 system-ui, sans-serif; text-transform: uppercase; }
.panel-controls button:hover { background: var(--accent); }

.final-desk { display: grid; grid-template-columns: minmax(470px,1fr) minmax(320px,.72fr); gap: 18px; margin-top: 22px; }
.reaction-picker { padding: 17px; border: 4px solid var(--ink); background: var(--blue); box-shadow: var(--thin-shadow); }
.reaction-buttons { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-top: 13px; }
.reaction-buttons button { min-height: 48px; border: 3px solid var(--ink); background: var(--white); font: 850 .77rem/1 system-ui, sans-serif; }
.reaction-buttons button[aria-pressed="true"] { background: var(--yellow); box-shadow: 3px 3px 0 var(--ink); transform: translate(-1px,-1px); }
.finish-actions { display: grid; grid-template-columns: 1.1fr .9fr; gap: 10px; }
.perform, .download { min-height: 92px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; padding: 15px; border: 4px solid var(--ink); box-shadow: var(--thin-shadow); font-weight: 950; text-transform: uppercase; text-align: left; }
.perform { background: var(--pink); color: var(--white); font-size: 1.05rem; }
.perform span:last-child { align-self: flex-end; font-size: 1.5rem; }
.download { background: var(--yellow); }
.download span:last-child { font: 800 .63rem/1 ui-monospace, monospace; }
.status { grid-column: 1 / -1; margin: 0; min-height: 24px; padding: 8px 12px; color: var(--white); background: var(--ink); font: 700 .72rem/1.2 ui-monospace, monospace; }
footer { display: flex; justify-content: space-between; gap: 16px; margin-top: 24px; padding-top: 12px; border-top: 3px solid var(--ink); font: 800 .64rem/1.2 ui-monospace, monospace; text-transform: uppercase; letter-spacing: .08em; }

.nojs { max-width: 1250px; margin: 0 auto; padding: 28px 22px; }
.nojs header { display: grid; grid-template-columns: 1fr 2fr 1fr; align-items: end; gap: 24px; padding-bottom: 20px; border-bottom: 5px solid var(--ink); }
.nojs header p { margin: 0; font-weight: 800; }
.nojs-comic { display: grid; grid-template-columns: repeat(3,1fr); gap: 4px; margin-top: 20px; padding: 4px; background: var(--ink); box-shadow: var(--shadow); }
.nojs-comic article { min-height: 230px; display: grid; grid-template-rows: auto 1fr auto; padding: 15px; border: 0; background: var(--yellow); }
.nojs-comic article:nth-child(2) { background: var(--blue); }.nojs-comic article:nth-child(3) { background: #ef6b45; }.nojs-comic article:nth-child(4) { background: var(--mint); }.nojs-comic article:nth-child(5) { background: #c6a5ff; }.nojs-comic article:nth-child(6) { background: #ff86aa; }
.nojs-comic p { align-self: center; margin: 10px; padding: 17px; border: 4px solid var(--ink); border-radius: 50%; background: var(--white); font: 950 clamp(1.1rem,2.7vw,2.2rem)/.9 Impact, sans-serif; text-align: center; }
.nojs-comic span { font-weight: 900; }
.nojs-note { max-width: 55ch; margin: 26px auto; font: 750 1rem/1.4 system-ui, sans-serif; text-align: center; }

@media (max-width: 900px) {
  .app { padding: 12px 12px 24px; }
  .mast { min-height: 0; grid-template-columns: 58px 1fr; gap: 12px; padding-bottom: 12px; }
  .date-mark { width: 54px; height: 54px; border-width: 3px; font-size: .92rem; }
  .title-lockup { display: block; }
  .title-lockup .kicker { width: auto; margin-bottom: 7px; }
  h1 { font-size: clamp(2.3rem, 11vw, 4.2rem); line-height: .77; }
  .mast .intro { grid-column: 2; font-size: .89rem; }
  .line-desk { grid-template-columns: 1fr auto; gap: 9px; }
  .line-copy { grid-column: 1 / -1; }
  .line-copy p { display: inline; }
  .sentence-wrap { min-width: 0; }
  .split-line { width: 68px; justify-content: center; padding: 8px; }
  .split-line span:first-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .cast-bar { grid-template-columns: 1fr; gap: 9px; }
  .cast-bar > div:first-child h2 { display: none; }
  .cast-list { gap: 6px; }
  .cast-card { min-height: 52px; grid-template-columns: 35px 1fr; gap: 6px; padding: 5px; }
  .mini-face { width: 32px; height: 32px; border-width: 2px; }
  .mini-face i::before, .mini-face i::after { top: 10px; }
  .cast-card small { display: none; }
  .comic-head { min-height: 55px; }
  .key-hint { display: none; }
  .comic { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 3px; border-width: 3px; box-shadow: 4px 4px 0 var(--ink); }
  .panel { height: clamp(245px, 76vw, 315px); }
  .balloon { left: 12%; width: 79%; padding-left: 11px; padding-right: 11px; }
  .balloon p { font-size: clamp(.92rem, 5.1vw, 1.45rem); }
  .delivery-mutter .balloon { left: 29%; width: 62%; }
  .delivery-mutter .balloon p { font-size: clamp(.7rem, 3vw, .98rem); }
  .delivery-bellow .balloon { left: 4%; width: 92%; }
  .delivery-bellow .balloon p { font-size: clamp(1.05rem, 6.4vw, 1.85rem); }
  .actor { --body: 32px; }
  .panel.selected::after { bottom: 61px; }
  .final-desk { grid-template-columns: 1fr; }
  .reaction-picker { padding: 13px; }
  .finish-actions { grid-template-columns: 1fr 1fr; }
  .perform, .download { min-height: 80px; padding: 11px; font-size: .76rem; }
  footer { display: grid; font-size: .58rem; }
  .nojs header { grid-template-columns: 1fr; }
  .nojs-comic { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .nojs-comic article { min-height: 220px; }
}

@media (max-width: 390px) {
  .app { padding-inline: 9px; }
  .sentence-foot { font-size: .53rem; }
  .cast-card strong { font-size: .82rem; }
  .panel { height: 282px; }
  .panel-number { width: 30px; height: 30px; left: 7px; top: 7px; }
  .actor { --body: 29px; }
  .panel-controls button { font-size: .62rem; }
  .reaction-buttons { grid-template-columns: 1fr; }
  .reaction-buttons button { min-height: 45px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media print {
  .mast, .line-desk, .cast-bar, .comic-head, .final-desk, footer { display: none; }
  .app { padding: 0; }
  .comic-section { border: 0; }
  .comic { box-shadow: none; }
  .panel { height: 33vh; }
  .panel-controls, .panel.selected::after { display: none; }
}
