:root {
  color-scheme: light;
  font-family: "Avenir Next", system-ui, sans-serif;
  color: #13283a;
  background: #f4f7f7;
  --muted: #476072;
  --line: #d7e1e4;
  --blue: #154eba;
  --pale-blue: #edf4ff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #245cc9; outline-offset: 3px; }
.shell { width: min(1080px, calc(100% - 48px)); margin-inline: auto; }
.masthead { background: #fff; border-bottom: 1px solid var(--line); }
.masthead-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.brand { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 9px; font-size: 1.26rem; font-weight: 750; letter-spacing: -.04em; white-space: nowrap; }
.brand-mark { display: block; flex: none; }
.local { color: #225647; font-size: .875rem; font-weight: 650; display: inline-flex; align-items: center; gap: 7px; }
.local span { width: 8px; height: 8px; border-radius: 50%; background: #218466; flex: none; }
.hero { margin: 32px 0 28px; padding: 21px 32px 23px; min-height: 0; background: #e4edf9; border: 1px solid #d5e4f7; border-radius: 22px; display: flex; align-items: center; justify-content: space-between; overflow: hidden; }
h1 { font: 500 clamp(2.2rem, 5vw, 4.25rem)/1.02 Georgia, serif; letter-spacing: -.067em; margin: 0; }
h1 em { color: var(--blue); font-weight: inherit; }
.hero p { color: var(--muted); margin: 12px 0 0; line-height: 1.55; }
.art { position: relative; width: 274px; height: 160px; flex: 0 0 230px; transform: scale(.73); transform-origin: top center; margin-right: clamp(0px, 4vw, 54px); }
.orbit { position: absolute; inset: 18px 5px; border: 1px solid #a4beee; border-radius: 50%; transform: rotate(-24deg); }
.page { position: absolute; width: 123px; height: 162px; border-radius: 10px; box-shadow: 3px 10px 22px #1a4b9b26; }
.back { background: #1248ae; border: 1px solid #174793; top: 25px; left: 67px; transform: rotate(-20deg); }
.front { background: #fcfdff; border: 1px solid #b8ccef; top: 17px; left: 101px; transform: rotate(12deg); padding: 49px 21px 0; }
.front span { color: var(--blue); font-size: 1.45rem; font-weight: 850; letter-spacing: -.06em; }
.front i { display: block; width: 100%; height: 4px; background: #acbfdf; border-radius: 7px; margin-top: 8px; }
.front i:last-child { width: 65%; }
.fold { position: absolute; top: 0; right: 0; width: 32px; height: 32px; background: linear-gradient(45deg, #d8e6fb 50%, #e4edf9 51%); border-bottom-left-radius: 5px; }
.image-work-area:has(.image-tools-sidebar:not([hidden])) { display: grid; gap: 16px; margin-top: 20px; }
.image-viewer-column, .image-tools-sidebar { min-width: 0; }
.image-work-area .image-preview, .image-tools-sidebar .pdf-size-limits { margin-top: 0; }
@media (min-width: 820px) {
  .image-work-area:has(.image-tools-sidebar:not([hidden])) { grid-template-columns: minmax(0, 1fr) minmax(275px, 32%); align-items: start; }
}
.panel { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 27px; box-shadow: 0 9px 22px #183c5607; }
.panel-title h2 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 14px; letter-spacing: -.035em; }
.drop { display: grid; justify-items: center; align-content: center; gap: 8px; width: 100%; padding: 22px 10px; min-height: 155px; border-radius: 13px; border: 2px dashed #b9cceb; color: inherit; background: #f7faff; }
.drop:hover:not(:disabled), .drop.dragging { background: #eaf2ff; border-color: #5984d6; }
.drop strong { font-size: 1.1rem; }
#drop-hint { color: var(--muted); font-size: .875rem; }
.upload-icon { background: #e5eeff; color: var(--blue); display: grid; place-items: center; border-radius: 10px; width: 38px; height: 38px; font-size: 1.25rem; font-weight: 800; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 18px; }
.primary, .secondary, .download { display: inline-flex; align-items: center; min-height: 44px; padding: 9px 16px; border-radius: 9px; font-weight: 700; text-decoration: none; }
.primary { background: var(--blue); color: #fff; border: 1px solid transparent; }
.primary:hover:not(:disabled) { background: #123d91; }
.primary:disabled { background: #e4ecfa; color: #4a6389; }
.secondary, .download { border: 1px solid #b9cceb; background: #fff; color: var(--blue); }
.secondary:hover, .download:hover { background: var(--pale-blue); }
.image-preview { margin-top: 20px; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.preview-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 10px 14px; }
.preview-toolbar h3 { margin: 0; font-size: 1rem; }
.live-preview-status { margin: 0; padding: 0 14px 8px; color: var(--muted); font-size: .875rem; }
.preview-navigation { display: flex; align-items: center; gap: 8px; font-size: .875rem; color: var(--muted); }
.preview-navigation .secondary { min-height: 36px; padding: 5px 10px; }
.preview-navigation .secondary:disabled { color: #647488; background: #f5f7fa; border-color: var(--line); }
.preview-scroll { height: clamp(345px, 64vh, 590px); overflow: auto; scrollbar-gutter: stable; background: #e8eef6; }
.preview-sheet { height: clamp(265px, 53vh, 480px); display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; align-content: center; gap: 10px; padding: 18px 14px; margin: 0; }
.preview-sheet + .preview-sheet { border-top: 1px solid #d4dfec; }
.preview-sheet figcaption { color: var(--muted); font-size: .875rem; }
.preview-sheet .preview-paper img { max-height: calc(clamp(265px, 53vh, 480px) - 62px); }
.preview-sheet[aria-current="page"] figcaption { color: var(--blue); font-weight: 700; }
.preview-sheet[aria-current="page"] { background: #eef4fc; }
.preview-sheet[aria-current="page"] .preview-paper { outline: 2px solid #9bb8e8; }
.preview-magnifier { display: none; position: fixed; z-index: 8; inset: 0 auto auto 0; width: 164px; height: 164px; transform: translate(-50%, -50%); overflow: hidden; pointer-events: none; background: white; border: 2px solid #154eba; border-radius: 50%; box-shadow: 0 4px 20px #152c4d59; }
.preview-magnifier img { position: absolute; max-width: none; image-orientation: none; }
@media (any-hover: hover) and (any-pointer: fine) {
  .preview-magnifier { display: block; }
}
.preview-stage { display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; height: clamp(240px, 48vw, 390px); padding: 14px; background: #edf2f8; }
.preview-stage p { margin: 0; color: var(--muted); }
.preview-paper { position: relative; max-width: 100%; background: #fff; box-shadow: 0 3px 12px #183c5626; overflow: hidden; }
.preview-paper img { display: block; max-width: 100%; max-height: calc(clamp(240px, 48vw, 390px) - 28px); image-orientation: none; }
.preview-paper.is-cropping { overflow: visible; }
.preview-paper.is-cropping img { image-orientation: from-image; }
.preview-filename { margin: 10px 14px 0; color: var(--muted); font-size: .875rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
body:not([data-tool="images"]) .preview-filename { padding-bottom: 12px; }
.pdf-sheet .preview-paper { --page-ratio: .773; aspect-ratio: var(--page-ratio); width: min(100%, calc((clamp(265px, 53vh, 480px) - 62px) * var(--page-ratio))); }
.pdf-sheet .preview-paper img { width: 100%; height: 100%; object-fit: contain; }
.pdf-size-limits { margin: 20px 0 0; padding: 12px 14px 14px; min-width: 0; border: 1px solid var(--line); border-radius: 10px; }
.pdf-size-limits legend { padding: 0 5px; font-weight: 750; }
.pdf-size-limits p { margin: 0 0 10px; color: var(--muted); font-size: .875rem; }
.size-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; font-weight: 650; cursor: pointer; }
.size-toggle input { width: 18px; height: 18px; margin: 0; accent-color: var(--blue); }
#reduction-options .option { margin: 8px 0 12px; }
.pdf-size-limits #size-floor { margin: 9px 0 0; padding: 8px 10px; border-radius: 7px; background: var(--pale-blue); color: var(--blue); font-weight: 650; }
.pdf-size-limits #size-floor.error { color: #a32420; }
.pdf-size-limits #compression-quality-note { margin: 8px 0 0; }
.size-slider-label { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; font-size: .875rem; font-weight: 650; }
.size-slider-label output { color: var(--blue); font-variant-numeric: tabular-nums; }
.size-slider { display: block; width: 100%; min-height: 36px; margin: 0; accent-color: var(--blue); }
.crop-export { margin-top: 12px; padding: 12px 14px 14px; border: 1px solid #d0def4; border-radius: 10px; background: #f7faff; }
.crop-export h3 { margin: 0; font-size: 1rem; }
.crop-export p { margin: 6px 0 10px; color: var(--muted); overflow-wrap: anywhere; }
.crop-export p.error { color: #a32420; }
.crop-export-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.crop-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px 14px; border-top: 1px solid var(--line); }
.crop-controls p { width: 100%; margin: 0; color: var(--muted); font-size: .875rem; }
.option.scan-filter select { padding-right: 28px; }
.batch-crop { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; }
.batch-crop button { width: 100%; justify-content: center; }
.batch-crop .scan-filter { margin-top: 10px; }
.batch-crop #cancel-pdf-filter { margin-top: 8px; }
.batch-crop p { margin: 8px 0 0; color: var(--muted); font-size: .875rem; }
#crop-status.error, #batch-crop-status.error { color: #a32420; }
.image-tools-sidebar .batch-crop:not([hidden]) + .pdf-size-limits { margin-top: 16px; }
.crop-overlay, .crop-overlay canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.crop-corner {
  position: absolute;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  transform: translate(-50%, -50%);
  touch-action: none;
  pointer-events: auto;
  cursor: grab;
}
.crop-corner::after { content: ""; width: 14px; height: 14px; box-sizing: border-box; border: 2px solid #fff; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.crop-corner:hover::after, .crop-corner:focus-visible::after { width: 18px; height: 18px; }
.crop-corner:active { cursor: grabbing; }
.files { margin: 12px 0 0; padding-left: 26px; }
.page-order-card, .settings-card { padding: 12px 7px 7px; border: 1px solid var(--line); border-radius: 10px; }
.image-tools-sidebar:has(> :is(.pdf-size-limits, .settings-card):not([hidden])) .page-order-card { margin-top: 16px; }
.settings-card { padding: 12px 14px 14px; }
.settings-card h3 { margin: 0 0 8px; font-size: 1rem; }
.settings-card .option { margin: 0; max-width: none; }
.settings-card :is(input, select) { min-width: 0; width: 100%; }
.image-order-title { font-size: 1rem; margin: 0 7px 8px; }
.page-order-scroll { max-height: clamp(160px, 34vh, 305px); overflow: auto; scrollbar-gutter: stable; border-radius: 7px; }
.file-name-tooltip { position: fixed; z-index: 9; width: max-content; max-width: min(380px, calc(100vw - 24px)); padding: 7px 10px; border-radius: 7px; background: #13283a; color: #fff; box-shadow: 0 4px 14px #13283a40; font-size: .875rem; line-height: 1.35; overflow-wrap: anywhere; pointer-events: none; }
.page-order-scroll .files { margin: 0; padding: 0 3px 0 26px; }
.page-order-scroll .files li { padding: 3px 0; }
.page-order-scroll .file-current .file-row { background: var(--pale-blue); border-color: #c9dbfa; }
.page-order-scroll .file-current::marker { color: var(--blue); font-weight: 700; }
.image-files { margin-top: 5px; }
.files li { padding: 6px 0; color: var(--muted); }
.file-row { display: flex; flex-wrap: wrap; gap: 7px 10px; align-items: center; }
.image-files .file-row { flex-wrap: nowrap; gap: 8px; border: 1px solid transparent; border-radius: 8px; }
.image-files .file-grip, .image-files .remove-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 1.25rem;
  line-height: 1;
}
.file-grip { cursor: grab; touch-action: none; user-select: none; }
.file-dragging .file-grip { cursor: grabbing; }
.image-files .file-grip:hover:not(:disabled) { background: var(--pale-blue); color: var(--blue); }
.image-files .remove-icon:hover:not(:disabled) { background: #fceded; color: #a32420; }
.file-dragging .file-row { opacity: .32; }
.file-drag-preview {
  position: fixed;
  inset: 0 auto auto 0;
  z-index: 10;
  margin: 0;
  outline: 1px solid #91afe2;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 7px 22px #183c5638;
  overflow: hidden;
  pointer-events: none;
}
.file-drag-preview .file-grip { color: var(--blue); background: var(--pale-blue); }
.file-drop-target { position: relative; }
.file-drop-target::after { content: ""; position: absolute; inset: 0 0 auto; border-top: 3px solid var(--blue); border-radius: 2px; pointer-events: none; }
.file-drop-after::after { inset: auto 0 0; }
.file-name { flex: 1 1 0; color: #13283a; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.preview-file { text-align: left; background: transparent; border: 0; border-radius: 6px; padding: 4px; }
.preview-file:hover:not(:disabled), .preview-file[aria-current="page"] { color: var(--blue); background: var(--pale-blue); }
.file-size { font-size: .875rem; white-space: nowrap; }
.file-controls { margin-left: auto; display: flex; flex-wrap: wrap; gap: 5px; }
.file-controls button { color: var(--blue); background: white; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; font-size: .875rem; }
.file-controls button:disabled { color: #647488; }
.option { display: grid; gap: 5px; margin-top: 16px; max-width: 340px; font-weight: 650; font-size: .93rem; }
.option input, .option select { padding: 9px 12px; border: 1px solid #aabbcd; border-radius: 8px; color: inherit; background: white; }
.option select { appearance: none; background: linear-gradient(45deg, transparent 50%, #345171 50%) calc(100% - 17px) 50% / 5px 5px no-repeat, linear-gradient(135deg, #345171 50%, transparent 50%) calc(100% - 12px) 50% / 5px 5px no-repeat; }
#status { margin: 14px 0 0; color: #225647; overflow-wrap: anywhere; }
#status.error { color: #a32420; }
footer { padding: 30px 0; font-size: .875rem; color: var(--muted); }
footer span { margin: 0 4px; }
@media (max-width: 690px) {
  .shell { width: calc(100% - 28px); }
  .hero { min-height: 0; padding: 17px 18px; margin: 14px 0; border-radius: 16px; }
  .hero p { margin-top: 7px; }
  .art { display: none; }
  .wide { display: none; }
  .panel { padding: 15px; }
  .preview-toolbar { align-items: flex-start; flex-direction: column; }
}
.support-content {
  margin: 20px 0 0;
  padding: 22px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  line-height: 1.6;
}
.support-content h2 { margin: 0 0 8px; font-size: 1.3rem; }
.support-content h2:not(:first-child) { margin-top: 22px; }
.support-content p { max-width: 72ch; margin: 6px 0 12px; }
.support-content li + li { margin-top: 6px; }
.support-content a:not(.primary), .site-footer a { color: var(--blue); text-underline-offset: 3px; }
.support-content h3 { margin-bottom: 8px; font-size: 1rem; }
.related-tools, .site-footer { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.guide-examples { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 16px; }
.guide-image { margin: 12px 0; }
.guide-image img { display: block; max-width: min(100%, 490px); height: auto; border-radius: 9px; }
.guide-image figcaption { font-size: .875rem; color: var(--muted); margin-top: 5px; }
