:root {
  --bg: #fafaf7;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #f5f5f2;
  --border: #e8e6e0;
  --border-hi: #d4d1c8;
  --ink: #0f1419;
  --ink-2: #3a3f47;
  --muted: #6b6f78;
  --muted-2: #9ba0a8;
  --accent: #6d28d9;
  --accent-2: #7c3aed;
  --accent-soft: #f5f3ff;
  --green: #15803d;
  --red: #b91c1c;
  --shadow-sm: 0 1px 2px rgba(15,20,25,0.04), 0 1px 3px rgba(15,20,25,0.06);
  --shadow-md: 0 4px 6px -1px rgba(15,20,25,0.05), 0 10px 24px -8px rgba(15,20,25,0.08);
  --shadow-lg: 0 12px 24px -8px rgba(15,20,25,0.08), 0 32px 64px -16px rgba(15,20,25,0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
  min-height: 100vh;
  letter-spacing: -0.005em;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

.bg-pattern {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    radial-gradient(circle at 20% 0%, rgba(124,58,237,0.04), transparent 50%),
    radial-gradient(circle at 80% 30%, rgba(184,134,11,0.03), transparent 50%);
}
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(15,20,25,0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15,20,25,0.025) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black, transparent 70%);
}

/* Top nav */
nav.topbar {
  position: sticky; top: 0; left: 0; right: 0; z-index: 100;
  padding: 14px 0;
  background: rgba(250,250,247,0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 32px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 18px; letter-spacing: -0.025em;
  color: var(--ink);
}
.logo-mark {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.logo-mark img { width: 100%; height: 100%; object-fit: contain; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  font-size: 14px; font-weight: 500;
  border-radius: 8px;
  border: 1px solid var(--border-hi);
  background: var(--surface);
  color: var(--ink);
  transition: all 0.15s;
  font-family: inherit;
}
.btn:hover { background: var(--surface-2); border-color: var(--ink-2); }
.btn-primary {
  background: var(--ink);
  color: white;
  border: 1px solid var(--ink);
  box-shadow: 0 1px 0 rgba(255,255,255,0.1) inset, var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--ink-2);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 1px 0 rgba(255,255,255,0.1) inset, var(--shadow-md);
}
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* Nav links + Tools dropdown */
.nav-links {
  display: flex; align-items: center; gap: 28px;
  margin-left: auto;
  margin-right: 12px;
}
.nav-links > a {
  font-size: 14px; font-weight: 500; color: var(--ink-2);
  transition: color 0.15s;
}
.nav-links > a:hover { color: var(--ink); }

.nav-dd { position: relative; }
.nav-dd-trigger {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: none; padding: 0;
  font: inherit; font-size: 14px; font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
}
.nav-dd-trigger:hover, .nav-dd:hover .nav-dd-trigger,
.nav-dd:focus-within .nav-dd-trigger { color: var(--ink); }
.nav-dd-trigger svg { transition: transform 0.2s; }
.nav-dd:hover .nav-dd-trigger svg,
.nav-dd:focus-within .nav-dd-trigger svg { transform: rotate(180deg); }
.nav-dd::after {
  content: ''; position: absolute;
  top: 100%; left: -20px; right: -20px;
  height: 18px;
}

.nav-dd-menu {
  position: absolute; top: calc(100% + 14px); left: -12px;
  width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px;
  box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.15s, transform 0.15s, visibility 0s linear 0.15s;
  z-index: 1000;
}
.nav-dd:hover .nav-dd-menu,
.nav-dd:focus-within .nav-dd-menu {
  opacity: 1; visibility: visible; transform: translateY(0);
  transition: opacity 0.15s, transform 0.15s;
}
.nav-dd-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none; color: inherit;
  transition: background 0.12s;
}
.nav-dd-item:hover { background: var(--surface-2); }
.nav-dd-item.is-active { background: var(--accent-soft); }
.nav-dd-ico {
  width: 32px; height: 32px;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--accent-soft);
  border: 1px solid rgba(124,58,237,0.15);
  display: grid; place-items: center;
}
.nav-dd-ico svg { width: 16px; height: 16px; color: var(--accent); }
.nav-dd-item.is-flagship .nav-dd-ico {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
}
.nav-dd-item.is-flagship .nav-dd-ico svg { color: white; }
.nav-dd-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nav-dd-title {
  font-size: 14px; font-weight: 600;
  color: var(--ink);
  display: inline-flex; align-items: center; gap: 8px;
  line-height: 1.3;
}
.nav-dd-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
}
.nav-dd-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.nav-dd-sep {
  height: 1px; background: var(--border);
  margin: 6px 4px;
}

/* Hamburger (mobile) */
.nav-hamburger {
  display: none;
  flex-direction: column; gap: 5px;
  width: 38px; height: 38px;
  background: none; border: 1px solid var(--border);
  border-radius: 8px;
  align-items: center; justify-content: center;
}
.nav-hamburger span {
  display: block; width: 18px; height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
.nav-hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile menu panel */
.nav-mobile {
  position: fixed; left: 0; right: 0; top: 60px; bottom: 0;
  background: var(--bg);
  z-index: 99;
  overflow-y: auto;
  padding: 20px 24px 32px;
  transform: translateY(-105%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex; flex-direction: column;
  visibility: hidden;
}
body.nav-open .nav-mobile { transform: translateY(0); visibility: visible; }
.nav-mobile h4 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 14px 12px 6px;
}
.nav-mobile a {
  display: flex; gap: 12px; align-items: center;
  padding: 12px;
  border-radius: 10px;
  text-decoration: none; color: var(--ink);
  font-size: 15px;
}
.nav-mobile a:hover, .nav-mobile a.is-active { background: var(--surface-2); }
.nav-mobile a.is-active { color: var(--accent); }
.nav-mobile a .nav-dd-ico { width: 28px; height: 28px; }
.nav-mobile a .nav-dd-ico svg { width: 14px; height: 14px; }
.nav-mobile-cta {
  margin-top: 16px;
  background: var(--ink); color: white;
  padding: 14px;
  border-radius: 10px;
  text-align: center;
  font-weight: 600;
  font-size: 15px;
}
.nav-mobile-cta:hover { background: var(--ink-2); }

@media (max-width: 800px) {
  .nav-links { display: none; }
  .nav-cta-desktop { display: none; }
  .nav-hamburger { display: flex; }
  body.nav-open { overflow: hidden; }
  /* backdrop-filter creates a containing block for position:fixed descendants,
     which would clip the mobile menu to the nav. Disable on mobile. */
  nav.topbar {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--bg);
  }
}
@media (min-width: 801px) {
  .nav-mobile { display: none; }
}

main {
  max-width: 920px;
  margin: 0 auto;
  padding: 60px 32px 80px;
  position: relative; z-index: 10;
}
@media (max-width: 640px) { main { padding: 40px 20px 60px; } }

.tool-header {
  text-align: center;
  margin-bottom: 48px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border);
}
.tool-num {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.18em;
  color: var(--accent);
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 16px;
}
.tool-icon-large {
  width: 56px; height: 56px; border-radius: 14px;
  margin: 0 auto 20px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  border: 1px solid rgba(124,58,237,0.15);
}
.tool-icon-large svg { width: 26px; height: 26px; color: var(--accent); }

.tool-header h1 {
  font-size: clamp(36px, 6vw, 56px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
  margin-bottom: 16px;
  color: var(--ink);
}
.tool-header h1 .accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.tool-header p {
  font-size: 17px;
  color: var(--ink-2);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.55;
}

/* Drop zone */
.dropzone {
  position: relative;
  border: 2px dashed var(--border-hi);
  border-radius: 18px;
  padding: 64px 28px;
  text-align: center;
  background: var(--surface);
  transition: all 0.2s;
  cursor: pointer;
  display: block;
  box-shadow: var(--shadow-sm);
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.dropzone-icon {
  width: 56px; height: 56px; margin: 0 auto 18px;
  border-radius: 14px;
  background: var(--accent-soft);
  border: 1px solid rgba(124,58,237,0.2);
  display: grid; place-items: center;
}
.dropzone-icon svg { width: 26px; height: 26px; color: var(--accent); }
.dropzone h3 {
  font-size: 22px; font-weight: 700;
  margin-bottom: 8px; letter-spacing: -0.02em;
  color: var(--ink);
}
.dropzone p {
  font-size: 14px; color: var(--ink-2);
  margin-bottom: 22px;
}
.btn-pick {
  display: inline-block;
  padding: 12px 24px; border-radius: 10px;
  background: var(--ink);
  color: white; font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow-sm);
}
.dropzone .hint {
  margin-top: 18px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}
.file-input { display: none; }

/* File list */
.file-list {
  margin-top: 28px;
  display: flex; flex-direction: column; gap: 8px;
}
.file-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}
.file-row:hover { border-color: var(--border-hi); }
.file-row .drag { cursor: grab; color: var(--muted-2); }
.file-row .file-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--accent-soft);
  border: 1px solid rgba(124,58,237,0.15);
  display: grid; place-items: center; flex-shrink: 0;
}
.file-row .file-icon svg { width: 18px; height: 18px; color: var(--accent); }
.file-row .file-info { flex: 1; min-width: 0; }
.file-row .file-name {
  font-weight: 600; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--ink);
}
.file-row .file-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--muted); margin-top: 4px;
}
.file-row .file-remove {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  display: grid; place-items: center;
  transition: all 0.2s;
}
.file-row .file-remove:hover { background: #fef2f2; border-color: var(--red); color: var(--red); }
.file-row.dragging { opacity: 0.4; }

/* Actions */
.actions {
  margin-top: 24px;
  display: flex; gap: 12px; justify-content: center;
  flex-wrap: wrap;
}
.actions .btn { padding: 13px 26px; font-size: 14px; }

/* Status */
.status {
  margin-top: 24px;
  padding: 20px 24px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: none;
  box-shadow: var(--shadow-sm);
}
.status strong { display: block; font-size: 16px; margin-bottom: 4px; font-weight: 700; }
.status.error { border-color: #fecaca; background: #fef2f2; }
.status.error strong { color: var(--red); }
.status.success { border-color: #bbf7d0; background: #f0fdf4; }
.status.success strong { color: var(--green); }
.progress {
  height: 4px; background: var(--border); border-radius: 100px;
  overflow: hidden; margin-top: 12px;
}
.progress-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s;
}

/* Tool footer */
.tool-footer {
  margin-top: 60px;
  text-align: center;
  padding-top: 32px;
  border-top: 1px solid var(--border);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.8;
}
.tool-footer a { color: var(--accent); text-decoration: underline; }

/* Form fields */
.input-row {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-top: 24px;
}
.field { flex: 1; min-width: 220px; }
.field label {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 600;
}
.field input, .field select {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: 10px;
  color: var(--ink);
  font-size: 14px; font-family: inherit;
  transition: border 0.15s;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.help {
  font-size: 12px; color: var(--muted); margin-top: 6px;
}

/* Mobile tweaks for simple tool pages */
@media (max-width: 640px) {
  .tool-header { margin-bottom: 32px; padding-bottom: 28px; }
  .tool-header h1 { line-height: 1.05; }
  .tool-header p { font-size: 15px; }
  .tool-icon-large { width: 48px; height: 48px; margin-bottom: 16px; }

  .dropzone { padding: 40px 20px; border-radius: 14px; }
  .dropzone h3 { font-size: 18px; }
  .dropzone p { font-size: 13px; margin-bottom: 16px; }
  .btn-pick { padding: 11px 22px; font-size: 13px; }
  .dropzone .hint { margin-top: 14px; font-size: 10px; }

  .file-row { padding: 12px 14px; gap: 10px; }
  .file-row .file-name { font-size: 13px; }

  .actions { gap: 10px; flex-direction: column; align-items: stretch; }
  .actions .btn { padding: 14px 22px; justify-content: center; }

  .status { padding: 16px 18px; }
  .status strong { font-size: 15px; }

  .field { min-width: 0; flex-basis: 100%; }
  .input-row { gap: 16px; }
}
