/* pdf.hosh.it. Everything is same-origin; the CSP allows no inline style element. */
@font-face { font-family: "Lato"; src: url("/fonts/Lato-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: block; }
@font-face { font-family: "Lato"; src: url("/fonts/Lato-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: block; }
@font-face { font-family: "Lato"; src: url("/fonts/Lato-Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: block; }
@font-face { font-family: "Lato"; src: url("/fonts/Lato-BoldItalic.ttf") format("truetype"); font-weight: 700; font-style: italic; font-display: block; }

:root {
  --bg: #eef0f4;
  --panel: #ffffff;
  --line: #d9dde5;
  --ink: #1d2433;
  --muted: #667085;
  --accent: #3448b0;
  --accent-ink: #ffffff;
  --accent-soft: #e6e9fb;
  --danger: #c0362c;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.18), 0 6px 18px rgba(16, 24, 40, 0.08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171f;
    --panel: #1e222d;
    --line: #343a4a;
    --ink: #e8ebf2;
    --muted: #9aa3b5;
    --accent: #8fa0ff;
    --accent-ink: #10131c;
    --accent-soft: #2a3157;
    --danger: #ff8a7f;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 6px 18px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.45; }
svg { width: 20px; height: 20px; display: block; }

.top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 6px; color: var(--accent); text-decoration: none; font-weight: 700; font-size: 17px; }
.brand svg { width: 24px; height: 24px; }
.brand small { font-weight: 500; font-size: 13px; color: var(--muted); }
.grow { flex: 1; }
.filename { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; max-width: 32vw; }
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 7px 14px; font-weight: 600; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.big { padding: 12px 28px; font-size: 16px; }
.group { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.icon, .zoom { border: 0; background: transparent; height: 34px; min-width: 34px; display: grid; place-items: center; font-size: 18px; }
.zoom { font-size: 13px; min-width: 54px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.icon:hover:not(:disabled), .zoom:hover { background: var(--accent-soft); }

.tools {
  display: flex;
  gap: 2px;
  padding: 4px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: thin;
}
.tools button {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px 4px;
  font-size: 12px;
  color: var(--muted);
  border-radius: 6px 6px 0 0;
  white-space: nowrap;
}
.tools button:hover { color: var(--ink); background: var(--accent-soft); }
.tools button.on { color: var(--accent); border-bottom-color: var(--accent); }

.work { flex: 1; display: flex; min-height: 0; }
.thumbs {
  width: 132px;
  overflow-y: auto;
  padding: 12px 10px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.thumbs:empty { display: none; }
.thumb { border: 0; background: transparent; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; }
.thumb canvas { width: 96px; height: auto; background: #fff; box-shadow: var(--shadow); outline: 2px solid transparent; outline-offset: 2px; }
.thumb.on canvas { outline-color: var(--accent); }

.stage { flex: 1; overflow: auto; min-width: 0; position: relative; }
.drop {
  max-width: 520px;
  margin: 8vh auto;
  padding: 36px 28px;
  text-align: center;
  background: var(--panel);
  border: 2px dashed var(--line);
  border-radius: 16px;
}
.drop svg { width: 64px; height: 64px; margin: 0 auto 8px; color: var(--accent); }
.drop h1 { margin: 0 0 6px; font-size: 26px; }
.drop p { margin: 6px 0 16px; color: var(--muted); }
.drop .hint { margin: 10px 0 18px; font-size: 13px; }
.drop .privacy { font-size: 13px; margin: 0; }
.drop .error { color: var(--danger); margin: 14px 0 0; }
body.dragging .drop, body.dragging .pages { outline: 3px dashed var(--accent); outline-offset: -8px; }

.pages { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 18px; width: max-content; min-width: 100%; }
.page { position: relative; background: #fff; box-shadow: var(--shadow); flex: none; }
.page canvas { display: block; width: 100%; height: 100%; }
.overlay { position: absolute; inset: 0; overflow: hidden; }
.overlay.create { cursor: crosshair; touch-action: none; }
.overlay.textcursor { cursor: text; }

/* existing text of the file: a dashed box, clicked to edit */
.piece { position: absolute; border: 1px dashed transparent; border-radius: 2px; cursor: text; }
.tool-select .piece { border-color: rgba(52, 72, 176, 0.35); }
.tool-select .piece:hover { border-color: #3448b0; background: rgba(52, 72, 176, 0.08); }
.overlay:not(.tool-select) .piece { pointer-events: none; }

.obj { position: absolute; border: 1px solid transparent; cursor: move; touch-action: none; }
.tool-select .obj:hover { border-color: rgba(52, 72, 176, 0.6); }
.overlay:not(.tool-select) .obj { pointer-events: none; }
.obj.sel { border-color: #3448b0; }
.handle {
  position: absolute;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  background: #fff;
  border: 2px solid #3448b0;
  border-radius: 50%;
  touch-action: none;
}
.handle.nw, .handle.se { cursor: nwse-resize; }
.handle.ne, .handle.sw { cursor: nesw-resize; }
.handle.p1, .handle.p2 { cursor: crosshair; }

.editor {
  position: absolute;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 1px solid #3448b0;
  outline-offset: 2px;
  background: transparent;
  resize: none;
  overflow: hidden;
  white-space: pre;
  caret-color: #3448b0;
}
.rubber { position: absolute; border: 1px dashed #3448b0; background: rgba(52, 72, 176, 0.08); pointer-events: none; }

.props {
  width: 264px;
  padding: 14px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  overflow-y: auto;
}
.props h2 { margin: 0 0 10px; font-size: 15px; }
.props .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 12px; }
.props label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.props label.wide { flex: 1; min-width: 120px; }
.props label.check { flex-direction: row; align-items: center; gap: 6px; padding-bottom: 6px; }
.props select, .props input[type="number"] { height: 32px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); padding: 0 8px; color: var(--ink); }
.props input[type="number"] { width: 72px; }
.props input[type="color"] { width: 44px; height: 32px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.props input[type="range"] { width: 100%; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; background: transparent; width: 34px; height: 32px; display: grid; place-items: center; font-size: 15px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent-soft); color: var(--accent); }
.mini { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 5px 9px; font-size: 12px; }
.mini:hover { border-color: var(--accent); }
.mini.danger { color: var(--danger); }
.link { border: 0; background: transparent; color: var(--accent); padding: 6px 0; font-size: 12px; text-decoration: underline; }
.note { font-size: 12px; margin: 0 0 10px; padding: 8px; border-radius: 6px; background: var(--accent-soft); color: var(--ink); }
.help { font-size: 12px; color: var(--muted); margin: 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  max-width: min(92vw, 560px);
  background: #1d2433;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 20;
}
.toast.bad { background: #8f241c; }

@media (max-width: 900px) {
  .thumbs { display: none; }
  .work { flex-direction: column; }
  .props { order: -1; width: auto; border-left: 0; border-bottom: 1px solid var(--line); padding: 8px 12px; max-height: 38vh; }
  .props h2, .props .help { display: none; }
  .props .row { margin-bottom: 8px; }
  .filename { display: none; }
  .tools button span { display: none; }
  .tools button { padding: 8px 11px; }
  .top { gap: 6px; padding: 6px 8px; }
  .brand small { display: none; }
  .btn { padding: 7px 10px; }
  .pages { padding: 10px; gap: 12px; }
  .drop { margin: 4vh 12px; }
}
@media (max-width: 600px) {
  /* a phone: icon, Open, undo/redo, zoom buttons, Download must fit in 390 px with any system font */
  .long, .brand span, .zoom { display: none; }
}
