.pdf-all-in-one {
  --page-bg: #f4f4f1;
  --surface: rgba(255, 255, 255, .54);
  --surface-strong: rgba(255, 255, 255, .82);
  --ink: #1f1f1d;
  --text: #2b2a27;
  --muted: #62605a;
  --pale: #6e6b62;
  --line: rgba(31, 31, 29, .14);
  --line-soft: rgba(31, 31, 29, .08);
  --danger: #8a2f2f;
  --ok: #315f47;
  --shadow: 0 18px 42px rgba(31, 31, 29, .055);
  color: var(--ink);
  background: var(--page-bg);
  min-height: 100vh;
  padding: 96px 20px 112px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
    "Hiragino Sans", "Noto Sans JP", sans-serif;
}

.pdf-all-in-one *,
.pdf-all-in-one *::before,
.pdf-all-in-one *::after {
  box-sizing: border-box;
}

.pdf-shell {
  width: min(100%, 1120px);
  margin: 0 auto;
}

.pdf-kicker {
  margin: 0 0 14px;
  color: var(--pale);
  font-size: .76rem;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.pdf-all-in-one h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", "Noto Serif JP", serif;
  font-size: clamp(2.35rem, 6vw, 4.8rem);
  font-weight: 400;
  line-height: 1.06;
  letter-spacing: 0;
}

.pdf-lead {
  max-width: 720px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.85;
}

.privacy-note {
  margin: 28px 0 0;
  padding: 14px 0;
  color: var(--muted);
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  font-size: .92rem;
  line-height: 1.75;
}

.tool-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 34px;
  margin-top: 52px;
  align-items: start;
}

.tool-tabs {
  position: sticky;
  top: 76px;
  display: grid;
  gap: 7px;
  padding: 12px;
  background: rgba(255, 255, 255, .32);
  border: 1px solid var(--line-soft);
}

.tool-tab {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .92rem;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.tool-tab:hover {
  background: rgba(255, 255, 255, .42);
  color: var(--ink);
}

.tool-tab.is-active {
  background: var(--surface-strong);
  border-color: var(--line);
  color: var(--ink);
}

.tool-panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow);
}

.tool-panel__header {
  padding: 28px 30px 24px;
  border-bottom: 1px solid var(--line-soft);
}

.tool-panel__header h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", "Noto Serif JP", serif;
  font-size: clamp(1.55rem, 3vw, 2.15rem);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.24;
}

.tool-panel__header p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: .94rem;
  line-height: 1.75;
}

.tool-form {
  display: grid;
  gap: 24px;
  padding: 28px 30px 30px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.field,
.file-field {
  display: grid;
  gap: 8px;
}

.field span,
.file-field span {
  color: var(--muted);
  font-size: .82rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea,
.file-field input[type="file"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, .66);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  padding: 10px 12px;
}

.file-field {
  position: relative;
  justify-self: start;
}

.file-field input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}

.file-field span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, .62);
  color: var(--text);
  font-size: .88rem;
  letter-spacing: 0;
  text-transform: none;
}

.field textarea {
  min-height: 190px;
  resize: vertical;
  line-height: 1.7;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.file-field input[type="file"]:focus {
  outline: 2px solid rgba(31, 31, 29, .16);
  outline-offset: 2px;
}

.field-hint {
  margin: 0;
  color: var(--pale);
  font-size: .82rem;
  line-height: 1.65;
}

.conditional-field.is-hidden {
  display: none;
}

.drop-target {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, .42);
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.drop-target__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.drop-target__input:focus-visible {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  clip: auto;
  outline: 2px solid rgba(31, 31, 29, .35);
  outline-offset: 2px;
}

.drop-target.is-dragover {
  background: rgba(255, 255, 255, .88);
  border-color: rgba(31, 31, 29, .6);
  border-style: solid;
  box-shadow: inset 0 0 0 2px rgba(31, 31, 29, .1), 0 12px 28px rgba(31, 31, 29, .06);
  transform: translateY(-1px);
}

.drop-target.is-selected {
  border-style: solid;
  border-color: rgba(31, 31, 29, .26);
  background: rgba(255, 255, 255, .58);
}

.drop-target__copy {
  display: grid;
  gap: 6px;
}

.drop-target__label,
.selection-card__label {
  color: var(--pale);
  font-size: .76rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.drop-target__copy strong {
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.45;
}

.drop-target__hint {
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.6;
}

.drop-target__state {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  margin-top: 2px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, .74);
  color: var(--ink);
  font-size: .86rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.drop-target.is-dragover .drop-target__state {
  background: #1f1f1d;
  border-color: #1f1f1d;
  color: #fff;
  font-size: .92rem;
}

.drop-target__state[hidden] {
  display: none;
}

.selection-summary:empty {
  display: none;
}

.selection-card {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: rgba(255, 255, 255, .62);
}

.selection-card + .selection-card {
  margin-top: 8px;
}

.selection-card strong {
  color: var(--ink);
  font-size: .98rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.selection-card span:not(.selection-card__label) {
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.55;
}

.selection-card--summary {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.selection-error {
  display: block;
  color: var(--danger);
}

.file-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.file-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 46px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, .58);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
}

.file-item__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.file-move {
  min-width: 44px;
  min-height: 44px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .82rem;
  cursor: pointer;
}

.file-move:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.file-item.is-sortable {
  cursor: grab;
}

.file-item-chosen {
  background: var(--surface-strong);
}

.file-item-ghost {
  opacity: .45;
}

.file-item__main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.file-order-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 30px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, .74);
  color: var(--ink);
  font-size: .8rem;
}

.file-name {
  overflow: hidden;
  color: var(--text);
  font-size: .92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta {
  color: var(--pale);
  font-size: .78rem;
}

.file-grip {
  min-height: 44px;
  padding: 6px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: rgba(255, 255, 255, .46);
  color: var(--muted);
  font-size: .78rem;
  cursor: grab;
  user-select: none;
}

.order-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 40px;
}

.order-chip {
  min-width: 44px;
  min-height: 44px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, .68);
  color: var(--text);
  font: inherit;
  font-size: .9rem;
  cursor: grab;
}

.order-chip-chosen {
  background: var(--surface-strong);
}

.order-chip-ghost {
  opacity: .45;
}

.remove-file {
  min-height: 44px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-btn,
.secondary-btn,
.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
  font-size: .92rem;
  text-decoration: none;
  cursor: pointer;
}

.primary-btn {
  background: #1f1f1d;
  color: #fff;
  border-color: #1f1f1d;
}

.primary-btn:disabled {
  cursor: not-allowed;
  opacity: .42;
}

.secondary-btn,
.link-btn {
  background: rgba(255, 255, 255, .48);
  color: var(--text);
}

.status-line {
  min-height: 28px;
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.6;
}

.status-line.is-error {
  color: var(--danger);
}

.status-line.is-ok {
  color: var(--ok);
}

.result-box {
  display: none;
  padding: 18px;
  background: rgba(255, 255, 255, .56);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
}

.result-box.is-visible {
  display: block;
}

.result-box p {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.75;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.result-actions--text {
  margin-bottom: 12px;
}

.text-result {
  width: 100%;
  min-height: 260px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, .74);
  color: var(--text);
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: .88rem;
  line-height: 1.65;
  padding: 12px;
  resize: vertical;
}

@media (max-width: 860px) {
  .pdf-all-in-one {
    padding: 84px 16px 90px;
  }

  .tool-layout {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .tool-tabs {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .tool-panel__header,
  .tool-form {
    padding-left: 18px;
    padding-right: 18px;
  }

  .file-item {
    grid-template-columns: 1fr;
  }

  .file-item__controls {
    width: 100%;
  }

  .file-move,
  .file-grip,
  .remove-file {
    flex: 1 1 auto;
  }

  .selection-card--summary {
    grid-template-columns: 1fr;
  }
}
