:root {
  --paper: #eeeae1;
  --ink: #242f27;
  --muted: #566356;
  --panel: #f8f6ef;
  --mint: #d5e5d8;
  --line: #c3c9bb;
  --shadow: #26352a18;
  font-family: "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #202620;
    --ink: #eeeae1;
    --muted: #b8c3b3;
    --panel: #2b342c;
    --mint: #3a5141;
    --line: #52624f;
    --shadow: #0004;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #202620;
  --ink: #eeeae1;
  --muted: #b8c3b3;
  --panel: #2b342c;
  --mint: #3a5141;
  --line: #52624f;
  --shadow: #0004;
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
summary {
  touch-action: manipulation;
}
button {
  cursor: pointer;
  min-height: 44px;
  border: 1px solid var(--line);
  padding: 10px 16px;
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
}
button:hover:not(:disabled) {
  background: var(--mint);
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
button.primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
button.primary:hover:not(:disabled) {
  background: var(--muted);
}
a {
  color: inherit;
  text-underline-offset: 4px;
}
button:focus-visible,
a:focus-visible,
textarea:focus-visible,
select:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid #9a6b38;
  outline-offset: 4px;
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3,
p {
  margin: 0;
}
p {
  line-height: 1.6;
}
h2 {
  font-size: clamp(24px, 3vw, 36px);
  letter-spacing: -0.04em;
  font-weight: 500;
}
h3 {
  font-size: 14px;
  font-weight: 600;
}
.site-header,
main,
footer {
  max-width: 1440px;
  margin: auto;
  padding-inline: clamp(18px, 4vw, 64px);
}
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 24px;
}
.brand {
  font-family: Georgia, serif;
  font-size: 30px;
  text-decoration: none;
  display: flex;
  gap: 18px;
  align-items: center;
}
.brand span {
  font:
    12px "Helvetica Neue",
    Arial,
    sans-serif;
}
.site-header button {
  font-size: 12px;
}
.intro {
  display: flex;
  justify-content: space-between;
  gap: 36px;
  align-items: end;
  padding-block: 55px 40px;
}
h1 {
  font-size: clamp(48px, 7vw, 92px);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.065em;
}
h1 em {
  font-family: Georgia, serif;
  font-weight: 400;
}
.eyebrow {
  font:
    11px/1.5 ui-monospace,
    monospace;
  letter-spacing: 0.05em;
  margin-bottom: 18px;
  color: var(--muted);
}
.intro-note {
  max-width: 360px;
  font-size: 14px;
  padding-bottom: 6px;
}
.intro-note p {
  margin-top: 10px;
  color: var(--muted);
}
.privacy-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #63926c;
  margin-right: 10px;
}
.status {
  min-height: 44px;
  padding: 10px 0;
  font-size: 13px;
  color: var(--muted);
}
.status.error {
  color: #ab3737;
}
.dropzone {
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--mint);
  padding: clamp(32px, 5vw, 72px);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 70px;
}
.dropzone.dragging {
  outline: 3px solid var(--ink);
  outline-offset: -6px;
}
.dropzone p {
  margin-block: 16px;
  color: var(--muted);
}
.dropzone small {
  display: block;
  font-size: 11px;
  margin-top: 18px;
  color: var(--muted);
}
.paper-art {
  width: 148px;
  height: 190px;
  background: var(--panel);
  box-shadow: 7px 9px 0 var(--shadow);
  border: 1px solid var(--line);
  padding: 28px;
  transform: rotate(-7deg);
  flex-shrink: 0;
}
.paper-art span {
  display: block;
  font:
    italic 40px Georgia,
    serif;
  margin-bottom: 24px;
}
.paper-art i {
  display: block;
  height: 1px;
  background: var(--line);
  margin-block: 15px;
}
.paper-art i:last-child {
  width: 65%;
}
.document-bar {
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 24px 0;
}
.document-bar h2 {
  font-size: 22px;
  overflow-wrap: anywhere;
}
.document-bar .eyebrow {
  margin-bottom: 6px;
}
#summary {
  font-size: 12px;
  color: var(--muted);
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.actions button {
  font-size: 12px;
}
.editor-grid {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.editor-grid aside {
  background: var(--panel);
  padding: 16px 10px;
  max-height: 850px;
  overflow: auto;
}
.pages-heading {
  padding: 0 6px 14px;
}
.pages-heading span {
  font-size: 11px;
  color: var(--muted);
}
#pages {
  list-style: none;
  padding: 0;
  margin: 0;
}
#pages button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border-color: transparent;
  background: transparent;
  margin-bottom: 6px;
  padding: 10px 8px;
}
#pages button[aria-current="page"] {
  border-color: var(--ink);
  background: var(--mint);
}
.page-number {
  font:
    22px Georgia,
    serif;
  min-width: 28px;
}
.page-info {
  min-width: 0;
  font-size: 11px;
}
.page-info strong {
  display: block;
  font-weight: 500;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 115px;
}
.page-info small {
  color: var(--muted);
}
.editing-area {
  min-width: 0;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  align-items: center;
}
.toolbar button {
  font-size: 12px;
  padding: 8px 11px;
}
.tool-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.toolbar button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}
.toolbar label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}
.toolbar input {
  width: 35px;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--line);
  background: transparent;
}
.toolbar select {
  min-height: 38px;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.tool-hint {
  font-size: 12px;
  padding: 12px 16px;
  color: var(--muted);
  background: var(--panel);
}
.preview {
  overflow: auto;
  min-height: 300px;
  padding: 24px;
  display: flex;
  justify-content: center;
  align-items: start;
  background: var(--shadow);
}
#sheet {
  position: relative;
  flex-shrink: 0;
  max-width: 100%;
  box-shadow: 0 8px 24px #0002;
  background: white;
}
#page-canvas {
  display: block;
  width: 100%;
  height: 100%;
}
#marks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: auto;
}
#marks.marking {
  touch-action: none;
  cursor: crosshair;
}
.marks-panel {
  padding: 18px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.marks-panel h3 {
  margin-bottom: 10px;
}
.marks-panel p {
  font-size: 12px;
  color: var(--muted);
}
#mark-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
#mark-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 12px;
  border-top: 1px solid var(--line);
  padding-block: 5px;
}
#mark-list li span {
  overflow-wrap: anywhere;
}
#mark-list button {
  font-size: 11px;
}
.limits {
  padding-block: 30px;
  max-width: 850px;
}
.limits summary {
  font-size: 14px;
  cursor: pointer;
  min-height: 44px;
}
.limits p {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}
footer {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-block: 26px;
  font-size: 12px;
  color: var(--muted);
}
footer nav {
  display: flex;
  gap: 20px;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  padding: 28px;
  max-width: min(480px, calc(100vw - 32px));
  width: 100%;
}
dialog::backdrop {
  background: #15251bc0;
}
dialog label {
  display: block;
  font-size: 13px;
  margin-block: 20px 8px;
}
textarea {
  width: 100%;
  padding: 12px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  resize: vertical;
}
#text-error {
  color: #b14444;
  font-size: 12px;
  margin-block: 10px;
}
.skip {
  position: fixed;
  top: -100px;
  left: 20px;
  z-index: 20;
  background: var(--paper);
  padding: 12px;
}
.skip:focus {
  top: 12px;
}
@media (max-width: 800px) {
  .intro {
    display: block;
    padding-top: 30px;
  }
  .intro-note {
    margin-top: 28px;
  }
  .dropzone {
    gap: 28px;
  }
  .paper-art {
    width: 90px;
    height: 125px;
    padding: 15px;
  }
  .paper-art span {
    font-size: 28px;
    margin-bottom: 12px;
  }
  .paper-art i {
    margin-block: 10px;
  }
  .document-bar {
    align-items: start;
    flex-direction: column;
  }
  .editor-grid {
    grid-template-columns: 1fr;
  }
  .editor-grid aside {
    max-height: 160px;
    border-bottom: 1px solid var(--line);
  }
  #pages {
    display: flex;
    gap: 8px;
    overflow: auto;
  }
  #pages button {
    width: 145px;
  }
  .pages-heading {
    display: none;
  }
  .preview {
    padding: 12px;
  }
  .toolbar {
    padding: 10px;
  }
  .intro h1 {
    font-size: 64px;
  }
  footer {
    flex-direction: column;
  }
  .brand span {
    max-width: 100px;
    line-height: 1.4;
  }
}
@media (max-width: 440px) {
  .paper-art {
    display: none;
  }
  .intro h1 {
    font-size: 54px;
  }
  .dropzone {
    padding: 30px 20px;
  }
  .toolbar label {
    font-size: 12px;
  }
  .tool-group {
    width: 100%;
  }
  .tool-group button {
    flex: 1;
  }
  .document-bar .actions {
    width: 100%;
  }
  .document-bar .actions .primary {
    flex: 1;
  }
}
#text-targets {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
#text-targets button {
  position: absolute;
  pointer-events: auto;
  min-height: 0;
  min-width: 0;
  padding: 0;
  border: 1px solid #307149;
  border-radius: 2px;
  background: #8bd3a326;
  touch-action: manipulation;
}
#text-targets button:hover,
#text-targets button:focus-visible {
  background: #8bd3a366;
  outline: 2px solid #307149;
}
#existing-text-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  max-height: 300px;
  overflow: auto;
}
#existing-text-list button {
  text-align: left;
  font-size: 13px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
#edit-help,
#edit-error {
  font-size: 13px;
  line-height: 1.5;
  margin-block: 12px;
  color: var(--muted);
}
