/* ---------- Colours (light) ---------- */
:root {
  --bg: #f4f7f5; --surface: #fff; --surface-2: #eef3f0; --text: #17211b; --muted: #56655c;
  --line: #dbe3de; --input: #b3c1b8; --accent: #14663a; --accent-hover: #0f5230; --accent-soft: #e3f1e8; --on-accent: #fff;
  --error: #b42318; --shadow: 0 1px 2px rgba(16, 40, 24, .05), 0 4px 14px rgba(16, 40, 24, .06);
  --shadow-hover: 0 2px 4px rgba(16, 40, 24, .06), 0 10px 26px rgba(16, 40, 24, .1);
  --radius: 14px;
  --blue: #1d5fd1; --blue-bg: #e7efff; --red: #c4321f; --red-bg: #fdecea; --purple: #7444c9; --purple-bg: #f1eafd;
  --green: #14663a; --green-bg: #e3f1e8; --amber: #a35b00; --amber-bg: #fff1dc; --teal: #0d7680; --teal-bg: #e0f4f5;
  color-scheme: light;
}
/* ---------- Colours (dark): used when chosen, or when the device is in dark mode and nothing was chosen ---------- */
:root[data-theme="dark"] {
  --bg: #0f1712; --surface: #17211b; --surface-2: #1e2a23; --text: #e6eee9; --muted: #9db0a4;
  --line: #2a3a31; --input: #3d5145; --accent: #4fc283; --accent-hover: #6fd49b; --accent-soft: #1c3527; --on-accent: #0b130e;
  --error: #ff8a7a; --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-hover: 0 6px 20px rgba(0, 0, 0, .4);
  --blue: #8ab4ff; --blue-bg: #1b2a45; --red: #ff9484; --red-bg: #3a1f1b; --purple: #c3a5ff; --purple-bg: #2c2240;
  --green: #6fd49b; --green-bg: #1c3527; --amber: #ffc46b; --amber-bg: #3a2b12; --teal: #6fd6de; --teal-bg: #15343a;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1712; --surface: #17211b; --surface-2: #1e2a23; --text: #e6eee9; --muted: #9db0a4;
    --line: #2a3a31; --input: #3d5145; --accent: #4fc283; --accent-hover: #6fd49b; --accent-soft: #1c3527; --on-accent: #0b130e;
    --error: #ff8a7a; --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-hover: 0 6px 20px rgba(0, 0, 0, .4);
    --blue: #8ab4ff; --blue-bg: #1b2a45; --red: #ff9484; --red-bg: #3a1f1b; --purple: #c3a5ff; --purple-bg: #2c2240;
    --green: #6fd49b; --green-bg: #1c3527; --amber: #ffc46b; --amber-bg: #3a2b12; --teal: #6fd6de; --teal-bg: #15343a;
    color-scheme: dark;
  }
}
.c-blue { --c: var(--blue); --c-bg: var(--blue-bg); }
.c-red { --c: var(--red); --c-bg: var(--red-bg); }
.c-purple { --c: var(--purple); --c-bg: var(--purple-bg); }
.c-green { --c: var(--green); --c-bg: var(--green-bg); }
.c-amber { --c: var(--amber); --c-bg: var(--amber-bg); }
.c-teal { --c: var(--teal); --c-bg: var(--teal-bg); }

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body { margin: 0; font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", sans-serif;
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.icon { width: 20px; height: 20px; flex: none; vertical-align: middle; }
main { max-width: 1040px; margin: 0 auto; padding: 20px 16px 40px; }
h1 { font-size: 28px; line-height: 1.2; letter-spacing: -.02em; margin: 0 0 8px; }
h2 { font-size: 20px; letter-spacing: -.01em; margin: 36px 0 14px; display: flex; align-items: center; gap: 10px; }
h2 small { font-size: 13px; font-weight: 600; color: var(--muted); background: var(--surface-2); border-radius: 20px; padding: 1px 9px; }
kbd { font: 600 12px/1 ui-monospace, monospace; padding: 4px 7px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; color: var(--muted); background: var(--surface); }

/* ---------- Header and footer ---------- */
.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1040px; margin: 0 auto; padding: 10px 16px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 19px; letter-spacing: -.02em; text-decoration: none; color: var(--text); }
.brand:hover { color: var(--text); }
.brand img { border-radius: 8px; }
.top nav { display: flex; align-items: center; gap: 4px; }
.top nav a { padding: 6px 10px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 500; font-size: 15px; }
.top nav a:hover { background: var(--surface-2); color: var(--text); }
.top nav a.lang { color: var(--accent); font-weight: 600; border: 1px solid var(--line); }
:root[lang="hi"] body { line-height: 1.65; }
.theme { display: grid; place-items: center; width: 38px; height: 38px; margin-left: 4px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--muted); cursor: pointer; }
.theme:hover { color: var(--text); }
.theme .i-sun { display: none; }
:root[data-theme="dark"] .theme .i-sun { display: block; }
:root[data-theme="dark"] .theme .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme .i-moon { display: none; }
}
footer { text-align: center; padding: 28px 16px; font-size: 14px; color: var(--muted); border-top: 1px solid var(--line); background: var(--surface); }
footer p { margin: 6px 0; }
.foot-cats { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-bottom: 14px; }
.foot-cats a { color: var(--text); text-decoration: none; font-weight: 500; }

/* ---------- Home ---------- */
.hero { text-align: center; padding: 34px 0 8px; }
.hero h1 { font-size: clamp(28px, 5vw, 42px); max-width: 720px; margin: 0 auto 10px; }
.lead { font-size: 18px; color: var(--muted); margin: 0 0 22px; }
.search { position: relative; max-width: 620px; margin: 0 auto; }
.search .icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search kbd { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); }
.search input:focus ~ kbd, .search input:not(:placeholder-shown) ~ kbd { display: none; }
.search input { padding: 15px 48px; font-size: 17px; border-radius: 14px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.search input:focus { border-color: var(--accent); outline: 3px solid var(--accent-soft); }
.trust { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; font-size: 14px; color: var(--muted); }
.trust li { display: flex; align-items: center; gap: 6px; }
.trust .icon { width: 17px; height: 17px; color: var(--accent); }
.cats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 22px 0 0; }
.none { text-align: center; color: var(--muted); margin-top: 24px; }
.extra.searching { display: none; }
.extra h2 .icon { color: var(--muted); }
.why { margin-top: 44px; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.why h2 { grid-column: 1 / -1; margin: 0 0 2px; }
.why p { margin: 0; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); font-size: 15px; color: var(--muted); }
.why strong { display: block; color: var(--text); margin-bottom: 2px; }

/* ---------- Cards and chips ---------- */
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.card { display: flex; gap: 12px; align-items: flex-start; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.card:hover, .card:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: var(--c, var(--accent)); color: var(--text); }
.card strong { display: block; font-size: 15.5px; line-height: 1.3; margin-bottom: 3px; }
.card-text > span { display: block; font-size: 14px; line-height: 1.45; color: var(--muted); }
.badge { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 11px; background: var(--c-bg, var(--accent-soft)); color: var(--c, var(--accent)); }
h2 .badge { width: 34px; height: 34px; border-radius: 10px; }
h2 .badge .icon { width: 18px; height: 18px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; background: var(--surface); border: 1px solid var(--line); border-radius: 30px;
  text-decoration: none; font-size: 14px; font-weight: 500; color: var(--text); }
.chip .icon { width: 16px; height: 16px; color: var(--c, var(--accent)); }
.chip:hover { border-color: var(--c, var(--accent)); background: var(--c-bg, var(--accent-soft)); color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }

/* ---------- Tool page ---------- */
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.crumbs a { text-decoration: none; color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.tool-head { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.tool-head h1 { margin: 0 0 2px; }
.tool-head p { margin: 0; color: var(--muted); }
.big-badge { width: 56px; height: 56px; border-radius: 16px; }
.big-badge .icon { width: 28px; height: 28px; }
.note { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); margin: 10px 2px 0; }
.note .icon { width: 17px; height: 17px; color: var(--accent); }
.how p { color: var(--muted); }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0; margin-bottom: 8px; }
.faq summary { font-weight: 600; cursor: pointer; padding: 13px 16px; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 20px; line-height: 1; color: var(--muted); }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0; padding: 0 16px 14px; color: var(--muted); }

/* ---------- Forms ---------- */
input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--input); border-radius: 10px; font: inherit; background: var(--surface); color: inherit; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 3px solid var(--accent-soft); }
input[type=color] { height: 46px; padding: 4px; }
input[type=file] { padding: 18px 12px; border-style: dashed; border-width: 2px; background: var(--surface-2); cursor: pointer; }
input[type=file]::file-selector-button { margin-right: 12px; padding: 8px 14px; border: 0; border-radius: 8px; background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 600; cursor: pointer; }
.panel, .result { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.fields { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin-bottom: 18px; }
.field label, .label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 5px; }
.field small { display: block; color: var(--muted); margin-top: 4px; }
.field.wide { grid-column: 1 / -1; }
.field.check { display: flex; flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 8px; }
.field.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.field.check label { margin: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 20px; border: 1px solid var(--accent); border-radius: 10px;
  background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s ease; }
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn.light { background: var(--surface); color: var(--accent); }
.btn.light:hover { background: var(--accent-soft); color: var(--accent); }
.btn:disabled { opacity: .6; cursor: wait; }
#tool > .btn { min-width: 160px; }
.error { color: var(--error); font-weight: 600; }

/* ---------- Results ---------- */
.result { margin-top: 16px; overflow-x: auto; }
.result img, .result canvas { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; }
.result table { width: 100%; border-collapse: collapse; }
.result td, .result th { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.result tr:last-child td, .result tr:last-child th { border-bottom: 0; }
.result td { font-variant-numeric: tabular-nums; font-weight: 600; }
.big { font-size: 44px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.files { list-style: none; padding: 0; margin: 8px 0 0; }
.files li { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; padding: 6px 8px; background: var(--surface-2); border-radius: 8px; }
.files span { flex: 1; overflow-wrap: anywhere; }
.files button, .item button { padding: 6px 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 8px; cursor: pointer; }
.item { display: grid; grid-template-columns: 1fr 80px 110px auto; gap: 6px; margin-bottom: 6px; }
.passage { font-size: 18px; background: var(--surface-2); padding: 14px; border-radius: 10px; }

/* ---------- Printable documents: always black on white ---------- */
.sheet { background: #fff; padding: 24px; border: 1px solid var(--line); color: #000; }
.sheet h2 { margin: 0 0 4px; display: block; }
.sheet h3 { border-bottom: 1px solid #999; font-size: 16px; margin: 18px 0 6px; }
.sheet td, .sheet th { border-color: #ccc; color: #000; }
.sheet .pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.sheet .right { text-align: right; }
.sheet .sign { margin-top: 56px; text-align: right; }
.cards { display: grid; grid-template-columns: repeat(2, 90mm); justify-content: center; }
.vcard { width: 90mm; height: 54mm; padding: 5mm; overflow: hidden; border: 1px dashed #bbb; border-left: 4mm solid; font-size: 9.5pt; line-height: 1.35; background: #fff; color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.vcard strong { display: block; font-size: 13pt; margin-bottom: 2mm; }

/* ---------- Small screens ---------- */
@media (max-width: 560px) {
  h1 { font-size: 24px; }
  .hero { padding-top: 18px; }
  .search kbd { display: none; }
  .search input { padding-right: 14px; }
  .top-in { flex-wrap: nowrap; padding: 8px 12px; }
  .brand { font-size: 17px; gap: 7px; }
  .brand img { width: 26px; height: 26px; }
  .top nav { gap: 0; }
  .top nav a { padding: 6px 6px; font-size: 14px; }
  .top nav a:first-child, .top nav a.nav-contact { display: none; }
  .theme { width: 34px; height: 34px; }
  .tool-head { align-items: flex-start; }
  .big-badge { width: 46px; height: 46px; border-radius: 13px; }
  .panel { padding: 16px; }
  #tool > .btn { width: 100%; }
  .grid { grid-template-columns: 1fr; gap: 10px; }
  .item { grid-template-columns: 1fr 1fr auto; }
  .item input:first-child { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card { transition: none; }
  .card:hover { transform: none; }
}

/* ---------- Printing ---------- */
@page { size: A4; margin: 10mm; }
@media print {
  :root { color-scheme: light; }
  body { background: #fff; color: #000; }
  .top, footer, main > *:not(#output), .actions, .no-print { display: none !important; }
  main { max-width: none; padding: 0; }
  .result { border: 0; padding: 0; margin: 0; overflow: visible; box-shadow: none; background: #fff; }
  .sheet { border: 0; padding: 0; }
}

/* ---------- Ads ---------- */
.ad { margin: 28px auto; text-align: center; min-height: 90px; overflow: hidden; }
.ad-label { display: block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.ad-preview { display: grid; place-items: center; align-content: center; gap: 2px; border: 2px dashed var(--line); border-radius: var(--radius); color: var(--muted); font-size: 14px; }
.ad-content.ad-preview { min-height: 250px; }
/* Left and right ads, only on screens wide enough to keep the page at full width */
.page { display: grid; grid-template-columns: 1fr minmax(0, 1040px) 1fr; }
.page > main { grid-column: 2; grid-row: 1; width: 100%; min-width: 0; }
.rail { display: none; }
@media (min-width: 1420px) {
  .rail { display: block; padding: 24px 16px; }
  .rail-left { grid-column: 1; grid-row: 1; justify-self: end; }
  .rail-right { grid-column: 3; grid-row: 1; justify-self: start; }
  .rail-in { position: sticky; top: 76px; width: 160px; }
  .rail .ad { margin: 0; min-height: 600px; }
  .rail .ad-preview { width: 160px; height: 620px; }
}
@media print { .ad, .rail { display: none !important; } }

/* ---------- Drag and drop ---------- */
.drop.over input[type=file] { border-color: var(--accent); background: var(--accent-soft); }
.drop.over label::after { content: " — drop to add"; color: var(--accent); font-weight: 500; }

/* ---------- About and Contact ---------- */
.page-hero { padding: 8px 0 4px; }
.page-hero h1 { font-size: clamp(28px, 4.5vw, 38px); }
.page-hero .lead { max-width: 720px; margin-bottom: 8px; }
.muted { color: var(--muted); }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 22px 0 8px; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stats strong { display: block; font-size: 30px; font-weight: 800; letter-spacing: -.02em; color: var(--accent); line-height: 1.1; }
.stats span { font-size: 14px; color: var(--muted); }
.values { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.value { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.value p { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.cta { margin: 36px 0 8px; padding: 22px; text-align: center; background: var(--accent-soft); border-radius: var(--radius); }
.cta p { margin: 0 0 12px; }
.contact-card { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-top: 22px; padding: 20px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.contact-card > div { flex: 1; min-width: 220px; }
.contact-card p { margin: 0; font-size: 14px; }
.contact-email { display: inline-block; font-size: 22px; font-weight: 700; margin: 2px 0 4px; overflow-wrap: anywhere; text-decoration: none; }
.topics .card-text > span { color: var(--accent); font-weight: 500; }
