:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #f1f4f7;
  --ink: #121926;
  --muted: #5b6675;
  --primary: #1d4ed8;
  --primary-strong: #1e3a8a;
  --secondary: #0f766e;
  --border: #e5e7eb;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.1);
  --shadow-md: 0 12px 26px rgba(16, 24, 40, 0.12);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --max-width: 1200px;
  --font-body: "Source Sans 3", "Segoe UI Variable", "Segoe UI", "Noto Sans", sans-serif;
  --font-display: "Source Serif 4", "Georgia", "Times New Roman", serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -20%, rgba(29, 78, 216, 0.08), transparent 60%),
    radial-gradient(1000px 600px at 100% -10%, rgba(15, 118, 110, 0.08), transparent 60%),
    var(--bg);
  min-height: 100vh;
  line-height: 1.6;
}

img, svg { max-width: 100%; }

a { color: inherit; text-decoration: none; }

h1, h2, h3 { font-family: var(--font-display); letter-spacing: 0.2px; margin: 0 0 10px; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(29, 78, 216, 0.35);
  outline-offset: 2px;
}

.tf-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.tf-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.tf-header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
}

.tf-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  white-space: nowrap;
}

.tf-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 10px;
}

.tf-nav-link,
.tf-nav details summary {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  max-width: 190px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tf-nav-link:hover,
.tf-nav details summary:hover {
  background: var(--surface-2);
}

.tf-nav details {
  position: relative;
}

.tf-nav details summary {
  list-style: none;
}

.tf-nav details summary::-webkit-details-marker { display: none; }

.tf-nav-panel {
  position: absolute;
  top: 110%;
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr);
  gap: 12px;
  min-width: 320px;
  box-shadow: var(--shadow-md);
  z-index: 20;
}

.tf-nav-group strong {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}

.tf-nav-group a {
  display: block;
  padding: 6px 0;
  font-size: 0.92rem;
  color: var(--ink);
}

.tf-nav-group a:hover { color: var(--primary); }

.tf-nav-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.tf-nav-toggle svg { width: 18px; height: 18px; }

.tf-search {
  flex: 1 1 320px;
  position: relative;
  min-width: 220px;
}

.tf-search input {
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tf-search input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.16);
}

.tf-search-results {
  position: absolute;
  top: 112%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: none;
  max-height: 320px;
  overflow: auto;
  box-shadow: var(--shadow-md);
  z-index: 40;
}

.tf-search-results a {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
  word-break: break-word;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tf-search-results a:last-child { border-bottom: none; }

.tf-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.tf-actions .tf-select {
  width: auto;
  min-width: 90px;
}

.tf-select,
.tf-input,
textarea {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  width: 100%;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tf-select:focus,
.tf-input:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.16);
}

.tf-main { padding: 18px 0 40px; }

.tf-page {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.tf-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  padding: 28px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(29, 78, 216, 0.08), rgba(15, 118, 110, 0.06));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

@media (min-width: 980px) {
  .tf-hero { grid-template-columns: 1.4fr 0.6fr; align-items: center; }
}

.tf-hero p { margin: 8px 0 0; color: var(--muted); }

.tf-hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

.tf-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  text-align: center;
  white-space: normal;
  line-height: 1.2;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 8px 16px rgba(29, 78, 216, 0.2);
}

.tf-btn:hover { transform: translateY(-1px); }

.tf-btn-secondary {
  background: var(--secondary);
  color: #fff;
  border: none;
  box-shadow: 0 8px 16px rgba(15, 118, 110, 0.18);
}

.tf-btn-outline {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary-strong);
  box-shadow: none;
}

.tf-section h2 { margin-bottom: 12px; }

.tf-intro { margin: 0; color: var(--muted); }

.tf-grid,
.tf-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.tf-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tf-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.tf-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.tf-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(29, 78, 216, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.tf-card-icon svg { width: 18px; height: 18px; }

.tf-card span {
  color: var(--muted);
  font-size: 0.92rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  hyphens: auto;
}

.tf-card-header strong {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.2;
  max-height: 2.4em;
  overflow-wrap: anywhere;
}

.tf-card-meta {
  font-size: 0.8rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tf-card .tf-card-meta {
  display: inline-flex;
  -webkit-line-clamp: unset;
  -webkit-box-orient: unset;
  overflow: visible;
}

.tf-breadcrumbs { font-size: 0.9rem; color: var(--muted); }

.tf-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }

.tf-field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; }

.tf-label { font-size: 0.9rem; font-weight: 600; color: var(--ink); }

.tf-tool,
.tf-tools-list,
.tf-guide,
.tf-category,
.tf-hub { display: flex; flex-direction: column; gap: 18px; }

.tf-tool-area {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

@media (min-width: 980px) {
  .tf-tool-area { grid-template-columns: 1.1fr 0.9fr; }
  .tf-tool-area.tf-fullwidth { grid-template-columns: 1fr; }
}

.tf-tool-ui,
.tf-output-panel,
.tf-howto,
.tf-related,
.tf-faq,
.tf-tool-detail,
.tf-content-block,
.tf-guide .tf-content-block {
  background: var(--surface);
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow-wrap: break-word;
}

.tf-output {
  white-space: pre-wrap;
  background: var(--surface-2);
  padding: 14px;
  border-radius: var(--radius-sm);
  min-height: 60px;
  border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.tf-tool-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.tf-tool-actions button {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  text-align: center;
  white-space: normal;
  line-height: 1.2;
}

.tf-tool-actions button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.tf-tool-actions .tf-btn-secondary {
  background: var(--secondary);
}

#tool-reset {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
}

.tf-note {
  color: var(--muted);
  margin-top: 8px;
  font-size: 0.92rem;
}

.tf-note--error { color: #b91c1c; }
.tf-note--success { color: #065f46; }

.tf-privacy {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 10px;
}

.tf-howto ul { padding-left: 18px; margin: 8px 0 0; }
.tf-howto li,
.tf-faq summary,
.tf-faq p,
.tf-tool-detail p,
.tf-content-block,
.tf-intro {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.tf-faq details {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 10px;
  background: var(--surface-2);
}

.tf-faq summary { cursor: pointer; font-weight: 600; }

.tf-ad {
  border: 1px dashed var(--border);
  padding: 16px 12px;
  text-align: center;
  color: var(--muted);
  border-radius: var(--radius-sm);
  margin: 28px 0;
}

.tf-row + .tf-ad,
.tf-privacy + .tf-ad,
.tf-ad + .tf-howto,
.tf-ad + .tf-tool-detail,
.tf-ad + .tf-faq,
.tf-ad + .tf-related,
.tf-ad + .tf-section,
.tf-ad + .tf-grid,
.tf-ad + .tf-breadcrumbs {
  margin-top: 28px;
}

.tf-footer .tf-ad {
  margin: 28px 0 0;
}

.tf-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.tf-feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
}

.tf-feature-card p { margin: 6px 0 0; }

.tf-feature-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(29, 78, 216, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex: 0 0 auto;
}

.tf-feature-icon svg { width: 18px; height: 18px; }

.tf-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 26px 0 36px;
  margin-top: 40px;
}

.tf-footer-inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  align-items: start;
}

.tf-footer-links { display: flex; flex-direction: column; gap: 6px; }
.tf-footer-links strong {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.tf-cookie-banner {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: var(--radius);
  max-width: 340px;
  box-shadow: var(--shadow-md);
}

.tf-cookie-actions { display: flex; gap: 8px; margin-top: 8px; }

.tf-hidden { display: none !important; }
.tf-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.tf-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 220px;
  width: 100%;
}

.tf-preview-large {
  min-height: 420px;
  height: 420px;
}

.tf-subtitle-preview {
  overflow: auto;
}

.tf-sub-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.tf-sub-editor {
  margin-top: 12px;
  overflow: auto;
}

.tf-sub-editor-table td {
  vertical-align: top;
}

.tf-sub-row-selected {
  outline: 2px solid rgba(29, 78, 216, 0.35);
  background: rgba(29, 78, 216, 0.08);
}

.tf-table { width: 100%; border-collapse: collapse; }
.tf-table th, .tf-table td { border: 1px solid var(--border); padding: 8px; text-align: center; }

.tf-color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.4);
}

.tf-color-swatch.lg {
  width: 36px;
  height: 36px;
}

.tf-swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}

.tf-swatch-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
}

.tf-swatch-color { height: 50px; }

.tf-swatch-label {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.85rem;
  padding: 6px 8px;
}

.tf-timer {
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 1.1rem;
  text-align: center;
}

.tf-pre { white-space: pre-wrap; }
.tf-image-preview { max-width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.tf-canvas { max-width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.tf-base64-output { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; resize: vertical; }

.tf-field > canvas,
.tf-field > svg,
.tf-field > iframe,
.tf-field > .tf-timer,
.tf-field > table {
  width: 100%;
  display: block;
}

.tf-cropper {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.tf-cropper .tf-canvas {
  display: block;
  width: 100%;
  height: auto;
}

.tf-crop-box {
  position: absolute;
  border: 2px solid #0ea5e9;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.25);
  cursor: move;
  box-sizing: border-box;
}

.tf-crop-handle {
  width: 12px;
  height: 12px;
  background: #0ea5e9;
  border: 2px solid #ffffff;
  border-radius: 50%;
  position: absolute;
}

.tf-crop-handle.nw { top: -6px; left: -6px; cursor: nwse-resize; }
.tf-crop-handle.ne { top: -6px; right: -6px; cursor: nesw-resize; }
.tf-crop-handle.sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.tf-crop-handle.se { bottom: -6px; right: -6px; cursor: nwse-resize; }

.tf-pdf-editor {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 300px;
  gap: 14px;
}

.tf-pdf-sidebar,
.tf-pdf-main,
.tf-pdf-inspector {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 12px;
}

.tf-pdf-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  padding: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tf-pdf-dropzone strong {
  color: var(--ink);
  font-size: 0.95rem;
}

.tf-pdf-dropzone span {
  font-size: 0.88rem;
}

.tf-pdf-dropzone.is-over {
  border-color: var(--primary);
  background: rgba(29, 78, 216, 0.08);
}

.tf-pdf-page-nav {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.tf-pdf-page-status {
  font-size: 0.86rem;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tf-pdf-thumb-list {
  margin-top: 10px;
  max-height: 280px;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.tf-pdf-thumb {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 8px;
  display: grid;
  gap: 6px;
  cursor: pointer;
}

.tf-pdf-thumb.is-active {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px rgba(29, 78, 216, 0.3);
}

.tf-pdf-thumb-canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #fff;
}

.tf-pdf-thumb-label {
  font-size: 0.78rem;
  color: var(--muted);
}

.tf-pdf-layers-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.tf-pdf-layers-head h3 {
  margin: 0;
  margin-right: auto;
}

.tf-pdf-layer-list {
  margin-top: 8px;
  display: grid;
  gap: 8px;
  max-height: 240px;
  overflow: auto;
}

.tf-pdf-layer-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 6px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.tf-pdf-layer-item.is-active {
  border-color: var(--primary);
}

.tf-pdf-layer-pick {
  background: transparent;
  border: none;
  text-align: left;
  padding: 4px;
  cursor: pointer;
}

.tf-pdf-layer-pick strong {
  display: block;
}

.tf-pdf-layer-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.tf-pdf-layer-actions {
  display: inline-flex;
  gap: 4px;
}

.tf-pdf-layer-actions .tf-btn-secondary {
  padding: 4px 6px;
}

.tf-pdf-main {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tf-pdf-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tf-pdf-zoom-wrap {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.tf-pdf-stage-wrap {
  background: #0f172a;
  border-radius: var(--radius-sm);
  border: 1px solid #0b1220;
  padding: 10px;
  overflow: auto;
  min-height: 360px;
}

.tf-pdf-stage {
  margin: 0 auto;
  position: relative;
}

.tf-pdf-canvas {
  display: block;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  box-shadow: 0 12px 30px rgba(0,0,0,0.24);
}

.tf-pdf-overlay {
  position: absolute;
  inset: 0;
}

.tf-pdf-layer {
  position: absolute;
  transform-origin: top left;
  user-select: none;
  cursor: grab;
}

.tf-pdf-layer:active {
  cursor: grabbing;
}

.tf-pdf-layer--text {
  padding: 2px 4px;
  background: rgba(255,255,255,0.35);
  border: 1px dashed rgba(17,24,39,0.4);
  border-radius: 4px;
  white-space: nowrap;
}

.tf-pdf-layer--rect {
  min-width: 16px;
  min-height: 10px;
  box-sizing: border-box;
}

.tf-pdf-layer.is-active {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.tf-pdf-result-wrap h3,
.tf-pdf-inspector h3 {
  margin: 4px 0 8px;
}

.tf-pdf-result {
  width: 100%;
  min-height: 340px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
}

.tf-pdf-inspector-body {
  display: grid;
  gap: 8px;
}

body.tf-dragging-layer {
  cursor: grabbing !important;
}

@media (max-width: 980px) {
  .tf-pdf-editor {
    grid-template-columns: 1fr;
  }
  .tf-pdf-thumb-list,
  .tf-pdf-layer-list {
    max-height: 180px;
  }
  .tf-pdf-result {
    min-height: 280px;
  }
  .tf-header-inner { flex-wrap: wrap; }
  .tf-nav { order: 4; width: 100%; flex-direction: column; align-items: flex-start; display: none; }
  body.tf-nav-open .tf-nav { display: flex; }
  .tf-nav-toggle { display: inline-flex; }
  .tf-search { order: 3; width: 100%; }
  .tf-actions { order: 2; margin-left: 0; width: 100%; justify-content: space-between; }
  .tf-nav-panel { position: static; grid-template-columns: 1fr; min-width: 100%; border: none; box-shadow: none; padding: 6px 0; }
  .tf-nav details summary { width: 100%; }
  .tf-nav-link,
  .tf-nav details summary {
    max-width: 100%;
    white-space: normal;
  }
  .tf-ad {
    margin: 32px 0;
    padding: 18px 12px;
  }
}

.tf-pdfx {
  display: grid;
  gap: 12px;
}

.tf-pdfx-topbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 12px;
  display: grid;
  gap: 8px;
}

.tf-pdfx-title {
  margin: 0;
  font-size: 1.06rem;
}

.tf-pdfx-subtitle,
.tf-pdfx-keyboard,
.tf-pdfx-overlay-info {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.tf-pdfx-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tf-pdfx-zoom {
  min-width: 56px;
  text-align: center;
  font-weight: 700;
  color: var(--ink);
}

.tf-pdfx-shell {
  display: grid;
  grid-template-columns: 220px 250px minmax(0, 1fr) 280px;
  gap: 12px;
}

.tf-pdfx-tools,
.tf-pdfx-thumbs,
.tf-pdfx-main,
.tf-pdfx-inspector {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 10px;
}

.tf-pdfx-tools h3,
.tf-pdfx-thumbs h3,
.tf-pdfx-inspector h3 {
  margin: 0 0 8px;
}

.tf-pdfx-tool-list {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.tf-pdfx-tool-btn {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.tf-pdfx-tool-btn.is-active {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px rgba(29, 78, 216, 0.2);
}

.tf-pdfx-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  padding: 12px;
  cursor: pointer;
  display: grid;
  gap: 4px;
}

.tf-pdfx-dropzone strong {
  color: var(--ink);
}

.tf-pdfx-dropzone.is-over {
  border-color: var(--primary);
  background: rgba(29, 78, 216, 0.08);
}

.tf-pdfx-thumb-list {
  margin-top: 10px;
  max-height: 70vh;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.tf-pdfx-thumb {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 8px;
  display: grid;
  gap: 6px;
  cursor: pointer;
}

.tf-pdfx-thumb.is-active {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px rgba(29, 78, 216, 0.28);
}

.tf-pdfx-thumb.is-dragging {
  opacity: 0.55;
}

.tf-pdfx-thumb-canvas {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
}

.tf-pdfx-thumb-meta {
  display: grid;
  gap: 2px;
}

.tf-pdfx-thumb-meta span {
  color: var(--muted);
  font-size: 0.78rem;
}

.tf-pdfx-thumb-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tf-pdfx-thumb-actions .tf-btn-secondary {
  padding: 4px 6px;
  font-size: 0.72rem;
}

.tf-pdfx-main {
  display: grid;
  gap: 8px;
}

.tf-pdfx-page-status {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}

.tf-pdfx-viewer-wrap {
  border-radius: var(--radius-sm);
  border: 1px solid #0f172a;
  background: #0b1327;
  min-height: 420px;
  padding: 10px;
  overflow: auto;
}

.tf-pdfx-viewer-stage {
  position: relative;
  margin: 0 auto;
}

.tf-pdfx-canvas {
  display: block;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  box-shadow: 0 12px 30px rgba(0,0,0,0.26);
}

.tf-pdfx-text-layer,
.tf-pdfx-overlay-host {
  position: absolute;
  inset: 0;
}

.tf-pdfx-text-layer {
  pointer-events: none;
}

.tf-pdfx-text-layer.is-active {
  pointer-events: auto;
}

.tf-pdfx-text-run {
  position: absolute;
  color: transparent;
  user-select: none;
  white-space: pre;
}

.tf-pdfx-text-layer.is-active .tf-pdfx-text-run {
  color: rgba(37, 99, 235, 0.06);
  background: rgba(37, 99, 235, 0.12);
  user-select: text;
  cursor: cell;
}

.tf-pdfx-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d1d5db;
  font-weight: 600;
  text-align: center;
  padding: 16px;
}

.tf-pdfx-inspector-body {
  display: grid;
  gap: 8px;
}

.tf-pdfx-inspector-row {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

@media (max-width: 1260px) {
  .tf-pdfx-shell {
    grid-template-columns: 1fr;
  }

  .tf-pdfx-thumb-list {
    max-height: 220px;
  }

  .tf-pdfx-viewer-wrap {
    min-height: 340px;
  }
}

.tf-pdfx-tool-note {
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.tf-pdfx2 {
  display: grid;
  gap: 14px;
}

.tf-pdfx2-topbar {
  background: linear-gradient(145deg, #ffffff, #f3f6fa);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.tf-pdfx2-head {
  display: grid;
  gap: 4px;
}

.tf-pdfx2-title {
  margin: 0;
  font-size: 1.08rem;
}

.tf-pdfx2-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.tf-pdfx2-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tf-pdfx2-row .tf-btn,
.tf-pdfx2-row .tf-btn-secondary,
.tf-pdfx2-tool-btn {
  padding: 8px 12px;
  line-height: 1.15;
}

.tf-pdfx2-page-label {
  min-width: 132px;
  padding: 0 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
}

.tf-pdfx2-stylebar {
  align-items: flex-end;
}

.tf-pdfx2-zoom {
  min-width: 58px;
  text-align: center;
  font-weight: 700;
  color: var(--ink);
}

.tf-pdfx2-inline-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 700;
}

.tf-pdfx2-inline-label input[type="number"] {
  width: 88px;
  min-width: 0;
  padding: 7px 8px;
}

.tf-pdfx2-inline-label input[type="color"] {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 2px;
}

.tf-pdfx2-inline-label input[type="range"] {
  width: 112px;
}

.tf-pdfx2-text-edit {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 9px 10px;
}

.tf-pdfx2-text-edit > span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.tf-pdfx2-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
}

.tf-pdfx2-sidebar,
.tf-pdfx2-main {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  background: var(--surface);
}

.tf-pdfx2-sidebar {
  padding: 12px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.tf-pdfx2-sidebar h3 {
  margin: 0;
}

.tf-pdfx2-tool-list {
  display: grid;
  gap: 6px;
}

.tf-pdfx2-tool-btn {
  width: 100%;
  text-align: left;
  justify-content: flex-start;
}

.tf-pdfx2-tool-btn.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary-strong);
  box-shadow: 0 8px 18px rgba(29, 78, 216, 0.28);
}

.tf-pdfx2-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.tf-pdfx2-main {
  padding: 12px;
}

.tf-pdfx2-viewer-wrap {
  min-height: 460px;
  border-radius: var(--radius-sm);
  border: 1px solid #0f172a;
  background:
    radial-gradient(70% 65% at 50% 0%, rgba(59, 130, 246, 0.17), transparent 70%),
    linear-gradient(180deg, #0b1327, #0a1022 58%, #111827);
  padding: 12px;
  overflow: auto;
}

.tf-pdfx2-viewer-stage {
  position: relative;
  margin: 0 auto;
}

.tf-pdfx2-canvas {
  display: block;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(2, 6, 23, 0.34);
}

.tf-pdfx2-overlay-host {
  position: absolute;
  inset: 0;
}

.tf-pdfx2-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #cbd5e1;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 20px;
}

@media (max-width: 1100px) {
  .tf-pdfx2-shell {
    grid-template-columns: 1fr;
  }

  .tf-pdfx2-viewer-wrap {
    min-height: 360px;
  }
}

@media (max-width: 820px) {
  .tf-pdfx2-stylebar {
    align-items: center;
  }

  .tf-pdfx2-inline-label {
    width: 100%;
    justify-content: space-between;
  }

  .tf-pdfx2-inline-label input[type="number"],
  .tf-pdfx2-inline-label input[type="range"] {
    width: 100%;
    max-width: 170px;
  }

  .tf-pdfx2-page-label {
    order: -1;
    width: 100%;
    text-align: left;
    padding: 0;
  }

  .tf-pdfx2-text-edit {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

.tf-burnsub {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel);
}

.tf-burnsub-privacy {
  margin: 0;
  color: var(--text);
  font-weight: 700;
}

.tf-burnsub-warning {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

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

.tf-burnsub-col {
  display: grid;
  gap: 10px;
  align-content: start;
}

.tf-burnsub-options {
  display: grid;
  gap: 8px;
}

.tf-burnsub-meta {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
}

.tf-burnsub-meta ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.tf-burnsub-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: #fff;
  overflow-x: auto;
}

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

.tf-burnsub-progress {
  display: grid;
  gap: 8px;
}

.tf-burnsub-progress-bar {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #e5e7eb;
}

.tf-burnsub-progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #2563eb, #10b981);
  transition: width .2s ease;
}

.tf-burnsub-progress-text {
  color: var(--muted);
  font-size: 0.87rem;
}

.tf-burnsub-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.tf-burnsub-status.is-error {
  color: #b91c1c;
}

.tf-burnsub-status.is-success {
  color: #047857;
}

.tf-burnsub-logs {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  overflow: hidden;
}

.tf-burnsub-logs summary {
  cursor: pointer;
  padding: 10px 12px;
  font-weight: 700;
}

.tf-burnsub-log-output {
  margin: 0;
  padding: 12px;
  max-height: 230px;
  overflow: auto;
  background: #0b1022;
  color: #d1d5db;
  font-size: 0.78rem;
  line-height: 1.35;
}

@media (max-width: 980px) {
  .tf-burnsub-grid {
    grid-template-columns: 1fr;
  }
}
