/*
Theme Name: FileToolsPlus
Description: Fast, ad-ready theme for the FileToolsPlus Core plugin. RTL, dark mode, zero-CLS ad slots, no web fonts.
Version: 0.3.0
Requires at least: 6.5
Requires PHP: 8.1
License: GPL-2.0-or-later
Text Domain: fileforge
*/

:root {
  --bg: #f7f7f5; --surface: #ffffff; --surface-2: #f0efec; --text: #1c1b19; --muted: #6b6862; --line: #e3e1dc;
  --accent: #1f6feb; --focus: #1f6feb; --radius: 14px; --radius-s: 9px;
  --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 4px 16px rgb(0 0 0 / .04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", Tahoma, sans-serif;
  --s-1: .8125rem; --s0: 1rem; --s1: 1.125rem; --s2: 1.375rem; --s3: 1.75rem; --s4: clamp(1.75rem, 1.2rem + 2.2vw, 2.6rem);
  /* suite colours */
  --c-image: #7c3aed; --c-pdf: #dc2626; --c-av: #ea580c; --c-gif: #db2777; --c-doc: #2563eb;
  --c-archive: #059669; --c-ebook: #0d9488; --c-font: #4f46e5; --c-data: #16a34a; --c-util: #64748b;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) { --bg:#121212; --surface:#1b1b1b; --surface-2:#242424; --text:#ecebe8; --muted:#a19e97; --line:#2e2d2b; --accent:#6ea8ff; --focus:#6ea8ff; color-scheme: dark; } }
:root[data-theme=dark] { --bg:#121212; --surface:#1b1b1b; --surface-2:#242424; --text:#ecebe8; --muted:#a19e97; --line:#2e2d2b; --accent:#6ea8ff; --focus:#6ea8ff; color-scheme: dark; }

/* readable text in the suite colour (WCAG AA on its tinted background) */
[data-suite] { --ink: color-mix(in srgb, var(--c) 68%, #000); }
:root[data-theme=dark] [data-suite] { --ink: color-mix(in srgb, var(--c) 60%, #fff); }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) [data-suite] { --ink: color-mix(in srgb, var(--c) 60%, #fff); } }
[data-suite=image]{--c:var(--c-image)} [data-suite=pdf]{--c:var(--c-pdf)} [data-suite=av]{--c:var(--c-av)} [data-suite=gif]{--c:var(--c-gif)}
[data-suite=doc]{--c:var(--c-doc)} [data-suite=archive]{--c:var(--c-archive)} [data-suite=ebook]{--c:var(--c-ebook)}
[data-suite=font]{--c:var(--c-font)} [data-suite=data]{--c:var(--c-data)} [data-suite=util]{--c:var(--c-util)}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 var(--s0)/1.6 var(--font); }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: var(--s4); } h2 { font-size: var(--s2); } h3 { font-size: var(--s1); }
.ff-wrap { max-width: 1240px; margin-inline: auto; padding-inline: 20px; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* header */
.ff-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.ff-header .ff-wrap { display: flex; align-items: center; gap: 12px; height: 60px; }
.ff-logo { font-weight: 800; font-size: var(--s1); color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 8px; margin-inline-end: auto; }
.ff-logo i { width: 26px; height: 26px; border-radius: 8px; background: conic-gradient(from 210deg, var(--c-pdf), var(--c-av), var(--c-image), var(--c-doc), var(--c-data), var(--c-pdf)); }
.ff-searchbtn { display: flex; align-items: center; gap: 10px; min-width: min(320px, 42vw); padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; cursor: pointer; }
.ff-searchbtn kbd { margin-inline-start: auto; font: 600 11px var(--font); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
.ff-searchbtn svg { flex: none; }
.ff-iconbtn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.ff-lang { position: relative; }
.ff-lang select { height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; padding-inline: 8px; }
@media (max-width: 640px) { .ff-searchbtn span, .ff-searchbtn kbd { display: none; } .ff-searchbtn { min-width: 0; padding: 8px 11px; } .ff-header .ff-wrap { gap: 8px; } .ff-lang select { max-width: 112px; } .ff-logo { font-size: var(--s0); } }
/* phones: 4 tools per category (6 popular) until "show all" */
@media (max-width: 640px) { .ff-suite:not(.ff-open):not(.ff-popular) > .ff-grid > li:nth-child(n+5), .ff-popular > .ff-grid > li:nth-child(n+7) { display: none; } .ff-hero--home { padding-top: 12px; } .ff-badges li { font-size: 12px; padding: 5px 10px; } }

/* layout */
.ff-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; max-width: 1240px; margin-inline: auto; padding: 24px 20px 64px; }
@media (min-width: 1200px) { .ff-layout { grid-template-columns: minmax(0, 1fr) 300px; } .ff-aside > .ff-ad { position: sticky; top: 84px; } }
@media (max-width: 1199px) { .ff-aside { display: none; } }
.ff-main { min-width: 0; }
main.ff-home { max-width: 1240px; margin-inline: auto; padding: 24px 20px 64px; }
.ff-crumbs { font-size: var(--s-1); color: var(--muted); display: flex; gap: 8px; margin-bottom: 12px; }
.ff-crumbs a { color: inherit; text-decoration: none; }
.ff-hero { margin: 8px 0 20px; }
.ff-hero--home { text-align: center; padding: 28px 0 8px; position: relative; }
.ff-hero--home::before { content: ""; position: absolute; inset: -40px 0 auto; height: 340px; z-index: -1; pointer-events: none; background: radial-gradient(closest-side, color-mix(in srgb, var(--c-image) 16%, transparent), transparent) 18% 30% / 45% 80% no-repeat, radial-gradient(closest-side, color-mix(in srgb, var(--c-pdf) 13%, transparent), transparent) 82% 20% / 45% 80% no-repeat, radial-gradient(closest-side, color-mix(in srgb, var(--c-doc) 11%, transparent), transparent) 50% 55% / 55% 80% no-repeat; }
.ff-hero--home h1 { max-width: 22ch; margin-inline: auto; font-size: clamp(1.9rem, 1.2rem + 3vw, 3.1rem); letter-spacing: -.025em; }
.ff-hero--home .ff-lead { font-size: var(--s1); color: var(--muted); margin: 0 auto 18px; max-width: 60ch; }
.ff-badges { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.ff-badges li { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: var(--s-1); font-weight: 600; }
.ff-badges li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c-data); }
.ff-404__code { font-size: clamp(4rem, 3rem + 6vw, 7rem); font-weight: 900; line-height: 1; margin: 0 0 8px; background: linear-gradient(120deg, var(--c-image), var(--c-pdf), var(--c-av)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ff-skip:focus { position: fixed; top: 8px; inset-inline-start: 8px; width: auto; height: auto; clip: auto; z-index: 99; padding: 8px 14px; background: var(--surface); border-radius: 8px; }
.ff-hero--tool h1 { display: flex; align-items: center; gap: 12px; }
.ff-hero--tool h1::before { content: ""; flex: none; width: 12px; height: 12px; border-radius: 4px; background: var(--c); }
.ff-lead { color: var(--muted); font-size: var(--s1); margin: 0; max-width: 62ch; }

/* dropzone + tool */
.ff-drop { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 40px 20px; border: 2px dashed color-mix(in srgb, var(--c, var(--accent)) 45%, var(--line)); border-radius: var(--radius); background: color-mix(in srgb, var(--c, var(--accent)) 5%, var(--surface)); cursor: pointer; transition: border-color .15s, background .15s, transform .15s; }
.ff-drop svg { color: var(--c, var(--accent)); }
.ff-drop strong { font-size: var(--s1); }
.ff-drop small { color: var(--muted); }
.ff-drop.is-over { border-color: var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 12%, var(--surface)); transform: scale(1.005); }
.ff-drop--hero { padding: 64px 20px; border-radius: 22px; --c: var(--accent); }
.ff-tool { background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--radius) + 4px); padding: 16px; box-shadow: var(--shadow); }
.ff-tool.has-files .ff-drop { padding: 18px; }
.ff-files, .ff-outs { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.ff-files li, .ff-outs li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius-s); background: var(--surface-2); }
.ff-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ff-size { color: var(--muted); font-variant-numeric: tabular-nums; font-size: var(--s-1); }
.ff-files button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; width: 28px; height: 28px; border-radius: 6px; }
.ff-files button:hover { background: var(--line); color: var(--text); }
.ff-options fieldset { border: 0; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: end; }
.ff-options legend { font-weight: 700; margin-bottom: 8px; }
.ff-field { display: grid; gap: 4px; font-size: var(--s-1); color: var(--muted); min-width: 140px; }
.ff-field input, .ff-field select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 40px; }
.ff-field input[type=range] { padding: 0; accent-color: var(--c); }
.ff-check { display: flex; gap: 8px; align-items: center; font-size: var(--s-1); min-height: 40px; }
.ff-actions { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.ff-actions progress { flex: 1; height: 8px; accent-color: var(--c); }
.ff-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 600 var(--s-1) var(--font); text-decoration: none; cursor: pointer; }
.ff-btn--primary { background: var(--c, var(--accent)); border-color: transparent; color: #fff; padding: 12px 28px; font-size: var(--s0); }
.ff-btn:disabled { opacity: .45; cursor: not-allowed; }
.ff-results:empty { display: none; }
.ff-results { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.ff-summary strong { color: var(--c-data); }
.ff-zip { margin-top: 10px; }
.ff-next { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ff-next p { margin: 0; width: 100%; font-weight: 700; }
.ff-chip { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); text-decoration: none; font-size: var(--s-1); }
.ff-chip:hover { border-color: var(--accent); }
.ff-error { color: var(--c-pdf); }

/* grids */
.ff-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.ff-grid a { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto 1fr; align-content: start; column-gap: 12px; row-gap: 4px; height: 100%; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; transition: transform .15s, box-shadow .15s, border-color .15s; }
.ff-grid a:hover, .ff-grid a:focus-visible { transform: translateY(-2px); box-shadow: 0 8px 24px color-mix(in srgb, var(--c, var(--accent)) 14%, transparent); border-color: color-mix(in srgb, var(--c, var(--accent)) 45%, var(--line)); }
.ff-grid b { grid-column: 2; font-size: .975rem; line-height: 1.3; align-self: center; }
.ff-grid small { grid-column: 1 / -1; color: var(--muted); font-size: var(--s-1); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin-top: 6px; }
.ff-grid a:not(:has(.ff-tile)) b, .ff-grid a:not(:has(.ff-tile)) small { grid-column: 1 / -1; }
.ff-tile { grid-row: 1; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; color: var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 12%, var(--surface)); }
.ff-ico { width: 22px; height: 22px; }
.ff-tabs { display: flex; gap: 8px; overflow-x: auto; margin: 28px 0 8px; padding-bottom: 4px; }
.ff-tabs a { flex: none; padding: 7px 14px; border-radius: 999px; background: color-mix(in srgb, var(--c) 10%, var(--surface)); color: var(--ink); font-weight: 700; text-decoration: none; font-size: var(--s-1); }
.ff-suite { margin-top: 28px; scroll-margin-top: 80px; }
.ff-suite h2 { display: flex; align-items: center; gap: 12px; }
.ff-suite h2 .ff-tile { width: 36px; height: 36px; }
.ff-count { font-size: var(--s-1); font-weight: 700; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 2px 10px; }
.ff-more { margin-top: 12px; }
.ff-more:empty { display: none; }
@media (min-width: 641px) { .ff-morebtn--phone { display: none; } }
.ff-morebtn { margin-top: 14px; padding: 10px 18px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--c) 35%, var(--line)); background: var(--surface); color: var(--ink, var(--c)); font: 700 var(--s-1) var(--font); cursor: pointer; }
.ff-morebtn:hover { background: color-mix(in srgb, var(--c) 8%, var(--surface)); }
.ff-popular h2::before { content: "★"; color: #f59e0b; }
.ff-smart-result { margin-top: 18px; }
.ff-detected { font-weight: 700; }
.ff-soon { color: var(--muted); text-align: center; margin-top: 32px; }

/* content */
.ff-content { margin-top: 36px; display: grid; gap: 36px; max-width: 820px; }
.ff-steps { counter-reset: s; list-style: none; padding: 0; display: grid; gap: 10px; }
.ff-steps li { counter-increment: s; display: flex; gap: 12px; align-items: baseline; }
.ff-steps li::before { content: counter(s); flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--c, var(--accent)); color: #fff; font-weight: 800; font-size: var(--s-1); }
.ff-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.ff-table { width: 100%; border-collapse: collapse; background: var(--surface); }
.ff-table th, .ff-table td { text-align: start; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ff-table thead th { background: var(--surface-2); font-size: var(--s-1); }
.ff-table tr:last-child > * { border-bottom: 0; }
.ff-privacy { padding: 20px; border-radius: var(--radius); background: color-mix(in srgb, var(--c-data) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c-data) 25%, var(--line)); }
.ff-privacy p { margin: 0; }
.ff-faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.ff-faq summary { cursor: pointer; font-weight: 700; }
.ff-faq details p { margin: 8px 0 0; color: var(--muted); }

/* ads: reserved height = zero layout shift */
.ff-ad { min-height: var(--ad-h); margin: 20px 0; display: grid; align-content: start; }
@media (min-width: 768px) { .ff-ad { min-height: var(--ad-hd); } }
.ff-ad[hidden] { display: none; }
.ff-ad__label { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); text-align: center; margin-bottom: 4px; }
.ff-ad:not(:has(ins)) { border: 1px dashed var(--line); border-radius: var(--radius-s); }
.ff-aside .ff-ad { width: 300px; margin-top: 0; }

/* palette */
#ff-palette { width: min(640px, 94vw); padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgb(0 0 0 / .25); margin-top: 10vh; }
#ff-palette::backdrop { background: rgb(0 0 0 / .35); }
#ff-palette input { width: 100%; padding: 18px 20px; font: 500 var(--s1) var(--font); border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); outline: none; }
#ff-palette ul { list-style: none; margin: 0; padding: 8px; max-height: 60vh; overflow: auto; }
#ff-palette li a { display: grid; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; border-inline-start: 3px solid var(--c); }
#ff-palette li[aria-selected=true] a, #ff-palette li a:hover { background: var(--surface-2); }
#ff-palette small { color: var(--muted); }
.ff-empty { padding: 16px; color: var(--muted); }

/* footer + regular pages */
.ff-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 40px 0 24px; color: var(--muted); font-size: var(--s-1); margin-top: 32px; }
.ff-footer__grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 28px; }
@media (max-width: 820px) { .ff-footer__grid { grid-template-columns: 1fr 1fr; } .ff-footer__brand { grid-column: 1 / -1; } }
.ff-footer h2 { font-size: var(--s-1); text-transform: uppercase; letter-spacing: .06em; color: var(--text); margin-bottom: 12px; }
.ff-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.ff-footer a { color: inherit; text-decoration: none; }
.ff-footer a:hover { color: var(--text); text-decoration: underline; }
.ff-footer__brand p { max-width: 34ch; margin: 10px 0 0; }
.ff-footer__base { border-top: 1px solid var(--line); margin-top: 28px; padding-top: 16px; }
.ff-footer__base p { margin: 0; }
.ff-article { max-width: 760px; margin-inline: auto; padding: 32px 20px 64px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
.ff-content h3 { margin-top: 1.2em; }
.ff-content section > p { max-width: 70ch; }
.ff-tips ul { padding-inline-start: 1.2em; display: grid; gap: 8px; }
.ff-tips li::marker { color: var(--c, var(--accent)); }
.ff-field--wide { flex: 1 1 260px; }
.ff-field small { font-size: 11px; }
.ff-crop { margin-top: 14px; display: grid; gap: 6px; justify-items: center; }
.ff-crop__stage { position: relative; display: inline-block; max-width: 100%; line-height: 0; user-select: none; touch-action: none; }
.ff-crop__stage img { max-width: 100%; max-height: 60vh; border-radius: 8px; }
.ff-crop__box { position: absolute; outline: 2px solid #fff; box-shadow: 0 0 0 9999px rgb(0 0 0 / .5); cursor: move; border-radius: 2px; }
.ff-crop__box span { position: absolute; width: 18px; height: 18px; background: #fff; border: 2px solid var(--c, var(--accent)); border-radius: 50%; }
.ff-crop__box [data-h=nw] { left: -9px; top: -9px; cursor: nwse-resize; } .ff-crop__box [data-h=ne] { right: -9px; top: -9px; cursor: nesw-resize; }
.ff-crop__box [data-h=sw] { left: -9px; bottom: -9px; cursor: nesw-resize; } .ff-crop__box [data-h=se] { right: -9px; bottom: -9px; cursor: nwse-resize; }
.ff-crop__size { font-size: var(--s-1); color: var(--muted); font-variant-numeric: tabular-nums; }
.ff-pick { margin-top: 14px; display: grid; gap: 10px; }
.ff-pick__stage { position: relative; justify-self: center; max-width: 100%; line-height: 0; }
.ff-pick__stage canvas { max-width: 100%; max-height: 60vh; border-radius: 8px; cursor: crosshair; touch-action: manipulation; }
.ff-pick__lens { position: absolute; z-index: 2; pointer-events: none; padding: 4px 8px 4px 26px; border-radius: 8px; background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: var(--shadow); font: 600 12px/1.4 ui-monospace, monospace; }
.ff-pick__lens::before { content: ""; position: absolute; inset-inline-start: 6px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 4px; background: var(--sw); border: 1px solid rgb(0 0 0 / .15); }
.ff-pick__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.ff-btn--small { padding: 4px 10px; font-size: var(--s-1); min-height: 0; }
.ff-pwlist { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.ff-pwlist li { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); }
.ff-pwlist code { font-size: 15px; overflow-wrap: anywhere; }
.ff-barcode { display: flex; justify-content: center; padding: 12px; background: #fff; border-radius: var(--radius-s); }
.ff-barcode svg { max-width: 100%; height: auto; }
.ff-fontprev { padding: 8px 4px 16px; border-bottom: 1px solid var(--line); margin-bottom: 10px; overflow-wrap: anywhere; }
.ff-fontprev p { margin: 0 0 6px; line-height: 1.3; }
.ff-hash__name { font-size: var(--s-1); margin: 14px 0 4px; overflow-wrap: anywhere; }
.ff-report { margin-bottom: 14px; }
.ff-info { width: 100%; border-collapse: collapse; font-size: var(--s-1); }
.ff-info th, .ff-info td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
.ff-info th { width: 38%; color: var(--muted); font-weight: 600; }
.ff-info td { overflow-wrap: anywhere; }
.ff-palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.ff-swatch { display: grid; gap: 2px; text-align: start; padding: 0 0 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); cursor: pointer; overflow: hidden; font: inherit; }
.ff-swatch i { display: block; height: 64px; background: var(--sw); margin-bottom: 6px; }
.ff-swatch b, .ff-swatch small { padding-inline: 10px; } .ff-swatch small { color: var(--muted); font-size: 11px; }
.ff-swatch.is-copied b::after, .ff-btn.is-copied::after { content: " ✓"; color: var(--c-data); }
.ff-code { width: 100%; font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--surface-2); color: var(--text); margin-bottom: 8px; direction: ltr; }
.ff-gps { font-weight: 700; }

/* QR generator */
.ff-qr-group { display: contents; }
.ff-qr-group[hidden] { display: none; }
.ff-qr { margin: 0 0 14px; text-align: center; }
.ff-qr img { max-width: 100%; height: auto; background: #fff; border: 1px solid var(--ff-line, #ddd); border-radius: 8px; image-rendering: pixelated; }
.ff-qr figcaption { margin-top: 6px; font-size: .85rem; color: #555; overflow-wrap: anywhere; }
.ff-field textarea { width: 100%; font: inherit; }
.ff-drop[hidden] { display: none; }
.ff-qr-group .ff-field--wide { flex: 1 1 100%; }
.ff-qr-group .ff-field--wide textarea { min-height: 5.5em; }

/* fill-pdf-form field panel */
.ff-formfields{border:1px solid var(--ff-border,#d9d9d4);border-radius:12px;padding:1rem;margin:0 0 1rem;display:grid;gap:.75rem;max-height:28rem;overflow:auto}
.ff-formfields legend{font-weight:600;padding:0 .4rem}
.ff-formfield{display:grid;gap:.25rem}
.ff-formfield label{font-size:.9rem;overflow-wrap:anywhere}
.ff-formfield input[type=text],.ff-formfield textarea,.ff-formfield select{width:100%;padding:.5rem .6rem;border:1px solid var(--ff-border,#c8c8c2);border-radius:8px;font:inherit;background:var(--ff-bg,#fff);color:inherit}
.ff-formfield--check{display:flex;align-items:center;gap:.5rem}
.ff-formmsg{color:#b3261e;margin:0}

/* Redact PDF: page previews with draggable black boxes */
.ff-redact { margin: 14px 0; padding: 12px; border: 1px solid var(--ff-line, #d9dee7); border-radius: 12px; background: #fff; }
.ff-redact__head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.ff-redact__count { color: #55607a; font-size: .92rem; margin-inline-end: auto; }
.ff-redact__pages { display: grid; gap: 14px; margin-top: 10px; max-height: 70vh; overflow: auto; padding: 4px; background: #eef1f6; border-radius: 8px; }
.ff-redact__page { margin: 0; display: grid; justify-items: center; gap: 4px; }
.ff-redact__page figcaption { font-size: .85rem; color: #55607a; }
.ff-redact__stage { position: relative; width: min(100%, 640px); background: #fff; box-shadow: 0 1px 6px rgb(0 0 0 / .18); cursor: crosshair; touch-action: none; user-select: none; }
.ff-redact__stage canvas { display: block; width: 100%; height: 100%; }
.ff-redact__box { position: absolute; background: #000; outline: 1px solid #fff; }
.ff-redact__box--auto { background: rgb(60 60 60 / .55); outline: 1px dashed #c00; pointer-events: none; }
.ff-redact__del { position: absolute; top: -10px; inset-inline-end: -10px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: #c0262d; color: #fff; font-size: 15px; line-height: 22px; padding: 0; cursor: pointer; }
.ff-redact__msg { color: #b00020; }/* Edit PDF / Annotate PDF page editor */
.ff-pe { margin: 14px 0; padding: 12px; border: 1px solid var(--ff-line, #d9dee7); border-radius: 12px; background: #fff; }
.ff-pe__bar { display: flex; flex-wrap: wrap; gap: 6px; }
.ff-pe__tool { padding: 6px 12px; border: 1px solid #c9d1de; border-radius: 999px; background: #f6f8fb; cursor: pointer; font: inherit; font-size: .92rem; }
.ff-pe__tool[aria-pressed="true"] { background: var(--c, #1f6feb); border-color: var(--c, #1f6feb); color: #fff; }
.ff-pe__opts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 10px; font-size: .92rem; }
.ff-pe__opt { display: inline-flex; align-items: center; gap: 6px; }
.ff-pe__opt[hidden] { display: none; }
.ff-pe__size { width: 4.5em; }
.ff-pe__count { color: #55607a; margin-inline-start: auto; }
.ff-pe__pages { display: grid; gap: 14px; margin-top: 10px; max-height: 75vh; overflow: auto; padding: 4px; background: #eef1f6; border-radius: 8px; }
.ff-pe__page { margin: 0; display: grid; justify-items: center; gap: 4px; }
.ff-pe__page figcaption { font-size: .85rem; color: #55607a; }
.ff-pe__stage { position: relative; width: min(100%, 720px); background: #fff; box-shadow: 0 1px 6px rgb(0 0 0 / .18); cursor: crosshair; touch-action: none; user-select: none; container-type: inline-size; }
.ff-pe[data-tool="select"] .ff-pe__stage { cursor: default; }
.ff-pe__stage canvas { display: block; width: 100%; height: 100%; }
.ff-pe__item { position: absolute; box-sizing: border-box; cursor: move; }
.ff-pe__item.is-selected { outline: 2px dashed #1f6feb; outline-offset: 2px; }
.ff-pe__item svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.ff-pe__item--text { min-width: 2em; }
.ff-pe__text { white-space: pre; outline: none; cursor: text; min-height: 1em; direction: ltr; unicode-bidi: plaintext; }
.ff-pe__text:empty::before { content: attr(data-placeholder); color: #8a94a6; }
.ff-pe__item--whiteout { background: #fff; outline: 1px dashed #b8c1cf; }
.ff-pe__item--rect, .ff-pe__item--box { border-style: solid; }
.ff-pe__item--ellipse { border-style: solid; border-radius: 50%; }
.ff-pe__item--image img { width: 100%; height: 100%; display: block; pointer-events: none; }
.ff-pe__item--highlight { background: var(--c); opacity: .45; mix-blend-mode: multiply; }
.ff-pe__item--underline { border-bottom: 2px solid var(--c); }
.ff-pe__item--strike { background: linear-gradient(transparent calc(50% - 1px), var(--c) calc(50% - 1px), var(--c) calc(50% + 1px), transparent calc(50% + 1px)); }
.ff-pe__item--note { background: var(--c); border: 1px solid #5a4c1a; border-radius: 2px; min-width: 16px; min-height: 16px; }
.ff-pe__del { position: absolute; top: -11px; inset-inline-end: -11px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: #c0262d; color: #fff; font-size: 15px; line-height: 22px; padding: 0; cursor: pointer; display: none; z-index: 2; }
.ff-pe__item.is-selected .ff-pe__del, .ff-pe__item:hover .ff-pe__del { display: block; }
.ff-hits { margin: 8px 0 0; padding-inline-start: 1.4em; display: grid; gap: 6px; font-size: var(--s-1); }
.ff-hits li { overflow-wrap: anywhere; }
.ff-hits__where { color: var(--muted); font-variant-numeric: tabular-nums; margin-inline-end: 6px; white-space: nowrap; }
.ff-hits mark { background: #ffe58a; color: #1c1b19; border-radius: 3px; padding: 0 2px; }
.ff-diff del { background: #ffd7d5; color: #82071e; text-decoration: line-through; }
.ff-diff ins { background: #ccffd8; color: #116329; text-decoration: none; }
.ff-gifbars { display: flex; align-items: flex-end; gap: 1px; height: 60px; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius-s); overflow-x: auto; }
.ff-gifbars i { flex: 1 0 3px; min-width: 3px; height: calc(var(--d) * 100%); background: var(--c, var(--accent)); border-radius: 1px; }
.ff-rec { margin: 12px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.ff-rec__btn.is-rec { background: #c62828; }
.ff-rec__time { font: 600 20px/1 ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.ff-rec__meter { width: 120px; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.ff-rec__meter i { display: block; height: 100%; width: calc(var(--lvl, 0) * 100%); background: #2e7d32; transition: width .08s; }
.ff-rec .ff-hint { flex-basis: 100%; margin: 0; }

/* live converters (units, time zones) */
.ff-live .ff-results { display: none; }
.ff-conv { margin: 12px 0; display: grid; gap: 12px; }
.ff-conv__row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.ff-conv__main .ff-field { flex: 1 1 160px; }
.ff-conv__main input[name=uval] { font-size: var(--s1); }
.ff-conv__swap { align-self: end; margin-bottom: 4px; }
.ff-conv__result { font-size: var(--s2); font-weight: 600; margin: 4px 0; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ff-conv__all summary { cursor: pointer; color: var(--muted); }
.ff-tz__table td, .ff-tz__table th { vertical-align: middle; }
.ff-tz__table small { color: var(--muted); font-weight: 400; }

/* PDF and EPUB readers */
.ff-reader { margin: 12px 0; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface-2); overflow: hidden; }
.ff-reader__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.ff-reader__bar input[type=number] { width: 4.5em; }
.ff-reader__bar input[type=search] { min-width: 10em; flex: 1 1 10em; }
.ff-reader__sep { flex: 0 0 8px; }
.ff-reader__hits { color: var(--muted); font-size: var(--s-1); }
.ff-reader__body { display: flex; }
.ff-reader__toc { flex: 0 0 240px; max-height: 80vh; overflow: auto; padding: 8px; border-inline-end: 1px solid var(--line); background: var(--surface); font-size: var(--s-1); }
.ff-reader__toc ul { list-style: none; margin: 0; padding: 0; }
.ff-reader__toc a { display: block; padding: 3px 0; }
.ff-reader__pages { flex: 1; height: 80vh; overflow: auto; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; outline: none; }
.ff-reader:fullscreen .ff-reader__pages { height: calc(100vh - 56px); }
.ff-reader__page { position: relative; background: #fff; box-shadow: 0 1px 4px rgb(0 0 0 / .25); flex: none; }
.ff-reader__page canvas { display: block; }
.ff-reader--dark .ff-reader__page canvas { filter: invert(1) hue-rotate(180deg); }
.ff-reader--dark .ff-reader__page { background: #111; }
.ff-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.textLayer { position: absolute; inset: 0; overflow: clip; line-height: 1; text-align: initial; opacity: 1; transform-origin: 0 0; z-index: 0;
  --min-font-size: 1; --text-scale-factor: calc(var(--total-scale-factor) * var(--min-font-size)); --min-font-size-inv: calc(1 / var(--min-font-size)); }
.textLayer :is(span, br) { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; user-select: text; }
.textLayer > :not(.markedContent), .textLayer .markedContent span:not(.markedContent) { z-index: 1; --font-height: 0; font-size: calc(var(--text-scale-factor) * var(--font-height));
  --scale-x: 1; --rotate: 0deg; transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv)); }
.textLayer .markedContent { display: contents; }
.textLayer ::selection { background: rgb(0 0 255 / .25); }
.textLayer br::selection { background: transparent; }
.textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: 0; cursor: default; user-select: none; }
.textLayer span.ff-reader__hit { background: rgb(255 200 0 / .45); border-radius: 2px; }
.ff-epub__frame { display: block; width: 100%; min-height: 400px; border: 0; background: #fff; }
.ff-epub__title { max-width: 18em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ff-epub .ff-reader__bar select[data-a=toc] { max-width: 16em; }
.ff-inv { margin: 12px 0; display: grid; gap: 12px; }
.ff-inv .ff-conv__row > .ff-field { flex: 1 1 160px; }
.ff-inv__items { width: 100%; border-collapse: collapse; }
.ff-inv__items th { text-align: start; font-size: var(--s-1); color: var(--muted); font-weight: 600; padding: 4px; }
.ff-inv__items td { padding: 3px 4px; vertical-align: top; }
.ff-inv__items td:first-child { width: 50%; }
.ff-inv__items input, .ff-inv__items textarea { width: 100%; box-sizing: border-box; }
.ff-inv__total { margin: 0 0 0 auto; font-size: var(--s1); }
.ff-pe__item--ftext, .ff-pe__item--fmulti, .ff-pe__item--fcheck, .ff-pe__item--fselect { border: 1.5px dashed #1f6feb; background: rgb(31 111 235 / .12); }
.ff-pe__fname { position: absolute; inset-inline-start: 3px; top: 1px; font-size: 11px; color: #1f4fbf; pointer-events: none; white-space: nowrap; overflow: hidden; max-width: 100%; }
.ff-pe__item--fcheck .ff-pe__fname { inset: 0; display: grid; place-items: center; font-size: 10px; }
.ff-sig { border: 1px solid var(--line); border-inline-start: 5px solid #16a34a; border-radius: var(--radius-s); padding: 8px 12px; margin: 8px 0; }
.ff-sig h3 { margin: 0 0 6px; font-size: var(--s0); }
.ff-sig--ok h3 span { color: #15803d; } .ff-sig--warn { border-inline-start-color: #d97706; } .ff-sig--warn h3 span { color: #b45309; }
.ff-sig--bad { border-inline-start-color: #dc2626; } .ff-sig--bad h3 span { color: #b91c1c; }

/* GIF frame editor */
.ff-gfe { margin: 12px 0; }
.ff-gfe__bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.ff-gfe__bar input[type=number] { width: 6em; }
.ff-gfe__bar output { color: var(--muted); font-size: var(--s-1); margin-inline-start: auto; }
.ff-gfe__preview { display: block; max-width: 100%; max-height: 320px; margin: 8px auto; image-rendering: auto; background: repeating-conic-gradient(#ddd 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.ff-gfe__strip { list-style: none; margin: 0; padding: 6px; display: flex; gap: 8px; overflow-x: auto; background: var(--surface-2); border-radius: var(--radius-s); }
.ff-gfe__strip li { flex: none; display: grid; justify-items: center; gap: 3px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; font-size: 12px; }
.ff-gfe__strip img { display: block; background: repeating-conic-gradient(#ddd 0 25%, #fff 0 50%) 0 0 / 10px 10px; }
.ff-gfe__strip input { width: 5.5em; font-size: 12px; }
.ff-gfe__btns { display: flex; gap: 2px; } .ff-gfe__btns button { padding: 0 5px; font-size: 12px; line-height: 1.6; border: 1px solid var(--line); background: var(--surface-2); border-radius: 4px; cursor: pointer; }

/* photo editor */
.ff-photo { margin: 12px 0; }
.ff-photo__bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.ff-photo__main { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 12px; align-items: start; }
@media (max-width: 760px) { .ff-photo__main { grid-template-columns: 1fr; } }
.ff-photo__stage { position: relative; justify-self: center; touch-action: none; user-select: none; line-height: 0; }
.ff-photo__stage canvas { max-width: 100%; max-height: 70vh; display: block; }
.ff-photo__crop { position: absolute; border: 2px dashed #fff; box-shadow: 0 0 0 9999px rgb(0 0 0 / .45); pointer-events: none; outline: 1px solid rgb(0 0 0 / .5); }
.ff-photo__stage { overflow: hidden; }
.ff-photo__sliders { display: grid; gap: 8px; }
.ff-photo__sl { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; font-size: var(--s-1); }
.ff-photo__sl input { grid-column: 1 / -1; width: 100%; }

/* card maker */
.ff-card { margin: 12px 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 760px) { .ff-card { grid-template-columns: 1fr; } }
.ff-card__form { display: grid; gap: 10px; }
.ff-card__preview canvas { max-width: 100%; height: auto; display: block; margin: 0 auto; box-shadow: var(--shadow); border-radius: 6px; }

/* PDF workflows */
.ff-wf { margin: 12px 0; display: grid; gap: 10px; }
.ff-wf__bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ff-wf__bar > span:first-child { color: var(--muted); font-size: var(--s-1); }
.ff-wf__saved { display: inline-flex; align-items: center; } .ff-wf__x { border: 0; background: none; cursor: pointer; color: var(--muted); }
.ff-wf__steps { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; counter-reset: wf; }
.ff-wf__steps li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); }
.ff-wf__steps li strong { min-width: 14em; }
.ff-wf__opts { display: flex; flex-wrap: wrap; gap: 8px; flex: 1; }
.ff-wf__f { font-size: var(--s-1); color: var(--muted); display: inline-flex; gap: 4px; align-items: center; }
.ff-wf__btns { display: flex; gap: 3px; margin-inline-start: auto; } .ff-wf__btns button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 4px; cursor: pointer; min-width: 26px; }
.ff-ve { margin: 12px 0; display: grid; gap: 6px; justify-items: center; }
.ff-ve video { max-width: 100%; max-height: 60vh; background: #000; border-radius: var(--radius-s); }
.ff-ve__bar { display: flex; gap: 10px; align-items: center; }

/* AI document tools: answers, chat, quiz */
.ff-ai-answer { text-align: start; background: var(--surface-2); border-radius: var(--radius-s); padding: 12px 16px; }
.ff-ai-answer--long { max-height: 60vh; overflow: auto; }
.ff-ai-answer h3, .ff-ai-answer h4 { margin: .8em 0 .3em; } .ff-ai-answer ul, .ff-ai-answer ol { padding-inline-start: 1.3em; margin: .3em 0; }
.ff-ai-note { font-size: var(--s-1); color: var(--muted); flex-basis: 100%; }
.ff-chat { margin: 12px 0; display: grid; gap: 10px; }
.ff-chat__log { display: grid; gap: 8px; max-height: 60vh; overflow: auto; }
.ff-chat__log:empty { display: none; }
.ff-chat__msg { padding: 10px 14px; border-radius: var(--radius-s); max-width: 92%; }
.ff-chat__msg p { margin: .2em 0; } .ff-chat__msg ul, .ff-chat__msg ol { padding-inline-start: 1.3em; margin: .3em 0; }
.ff-chat__msg--me { justify-self: end; background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.ff-chat__msg--ai { justify-self: start; background: var(--surface-2); }
.ff-chat__wait { color: var(--muted); }
.ff-chat__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ff-chat__ask { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.ff-chat__ask textarea { flex: 1 1 260px; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); color: var(--text); resize: vertical; }
.ff-chat .ff-hint { font-size: var(--s-1); color: var(--muted); margin: 0; }
.ff-quiz { text-align: start; padding-inline-start: 1.4em; display: grid; gap: 14px; }
.ff-quiz ul { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 6px; }
.ff-quiz__opt { width: 100%; text-align: start; font: inherit; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); color: var(--text); cursor: pointer; }
.ff-quiz__opt:hover:not(:disabled) { border-color: var(--accent); }
.ff-quiz__opt.is-right { border-color: #16a34a; background: color-mix(in srgb, #16a34a 14%, var(--surface)); }
.ff-quiz__opt.is-wrong { border-color: #dc2626; background: color-mix(in srgb, #dc2626 12%, var(--surface)); }
.ff-quiz__opt:disabled { cursor: default; }
.ff-quiz__why { margin: 4px 0 0; color: var(--muted); }
.ff-quiz__score { font-weight: 600; }

/* generative fill editor */
.ff-inp { margin: 12px 0; display: grid; gap: 8px; }
.ff-inp__bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ff-inp__bar .is-on { outline: 2px solid var(--accent); }
.ff-inp__stage { position: relative; justify-self: center; max-width: 100%; line-height: 0; }
.ff-inp__stage canvas { max-width: 100%; height: auto; border-radius: var(--radius-s); }
.ff-inp__mask { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
.ff-inp .ff-hint { margin: 0; font-size: var(--s-1); color: var(--muted); }
.ff-tts__bar { flex-basis: 100%; margin: 0; display: flex; gap: 8px; }
.ff-inv__party { flex: 1 1 320px; border: 1px solid var(--line); border-radius: var(--radius-s); padding: 8px 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 10px; }
.ff-inv__party legend { font-weight: 600; padding: 0 4px; }

/* PDF reader: clickable links over the page */
.ff-reader__links{position:absolute;inset:0;pointer-events:none;z-index:2}
.ff-reader__links a{position:absolute;pointer-events:auto;border-radius:2px}
.ff-reader__links a:hover,.ff-reader__links a:focus-visible{background:rgba(37,99,235,.18);outline:1px solid rgba(37,99,235,.55)}
