/* Zine Press — 1984 desktop chrome (after ../newsroom), hand-drawn pages. */
@font-face { font-family: "Pixelify Sans"; src: url(/fonts/PixelifySans-Regular.woff) format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Pixelify Sans"; src: url(/fonts/PixelifySans-Bold.woff) format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "VT323"; src: url(/fonts/VT323-Regular.woff) format("woff"); font-display: swap; }
@font-face { font-family: "Patrick Hand"; src: url(/fonts/PatrickHand-Regular.ttf) format("truetype"); font-display: block; }
@font-face { font-family: "Gochi Hand"; src: url(/fonts/GochiHand-Regular.ttf) format("truetype"); font-display: block; }
@font-face { font-family: "Permanent Marker"; src: url(/fonts/PermanentMarker-Regular.ttf) format("truetype"); font-display: block; }

:root { --dither: repeating-conic-gradient(#000 0 25%, #fff 0 50%) 0 0 / 4px 4px; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: #fff; color: #000; font: 16px/1.3 "Pixelify Sans", monospace; }
body.editor { overflow: hidden; }
body.desk-bg, body.scan { background: var(--dither); min-height: 100%; }
button, input, select, textarea { font: inherit; color: #000; }
::selection { background: #000; color: #fff; }
a { color: #000; }
.hint { font-size: 13px; line-height: 1.35; opacity: .85; }
.big { font-size: 22px; }
.warn { border: 1px solid #000; padding: 6px 8px; background: #fff; box-shadow: 2px 2px 0 #000; }
.grow { flex: 1; }
.loading { display: grid; place-items: center; height: 100vh; background: var(--dither); }
.loading::after { content: ""; }

/* ── windows ── */
.win { background: #fff; border: 1px solid #000; box-shadow: 2px 2px 0 #000; display: flex; flex-direction: column; min-height: 0; }
.tbar { height: 20px; flex: none; border-bottom: 1px solid #000; display: flex; align-items: center; justify-content: center; user-select: none;
  background: repeating-linear-gradient(#fff 0 2px, #000 2px 3px) 0 1px / 100% 100%; }
.tbar .t { background: #fff; padding: 0 8px; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 90%; }
.win > .body { padding: 14px; }

/* ── controls ── */
.btn { background: #fff; border: 1px solid #000; border-radius: 6px; padding: 3px 10px; font: 14px "Pixelify Sans", monospace; cursor: pointer; white-space: nowrap; line-height: 1.3; text-decoration: none; display: inline-block; }
.btn:active, .btn.on { background: #000; color: #fff; }
.btn.default { box-shadow: 0 0 0 1px #fff, 0 0 0 3px #000; }
.btn.wide { width: 100%; padding: 5px 10px; margin-top: 6px; }
.btn.big { font-size: 18px; padding: 8px 16px; }
.btn:disabled { opacity: .4; cursor: default; }
.btn:focus-visible, .item:focus-visible { outline: 2px dotted #000; outline-offset: 2px; }
.row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.seg { display: flex; }
.seg .btn { flex: 1; border-radius: 0; margin-left: -1px; padding: 3px 4px; }
.seg .btn:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.seg .btn:last-child { border-radius: 0 6px 6px 0; }
.seg.wrap { flex-wrap: wrap; gap: 4px; }
.seg.wrap .btn { flex: 1 0 30%; border-radius: 6px; margin: 0; }
input[type=text], select, textarea:not(.txt) { width: 100%; background: #fff; border: 1px solid #000; padding: 4px 6px; font: 18px/1.2 "VT323", monospace; border-radius: 0; }
input[type=text]:focus, select:focus { outline: 2px solid #000; outline-offset: -2px; }
input[type=range] { width: 100%; accent-color: #000; }
label { display: block; font-size: 13px; margin: 8px 0 3px; }
label.chk { display: flex; gap: 4px; align-items: center; }

/* ── dialogs ── */
dialog.dlg { padding: 0; border: 1px solid #000; box-shadow: 3px 3px 0 #000; max-width: min(96vw, 560px); max-height: 94vh; background: #fff; }
dialog.dlg.wide { max-width: min(96vw, 980px); }
dialog.dlg[open] { display: flex; flex-direction: column; }
dialog.dlg:modal { overscroll-behavior: contain; }
dialog.dlg::backdrop { background: repeating-conic-gradient(rgba(0,0,0,.5) 0 25%, transparent 0 50%) 0 0 / 4px 4px; overflow: hidden; overscroll-behavior: contain; }
dialog .body { padding: 14px; overflow: auto; min-width: min(380px, 90vw); }
dialog .foot { display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding: 10px 14px; border-top: 1px dotted #000; margin: 0; }
dialog .foot .hint { margin-right: auto; }
.msg p:first-child { margin-top: 0; }
.linkrow { margin: 8px 0 12px; }
.linkrow .lbl { font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.linkrow .lbl small { font-weight: 400; opacity: .8; }
.linkrow .row { flex-wrap: nowrap; }
.linkrow input { flex: 1; min-width: 0; font-size: 16px; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: #fff; border: 1px solid #000; box-shadow: 2px 2px 0 #000; padding: 6px 14px; opacity: 0; transition: .2s; pointer-events: none; z-index: 100; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
pre.fold { font: 15px/1.15 "VT323", monospace; }

/* ── editor layout ── */
#app { height: 100%; }
#menubar { position: relative; z-index: 30; height: 24px; background: #fff; border-bottom: 1px solid #000; display: flex; align-items: stretch; padding-left: 6px; user-select: none; }
#menubar .logo { padding: 0 10px; display: flex; align-items: center; font-weight: 700; }
#menus { display: flex; }
.mt { border: 0; background: none; padding: 0 12px; font-size: 15px; cursor: default; }
.mt.open { background: #000; color: #fff; }
#menubar .right { margin-left: auto; display: flex; align-items: center; gap: 14px; padding-right: 10px; font-size: 14px; }
.dropdown { position: fixed; top: 24px; background: #fff; border: 1px solid #000; box-shadow: 2px 2px 0 #000; min-width: 230px; padding: 3px 0; z-index: 40; display: flex; flex-direction: column; }
.item { display: flex; justify-content: space-between; gap: 24px; padding: 3px 18px 3px 22px; border: 0; background: none; text-align: left; font-size: 15px; cursor: default; }
.item:hover:not(.dis) { background: #000; color: #fff; }
.item.dis { opacity: .35; }
.item .sc { opacity: .7; font-size: 13px; }
.sep { border-top: 1px dotted #000; margin: 3px 0; }
#desktop { height: calc(100vh - 24px); display: grid; grid-template-columns: 210px 1fr 270px; gap: 12px; padding: 12px; background: var(--dither); }
#w-page { min-width: 0; }
#tools { display: flex; gap: 4px; padding: 6px; border-bottom: 1px solid #000; flex-wrap: wrap; }
#tools .btn { padding: 2px 8px; }
#desk { flex: 1; position: relative; overflow: hidden; background: repeating-conic-gradient(#ddd 0 25%, #fff 0 50%) 0 0 / 8px 8px; touch-action: none; }
#stage { position: absolute; transform-origin: 0 0; }
#thumbs { flex: 1; overflow-y: auto; padding: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-content: start; }
.thumb { position: relative; border: 1px solid #000; background: #fff; padding: 0; cursor: pointer; aspect-ratio: 198 / 306; overflow: hidden; }
.thumb .tw { position: absolute; left: 0; top: 0; width: 198px; height: 306px; transform-origin: 0 0; transform: scale(var(--ts, .43)); pointer-events: none; }
.thumb .n { position: absolute; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid #000; font-size: 11px; text-align: center; line-height: 15px; }
.thumb.cur { outline: 2px solid #000; outline-offset: 2px; }
.thumb .dots { position: absolute; top: 3px; right: 3px; display: flex; gap: 2px; }
.sw { display: inline-block; width: 10px; height: 10px; border: 1px solid #000; border-radius: 50%; }
#side { flex: 1; overflow-y: auto; padding: 10px; font-size: 14px; }
.sec { border-top: 1px dotted #000; padding-top: 8px; margin-top: 8px; }
.sec.first { border-top: 0; padding-top: 0; margin-top: 0; }
.sec h3 { margin: 0 0 4px; font-size: 15px; }
#people { border-top: 1px solid #000; padding: 8px 10px; font-size: 13px; max-height: 30%; overflow-y: auto; }
#people .sec-t { font-weight: 700; margin-bottom: 4px; }
.person { display: flex; gap: 6px; align-items: center; }
.person small { opacity: .6; }

/* ── the zine page (1px = 1pt) ── */
.zpage { position: relative; background: #fff; overflow: hidden; color: #000; box-shadow: 0 0 0 1px #000; }
.zpage.live { box-shadow: 0 0 0 0.5px #000, 3px 3px 0 #000; overflow: visible; }
.zpage.live::after { content: ""; position: absolute; inset: 0; box-shadow: 0 0 0 9999px rgba(255,255,255,.55); pointer-events: none; z-index: 9000; }
.zpage[data-bg=graph] { background-image: linear-gradient(to bottom, transparent 11.5px, #cdcdcd 11.5px), linear-gradient(to right, transparent 11.5px, #cdcdcd 11.5px); background-size: 12px 12px; }
.zpage[data-bg=dots] { background-image: radial-gradient(circle at 5.5px 5.5px, #aaa 0.6px, transparent 0.9px); background-size: 11px 11px; }
.zpage .els, .zpage .pdeco, .zpage .over { position: absolute; inset: 0; }
.zpage .pdeco { pointer-events: none; z-index: 8000; }
.zpage .pdeco svg { position: absolute; left: 0; top: 0; overflow: visible; }
.zpage .els { z-index: 1; }
.zpage .over { z-index: 9500; pointer-events: none; }
.zpage.live .over .selbox, .zpage.live .over .hd, .zpage.live .over .rot { pointer-events: auto; }
.el { position: absolute; transform-origin: 50% 50%; }
.zpage.live .el { cursor: move; }
.el .dk { position: absolute; inset: 0; pointer-events: none; }
.el .dk svg { position: absolute; left: 0; top: 0; overflow: visible; }
.el .txt { position: absolute; inset: 0; white-space: pre-wrap; overflow-wrap: normal; word-break: normal; hyphens: none; font-kerning: normal; margin: 0; }
.el .txt[data-style=stamp] { text-transform: uppercase; letter-spacing: 1px; display: flex; flex-direction: column; justify-content: center; }
.el .txt[data-style=burst] { left: 19%; top: 19%; width: 62%; height: 62%; right: auto; bottom: auto; padding: 0 !important; display: flex; flex-direction: column; justify-content: center; }
textarea.txt.edit { border: 0; outline: none; background: rgba(255, 255, 140, .25); resize: none; overflow: hidden; color: #000; z-index: 2; cursor: text; display: block !important; }
.el canvas, .el img { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: auto; user-select: none; -webkit-user-drag: none; }
.el canvas, .el img.px { image-rendering: pixelated; }
.selbox { position: absolute; outline: calc(1px / var(--z, 2)) dashed #000; outline-offset: calc(2px / var(--z, 2)); transform-origin: 50% 50%; cursor: move; }
.selbox.editing { outline-style: solid; pointer-events: none !important; }
.hd { position: absolute; width: calc(9px / var(--z, 2)); height: calc(9px / var(--z, 2)); background: #fff; border: calc(1px / var(--z, 2)) solid #000; }
.hd[data-h=nw] { left: 0; top: 0; transform: translate(-50%, -50%); cursor: nwse-resize; }
.hd[data-h=ne] { right: 0; top: 0; transform: translate(50%, -50%); cursor: nesw-resize; }
.hd[data-h=sw] { left: 0; bottom: 0; transform: translate(-50%, 50%); cursor: nesw-resize; }
.hd[data-h=se] { right: 0; bottom: 0; transform: translate(50%, 50%); cursor: nwse-resize; }
.rot { position: absolute; left: 50%; top: calc(-18px / var(--z, 2)); width: calc(10px / var(--z, 2)); height: calc(10px / var(--z, 2)); border-radius: 50%; background: #000; transform: translate(-50%, -50%); cursor: grab; }
.remote-sel { position: absolute; border: calc(1.5px / var(--z, 2)) solid; transform-origin: 50% 50%; }
.remote-sel .tag, .rcursor .nm { position: absolute; font: calc(11px / var(--z, 2)) / 1.2 "Pixelify Sans", monospace; color: #fff; padding: 0 calc(4px / var(--z, 2)); white-space: nowrap; }
.remote-sel .tag { left: -1px; top: 0; transform: translateY(-100%); }
.rcursor { position: absolute; }
.rcursor .arrow { position: absolute; left: 0; top: 0; width: 0; height: 0; border-left: calc(5px / var(--z, 2)) solid currentColor; border-right: calc(5px / var(--z, 2)) solid transparent; border-bottom: calc(5px / var(--z, 2)) solid transparent; border-top: calc(9px / var(--z, 2)) solid currentColor; transform: rotate(-20deg); transform-origin: 0 0; }
.rcursor .nm { left: calc(9px / var(--z, 2)); top: calc(10px / var(--z, 2)); }

/* ── proof / history / share ── */
.proof .row { justify-content: center; margin-bottom: 8px; }
.proofwrap { display: grid; place-items: center; background: var(--dither); padding: 14px; border: 1px solid #000; }
.proofimg { max-height: 66vh; max-width: 100%; background: #fff; box-shadow: 3px 3px 0 #000; }
.proofwrap.small .proofimg { max-height: 50vh; }
.history { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; min-width: min(760px, 88vw); }
.hist { max-height: 60vh; overflow-y: auto; border: 1px solid #000; }
.histrow { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px dotted #000; background: #fff; padding: 5px 8px; font-size: 14px; cursor: pointer; }
.histrow.on, .histrow:hover { background: #000; color: #fff; }
.scanqr { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start; }
.qr svg { width: 220px; height: 220px; display: block; border: 1px solid #000; }

/* ── paint lab ── */
.paintlab .body { padding: 10px; }
.pl { display: grid; grid-template-columns: 220px 1fr; gap: 12px; min-height: min(70vh, 620px); }
.pl-tools { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.pl-tools .grid2 .btn { text-align: left; padding: 3px 6px; }
.pl-pats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; }
.pl-pats canvas { width: 100%; height: 22px; border: 1px solid #000; image-rendering: pixelated; cursor: pointer; }
.pl-pats canvas.on { outline: 2px solid #000; outline-offset: 1px; }
.pl-canvas { display: grid; place-items: center; background: var(--dither); border: 1px solid #000; min-width: min(560px, 60vw); overflow: auto; }
.pl-wrap { position: relative; background: repeating-conic-gradient(#e6e6e6 0 25%, #fff 0 50%) 0 0 / 12px 12px; box-shadow: 2px 2px 0 #000; border: 1px solid #000; }
.pl-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; touch-action: none; }
.pl-ghost { pointer-events: none; }
.pl-main { cursor: crosshair; }
.pl-others { font-size: 12px; }

/* ── stickers ── */
.stickers { min-width: min(820px, 90vw); }
.st-top { margin-bottom: 8px; }
.st-top .seg { width: 240px; }
.st-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.st-tabs .btn { font-size: 12px; padding: 2px 8px; }
.st-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; max-height: 56vh; overflow-y: auto; border: 1px solid #000; padding: 6px; background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 10px 10px; }
.st-grid.bw img { filter: grayscale(1) contrast(1.6); }
.st { aspect-ratio: 1; border: 1px solid transparent; background: none; padding: 2px; cursor: pointer; display: grid; place-items: center; }
.st:hover { border-color: #000; background: #fff; }
.st.busy { opacity: .4; }
.st img { max-width: 100%; max-height: 100%; }

/* ── scan flow (phone + import dialog) ── */
.scanwin { max-width: 640px; margin: 0 auto; min-height: 100vh; border-top: 0; }
@media (min-width: 700px) { .scanwin { margin: 20px auto; min-height: 0; } }
.sf { display: flex; flex-direction: column; gap: 6px; }
.sf-pick { display: flex; flex-direction: column; gap: 12px; align-items: stretch; padding: 20px 0; }
.sf-stage { position: relative; touch-action: none; line-height: 0; }
.sf-photo { width: 100%; height: auto; max-height: 62vh; object-fit: contain; display: block; }
.sf-quad { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.sf-quad polygon { fill: rgba(255, 255, 255, .15); stroke: #000; stroke-width: 3; vector-effect: non-scaling-stroke; stroke-dasharray: 6 4; }
.sf-h { position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; border: 2px solid #000; background: rgba(255, 255, 255, .8); box-shadow: 0 0 0 2px #fff; touch-action: none; cursor: grab; }
.sf-outwrap { display: grid; place-items: center; background: repeating-conic-gradient(#ddd 0 25%, #fff 0 50%) 0 0 / 14px 14px; border: 1px solid #000; padding: 8px; }
.sf-out { max-width: 100%; max-height: 52vh; }
.sf-bar { justify-content: space-between; margin-top: 8px; }
.sf-done { text-align: center; padding: 30px 0; }

/* ── landing, desk, reader ── */
main.landing, main.reader, main.desk { max-width: 860px; margin: 0 auto; padding: 40px 16px; }
main.landing { max-width: 620px; }
main.landing .body { font: 20px/1.4 "VT323", monospace; }
main.landing h1, main.landing h2 { font-family: "Pixelify Sans", monospace; }
.desk-top { margin-bottom: 14px; }
.ed { border: 1px solid #000; box-shadow: 2px 2px 0 #000; padding: 10px 12px; margin: 12px 0; }
.ed-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.ed-head .num { font-weight: 700; }
.ed-head .ttl { font-size: 18px; }
.ed-head .meta { font-size: 12px; opacity: .75; margin-left: auto; }
.ed-actions .btn { font-size: 13px; }
.creators { border-top: 1px dotted #000; margin-top: 18px; padding-top: 6px; }
.crow { margin: 4px 0; }
.crow span { flex: 1; }
.reader-bar { margin-bottom: 14px; justify-content: space-between; }
.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.pages figure { margin: 0; text-align: center; }
.pages img { width: 100%; height: auto; border: 1px solid #000; box-shadow: 2px 2px 0 #000; background: #fff; }
.pages figcaption { font-size: 12px; }
.howto { margin-top: 18px; font-size: 14px; }

@media (max-width: 900px) {
  #desktop { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; overflow-y: auto; }
  #w-pages { max-height: 150px; }
  #thumbs { grid-template-columns: repeat(8, 70px); }
  #w-page { min-height: 70vh; }
  .history, .scanqr, .pl { grid-template-columns: 1fr; }
}
