@font-face { font-family: "Courier Prime"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/courier-prime-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Courier Prime"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/courier-prime-latin-700-normal.woff2") format("woff2"); }
/* Same tokens as the other Doplic apps. --paper and --pen are the comic page itself: it stays white with black ink in both themes,
   because that is what gets printed and exported. --desk is the surface around the page in the editor. */
:root { --bg:#fdf4e8; --card:#fffaf2; --ink:#17302c; --muted:#516761; --line:#ead9c4; --accent:#f58a2c; --link:#a84a0e;
  --red:#b3261e; --green:#1f6b3a; --paper:#ffffff; --pen:#111111; --desk:#e9dcc8; --hi:#e8590c;
  --type:"Courier Prime","Courier New",monospace; --ui:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif; color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg:#1c1633; --card:#281f47; --ink:#f1ecf8; --muted:#b6acca; --line:#40356a; --accent:#ff9f6e; --link:#c9baff; --red:#ff8a80; --green:#7bdc9b; --desk:#120e22; --hi:#ff9f6e; } }
:root[data-theme="dark"] { color-scheme: dark; --bg:#1c1633; --card:#281f47; --ink:#f1ecf8; --muted:#b6acca; --line:#40356a; --accent:#ff9f6e; --link:#c9baff; --red:#ff8a80; --green:#7bdc9b; --desk:#120e22; --hi:#ff9f6e; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--ui); -webkit-text-size-adjust: 100%; }
a { color: var(--link); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- regular pages ---------- */
.wrap { max-width: 860px; margin: 0 auto; padding: 16px 18px 48px; }
.head { text-align: center; padding: 18px 0 8px; }
.hero { display: block; width: min(100%, 440px); margin: 0 auto 8px; }
.hero canvas { display: block; width: 100%; height: auto; }
.head h1 { font-family: var(--type); font-size: 2.1rem; margin: 0; letter-spacing: -.01em; text-wrap: balance; }
.head h1 a { color: inherit; text-decoration: none; }
.head h1.hero-h { line-height: 0; }
.hero-h .hero { margin-bottom: 4px; }
.tag { color: var(--muted); margin: 6px 0 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: 600 15px var(--ui); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn:focus-visible, a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
.btn.primary { background: #0a3cff; border-color: #0a3cff; color: #fff; }
.btn.small { min-height: 36px; padding: 4px 12px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.box { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin: 14px 0; line-height: 1.5; }
.box h2 { font-family: var(--type); font-size: 1.1rem; margin: 0 0 8px; }
.box p { margin: 4px 0; }

.starts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 18px 0; }
.start { display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: center; text-align: left; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; cursor: pointer; }
.start:hover:not([disabled]) { border-color: var(--accent); }
.start[disabled] { cursor: default; opacity: .65; }
.start b { display: block; font-family: var(--type); font-size: 1.05rem; }
.start small { display: block; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.start svg { width: 56px; height: 56px; color: var(--ink); }
.soon { display: inline-block; font: 600 .7rem var(--ui); padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); margin-left: 6px; vertical-align: 2px; }

.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; margin-top: 10px; }
.comic { display: grid; gap: 6px; text-decoration: none; color: inherit; background: none; border: 0; padding: 0; font: inherit; text-align: left; cursor: pointer; }
.comic .thumb { display: block; background: var(--paper); border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 2px 0 var(--line); width: 100%; object-fit: contain; }
.comic:hover .thumb { border-color: var(--accent); }
.comic .cap { font-size: .9rem; } .comic .meta { color: var(--muted); font-size: .8rem; }
.empty { display: grid; place-items: center; gap: 6px; padding: 22px 10px; color: var(--muted); text-align: center; border: 2px dashed var(--line); border-radius: 12px; }

.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.overlay .panel { background: var(--bg); color: var(--ink); border-radius: 16px; max-width: 440px; width: 100%; max-height: 90vh; overflow: auto; padding: 18px; display: grid; gap: 12px; }
.overlay h2 { font-family: var(--type); margin: 0; font-size: 1.3rem; }
.orient { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.orient button { display: grid; justify-items: center; gap: 8px; padding: 16px 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: 600 15px var(--ui); cursor: pointer; }
.orient button:hover { border-color: var(--accent); }
.orient i { display: block; background: var(--paper); border: 3px solid var(--pen); border-radius: 2px; }
.orient small { color: var(--muted); font-weight: 400; font-size: .82rem; }

/* ---------- the editor: full screen, no Doplic bar, no install banners ---------- */
body.editing { background: var(--desk); overflow: hidden; overscroll-behavior: none; }
body.editing #doplic-bar, body.editing #doplic-legal, body.editing .install-card, body.editing [id^="doplic-install"] { display: none !important; }
.ed { position: fixed; inset: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto auto; grid-template-columns: minmax(0, 1fr); }
.ed .stage { display: flex; align-items: center; justify-content: center; min-height: 0; padding: 10px; padding-top: max(10px, env(safe-area-inset-top)); }
.ed canvas { display: block; background: var(--paper); box-shadow: 0 2px 0 rgba(0,0,0,.35), 0 10px 26px rgba(0,0,0,.28); border-radius: 2px; touch-action: none; }
.bar { display: flex; gap: 6px; align-items: center; overflow-x: auto; padding: 8px 10px; padding-bottom: max(8px, env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); scrollbar-width: none; }
.bar::-webkit-scrollbar { display: none; }
.bar > * { flex: none; }
.tb { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; min-height: 44px; padding: 6px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: 600 14px var(--ui); cursor: pointer; }
.tb svg { width: 22px; height: 22px; flex: none; }
.bar .tb[data-t] { flex-direction: column; gap: 1px; padding: 4px 6px; min-width: 52px; font-size: 11px; }
.bar .tb[data-t] svg { width: 20px; height: 20px; }
@media (max-width: 700px) {
  .bar { flex-wrap: wrap; gap: 4px; padding: 6px; overflow: visible; }
  .bar .sep { display: none; }
  .bar .tb[data-x] { order: 0; min-width: 40px; min-height: 38px; padding: 4px 8px; }
  .bar .tb[data-x="done"] span { display: inline; }
  .bar .tb[data-x="undo"] span, .bar .tb[data-x="export"] span, .bar .tb[data-x="share"] span, .bar .tb[data-x="prev"] span, .bar .tb[data-x="next"] span { display: none; }
  .bar .tb[data-x="share"] { margin-right: auto; }
  .bar .pg { order: 0; min-width: 0; font-size: 12px; }
  .bar .saved { order: 0; font-size: 11px; min-width: 0; }
  .bar .brk { display: block; order: 1; flex-basis: 100%; height: 0; }
  .bar .tb[data-t] { order: 2; flex: 1 1 0; min-width: 0; padding: 4px 0; font-size: 10px; }
}
@media (max-width: 440px) {
  .bar .tb[data-x] { min-width: 36px; padding: 4px 6px; }
  .bar .tb[data-x="done"] { padding: 4px 8px 4px 4px; gap: 2px; }
  .bar .pg { font-size: 12px; }
  .bar .pg .pg-w { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .bar .pg .pg-s { display: inline; }
}

.tb[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tb[disabled] { opacity: .4; cursor: default; }
.brk { display: none; }
.sep { width: 1px; align-self: stretch; background: var(--line); margin: 4px 2px; }
.sw { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--line); padding: 0; cursor: pointer; }
.sw[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--hi); }
.sw.wheel { background: radial-gradient(circle, #fff 0 18%, transparent 62%), conic-gradient(from 90deg, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); }
.wheelbox { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; background: rgba(0,0,0,.35); }
.wheelpanel { width: min(100%, 420px); box-sizing: border-box; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 18px 18px 0 0; padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); display: grid; gap: 14px; }
.wrow { display: flex; align-items: center; justify-content: center; gap: 8px; }
.wfoot { justify-content: flex-start; flex-wrap: wrap; }
.wbright { display: grid; gap: 6px; font: 600 13px var(--ui); color: var(--muted); }
.wbright input { width: 100%; height: 26px; border-radius: 13px; -webkit-appearance: none; appearance: none; border: 1px solid var(--line); }
.wbright input::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 3px solid #111; }
.wbright input::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 3px solid #111; }
.wprev { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--line); }
.whex { font: 700 14px var(--type); }
.sw.drop { display: inline-flex; align-items: center; justify-content: center; background: var(--bg); color: var(--ink); }
.sw.drop svg, .drophint svg, .wdrop svg { width: 18px; height: 18px; }
.drophint { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); white-space: normal; }
.wdrop { display: inline-flex; align-items: center; gap: 6px; }
.ed canvas.dropping { cursor: crosshair; }
.ed .wheelbox canvas { background: none; box-shadow: none; border-radius: 50%; }
.size { width: 96px; accent-color: var(--hi); }
.pg { font: 700 13px var(--type); color: var(--muted); min-width: 64px; text-align: center; }
.pg-s { display: none; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 60px; max-height: 38vh; overflow-y: auto; padding: 8px 10px; background: var(--card); border-top: 1px solid var(--line); }
.sizer { display: inline-flex; align-items: center; gap: 8px; }
.szdot { display: inline-block; box-sizing: border-box; border-radius: 50%; border: 1px solid var(--muted); }
.btext { flex: 1 1 160px; }
.opts > * { flex: none; }
.olab { font: 700 12px var(--ui); color: var(--muted); margin: 0 2px 0 6px; }
.olab:first-child, .sizer .olab { margin-left: 0; }
.hint { font-size: 14px; color: var(--muted); white-space: nowrap; }
.chip { min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: 600 14px var(--ui); cursor: pointer; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.go { background: var(--hi); color: #fff; border-color: var(--hi); }
.chip.warn { color: var(--red); }
.chip.dim { opacity: .5; }
.th { padding: 3px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; line-height: 0; }
.th canvas { width: 48px; height: 48px; }
.th.wide canvas { width: 72px; height: 50px; border-radius: 6px; }
.th.lay { padding: 5px; }
.th.shp { touch-action: none; cursor: grab; }
#cv.dropok { cursor: copy; }
.th[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--hi); }
.btext { width: 190px; min-height: 40px; max-height: 80px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: 16px var(--ui); resize: none; }
.saved { font-size: 12px; color: var(--muted); min-width: 64px; }
#toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 9px 14px; border-radius: 999px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; text-align: center; z-index: 70; }
#toast.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }

/* ---------- Library page ---------- */
a.start { text-decoration: none; }
.btn svg { width: 22px; height: 22px; }
.btn.danger { background: #b3261e; border-color: #b3261e; color: #fff; }
.back { margin: 4px 0 0; }
.back a { color: var(--link); font-weight: 600; text-decoration: none; }
.libhead h1 { font-family: var(--type); font-size: 2rem; margin: 6px 0 4px; }
.libhead .row { margin: 12px 0 18px; }
.libgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.libitem { margin: 0; display: grid; gap: 6px; align-content: start; padding: 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); }
.libitem img { display: block; width: 100%; height: auto; max-height: 220px; object-fit: contain; background: #fff; border-radius: 6px; }
.libitem figcaption { display: grid; gap: 2px; font-size: 14px; }
.libitem .meta { color: var(--muted); font-size: 12px; }
.libitem .chip { justify-self: start; min-height: 36px; padding: 4px 12px; font-size: 13px; }

/* ---------- editor: pictures ---------- */
.th.lib { background: #fff; }
.th.lib img { display: block; width: 72px; height: 50px; object-fit: cover; border-radius: 6px; }
.opts .brk2 { flex-basis: 100%; height: 0; }

/* ---------- scan wizard ---------- */
.wz { position: fixed; inset: 0; z-index: 1000; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); background: var(--desk); color: var(--ink); }
.wz-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--card); border-bottom: 1px solid var(--line); }
.wz-t { font: 700 15px var(--ui); }
.wz-help { margin: 0; padding: 8px 14px; font-size: 14px; color: var(--ink); background: var(--card); border-bottom: 1px solid var(--line); }
.wz-main { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 12px; overflow: auto; }
.wz-cv { display: block; touch-action: none; border-radius: 2px; box-shadow: 0 6px 20px rgba(0,0,0,.3); }
.wz-body { width: 100%; max-width: 520px; align-self: start; }
.wz-make { display: grid; gap: 10px; }
.wz-make .muted { margin: 0 0 4px; }
.wz-opt { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.wz-opt input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--hi); }
.wz-opt b { display: block; font-size: 15px; }
.wz-opt small { display: block; margin-top: 3px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.wz-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); }
.wz-bar .go { margin-left: auto; min-width: 96px; }
.wz-busy { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.45); color: #fff; font: 700 18px var(--ui); }
.wz-busy[hidden], .wz-body[hidden], .wz-cv[hidden], .wz-help[hidden] { display: none; }

/* Export sheet */
.xp .panel { max-width: 480px; }
.xp-h { margin: 6px 0 0; font: 700 16px var(--ui); }
.xp-p { margin: 0; font-size: 14px; }
.xp-row { display: flex; flex-wrap: wrap; gap: 8px; }
.xp-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 4px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 600; }
.xp-chip:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.xp-status { margin: 0; min-height: 1.2em; font-size: 14px; color: var(--ink); }
/* sharing and keeping comics in the account */
.sh-title { display: grid; gap: 4px; font-weight: 700; }
.sh-title input { font: 400 16px var(--ui); padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.cf-opts { display: grid; gap: 8px; }
.cf-opts .btn { display: grid; justify-items: start; justify-content: stretch; text-align: left; border-radius: 14px; padding: 10px 14px; gap: 2px; }
.cf-opts .btn small { font-weight: 400; opacity: .8; }
.flag { display: inline-block; margin-top: 2px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #fff3bf; color: #5c3c00; }
.note-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--accent); background: var(--card); margin-bottom: 12px; }
.note-bar p { margin: 0; flex: 1 1 240px; }
.usage { margin: 10px 0 0; font-size: 13px; }
.xp .wz-opt input { accent-color: var(--accent); }

/* PDF page picker */
.pi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; max-height: 50vh; overflow: auto; }
.pi-pg { display: grid; gap: 4px; justify-items: center; padding: 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: 600 13px var(--ui); cursor: pointer; }
.pi-pg:hover { border-color: var(--accent); }
.pi-pg canvas { width: 100%; height: auto; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
