@font-face {
  font-family: Manrope;
  src: url('/assets/manrope.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
}

:root {
  font-family: Manrope, system-ui, sans-serif;
  color-scheme: light;
  background: #f7f6f2;
  color: #242a41;
  --ink: #242a41;
  --muted: #5d6375;
  --line: #dcdfe7;
  --blue: #343d77;
  --accent: #a43e37;
  --paper: #fff;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; text-underline-offset: 0.2em; }
::selection { background: #f5d6ce; color: var(--ink); }
:focus-visible { outline: 3px solid #5965bf; outline-offset: 3px; }
.wrap { width: min(69rem, calc(100% - 3rem)); margin-inline: auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; z-index: 2; top: 0.7rem; left: 0.7rem; transform: translateY(-200%); padding: 0.7rem 1rem; background: #fff; border-radius: 0.5rem; }
.skip-link:focus { transform: none; }

.site-header { border-bottom: 1px solid var(--line); }
.header-inner { position: relative; min-height: 4.45rem; display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; }
.brand { display: inline-flex; align-items: center; gap: 0.65rem; text-decoration: none; font-size: 1.15rem; font-weight: 800; white-space: nowrap; }
.nav { display: flex; align-items: center; gap: 1rem; font-size: 0.875rem; font-weight: 750; }
.nav a { text-decoration: none; }
.nav a:hover { text-decoration: underline; }
.outline, .merge-button, .download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.5rem 0.8rem;
  border: 1px solid #bcc3d3;
  border-radius: 0.55rem;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 800;
  white-space: nowrap;
}
.outline:hover:not(:disabled) { background: #f0f2fa; }
.outline:disabled { color: var(--muted); background: #f3f3f6; }
.share-popover { position: absolute; z-index: 2; top: calc(100% + 0.4rem); right: 0; width: min(23rem, 100%); padding: 1rem; border: 1px solid var(--line); border-radius: 0.8rem; background: var(--paper); }
.share-popover label { display: block; margin-bottom: 0.5rem; font-weight: 800; }
.share-popover input { width: 100%; padding: 0.65rem; border: 1px solid #bcc3d3; border-radius: 0.4rem; }

.intro { padding-block: 2.8rem 1.9rem; }
.intro h1 { margin: 0; font-size: 3.6rem; line-height: 1.05; font-weight: 800; letter-spacing: -0.04em; }
.intro p { max-width: 47ch; margin: 0.8rem 0 0; color: var(--muted); line-height: 1.65; }
.notice { padding: 0.75rem 1rem; background: #eeeef7; border-radius: 0.55rem; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1.15rem; align-items: start; }
.files-panel, .preview-panel { min-width: 0; padding: 1.35rem; border-radius: 1rem; }
.files-panel { border: 1px solid var(--line); background: var(--paper); }
.preview-panel { background: #282f54; color: #fff; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 0.7rem; min-height: 2.75rem; margin-bottom: 0.65rem; }
.panel-heading h2 { margin: 0; font-size: 1.08rem; font-weight: 800; letter-spacing: -0.015em; }
.text-button { min-height: 2.75rem; padding: 0.45rem 0.6rem; border: 0; border-radius: 0.45rem; background: transparent; color: var(--blue); font-size: 0.875rem; font-weight: 800; }
.text-button:hover:not(:disabled) { text-decoration: underline; text-underline-offset: 0.2em; }
.text-button:disabled { color: var(--muted); }
.dropzone { position: relative; display: flex; align-items: center; gap: 1rem; min-height: 6.6rem; padding: 0.85rem 1rem; border: 1px dashed #8c98bd; border-radius: 0.75rem; background: #f0f2fc; }
.dropzone.dragging, .dropzone:has(input:not(:disabled)):hover { border-color: #465493; background: #e8ecfa; }
.dropzone:has(input:focus-visible) { outline: 3px solid #5965bf; outline-offset: 3px; }
.dropzone label { color: var(--blue); font-weight: 800; cursor: pointer; }
.dropzone:has(input:disabled) label { color: var(--muted); cursor: default; }
.dropzone label::after { position: absolute; content: ''; inset: 0; }
.dropzone p { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.875rem; }
.upload-icon { position: relative; flex: none; width: 2rem; height: 2.5rem; border: 2px solid #5c6798; border-radius: 0.3rem; }
.upload-icon::before, .upload-icon::after { position: absolute; content: ''; inset: 50% auto auto 50%; width: 0.85rem; height: 2px; transform: translate(-50%, -50%); background: #5c6798; }
.upload-icon::after { transform: translate(-50%, -50%) rotate(90deg); }
.problem { margin: 0.75rem 0 0; color: #952f32; font-size: 0.875rem; overflow-wrap: anywhere; }
.order-note { margin: 1rem 0 0.45rem; color: var(--muted); font-size: 0.875rem; }
.file-list { display: grid; gap: 0.3rem; margin: 0; padding: 0; list-style: none; }
.file-row { display: flex; align-items: center; gap: 0.45rem; min-width: 0; padding: 0.35rem 0.45rem 0.35rem 0.55rem; border: 1px solid var(--line); border-radius: 0.6rem; }
.file-row.selected { border-color: #aeb8dd; background: #f3f5fe; }
.file-row.drop-target { outline: 2px solid #5965bf; outline-offset: 1px; }
.file-row[draggable="true"] { cursor: grab; }
.file-label { flex: 1; min-width: 0; min-height: 2.75rem; padding: 0.25rem 0.35rem; text-align: left; border: 0; border-radius: 0.3rem; background: transparent; color: var(--ink); }
.file-label:hover .file-name { text-decoration: underline; }
.file-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.88rem; font-weight: 800; }
.file-pages { display: block; color: var(--muted); font-size: 0.78rem; }
.file-tools { display: flex; gap: 0.2rem; }
.row-button { display: grid; place-items: center; width: 2.75rem; min-height: 2.75rem; padding: 0.5rem; border: 1px solid transparent; border-radius: 0.45rem; color: var(--blue); background: transparent; }
.row-button:hover:not(:disabled) { border-color: var(--line); background: #fff; }
.row-button:disabled { color: #777d90; }
.row-button::before { content: ''; width: 0.55rem; height: 0.55rem; border-top: 2px solid; border-left: 2px solid; transform: rotate(45deg) translate(1px, 1px); }
.row-button[data-action="down"]::before { transform: rotate(225deg) translate(1px, 1px); }
.row-button[data-action="remove"]::before { width: 0.85rem; height: 0.85rem; border: 0; transform: none; background: linear-gradient(45deg, transparent 44%, currentColor 44% 56%, transparent 56%), linear-gradient(-45deg, transparent 44%, currentColor 44% 56%, transparent 56%); }
.actions { display: flex; justify-content: space-between; align-items: center; gap: 0.65rem; flex-wrap: wrap; margin-top: 1rem; }
.actions p { margin: 0; color: var(--muted); font-size: 0.875rem; }
.merge-button { color: #fff; background: var(--blue); border-color: var(--blue); }
.merge-button:hover:not(:disabled) { background: #292f61; }
.merge-button:disabled { color: #555b75; background: #ecedf5; border-color: #ecedf5; }
.download-area { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.65rem; padding: 0.75rem; margin-top: 0.85rem; background: #f9ebe7; border-radius: 0.55rem; color: #742b25; font-size: 0.875rem; font-weight: 750; }
.download-link { background: #ab4138; border-color: #ab4138; color: #fff; text-decoration: none; }
.download-link:hover { background: #91352d; }

.preview-count { color: #e8ebfa; font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.preview-stage { display: grid; place-items: center; min-height: 15rem; padding: 1rem; background: #343d68; border-radius: 0.75rem; }
.preview-stage > p { margin: 0; color: #edf0ff; text-align: center; font-size: 0.9rem; }
.page-canvas { display: grid; place-items: center; width: 100%; }
.page-canvas canvas { display: block; max-width: 100%; max-height: 22rem; width: auto; height: auto; object-fit: contain; background: #fff; border-radius: 0.15rem; }
.preview-controls { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.65rem; margin-top: 0.85rem; }
.preview-controls p { flex: 1; min-width: 7rem; margin: 0; overflow-wrap: anywhere; color: #edf0ff; font-size: 0.84rem; }
.stepper { display: flex; gap: 0.35rem; }
.preview-panel .outline { background: #f5f6ff; }
.preview-panel .outline:disabled { background: #37406a; color: #e5e8fa; border-color: #7180ac; }
.preview-panel :focus-visible { outline-color: #ffc2b5; }

.guide { max-width: 47rem; padding-block: 2.8rem; scroll-margin-top: 1rem; }
.guide h2 { margin: 0 0 0.8rem; font-size: 1.5rem; line-height: 1.3; letter-spacing: -0.025em; }
.guide ol { margin: 0; padding-left: 1.35rem; color: var(--muted); line-height: 1.65; }
.guide ol li + li { margin-top: 0.3rem; }
.guide strong { color: var(--ink); }
.questions { margin-top: 1.4rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--line); }
.questions details { border-top: 1px solid var(--line); }
.questions summary { padding: 0.85rem 0.75rem; cursor: pointer; font-size: 0.94rem; font-weight: 800; }
.questions p { margin: 0 0 0.9rem; padding-inline: 0.75rem; color: var(--muted); line-height: 1.6; }
.site-footer { padding-block: 1.1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.84rem; }

@media (max-width: 51rem) {
  .wrap { max-width: 41rem; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .intro { padding-block: 2.2rem 1.45rem; }
  .intro h1 { font-size: 3rem; }
}
@media (max-width: 30rem) {
  .wrap { width: calc(100% - 1.6rem); }
  .header-inner { min-height: 3.8rem; }
  .nav a { display: none; }
  .intro h1 { font-size: 2.6rem; }
  .files-panel, .preview-panel { padding: 0.9rem; }
  .dropzone { gap: 0.65rem; }
  .preview-stage { min-height: 12rem; }
  .guide { padding-block: 2.15rem; }
}
