:root { color-scheme: light; font-family: system-ui, sans-serif; color: #0f172a; background: #f8fafc; font-size: 16px; }
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; }
a { color: #2563eb; text-underline-offset: 3px; }
button, input, select { font: inherit; font-variant-numeric: tabular-nums; }
button, select, input:not([type=file]), .download { min-height: 44px; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
:focus-visible { outline: 3px solid #2563eb; outline-offset: 3px; }
[hidden] { display: none !important; }
.topbar { height: 60px; background: #fff; border-bottom: 1px solid #e2e8f0; }
.nav-inner { max-width: 1080px; margin: auto; height: 100%; padding: 0 16px; display: flex; align-items: center; gap: 20px; }
.brand { color: #0f172a; font-weight: 750; text-decoration: none; margin-right: auto; }
.nav-inner nav { display: flex; gap: 16px; }
.nav-inner nav a { display: inline-flex; align-items: center; min-height: 44px; font-size: .9rem; }
main { max-width: 1080px; margin: auto; padding: 16px; }
.breadcrumb { font-size: .85rem; color: #475569; margin-bottom: 8px; }
h1 { font-size: clamp(1.5rem, 4vw, 2rem); line-height: 1.2; margin: 0 0 8px; letter-spacing: -.025em; }
.intro { margin: 0 0 20px; color: #475569; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 32px; align-items: start; }
form, .result { min-width: 0; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.dropzone { display: grid; justify-items: start; gap: 8px; border: 1px dashed #94a3b8; border-radius: 8px; background: #fff; padding: 18px; }
.dropzone.dragover { border-color: #2563eb; background: #eff6ff; }
.dropzone svg { width: 24px; height: 24px; color: #2563eb; }
.dropzone label { font-weight: 650; }
input[type=file] { width: 100%; max-width: 100%; min-height: 44px; font-size: 1rem; }
input::file-selector-button { font: inherit; min-height: 44px; background: #fff; border: 1px solid #94a3b8; border-radius: 5px; padding: 6px 10px; margin-right: 8px; color: #0f172a; cursor: pointer; }
.hint { font-size: .875rem; color: #475569; margin: 6px 0 12px; }
.file-list { list-style: none; padding: 0; margin: 12px 0; }
.file-list li { border-bottom: 1px solid #e2e8f0; padding: 10px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.file-info { flex: 1 1 180px; min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.file-info small { display: block; color: #475569; }
.file-actions { display: flex; gap: 4px; }
.file-actions button { min-width: 44px; padding: 6px 10px; }
button, .download { border: 1px solid #94a3b8; border-radius: 6px; padding: 9px 14px; background: #fff; color: #0f172a; }
.primary, .download { background: #2563eb; border-color: #2563eb; color: #fff; font-weight: 650; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.option { margin: 16px 0; }
.option label { display: block; font-weight: 650; margin-bottom: 6px; }
.option input, .option select { width: 100%; border: 1px solid #94a3b8; border-radius: 6px; padding: 8px 10px; background: #fff; color: #0f172a; }
.result { position: sticky; top: 80px; border-top: 2px solid #0f172a; padding: 16px 0; font-variant-numeric: tabular-nums; }
.result h2 { font-size: 1.15rem; margin: 0 0 8px; }
.result p { overflow-wrap: anywhere; }
#status { color: #475569; }
#error { color: #b91c1c; overflow-wrap: anywhere; }
.download { display: inline-flex; align-items: center; text-decoration: none; max-width: 100%; }
.privacy { color: #475569; font-size: .875rem; margin-top: 20px; }
.guide { border-top: 1px solid #e2e8f0; margin-top: 28px; padding-top: 8px; }
.guide h2 { margin: 16px 0 8px; font-size: 1.125rem; line-height: 1.4; }
details { border-bottom: 1px solid #e2e8f0; padding: 12px 0; }
summary { cursor: pointer; font-weight: 650; min-height: 44px; display: flex; align-items: center; overflow-wrap: anywhere; }
details p { max-width: 75ch; color: #475569; line-height: 1.75; overflow-wrap: anywhere; }
footer { max-width: 1080px; margin: 24px auto; padding: 0 16px; color: #475569; font-size: .875rem; }
/* Stack tablet tools too: the result preview needs room for readable controls. */
@media (max-width: 1023px) { .workspace { grid-template-columns: minmax(0, 1fr); gap: 16px; } .result { position: static; } }
@media (max-width: 700px) { .nav-inner { gap: 12px; } .nav-inner nav { gap: 12px; } .brand { font-size: .95rem; } main { padding-top: 12px; } .intro { margin-bottom: 16px; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Result preview only. Canvas dimensions belong to the renderer, not layout. */
.pdf-preview {
  min-width: 0;
  max-width: 100%;
  margin: 16px 0;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
  color: #0f172a;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.pdf-preview .pdf-preview__title {
  margin: 0 0 8px;
  font-size: 1rem;
  line-height: 1.5;
  font-weight: 650;
}
.pdf-preview .pdf-preview__status,
.pdf-preview .pdf-preview__caption {
  min-width: 0;
  max-width: 100%;
  margin: 0 0 12px;
  color: #475569;
  font-size: 1rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.pdf-preview[data-state="error"] .pdf-preview__status { color: #b91c1c; }
.pdf-preview .pdf-preview__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  margin-bottom: 12px;
}
.pdf-preview .pdf-preview__button {
  min-width: 44px;
  min-height: 44px;
  max-width: 100%;
  padding: 9px 12px;
  border: 1px solid #94a3b8;
  border-radius: 6px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  white-space: normal;
  overflow-wrap: anywhere;
}
.pdf-preview .pdf-preview__button:hover:not(:disabled) { background: #f1f5f9; border-color: #475569; }
.pdf-preview .pdf-preview__button:disabled { opacity: 1; color: #64748b; border-color: #cbd5e1; background: #f8fafc; cursor: not-allowed; }
.pdf-preview .pdf-preview__counter,
.pdf-preview .pdf-preview__zoom {
  min-width: 0;
  max-width: 100%;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}
.pdf-preview .pdf-preview__counter { text-align: center; }
.pdf-preview .pdf-preview__zoom { color: #475569; }
.pdf-preview .pdf-preview__viewport {
  min-width: 0;
  max-width: 100%;
  max-height: min(60vh, 640px);
  overflow: auto;
  overscroll-behavior: contain;
  background: #f1f5f9;
}
.pdf-preview .pdf-preview__canvas {
  display: block;
  max-width: none;
  background: #fff;
}
.pdf-preview .pdf-preview__caption { margin: 10px 0 0; }
.pdf-preview :focus-visible { outline: 3px solid #2563eb; outline-offset: 3px; }
.pdf-preview .pdf-preview__viewport:focus-visible { outline-offset: -3px; }
.pdf-preview[hidden], .pdf-preview [hidden] { display: none !important; }
