:root {
  --bg: #ffffff;
  --bg-soft: #f5f7fb;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #0b57d0;
  --primary-strong: #0847ac;
  --shadow: 0 10px 30px rgba(17, 24, 39, 0.08);
  --shadow-lg: 0 24px 60px rgba(17, 24, 39, 0.14);
  --header-bg: rgba(255, 255, 255, 0.92);
}

html[data-theme="dark"] {
  --bg: #0f1115;
  --bg-soft: #171b24;
  --panel: #151922;
  --panel-2: #1a2030;
  --text: #f3f4f6;
  --muted: #9ca3af;
  --border: #2a3140;
  --primary: #4f8cff;
  --primary-strong: #3774e6;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.42);
  --header-bg: rgba(15, 17, 21, 0.9);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
}

body {
  overflow-x: hidden;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

.container {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(11, 87, 208, 0.22);
  flex-shrink: 0;
}

.brand-text {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: center;
}

.nav-item {
  position: relative;
}

.nav-link,
.nav-trigger {
  height: 76px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 0;
  color: var(--text);
  cursor: pointer;
  padding: 0 14px;
  font-weight: 700;
  font-size: 16px;
}

.chevron {
  font-size: 12px;
  opacity: 0.8;
}

.dropdown-panel {
  display: none;
  position: absolute;
  top: calc(100% - 10px);
  left: 50%;
  transform: translateX(-50%);
  width: min(1120px, 94vw);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: 24px;
}

.has-dropdown.open .dropdown-panel {
  display: block;
}

.dropdown-grid {
  column-count: 4;
  column-gap: 26px;
}

.dropdown-col {
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  display: inline-block;
  width: 100%;
  margin-bottom: 26px;
  vertical-align: top;
}

.dropdown-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.dropdown-links {
  display: grid;
  gap: 6px;
}

.dropdown-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 14px;
  color: var(--text);
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.dropdown-link:hover {
  background: var(--bg-soft);
  color: var(--primary);
  transform: translateX(2px);
}

.menu-icon {
  width: 22px;
  min-width: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle,
.mobile-theme-toggle,
.mobile-menu-button {
  min-height: 44px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.theme-toggle:hover,
.mobile-theme-toggle:hover,
.mobile-menu-button:hover {
  background: var(--bg-soft);
  border-color: var(--primary);
}

.theme-toggle,
.mobile-theme-toggle {
  padding: 0 14px;
  font-weight: 600;
}

.mobile-menu-button {
  width: 46px;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.mobile-menu-button span {
  width: 18px;
  height: 2px;
  background: var(--text);
  display: block;
  border-radius: 999px;
}

.mobile-menu {
  display: none;
  border-top: 1px solid var(--border);
  background: var(--panel);
}

.mobile-menu.open {
  display: block;
}

.mobile-menu-inner {
  padding: 12px 0 18px;
}

.mobile-link,
.mobile-sublink {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.mobile-group {
  border-bottom: 1px solid var(--border);
}

.mobile-group summary {
  padding: 14px 0;
  cursor: pointer;
  font-weight: 700;
}

.mobile-submenu {
  padding-bottom: 10px;
}

.mobile-sublink {
  padding-left: 12px;
  color: var(--muted);
}

.site-main {
  padding: 28px 0 48px;
}

.flash-wrap {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.flash {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.section {
  padding: 20px 0;
}

.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  align-items: start;
}

.tool-card,
.side-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.tool-card {
  padding: 26px;
  overflow: hidden;
}

.side-card {
  padding: 20px;
  margin-bottom: 18px;
}

.side-card h3 {
  margin-top: 0;
}

.tool-badge {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
}

.tool-head h1 {
  margin: 0 0 10px;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.03em;
  word-break: break-word;
}

.tool-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.tool-form {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.dropzone {
  position: relative;
  display: block;
  border: 2px dashed var(--border);
  background: var(--bg-soft);
  border-radius: 22px;
  min-height: 220px;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.dropzone.dragover,
.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--bg-soft) 85%, var(--primary) 15%);
}

.file-input {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  opacity: 0 !important;
  cursor: pointer !important;
  z-index: 5 !important;
}

.dropzone-inner {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 24px;
  pointer-events: none;
}

.dropzone-icon {
  font-size: 42px;
}

.dropzone-title {
  font-size: 22px;
  font-weight: 800;
}

.dropzone-subtitle,
.selected-file {
  color: var(--muted);
}

.selected-file {
  margin-top: 8px;
  font-size: 14px;
  word-break: break-word;
  max-width: 100%;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  font-weight: 700;
  font-size: 14px;
}

input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(11, 87, 208, 0.08);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 14px;
  border: 0;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.btn:hover {
  background: var(--primary-strong);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(11, 87, 208, 0.18);
}

.result-box {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

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

.result-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.result-meta {
  min-width: 0;
}

.result-title {
  font-size: 14px;
  color: var(--muted);
}

.result-name {
  font-size: 16px;
  font-weight: 700;
  word-break: break-word;
}

ol {
  padding-left: 18px;
  margin: 0;
}

ol li + li {
  margin-top: 8px;
}

p {
  overflow-wrap: anywhere;
}

@media (max-width: 1100px) {
  .dropdown-grid {
    column-count: 2;
  }
}

@media (max-width: 960px) {
  .desktop-nav {
    display: none;
  }

  .mobile-menu-button {
    display: inline-flex;
  }

  .theme-toggle {
    display: none;
  }

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

@media (max-width: 640px) {
  .container {
    width: min(100% - 20px, 1280px);
  }

  .tool-card {
    padding: 20px;
  }

  .dropzone,
  .dropzone-inner {
    min-height: 180px;
  }

  .dropdown-grid {
    column-count: 1;
	}


  .brand-text {
    font-size: 18px;
  }

  .tool-head h1 {
    font-size: clamp(28px, 9vw, 38px);
  }

  .btn {
    width: 100%;
  }

  .result-box {
    align-items: stretch;
  }
}

.pdf-editor {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel-2);
}

.editor-group {
  display: grid;
  gap: 6px;
  min-width: 140px;
}

.editor-group label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.editor-actions {
  display: flex;
  gap: 10px;
  align-items: end;
  margin-left: auto;
  flex-wrap: wrap;
}

.editor-note {
  color: var(--muted);
  font-size: 14px;
}

.pdf-pages {
  display: grid;
  gap: 24px;
}

.pdf-page-box {
  display: grid;
  gap: 10px;
}

.pdf-page-title {
  font-weight: 800;
}

.pdf-page-stage {
  position: relative;
  border: 1px solid var(--border);
  background: #cfd6e4;
  padding: 0;
  overflow: auto;
  width: fit-content;
  max-width: 100%;
  box-shadow: var(--shadow);
}

.pdf-canvas {
  display: block;
  background: #fff;
}

.page-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
}

.overlay-item {
  position: absolute;
  border: 1px dashed rgba(11, 87, 208, 0.65);
  cursor: move;
  user-select: none;
  z-index: 10;
}

.overlay-item.selected {
  outline: 2px solid var(--primary);
}

.overlay-text {
  white-space: pre-wrap;
  line-height: 1.2;
}

.overlay-rect {
  min-width: 20px;
  min-height: 20px;
}

.overlay-image img {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  object-fit: fill;
}

.resize-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  right: -6px;
  bottom: -6px;
  border-radius: 999px;
  background: var(--primary);
  cursor: nwse-resize;
}

.secondary-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.secondary-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}