/* =========================================================
   ilovetoolbench — stylesheet
   ========================================================= */
:root {
  --red: #D3361E;
  --red-dark: #B52C17;
  --red-soft: #FF8A73;
  --ink: #17150F;
  --ink-2: #221F18;
  --ink-line: #38322A;
  --paper: #F5F1EA;
  --paper-2: #EDE6DA;
  --paper-3: #EFE9DF;
  --white: #FFFFFF;
  --line: #E4DDD1;
  --stone: #5E584E;
  --stone-dark: #3D3830;
  --stone-light: #CFC7B9;
  --brass: #F4B740;
  --green: #0F7A4B;
  --green-bg: #E3F4EA;
  --err-bg: #FDE8E4;
  --display: 'Bricolage Grotesque', Georgia, serif;
  --body: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --wrap: 1280px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  margin: 0;
  font-family: var(--body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; border-radius: 8px; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; letter-spacing: -0.03em; margin: 0; line-height: 1.1; }
p { margin: 0; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 780px; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 10px; z-index: 100; }
.skip-link:focus { top: 12px; }
.muted { color: var(--stone); }
.text-link { color: var(--red-dark); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.is-hidden { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: 12px; border: 1.5px solid transparent;
  font-weight: 700; font-size: 15px; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover { background: #2B271E; }
.btn-red { background: var(--red); color: var(--white); }
.btn-red:hover { background: var(--red-dark); }
.btn-brass { background: var(--brass); color: var(--ink); min-height: 56px; padding: 0 28px; font-size: 17px; border-radius: 14px; }
.btn-brass:hover { background: #F7C662; }
.btn-outline { background: var(--white); border-color: var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--ink); }
.btn-ghost { background: transparent; color: var(--stone-dark); }
.btn-ghost:hover { background: var(--paper-2); }
.btn-lg { min-height: 54px; padding: 0 28px; font-size: 16px; }
.btn.copied { background: var(--green); color: #fff; border-color: var(--green); }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--white); display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { border-color: var(--ink); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(245, 241, 234, .92);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-word { font-family: var(--display); font-weight: 800; font-size: 23px; letter-spacing: -0.03em; }
.logo-word span { color: var(--red); }
.main-nav { display: flex; gap: 28px; font-weight: 600; font-size: 15px; }
.main-nav a { padding: 6px 0; border-bottom: 2px solid transparent; }
.main-nav a:hover { color: var(--red-dark); }
.main-nav a[aria-current="page"] { border-bottom-color: var(--red); }
.header-actions { display: flex; gap: 12px; align-items: center; }
.menu-btn { display: none; }
.mobile-nav { display: none; }

/* ---------- Hero ---------- */
.hero { padding: 80px 0 64px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) 480px; gap: 56px; align-items: center; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  background: var(--white); border: 1px solid var(--line); font-size: 14px; font-weight: 600;
}
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.hero h1 { font-size: clamp(44px, 6.4vw, 84px); line-height: .98; letter-spacing: -0.04em; margin: 24px 0 22px; }
.hero h1 u { text-decoration-color: var(--red); text-decoration-thickness: .12em; text-underline-offset: .12em; }
.hero-sub { font-size: 20px; color: var(--stone-dark); max-width: 560px; }

.search {
  margin-top: 30px; display: flex; align-items: center; background: var(--white);
  border: 2px solid var(--ink); border-radius: 18px; padding: 6px;
  box-shadow: 6px 6px 0 var(--ink); max-width: 640px;
}
.search > svg { margin: 0 10px 0 12px; flex-shrink: 0; color: var(--stone); }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 18px; height: 52px; }
.search .btn { min-height: 52px; padding: 0 26px; font-size: 16px; background: var(--red); color: var(--white); }
.search .btn:hover { background: var(--red-dark); }
.search:focus-within { box-shadow: 6px 6px 0 var(--red); }
.search-inline { margin: 28px auto; }

.quick { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.quick-label { font-size: 14px; font-weight: 600; color: var(--stone); }
.chip { padding: 8px 14px; border-radius: 999px; background: var(--paper-2); font-size: 14px; font-weight: 600; border: 0; }
.chip:hover { background: #E3DACB; }

.bench {
  position: relative; height: 460px; border-radius: 28px;
  background-color: var(--paper-2);
  background-image: radial-gradient(#CFC4B2 1.6px, transparent 1.8px);
  background-size: 24px 24px; border: 1px solid #E0D7C8;
}
.bench-card {
  position: absolute; background: var(--white); border: 1px solid var(--line); border-radius: 18px;
  padding: 18px; box-shadow: 0 10px 24px rgba(23,21,15,.08); display: flex; flex-direction: column; gap: 12px;
}
.bench-card strong { font-family: var(--display); font-size: 20px; }
.bench-1 { left: 40px; top: 44px; width: 200px; transform: rotate(-3deg); }
.bench-2 { right: 36px; top: 84px; width: 190px; transform: rotate(2.5deg); }
.bench-3 {
  left: 80px; bottom: 56px; width: 250px; background: var(--ink); color: var(--paper); border: 0;
  font-family: var(--mono); font-size: 14px; gap: 4px; transform: rotate(1.5deg);
  box-shadow: 0 10px 24px rgba(23,21,15,.18);
}
.bench-3 .b { color: var(--brass); }
.bench-4 {
  position: absolute; right: 52px; bottom: 90px; width: 120px; height: 120px; border-radius: 24px;
  background: var(--brass); display: flex; align-items: center; justify-content: center;
  transform: rotate(-6deg); box-shadow: 0 10px 24px rgba(23,21,15,.12);
}
.progress { height: 8px; border-radius: 9px; background: #F1ECE3; overflow: hidden; }
.progress span { display: block; width: 72%; height: 100%; background: var(--red); border-radius: 9px; }
.muted-sm { font-size: 14px; color: var(--stone); font-weight: 600; }

/* ---------- Tiles ---------- */
.tile {
  width: 48px; height: 48px; border-radius: 14px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.tile-lg { width: 68px; height: 68px; border-radius: 18px; }
.t-pdf  { background: #FBE4DE; color: #B52C17; }
.t-img  { background: #E2E9FB; color: #2F5BD3; }
.t-text { background: #DDF1EC; color: #0F7A6B; }
.t-dev  { background: #ECE5FB; color: #6B3FD0; }
.t-calc { background: var(--paper-2); color: var(--stone-dark); }
.t-brass { background: var(--brass); color: var(--ink); }

/* ---------- Section heads ---------- */
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 28px; }
.section-head h2 { font-size: clamp(32px, 4vw, 44px); }
.section-head p { font-size: 17px; color: var(--stone); margin-top: 8px; }
.kicker { font-size: 14px; font-weight: 700; color: var(--red-dark); margin-bottom: 6px; }

/* ---------- Developer tools ---------- */
.dev { padding: 16px 16px 0; }
.dev-panel {
  max-width: calc(var(--wrap) + 80px); margin: 0 auto; background: var(--ink); color: var(--paper);
  border-radius: 36px; padding: 64px 40px;
}
.dev-panel .kicker { color: var(--brass); }
.dev-panel .section-head p { color: var(--stone-light); }
.dev-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.dev-card {
  background: var(--ink-2); border: 1px solid var(--ink-line); border-radius: 22px; padding: 28px;
  display: flex; flex-direction: column; gap: 12px; min-height: 230px;
  transition: border-color .15s, transform .15s;
}
.dev-card:hover { border-color: var(--brass); transform: translateY(-2px); }
.dev-card .top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; }
.dev-card .code { font-family: var(--mono); font-size: 13px; color: #A69E90; }
.dev-card h3 { font-size: 24px; letter-spacing: -0.01em; }
.dev-card p { font-size: 15px; color: var(--stone-light); flex: 1; }
.dev-card .open { font-weight: 700; font-size: 15px; color: var(--red-soft); }

/* ---------- Everyday tools ---------- */
.everyday { padding: 72px 0; }
.tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.tool-card {
  background: var(--white); border: 1px solid var(--line); border-radius: 20px; padding: 22px;
  display: flex; flex-direction: column; gap: 14px; transition: border-color .15s, transform .15s;
}
.tool-card:hover { border-color: var(--ink); transform: translateY(-2px); }
.tool-card .top { display: flex; justify-content: space-between; align-items: flex-start; }
.tool-card .cat-tag { font-size: 12px; font-weight: 700; color: var(--stone); }
.tool-card h3 { font-size: 20px; letter-spacing: -0.01em; }
.tool-card p { font-size: 15px; color: var(--stone); margin-top: 4px; }

.no-results {
  display: none; margin: 0 auto 40px; padding: 28px; text-align: center; border-radius: 20px;
  background: var(--white); border: 1px dashed #B9AE9C; max-width: 640px;
}
.no-results.show { display: block; }
.no-results strong { font-family: var(--display); font-size: 22px; display: block; margin-bottom: 4px; }
.no-results a { color: var(--red-dark); font-weight: 700; text-decoration: underline; }

/* ---------- Features / CTA ---------- */
.features { padding-bottom: 72px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.feature { background: var(--white); border: 1px solid var(--line); border-radius: 24px; padding: 32px; }
.feature h3 { font-size: 24px; margin: 14px 0 8px; }
.feature p { color: var(--stone); }
.cta { padding-bottom: 80px; }
.cta-box {
  background: var(--ink); color: var(--paper); border-radius: 28px; padding: 56px 64px;
  display: flex; justify-content: space-between; align-items: center; gap: 32px;
}
.cta-box h2 { font-size: clamp(32px, 4vw, 44px); }
.cta-box p { color: var(--stone-light); font-size: 18px; margin-top: 8px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--paper-3); border-top: 1px solid var(--line); padding: 56px 0; }
.footer-inner { display: flex; justify-content: space-between; gap: 48px; }
.footer-brand { max-width: 320px; display: flex; flex-direction: column; gap: 14px; color: var(--stone); font-size: 15px; }
.footer-cols { display: grid; grid-template-columns: repeat(3, minmax(0, auto)); gap: 64px; font-size: 15px; }
.footer-cols div { display: flex; flex-direction: column; gap: 10px; }
.footer-cols strong { color: var(--ink); margin-bottom: 2px; }
.footer-cols a { color: var(--stone); }
.footer-cols a:hover { color: var(--red-dark); }

/* ---------- Simple pages (About / Contact / Privacy / 404) ---------- */
.page-hero { padding: 72px 0 32px; }
.page-hero h1 { font-size: clamp(40px, 6vw, 68px); letter-spacing: -0.04em; }
.lead { font-size: 20px; color: var(--stone-dark); margin-top: 16px; }
.page-body { padding: 16px 0 80px; }
.prose h2 { font-size: 28px; margin: 40px 0 12px; }
.prose p, .prose li { font-size: 17px; line-height: 1.7; color: var(--stone-dark); }
.prose p + p { margin-top: 14px; }
.check-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.check-list li { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 16px 20px; }
.check-list strong { color: var(--ink); }
.about-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 32px 0 8px; }
.about-stats div { background: var(--ink); color: var(--paper); border-radius: 20px; padding: 24px; display: flex; flex-direction: column; gap: 4px; }
.about-stats strong { font-family: var(--display); font-size: 48px; line-height: 1; color: var(--brass); }
.about-stats span { color: var(--stone-light); font-size: 15px; }
.about-cta { margin-top: 48px; background: var(--brass); border-radius: 24px; padding: 32px; display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.about-cta h3 { font-size: 26px; }
.about-cta p { margin-top: 4px; color: var(--stone-dark); }
.big-code { font-family: var(--display); font-weight: 800; font-size: 140px; line-height: 1; color: var(--red); margin-top: 48px; }
.simple-page { padding: 32px 0 96px; }
.simple-page h1 { font-size: clamp(34px, 5vw, 52px); margin-top: 12px; }

.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.contact-card { background: var(--white); border: 1px solid var(--line); border-radius: 28px; padding: 36px; }
.contact-form { display: flex; flex-direction: column; gap: 20px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.form-field { display: flex; flex-direction: column; gap: 8px; }
.form-field label { font-weight: 700; font-size: 15px; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--paper);
  font-size: 16px; outline: none; transition: border-color .15s, background .15s;
}
.form-field textarea { resize: vertical; min-height: 160px; font-family: var(--body); }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--ink); background: var(--white); }
.form-field.has-error input, .form-field.has-error textarea { border-color: var(--red); background: var(--err-bg); }
.field-error { color: var(--red-dark); font-size: 14px; font-weight: 600; }
.contact-form .btn { align-self: flex-start; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-success { text-align: center; padding: 32px 8px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.form-success svg { color: var(--green); background: var(--green-bg); border-radius: 50%; padding: 12px; width: 64px; height: 64px; }
.form-success h2 { font-size: 32px; }
.form-success p { color: var(--stone); margin-bottom: 8px; }
.contact-aside { display: flex; flex-direction: column; gap: 16px; }
.aside-box { background: var(--white); border: 1px solid var(--line); border-radius: 22px; padding: 24px; }
.aside-box.brass { background: var(--brass); border-color: var(--brass); }
.aside-box h3 { font-size: 20px; margin-bottom: 8px; }
.aside-box p { color: var(--stone-dark); font-size: 15px; }

/* ---------- Tool page ---------- */
.tool-hero { padding: 40px 0 28px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; font-weight: 600; color: var(--stone); margin-bottom: 20px; }
.crumbs a:hover { color: var(--red-dark); }
.crumbs [aria-current] { color: var(--ink); }
.tool-title { display: flex; gap: 20px; align-items: center; }
.tool-title h1 { font-size: clamp(36px, 5vw, 54px); letter-spacing: -0.035em; }
.tool-title p { font-size: 18px; color: var(--stone); margin-top: 6px; max-width: 760px; }
.tool-body { padding-bottom: 48px; }
.tool-panel { background: var(--white); border: 1px solid var(--line); border-radius: 28px; padding: 28px; }
.tool-info { padding-bottom: 48px; }
.tool-info-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; }
.how { background: var(--white); border: 1px solid var(--line); border-radius: 24px; padding: 28px 32px; }
.how h2 { font-size: 26px; margin-bottom: 16px; }
.how ol { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 12px; }
.how li { counter-increment: s; display: flex; gap: 14px; align-items: flex-start; font-size: 16px; color: var(--stone-dark); }
.how li::before {
  content: counter(s); flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--paper);
  font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center;
}
.privacy-note { background: var(--ink); color: var(--paper); border-radius: 24px; padding: 28px; }
.privacy-note svg { color: var(--brass); }
.privacy-note h3 { font-size: 22px; margin: 14px 0 8px; }
.privacy-note p { color: var(--stone-light); }
.related { padding-bottom: 80px; }
.related h2 { font-size: 28px; margin-bottom: 18px; }
.related-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.related-card {
  background: var(--white); border: 1px solid var(--line); border-radius: 18px; padding: 18px;
  display: flex; align-items: center; gap: 14px; font-weight: 700; transition: border-color .15s;
}
.related-card .tile { width: 44px; height: 44px; border-radius: 12px; }
.related-card:hover { border-color: var(--ink); }

/* ---------- Tool UI components ---------- */
.controls { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: flex-end; margin-bottom: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 160px; }
.field > label, .field-label { font-weight: 700; font-size: 14px; display: flex; justify-content: space-between; gap: 12px; }
.field .val { font-family: var(--mono); font-weight: 500; color: var(--red-dark); }
.field select, .field input[type="text"], .field input[type="number"], .field input[type="url"] {
  height: 44px; border: 1.5px solid var(--line); border-radius: 12px; padding: 0 12px; background: var(--paper);
  font-size: 15px; outline: none; min-width: 0;
}
.field select:focus, .field input:focus { border-color: var(--ink); background: var(--white); }
.field input[type="range"] { accent-color: var(--red); width: 100%; height: 28px; }
.field input[type="color"] { width: 64px; height: 44px; border: 1.5px solid var(--line); border-radius: 12px; padding: 4px; background: var(--white); cursor: pointer; }
.check { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; cursor: pointer; min-height: 32px; }
.check input { width: 20px; height: 20px; accent-color: var(--red); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.panes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.pane { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pane-label { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 14px; }
.pane-label .count { font-family: var(--mono); font-weight: 400; font-size: 13px; color: var(--stone); }
textarea.code, textarea.plain {
  width: 100%; min-height: 380px; resize: vertical; border: 1.5px solid var(--line); border-radius: 16px;
  padding: 16px; background: var(--paper); font-family: var(--mono); font-size: 14px; line-height: 1.6;
  outline: none; tab-size: 2; white-space: pre; overflow: auto;
}
textarea.plain { font-family: var(--body); font-size: 16px; white-space: pre-wrap; min-height: 260px; }
textarea.code:focus, textarea.plain:focus { border-color: var(--ink); background: var(--white); }
textarea[readonly] { background: #FBF9F5; }
.msg { display: none; margin-top: 14px; padding: 12px 16px; border-radius: 12px; font-weight: 600; font-size: 15px; }
.msg.show { display: block; }
.msg.ok { background: var(--green-bg); color: var(--green); }
.msg.error { background: var(--err-bg); color: var(--red-dark); }
.msg.info { background: var(--paper-2); color: var(--stone-dark); }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.stat .n { font-family: var(--display); font-weight: 800; font-size: 34px; line-height: 1.1; }
.stat .l { font-size: 14px; color: var(--stone); font-weight: 600; }

/* Diff */
.diff-result { border: 1.5px solid var(--line); border-radius: 16px; overflow: auto; max-height: 560px; background: #FBF9F5; font-family: var(--mono); font-size: 13.5px; }
.diff-empty { padding: 18px; color: var(--stone); font-family: var(--body); }
.diff-line { display: grid; grid-template-columns: 48px 48px 22px minmax(0, 1fr); white-space: pre-wrap; word-break: break-word; }
.diff-line .ln { color: #A69E90; text-align: right; padding: 2px 8px; user-select: none; border-right: 1px solid var(--line); }
.diff-line .sign { text-align: center; padding: 2px 0; user-select: none; }
.diff-line .txt { padding: 2px 10px; }
.diff-add { background: #E3F4EA; }
.diff-add .sign, .diff-add .txt { color: #0B5E3A; }
.diff-del { background: #FDE8E4; }
.diff-del .sign, .diff-del .txt { color: #9E2410; }
.diff-summary { display: flex; gap: 10px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.badge.add { background: var(--green-bg); color: var(--green); }
.badge.del { background: var(--err-bg); color: var(--red-dark); }
.badge.same { background: var(--paper-2); color: var(--stone-dark); }

/* Grid generator */
.gg-wrap { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; margin-bottom: 18px; }
.gg-controls { display: flex; flex-direction: column; gap: 16px; background: var(--paper); border-radius: 18px; padding: 20px; }
.gg-preview { background: var(--paper); border-radius: 18px; padding: 20px; min-height: 360px; overflow: auto; }
.gg-cell { background: var(--white); border: 1.5px dashed #B9AE9C; border-radius: 10px; min-height: 44px; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 12px; color: var(--stone); }

/* File tools */
.dropzone {
  border: 2.5px dashed #B9AE9C; border-radius: 22px; background: var(--paper); padding: 40px 20px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center;
  transition: border-color .15s, background .15s;
}
.dropzone.drag { border-color: var(--red); background: #FFF6F3; }
.dropzone .dz-icon { width: 72px; height: 72px; border-radius: 20px; background: var(--white); display: flex; align-items: center; justify-content: center; }
.dropzone strong { font-family: var(--display); font-size: 24px; }
.dropzone small { color: var(--stone); font-size: 14px; }
.file-list { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 8px; }
.file-item { display: flex; align-items: center; gap: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.file-item .thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--white); flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--red-dark); font-size: 11px; font-weight: 800; }
.file-item .meta { flex: 1; min-width: 0; }
.file-item .name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item .size { font-size: 13px; color: var(--stone); }
.file-item .actions { display: flex; gap: 4px; }
.file-item .actions button { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--white); display: flex; align-items: center; justify-content: center; }
.file-item .actions button:hover { border-color: var(--ink); }
.file-item .saved { font-weight: 700; font-size: 14px; color: var(--green); white-space: nowrap; }
.file-item .saved.none { color: var(--stone); }
.file-item .dl { min-height: 36px; padding: 0 14px; font-size: 14px; }
.tool-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 18px; }

/* Resize */
.resize-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; margin-top: 18px; }
.preview-box { background: var(--paper); border-radius: 18px; padding: 16px; display: flex; align-items: center; justify-content: center; min-height: 300px; }
.preview-box img { max-width: 100%; max-height: 460px; border-radius: 8px; }
.side-controls { display: flex; flex-direction: column; gap: 16px; }
.dims { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: end; }
.dims .x { padding-bottom: 12px; color: var(--stone); font-weight: 700; }
.preset-row { display: flex; gap: 8px; flex-wrap: wrap; }
.preset-row button { min-height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--white); font-weight: 600; font-size: 14px; }
.preset-row button:hover { border-color: var(--ink); }

/* QR */
.qr-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; }
.qr-preview { background: var(--paper); border-radius: 18px; padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.qr-preview #qr { background: #fff; padding: 16px; border-radius: 12px; }
.qr-preview #qr img, .qr-preview #qr canvas { width: 240px !important; height: 240px !important; }
.seg { display: inline-flex; background: var(--paper); padding: 4px; border-radius: 12px; gap: 4px; flex-wrap: wrap; }
.seg button { min-height: 38px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; font-size: 14px; color: var(--stone-dark); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* Case converter */
.case-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }

/* Password */
.pw-box { display: flex; align-items: center; gap: 12px; background: var(--ink); color: var(--paper); border-radius: 18px; padding: 16px 16px 16px 22px; margin-bottom: 12px; }
.pw-box output { flex: 1; min-width: 0; font-family: var(--mono); font-size: 22px; word-break: break-all; }
.pw-box .btn-brass { min-height: 48px; font-size: 15px; padding: 0 18px; }
.strength { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; font-size: 14px; font-weight: 700; }
.strength-bar { flex: 1; height: 8px; border-radius: 9px; background: var(--paper-2); overflow: hidden; }
.strength-bar span { display: block; height: 100%; width: 0; border-radius: 9px; transition: width .2s, background .2s; }
.pw-options { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.pw-checks { display: grid; gap: 6px; }

/* EMI */
.emi-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; }
.emi-inputs { display: flex; flex-direction: column; gap: 20px; }
.emi-inputs .field input[type="number"] { font-size: 18px; font-weight: 700; }
.input-pair { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 8px; }
.emi-result { background: var(--ink); color: var(--paper); border-radius: 22px; padding: 26px; display: flex; flex-direction: column; gap: 18px; }
.emi-result .big { font-family: var(--display); font-weight: 800; font-size: 46px; line-height: 1; color: var(--brass); }
.emi-result .label { color: var(--stone-light); font-size: 14px; font-weight: 600; }
.emi-rows { display: grid; gap: 10px; border-top: 1px solid var(--ink-line); padding-top: 16px; }
.emi-rows div { display: flex; justify-content: space-between; font-size: 15px; }
.emi-rows strong { font-family: var(--mono); font-weight: 500; }
.split-bar { display: flex; height: 12px; border-radius: 9px; overflow: hidden; background: var(--ink-line); }
.split-bar .p { background: var(--brass); }
.split-bar .i { background: var(--red-soft); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--stone-light); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.legend .lp::before { background: var(--brass); }
.legend .li::before { background: var(--red-soft); }
.table-wrap { overflow-x: auto; margin-top: 24px; border: 1px solid var(--line); border-radius: 16px; }
table.amort { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 560px; }
table.amort th, table.amort td { padding: 12px 16px; text-align: right; border-bottom: 1px solid var(--line); }
table.amort th:first-child, table.amort td:first-child { text-align: left; }
table.amort th { background: var(--paper); font-size: 13px; color: var(--stone); font-weight: 700; }
table.amort tr:last-child td { border-bottom: 0; }
table.amort td { font-variant-numeric: tabular-nums; }

/* ---------- Diff Checker ---------- */
.btn-xs { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; gap: 6px; }
.btn-green { background: #0F7A4B; color: #fff; }
.btn-green:hover { background: #0B6440; }
kbd { font: 500 11px var(--mono); padding: 2px 6px; border-radius: 5px; background: var(--paper); border: 1px solid var(--line); color: var(--stone); }
.df-grow { flex: 1; }
.df-hint { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--stone); }
.df-count { font-size: 13px; color: var(--stone); white-space: nowrap; }
.df-swap { width: 36px; height: 36px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--white); display: inline-flex; align-items: center; justify-content: center; }
.df-swap:hover { border-color: var(--ink); }
.tool-panel:has(.df) { padding: 20px; }

/* Input */
.df-editors { display: grid; grid-template-columns: minmax(0, 1fr) 52px minmax(0, 1fr); }
.df-ed { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.df-ed-head { display: flex; align-items: center; gap: 10px; min-height: 36px; }
.df-ed-head > label:first-child { font-weight: 800; font-size: 16px; }
.df-ed-mid { display: flex; justify-content: center; padding-top: 46px; }
.df-ed-box { position: relative; display: flex; height: 440px; border: 1.5px solid var(--line); border-radius: 14px; background: #FBF9F5; overflow: hidden; transition: border-color .15s; }
.df-ed-box:focus-within { border-color: var(--ink); background: var(--white); }
.df-ed-box.drag { border-color: var(--red); border-style: dashed; background: #FFF6F3; }
.df-gutter, .df-ed-box textarea { font: 13.5px/24px var(--mono); padding: 12px 0; margin: 0; }
.df-gutter { width: 50px; flex-shrink: 0; text-align: right; padding-right: 12px; box-sizing: border-box; color: #A69E90; white-space: pre; overflow: hidden; user-select: none; border-right: 1px solid #EFEAE1; }
.df-ed-box textarea { flex: 1; min-width: 0; border: 0; outline: none; resize: none; background: transparent; padding-left: 12px; padding-right: 12px; white-space: pre; overflow: auto; tab-size: 4; color: var(--ink); }
.df-input-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 18px; padding-top: 18px; border-top: 1px solid #EFEAE1; }
.df-input + .df-result { margin-top: 24px; }

/* Result layout */
.df-result { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.df-result[hidden], .df-input[hidden] { display: none; }
.df-side { position: sticky; top: 92px; border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 2px; background: var(--white); }
.df-side-title { font-size: 12px; font-weight: 700; color: var(--stone); margin: 10px 0 4px; }
.df-side-title:first-child { margin-top: 0; }
.df-set { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 38px; font-size: 14px; font-weight: 600; cursor: pointer; }
.df-seg { display: inline-flex; background: var(--paper); border-radius: 10px; padding: 3px; gap: 2px; }
.df-seg button { border: 0; background: transparent; padding: 5px 10px; border-radius: 8px; font-size: 13px; font-weight: 700; color: var(--stone); }
.df-seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.df-seg button:disabled { opacity: .4; cursor: not-allowed; }
.df-select { height: 32px; border: 1.5px solid var(--line); border-radius: 9px; padding: 0 6px; font-size: 13px; font-weight: 700; background: var(--white); }
.df-switch { appearance: none; -webkit-appearance: none; width: 38px; height: 22px; border-radius: 99px; background: #DCD4C6; position: relative; cursor: pointer; flex-shrink: 0; margin: 0; transition: background .15s; }
.df-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: left .15s; }
.df-switch:checked { background: var(--red); }
.df-switch:checked::after { left: 19px; }
.df-side-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid #EFEAE1; }
.df-side-actions .btn { justify-content: flex-start; min-height: 40px; font-size: 14px; }
.df-clear-btn { color: var(--red-dark); }
.df-clear-btn:hover { border-color: var(--red); background: #FFF6F3; }

.df-main { border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--white); min-width: 0; }
.df-head { display: grid; grid-template-columns: minmax(0, 1fr) 52px minmax(0, 1fr); align-items: center; height: 54px; padding: 0 22px 0 12px; border-bottom: 1px solid var(--line); }
.df-head-side { display: flex; align-items: center; gap: 10px; min-width: 0; }
.df-head-mid { display: flex; justify-content: center; }
.df-stat { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; white-space: nowrap; }
.df-stat.del { color: var(--red-dark); }
.df-stat.add { color: var(--green); }
.is-unified .df-head { grid-template-columns: auto auto minmax(0, 1fr); gap: 16px; }
.is-unified .df-head-mid { order: 3; justify-content: flex-end; }
.df-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 52px; padding: 8px 12px; background: #FBF9F5; border-bottom: 1px solid var(--line); }
.df-nav-pos { font-size: 14px; font-weight: 600; margin-right: 4px; white-space: nowrap; }
.df-nav-pos strong { font-weight: 800; }
.df-nav-pos span { color: var(--stone); }

/* Diff body */
.df-view { position: relative; }
.df-body { max-height: 70vh; min-height: 280px; overflow: auto; padding: 6px 12px 16px 0; outline: none; }
.df-map { position: absolute; top: 0; right: 0; bottom: 0; width: 12px; background: #F3EFE8; border-left: 1px solid var(--line); cursor: pointer; }
.df-mark { position: absolute; left: 2px; right: 2px; border-radius: 2px; min-height: 3px; }
.df-mark.del { background: #E26A55; }
.df-mark.add { background: #3FB57A; }
.df-mark.both { background: linear-gradient(90deg, #E26A55 50%, #3FB57A 50%); }
.df-mark.active { box-shadow: 0 0 0 1.5px var(--ink); }
.df-map-view { position: absolute; left: 0; right: 0; border: 1.5px solid rgba(23,21,15,.55); border-radius: 3px; pointer-events: none; }
.df-same-banner { margin: 10px 12px; padding: 14px 16px; border-radius: 12px; background: var(--green-bg); color: var(--green); font-size: 15px; }

.df-c, .df-u { font: 13.5px/24px var(--mono); }
.df-c { display: grid; grid-template-columns: 48px 20px minmax(0, 1fr); min-height: 24px; position: relative; }
.df-u { display: grid; grid-template-columns: 48px 48px 20px minmax(0, 1fr); min-height: 24px; position: relative; }
.df-c .ln, .df-u .ln { color: #A69E90; text-align: right; padding-right: 10px; user-select: none; }
.df-c .sg, .df-u .sg { text-align: center; user-select: none; }
.df-c .tx, .df-u .tx { white-space: pre-wrap; word-break: break-word; padding-right: 12px; tab-size: 4; }
.df-del { background: #FDECE8; }
.df-add { background: #E6F5EC; }
.df-del .ln, .df-del .sg { color: var(--red-dark); }
.df-add .ln, .df-add .sg { color: var(--green); }
.df-del mark { background: #F6B8AA; color: #7A1C0C; border-radius: 3px; }
.df-add mark { background: #A8DDBE; color: #0B4D30; border-radius: 3px; }
.df-empty { background: repeating-linear-gradient(135deg, #F5F1EA 0 6px, #ECE6DB 6px 7px); }
.df-void { background: #FBF9F5; }
[data-ch] { cursor: pointer; }
.df-c.is-active::before, .df-u.is-active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--ink); }

.df-split .df-r { display: grid; grid-template-columns: minmax(0, 1fr) 14px minmax(0, 1fr); }
.df-split.nowrap { display: grid; grid-template-columns: minmax(0, 1fr) 14px minmax(0, 1fr); }
.df-split.nowrap .df-col { overflow-x: auto; min-width: 0; }
.df-split.nowrap .df-rowwrap, .df-split.nowrap .df-c { min-width: max-content; width: 100%; }
.df-split.nowrap .df-c .tx, .df-uni.nowrap .tx { white-space: pre; word-break: normal; }
.df-split.nowrap .df-c { height: 24px; grid-template-columns: 48px 20px auto; }
.df-uni.nowrap { overflow-x: auto; }
.df-uni.nowrap .df-u { min-width: max-content; }

.df-fold { display: flex; align-items: center; gap: 8px; width: 100%; height: 34px; padding: 0 0 0 16px; border: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #F0EADF; color: var(--stone); font-size: 13px; font-weight: 700; text-align: left; }
.df-fold:hover { background: #E8E0D2; color: var(--ink); }
.df-act { display: grid; grid-template-columns: minmax(0, 1fr) 14px minmax(0, 1fr); padding: 10px 0 12px; border-bottom: 1px solid var(--line); background: var(--white); box-shadow: 0 6px 14px -10px rgba(23,21,15,.35); }
.df-act-l { display: flex; justify-content: flex-end; padding-right: 8px; }
.df-act-r { display: flex; justify-content: flex-start; padding-left: 8px; }
.df-act-cell { height: 56px; align-items: center; border-bottom: 1px solid var(--line); background: var(--white); }
.df-act-u { display: flex; justify-content: center; gap: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .main-nav { gap: 20px; }
  .hero-grid { grid-template-columns: 1fr; }
  .bench { display: none; }
  .tool-grid, .related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-inner { flex-direction: column; }
  .tool-info-grid, .contact-grid, .emi-grid, .qr-grid, .resize-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .df-result { grid-template-columns: 1fr; }
  .df-side { position: static; order: 2; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
  .df-side-title { grid-column: 1 / -1; }
  .df-side-actions { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
}
@media (max-width: 760px) {
  .df-editors { grid-template-columns: 1fr; gap: 8px; }
  .df-ed-mid { padding: 0; }
  .df-ed-box { height: 260px; }
  .df-side { grid-template-columns: 1fr; }
  .df-head, .is-unified .df-head { grid-template-columns: 1fr; padding: 6px 20px 6px 10px; height: auto; gap: 0; }
  .df-head .df-count, .hide-md { display: none; }
  .df-head-mid { display: none; }
  .df-act-u { flex-direction: column; align-items: center; gap: 8px; }
  .df-u { grid-template-columns: 34px 34px 16px minmax(0, 1fr); font-size: 12.5px; }
  .tool-panel:has(.df) { padding: 12px; }
}
@media (max-width: 920px) {
  .main-nav, .hide-sm { display: none; }
  .menu-btn { display: inline-flex; }
  .mobile-nav.open {
    display: flex; flex-direction: column; padding: 8px 24px 20px;
    border-top: 1px solid var(--line); background: var(--paper);
  }
  .mobile-nav a { padding: 14px 0; font-weight: 600; border-bottom: 1px solid var(--line); }
  .dev-grid, .feature-grid { grid-template-columns: 1fr; }
  .cta-box, .about-cta { flex-direction: column; align-items: flex-start; padding: 40px 28px; }
  .footer-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .panes, .gg-wrap, .pw-options { grid-template-columns: 1fr; }
  textarea.code { min-height: 260px; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .hero { padding: 40px 0 32px; }
  .hero-sub, .lead { font-size: 17px; }
  .search { box-shadow: 4px 4px 0 var(--ink); }
  .search input { font-size: 16px; height: 48px; }
  .search .btn { min-height: 48px; padding: 0 16px; }
  .search .btn .long { display: none; }
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tool-card { padding: 16px; }
  .tool-card p { display: none; }
  .related-grid { grid-template-columns: 1fr; }
  .dev { padding: 8px 8px 0; }
  .dev-panel { padding: 40px 16px; border-radius: 24px; }
  .dev-card { min-height: 0; padding: 22px; }
  .logo-word { font-size: 20px; }
  .tool-panel { padding: 16px; border-radius: 20px; }
  .tool-title { flex-direction: column; align-items: flex-start; gap: 14px; }
  .form-row, .about-stats { grid-template-columns: 1fr; }
  .contact-card { padding: 22px; }
  .footer-cols { grid-template-columns: 1fr; }
  .pw-box output { font-size: 18px; }
  .input-pair { grid-template-columns: minmax(0, 1fr) 120px; }
  .emi-result .big { font-size: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
