/* ============================================================
   ConvertHub — Claude-inspired design system (v2)
   Warm ivory / warm charcoal, coral accent. Rebuilt spacing,
   fixed icon sizing, ad-ready layout.
   ============================================================ */

:root {
  --bg: #FAF9F5;
  --bg-2: #F2F0E9;
  --bg-3: #EAE7DD;
  --surface: #FFFFFF;
  --surface-2: #F7F6F1;
  --border: #E6E3D8;
  --border-strong: #D6D3C7;
  --text: #1F1E1D;
  --text-2: #55534E;
  --muted: #8A897F;
  --accent: #D97757;
  --accent-hover: #C4633F;
  --accent-soft: #F7EAE3;
  --accent-soft-2: #F0DACE;
  --green: #5E8C61;
  --green-soft: #E9F0E9;
  --red: #C24E42;
  --red-soft: #F8E9E7;
  --blue: #5E7E9B;
  --blue-soft: #E7EEF4;
  --violet: #8264A8;
  --violet-soft: #EEE8F5;

  --shadow-xs: 0 1px 2px rgba(31, 30, 29, 0.05);
  --shadow-sm: 0 2px 6px rgba(31, 30, 29, 0.06);
  --shadow-md: 0 6px 20px rgba(31, 30, 29, 0.08);
  --shadow-lg: 0 16px 40px rgba(31, 30, 29, 0.12);

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", SFMono-Regular, ui-monospace, Menlo, Consolas, monospace;

  --header-h: 66px;
  --maxw: 1160px;

  --s1: 0.5rem;
  --s2: 1rem;
  --s3: 1.5rem;
  --s4: 2.25rem;
  --s5: 3.5rem;
  --s6: 5rem;
}

[data-theme="dark"] {
  --bg: #262624;
  --bg-2: #211F1D;
  --bg-3: #1A1917;
  --surface: #302F2C;
  --surface-2: #383734;
  --border: #3D3C38;
  --border-strong: #514F49;
  --text: #F2F0E8;
  --text-2: #C9C6BB;
  --muted: #908E85;
  --accent: #D97757;
  --accent-hover: #E68B6C;
  --accent-soft: #42332D;
  --accent-soft-2: #4F3A31;
  --green: #8FBF92;
  --green-soft: #2C382D;
  --red: #E08578;
  --red-soft: #45302D;
  --blue: #8EAAC5;
  --blue-soft: #2B3742;
  --violet: #B394D8;
  --violet-soft: #362B41;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.45);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.25s ease, color 0.25s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
main { flex: 1 0 auto; width: 100%; }

h1, h2, h3, .serif { font-family: var(--font-serif); font-weight: 500; letter-spacing: -0.015em; color: var(--text); }
h1 { font-size: clamp(2rem, 4.4vw, 3rem); line-height: 1.12; }
h2 { font-size: clamp(1.55rem, 2.8vw, 2.1rem); line-height: 1.2; }
h3 { font-size: 1.18rem; line-height: 1.3; }

a { color: var(--accent); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent-hover); }
img, video, canvas, svg { max-width: 100%; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; width: 100%; }
.container-narrow { max-width: 820px; margin: 0 auto; padding: 0 24px; width: 100%; }
.section { padding: var(--s6) 0; }
.section.tight { padding: var(--s5) 0; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto var(--s4); }
.section-head p { color: var(--text-2); margin-top: 12px; font-size: 1.02rem; }
.eyebrow-label {
  display: inline-block; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 12px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100; height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1240px; margin: 0 auto; padding: 0 24px;
  height: 100%; display: flex; align-items: center; gap: 22px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-serif); font-size: 1.3rem; font-weight: 600;
  color: var(--text); flex-shrink: 0;
}
.logo:hover { color: var(--text); }
.logo-mark {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-xs);
}
.logo-mark svg { width: 18px; height: 18px; }

.main-nav { display: flex; align-items: center; gap: 2px; }
.main-nav a {
  color: var(--text-2); font-size: 0.925rem; font-weight: 500;
  padding: 8px 13px; border-radius: var(--r-sm);
  transition: background 0.15s, color 0.15s; white-space: nowrap;
}
.main-nav a:hover { background: var(--bg-2); color: var(--text); }
.main-nav a.active { background: var(--accent-soft); color: var(--accent); }
[data-theme="dark"] .main-nav a.active { color: var(--accent-hover); }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--r-sm); flex-shrink: 0;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.icon-btn:hover { border-color: var(--border-strong); color: var(--text); box-shadow: var(--shadow-xs); }
.icon-btn svg { width: 18px; height: 18px; }
.hamburger { display: none; }

.mobile-nav {
  display: none; position: fixed; inset: var(--header-h) 0 auto 0;
  background: var(--bg); border-bottom: 1px solid var(--border);
  padding: 10px 16px 18px; z-index: 99; box-shadow: var(--shadow-lg);
}
.mobile-nav.open { display: block; animation: slideDown 0.2s ease; }
.mobile-nav a { display: block; padding: 12px 14px; color: var(--text-2); font-weight: 500; border-radius: var(--r-sm); }
.mobile-nav a:hover, .mobile-nav a.active { background: var(--bg-2); color: var(--text); }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-sans); font-size: 0.95rem; font-weight: 600;
  padding: 11px 20px; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent; transition: all 0.16s ease;
  text-decoration: none; white-space: nowrap; line-height: 1.2;
}
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-xs); }
.btn-primary:hover { background: var(--accent-hover); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); transform: translateY(-1px); box-shadow: var(--shadow-xs); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-2); color: var(--text); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 7px 13px; font-size: 0.85rem; border-radius: 8px; }
.btn-lg { padding: 14px 28px; font-size: 1.02rem; }

/* ---------- Hero ---------- */
.hero { padding: var(--s6) 0 var(--s4); text-align: center; }
.hero .badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.02em;
  color: var(--accent); background: var(--accent-soft);
  padding: 6px 14px 6px 11px; border-radius: 999px; margin-bottom: 22px;
  border: 1px solid var(--accent-soft-2);
}
.hero .badge svg { width: 14px; height: 14px; flex-shrink: 0; }
.hero h1 { max-width: 820px; margin: 0 auto 18px; }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero .sub { max-width: 600px; margin: 0 auto; color: var(--text-2); font-size: 1.1rem; }
.hero-actions { margin-top: 28px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- Universal converter card (home) ---------- */
.converter-shell {
  max-width: 820px; margin: 0 auto; padding: 0 24px; width: 100%;
}
.converter-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); box-shadow: var(--shadow-md);
  padding: 10px; margin-top: 6px;
}
.cat-tabs {
  display: flex; gap: 4px; padding: 6px; background: var(--bg-2);
  border-radius: var(--r-lg); margin-bottom: 10px; flex-wrap: wrap;
}
.cat-tab {
  flex: 1; min-width: 90px; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
  font-family: var(--font-sans); font-size: 0.92rem; font-weight: 600; color: var(--text-2);
  background: transparent; border: none; transition: all 0.15s;
}
.cat-tab svg { width: 17px; height: 17px; }
.cat-tab:hover { color: var(--text); background: var(--surface); }
.cat-tab.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-xs); }

/* ---------- Dropzone ---------- */
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--r-lg);
  background: var(--surface); padding: 46px 28px; text-align: center;
  cursor: pointer; transition: all 0.2s ease; position: relative;
}
.dropzone.in-card { border-radius: var(--r-lg); background: var(--surface-2); }
.dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); box-shadow: var(--shadow-md); }
.dropzone .dz-icon {
  width: 60px; height: 60px; margin: 0 auto 16px; border-radius: 16px;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; transition: transform 0.2s, background 0.2s;
}
.dropzone:hover .dz-icon, .dropzone.dragover .dz-icon { transform: translateY(-3px); background: var(--accent); color: #fff; }
.dropzone .dz-icon svg { width: 28px; height: 28px; }
.dropzone h3 { font-size: 1.3rem; margin-bottom: 6px; }
.dropzone p { color: var(--muted); font-size: 0.92rem; }
.dropzone .dz-formats { margin-top: 14px; font-size: 0.79rem; color: var(--muted); max-width: 560px; margin-left: auto; margin-right: auto; line-height: 1.5; }
.dropzone .btn { margin-top: 18px; }

/* ---------- Cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.card-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 24px; transition: all 0.2s ease; position: relative;
}
a.card { color: var(--text); display: block; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.card .card-icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; margin-bottom: 15px;
}
.card .card-icon svg { width: 22px; height: 22px; }
.card h3 { margin-bottom: 7px; }
.card p { color: var(--text-2); font-size: 0.9rem; line-height: 1.55; }
.card .card-formats { margin-top: 15px; display: flex; flex-wrap: wrap; gap: 6px; }
.card-arrow { position: absolute; top: 22px; right: 22px; color: var(--muted); opacity: 0; transition: all 0.2s; }
.card:hover .card-arrow { opacity: 1; transform: translateX(3px); color: var(--accent); }
.card-arrow svg { width: 18px; height: 18px; }

.tint-coral  { background: var(--accent-soft); color: var(--accent); }
.tint-green  { background: var(--green-soft); color: var(--green); }
.tint-blue   { background: var(--blue-soft); color: var(--blue); }
.tint-violet { background: var(--violet-soft); color: var(--violet); }

.chip {
  font-size: 0.72rem; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: var(--bg-2); color: var(--muted); letter-spacing: 0.02em;
}
.badge-soon {
  font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  background: var(--bg-2); color: var(--muted); border-radius: 999px; padding: 3px 8px;
}

/* ---------- Features ---------- */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.feature {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 20px;
}
.feature .f-icon {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.feature .f-icon svg { width: 19px; height: 19px; }
.feature h4 { font-size: 0.97rem; margin-bottom: 4px; }
.feature p { font-size: 0.86rem; color: var(--text-2); line-height: 1.5; }

/* ---------- Steps ---------- */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 22px; counter-reset: step; }
.step { text-align: center; padding: 6px; }
.step .step-num {
  counter-increment: step; width: 46px; height: 46px; margin: 0 auto 15px;
  border-radius: 50%; background: var(--accent); color: #fff;
  font-family: var(--font-serif); font-size: 1.2rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.step .step-num::before { content: counter(step); }
.step h4 { font-family: var(--font-serif); font-size: 1.08rem; margin-bottom: 6px; font-weight: 500; }
.step p { font-size: 0.88rem; color: var(--text-2); }

/* ---------- Ad slots (Google AdSense-ready) ---------- */
.ad-slot {
  margin: 0 auto; max-width: var(--maxw); width: 100%; padding: 0 24px;
}
.ad-inner {
  position: relative; margin: 0 auto; border: 1px dashed var(--border-strong);
  border-radius: var(--r); background: var(--surface-2);
  min-height: 100px; display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.ad-inner::before {
  content: "Advertisement"; position: absolute; top: 6px; left: 10px;
  font-size: 0.62rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); opacity: 0.7;
}
.ad-inner .ad-placeholder { color: var(--muted); font-size: 0.82rem; padding: 30px; text-align: center; }
.ad-leaderboard .ad-inner { min-height: 100px; max-width: 970px; }
.ad-rect .ad-inner { min-height: 250px; max-width: 336px; }
.ad-slot.in-flow { margin-top: var(--s4); margin-bottom: var(--s4); }
/* When real ads load, hide the placeholder chrome */
.ad-inner:has(ins.adsbygoogle[data-ad-status="filled"]) { border: none; background: transparent; }
.ad-inner:has(ins.adsbygoogle[data-ad-status="filled"])::before { display: none; }

/* ============================================================
   Converter workspace
   ============================================================ */
.converter-page-head { padding: var(--s5) 0 0; text-align: center; }
.converter-page-head .cat-icon {
  width: 58px; height: 58px; border-radius: 16px; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
}
.converter-page-head .cat-icon svg { width: 27px; height: 27px; }
.converter-page-head p { color: var(--text-2); max-width: 580px; margin: 12px auto 0; font-size: 1.02rem; }

.workspace { max-width: 840px; margin: var(--s3) auto 0; padding: 0 24px; width: 100%; }

.tool-banner {
  display: flex; align-items: center; gap: 11px;
  background: var(--accent-soft); border: 1px solid var(--accent-soft-2);
  color: var(--accent); border-radius: var(--r); padding: 11px 16px; margin-bottom: 16px;
  font-weight: 600; font-size: 0.92rem;
}
[data-theme="dark"] .tool-banner { color: var(--accent-hover); }
.tool-banner svg { width: 18px; height: 18px; flex-shrink: 0; }
.tool-banner button { margin-left: auto; background: none; border: none; cursor: pointer; color: inherit; font-size: 1.3rem; line-height: 1; padding: 0 4px; }

.convert-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 14px 16px; margin-top: 16px;
}
.convert-bar label { font-size: 0.88rem; font-weight: 600; color: var(--text-2); }

select, input[type="text"], input[type="number"], input[type="color"], input[type="file"], textarea {
  font-family: var(--font-sans); font-size: 0.92rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  padding: 9px 12px; outline: none; transition: border 0.15s, box-shadow 0.15s;
}
select:focus, input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select { cursor: pointer; padding-right: 32px; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238A897F' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
input[type="color"] { padding: 3px; width: 44px; height: 38px; cursor: pointer; }
input[type="range"] { accent-color: var(--accent); }
input[type="checkbox"] { accent-color: var(--accent); width: 17px; height: 17px; cursor: pointer; }
input[type="file"] { cursor: pointer; }

.settings-panel {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 18px 20px; margin-top: 12px; display: none;
}
.settings-panel.open { display: block; animation: slideDown 0.18s ease; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 15px 22px; }
.setting-field { display: flex; flex-direction: column; gap: 6px; }
.setting-field > label { font-size: 0.79rem; font-weight: 600; color: var(--text-2); }
.setting-field .range-row { display: flex; align-items: center; gap: 10px; }
.setting-field .range-row input[type="range"] { flex: 1; }
.setting-field .range-row output { font-size: 0.8rem; color: var(--muted); min-width: 40px; font-family: var(--font-mono); text-align: right; }
.setting-field.check-row { flex-direction: row; align-items: center; gap: 9px; }
.setting-field.check-row > label { font-weight: 500; color: var(--text); font-size: 0.88rem; }

.file-queue { margin-top: 18px; display: flex; flex-direction: column; gap: 12px; }
.file-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 13px 15px; animation: fadeInUp 0.25s ease;
}
.file-card .thumb {
  width: 52px; height: 52px; border-radius: 10px; flex-shrink: 0;
  background: var(--bg-2); overflow: hidden;
  display: flex; align-items: center; justify-content: center; color: var(--muted);
}
.file-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-card .thumb svg { width: 22px; height: 22px; }
.file-card .f-info { flex: 1; min-width: 0; }
.file-card .f-name { font-weight: 600; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-card .f-meta { font-size: 0.78rem; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.file-card .f-meta .status-done { color: var(--green); font-weight: 600; }
.file-card .f-meta .status-error { color: var(--red); font-weight: 600; }
.file-card .f-meta .status-working { color: var(--accent); font-weight: 600; }
.file-card .f-actions { display: flex; gap: 7px; flex-shrink: 0; }

.progress-track { height: 6px; border-radius: 999px; background: var(--bg-2); overflow: hidden; margin-top: 8px; display: none; }
.progress-track.visible { display: block; }
.progress-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  transition: width 0.2s ease; position: relative;
}
.progress-fill::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.queue-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.queue-toolbar .spacer { flex: 1; }
.auto-dl-label {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 0.84rem; font-weight: 500; color: var(--text-2); cursor: pointer;
  user-select: none; white-space: nowrap;
}
.auto-dl-label input { width: 16px; height: 16px; }
.secure-note kbd {
  font-family: var(--font-mono); font-size: 0.75rem;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 5px; color: var(--text-2);
}
.file-card .f-actions .icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.file-card.is-done { border-color: color-mix(in srgb, var(--green) 35%, var(--border)); }
.file-card.is-error { border-color: color-mix(in srgb, var(--red) 40%, var(--border)); }
.file-card.dragging { opacity: 0.55; }
.file-card.drag-over { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.file-card .drag-handle {
  cursor: grab; color: var(--muted); font-size: 0.75rem; letter-spacing: -2px;
  user-select: none; padding: 0 2px; align-self: stretch; display: flex; align-items: center;
}
.file-card .mini-fmt {
  font-size: 0.72rem; padding: 2px 22px 2px 6px; border-radius: 6px; max-width: 88px;
}
.size-delta { font-weight: 600; }
.size-delta em { font-style: normal; font-weight: 500; opacity: 0.85; }
.size-delta.delta-down { color: var(--green); }
.size-delta.delta-up { color: var(--red); }
.size-delta.delta-same { color: var(--muted); }

/* Sticky convert controls */
.sticky-bar {
  position: sticky; top: calc(var(--header-h) + 8px); z-index: 40;
  box-shadow: var(--shadow-sm);
}
.sticky-toolbar {
  position: sticky; bottom: 12px; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 12px 14px; box-shadow: var(--shadow-md);
}
.estimate-chip {
  font-size: 0.75rem; color: var(--muted); background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 5px 10px; max-width: 220px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Multi-format export */
.multi-format-wrap {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin-top: 10px; padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r);
}
.mf-label { font-size: 0.8rem; font-weight: 600; color: var(--text-2); }
.mf-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.mf-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.8rem; font-weight: 600; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 5px 12px;
}
.mf-chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* Before/after + crop preview */
.preview-panel {
  margin-top: 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 14px; overflow: hidden;
}
.preview-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 12px;
}
.preview-head .muted, .preview-head span.muted, span.muted { color: var(--muted); font-size: 0.82rem; }
.preview-slider-wrap { display: flex; align-items: center; gap: 10px; font-size: 0.78rem; color: var(--muted); }
.preview-slider-wrap input { width: 140px; }
.preview-compare {
  position: relative; width: 100%; max-height: 360px; border-radius: var(--r-sm);
  overflow: hidden; background: var(--bg-2); aspect-ratio: 16/10;
}
.preview-compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.preview-before-clip { position: absolute; inset: 0 auto 0 0; overflow: hidden; border-right: 2px solid #fff; }
.preview-before-clip img { width: 100%; max-width: none; }
.preview-divider {
  position: absolute; top: 0; bottom: 0; width: 2px; background: #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.2); pointer-events: none;
}
.crop-preview-stage {
  position: relative; max-height: 360px; border-radius: var(--r-sm); overflow: hidden;
  background: var(--bg-2); line-height: 0;
}
.crop-preview-stage img { width: 100%; height: auto; max-height: 360px; object-fit: contain; display: block; margin: 0 auto; }
.crop-overlay {
  position: absolute; border: 2px solid var(--accent); box-shadow: 0 0 0 9999px rgba(0,0,0,0.35);
  border-radius: 2px; pointer-events: none;
}

/* PDF page thumbnails */
.pdf-thumbs {
  margin-top: 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 14px;
}
.pdf-thumbs-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px;
}
.pdf-thumbs-head span { color: var(--muted); font-size: 0.82rem; }
.pdf-thumbs-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px;
}
.pdf-thumb {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer; font-size: 0.75rem; color: var(--muted); position: relative;
}
.pdf-thumb input { position: absolute; top: 6px; left: 6px; z-index: 1; }
.pdf-thumb img {
  width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 8px;
  border: 2px solid var(--border); background: var(--bg-2);
}
.pdf-thumb:has(input:checked) img { border-color: var(--accent); }
.pdf-thumbs-loading { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.88rem; }

/* Waveform */
.wave-wrap {
  margin-top: 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 12px 14px;
}
.wave-wrap canvas { width: 100%; height: 72px; display: block; cursor: crosshair; border-radius: 8px; background: var(--bg-2); }
.wave-labels { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); margin-top: 6px; font-family: var(--font-mono); }

/* Queue stats */
.queue-stats {
  display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center;
  margin-top: 14px; padding: 8px 12px;
  font-size: 0.8rem; font-weight: 600; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
}
.queue-stats .qs-ok { color: var(--green); }
.queue-stats .qs-err { color: var(--red); }
.queue-stats .qs-run { color: var(--accent); }
.queue-actions {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; align-items: center;
}
.global-progress {
  margin-top: 10px; height: 6px; border-radius: 999px; background: var(--bg-2); overflow: hidden;
}
.global-progress-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  transition: width 0.25s ease;
}
.file-card .sel-box { display: flex; align-items: center; flex-shrink: 0; }
.file-card.is-deselected { opacity: 0.55; }

/* Media preview modal */
.media-modal { position: fixed; inset: 0; z-index: 1300; display: flex; align-items: center; justify-content: center; padding: 20px; }
.media-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.55); }
.media-modal-card {
  position: relative; z-index: 1; width: min(920px, 100%);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg); overflow: hidden;
}
.media-modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.media-modal-body { padding: 16px; text-align: center; max-height: min(70vh, 640px); overflow: auto; }
.media-modal-body img, .media-modal-body video { max-width: 100%; max-height: min(60vh, 560px); border-radius: var(--r-sm); }
.media-modal-body audio { width: 100%; margin-top: 8px; }

/* Post-convert strip */
.post-convert {
  margin-top: 16px; background: var(--green-soft); border: 1px solid color-mix(in srgb, var(--green) 30%, var(--border));
  border-radius: var(--r); padding: 14px 16px;
}
.post-convert-inner { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.post-convert-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Mismatch help */
.mismatch-help {
  margin: 12px 0; padding: 14px 16px; border-radius: var(--r);
  background: var(--accent-soft); border: 1px solid var(--accent-soft-2);
}
.mismatch-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* Page tool search */
.page-tool-search { margin-bottom: 16px; }
.page-tools-search { max-width: 100%; margin-bottom: 8px; }
.page-tools-search .pts-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); display: flex; z-index: 1; pointer-events: none; }
.page-tools-search .pts-icon svg { position: static; transform: none; width: 18px; height: 18px; }
.local-tool-hits {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 6px; box-shadow: var(--shadow-md); max-height: 280px; overflow: auto;
}
.local-hit {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 8px; color: var(--text); font-size: 0.9rem; font-weight: 500;
}
.local-hit:hover { background: var(--bg-2); color: var(--text); }
.local-hit svg { width: 16px; height: 16px; color: var(--accent); flex-shrink: 0; }

/* Mobile convert dock */
.mobile-convert-dock {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
.mobile-convert-dock .btn { width: 100%; }

/* Onboarding tip */
.onboard-tip {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 1100;
  max-width: 420px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
}
.onboard-inner { padding: 16px 18px; }
.onboard-inner strong { display: flex; align-items: center; gap: 8px; font-size: 0.98rem; }
.onboard-inner strong svg { width: 18px; height: 18px; color: var(--green); }
.onboard-inner p { color: var(--text-2); font-size: 0.86rem; margin: 8px 0 14px; line-height: 1.55; }

/* Dark theme polish */
[data-theme="dark"] .matrix th,
[data-theme="dark"] .matrix td:first-child { background: var(--surface); }
[data-theme="dark"] .ad-inner { border-color: var(--border); }
[data-theme="dark"] .preview-compare { background: #1a1917; }
[data-theme="dark"] .sticky-toolbar { background: color-mix(in srgb, var(--bg) 90%, transparent); }

.engine-note {
  display: none; align-items: center; gap: 10px; margin-top: 14px; padding: 11px 16px;
  background: var(--blue-soft); color: var(--blue); border-radius: var(--r); font-size: 0.86rem; font-weight: 500;
}
.engine-note.visible { display: flex; }
.spinner { width: 16px; height: 16px; flex-shrink: 0; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.secure-note { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 22px; color: var(--muted); font-size: 0.83rem; text-align: center; }
.secure-note svg { width: 15px; height: 15px; color: var(--green); flex-shrink: 0; }

/* Tools + matrix */
.tools-section { margin-top: var(--s6); }
.tools-section h2 { text-align: center; margin-bottom: 10px; }
.tools-section .tools-sub { text-align: center; color: var(--text-2); margin-bottom: var(--s4); }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.tool-card {
  display: flex; flex-direction: column; gap: 9px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 18px; cursor: pointer; transition: all 0.18s ease;
  text-align: left; font-family: var(--font-sans); color: var(--text);
}
.tool-card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow-sm); }
.tool-card .t-icon { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
.tool-card .t-icon svg { width: 18px; height: 18px; }
.tool-card h4 { font-size: 0.95rem; font-weight: 600; }
.tool-card p { font-size: 0.81rem; color: var(--muted); line-height: 1.45; }
.tool-card .row { display: flex; align-items: center; justify-content: space-between; }

.matrix-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r); margin-top: var(--s3); -webkit-overflow-scrolling: touch; }
.matrix { border-collapse: collapse; width: 100%; font-size: 0.8rem; min-width: 640px; }
.matrix th, .matrix td { padding: 9px 10px; text-align: center; border-bottom: 1px solid var(--border); }
.matrix th { background: var(--surface-2); font-weight: 600; color: var(--text-2); position: sticky; top: 0; }
.matrix td:first-child, .matrix th:first-child { text-align: left; font-weight: 600; background: var(--surface-2); color: var(--text-2); position: sticky; left: 0; }
.matrix td .dot { color: var(--green); font-weight: 700; }
.matrix td .no { color: var(--border-strong); }
.matrix tbody tr:last-child td { border-bottom: none; }
.matrix tr:hover td { background: var(--bg-2); }

/* ---------- Search ---------- */
.search-wrap { position: relative; max-width: 580px; margin: 0 auto var(--s4); }
.search-wrap svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search-wrap input { width: 100%; padding: 14px 18px 14px 46px; font-size: 1rem; border-radius: var(--r); border: 1px solid var(--border-strong); background: var(--surface); }

/* ---------- History ---------- */
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 13px 15px;
}
.history-item .h-icon { width: 42px; height: 42px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.history-item .h-icon svg { width: 19px; height: 19px; }
.history-item .h-info { flex: 1; min-width: 0; }
.history-item .h-name { font-weight: 600; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-item .h-meta { font-size: 0.78rem; color: var(--muted); margin-top: 1px; }
.conv-arrow {
  display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600;
  color: var(--accent); background: var(--accent-soft); padding: 3px 10px; border-radius: 999px; text-transform: uppercase;
}
.empty-state { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty-state svg { width: 44px; height: 44px; margin-bottom: 14px; opacity: 0.5; }
.empty-state h3 { color: var(--text-2); margin-bottom: 6px; }

/* ---------- FAQ ---------- */
.faq-list { display: flex; flex-direction: column; gap: 10px; }
details.faq { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 0 22px; transition: border 0.15s; }
details.faq[open] { border-color: var(--border-strong); }
details.faq summary { cursor: pointer; font-weight: 600; padding: 17px 0; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; font-size: 1.4rem; color: var(--muted); font-weight: 300; transition: transform 0.2s; flex-shrink: 0; }
details.faq[open] summary::after { transform: rotate(45deg); }
details.faq .faq-body { padding: 0 0 18px; color: var(--text-2); font-size: 0.93rem; line-height: 1.65; }

/* ---------- Legal ---------- */
.prose { padding: var(--s5) 0 var(--s6); }
.prose h1 { margin-bottom: 8px; }
.prose .updated { color: var(--muted); font-size: 0.87rem; margin-bottom: var(--s4); }
.prose h2 { font-size: 1.35rem; margin: var(--s4) 0 10px; }
.prose p, .prose li { color: var(--text-2); margin-bottom: 10px; line-height: 1.7; }
.prose ul { padding-left: 22px; margin-bottom: 14px; }
.prose strong { color: var(--text); }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; bottom: 24px; right: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.toast {
  display: flex; gap: 11px; align-items: flex-start;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-left: 4px solid var(--accent);
  border-radius: var(--r); padding: 13px 16px; box-shadow: var(--shadow-lg); font-size: 0.89rem;
  animation: toastIn 0.25s ease;
}
.toast.err { border-left-color: var(--red); }
.toast.ok { border-left-color: var(--green); }
.toast svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 2px; }
.toast.err svg { color: var(--red); }
.toast.ok svg { color: var(--green); }
.toast.info svg { color: var(--accent); }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
.toast.leaving { opacity: 0; transform: translateX(24px); transition: all 0.25s; }

/* ---------- Footer ---------- */
.site-footer { flex-shrink: 0; margin-top: var(--s6); border-top: 1px solid var(--border); background: var(--bg-2); padding: var(--s5) 0 28px; }
.footer-grid { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px; }
.footer-grid h5 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-bottom: 14px; }
.footer-grid a { display: block; color: var(--text-2); font-size: 0.88rem; padding: 4px 0; }
.footer-grid a:hover { color: var(--accent); }
.footer-brand p { color: var(--muted); font-size: 0.86rem; margin-top: 12px; max-width: 280px; line-height: 1.6; }
.footer-bottom {
  max-width: var(--maxw); margin: var(--s4) auto 0; padding: 22px 24px 0; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  color: var(--muted); font-size: 0.82rem;
}
.footer-bottom .local-badge { display: inline-flex; align-items: center; gap: 6px; color: var(--green); font-weight: 600; }
.footer-bottom .local-badge svg { width: 14px; height: 14px; }

/* ---------- Breadcrumbs ---------- */
.breadcrumb {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding-top: 18px; margin: 0 auto; font-size: 0.83rem; color: var(--muted);
}
.breadcrumb a { color: var(--text-2); font-weight: 500; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span[aria-hidden] { color: var(--border-strong); }
.breadcrumb span[aria-current] { color: var(--muted); }

/* ---------- Cookie / privacy consent ---------- */
.consent-banner {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 1200;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
}
.consent-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 18px 22px;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.consent-text { flex: 1; min-width: 260px; }
.consent-text strong { font-size: 0.98rem; }
.consent-text p { color: var(--text-2); font-size: 0.86rem; margin-top: 4px; line-height: 1.55; }
.consent-actions { display: flex; gap: 10px; flex-shrink: 0; }
@media (max-width: 560px) {
  .consent-actions { width: 100%; }
  .consent-actions .btn { flex: 1; }
}

/* ---------- Accessibility: visible keyboard focus ---------- */
a:focus-visible, button:focus-visible, .btn:focus-visible, .cat-tab:focus-visible,
.dropzone:focus-visible, .tool-card:focus-visible, .card:focus-visible,
select:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible,
.icon-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
.dropzone:focus-visible { outline-offset: -3px; }

/* Skip link for keyboard users */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 2000;
  background: var(--accent); color: #fff; padding: 10px 16px;
  border-radius: 0 0 var(--r-sm) 0; font-weight: 600; font-size: 0.9rem;
}
.skip-link:focus { left: 0; color: #fff; }

/* Disabled convert button during run */
.btn:disabled { pointer-events: none; }

/* Long error messages in the queue */
.file-card .f-meta .status-error {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; max-width: 100%;
}

/* ---------- Animations ---------- */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.animate-in { animation: fadeInUp 0.4s ease both; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 940px) {
  .main-nav { display: none; }
  .hamburger { display: flex; }
  .card-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  :root { --s6: 4rem; --s5: 3rem; }
}
@media (max-width: 620px) {
  body { font-size: 15.5px; }
  .container, .container-narrow, .workspace, .converter-shell, .ad-slot { padding-left: 18px; padding-right: 18px; }
  .hero { padding: var(--s5) 0 var(--s3); }
  .dropzone { padding: 36px 18px; }
  .card-grid.cols-4 { grid-template-columns: 1fr; }
  .convert-bar { flex-direction: column; align-items: stretch; }
  .convert-bar > * { width: 100%; }
  .convert-bar label { margin-bottom: -4px; }
  .convert-bar #convertBtnTop { display: none; }
  .sticky-toolbar { bottom: 72px; }
  .queue-toolbar { flex-direction: column; align-items: stretch; }
  .queue-toolbar .btn { width: 100%; }
  .queue-toolbar .spacer { display: none; }
  .queue-toolbar #convertBtn { display: none; } /* use mobile dock */
  .mobile-convert-dock.is-open { display: flex !important; }
  .file-card { flex-wrap: wrap; }
  .file-card .drag-handle { display: none; }
  .file-card .f-actions { width: 100%; margin-top: 4px; }
  .file-card .f-actions .btn { flex: 1; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .toast-stack { left: 16px; right: 16px; max-width: none; bottom: 88px; }
  .cat-tab span { display: none; }
  .cat-tab { min-width: 0; padding: 11px; }
  .cat-tab svg { width: 19px; height: 19px; }
  .secure-note { margin-bottom: 80px; }
  .estimate-chip { max-width: 100%; white-space: normal; }
}
