/* =====================================================================
   File Zain — v44 design layer
   Loaded after styles.css. Redefines the colour and type tokens (so every
   existing page picks them up) and styles the new home page pieces (px-*).
   ===================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Readex+Pro:wght@400;500;600;700&family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap');

:root {
  --bg: #F6F7FB;
  --surface: #FFFFFF;
  --surface-2: #EEF0F7;
  --ink: #131A33;
  --ink-soft: #525B78;
  --ink-faint: #8990A7;
  --border: #E0E3ED;
  --accent: #2F4BDB;
  --accent-ink: #FFFFFF;
  --accent-soft: #E8ECFD;
  --slab: #131A33;
  --slab-2: #1D2647;
  --star: #E8A317;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(19,26,51,.04), 0 10px 28px -12px rgba(19,26,51,.12);
  --font-display: 'Readex Pro', 'IBM Plex Sans Arabic', 'Noto Sans SC', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans Arabic', 'Noto Sans SC', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --header-h: 63px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A0F1E; --surface: #111831; --surface-2: #18213D;
    --ink: #EDF0FA; --ink-soft: #A6AEC7; --ink-faint: #6D7593;
    --border: #232D4B; --accent: #8DA2FF; --accent-ink: #0A0F1E; --accent-soft: #1B2550;
    --slab: #1A2550; --slab-2: #233063; --star: #F5B83D;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 14px 32px -14px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  --bg: #0A0F1E; --surface: #111831; --surface-2: #18213D;
  --ink: #EDF0FA; --ink-soft: #A6AEC7; --ink-faint: #6D7593;
  --border: #232D4B; --accent: #8DA2FF; --accent-ink: #0A0F1E; --accent-soft: #1B2550;
  --slab: #1A2550; --slab-2: #233063; --star: #F5B83D;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 14px 32px -14px rgba(0,0,0,.6);
}

/* one hue per tool family, used for icons, dots and hover states */
[data-cat] { --hue: #2F4BDB; }
[data-cat="pdf_from"] { --hue: #E0434A; }
[data-cat="pdf_to"] { --hue: #DD6B10; }
[data-cat="image"] { --hue: #8250E8; }
[data-cat="pdf_tools"] { --hue: #2F4BDB; }
[data-cat="media"] { --hue: #0C9586; }
[data-cat="utilities"] { --hue: #5F6B8C; }
[data-cat="archive"] { --hue: #B7791F; }
[data-cat="studio"] { --hue: #2F4BDB; }
:root[data-theme="dark"] [data-cat="pdf_tools"], :root[data-theme="dark"] [data-cat="studio"] { --hue: #8DA2FF; }
:root[data-theme="dark"] [data-cat="utilities"] { --hue: #A3ADCB; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) [data-cat="pdf_tools"], :root:not([data-theme="light"]) [data-cat="studio"] { --hue: #8DA2FF; }
  :root:not([data-theme="light"]) [data-cat="utilities"] { --hue: #A3ADCB; }
}
[data-cat] { --hue-soft: color-mix(in srgb, var(--hue) 12%, var(--surface)); }

/* ---------- type ---------- */
body, [dir="rtl"] body { font-family: var(--font-body); line-height: 1.55; }
h1, h2, h3, [dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3 { font-family: var(--font-display); }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3 { letter-spacing: 0 !important; } /* tracking breaks Arabic joins */
[lang="zh"] body, [lang="zh"] h1, [lang="zh"] h2, [lang="zh"] h3 { font-family: 'Noto Sans SC', var(--font-body); }

/* ---------- header ---------- */
.site-header { min-height: var(--header-h); gap: 12px; }
.site-header .brand { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; }
.header-controls { gap: 10px; }
.px-cmd-open {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 10px 0 12px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--ink-soft);
  font: 500 .88rem var(--font-body); cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.px-cmd-open:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); color: var(--ink); }
.px-cmd-open svg { width: 17px; height: 17px; flex: none; }
.px-cmd-open kbd {
  font: 600 .72rem var(--font-body); color: var(--ink-faint);
  border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; background: var(--surface-2);
}
@media (max-width: 720px) {
  .px-cmd-open { width: 40px; height: 40px; padding: 0; justify-content: center; }
  .px-cmd-open .px-cmd-label, .px-cmd-open kbd { display: none; }
}

/* ---------- hero ---------- */
.px-hero {
  max-width: 1080px; margin: 0 auto;
  padding: clamp(40px, 7vw, 84px) 20px 8px;
  text-align: center;
}
.px-title {
  font-size: clamp(2.05rem, 5vw, 3.75rem);
  line-height: 1.14; font-weight: 600; letter-spacing: -.028em;
  max-width: 17ch; margin: 0 auto; color: var(--ink);
  text-wrap: balance;
}
[dir="rtl"] .px-title { line-height: 1.3; max-width: 16ch; }
.px-sub {
  max-width: 58ch; margin: 18px auto 0;
  font-size: clamp(1rem, 1.6vw, 1.12rem); line-height: 1.75; color: var(--ink-soft);
  text-wrap: pretty;
}

/* the drop surface: the one loud thing on the page */
.px-drop {
  position: relative; isolation: isolate;
  margin: 38px auto 0; max-width: 880px;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 26px;
  padding: 30px 30px 22px;
  background: var(--slab); color: #fff;
  border-radius: 28px; text-align: start; cursor: pointer;
  box-shadow: 0 34px 60px -34px rgba(19,26,51,.6), inset 0 0 0 1px rgba(255,255,255,.06);
  transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s ease;
}
.px-drop::before { /* faint grid, like a cutting mat */
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(120% 90% at 15% 50%, #000 30%, transparent 75%);
          mask-image: radial-gradient(120% 90% at 15% 50%, #000 30%, transparent 75%);
}
[dir="rtl"] .px-drop::before {
  -webkit-mask-image: radial-gradient(120% 90% at 85% 50%, #000 30%, transparent 75%);
          mask-image: radial-gradient(120% 90% at 85% 50%, #000 30%, transparent 75%);
}
.px-drop:hover { transform: translateY(-2px); }
.px-drop:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }

.px-sheets { position: relative; width: 132px; height: 104px; flex: none; }
.px-sheet {
  position: absolute; top: 8px; inset-inline-start: 34px;
  width: 62px; height: 80px; border-radius: 7px;
  background: #fff;
  box-shadow: 0 10px 22px -10px rgba(0,0,0,.55);
  clip-path: polygon(0 0, 72% 0, 100% 22%, 100% 100%, 0 100%);
  transition: transform .4s cubic-bezier(.2,.9,.25,1.15);
}
.px-sheet::before { /* text lines */
  content: ""; position: absolute; inset: 14px 11px auto 11px; height: 26px;
  background: repeating-linear-gradient(#D9DDEA 0 3px, transparent 3px 8px);
  border-radius: 2px;
}
.px-sheet b {
  position: absolute; bottom: 9px; inset-inline-start: 9px;
  font: 700 10px/1 'Readex Pro', Arial, sans-serif; letter-spacing: .04em;
  color: #fff; padding: 4px 6px; border-radius: 4px;
}
.px-sheet-a { transform: translateX(-22px) rotate(-13deg); }
.px-sheet-a b { background: #2B579A; }
.px-sheet-b { transform: translateY(-4px); z-index: 2; }
.px-sheet-b b { background: #E0434A; }
.px-sheet-c { transform: translateX(22px) rotate(13deg); }
.px-sheet-c b { background: #8250E8; }
.px-drop:hover .px-sheet-a { transform: translateX(-30px) translateY(-3px) rotate(-18deg); }
.px-drop:hover .px-sheet-b { transform: translateY(-10px); }
.px-drop:hover .px-sheet-c { transform: translateX(30px) translateY(-3px) rotate(18deg); }

.px-drop-text strong { display: block; font: 600 clamp(1.25rem, 2.4vw, 1.55rem)/1.3 var(--font-display); color: #fff; }
.px-drop-text span { display: block; margin-top: 4px; color: rgba(255,255,255,.72); font-size: .98rem; }
.px-drop-btn {
  justify-self: end;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 22px; border-radius: 999px;
  background: #fff; color: #131A33; font: 600 .98rem var(--font-body); white-space: nowrap;
  box-shadow: 0 6px 16px -8px rgba(0,0,0,.5);
  transition: background .15s ease;
}
.px-drop:hover .px-drop-btn { background: #E8ECFD; }
.px-drop-hint {
  grid-column: 1 / -1; display: block;
  padding-top: 16px; border-top: 1px solid rgba(255,255,255,.1);
  color: rgba(255,255,255,.55); font-size: .84rem; text-align: center;
}

/* dragging a file over the page */
.px-release {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 20px); z-index: 61;
  padding: 12px 20px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: .95rem;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,.45);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
}
body.px-dragging::before {
  content: ""; position: fixed; inset: 0; z-index: 59;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  backdrop-filter: blur(2px); pointer-events: none;
}
body.px-dragging .px-drop { z-index: 60; transform: scale(1.015); box-shadow: 0 0 0 4px var(--accent), 0 40px 70px -30px rgba(19,26,51,.7); }
body.px-dragging .px-sheet-a { transform: translateX(-34px) translateY(-6px) rotate(-22deg); }
body.px-dragging .px-sheet-b { transform: translateY(-14px); }
body.px-dragging .px-sheet-c { transform: translateX(34px) translateY(-6px) rotate(22deg); }
body.px-dragging .px-release { opacity: 1; transform: translate(-50%, 0); }

.px-trust {
  list-style: none; padding: 0; margin: 20px auto 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px;
  color: var(--ink-soft); font-size: .92rem;
}
.px-trust li { display: inline-flex; align-items: center; gap: 7px; }
.px-trust svg { width: 17px; height: 17px; color: var(--success); flex: none; }

@media (max-width: 720px) {
  .px-drop { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 16px; padding: 26px 20px 18px; border-radius: 24px; }
  .px-drop-btn { justify-self: center; }
  .px-sheets { width: 120px; height: 92px; }
  .px-sheet { width: 54px; height: 70px; inset-inline-start: 33px; }
  .px-drop::before { -webkit-mask-image: radial-gradient(90% 70% at 50% 25%, #000 30%, transparent 75%); mask-image: radial-gradient(90% 70% at 50% 25%, #000 30%, transparent 75%); }
}

/* the existing assistant (mascot + search + quick tools) sits under the hero */
.px-assist { max-width: 880px; margin: 30px auto 0; padding: 0 20px; }
.px-assist .fm-stage { margin: 0 auto; }
.px-assist .fm-panel { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }

/* ---------- your tools ---------- */
.px-mine {
  max-width: 1180px; margin: 44px auto 0; padding: 20px 22px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  width: calc(100% - 40px);
}
.px-mine h2 { font-size: 1.05rem; font-weight: 600; margin-bottom: 12px; }
.px-mine-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; }
.px-mine-row + .px-mine-row { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.px-mine-label { color: var(--ink-faint); font-size: .85rem; min-width: 7.5em; }
.px-linkbtn { margin-inline-start: auto; background: none; border: 0; color: var(--ink-faint); font: inherit; font-size: .84rem; cursor: pointer; padding: 6px 4px; text-decoration: underline; text-underline-offset: 3px; }
.px-linkbtn:hover { color: var(--ink); }

.px-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.px-chip {
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 44px; padding: 6px 14px 6px 7px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  font-size: .9rem; font-weight: 500; color: var(--ink);
  transition: border-color .15s ease, background .15s ease;
}
[dir="rtl"] .px-chip { padding: 6px 7px 6px 14px; }
.px-chip:hover { border-color: color-mix(in srgb, var(--hue) 50%, var(--border)); background: var(--hue-soft); }
.px-chip-ico { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; }
.px-chip-ico .fm-tool-icon-svg { height: 18px; max-width: 64px; }
.px-chip-ico .fm-tool-icon-svg.fm-tool-icon-mono { width: 30px; height: 30px; max-width: none; padding: 6px; border-radius: 8px; background: var(--hue-soft); color: var(--hue); }
.px-chip-ico img { width: 28px; height: 28px; object-fit: contain; }

/* ---------- filter bar ---------- */
.px-filters {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--header-h)); z-index: 30;
  margin-top: 48px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.px-filters-in {
  max-width: 1180px; margin: 0 auto; padding: 10px 20px;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
}
.px-filters-in::-webkit-scrollbar { display: none; }
.px-filter {
  flex: none; display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 15px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-soft);
  font: 500 .9rem var(--font-body); cursor: pointer; white-space: nowrap;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.px-filter:hover { color: var(--ink); border-color: color-mix(in srgb, var(--hue, var(--ink)) 40%, var(--border)); }
.px-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--hue, var(--ink)); flex: none; }
.px-filter[data-filter="all"] .px-dot { background: conic-gradient(#E0434A 0 25%, #8250E8 0 50%, #0C9586 0 75%, #2F4BDB 0); }
.px-filter[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- tool sections ---------- */
.px-sections { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.px-sections .px-section { margin: 34px 0 0; padding: 0; scroll-margin-top: 140px; }
.px-section-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.px-sections .section-title { margin: 0; font: 600 1.2rem/1.3 var(--font-display); color: var(--ink); }
.px-count { color: var(--ink-faint); font-size: .85rem; }
.px-sections .px-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: 12px;
  margin: 0; padding: 0;
}

.px-card {
  position: relative; --hue-soft: color-mix(in srgb, var(--hue) 11%, var(--surface));
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  overflow: hidden;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.px-card:hover {
  border-color: color-mix(in srgb, var(--hue) 45%, var(--border));
  box-shadow: 0 14px 28px -18px color-mix(in srgb, var(--hue) 70%, transparent);
  transform: translateY(-2px);
}
/* Terminal Pro: slim terminal bar with traffic dots + favorite star */
.px-termbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.px-dots { display: flex; gap: 6px; transition: transform .25s ease; }
.px-dots i { display: block; width: 10px; height: 10px; border-radius: 50%; }
.px-dots i:nth-child(1) { background: #FF5F57; }
.px-dots i:nth-child(2) { background: #FEBC2E; }
.px-dots i:nth-child(3) { background: #28C840; }
.px-card:hover .px-dots, .px-card:active .px-dots, .px-card:focus-within .px-dots { transform: translateX(18px); }
[dir="rtl"] .px-card:hover .px-dots, [dir="rtl"] .px-card:active .px-dots, [dir="rtl"] .px-card:focus-within .px-dots { transform: translateX(-18px); }
.px-card-link {
  height: 100%;
  display: flex; flex-direction: column;
  padding: 0 18px 16px; min-height: 150px;
  color: var(--ink);
}
.px-card-link:focus-visible { outline: 2px solid var(--hue); outline-offset: 2px; }
/* base icon box (used by the drop-zone match suggestions) */
.px-card-ico { display: flex; align-items: center; height: 42px; margin-bottom: 6px; }
.px-card-ico .fm-tool-icon-svg { height: 26px; max-width: 96px; }
.px-card-ico .fm-tool-icon-svg.fm-tool-icon-mono {
  width: 42px; height: 42px; max-width: none; padding: 9px; border-radius: 12px;
  background: var(--hue-soft); color: var(--hue);
}
/* Terminal Pro: wide icon strip across the card */
.px-card-icostrip {
  display: flex; align-items: center; justify-content: center;
  margin: 0 -18px 12px; padding: 16px 12px;
  background: var(--hue-soft);
  border-bottom: 1px solid var(--border);
}
.px-card-icostrip .fm-tool-icon-svg { height: 40px; max-width: 210px; }
.px-card-icostrip .fm-tool-icon-svg.fm-tool-icon-mono {
  width: 58px; height: 58px; max-width: none; padding: 0; border-radius: 0;
  background: none; color: var(--hue);
}
.px-card-icostrip img { width: 52px; height: 52px; object-fit: contain; }
.px-card-name { font-weight: 600; font-size: 1rem; line-height: 1.35; }
.px-card-desc {
  font-size: .86rem; line-height: 1.55; color: var(--ink-soft);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.px-termbar .px-star {
  width: 32px; height: 32px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--ink-faint);
  cursor: pointer; transition: color .15s ease, background .15s ease, transform .15s ease;
}
.px-termbar .px-star svg { width: 18px; height: 18px; fill: none; }
.px-termbar .px-star:hover { background: var(--surface); color: var(--ink); transform: scale(1.08); }
.px-termbar .px-star[aria-pressed="true"] { color: var(--star); }
.px-termbar .px-star[aria-pressed="true"] svg { fill: currentColor; }
.px-termbar .px-star.is-pop svg { animation: px-pop .38s cubic-bezier(.3,1.6,.5,1); }
@keyframes px-pop { 0% { transform: scale(.6); } 100% { transform: scale(1); } }
@media (hover: none) { .px-star { opacity: .6; } }

/* ---------- how it works ---------- */
.px-steps {
  max-width: 1180px; width: calc(100% - 40px); margin: 72px auto 0;
  padding: clamp(24px, 4vw, 40px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 24px;
}
.px-steps h2 { font-size: clamp(1.3rem, 2.4vw, 1.6rem); font-weight: 600; margin-bottom: 24px; }
.px-steps ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); }
.px-steps li { display: flex; gap: 14px; padding-inline-end: 24px; }
.px-steps li + li { padding-inline-start: 24px; border-inline-start: 1px solid var(--border); }
.px-step-n {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font: 700 .95rem var(--font-display);
}
.px-steps h3 { font-size: 1rem; font-weight: 600; margin: 5px 0 6px; }
.px-steps p { font-size: .9rem; line-height: 1.6; }
@media (max-width: 820px) {
  .px-steps ol { grid-template-columns: 1fr; gap: 18px; }
  .px-steps li, .px-steps li + li { padding: 0; border: 0; }
}

/* ---------- create from scratch ---------- */
.px-studio { max-width: 1180px; margin: 64px auto 0; padding: 0 20px; }
.px-studio h2 { font-size: clamp(1.3rem, 2.4vw, 1.6rem); font-weight: 600; margin-bottom: 18px; }
.px-studio-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.px-studio-tile {
  display: flex; flex-direction: column; gap: 8px;
  padding: 22px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--border); color: var(--ink);
  transition: border-color .16s ease, transform .16s ease;
}
a.px-studio-tile:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); transform: translateY(-2px); }
.px-studio-tile img { width: 56px; height: 56px; object-fit: contain; margin-bottom: 6px; }
.px-studio-tile strong { font: 600 1.08rem/1.35 var(--font-display); }
.px-studio-tile > span { color: var(--ink-soft); font-size: .9rem; line-height: 1.6; }
.px-studio-tile em { font-style: normal; font-weight: 600; color: var(--accent); margin-top: auto; padding-top: 8px; font-size: .92rem; }
.px-studio-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 8px; }
.px-studio-actions a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px;
  font-weight: 600; font-size: .88rem; border: 1px solid var(--border); color: var(--ink);
}
.px-studio-actions a:first-child { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.px-studio-actions a:hover { border-color: var(--accent); }
@media (max-width: 860px) { .px-studio-grid { grid-template-columns: 1fr; } }

/* ---------- tool pages ---------- */
.px-related { margin-top: 44px; padding-top: 24px; border-top: 1px solid var(--border); }
.px-related h2 { font-size: 1.02rem; font-weight: 600; margin-bottom: 12px; color: var(--ink); }
.tool-page .dropzone { border-radius: 20px; background: var(--surface); }
.tool-page .dropzone:hover, .tool-page .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- dialogs (smart drop results, command palette) ---------- */
.px-sheet-dialog, .px-cmd-dialog {
  border: 0; padding: 0; color: var(--ink); background: var(--surface);
  box-shadow: 0 40px 80px -30px rgba(0,0,0,.5), 0 0 0 1px var(--border);
}
.px-sheet-dialog::backdrop, .px-cmd-dialog::backdrop { background: rgba(8,12,26,.5); backdrop-filter: blur(3px); }
.px-sheet-dialog { width: min(760px, calc(100% - 24px)); max-height: min(80vh, 760px); border-radius: 24px; }
.px-sheet-dialog[open], .px-cmd-dialog[open] { animation: px-in .22s cubic-bezier(.2,.8,.2,1); }
@keyframes px-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.px-sheet-in { padding: 22px; }
.px-sheet-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.px-sheet-head > div { flex: 1; min-width: 0; }
.px-sheet-head h2 { font-size: 1.25rem; font-weight: 600; }
.px-sheet-head p { margin-top: 4px; font-size: .9rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.px-size { color: var(--ink-faint); margin-inline-start: 6px; }
.px-x {
  flex: none; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink-soft); font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.px-x:hover { color: var(--ink); background: var(--surface-2); }
.px-match-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.px-match {
  display: flex; align-items: center; gap: 12px; text-align: start;
  padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); font: inherit; cursor: pointer;
  --hue-soft: color-mix(in srgb, var(--hue) 11%, var(--surface));
  transition: border-color .15s ease, background .15s ease;
}
.px-match:hover, .px-match:focus-visible { border-color: color-mix(in srgb, var(--hue) 55%, var(--border)); background: var(--hue-soft); outline: none; }
.px-match .px-card-ico { margin: 0; height: 40px; min-width: 40px; justify-content: center; }
.px-match .px-card-ico .fm-tool-icon-svg { height: 22px; max-width: 80px; }
.px-match .px-card-ico .fm-tool-icon-svg.fm-tool-icon-mono { width: 40px; height: 40px; }
.px-match-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.px-match-txt strong { font-weight: 600; font-size: .95rem; }
.px-match-txt small { color: var(--ink-soft); font-size: .8rem; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.px-match-none { padding: 18px; border-radius: 14px; background: var(--surface-2); color: var(--ink-soft); }
@media (max-width: 640px) {
  .px-sheet-dialog { width: 100%; max-width: 100%; max-height: 86vh; margin: auto 0 0; border-radius: 24px 24px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .px-match-grid { grid-template-columns: 1fr; }
}

.px-cmd-dialog { width: min(620px, calc(100% - 24px)); margin-top: 12vh; border-radius: 20px; }
.px-cmd-in { display: flex; flex-direction: column; max-height: 70vh; }
.px-cmd-field { display: flex; align-items: center; gap: 10px; padding: 6px 16px; border-bottom: 1px solid var(--border); color: var(--ink-faint); }
.px-cmd-field svg { width: 20px; height: 20px; flex: none; }
.px-cmd-field input {
  flex: 1; min-width: 0; height: 52px; border: 0; outline: 0; background: transparent;
  color: var(--ink); font: 500 1.05rem var(--font-body);
}
.px-cmd-field input::-webkit-search-cancel-button { display: none; }
.px-cmd-list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.px-cmd-list li[role="option"] {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; cursor: pointer;
  --hue-soft: color-mix(in srgb, var(--hue) 12%, var(--surface));
}
.px-cmd-list li[aria-selected="true"] { background: var(--surface-2); }
.px-cmd-ico { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 32px; flex: none; }
.px-cmd-ico .fm-tool-icon-svg { height: 18px; max-width: 64px; }
.px-cmd-ico .fm-tool-icon-svg.fm-tool-icon-mono { width: 32px; height: 32px; padding: 6px; border-radius: 9px; background: var(--hue-soft); color: var(--hue); }
.px-cmd-ico img { width: 28px; height: 28px; object-fit: contain; }
.px-cmd-name { font-weight: 500; font-size: .95rem; }
.px-cmd-sub { margin-inline-start: auto; color: var(--ink-faint); font-size: .8rem; white-space: nowrap; }
.px-cmd-empty { padding: 18px; color: var(--ink-soft); text-align: center; }
.px-cmd-hint { margin: 0; padding: 10px 16px; border-top: 1px solid var(--border); color: var(--ink-faint); font-size: .78rem; }
@media (hover: none) { .px-cmd-hint { display: none; } }

/* ---------- footer ---------- */
.site-footer { margin-top: 80px; border-top: 1px solid var(--border); }

@media (prefers-reduced-motion: reduce) {
  .px-drop, .px-sheet, .px-card, .px-card-link, .px-studio-tile, .px-release, .px-chip { transition: none !important; }
  .px-drop:hover, .px-card:hover, a.px-studio-tile:hover { transform: none; }
  .px-sheet-dialog[open], .px-cmd-dialog[open], .px-star.is-pop svg { animation: none; }
}

/* v44 fixes */
.site-header .brand { white-space: nowrap; min-width: 0; }
@media (max-width: 420px) {
  .site-header { padding-inline: 14px; }
  .header-controls { gap: 6px; }
  #brand-text { display: none; }
}
.px-drop-hint { display: flex !important; flex-wrap: wrap; justify-content: center; gap: 6px; }
.px-drop-hint i {
  font: 600 .72rem/1 'Readex Pro', system-ui, sans-serif; font-style: normal; letter-spacing: .03em;
  padding: 5px 8px; border-radius: 6px;
  color: rgba(255,255,255,.7); background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.08);
}
.px-sheet-a { transform: translateX(-30px) rotate(-14deg); }
.px-sheet-c { transform: translateX(30px) rotate(14deg); }
.px-drop:hover .px-sheet-a { transform: translateX(-38px) translateY(-3px) rotate(-19deg); }
.px-drop:hover .px-sheet-c { transform: translateX(38px) translateY(-3px) rotate(19deg); }
body.px-dragging .px-sheet-a { transform: translateX(-42px) translateY(-6px) rotate(-23deg); }
body.px-dragging .px-sheet-c { transform: translateX(42px) translateY(-6px) rotate(23deg); }
.px-card-ico img, .px-match .px-card-ico img { width: 40px; height: 40px; object-fit: contain; }
.px-note { margin: 6px 0 10px; font-size: .9rem; color: var(--ink-soft); }

/* v46 accessibility: visually hidden headings + 44px touch targets on small controls */
.fz-sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.fm-search-x, .back-link, .fb-entry-remove, .fb-section-remove { position: relative; }
.fm-search-x::after, .back-link::after, .fb-entry-remove::after, .fb-section-remove::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: max(100%, 44px); height: max(100%, 44px); transform: translate(-50%, -50%);
}
.back-link { padding-block: 8px; }

/* v46 phones: two compact cards per row instead of one tall card (≈ 60% less scrolling) */
@media (max-width: 560px) {
  .px-sections { padding: 0 14px; }
  .px-sections .px-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .px-card { border-radius: 14px; }
  .px-termbar { padding: 4px 6px 4px 10px; }
  [dir="rtl"] .px-termbar { padding: 4px 10px 4px 6px; }
  .px-dots { gap: 5px; }
  .px-dots i { width: 8px; height: 8px; }
  .px-termbar .px-star { width: 36px; height: 36px; }
  .px-card-link { min-height: 0; padding: 0 12px 12px; }
  .px-card-icostrip { margin: 0 -12px 10px; padding: 12px 6px; }
  .px-card-icostrip .fm-tool-icon-svg { height: 26px; max-width: 100%; }
  .px-card-icostrip .fm-tool-icon-svg.fm-tool-icon-mono { width: 38px; height: 38px; }
  .px-card-icostrip img { width: 38px; height: 38px; }
  .px-card-name { font-size: .9rem; }
  .px-card-desc { font-size: .78rem; line-height: 1.45; }
}

/* v47 offline: media-engine card + connection notice */
.px-offline {
  margin-top: 36px; padding: 18px; border-radius: 18px;
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
}
.px-offline-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.px-offline-ico svg { width: 22px; height: 22px; }
.px-offline h2 { font-size: 1rem; font-weight: 600; margin: 0 0 3px; color: var(--ink); }
.px-offline p { font-size: .88rem; line-height: 1.55; color: var(--ink-soft); margin: 0; }
.px-offline-btn { white-space: nowrap; min-height: 44px; }
.px-offline-bar { height: 6px; margin-top: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.px-offline-bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .2s ease; }
.px-offline.is-ready { grid-template-columns: auto 1fr; }
.px-offline.is-ready .px-offline-ico { background: color-mix(in srgb, var(--success) 15%, var(--surface)); color: var(--success); }
@media (max-width: 560px) { .px-offline { grid-template-columns: auto 1fr; } .px-offline-btn { grid-column: 1 / -1; width: 100%; } }
.px-net {
  position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom, 0px)); z-index: 80;
  transform: translate(-50%, 140%); max-width: calc(100% - 28px);
  padding: 11px 18px; border-radius: 999px; font-size: .9rem; font-weight: 500;
  background: var(--ink); color: var(--bg); box-shadow: 0 12px 30px -12px rgba(0,0,0,.5);
  transition: transform .25s cubic-bezier(.2,.8,.2,1); pointer-events: none; text-align: center;
}
.px-net.is-on { transform: translate(-50%, 0); }
.px-net[data-kind="on"] { background: var(--success); color: #fff; }
@media (prefers-reduced-motion: reduce) { .px-net, .px-offline-bar span { transition: none; } }

/* v48 fillform: fill-PDF-forms custom tool */
#ff-actions[hidden], #ff-fields[hidden] { display: none; }
.ff-wrap { margin-top: 18px; }
.ff-drop { text-align: center; padding: 26px 16px; border: 2px dashed var(--border); border-radius: 16px; background: var(--surface); }
.ff-hint { margin: 12px 0 0; font-size: .9rem; color: var(--ink-soft); }
.ff-fields { margin-top: 18px; display: grid; gap: 12px; }
.ff-fields .opt { display: grid; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.ff-fields .opt span { font-size: .85rem; font-weight: 600; color: var(--ink-soft); word-break: break-all; }
.ff-fields input[type="text"], .ff-fields textarea, .ff-fields select { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--ink); font-size: .95rem; font-family: inherit; }
.ff-fields input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--accent); }
.ff-radios { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.ff-radios label { display: flex; align-items: center; gap: 6px; font-size: .9rem; }
.ff-loading { text-align: center; color: var(--ink-soft); }
