/* =========================================================================
   BISCS Tools — design system
   ========================================================================= */
:root {
  --bg: #f6f7fb;
  --bg-2: #eef0f7;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --glass: rgba(255, 255, 255, 0.72);
  --border: #e3e6ef;
  --border-strong: #cfd4e2;
  --text: #0f1424;
  --text-2: #4a5268;
  --text-3: #5f6780;
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --brand-ink: #ffffff;
  --brand-soft: #eef0ff;
  --ok: #08786c;
  --ok-soft: #e6f7f4;
  --warn: #b45309;
  --warn-soft: #fff6e6;
  --danger: #c62a2f;
  --danger-ink: #ffffff;
  --danger-soft: #feeceb;
  --ring: 0 0 0 3px rgba(79, 70, 229, 0.28);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow: 0 6px 24px -8px rgba(16, 24, 40, 0.14), 0 2px 6px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 24px 60px -20px rgba(30, 27, 75, 0.35);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --hero-1: #1e1b4b;
  --hero-2: #312e81;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0d16; --bg-2: #10131f; --surface: #141826; --surface-2: #1a1f30;
    --glass: rgba(20, 24, 38, 0.72); --border: #262c40; --border-strong: #353d57;
    --text: #eef0f8; --text-2: #b4bbd0; --text-3: #949cb5;
    --brand: #818cf8; --brand-2: #a78bfa; --brand-ink: #0b0d16; --brand-soft: #1e2140;
    --ok: #2dd4bf; --warn: #fbbf24; --danger: #ff7b7f; --danger-ink: #0b0d16;
    --ok-soft: #0f2a27; --warn-soft: #2d2410; --danger-soft: #331a1b;
    --shadow: 0 6px 24px -8px rgba(0, 0, 0, 0.6); --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.8);
    --hero-1: #07081a; --hero-2: #1a1747;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0d16; --bg-2: #10131f; --surface: #141826; --surface-2: #1a1f30;
  --glass: rgba(20, 24, 38, 0.72); --border: #262c40; --border-strong: #353d57;
  --text: #eef0f8; --text-2: #b4bbd0; --text-3: #949cb5;
  --brand: #818cf8; --brand-2: #a78bfa; --brand-ink: #0b0d16; --brand-soft: #1e2140;
  --ok: #2dd4bf; --warn: #fbbf24; --danger: #ff7b7f; --danger-ink: #0b0d16;
    --ok-soft: #0f2a27; --warn-soft: #2d2410; --danger-soft: #331a1b;
  --shadow: 0 6px 24px -8px rgba(0, 0, 0, 0.6); --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.8);
  --hero-1: #07081a; --hero-2: #1a1747;
  color-scheme: dark;
}

/* Cross-page view transitions (progressive enhancement) */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.28s; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img, canvas, svg { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.02em; }
h1 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); font-weight: 800; }
h2 { font-size: 1.35rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0 0 1em; }
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .container { padding: 0 24px; } }
.muted { color: var(--text-3); }
.small { font-size: 0.85em; }
.hidden { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }

/* ---------------------------------------------------------------- Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--glass); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--border);
}
.site-header .bar { display: flex; align-items: center; gap: 16px; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; color: var(--text); letter-spacing: -0.02em; }
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2) 60%, #ec4899);
  box-shadow: 0 6px 16px -6px rgba(79, 70, 229, 0.7), inset 0 1px 0 rgba(255,255,255,.35);
  transform: perspective(200px) rotateX(10deg) rotateY(-12deg);
}
.logo-mark svg { width: 19px; height: 19px; }
.logo span em { font-style: normal; background: linear-gradient(90deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav { display: none; gap: 4px; margin-left: 12px; }
.nav a { color: var(--text-2); font-weight: 550; font-size: 0.92rem; padding: 8px 12px; border-radius: 9px; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
@media (min-width: 980px) { .nav { display: flex; } }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); display: inline-grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.search-trigger {
  display: none; align-items: center; gap: 8px; height: 40px; padding: 0 12px; min-width: 220px;
  border: 1px solid var(--border); background: var(--surface); border-radius: 10px; color: var(--text-3); cursor: pointer; font: inherit;
}
.search-trigger kbd { margin-left: auto; font-family: var(--mono); font-size: 0.72rem; border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; }
@media (min-width: 720px) { .search-trigger { display: inline-flex; } .search-trigger-mobile { display: none; } }
.menu-btn { display: inline-grid; }
@media (min-width: 980px) { .menu-btn { display: none; } }
.mobile-nav { display: none; border-top: 1px solid var(--border); padding: 8px 0 14px; }
.mobile-nav.open { display: block; }
.mobile-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 4px; color: var(--text); font-weight: 550; }

/* ------------------------------------------------------------------ Hero */
.hero {
  position: relative; overflow: hidden; color: #fff; isolation: isolate;
  background: radial-gradient(1200px 500px at 70% -10%, #4338ca 0%, transparent 60%),
              radial-gradient(900px 500px at 0% 110%, #7c3aed55 0%, transparent 60%),
              linear-gradient(160deg, var(--hero-1), var(--hero-2));
}
.hero canvas.hero-3d { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
/* CSS-3D fallback tiles, hidden once the WebGL scene is running */
.hero-tiles { position: absolute; inset: 0; z-index: -1; perspective: 900px; pointer-events: none; transition: opacity .6s; }
.hero.webgl .hero-tiles { opacity: 0; }
.ht {
  position: absolute; width: 92px; height: 92px; border-radius: 24px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(140deg, color-mix(in srgb, var(--c) 70%, #fff), var(--c) 55%, color-mix(in srgb, var(--c) 70%, #000));
  box-shadow: 0 30px 50px -18px rgba(0,0,0,.6), inset 0 2px 0 rgba(255,255,255,.4), inset 0 -4px 0 rgba(0,0,0,.18);
  transform-style: preserve-3d; animation: htFloat 7s ease-in-out infinite;
}
.ht svg { width: 40px; height: 40px; }
.ht0 { left: 58%; top: 16%; --r: -16deg; animation-delay: -1s; }
.ht1 { left: 70%; top: 10%; --r: 12deg; animation-delay: -2.5s; }
.ht2 { left: 64%; top: 46%; --r: -8deg; animation-delay: -4s; }
.ht3 { left: 77%; top: 38%; --r: 16deg; animation-delay: -3s; }
.ht4 { left: 56%; top: 70%; --r: 10deg; animation-delay: -5s; }
.ht5 { left: 72%; top: 70%; --r: -14deg; animation-delay: -1.5s; }
.ht6 { left: 86%; top: 18%; --r: 8deg; animation-delay: -6s; width: 72px; height: 72px; }
@keyframes htFloat {
  0%, 100% { transform: rotateX(18deg) rotateY(var(--r)) translateY(0); }
  50% { transform: rotateX(4deg) rotateY(calc(var(--r) * -0.6)) translateY(-14px); }
}
@media (max-width: 759px) {
  .ht { width: 64px; height: 64px; border-radius: 18px; }
  .ht svg { width: 28px; height: 28px; }
  .ht0 { left: 8%; top: auto; bottom: 120px; } .ht1 { left: 30%; top: auto; bottom: 150px; } .ht2 { left: 52%; top: auto; bottom: 115px; }
  .ht3 { left: 74%; top: auto; bottom: 145px; } .ht4 { left: 18%; top: auto; bottom: 30px; } .ht5 { left: 42%; top: auto; bottom: 40px; }
  .ht6 { left: 66%; top: auto; bottom: 36px; width: 56px; height: 56px; }
}
@media (min-width: 760px) and (max-width: 1099px) { .ht { width: 72px; height: 72px; } .ht svg { width: 32px; height: 32px; } }
.hero::after { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(90deg, rgba(10,10,35,.75) 0%, rgba(10,10,35,.35) 55%, transparent 100%); }
.hero .container { padding-top: 72px; padding-bottom: 84px; }
@media (max-width: 759px) { .hero .container { padding-top: 44px; padding-bottom: 250px; } .hero::after { background: linear-gradient(180deg, rgba(10,10,35,.55) 0%, rgba(10,10,35,.2) 60%, transparent 100%); } }
.hero h1 { font-size: clamp(2.1rem, 5.5vw, 3.6rem); max-width: 15ch; margin-bottom: 18px; }
.hero h1 .grad { background: linear-gradient(90deg, #a5b4fc, #f0abfc 50%, #fda4af); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 1.12rem; color: #c7cbea; max-width: 52ch; }
.hero-search {
  margin-top: 26px; display: flex; align-items: center; gap: 10px; max-width: 560px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.22); border-radius: 16px; padding: 6px 6px 6px 16px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 20px 50px -20px rgba(0,0,0,.6);
}
.hero-search input[type="search"] { flex: 1; min-width: 0; min-height: 0; background: transparent; border: 0; box-shadow: none; color: #fff; font: inherit; font-size: 1.02rem; padding: 10px 0; outline: none; }
.hero-search input::placeholder { color: #aeb3d6; }
.hero-search .btn { border-radius: 11px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 10px 24px; margin-top: 26px; color: #c7cbea; font-size: 0.92rem; }
.hero-stats span { display: inline-flex; align-items: center; gap: 7px; }
.hero-stats .icon { color: #a5b4fc; }

/* ------------------------------------------------------------ Chips/tabs */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: inherit; font-size: 0.9rem; font-weight: 550;
  transition: all .15s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); text-decoration: none; }
.chip.active, .chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.cat-bar { position: sticky; top: 64px; z-index: 20; background: var(--bg); padding: 14px 0; border-bottom: 1px solid transparent; }

/* ------------------------------------------------------------ Tool cards */
.section { padding: 44px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-head p { margin: 0; color: var(--text-3); }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.tool-card {
  --c: var(--brand);
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 20px; min-height: 160px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text);
  box-shadow: var(--shadow-sm); transform-style: preserve-3d;
  transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s, border-color .25s;
  will-change: transform;
}
.tool-card:hover { text-decoration: none; border-color: color-mix(in srgb, var(--c) 45%, var(--border)); box-shadow: var(--shadow-lg); }
.tool-card::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .25s;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--c) 14%, transparent), transparent 45%);
}
.tool-card:hover::before { opacity: 1; }
.tool-card h3 { margin: 4px 0 0; font-size: 1rem; transform: translateZ(18px); }
.tool-card p { margin: 0; color: var(--text-3); font-size: 0.88rem; line-height: 1.45; transform: translateZ(10px); }
.tool-icon {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(140deg, color-mix(in srgb, var(--c) 78%, #fff), var(--c) 55%, color-mix(in srgb, var(--c) 75%, #000));
  box-shadow: 0 10px 20px -10px var(--c), inset 0 1px 0 rgba(255,255,255,.35), inset 0 -2px 0 rgba(0,0,0,.12);
  transform: translateZ(30px);
}
.tool-icon svg { width: 23px; height: 23px; }
.tool-card .badge-new { position: absolute; top: 14px; right: 14px; }
.tool-card .go { position: absolute; right: 16px; bottom: 16px; color: var(--c); opacity: 0; transform: translateX(-6px); transition: all .2s; }
.tool-card:hover .go { opacity: 1; transform: none; }
.tool-card.featured { grid-column: span 1; }
@media (min-width: 720px) { .tool-card.wide { grid-column: span 2; } }
.empty-state { padding: 40px; text-align: center; color: var(--text-3); border: 1px dashed var(--border-strong); border-radius: var(--radius); }

/* Category cards (home) */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.cat-card {
  --c: var(--brand); position: relative; overflow: hidden; padding: 22px; border-radius: var(--radius-lg); color: #fff;
  background: linear-gradient(145deg, color-mix(in srgb, var(--c) 85%, #fff 0%), color-mix(in srgb, var(--c) 70%, #000));
  box-shadow: 0 18px 40px -22px var(--c); transform-style: preserve-3d; transition: transform .25s cubic-bezier(.2,.8,.2,1);
}
.cat-card:hover { text-decoration: none; }
.cat-card h3 { font-size: 1.15rem; margin: 14px 0 6px; transform: translateZ(24px); }
.cat-card p { color: rgba(255,255,255,.85); font-size: 0.9rem; margin: 0; transform: translateZ(14px); }
.cat-card .count { position: absolute; top: 18px; right: 18px; font-size: 0.8rem; font-weight: 700; background: rgba(255,255,255,.2); padding: 3px 10px; border-radius: 999px; }
.cat-card .big-icon { position: absolute; right: -18px; bottom: -22px; width: 120px; height: 120px; opacity: .16; transform: rotate(-14deg) translateZ(-10px); }
.cat-card .ci { width: 44px; height: 44px; border-radius: 12px; background: rgba(255,255,255,.2); display: grid; place-items: center; transform: translateZ(34px); box-shadow: inset 0 1px 0 rgba(255,255,255,.35); }

/* Feature strip */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.feature { padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.feature .fi { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); margin-bottom: 12px; }
.feature h3 { margin-bottom: 4px; }
.feature p { margin: 0; color: var(--text-3); font-size: 0.9rem; }

/* PDF suite banner */
.pdf-banner {
  position: relative; overflow: hidden; border-radius: var(--radius-lg); padding: 32px; color: #fff;
  background: radial-gradient(600px 300px at 90% 0%, #ff8a8a55, transparent 60%), linear-gradient(135deg, #b91c1c, #e5484d 55%, #f97316);
  display: grid; gap: 22px; grid-template-columns: 1fr;
}
@media (min-width: 860px) { .pdf-banner { grid-template-columns: 1.1fr 1fr; align-items: center; padding: 40px; } }
.pdf-banner h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
.pdf-banner p { color: #ffe4e4; }
.pdf-banner .btn { background: #fff; color: #b91c1c; }
.pdf-banner .btn.btn-ghost { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.4); }
.pdf-banner .btn.btn-ghost:hover { background: rgba(255,255,255,.24); }
.pdf-stack { position: relative; height: 210px; perspective: 900px; }
.pdf-sheet {
  position: absolute; left: 50%; top: 50%; width: 130px; height: 170px; margin: -85px 0 0 -65px; border-radius: 10px; background: #fff;
  box-shadow: 0 30px 50px -20px rgba(0,0,0,.45); transform-style: preserve-3d; animation: sheet 7s ease-in-out infinite;
  padding: 16px 14px; display: flex; flex-direction: column; gap: 7px;
}
.pdf-sheet i { display: block; height: 7px; border-radius: 4px; background: #e9e9ef; }
.pdf-sheet i:nth-child(1) { width: 60%; background: #e5484d; height: 9px; }
.pdf-sheet i:nth-child(3) { width: 80%; } .pdf-sheet i:nth-child(5) { width: 70%; }
.pdf-sheet:nth-child(1) { --r: -18deg; --x: -95px; animation-delay: -1s; }
.pdf-sheet:nth-child(2) { --r: 0deg; --x: 0px; z-index: 2; animation-delay: -3s; }
.pdf-sheet:nth-child(3) { --r: 18deg; --x: 95px; animation-delay: -5s; }
@keyframes sheet {
  0%, 100% { transform: translateX(var(--x)) rotateY(var(--r)) rotateX(8deg) translateY(0); }
  50% { transform: translateX(var(--x)) rotateY(calc(var(--r) * -0.6)) rotateX(-4deg) translateY(-12px); }
}

/* ------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px;
  border-radius: 11px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 0.93rem; cursor: pointer;
  background: var(--surface); color: var(--text); border-color: var(--border); transition: transform .08s, background .15s, box-shadow .15s;
  white-space: nowrap; text-decoration: none !important;
}
.btn:hover { border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-color: transparent; box-shadow: 0 8px 20px -10px var(--brand); }
:root[data-theme="dark"] .btn-primary { color: #0b0d16; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { color: #0b0d16; } }
.btn-primary:hover { filter: brightness(1.06); }
.btn-danger { background: var(--danger); color: var(--danger-ink); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-lg { height: 52px; padding: 0 26px; font-size: 1rem; border-radius: 13px; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 0.85rem; border-radius: 9px; }
.btn-block { width: 100%; }
.btn-group { display: flex; flex-wrap: wrap; gap: 8px; }
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); flex-wrap: wrap; }
.seg button { font: inherit; font-size: 0.88rem; font-weight: 600; border: 0; background: transparent; color: var(--text-2); padding: 7px 14px; border-radius: 8px; cursor: pointer; }
.seg button.active, .seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* --------------------------------------------------------------- Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field > label, .label { font-size: 0.85rem; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 0.8rem; color: var(--text-3); }
input[type="text"], input[type="number"], input[type="email"], input[type="url"], input[type="tel"], input[type="date"],
input[type="time"], input[type="datetime-local"], input[type="password"], input[type="search"], select, textarea, .input {
  width: 100%; font: inherit; font-size: 0.95rem; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px 12px; min-height: 42px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 160px; resize: vertical; line-height: 1.5; }
textarea.mono, .mono { font-family: var(--mono); font-size: 0.86rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
input[type="range"] { width: 100%; accent-color: var(--brand); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); width: 17px; height: 17px; }
input[type="color"] { width: 48px; height: 42px; padding: 3px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); cursor: pointer; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.92rem; cursor: pointer; user-select: none; }
.input-group { display: flex; align-items: stretch; }
.input-group > :not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
.input-group > :not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .addon { display: grid; place-items: center; padding: 0 12px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--text-3); font-weight: 600; font-size: 0.9rem; }
.row { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .row.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .row.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.split { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .split.wide-left { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }

/* --------------------------------------------------------- Panels/results */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 16px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-title h3 { margin: 0; }
.result {
  position: relative; border-radius: var(--radius); padding: 22px; color: #fff; overflow: hidden;
  background: radial-gradient(400px 200px at 100% 0%, rgba(255,255,255,.18), transparent 60%), linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 18px 40px -22px var(--brand);
}
:root[data-theme="dark"] .result { color: #0b0d16; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .result { color: #0b0d16; } }
.result .label { color: inherit; opacity: .8; }
.result .value { font-size: clamp(1.7rem, 4vw, 2.4rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; margin-top: 4px; word-break: break-word; }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); min-width: 0; }
.stat .label { font-size: 0.78rem; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.stat .value { font-size: 1.25rem; font-weight: 750; margin-top: 2px; word-break: break-word; font-variant-numeric: tabular-nums; }
.output { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; font-family: var(--mono); font-size: 0.86rem; white-space: pre-wrap; word-break: break-word; min-height: 60px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--text-2); font-size: 0.9rem; }
.notice.warn { background: var(--warn-soft); } .notice.error { background: var(--danger-soft); color: var(--danger); } .notice.ok { background: var(--ok-soft); }
.notice .icon { margin-top: 2px; color: var(--brand); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; background: var(--brand-soft); color: var(--brand); }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.warn { background: var(--warn-soft); color: var(--warn); } .badge.danger { background: var(--danger-soft); color: var(--danger); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.table th, .table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { background: var(--surface-2); font-weight: 650; color: var(--text-2); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; position: sticky; top: 0; }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; }
.bar-chart { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--surface-2); }
.bar-chart span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 0.85rem; color: var(--text-2); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.toolbar .spacer { flex: 1; }
.preview-box { display: grid; place-items: center; background: repeating-conic-gradient(var(--surface-2) 0% 25%, var(--surface) 0% 50%) 50% / 20px 20px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; min-height: 200px; overflow: hidden; }
.preview-box img, .preview-box canvas { max-height: 480px; object-fit: contain; }

/* -------------------------------------------------------------- Dropzone */
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center;
  padding: 44px 20px; border-radius: var(--radius-lg); border: 2px dashed var(--border-strong); background: var(--surface);
  cursor: pointer; transition: all .2s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.dropzone .dz-icon { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--c, var(--brand)), color-mix(in srgb, var(--c, var(--brand)) 65%, #000)); box-shadow: 0 14px 30px -14px var(--c, var(--brand)); transform: perspective(300px) rotateX(12deg); }
.dropzone .dz-icon svg { width: 30px; height: 30px; }
.dropzone strong { font-size: 1.05rem; }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dropzone.compact { padding: 18px; flex-direction: row; border-radius: var(--radius); }
.dropzone.compact .dz-icon { width: 40px; height: 40px; border-radius: 12px; }
.dropzone.compact .dz-icon svg { width: 20px; height: 20px; }
.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.file-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.file-item .meta { color: var(--text-3); font-size: 0.82rem; }
.file-item.dragging { opacity: .5; }

/* Page thumbnails (PDF tools) */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; }
.thumb {
  position: relative; border: 2px solid var(--border); border-radius: 12px; background: var(--surface); padding: 8px; cursor: pointer;
  transition: border-color .15s, transform .15s, box-shadow .15s; user-select: none;
}
.thumb:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.thumb canvas, .thumb img { display: block; width: 100%; height: auto; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.15); background: #fff; transition: transform .2s; }
.thumb .pg { text-align: center; font-size: 0.8rem; color: var(--text-3); margin-top: 6px; font-weight: 600; }
.thumb.selected { border-color: var(--brand); background: var(--brand-soft); }
.thumb.removed { opacity: .35; }
.thumb.removed::after { content: ''; position: absolute; inset: 8px 8px 28px; background: linear-gradient(to top right, transparent calc(50% - 2px), var(--danger) calc(50% - 1px), var(--danger) calc(50% + 1px), transparent calc(50% + 2px)); }
.thumb .thumb-actions { position: absolute; top: 12px; right: 12px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.thumb:hover .thumb-actions, .thumb:focus-within .thumb-actions { opacity: 1; }
.thumb .thumb-actions button { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow-sm); }
.thumb .check-badge { position: absolute; top: 12px; left: 12px; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; display: none; place-items: center; }
.thumb.selected .check-badge { display: grid; }
.thumb.drop-before { box-shadow: -4px 0 0 0 var(--brand); }
.thumb.drop-after { box-shadow: 4px 0 0 0 var(--brand); }

/* Progress */
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.progress > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .2s; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ Tool page */
.tool-hero { padding: 28px 0 10px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--text-3); margin-bottom: 14px; }
.crumbs a { color: var(--text-3); } .crumbs a:hover { color: var(--brand); }
.crumbs .icon { width: 14px; height: 14px; }
.tool-title { display: flex; align-items: center; gap: 16px; }
.tool-title .tool-icon { width: 56px; height: 56px; border-radius: 16px; transform: perspective(300px) rotateX(10deg) rotateY(-10deg); }
.tool-title .tool-icon svg { width: 28px; height: 28px; }
.tool-title h1 { margin: 0; }
.tool-title p { margin: 4px 0 0; color: var(--text-2); }
.privacy-pill { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; font-size: 0.82rem; font-weight: 600; color: var(--ok); background: var(--ok-soft); padding: 5px 11px; border-radius: 999px; }
.tool-layout { display: grid; gap: 24px; grid-template-columns: 1fr; padding: 18px 0 40px; }
@media (min-width: 1100px) { .tool-layout.has-aside { grid-template-columns: minmax(0, 1fr) 280px; } }
.tool-layout > * { min-width: 0; }
#tool-root { min-width: 0; min-height: 380px; }
#tool-root .loading { display: flex; align-items: center; gap: 10px; color: var(--text-3); padding: 40px 0; }
.tool-aside { display: flex; flex-direction: column; gap: 16px; }
.tool-aside .card h3 { font-size: 0.95rem; }
.mini-list { display: flex; flex-direction: column; gap: 2px; }
.mini-list a { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 9px; color: var(--text); font-size: 0.9rem; font-weight: 550; }
.mini-list a:hover { background: var(--surface-2); text-decoration: none; }
.mini-list .mi { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; flex: none; }
.mini-list .mi svg { width: 16px; height: 16px; }
.promo { background: linear-gradient(145deg, #1e1b4b, #4338ca); color: #fff; border: 0; }
.promo p { color: #c7cbea; font-size: 0.88rem; }
.promo .btn { background: #fff; color: #312e81; border: 0; }
.howto { padding: 8px 0 48px; }
.howto ol { padding-left: 20px; color: var(--text-2); }
.howto li { margin-bottom: 6px; }
.faq details { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px; background: var(--surface); margin-bottom: 8px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 10px 0 0; color: var(--text-2); }
.ad-slot:empty { display: none; }

/* ---------------------------------------------------------- Search modal */
.search-modal { position: fixed; inset: 0; z-index: 100; display: none; background: rgba(8, 10, 25, 0.55); backdrop-filter: blur(4px); padding: 10vh 16px 16px; }
.search-modal.open { display: block; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.search-panel { max-width: 640px; margin: 0 auto; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .2s cubic-bezier(.2,.8,.2,1); }
@keyframes pop { from { transform: translateY(-8px) scale(.98); opacity: 0; } }
.search-panel .sp-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.search-panel .sp-input input { border: 0; box-shadow: none; padding: 16px 0; font-size: 1.05rem; background: transparent; }
.search-results { max-height: 60vh; overflow-y: auto; padding: 8px; }
.search-results a { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; color: var(--text); }
.search-results a:hover, .search-results a.active { background: var(--brand-soft); text-decoration: none; }
.search-results .mi { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex: none; }
.search-results .mi svg { width: 18px; height: 18px; }
.search-results .t { font-weight: 600; } .search-results .d { font-size: 0.82rem; color: var(--text-3); }

/* ---------------------------------------------------------------- Toast */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 550; font-size: 0.9rem; box-shadow: var(--shadow-lg); animation: toast .25s cubic-bezier(.2,.8,.2,1); }
.toast.error { background: var(--danger); color: var(--danger-ink); }
@keyframes toast { from { transform: translateY(12px); opacity: 0; } }

/* --------------------------------------------------------------- Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 44px 0 28px; margin-top: 40px; font-size: 0.9rem; }
.footer-grid { display: grid; gap: 28px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 860px) { .footer-grid { grid-template-columns: 1.6fr repeat(4, 1fr); } }
.footer-grid h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); margin-bottom: 12px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.footer-grid a { color: var(--text-2); }
.footer-brand p { color: var(--text-3); max-width: 36ch; margin-top: 12px; }
.footer-contact { font-style: normal; display: flex; flex-direction: column; gap: 6px; margin-top: 4px; color: var(--text-2); }
.footer-contact a, .footer-contact span { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); }
.contact-card p { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 8px; }
.contact-card p .icon { margin-top: 3px; }
.contact-card p:last-child { margin-bottom: 0; }
.contact-card .icon { color: var(--brand); }
.prose.wide { max-width: 1040px; }
.contact-layout { display: grid; gap: 20px; grid-template-columns: 1fr; align-items: start; margin-top: 8px; }
@media (min-width: 900px) { .contact-layout { grid-template-columns: minmax(0, 1fr) 300px; } }
.contact-side { display: flex; flex-direction: column; gap: 16px; }
.contact-side .card + .card { margin-top: 0; }
.cf-title, .prose .cf-title { font-size: 1.1rem; margin: 0 0 14px; }
.contact-form .req { color: var(--danger); }
.contact-form .check { display: flex; flex-wrap: wrap; align-items: flex-start; margin: 4px 0 14px; color: var(--text-2); font-size: 0.9rem; }
.contact-form .check > span { flex: 1; min-width: 0; }
.contact-form .check .err { flex-basis: 100%; padding-left: 25px; }
.contact-form .check input { margin-top: 2px; flex: none; }
.contact-form .field.invalid input, .contact-form .field.invalid textarea, .contact-form .check.invalid input { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 20%, transparent); }
.contact-form .err { color: var(--danger); font-size: 0.82rem; font-weight: 600; }
.cf-status:empty { display: none; }
.cf-status { margin-bottom: 14px; }
.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.contact-thanks { display: flex; gap: 16px; align-items: flex-start; }
.contact-thanks .tool-icon { flex: none; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; border-top: 1px solid var(--border); margin-top: 32px; padding-top: 20px; color: var(--text-3); font-size: 0.85rem; }
.footer-brand { grid-column: 1 / -1; }
@media (min-width: 860px) { .footer-brand { grid-column: auto; } }

/* Prose pages */
.prose { max-width: 760px; padding: 36px 0 60px; }
.prose h2 { margin-top: 1.6em; }
.prose p, .prose li { color: var(--text-2); }
.prose a, .faq a, .notice a { text-decoration: underline; text-underline-offset: 2px; }

/* Reveal-on-scroll */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s cubic-bezier(.2,.8,.2,1); }
.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .js .reveal { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------- Print */
@media print {
  .site-header, .site-footer, .tool-aside, .howto, .crumbs, .privacy-pill, .no-print, .toasts, .tool-hero { display: none !important; }
  body { background: #fff; color: #000; }
  .tool-layout { padding: 0; display: block; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .print-only { display: block !important; }
}
.print-only { display: none; }
