:root { color-scheme: light; --ink: #303438; --muted: #64696c; --red: #d72424; --line: #e4e6e8; --soft: #fafafa; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: #fff; font: 500 16px/1.65 'Quicksand', sans-serif; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--red); }
button, input, select { font: inherit; }
button, select, input[type=number] { border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--ink); min-height: 44px; }
button { padding: 10px 16px; font-size: .875rem; font-weight: 600; cursor: pointer; line-height: 1.45; transition: border-color .15s, background .15s; }
button:hover { border-color: #a9adb0; background: var(--soft); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--red); color: white; border-color: var(--red); }
button.primary:hover { background: #bd1d1d; }
button.quiet { background: transparent; border-color: transparent; }
button.quiet:hover { background: #f2f3f4; }
:focus-visible { outline: 3px solid #e3292970; outline-offset: 3px; }
input[type=number], select { padding: 8px 10px; width: 100%; }
input[type=number] { font-variant-numeric: tabular-nums; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 4vw, 3.125rem); line-height: 1.25; font-weight: 500; letter-spacing: -.04em; }
h2 { font-size: 1.0625rem; font-weight: 600; }
h3 { font-size: .875rem; font-weight: 600; }
.site-header { max-width: 1160px; margin: auto; min-height: 88px; padding: 20px 24px; display: flex; justify-content: space-between; align-items: center; gap: 20px; font-size: .875rem; border-bottom: 1px solid var(--line); }
.site-header > a:first-child { font-weight: 700; }
main { max-width: 1160px; margin: 0 auto; padding: 0 24px 48px; }
.intro { text-align: center; padding: 52px 0 35px; }
.intro::after { content: ''; display: block; width: 36px; height: 2px; background: var(--red); margin: 26px auto 0; }
.intro p { margin-top: 14px; color: var(--muted); }
.upload { max-width: 760px; margin: 4px auto 0; padding: 36px 24px 26px; text-align: center; background: var(--soft); border: 1px dashed #c8ccd0; border-radius: 8px; }
.upload.dragging { border-color: var(--red); background: #fff5f5; }
.upload-icon { width: 44px; height: 44px; color: var(--red); margin-bottom: 12px; }
.upload h2 { font-size: 1.375rem; font-weight: 500; }
.upload p { color: var(--muted); margin: 8px 0 20px; }
.upload .privacy { margin: 20px 0 0; }
.small { font-size: .875rem; color: var(--muted); line-height: 1.6; }
.status { color: var(--muted); font-size: .875rem; text-align: center; margin: 16px 0; }
.status:empty { margin: 12px 0; }
.error { color: #a01818; background: #fff4f4; border-radius: 6px; padding: 12px 16px; margin: 12px 0 20px; }
.file-bar { display: flex; justify-content: space-between; gap: 18px; align-items: center; padding: 12px 0 22px; border-bottom: 1px solid var(--line); }
.file-info { display: flex; flex-wrap: wrap; gap: 5px 16px; align-items: baseline; min-width: 0; }
#filename { font-size: .9375rem; overflow-wrap: anywhere; }
.file-bar button { flex-shrink: 0; }
.editor-layout { display: grid; grid-template-columns: 255px minmax(0, 1fr); gap: 36px; padding-top: 28px; }
.settings { min-width: 0; }
.settings h2 { margin-bottom: 16px; }
fieldset { padding: 0; border: 0; margin: 0 0 20px; min-width: 0; }
legend, .field { font-size: .875rem; font-weight: 600; }
legend { padding: 0; margin-bottom: 8px; }
.field { display: block; margin-bottom: 18px; }
.field select, .input-unit { margin-top: 8px; }
.segments { display: flex; gap: 8px; }
.segments label { flex: 1; position: relative; cursor: pointer; }
.segments input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.segments span { display: flex; justify-content: center; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 6px; padding: 10px; font-size: .875rem; }
.segments input:checked + span { color: var(--red); border-color: var(--red); background: #fff8f8; }
.segments input:focus-visible + span { outline: 3px solid #e3292970; outline-offset: 3px; }
.side-icon { display: inline-block; width: 23px; height: 17px; border: 1px solid currentColor; border-radius: 2px; background: linear-gradient(to right, currentColor 50%, transparent 50%); }
.side-icon.right { transform: rotate(180deg); }
.notes-icon { display: inline-block; width: 25px; height: 19px; border: 1px solid currentColor; border-radius: 2px; }
.notes-icon.grid { background: linear-gradient(currentColor 1px, transparent 1px) 5px 5px / 6px 6px, linear-gradient(to right, currentColor 1px, transparent 1px) 5px 5px / 6px 6px; }
.input-unit { display: flex; align-items: center; gap: 10px; }
.input-unit input { width: 90px; }
.input-unit > span { font-weight: 500; color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.settings > button { width: 100%; }
#open-crop { margin-top: 14px; }
.crop-summary { margin-top: 8px; }
.export-note { margin-top: 12px; font-size: .8125rem; }
.download { display: flex; justify-content: space-between; align-items: center; }
progress { width: 100%; height: 6px; margin-top: 15px; accent-color: var(--red); }
.preview-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.pagination { display: flex; gap: 8px; align-items: center; font-size: .875rem; }
.pagination button { width: 40px; padding: 8px; }
.pagination input { width: 60px; min-height: 38px; padding: 5px; margin-left: 5px; text-align: center; }
.preview-stage { background: #f2f3f4; padding: 28px; border-radius: 6px; }
.preview-stage[aria-busy=true] { opacity: .45; }
#preview, .crop-preview { display: block; width: 100%; height: auto; background: white; box-shadow: 0 3px 18px #202b3812, 0 0 0 1px #202b3809; }
.page-labels { display: grid; grid-template-columns: 1fr 1fr; text-align: center; margin-top: 16px; font-size: .8125rem; color: var(--muted); }
.preview-caption { text-align: center; margin: 16px auto; max-width: 510px; }
dialog { width: min(1040px, calc(100% - 32px)); max-height: calc(100dvh - 32px); border: 1px solid var(--line); border-radius: 10px; padding: 24px; color: var(--ink); }
dialog::backdrop { background: #1d253377; }
body:has(dialog[open]) { overflow: hidden; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 6px; }
.dialog-heading h2 { font-size: 1.375rem; }
.crop-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, .78fr); gap: 28px; margin-top: 20px; }
.crop-source-well { background: #f2f3f4; border-radius: 6px; padding: 22px; display: flex; justify-content: center; align-items: center; min-width: 0; }
.crop-source { position: relative; max-width: 100%; flex-shrink: 1; box-shadow: 0 2px 14px #202b3818; }
#crop-canvas { display: block; width: 100%; height: auto; background: white; }
.crop-overlay { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: crosshair; user-select: none; }
.crop-box { position: absolute; border: 2px solid var(--red); box-shadow: 0 0 0 1000px #222c3e50; cursor: move; }
.crop-box [data-handle] { position: absolute; width: 18px; height: 18px; background: white; border: 2px solid var(--red); border-radius: 3px; }
[data-handle=nw] { top: -3px; left: -3px; cursor: nwse-resize; }
[data-handle=ne] { top: -3px; right: -3px; cursor: nesw-resize; }
[data-handle=sw] { bottom: -3px; left: -3px; cursor: nesw-resize; }
[data-handle=se] { bottom: -3px; right: -3px; cursor: nwse-resize; }
[data-handle=n] { top: -3px; left: calc(50% - 9px); cursor: ns-resize; }
[data-handle=s] { bottom: -3px; left: calc(50% - 9px); cursor: ns-resize; }
[data-handle=w] { left: -3px; top: calc(50% - 9px); cursor: ew-resize; }
[data-handle=e] { right: -3px; top: calc(50% - 9px); cursor: ew-resize; }
.crop-controls h3 { margin-bottom: 12px; }
.crop-preview { margin-bottom: 20px; }
.crop-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.crop-fields label { font-size: .875rem; }
.crop-fields input { margin-top: 5px; padding: 8px 5px; }
.crop-actions { display: flex; flex-wrap: wrap; gap: 6px; }
#crop-status { min-height: 1.6em; margin: 12px 0; }
#apply-all { width: 100%; }
#apply-all + p { margin-top: 8px; }
.dialog-footer { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 22px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
@media (max-width: 800px) {
  .editor-layout { grid-template-columns: 1fr; gap: 24px; }
  .preview-panel { grid-row: 1; }
  .settings { border-top: 1px solid var(--line); padding-top: 24px; }
  .intro { padding: 36px 0 26px; }
  .crop-layout { grid-template-columns: 1fr; }
  .crop-source { max-width: 350px; }
  .crop-source-well { padding: 14px; }
}
@media (max-width: 480px) {
  main { padding: 0 16px 48px; }
  .site-header { padding: 16px; min-height: 72px; font-size: .8125rem; gap: 10px; }
  .intro p { font-size: .9375rem; }
  .file-bar { align-items: flex-start; flex-direction: column; gap: 8px; }
  .file-bar button { padding-left: 0; }
  .preview-stage { padding: 16px 12px; }
  .preview-toolbar { gap: 8px; }
  .pagination { gap: 5px; }
  .pagination input { width: 50px; }
  dialog { padding: 16px; width: calc(100% - 16px); }
  .crop-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
