.pdf-text-tool {
  display: grid;
  gap: 22px;
}

.pdf-text-heading h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(34px, 4vw, 56px);
  font-weight: 550;
  letter-spacing: -0.035em;
}

.pdf-text-heading p {
  max-width: 1180px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.75;
}

.pdf-text-workspace {
  min-height: 620px;
  padding: 0;
  overflow: hidden;
}

.pdf-text-toolbar {
  display: grid;
  padding: 18px;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.pdf-text-toolbar-top,
.pdf-text-results-head,
.pdf-text-editor-bar {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.pdf-text-file-summary {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.pdf-text-file-summary > div {
  min-width: 0;
}

.pdf-text-file-summary > svg {
  flex: 0 0 24px;
  color: var(--brand);
}

.pdf-text-file-summary strong,
.pdf-text-file-summary span {
  display: block;
}

.pdf-text-file-summary strong {
  max-width: min(720px, 62vw);
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 550;
}

.pdf-text-file-summary span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.pdf-text-controls {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.pdf-text-select-field,
.pdf-text-input-field {
  display: grid;
  position: relative;
  width: auto;
  height: 64px;
  min-width: 0;
  padding: 9px 42px 7px 16px;
  align-content: center;
  gap: 1px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.pdf-text-input-field {
  padding-right: 16px;
}

.pdf-text-select-field:focus-within,
.pdf-text-input-field:focus-within {
  border-color: rgba(207, 75, 69, 0.48);
  box-shadow: 0 0 0 3px rgba(207, 75, 69, 0.08);
}

.pdf-text-select-field > span,
.pdf-text-input-field > span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.pdf-text-select-field > select,
.pdf-text-input-field > input {
  width: 100%;
  min-width: 0;
  height: 26px;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font: inherit;
  line-height: 26px;
}

.pdf-text-select-field > select {
  appearance: none;
}

.pdf-text-select-field::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 16px;
  width: 18px;
  height: 18px;
  pointer-events: none;
  transform: translateY(-50%);
  background: center / 18px 18px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%237b8492' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.pdf-text-select-field:has(select:disabled),
.pdf-text-input-field:has(input:disabled) {
  background: #f2efed;
}

.pdf-text-select-field:has(select:disabled) > span,
.pdf-text-select-field > select:disabled,
.pdf-text-input-field:has(input:disabled) > span,
.pdf-text-input-field > input:disabled {
  color: var(--soft-text);
}

.pdf-text-primary-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.pdf-text-primary-actions .g_button {
  min-width: 118px;
  white-space: nowrap;
}

.pdf-text-icon-button {
  display: inline-flex;
  width: 44px;
  height: 44px;
  padding: 0;
  flex: 0 0 44px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
}

.pdf-text-icon-button:hover:not(:disabled) {
  color: var(--brand);
  border-color: rgba(207, 75, 69, 0.22);
}

.pdf-text-icon-button:disabled {
  color: var(--soft-text);
}

.pdf-text-progress {
  display: grid;
  padding: 14px 16px;
  gap: 9px;
  background: var(--surface);
  border-radius: 14px;
}

.pdf-text-progress > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pdf-text-progress strong {
  color: var(--ink);
  font-weight: 550;
}

.pdf-text-progress span {
  color: var(--muted);
}

.pdf-text-progress progress {
  width: 100%;
  height: 7px;
  overflow: hidden;
  appearance: none;
  border: 0;
  border-radius: 999px;
}

.pdf-text-progress progress::-webkit-progress-bar {
  background: #e8e3e0;
}

.pdf-text-progress progress::-webkit-progress-value,
.pdf-text-progress progress::-moz-progress-bar {
  background: var(--brand);
  border-radius: 999px;
}

.pdf-text-empty {
  display: grid;
  min-height: 430px;
  padding: 54px 24px;
  place-content: center;
  justify-items: center;
  text-align: center;
}

.pdf-text-empty.is-dragging {
  background: var(--brand-soft);
  outline: 2px dashed rgba(207, 75, 69, 0.34);
  outline-offset: -16px;
}

.pdf-text-empty svg {
  color: var(--brand);
}

.pdf-text-empty h2 {
  margin: 20px 0 0;
  color: var(--ink);
  font-size: 24px;
  font-weight: 550;
}

.pdf-text-empty p {
  max-width: 690px;
  margin: 10px 0 20px;
  color: var(--muted);
  line-height: 1.7;
}

.pdf-text-file-button {
  cursor: pointer;
}

.pdf-text-password {
  display: grid;
  margin: 18px;
  padding: 16px;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 360px) auto;
  align-items: center;
  gap: 12px;
  background: var(--brand-soft);
  border: 1px solid rgba(207, 75, 69, 0.2);
  border-radius: 14px;
}

.pdf-text-password strong,
.pdf-text-password span {
  display: block;
}

.pdf-text-password strong {
  color: var(--ink);
  font-weight: 550;
}

.pdf-text-password span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.pdf-text-message {
  margin: 18px;
  padding: 13px 16px;
  color: var(--muted);
  background: var(--surface);
  border-radius: 12px;
  line-height: 1.6;
}

.pdf-text-message[data-tone="error"] {
  color: var(--brand);
  background: var(--brand-soft);
}

.pdf-text-message[data-tone="success"] {
  color: #267657;
  background: #edf7f2;
}

.pdf-text-results {
  display: grid;
  padding: 18px;
  gap: 16px;
}

.pdf-text-results-head {
  flex-wrap: wrap;
}

.pdf-text-results-head > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.pdf-text-results-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
  font-weight: 550;
}

.pdf-text-results-head span {
  color: var(--muted);
}

.pdf-text-search {
  display: flex;
  width: min(100%, 430px);
  align-items: center;
  gap: 8px;
}

.pdf-text-search .g_input {
  min-width: 0;
}

.pdf-text-search > span {
  min-width: 48px;
  text-align: right;
  font-size: 13px;
  white-space: nowrap;
}

.pdf-text-result-layout {
  display: grid;
  min-height: 480px;
  grid-template-columns: 170px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.pdf-text-pages {
  padding: 14px;
  border-right: 1px solid var(--line);
}

.pdf-text-pages > strong {
  display: block;
  margin: 0 8px 10px;
  color: var(--ink);
  font-weight: 550;
}

.pdf-text-pages > div {
  display: grid;
  max-height: 440px;
  overflow: auto;
  gap: 4px;
}

.pdf-text-page-button {
  width: 100%;
  min-height: 38px;
  padding: 7px 10px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 10px;
  text-align: left;
}

.pdf-text-page-button:hover,
.pdf-text-page-button.active {
  color: var(--brand);
  background: var(--brand-soft);
}

.pdf-text-page-button.has-no-text::after {
  content: "无文字";
  float: right;
  color: var(--soft-text);
  font-size: 11px;
}

.pdf-text-editor {
  display: grid;
  min-width: 0;
  grid-template-rows: auto minmax(0, 1fr);
}

.pdf-text-editor-bar {
  min-height: 52px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
}

.pdf-text-editor-bar strong {
  color: var(--ink);
  font-weight: 550;
}

.pdf-text-inline-action {
  min-height: 36px;
  padding: 6px 10px;
  color: var(--brand);
  background: transparent;
  border: 0;
  border-radius: 9px;
}

.pdf-text-inline-action:hover {
  background: var(--brand-soft);
}

#pdfTextOutput {
  width: 100%;
  min-height: 426px;
  padding: 18px;
  resize: vertical;
  color: var(--ink);
  background: var(--surface);
  border: 0;
  outline: 0;
  font: 15px/1.8 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

@media (max-width: 960px) {
  .pdf-text-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pdf-text-password {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .pdf-text-heading h1 {
    font-size: 36px;
  }

  .pdf-text-toolbar,
  .pdf-text-results {
    padding: 14px;
  }

  .pdf-text-controls,
  .pdf-text-result-layout {
    grid-template-columns: 1fr;
  }

  .pdf-text-primary-actions .g_button {
    min-width: 0;
    flex: 1 1 calc(50% - 5px);
  }

  .pdf-text-pages {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .pdf-text-pages > div {
    display: flex;
    max-height: none;
    overflow-x: auto;
  }

  .pdf-text-page-button {
    width: auto;
    min-width: 78px;
    white-space: nowrap;
  }
}
