:root {
  --bg: #100e0c;
  --bg-raised: #18140f;
  --bg-raised-2: #1e1712;
  --border: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(255, 255, 255, 0.25);
  --text: #ffffff;
  --text-dim: rgba(255, 255, 255, 0.6);
  --text-dimmer: rgba(255, 255, 255, 0.4);
  --text-dimmest: rgba(255, 255, 255, 0.3);
  --red: #C8722F;
  --red-hover: #A85F26;
  --green: #22c55e;
  --green-hover: #16a34a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: dark;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(13, 13, 13, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 800;
}
.logo svg { width: 32px; height: 32px; }
.logo .accent { color: var(--red); }
.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dim);
}
.nav-links a:hover { color: var(--text); }
.header-right { display: flex; align-items: center; gap: 12px; }
.badge-pill {
  border: 1px solid var(--border-hover);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}
.btn-white {
  background: #fff;
  color: #000;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
}
.btn-white:hover { background: rgba(255,255,255,0.9); }

.hamburger-btn {
  display: none; background: transparent; border: 1px solid var(--border-hover);
  border-radius: 8px; width: 38px; height: 38px; align-items: center; justify-content: center;
  color: #fff;
}
.hamburger-btn svg { width: 20px; height: 20px; }

.mobile-nav {
  display: none; flex-direction: column; border-top: 1px solid var(--border);
  background: var(--bg); padding: 8px 0;
}
.mobile-nav.open { display: flex; }
.mobile-nav a {
  padding: 14px 24px; font-size: 15px; font-weight: 600; color: rgba(255,255,255,0.85);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.mobile-nav a:last-child { border-bottom: none; }
.mobile-nav a:hover { color: #fff; background: rgba(255,255,255,0.03); }
.header-account-btn { display: inline-block; }

@media (max-width: 768px) {
  .nav-links, .badge-pill, .header-account-btn { display: none; }
  .hamburger-btn { display: flex; }
}

/* ---------- Hero ---------- */
.hero { padding: 80px 0 60px; }
.hero-grid { display: grid; grid-template-columns: 1fr; gap: 40px; align-items: center; }
@media (min-width: 1024px) { .hero-grid { grid-template-columns: 1fr 1fr; } }
.hero h1 { font-size: 48px; font-weight: 900; line-height: 1.05; margin: 0 0 20px; }
@media (min-width: 640px) { .hero h1 { font-size: 60px; } }
.hero p { max-width: 480px; color: var(--text-dim); font-size: 18px; line-height: 1.6; margin: 0 0 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn-red { background: var(--red); color: #fff; border: none; border-radius: 8px; padding: 13px 26px; font-size: 14px; font-weight: 700; }
.btn-red:hover { background: var(--red-hover); }
.btn-outline { border: 1px solid var(--border-hover); color: rgba(255,255,255,0.8); background: transparent; border-radius: 8px; padding: 13px 26px; font-size: 14px; font-weight: 700; }
.btn-outline:hover { border-color: rgba(255,255,255,0.4); color: #fff; }

.hero-picker-wrap { display: flex; justify-content: center; }
@media (min-width: 1024px) { .hero-picker-wrap { justify-content: flex-end; } }
.hero #dropzoneWrap, .hero #fileCardWrap { margin-top: 48px; }
.hero .dropzone { max-width: 720px; margin: 0 auto; }

/* ---------- Format Picker Widget ---------- */
.format-picker { display: flex; align-items: center; gap: 12px; position: relative; }
.fp-box {
  width: 128px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  border: 1px solid var(--border); background: var(--bg-raised); border-radius: 12px;
  padding: 20px 16px; color: #fff; position: relative; border-width: 1px;
}
.fp-box.target { background: var(--bg-raised-2); }
.fp-box:hover { border-color: var(--border-hover); }
.fp-box svg.file-icon { width: 32px; height: 32px; color: rgba(255,255,255,0.7); }
.fp-box.target svg.file-icon { color: rgba(227,148,91,0.8); }
.fp-box .fp-label { font-size: 14px; font-weight: 700; letter-spacing: 0.5px; }
.fp-box .fp-chevron { width: 14px; height: 14px; color: var(--text-dimmer); }

.fp-swap-col { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0 2px; }
.fp-swap-line { width: 24px; height: 1px; background: rgba(255,255,255,0.15); }
.fp-swap-btn {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: 999px; border: 1px solid rgba(200,114,47,0.4); background: rgba(200,114,47,0.1); color: var(--red);
}
.fp-swap-btn:hover { background: rgba(200,114,47,0.2); }
.fp-swap-btn svg { width: 16px; height: 16px; }
.fp-swap-label { font-size: 10px; font-weight: 700; letter-spacing: 1px; color: var(--text-dimmer); }

.fp-dropdown {
  position: fixed; z-index: 50; background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 25px 50px rgba(0,0,0,0.5); overflow: hidden;
  max-width: calc(100vw - 24px);
}
.fp-search { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.fp-search svg { width: 16px; height: 16px; color: var(--text-dimmer); flex-shrink: 0; }
.fp-search input { width: 100%; min-width: 0; background: transparent; border: none; outline: none; color: #fff; font-size: 14px; }
.fp-search input::placeholder { color: var(--text-dimmer); }

.fp-body { display: flex; max-height: 320px; min-width: 0; }
.fp-categories { width: 150px; flex-shrink: 0; overflow-y: auto; overflow-x: hidden; border-right: 1px solid var(--border); padding: 8px 0; }
.fp-cat-item {
  width: 100%; display: flex; align-items: center; justify-content: space-between; text-align: left;
  padding: 10px 12px; font-size: 13px; color: var(--text-dim); background: transparent; border: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fp-cat-item:hover, .fp-cat-item.active { background: rgba(255,255,255,0.05); color: #fff; }
.fp-cat-item svg { width: 14px; height: 14px; opacity: 0.5; flex-shrink: 0; }

.fp-grid {
  flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px; padding: 12px; overflow-y: auto; overflow-x: hidden; align-content: start;
}
.fp-format-btn {
  min-width: 0; border: 1px solid var(--border); background: rgba(255,255,255,0.03); color: rgba(255,255,255,0.8);
  border-radius: 6px; padding: 10px 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.3px; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fp-format-btn:hover { border-color: var(--border-hover); background: rgba(255,255,255,0.07); }
.fp-format-btn.selected { border-color: var(--red); background: var(--red); color: #fff; }
.fp-empty { grid-column: 1 / -1; text-align: center; padding: 32px 0; color: var(--text-dimmer); font-size: 14px; }

@media (max-width: 480px) {
  .fp-categories { width: 110px; }
  .fp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 400px) {
  .format-picker { gap: 6px; }
  .fp-box { width: 96px; padding: 14px 8px; }
  .fp-box svg.file-icon { width: 24px; height: 24px; }
  .fp-box .fp-label { font-size: 12px; }
  .fp-swap-btn { width: 30px; height: 30px; }
  .fp-swap-btn svg { width: 13px; height: 13px; }
}

/* ---------- Privacy strip ---------- */
.privacy-strip { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: rgba(255,255,255,0.02); }
.privacy-grid { display: grid; grid-template-columns: 1fr; gap: 32px; padding-top: 56px; padding-bottom: 56px; }
@media (min-width: 640px) { .privacy-grid { grid-template-columns: repeat(3, 1fr); } }
.privacy-grid h3 { margin: 0 0 8px; font-size: 16px; font-weight: 700; }
.privacy-grid p { margin: 0; color: var(--text-dimmer); font-size: 14px; line-height: 1.6; }

/* ---------- Format catalog ---------- */
.catalog { padding: 80px 0; }
.catalog h2 { font-size: 28px; font-weight: 800; margin: 0 0 8px; }
.catalog > .container > p { color: var(--text-dimmer); font-size: 14px; margin: 0 0 40px; }
.catalog-grid { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 640px) { .catalog-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .catalog-grid { grid-template-columns: repeat(3, 1fr); } }
.catalog-card { border: 1px solid var(--border); background: rgba(255,255,255,0.02); border-radius: 16px; padding: 24px; }
.catalog-card h3 { margin: 0 0 16px; font-size: 16px; font-weight: 700; }
.catalog-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.catalog-tag { border: 1px solid var(--border); background: rgba(255,255,255,0.03); border-radius: 6px; padding: 5px 10px; font-size: 12px; font-weight: 600; color: var(--text-dim); }
.catalog-tag:hover { border-color: rgba(200,114,47,0.4); color: #fff; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg); }
.footer-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 32px; padding-top: 56px; padding-bottom: 56px; }
@media (min-width: 768px) { .footer-grid { grid-template-columns: repeat(4, 1fr); } }
.footer-brand p { color: var(--text-dimmer); font-size: 14px; margin-top: 12px; }
.footer-col h4 { font-size: 14px; font-weight: 700; margin: 0 0 12px; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.footer-col a { font-size: 14px; color: var(--text-dimmer); }
.footer-col a:hover { color: rgba(255,255,255,0.8); }
.footer-bottom { border-top: 1px solid var(--border); padding: 24px; text-align: center; font-size: 12px; color: var(--text-dimmest); }

/* ---------- Converter page ---------- */
.conv-hero { padding: 64px 0 40px; }
.conv-hero h1 { font-size: 40px; font-weight: 900; line-height: 1.1; margin: 0 0 20px; }
@media (min-width: 640px) { .conv-hero h1 { font-size: 48px; } }
.conv-hero p { max-width: 440px; color: var(--text-dim); margin: 0 0 24px; }
.conv-checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--text-dimmer); }
.conv-checklist li { display: flex; align-items: center; gap: 8px; }
.conv-checklist svg { width: 16px; height: 16px; color: var(--red); flex-shrink: 0; }

.upload-section { max-width: 720px; margin: 0 auto; padding: 0 24px 64px; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  border: 2px dashed rgba(255,255,255,0.15); background: rgba(255,255,255,0.02); border-radius: 20px;
  padding: 64px 32px; transition: border-color 0.15s, background 0.15s;
}
.dropzone.dragging { border-color: var(--red); background: rgba(200,114,47,0.05); }
.dropzone svg.cloud { width: 56px; height: 56px; color: var(--red); margin-bottom: 16px; }
.dropzone h3 { margin: 0; font-size: 20px; font-weight: 800; }
.dropzone p { margin: 4px 0 0; color: var(--text-dimmer); font-size: 14px; }
.dropzone .privacy-note { font-size: 12px; color: var(--text-dimmest); margin-top: 4px; }
.select-file-btn {
  margin-top: 24px; display: flex; align-items: center; gap: 8px;
  background: var(--red); color: #fff; border: none; border-radius: 8px; padding: 13px 24px; font-size: 14px; font-weight: 700;
}
.select-file-btn:hover { background: var(--red-hover); }
.select-file-btn svg { width: 16px; height: 16px; }

.file-card { border: 1px solid var(--border); background: rgba(255,255,255,0.02); border-radius: 16px; padding: 32px; }
.file-card-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.file-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.file-badge {
  width: 40px; height: 40px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; font-size: 10px; font-weight: 800; background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.7);
}
.file-badge.accent { background: var(--red); color: #fff; }
.file-info .name { font-size: 14px; font-weight: 600; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.file-info .size { font-size: 12px; color: var(--text-dimmer); margin: 2px 0 0; }
.file-card-top svg.arrow { width: 16px; height: 16px; color: var(--text-dimmest); flex-shrink: 0; }

.action-area { margin-top: 24px; }
.btn-full { width: 100%; border: none; border-radius: 8px; padding: 13px; font-size: 14px; font-weight: 700; }
.btn-convert { background: var(--red); color: #fff; }
.btn-convert:hover { background: var(--red-hover); }
.btn-download { background: var(--green); color: #fff; }
.btn-download:hover { background: var(--green-hover); }
.converting-row { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 13px 0; font-size: 14px; color: var(--text-dim); }
.spin { animation: spin 1s linear infinite; width: 16px; height: 16px; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-box { border: 1px solid rgba(200,114,47,0.3); background: rgba(200,114,47,0.1); color: #fca5a5; border-radius: 8px; padding: 14px; font-size: 14px; }
.error-box a { color: #E3945B; font-weight: 700; text-decoration: underline; }
.reset-link { display: block; width: 100%; text-align: center; background: none; border: none; margin-top: 12px; font-size: 12px; color: var(--text-dimmer); }
.reset-link:hover { color: rgba(255,255,255,0.7); }

.info-section { max-width: 720px; margin: 0 auto; padding: 0 24px 96px; }
.info-card { border: 1px solid var(--border); background: rgba(255,255,255,0.02); border-radius: 16px; padding: 24px; display: flex; gap: 16px; align-items: flex-start; }
.info-icon {
  width: 44px; height: 44px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; background: rgba(200,114,47,0.15); color: #E3945B; font-size: 13px; font-weight: 800;
}
.info-card h2 { margin: 0; font-size: 16px; font-weight: 700; }
.info-card h2 span { font-weight: 400; color: var(--text-dimmer); }
.info-card p { margin: 8px 0 0; font-size: 14px; line-height: 1.6; color: var(--text-dimmer); }

/* ---------- Options panel ---------- */
.options-toggle {
  display: flex; align-items: center; gap: 8px; margin-top: 16px;
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 8px; padding: 10px 16px; font-size: 13px; font-weight: 600;
}
.options-toggle:hover { border-color: var(--border-hover); color: #fff; }
.options-toggle svg { width: 14px; height: 14px; transition: transform 0.15s; }
.options-toggle.open svg { transform: rotate(180deg); }
.options-panel {
  margin-top: 12px; border: 1px solid var(--border); background: rgba(255,255,255,0.02);
  border-radius: 12px; padding: 20px;
}
.options-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 16px; align-items: end; }
.options-row:last-child { margin-bottom: 0; }
.options-row label {
  min-width: 0; display: flex; flex-direction: column; gap: 8px;
  font-size: 13px; font-weight: 600; color: var(--text-dim); justify-content: flex-end;
}
.options-row .opt-hint { font-weight: 400; color: var(--text-dimmer); font-size: 12px; }
.options-row input[type="number"], .options-row select {
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: 6px;
  padding: 9px 10px; color: #fff; font-size: 14px; height: 38px; box-sizing: border-box; width: 100%;
}
.options-row input[type="range"] {
  width: 100%; accent-color: var(--red); height: 38px; padding: 0; margin: 0; display: block;
}
@media (max-width: 480px) {
  .options-row { grid-template-columns: 1fr; }
}

/* Polished select — custom chevron, proper focus ring, consistent with
   the rest of the design system instead of a bare browser default. */
.select-field {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--bg-raised);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23E3945B' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 40px 12px 14px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.select-field:hover { border-color: var(--border-hover); }
.select-field:focus { outline: none; border-color: var(--red); background-color: var(--bg-raised-2); }
.select-field option { background: var(--bg-raised); color: var(--text); }

/* ---------- Merge / multi-file tool ---------- */
.multi-file-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.multi-file-item {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border); background: rgba(255,255,255,0.02);
  border-radius: 10px; padding: 12px 14px; cursor: default;
}
.multi-file-item.dragging { opacity: 0.4; }
.drag-handle {
  cursor: grab; color: var(--text-dimmer); flex-shrink: 0; display: flex; align-items: center;
  touch-action: none;
}
.drag-handle:active { cursor: grabbing; }
.drag-handle svg { width: 16px; height: 16px; }
.multi-file-item .file-badge { width: 36px; height: 36px; font-size: 9px; }
.multi-file-item .name { flex: 1; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.multi-file-item .size { font-size: 12px; color: var(--text-dimmer); }
.multi-file-item .remove-btn {
  background: none; border: none; color: var(--text-dimmer); width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center; border-radius: 6px; flex-shrink: 0;
}
.multi-file-item .remove-btn:hover { background: rgba(200,114,47,0.15); color: #E3945B; }
.add-more-btn {
  border: 1px dashed var(--border-hover); background: transparent; color: var(--text-dim);
  border-radius: 10px; padding: 12px; font-size: 13px; font-weight: 600; width: 100%;
}
.add-more-btn:hover { border-color: var(--red); color: #fff; }

/* ---------- Page thumbnail grid (Rearrange PDF) ---------- */
.page-thumb-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px;
  margin-bottom: 20px;
}
.page-thumb {
  border: 1px solid var(--border); background: rgba(255,255,255,0.02); border-radius: 10px;
  padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: opacity 0.15s;
}
.page-thumb.deleted { opacity: 0.3; }
.page-thumb canvas { width: 100%; height: auto; border-radius: 4px; background: #fff; display: block; }
.page-thumb .page-num { font-size: 12px; font-weight: 700; color: var(--text-dim); }
.page-thumb-controls { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.page-thumb-controls button {
  background: rgba(255,255,255,0.06); border: 1px solid var(--border); color: rgba(255,255,255,0.8);
  border-radius: 5px; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
}
.page-thumb-controls button:hover { border-color: var(--border-hover); }
.page-thumb-controls button svg { width: 13px; height: 13px; }
.page-thumb-controls button.danger:hover { background: rgba(200,114,47,0.15); border-color: rgba(200,114,47,0.4); color: #E3945B; }

.hidden { display: none !important; }
