.pdf-intro { padding-block: clamp(26px, 4vw, 50px) 28px; }
.pdf-intro h1 { font-size: clamp(2.5rem, 5.5vw, 4.4rem); }
.pdf-intro p { max-width: 650px; font-size: 1rem; }
.pdf-notice { margin-bottom: 16px; }
.pdf-workspace { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 18px; align-items: start; }
.pdf-pages { padding: 18px 14px 14px; position: sticky; top: 16px; }
.pdf-pages-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; padding-inline: 3px; }
.pdf-pages-heading h2 { display: flex; align-items: center; gap: 8px; }
.pdf-count { padding: 3px 6px; border-radius: 5px; background: #e9edf4; color: #596477; font-size: .7rem; font-weight: 600; letter-spacing: 0; }
.pdf-pages .subtle { min-height: 26px; font-size: .73rem; }
.pdf-pages .subtle:disabled { opacity: .5; text-decoration: none; }
.pdf-add-files { width: 100%; justify-content: center; }
.pdf-add-files > span { color: var(--accent); font-size: 1.1rem; line-height: 1; }
.pdf-pages-hint { padding: 12px 3px 0; color: var(--muted); font-size: .69rem; line-height: 1.5; }
.pdf-page-list { min-height: 138px; max-height: min(690px, calc(100vh - 220px)); overflow-y: auto; overscroll-behavior: contain; list-style: none; margin: 10px 0 0; padding: 2px 4px 2px 2px; scrollbar-width: thin; }
.pdf-page-list:empty { min-height: 0; height: 0; margin: 0; padding: 0; }
.pdf-pages-empty { display: grid; place-items: center; min-height: 138px; margin-top: 12px; padding: 20px; border: 1px dashed #d6dbe3; border-radius: 8px; background: #f3f4f7; color: #6a758a; font-size: .74rem; text-align: center; line-height: 1.5; }
.pdf-page-item { position: relative; margin-bottom: 9px; border-radius: 9px; cursor: grab; }
.pdf-page-item:last-child { margin-bottom: 0; }
.pdf-page-item:active { cursor: grabbing; }
.pdf-page-select { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px 6px; width: 100%; padding: 8px 10px; border: 1px solid #dbe0e8; border-radius: 9px; background: #f0f2f6; text-align: left; transition: border-color .15s, background .15s; }
.pdf-page-select:hover { background: #eaf0fc; border-color: #a7b9e4; }
.pdf-page-select[aria-current],
.pdf-page-select[aria-selected="true"],
.pdf-page-item.selected .pdf-page-select,
.pdf-page-item.is-selected .pdf-page-select { border-color: var(--accent); background: #e7eeff; box-shadow: 0 0 0 1px #2855d922; }
.pdf-page-thumb { display: block; grid-column: 1 / -1; justify-self: center; max-width: min(100%, 130px); width: auto; height: auto; max-height: 100px; background: white; box-shadow: 0 2px 6px #25334b21; pointer-events: none; }
.pdf-page-number { align-self: start; color: #2145b1; font-size: .7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.pdf-page-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #586278; font-size: .69rem; line-height: 1.4; }
.pdf-page-select::after { content: '⠿'; position: absolute; top: 11px; right: 11px; color: #72809a; font-size: .9rem; line-height: 1; opacity: 0; pointer-events: none; }
.pdf-page-select:hover::after,
.pdf-page-select:focus-visible::after { opacity: 1; }
.pdf-page-item.dragging { opacity: .45; }
.pdf-page-item.drag-over::before,
.pdf-page-item.drop-before::before,
.pdf-page-item.drop-after::after { content: ''; position: absolute; height: 3px; inset-inline: 0; top: -6px; border-radius: 3px; background: var(--accent); }
.pdf-page-item.drop-after::after { top: auto; bottom: -6px; }
.pdf-editor { padding: 0; overflow: hidden; container-type: inline-size; }
.pdf-preview-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; min-height: 65px; padding: 13px 19px; border-bottom: 1px solid var(--line); }
.pdf-preview-toolbar h2 { font-size: .86rem; }
.pdf-page-actions { display: flex; align-items: center; justify-self: end; gap: 5px; }
.pdf-rotation-actions { display: flex; align-items: center; justify-self: center; gap: 5px; }
.pdf-rotate-symbol { display: block; font-family: Arial, sans-serif; font-size: 1.45rem; line-height: 1; }
.pdf-icon-button,
.pdf-remove-page { display: inline-flex; align-items: center; justify-content: center; min-height: 31px; padding: 5px 9px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: #4f5c72; font-size: .73rem; }
.pdf-icon-button { width: 31px; font-size: 1rem; }
.pdf-remove-page { margin-left: 6px; }
.pdf-icon-button:hover:enabled,
.pdf-remove-page:hover:enabled { background: #e9edf5; border-color: #d6deeb; }
.pdf-icon-button:disabled,
.pdf-remove-page:disabled { opacity: .4; }
.pdf-preview-stage { position: relative; display: grid; place-items: center; min-height: 495px; padding: 28px; background: #e4e8ee; transition: background .15s; }
.pdf-preview-stage.drag { background: #dce6fd; outline: 2px dashed var(--accent); outline-offset: -9px; }
.pdf-preview-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 28px 10px; }
.pdf-paper-icon { position: relative; display: block; width: 43px; height: 56px; border: 1.5px solid #7184ac; border-radius: 5px; background: #f4f6fb; box-shadow: 5px 5px 0 -1px #e4e8ee, 5px 5px 0 0 #aab5c9; margin: 0 5px 27px 0; }
.pdf-paper-icon::after { content: ''; position: absolute; top: 18px; left: 9px; right: 9px; height: 14px; border-block: 1px solid #8c9cba; }
.pdf-preview-empty h3 { font-size: 1.16rem; font-weight: 650; letter-spacing: -.035em; margin: 0; }
.pdf-preview-empty p { color: #586478; font-size: .84rem; margin-top: 8px; line-height: 1.5; }
.pdf-preview-empty .secondary { margin-top: 20px; background: #fafbfe; }
#preview-canvas { display: block; width: auto; height: auto; max-width: 100%; max-height: 640px; object-fit: contain; background: #fff; box-shadow: 0 3px 5px #29374a16, 0 12px 30px #29374a21; }
.pdf-preview-loading { position: absolute; inset-block-start: 14px; inset-inline-end: 16px; padding: 7px 11px; border: 1px solid #d6dce7; border-radius: 6px; background: #fafafbef; color: #4b5970; font-size: .75rem; }
.pdf-export { padding: 21px; border-top: 1px solid var(--line); }
.pdf-export-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, .7fr); gap: 14px; }
.pdf-filename-field { align-self: start; align-content: start; }
.pdf-filename { display: flex; align-items: center; min-height: 43px; border: 1px solid #aeb6c4; border-radius: 7px; background: #fff; }
.pdf-filename input:not([type="color"]) { flex: 1; width: 0; min-width: 0; min-height: 41px; padding: 0 11px; border: 0; background: transparent; }
.pdf-filename > span { flex: none; padding-right: 11px; color: #788295; font-size: .78rem; pointer-events: none; }
.pdf-filename:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.pdf-filename input:focus-visible { outline: 0; }
.pdf-export-actions { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.pdf-export-actions .primary { min-height: 44px; flex: 1; }
.pdf-export progress { width: 100%; margin-top: 14px; }
.pdf-export .status { margin-top: 11px; }

@container (max-width: 540px) {
  .pdf-preview-toolbar { grid-template-columns: auto minmax(0, 1fr); row-gap: 6px; }
  .pdf-preview-toolbar h2 { grid-area: 1 / 1; }
  .pdf-page-actions { grid-area: 1 / 2; }
  .pdf-rotation-actions { grid-area: 2 / 1 / 3 / -1; }
}

@media (max-width: 800px) {
  .pdf-workspace { grid-template-columns: 190px minmax(0, 1fr); gap: 12px; }
  .pdf-pages { padding: 14px 10px 10px; }
  .pdf-preview-toolbar { padding: 11px 12px; }
  .pdf-preview-stage { min-height: 420px; padding: 18px; }
  .pdf-export { padding: 16px; }
  .pdf-export-fields { grid-template-columns: minmax(0, 1fr); gap: 12px; }
}

@media (max-width: 600px) {
  .pdf-intro { padding-block: 29px 22px; }
  .pdf-intro p { font-size: .88rem; }
  .pdf-workspace { grid-template-columns: minmax(0, 1fr); }
  .pdf-pages { z-index: 2; top: 0; padding: 12px; border-radius: 12px; background: #fafafaf5; }
  .pdf-pages-heading { margin: 0; padding: 0; min-height: 28px; padding-right: 118px; }
  .pdf-add-files { position: absolute; top: 11px; right: 12px; min-height: 30px; width: auto; padding: 5px 9px; font-size: .75rem; }
  .pdf-pages-heading .subtle { font-size: .7rem; }
  .pdf-pages-hint { padding-top: 5px; font-size: .66rem; }
  .pdf-page-list { display: flex; gap: 9px; min-height: 95px; max-height: 140px; margin-top: 9px; overflow-x: auto; overflow-y: hidden; padding: 2px 2px 6px; }
  .pdf-page-list:empty { min-height: 0; height: 0; margin: 0; padding: 0; }
  .pdf-pages-empty { min-height: 95px; margin-top: 9px; }
  .pdf-page-item { flex: 0 0 91px; margin-bottom: 0; }
  .pdf-page-select { height: 118px; padding: 7px; gap: 6px 5px; align-content: space-between; }
  .pdf-page-thumb { max-height: 77px; max-width: 76px; }
  .pdf-page-number, .pdf-page-name { font-size: .61rem; }
  .pdf-page-select::after { top: 9px; right: 9px; }
  .pdf-page-item.drag-over::before,
  .pdf-page-item.drop-before::before,
  .pdf-page-item.drop-after::after { top: 0; bottom: 0; width: 3px; height: auto; left: -6px; right: auto; }
  .pdf-page-item.drop-after::after { left: auto; right: -6px; }
  .pdf-preview-toolbar { min-height: 56px; padding-inline: 12px; gap: 8px; }
  .pdf-preview-toolbar h2 { font-size: .78rem; }
  .pdf-remove-page { margin-left: 0; padding-inline: 6px; }
  .pdf-preview-stage { min-height: 360px; padding: 18px; }
  .pdf-preview-empty h3 { font-size: 1.05rem; }
  #preview-canvas { max-height: 490px; }
}
