:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f0f0ec;
  --text: #1b1c1e;
  --muted: #5e6066;
  --border: #e2e2dc;
  --accent: #0f766e;
  --accent-text: #ffffff;
  --accent-soft: #e3f2ef;
  --focus: #0f766e66;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 4px 16px rgb(0 0 0 / 0.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121315;
    --surface: #1b1c1f;
    --surface-2: #232428;
    --text: #ececea;
    --muted: #a3a5aa;
    --border: #2e3034;
    --accent: #2dd4bf;
    --accent-text: #08201d;
    --accent-soft: #12302c;
    --focus: #2dd4bf55;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121315;
  --surface: #1b1c1f;
  --surface-2: #232428;
  --text: #ececea;
  --muted: #a3a5aa;
  --border: #2e3034;
  --accent: #2dd4bf;
  --accent-text: #08201d;
  --accent-soft: #12302c;
  --focus: #2dd4bf55;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", "Noto Sans Tamil", "Nirmala UI", sans-serif;
}
a { color: var(--accent); text-underline-offset: 2px; }
.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px; }

/* Header / footer */
.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 56px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); text-decoration: none; white-space: nowrap; }
@media (max-width: 420px) {
  .header-nav a { padding: 6px 7px; }
  .brand-name { display: none; }
}
.brand img { width: 26px; height: 26px; }
.header-nav { display: flex; align-items: center; gap: 4px; }
.header-nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: 15px; }
.header-nav a:hover { color: var(--text); background: var(--surface-2); }
.icon-btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px; width: 36px; height: 36px; cursor: pointer; font-size: 16px; }
.site-footer { border-top: 1px solid var(--border); margin-top: 48px; padding: 24px 0 40px; color: var(--muted); font-size: 14px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 8px; }
.site-footer a { color: var(--muted); }

/* Page */
main { padding: 24px 0; }
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }
h1 { font-size: clamp(26px, 4.5vw, 34px); line-height: 1.2; margin: 0 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 22px; margin: 36px 0 10px; }
h3 { font-size: 17px; margin: 20px 0 6px; }
.lead { color: var(--muted); margin: 0 0 20px; font-size: 17px; }

/* Tool card */
.tool { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.tool + .tool { margin-top: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 180px; min-width: 0; }
label, .label { font-size: 14px; font-weight: 600; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; width: 100%;
}
textarea { min-height: 180px; resize: vertical; line-height: 1.7; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--accent); }
.btn {
  font: inherit; font-weight: 600; font-size: 15px; border-radius: 10px; padding: 9px 14px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.05); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pane-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 760px) { .pane-grid { grid-template-columns: 1fr 1fr; } }
.pane-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; gap: 8px; }
.count { font-size: 13px; color: var(--muted); }
.swap-link { display: inline-block; margin-top: 12px; font-size: 15px; }
.note { font-size: 14px; color: var(--muted); margin: 10px 0 0; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 8px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }

/* Result */
.result { margin-top: 16px; padding: 16px; border-radius: 10px; background: var(--accent-soft); }
.result-value { font-size: clamp(28px, 6vw, 40px); font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; word-break: break-word; }
.result-sub { color: var(--muted); font-size: 14px; margin-top: 6px; }

.tabs { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 4px; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs a, .tabs button { border: 0; background: transparent; font: inherit; font-size: 15px; font-weight: 600; color: var(--muted); padding: 7px 12px; border-radius: 8px; cursor: pointer; text-decoration: none; }
.tabs .active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: 15px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
th { background: var(--surface-2); font-size: 14px; color: var(--muted); }
td.num { text-align: right; }

/* Home cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--text); }
.card:hover { border-color: var(--accent); }
.card strong { display: block; margin-bottom: 2px; }
.card span { color: var(--muted); font-size: 14px; }
.link-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; list-style: none; }
.link-list a { display: inline-block; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); text-decoration: none; font-size: 14px; color: var(--text); }
.link-list a:hover { border-color: var(--accent); }

/* Content */
.prose p, .prose li { color: var(--text); }
.prose code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: 0.92em; }
details { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
details + details { margin-top: 8px; }
summary { cursor: pointer; font-weight: 600; }
details p { margin: 8px 0 0; color: var(--muted); }
.ad { margin: 24px 0; text-align: center; min-height: 0; }
