@font-face { font-family: Inter; src: url(/fonts/InterVariable.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url(/fonts/jbmono-sub.woff2) format("woff2"); font-display: swap; }

:root {
  --ink: #0A0A0A; --paper: #F7F7F5; --iris: #7B73FF; --iris-text: #4A41D6; --mist: #A8BCD0; --white: #fff;
  --line: 3px solid var(--ink);
  --dots-mist: radial-gradient(var(--mist) 34%, transparent 36%);
  --dots-iris: radial-gradient(var(--iris) 34%, transparent 36%);
  --dots-ink: radial-gradient(var(--ink) 26%, transparent 28%);
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --spring: cubic-bezier(.2, 1.5, .4, 1);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.5 Inter, system-ui, sans-serif; }
h1, h2, p, ol { margin: 0; }
ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--iris-text); outline-offset: 2px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -60px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 5; }
.skip:focus { top: 8px; }
.note { font-size: 14px; color: #3c3c3a; max-width: 62ch; }

.mast { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 16px clamp(16px, 4vw, 40px) 12px; max-width: 1320px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--iris-text); }
.brand-mark { width: 30px; height: 26px; }
.brand-word { font-weight: 800; font-size: 22px; letter-spacing: -.04em; color: var(--ink); }
.flag { font: 12px/1.4 var(--mono); padding: 5px 10px; border: 2px dashed var(--iris-text); color: var(--iris-text); }
.flag[data-mode=live] { background: var(--ink); color: var(--paper); border: 2px solid var(--ink); }

.notice { max-width: 1320px; margin: 0 auto 8px; padding: 10px clamp(16px, 4vw, 40px); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: var(--ink); color: var(--paper); font-weight: 600; font-size: 14px; }
.notice p { flex: 1 1 280px; max-width: 80ch; }
.notice .ghost { border-color: var(--paper); }
.notice .ghost:hover { background: var(--paper); color: var(--ink); }

.rack { display: flex; gap: 8px; align-items: stretch; padding: 0 clamp(16px, 4vw, 40px) 8px; max-width: 1320px; margin: 0 auto; }
.rack ol { display: flex; gap: 8px; overflow-x: auto; flex: 1; padding: 4px 3px 8px; scrollbar-width: thin; }
.rack li { flex: none; }
.issue-tab { display: grid; gap: 1px; text-align: left; background: none; border: 2px solid transparent; border-bottom-color: #c9c9c4; padding: 6px 12px; min-height: 48px; max-width: 240px; cursor: pointer; }
.issue-tab span:first-child { font: 11px/1.3 var(--mono); color: #4a4a47; }
.issue-tab span:nth-child(2) { font-weight: 600; font-size: 14px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.issue-tab .tab-post { font-size: 12px; color: #4a4a47; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab-link { display: block; font-size: 12px; padding: 2px 12px; color: #4A41D6; }
.issue-tab:hover { border-bottom-color: var(--ink); }
.issue-tab[aria-current=true] { border: 2px solid var(--ink); background: var(--white); }

.ghost, .solid { min-height: 44px; padding: 8px 14px; font-weight: 600; font-size: 14px; cursor: pointer; border: 2px solid var(--ink); transition: transform .12s, background .12s, color .12s; }
.ghost { background: transparent; }
.ghost:hover { background: var(--ink); color: var(--paper); }
.solid { background: var(--ink); color: var(--paper); }
.solid:hover { background: var(--iris-text); border-color: var(--iris-text); }
.solid:active, .ghost:active { transform: translateY(1px); }
.solid:disabled { opacity: .6; cursor: wait; }

main { max-width: 1320px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px) 64px; }

.cover { display: grid; grid-template-columns: 1fr auto; gap: 0 24px; align-items: end; padding: 14px 0 18px; }
.issue { grid-column: 1 / -1; font: 13px var(--mono); color: var(--iris-text); }
.title { width: 100%; min-width: 0; background: none; border: 0; border-bottom: 3px solid transparent; font-weight: 800; font-size: clamp(30px, 5vw, 60px); line-height: 1.08; letter-spacing: -.04em; padding: 2px 0; }
.title:hover { border-bottom-color: #d6d6d1; }
.title:focus { outline: 0; border-bottom-color: var(--iris-text); }
.cover-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 6px; justify-content: flex-end; }
.saved { font: 12px var(--mono); color: #4a4a47; min-width: 11ch; }
.saved[data-bad] { color: #a0160f; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; cursor: pointer; min-height: 44px; }
.switch input { position: absolute; left: 0; top: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.track { width: 44px; height: 26px; border: 2px solid var(--ink); background: var(--white); position: relative; transition: background .15s; }
.track::after { content: ""; position: absolute; left: 2px; top: 2px; width: 18px; height: 18px; background: var(--ink); transition: transform .18s var(--spring); }
.switch input:checked + .track { background: var(--iris); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 3px solid var(--iris-text); outline-offset: 2px; }

/* The comic page */
.page { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; outline: 0; }
.panel { position: relative; border: 4px solid var(--ink); background: var(--white); min-height: 430px; padding: 54px 16px 168px; overflow: hidden; display: flex; flex-direction: column; gap: 14px; grid-column: span var(--span, 4); isolation: isolate; }
.panel.in { animation: ink-in .5s cubic-bezier(.2, .8, .2, 1) backwards; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes ink-in { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.panel::before { content: ""; position: absolute; z-index: -1; right: 0; bottom: 0; width: 72%; height: 54%; background-image: var(--dots-mist); background-size: 13px 13px; -webkit-mask-image: linear-gradient(to top left, #000 30%, transparent 78%); mask-image: linear-gradient(to top left, #000 30%, transparent 78%); }
.panel-fan::before { right: auto; left: 0; -webkit-mask-image: linear-gradient(to top right, #000 30%, transparent 78%); mask-image: linear-gradient(to top right, #000 30%, transparent 78%); }
.panel-psst { background: var(--ink); color: var(--paper); }
.panel-psst::before { background-image: var(--dots-iris); }
.panel-shout { background: var(--iris); }
.panel-shout::before { background-image: var(--dots-ink); opacity: .55; }

.caption { position: absolute; left: -1px; top: -1px; display: grid; background: var(--mist); color: var(--ink); border: 3px solid var(--ink); border-left: 0; border-top: 0; padding: 5px 11px 6px; font: 12px/1.35 var(--mono); max-width: calc(100% - 44px); }
.caption b { font-weight: 400; text-transform: uppercase; letter-spacing: .02em; }
.caption small { font-size: 11px; color: #1f2b36; }
.panel-remove { position: absolute; top: 2px; right: 2px; width: 44px; height: 44px; background: transparent; border: 0; cursor: pointer; color: inherit; font-size: 20px; line-height: 1; display: grid; place-items: center; }
.panel-remove:hover { background: var(--ink); color: var(--paper); }
.panel-psst .panel-remove:hover, .panel-shout .panel-remove:hover { background: var(--paper); color: var(--ink); }

.balloon { position: relative; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: 26px; padding: 12px 16px; z-index: 1; }
.balloon textarea { display: block; width: 100%; border: 0; background: none; resize: none; overflow: hidden; outline: 0; padding: 0; min-height: 1.5em; }
.balloon:focus-within { box-shadow: 0 0 0 3px var(--iris-text); }
.panel-psst .balloon:focus-within { box-shadow: 0 0 0 3px var(--paper); }
.tail { position: absolute; bottom: -29px; width: 44px; height: 32px; overflow: visible; }
.tail path { fill: var(--paper); stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; }
.tail-left { left: 40px; }
.tail-right { right: 26px; transform: scaleX(-1); }
.balloon-word textarea { font-weight: 800; font-size: clamp(24px, 2.5vw, 34px); line-height: 1.12; letter-spacing: -.03em; }
.balloon-word { border-radius: 34px; }

.balloon-whisper { border-style: dashed; }
.balloon-whisper .tail path { stroke-dasharray: 5 3; }
.panel-psst .balloon-whisper { border-color: var(--iris); }
.panel-psst .tail path { stroke: var(--iris); }

.burst { position: relative; padding: 38px 34px; z-index: 1; color: var(--ink); filter: drop-shadow(0 0 0 var(--ink)); }
.burst::before, .burst::after { content: ""; position: absolute; clip-path: polygon(50% 0, 58% 11%, 71% 2%, 75% 15%, 92% 9%, 89% 25%, 100% 32%, 92% 44%, 100% 58%, 90% 65%, 95% 83%, 79% 81%, 73% 97%, 60% 87%, 49% 100%, 40% 87%, 25% 97%, 22% 81%, 5% 85%, 10% 66%, 0 56%, 8% 44%, 0 30%, 12% 25%, 9% 8%, 26% 14%, 31% 2%, 42% 11%); }
.burst::before { inset: 0; background: var(--ink); }
.burst::after { inset: 5px; background: var(--paper); }
.burst textarea { position: relative; z-index: 1; display: block; width: 100%; border: 0; background: none; resize: none; overflow: hidden; font-weight: 700; text-align: center; line-height: 1.25; outline: 0; padding: 0; }
.burst:focus-within::after { background: var(--white); }
.burst:focus-within textarea { outline: 3px solid var(--iris-text); outline-offset: 3px; }

.meta { display: flex; align-items: center; justify-content: flex-start; gap: 12px; flex-wrap: wrap; font: 12px var(--mono); position: relative; z-index: 1; margin-top: 2px; }
.chip { background: none; border: 1.500px solid currentColor; color: inherit; font: 12px var(--mono); padding: 5px 10px; min-height: 44px; cursor: pointer; }
.chip:hover { background: var(--ink); color: var(--paper); }
.panel-psst .chip { background: var(--ink); }
.panel-psst .chip:hover { background: var(--paper); color: var(--ink); }
.err { font: 500 13px/1.35 Inter, sans-serif; color: #a0160f; background: var(--white); padding: 2px 6px; position: relative; z-index: 2; }
.err:empty { display: none; }
.balloon + .err { margin-top: 22px; }

.scope { position: relative; z-index: 2; display: grid; gap: 6px; font-size: 13px; margin-top: 16px; }
.scope select, .scope > input { background: var(--white); border: 2px solid var(--ink); padding: 6px 8px; min-height: 44px; width: 100%; font-size: 14px; }
.scope-note { background: var(--white); padding: 2px 6px; width: fit-content; }
.scope-note:empty { display: none; }
.post-picker { display: grid; gap: 6px; justify-items: start; }
.post-picker .chip { background: var(--white); color: var(--ink); }
.post-list { display: grid; width: 100%; max-height: 260px; overflow-y: auto; background: var(--white); }
.post-list:empty { display: none; }
.post { border-bottom: 1px solid #d6d6d1; padding: 4px 8px; line-height: 1.3; }
.post span { min-width: 0; overflow-wrap: anywhere; }
.post small { display: block; font: 11px var(--mono); color: #4a4a47; }
.scope label { font: 12px var(--mono); }

.ask { display: grid; gap: 4px; z-index: 1; position: relative; margin-bottom: 18px; }
.ask label { font: 12px var(--mono); }
.ask input { width: 100%; min-height: 44px; border: 0; background: none; font-weight: 700; outline: 0; padding: 0; }
.ask .balloon { padding: 0 14px; border-radius: 20px; }
.ask .tail-left { left: 24px; }

.peep-btn { position: absolute; bottom: -10px; width: 170px; height: 170px; padding: 0; border: 0; background: none; cursor: pointer; z-index: 0; transform-origin: 50% 100%; }
.peep-btn img { display: block; width: 100%; height: 100%; }
.peep-fan { left: 2px; }
.peep-you { right: 2px; }
.peep-you img { transform: scaleX(-1); }
.peep-btn:hover { translate: 0 -4px; }
.peep-btn:focus-visible { outline-offset: -4px; }
.peep-btn.hop { animation: hop .26s var(--spring); }
@keyframes hop { 40% { transform: translateY(-9px) rotate(-1.5deg); } }
.panel-psst .peep-btn::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--paper); z-index: -1; }
.panel-followup .peep-btn { width: 130px; height: 130px; }

.sfx { --edge: var(--paper); --depth: var(--iris); position: absolute; z-index: 4; left: 46%; top: 62%; pointer-events: none; white-space: nowrap; font-weight: 900; font-size: clamp(52px, 7vw, 96px); line-height: 1; letter-spacing: -.04em; color: var(--ink); text-shadow: -3px -3px 0 var(--edge), 3px -3px 0 var(--edge), -3px 3px 0 var(--edge), 3px 3px 0 var(--edge), 0 -3px 0 var(--edge), 0 3px 0 var(--edge), -3px 0 0 var(--edge), 3px 0 0 var(--edge), 8px 8px 0 var(--depth); transform: translate(-50%, -50%) rotate(-8deg); animation: sfx 1.3s var(--spring) both; }
.sfx-iris { color: var(--iris); --depth: var(--mist); }
.sfx-ink { color: var(--ink); --depth: var(--iris); }
@keyframes sfx {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(-18deg) scale(.3); }
  22% { opacity: 1; transform: translate(-50%, -50%) rotate(-8deg) scale(1); }
  78% { opacity: 1; transform: translate(-50%, -50%) rotate(-6deg) scale(1.03); }
  100% { opacity: 0; transform: translate(-50%, -54%) rotate(-6deg) scale(1.08); }
}
.page.playing .panel { transition: filter .25s, opacity .25s; filter: grayscale(.8); opacity: .32; }
.page.playing .panel.lit { filter: none; opacity: 1; }
.panel.lit .peep-btn { animation: hop .3s var(--spring) 2; }

.add-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.add { flex: 1 1 260px; background: none; border: 3px dashed var(--ink); padding: 12px 14px; min-height: 56px; text-align: left; cursor: pointer; display: grid; font-weight: 700; transition: background .12s, color .12s; }
.add small { font: 12px var(--mono); }
.add:hover { background: var(--ink); color: var(--paper); }
.rule-note { margin-top: 10px; }

.try { margin-top: 44px; padding-top: 20px; border-top: 4px solid var(--ink); display: grid; gap: 12px; }
h2 { font-weight: 800; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.035em; line-height: 1.12; }
.try-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.field { display: grid; gap: 4px; }
.field.grow { flex: 1 1 260px; }
.field label { font: 12px var(--mono); }
.field input, .field select { min-height: 44px; border: 2px solid var(--ink); background: var(--white); padding: 8px 10px; width: 100%; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; cursor: pointer; }
.gate-check { position: relative; z-index: 1; align-items: flex-start; margin-top: 14px; padding-top: 12px; border-top: 2px dashed var(--ink); min-height: 0; }
.gate-check span { display: grid; gap: 2px; }
.gate-check b { font: 12px var(--mono); text-transform: uppercase; letter-spacing: .02em; font-weight: 400; }
.gate-check small { font-size: 13px; }
.gate-label { position: relative; z-index: 1; font: 12px var(--mono); margin: 12px 0 4px; }
.balloon-notyet { background: var(--paper); }
.check input { flex: none; width: 24px; height: 24px; margin: 0; accent-color: var(--iris-text); }
.verdict { min-height: 24px; display: grid; gap: 8px; max-width: 72ch; }
.verdict p:first-child { font-weight: 600; }
.verdict .out { border: 3px dashed var(--iris-text); border-radius: 18px; padding: 10px 14px; background: var(--white); white-space: pre-wrap; overflow-wrap: anywhere; }
.verdict .out small { display: block; font: 12px var(--mono); color: var(--iris-text); }

.back { margin-top: 44px; padding-top: 20px; border-top: 4px solid var(--ink); display: grid; gap: 12px; }
.today { font-size: clamp(17px, 2vw, 21px); letter-spacing: -.01em; max-width: 60ch; }
.ledger { display: grid; }
.ledger li { display: grid; grid-template-columns: 92px 1fr auto; gap: 12px; padding: 8px 0; border-bottom: 1px solid #d6d6d1; font-size: 14px; align-items: baseline; }
.ledger time, .ledger .tag { font: 12px var(--mono); color: #4a4a47; }
.ledger .tag { color: var(--iris-text); }
.ledger li:has(.blank) { grid-template-columns: 1fr; }
.ledger .blank { display: block; color: #4a4a47; }

.wiring { margin-top: 36px; border: 3px solid var(--ink); background: var(--white); }
.wiring summary { cursor: pointer; font-weight: 700; padding: 14px 16px; min-height: 48px; }
.wiring-body { padding: 0 16px 16px; display: grid; gap: 10px; font-size: 14px; }
#wiring-body { padding: 0 16px 16px; display: grid; gap: 10px; font-size: 14px; }
#wiring-body code { font: 13px var(--mono); overflow-wrap: anywhere; }
#wiring-body ul { margin: 0; padding-left: 18px; }

.gate, .empty { padding: 40px 0; }
.gate h2, .panel-empty h2 { font-weight: 800; font-size: clamp(32px, 5vw, 56px); letter-spacing: -.04em; line-height: 1.05; margin-bottom: 14px; }
.gate form { display: grid; gap: 8px; max-width: 360px; }
.gate input { min-height: 44px; border: 2px solid var(--ink); padding: 8px 10px; background: var(--white); }
.panel-empty { min-height: 0; padding: 72px 24px 32px; max-width: 760px; align-items: flex-start; }
.panel-empty::before { width: 45%; height: 70%; }

dialog { border: 4px solid var(--ink); background: var(--paper); color: var(--ink); padding: 16px; max-width: min(1100px, calc(100vw - 24px)); max-height: calc(100vh - 24px); width: 100%; }
dialog::backdrop { background: rgb(10 10 10 / .7); }
.poster-head, .poster-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.poster-actions { justify-content: flex-start; margin-top: 12px; }
#poster-img { display: block; width: 100%; height: auto; margin-top: 12px; border: 1px solid #d6d6d1; }

@media (max-width: 900px) {
  .cover { grid-template-columns: 1fr; }
  .cover-actions { justify-content: flex-start; padding-top: 8px; }
  .panel { grid-column: span 12; min-height: 340px; }
  .peep-btn { width: 140px; height: 140px; }
  .panel { padding-bottom: 136px; }
  .panel-followup .peep-btn { width: 110px; height: 110px; }
  .ledger li { grid-template-columns: 76px 1fr; }
  .ledger .tag { grid-column: 2; }
  .try-form > * { flex: 1 1 100%; }
  .rack { flex-direction: column; }
  .cover-actions { gap: 8px; }
  .cover-actions .ghost { padding: 8px 10px; }
  .saved { flex-basis: 100%; }
  .rack .ghost { align-self: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
  .sfx { animation: none; opacity: 1; }
}
