/* PixelFree v2 — Studio-grade hand-written CSS. Logical properties keep RTL flawless. */
:root {
  --bg: #f5f6fb;
  --bg-glow: radial-gradient(900px 420px at 50% -80px, rgba(109, 74, 255, .14), transparent 70%);
  --surface: #ffffff;
  --surface-2: #f1f2f9;
  --surface-3: #e9ebf6;
  --glass: rgba(255, 255, 255, .82);
  --text: #111328;
  --muted: #5a5d7a;
  --border: #dfe2f0;
  --brand: #6d4aff;
  --brand-2: #8b5cf6;
  --brand-soft: rgba(109, 74, 255, .10);
  --brand-ink: #ffffff;
  --accent: #06b6d4;
  --ok: #0e9f52;
  --ok-soft: rgba(14, 159, 82, .12);
  --warn: #d97706;
  --warn-soft: rgba(217, 119, 6, .13);
  --err: #dc2626;
  --err-soft: rgba(220, 38, 38, .12);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 2px 10px rgba(20, 22, 60, .05);
  --shadow: 0 10px 34px rgba(24, 22, 74, .08);
  --shadow-lg: 0 20px 56px rgba(24, 22, 74, .16);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", Tahoma, sans-serif;
  --checker: repeating-conic-gradient(#e7e9f4 0 25%, #ffffff 0 50%) 0 0 / 16px 16px;
  color-scheme: light;
}
.dark {
  --bg: #0b0c18;
  --bg-glow: radial-gradient(900px 440px at 50% -90px, rgba(139, 92, 246, .22), transparent 72%);
  --surface: #141629;
  --surface-2: #1c1f37;
  --surface-3: #252946;
  --glass: rgba(17, 19, 36, .84);
  --text: #eef0ff;
  --muted: #9da1c4;
  --border: #2a2e4d;
  --brand: #8b72ff;
  --brand-2: #a78bfa;
  --brand-soft: rgba(139, 114, 255, .16);
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, .28);
  --shadow: 0 12px 38px rgba(0, 0, 0, .42);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, .62);
  --checker: repeating-conic-gradient(#262a47 0 25%, #1a1d34 0 50%) 0 0 / 16px 16px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font: 15.5px/1.6 var(--font);
  background: var(--bg);
  background-image: var(--bg-glow);
  background-repeat: no-repeat;
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--brand); }
img, canvas { max-width: 100%; }
.ic { display: inline-block; vertical-align: -0.18em; flex-shrink: 0; }
h1 { font-size: clamp(1.75rem, 4.2vw, 2.75rem); line-height: 1.14; letter-spacing: -0.025em; margin: .35em 0 .28em; font-weight: 850; }
h2 { font-size: 1.38rem; letter-spacing: -0.015em; margin: 1.7em 0 .6em; font-weight: 800; }
h3 { font-size: 1.05rem; margin: 1em 0 .45em; font-weight: 700; }
.muted { color: var(--muted); font-size: .9rem; }
.wrap { max-width: 1200px; margin-inline: auto; padding-inline: 18px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: -999px; top: 8px; background: var(--brand); color: #fff; padding: 8px 14px; border-radius: 10px; z-index: 120; text-decoration: none; font-weight: 700; }
.skip:focus { inset-inline-start: 10px; }
:focus-visible { outline: 2.5px solid var(--brand-2); outline-offset: 2px; }

/* ---- Header ---- */
.site-header {
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.header-inner { display: flex; align-items: center; gap: 10px; min-height: 62px; flex-wrap: nowrap; }
.brand {
  display: inline-flex; align-items: center; gap: 8px; font-weight: 850; font-size: 1.12rem;
  letter-spacing: -0.02em; color: var(--text); text-decoration: none; white-space: nowrap; flex-shrink: 0;
}
.brand-badge {
  font-size: .66rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 999px; background: var(--brand-soft); color: var(--brand);
}
.main-nav { display: flex; gap: 2px; flex-wrap: nowrap; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.main-nav a {
  color: var(--muted); text-decoration: none; padding: 6px 9px; border-radius: 9px; white-space: nowrap;
  font-weight: 600; font-size: .87rem; transition: background .15s, color .15s; flex-shrink: 0;
}
.main-nav a:hover, .main-nav a[aria-current="page"] { background: var(--surface-2); color: var(--text); }
.header-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; margin-inline-start: auto; }

.search-trigger {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; height: 36px; white-space: nowrap;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--muted); font: inherit; font-size: .84rem; cursor: pointer; transition: border-color .15s, color .15s;
}
.search-trigger:hover { border-color: var(--brand); color: var(--text); }
.search-trigger kbd {
  font: 700 .7rem/1 var(--font); padding: 2px 5px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
}

.lang-select, select, input[type=number], input[type=text], input[type=search] {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 10px;
}
.lang-select { height: 36px; padding-block: 4px; font-size: .85rem; cursor: pointer; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.icon-btn:hover { border-color: var(--brand); background: var(--surface-2); }

@media (max-width: 1080px) {
  .search-trigger span, .search-trigger kbd { display: none; }
}
@media (max-width: 820px) {
  .header-inner { flex-wrap: wrap; padding-block: 6px; }
  .main-nav { order: 3; flex-basis: 100%; padding-bottom: 4px; }
}

/* ---- Buttons & Badges ---- */
.privacy-badge {
  display: inline-flex; gap: 8px; align-items: center;
  background: var(--ok-soft); color: var(--ok);
  border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent);
  border-radius: 999px; padding: 6px 14px; font-weight: 650; font-size: .88rem; margin: 0 0 18px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-weight: 650; padding: 9px 16px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; text-decoration: none; min-height: 42px;
  transition: transform .12s, border-color .15s, background .15s, box-shadow .15s;
}
.btn:hover:not(:disabled) { border-color: var(--brand); background: var(--surface-2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent; color: var(--brand-ink);
  box-shadow: 0 4px 16px rgba(109, 74, 255, .28);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 6px 22px rgba(109, 74, 255, .38); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn-ghost:hover:not(:disabled) { background: var(--brand-soft); border-color: transparent; }
.btn-lg { padding: 13px 22px; font-size: 1rem; min-height: 48px; }
.btn-sm { min-height: 34px; padding: 5px 10px; font-size: .85rem; border-radius: 9px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.chip-btn {
  display: inline-flex; align-items: center; gap: 5px; font: inherit; font-size: .83rem; font-weight: 650;
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; transition: all .15s;
}
.chip-btn:hover, .chip-btn.active, .chip-btn[aria-pressed="true"] {
  background: var(--brand); color: #fff; border-color: var(--brand);
}
.fmt-pill {
  font-size: .72rem; font-weight: 750; letter-spacing: .04em; padding: 2px 8px;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}
.badge-good { color: var(--ok); font-weight: 750; background: var(--ok-soft); padding: 1px 7px; border-radius: 999px; font-size: .82rem; }
.badge-bad { color: var(--err); font-weight: 750; background: var(--err-soft); padding: 1px 7px; border-radius: 999px; font-size: .82rem; }
.new-tag {
  font-size: .66rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 6px; background: linear-gradient(135deg, #6d4aff, #06b6d4); color: #fff;
}

/* ---- Hero & Homepage ---- */
.hero { text-align: center; padding: 36px 0 18px; max-width: 820px; margin-inline: auto; }
.hero h1 span.grad {
  background: linear-gradient(135deg, var(--brand), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .lead { font-size: 1.12rem; color: var(--muted); margin: 0 auto 20px; max-width: 660px; }
.hero-cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 24px; }

.quick-drop {
  margin: 0 auto 22px; max-width: 720px; padding: 24px 20px;
  border-radius: 20px; background: var(--surface); border: 2px dashed var(--border);
  box-shadow: var(--shadow); cursor: pointer; transition: all .18s;
}
.quick-drop:hover, .quick-drop.over { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 4%, var(--surface)); transform: translateY(-1px); }
.qd-prompt { display: grid; gap: 6px; place-items: center; }
.qd-prompt strong { font-size: 1.08rem; }
.qd-prompt small { color: var(--muted); }
.qd-file-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.qd-btn-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

.trust-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px;
  margin: 10px auto 26px; padding: 14px 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.trust-item { display: flex; align-items: center; gap: 10px; font-size: .88rem; font-weight: 650; }
.trust-ic {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); flex-shrink: 0;
}

.home-controls {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between;
  margin: 8px 0 20px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
}
.home-search-wrap { position: relative; flex: 1; min-width: 220px; display: flex; align-items: center; }
.home-search-wrap .ic { position: absolute; inset-inline-start: 12px; color: var(--muted); pointer-events: none; }
.home-search-wrap input { width: 100%; padding-inline-start: 38px; background: var(--surface-2); border-color: transparent; }
.home-search-wrap input:focus { background: var(--surface); border-color: var(--brand); }
.cat-tabs { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- Tool Cards Grid ---- */
.tool-group { margin-top: 26px; }
.tool-group-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.tool-group-head h2 { margin: 0; font-size: 1.25rem; }
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); }
.card {
  display: flex; flex-direction: column; gap: 6px; padding: 16px; height: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; color: var(--text); box-shadow: var(--shadow-sm);
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: var(--shadow); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-ic {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
}
.card[data-cat="pdf"] .card-ic { background: rgba(239, 68, 68, .12); color: #ef4444; }
.card[data-cat="studio"] .card-ic { background: rgba(6, 182, 212, .13); color: #0891b2; }
.card[data-cat="compress"] .card-ic { background: var(--ok-soft); color: var(--ok); }
.card[data-cat="inspect"] .card-ic { background: var(--warn-soft); color: var(--warn); }
.card strong { font-size: .98rem; line-height: 1.3; }
.card span.desc { color: var(--muted); font-size: .85rem; line-height: 1.45; }

/* ---- Tool Container ---- */
.crumbs { font-size: .86rem; color: var(--muted); margin-top: 16px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--brand); }
.tool-layout { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 1040px) { .tool-layout:has(.ad-side) { grid-template-columns: 1fr 300px; } }
.tool {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  box-shadow: var(--shadow); padding: 20px; min-height: 320px; min-width: 0;
}
.tool-skeleton { height: 280px; border-radius: 14px; background: var(--surface-2); }

.drop {
  display: grid; place-items: center; text-align: center; gap: 8px; min-height: 220px;
  border: 2px dashed var(--border); border-radius: 16px; padding: 26px 20px;
  cursor: pointer; transition: border-color .16s, background .16s;
  background: color-mix(in srgb, var(--surface-2) 45%, transparent);
}
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop strong { font-size: 1.2rem; }
.drop small { color: var(--muted); }
.drop-icon {
  width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); margin-bottom: 2px;
}
.drop.compact { min-height: 84px; padding: 12px; }
.drop-badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 2px; }
.drop-sample { margin-top: 4px; }

.options-stack { display: grid; gap: 10px; margin: 14px 0; }
.options {
  display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center;
  padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px;
}
.options label { display: inline-flex; gap: 7px; align-items: center; font-weight: 600; font-size: .9rem; }
.options input[type=range] { width: 126px; accent-color: var(--brand); }
.options input[type=number] { width: 84px; }
.options output { min-width: 2.2ch; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--brand); }
.preset-bar { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.preset-label { font-size: .85rem; font-weight: 700; color: var(--muted); }

.adv-panel { border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); overflow: hidden; }
.adv-panel > summary {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px; cursor: pointer;
  font-weight: 700; font-size: .9rem; list-style: none;
}
.adv-panel > summary::-webkit-details-marker { display: none; }
.adv-inner { border: 0; border-top: 1px solid var(--border); border-radius: 0; margin: 0; }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg button {
  font: inherit; border: 0; background: transparent; color: var(--text);
  padding: 6px 11px; cursor: pointer; font-weight: 650; font-size: .86rem; transition: background .15s, color .15s;
}
.seg button[aria-pressed=true] { background: var(--brand); color: #fff; }

.swatch { width: 34px; height: 34px; padding: 2px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); cursor: pointer; }
.swatch-row { display: inline-flex; gap: 6px; align-items: center; }
.swatch-dot { width: 24px; height: 24px; border-radius: 999px; border: 2px solid var(--border); cursor: pointer; padding: 0; }
.swatch-dot:hover { transform: scale(1.12); border-color: var(--brand); }

.notice { padding: 11px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--text); margin: 10px 0; font-size: .92rem; }
.notice.err { background: var(--err-soft); }

.savings-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 12px 16px; margin-top: 14px; border-radius: 14px;
  background: var(--ok-soft); border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent);
  color: var(--text); font-size: .93rem;
}
.savings-banner .ic { color: var(--ok); }

/* ---- Files List ---- */
.files { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; }
.file {
  display: grid; grid-template-columns: 60px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
  transition: border-color .15s;
}
.file.dragging { opacity: .5; border-style: dashed; border-color: var(--brand); }
.file .thumb { width: 60px; height: 60px; object-fit: cover; border-radius: 10px; background: var(--checker); }
.pdf-thumb-ic { display: grid; place-items: center; background: rgba(239, 68, 68, .12) !important; color: #ef4444; }
.pdf-thumb-ic.ok { background: var(--ok-soft) !important; color: var(--ok); }
.file-info { min-width: 0; }
.file .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95rem; }
.file .meta { color: var(--muted); font-size: .85rem; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 2px; }
.file .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
@media (max-width: 640px) {
  .file { grid-template-columns: 50px 1fr; }
  .file .thumb { width: 50px; height: 50px; }
  .file .actions { grid-column: 1 / -1; justify-content: flex-start; }
}

.progress { height: 7px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 7px; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--accent)); transition: width .18s; }
.progress.indeterminate > i { width: 35%; animation: indet 1.1s infinite ease-in-out; }
@keyframes indet { from { margin-inline-start: -35%; } to { margin-inline-start: 100%; } }
.toolbar { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.status { color: var(--muted); font-size: .88rem; font-weight: 600; }

/* ---- Popover ("Send to...") ---- */
.popover-wrap { position: relative; display: inline-block; }
.popover-menu {
  position: absolute; inset-inline-end: 0; bottom: calc(100% + 6px); min-width: 190px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 13px;
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; display: grid; gap: 2px;
}
.popover-item {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px;
  border: 0; border-radius: 9px; background: transparent; color: var(--text);
  font: inherit; font-size: .88rem; font-weight: 600; text-align: start; cursor: pointer;
}
.popover-item:hover { background: var(--brand-soft); color: var(--brand); }

/* ---- Background Remover Compare ---- */
.bg-results { display: grid; gap: 16px; margin-top: 16px; }
.bg-item { border: 1px solid var(--border); border-radius: 16px; padding: 14px; background: var(--surface); }
.bg-item-bar { margin-top: 12px; justify-content: space-between; }
.compare {
  position: relative; border-radius: 12px; overflow: hidden; background: var(--checker);
  max-height: 68vh; display: grid; place-items: center; --pos: 50%; touch-action: pan-y; direction: ltr;
}
.compare canvas, .compare img { display: block; width: 100%; height: auto; max-height: 68vh; object-fit: contain; user-select: none; }
.compare .before { position: absolute; inset: 0; width: 100%; height: 100%; clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.compare .handle { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 3px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.3); pointer-events: none; }
.compare .handle::after {
  content: '↔'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 30px; height: 30px; border-radius: 999px; background: #fff; color: #111;
  display: grid; place-items: center; font-size: .8rem; font-weight: 900; box-shadow: 0 2px 10px rgba(0,0,0,.3);
}
.compare input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }
.compare .tag { position: absolute; top: 10px; padding: 3px 9px; border-radius: 8px; background: rgba(10, 12, 24, .68); backdrop-filter: blur(6px); color: #fff; font-size: .76rem; font-weight: 700; pointer-events: none; }
.compare .tag.b { left: 10px; } .compare .tag.a { right: 10px; }

/* ---- Modals & Refine Studio ---- */
.modal { position: fixed; inset: 0; z-index: 90; background: rgba(8, 10, 24, .84); backdrop-filter: blur(8px); display: grid; grid-template-rows: auto 1fr; }
.modal-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.modal-stage { overflow: auto; display: grid; place-items: center; padding: 20px; touch-action: none; }
.modal-stage canvas { max-width: 100%; max-height: calc(100vh - 120px); border-radius: 10px; box-shadow: var(--shadow-lg); transform-origin: center; }
.refine-stage canvas { cursor: none; }
.refine-stage canvas[data-bg="checker"] { background: var(--checker); }
.refine-stage canvas[data-bg="dark"] { background: #0f111a; }
.refine-stage canvas[data-bg="light"] { background: #ffffff; }
.refine-stage canvas[data-bg="mask"] { background: #1a1a24; }
.brush-cursor {
  position: fixed; top: 0; left: 0; z-index: 100; border-radius: 999px;
  border: 2px solid #fff; box-shadow: 0 0 0 1.5px rgba(0,0,0,.65); pointer-events: none;
}
.compare-modal-box { max-width: 90vw; max-height: calc(100vh - 110px); transform-origin: center; }

/* ---- Pro Image Studio Editor ---- */
.studio-topbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.studio-body { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .studio-body { grid-template-columns: 1fr 330px; align-items: start; } }
.studio-stage {
  background: var(--checker); border: 1px solid var(--border); border-radius: 16px;
  min-height: 360px; max-height: 70vh; display: grid; place-items: center; padding: 12px; overflow: hidden;
}
.studio-stage-inner { position: relative; display: inline-grid; place-items: center; max-width: 100%; max-height: calc(70vh - 24px); }
.studio-canvas, .studio-overlay { display: block; max-width: 100%; max-height: calc(70vh - 24px); width: auto; height: auto; border-radius: 6px; }
.studio-overlay { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.studio-sidebar { display: grid; gap: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px; padding: 14px; }
.studio-tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; background: var(--surface); padding: 4px; border-radius: 12px; border: 1px solid var(--border); }
.studio-tab {
  display: grid; place-items: center; gap: 3px; padding: 7px 4px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted); font: inherit; font-size: .72rem; font-weight: 700; cursor: pointer;
}
.studio-tab[aria-selected="true"] { background: var(--brand); color: #fff; }
.studio-panel { display: grid; gap: 12px; }
.panel-group { display: grid; gap: 8px; }
.panel-title { font-size: .82rem; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.chip-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.slider-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; font-size: .88rem; font-weight: 650; }
.slider-row input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--brand); }
.slider-row output { color: var(--brand); font-variant-numeric: tabular-nums; }
.stack-field { display: grid; gap: 5px; font-size: .88rem; font-weight: 650; }
.filter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.filter-card {
  display: grid; gap: 6px; place-items: center; padding: 8px 6px; border-radius: 11px;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .78rem; font-weight: 650; cursor: pointer;
}
.filter-card.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.filter-dot { width: 100%; height: 34px; border-radius: 7px; background: linear-gradient(135deg, #f97316, #ec4899 50%, #3b82f6); }
.studio-export { display: grid; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border); }

/* ---- PDF Visual Page Grid ---- */
.page-toolbar { margin: 14px 0 6px; }
.pdf-page-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; margin-top: 10px;
}
.pdf-page-card {
  border: 2px solid var(--border); border-radius: 12px; background: var(--surface-2); padding: 8px;
  display: grid; gap: 6px; cursor: grab; transition: border-color .15s, transform .15s;
}
.pdf-page-card.selected { border-color: var(--brand); background: var(--brand-soft); }
.pdf-page-card.dragging { opacity: .45; }
.pdf-page-thumb { aspect-ratio: 3/4; background: #fff; border-radius: 8px; overflow: hidden; display: grid; place-items: center; }
.pdf-page-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform .2s; }
.pdf-page-foot { display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.pdf-page-num { font-size: .78rem; font-weight: 750; color: var(--muted); }
.icon-mini { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--text); display: inline-grid; place-items: center; cursor: pointer; }
.icon-mini:hover { border-color: var(--brand); color: var(--brand); }

/* ---- EXIF & Color Palette Inspector ---- */
.inspect-results { display: grid; gap: 16px; margin-top: 16px; }
.inspect-card { border: 1px solid var(--border); border-radius: 16px; padding: 16px; background: var(--surface); display: grid; gap: 14px; }
.inspect-head { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.inspect-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; background: var(--checker); }
.inspect-head-info { flex: 1; min-width: 200px; display: grid; gap: 4px; }
.privacy-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .82rem; font-weight: 700; width: fit-content; }
.privacy-pill.safe { background: var(--ok-soft); color: var(--ok); }
.privacy-pill.warn { background: var(--warn-soft); color: var(--warn); }
.privacy-pill.danger { background: var(--err-soft); color: var(--err); }
.gps-box {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-radius: 12px; background: var(--err-soft); border: 1px solid color-mix(in srgb, var(--err) 35%, transparent);
}
.meta-group h3 { margin: 0 0 8px; font-size: .88rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.meta-grid { display: grid; grid-template-columns: minmax(130px, 210px) 1fr; gap: 6px 14px; margin: 0; padding: 12px; border-radius: 12px; background: var(--surface-2); font-size: .9rem; }
.meta-grid dt { font-weight: 650; color: var(--muted); }
.meta-grid dd { margin: 0; word-break: break-word; font-weight: 550; }
@media (max-width: 560px) { .meta-grid { grid-template-columns: 1fr; gap: 2px; } .meta-grid dd { margin-bottom: 8px; } }

.palette-stage { margin-top: 16px; display: grid; gap: 14px; }
.palette-preview { max-height: 280px; width: auto; border-radius: 14px; margin-inline: auto; display: block; box-shadow: var(--shadow-sm); }
.palette-bar { display: flex; height: 42px; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-sm); cursor: pointer; }
.swatch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.swatch-card { border: 1px solid var(--border); border-radius: 13px; overflow: hidden; background: var(--surface); }
.swatch-color { width: 100%; border: 0; padding: 20px 12px; display: grid; gap: 4px; text-align: start; cursor: pointer; font: inherit; }
.swatch-color strong { font-size: 1.05rem; letter-spacing: .02em; }
.swatch-color span { font-size: .76rem; opacity: .88; font-weight: 650; }
.swatch-meta { padding: 8px; display: grid; gap: 4px; }
.code-copy {
  border: 0; background: var(--surface-2); color: var(--text); font: 600 .78rem/1.4 ui-monospace, monospace;
  padding: 5px 8px; border-radius: 7px; text-align: start; cursor: pointer;
}
.code-copy:hover { background: var(--brand-soft); color: var(--brand); }

/* ---- Command Palette & Cache Modal ---- */
.cmd-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(9, 11, 24, .62); backdrop-filter: blur(6px);
  display: grid; place-items: start center; padding: 10vh 16px 16px;
}
.cmd-box {
  width: min(620px, 100%); background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden;
}
.cmd-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.cmd-input { flex: 1; border: 0 !important; background: transparent !important; font-size: 1.02rem; outline: none; padding: 4px 0 !important; }
.cmd-head kbd { font-size: .72rem; padding: 3px 7px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.cmd-list { list-style: none; margin: 0; padding: 8px; max-height: 55vh; overflow: auto; display: grid; gap: 3px; }
.cmd-item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center;
  padding: 10px 12px; border-radius: 11px; text-decoration: none; color: var(--text);
}
.cmd-item:hover, .cmd-item.active { background: var(--brand-soft); }
.cmd-item strong { display: block; font-size: .94rem; }
.cmd-item small { color: var(--muted); font-size: .82rem; }
.cmd-cat { font-size: .72rem; font-weight: 750; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.cmd-empty { padding: 24px; text-align: center; color: var(--muted); }

.cache-body { padding: 16px; }
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-card { padding: 12px; border-radius: 12px; background: var(--surface-2); text-align: center; display: grid; gap: 2px; }
.stat-val { font-size: 1.25rem; font-weight: 850; color: var(--brand); }
.stat-lbl { font-size: .76rem; color: var(--muted); font-weight: 650; }
.cache-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.cache-list li { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); font-size: .88rem; }

/* ---- Ads (CLS-safe) ---- */
.ad { display: block; margin: 16px auto; text-align: center; }
.ad-label { display: block; font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }
.ad-top { max-width: 970px; min-height: 120px; padding-inline: 16px; }
.ad-side { min-height: 280px; margin: 0; }
.ad-content { min-height: 280px; }
.ad-processing { min-height: 120px; }

/* ---- Content, FAQ, Related & Footer ---- */
.content {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 16px 26px 26px; margin-top: 26px; box-shadow: var(--shadow-sm);
}
.content .lead { font-size: 1.08rem; color: var(--muted); }
.content li { margin: 5px 0; }
.faq details { border-bottom: 1px solid var(--border); padding: 12px 0; }
.faq details:last-child { border-bottom: 0; }
.faq summary { font-weight: 700; cursor: pointer; }
.related { margin: 28px 0; }
.chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips a {
  display: inline-block; padding: 7px 13px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); text-decoration: none; font-weight: 600; font-size: .88rem;
  transition: border-color .15s, color .15s;
}
.chips a:hover { border-color: var(--brand); color: var(--brand); }
.prose { max-width: 780px; padding-block: 16px 44px; }

.site-footer { margin-top: 48px; background: var(--surface); border-top: 1px solid var(--border); padding: 32px 0 26px; font-size: .88rem; }
.footer-grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.footer-grid h3 { font-size: .95rem; margin: 0 0 8px; color: var(--text); }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.footer-grid a, .footer-links a { color: var(--muted); text-decoration: none; }
.footer-grid a:hover, .footer-links a:hover { color: var(--brand); }
.footer-bottom { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 10px 20px; justify-content: space-between; align-items: center; }
.footer-note, .copy { color: var(--muted); margin: 4px 0; }

/* ---- Toasts ---- */
.toasts { position: fixed; bottom: 24px; inset-inline-end: 18px; display: grid; gap: 8px; z-index: 120; }
.toast {
  display: inline-flex; align-items: center; gap: 8px; background: var(--text); color: var(--bg);
  padding: 10px 15px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 650;
  font-size: .9rem; max-width: 340px; animation: tin .2s ease-out; transition: opacity .2s, transform .2s;
}
.toast.err { background: var(--err); color: #fff; }
.toast.out { opacity: 0; transform: translateY(6px); }
@keyframes tin { from { transform: translateY(10px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
