/* ============================================================
   Design system
   Zero external resources. No CDN, no web fonts.
   Every request stays on the user's own domain.
   ============================================================ */

:root {
  --bg:            #ffffff;
  --bg-subtle:     #f6f8fb;
  --surface:       #ffffff;
  --surface-alt:   #f1f5f9;
  --border:        #e2e8f0;
  --border-strong: #cbd5e1;
  --text:          #0f172a;
  --text-muted:    #5b6b80;
  --text-faint:    #8494a8;
  --accent:        #4f46e5;
  --accent-hover:  #4338ca;
  --accent-soft:   #eef2ff;
  --ok:            #047857;
  --ok-soft:       #ecfdf5;
  --warn:          #b45309;
  --warn-soft:     #fffbeb;
  --err:           #b91c1c;
  --err-soft:      #fef2f2;
  --code-bg:       #f8fafc;
  --shadow:        0 1px 2px rgba(15,23,42,.04), 0 4px 12px rgba(15,23,42,.05);
  --shadow-lg:     0 4px 8px rgba(15,23,42,.05), 0 12px 32px rgba(15,23,42,.08);
  --radius:        12px;
  --radius-sm:     8px;
  --maxw:          1140px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

html[data-theme="dark"] {
  --bg:            #0b1120;
  --bg-subtle:     #0f1729;
  --surface:       #131c2e;
  --surface-alt:   #1a2438;
  --border:        #223047;
  --border-strong: #33425e;
  --text:          #e6edf6;
  --text-muted:    #9aabc2;
  --text-faint:    #74869e;
  --accent:        #818cf8;
  --accent-hover:  #a5b4fc;
  --accent-soft:   #1e2445;
  --ok:            #34d399;
  --ok-soft:       #04251c;
  --warn:          #fbbf24;
  --warn-soft:     #2a1f04;
  --err:           #f87171;
  --err-soft:      #2a1215;
  --code-bg:       #0d1526;
  --shadow:        0 1px 2px rgba(0,0,0,.3), 0 4px 12px rgba(0,0,0,.25);
  --shadow-lg:     0 4px 8px rgba(0,0,0,.35), 0 12px 32px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .6em; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.12rem; }
p  { margin: 0 0 1em; }

code, pre, .mono { font-family: var(--mono); }

/* ---------- Layout ---------- */

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 800px; }

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex; align-items: center; gap: 24px;
  height: 60px;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.05rem; letter-spacing: -.02em;
  color: var(--text); flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #06b6d4));
  display: grid; place-items: center;
  color: #fff; font-size: .8rem; font-weight: 800;
  font-family: var(--mono);
}

.main-nav { display: flex; gap: 4px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.main-nav a {
  color: var(--text-muted); font-size: .92rem; font-weight: 500;
  padding: 7px 11px; border-radius: var(--radius-sm); white-space: nowrap;
}
.main-nav a:hover { background: var(--surface-alt); color: var(--text); text-decoration: none; }
.main-nav a.active { color: var(--accent); background: var(--accent-soft); }

.icon-btn {
  background: var(--surface-alt); border: 1px solid var(--border);
  color: var(--text-muted); width: 34px; height: 34px; border-radius: var(--radius-sm);
  cursor: pointer; display: grid; place-items: center; font-size: .95rem; flex-shrink: 0;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }

main { min-height: 60vh; padding: 40px 0 72px; }

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  padding: 40px 0 32px; margin-top: 40px;
  font-size: .9rem; color: var(--text-muted);
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 28px; }
.footer-grid h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); margin-bottom: 10px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: 6px; }
.footer-grid a { color: var(--text-muted); }
.footer-grid a:hover { color: var(--accent); }
.footer-bottom { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); font-size: .84rem; color: var(--text-faint); }

/* ---------- Hero ---------- */

.hero { text-align: center; padding: 32px 0 12px; }
.hero h1 { font-size: 2.4rem; }
.hero p.lead { font-size: 1.1rem; color: var(--text-muted); max-width: 660px; margin: 0 auto 24px; }

.privacy-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--ok-soft); color: var(--ok);
  border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent);
  padding: 6px 14px; border-radius: 999px;
  font-size: .85rem; font-weight: 600; margin-bottom: 20px;
}

/* ---------- Tool grid ---------- */

.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 16px; margin: 28px 0; }

.tool-card {
  display: block; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); position: relative;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.tool-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.tool-card h3 { font-size: 1.02rem; margin: 0 0 6px; color: var(--text); display: flex; align-items: center; gap: 9px; }
.tool-card:hover h3 { color: var(--accent); }
.tool-card p { margin: 0; font-size: .9rem; color: var(--text-muted); line-height: 1.55; }
.tool-card .card-icon {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent-soft);
  color: var(--accent); display: grid; place-items: center; font-family: var(--mono);
  font-size: .8rem; font-weight: 700; flex-shrink: 0;
}

.badge-note {
  display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ok); background: var(--ok-soft);
  padding: 3px 8px; border-radius: 5px; margin-top: 12px;
}

/* ---------- Tool page shell ---------- */

.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 1.95rem; }
.page-head .sub { color: var(--text-muted); font-size: 1.02rem; margin: 0; }

.breadcrumb { font-size: .85rem; color: var(--text-faint); margin-bottom: 14px; }
.breadcrumb a { color: var(--text-muted); }

.tool-shell {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; margin-bottom: 32px;
}

.tool-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.btn {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 7px 14px; font-size: .88rem; font-weight: 550; cursor: pointer;
  font-family: var(--font); transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-alt); }
.btn:active { transform: translateY(.5px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-alt); color: var(--text); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.spacer { flex: 1 1 auto; }

select.btn { padding-right: 10px; }

.pane-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border); }
.pane-grid.single { grid-template-columns: 1fr; }
@media (max-width: 760px) { .pane-grid { grid-template-columns: 1fr; } }

.pane { background: var(--surface); display: flex; flex-direction: column; min-height: 260px; }
.pane-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 12px; font-size: .76rem; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-faint);
  border-bottom: 1px solid var(--border);
}

textarea.io {
  flex: 1; width: 100%; border: 0; outline: none; resize: vertical;
  padding: 14px; font-family: var(--mono); font-size: 13.5px; line-height: 1.6;
  background: var(--surface); color: var(--text); min-height: 240px;
  tab-size: 2;
}
textarea.io:focus { box-shadow: inset 0 0 0 2px var(--accent-soft); }

.output-view {
  flex: 1; padding: 14px; overflow: auto; max-height: 560px;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.6;
  background: var(--surface); white-space: pre-wrap; word-break: break-word; margin: 0;
}
.output-view.empty { color: var(--text-faint); font-family: var(--font); }

.status {
  padding: 10px 14px; font-size: .88rem; font-weight: 550;
  border-bottom: 1px solid var(--border); display: none;
}
.status.show { display: block; }
.status.ok    { background: var(--ok-soft);  color: var(--ok); }
.status.err   { background: var(--err-soft); color: var(--err); }
.status.warn  { background: var(--warn-soft); color: var(--warn); }
.status.neutral { background: var(--bg-subtle); color: var(--text-muted); }

/* JSON tree rendering */
.json-tree { flex: 1; padding: 14px; overflow: auto; max-height: 560px; font-family: var(--mono); font-size: 13.5px; line-height: 1.65; }
.json-tree ul { list-style: none; margin: 0; padding-left: 18px; border-left: 1px dotted var(--border-strong); }
.json-tree > ul { padding-left: 2px; border-left: 0; }
.jt-key   { color: var(--accent); }
.jt-str   { color: var(--ok); }
.jt-num   { color: var(--warn); }
.jt-bool  { color: var(--err); }
.jt-null  { color: var(--text-faint); font-style: italic; }
.jt-row   { white-space: pre-wrap; word-break: break-word; }

/* Key-value result table (JWT) */
.kv { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.kv td { padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: top; font-family: var(--mono); word-break: break-all; }
.kv td:first-child { width: 130px; color: var(--text-faint); white-space: nowrap; font-family: var(--font); font-size: .85rem; }
.kv tr:last-child td { border-bottom: 0; }

/* ---------- Content sections ---------- */

.section { margin: 36px 0; }
.section h2 { padding-bottom: 8px; border-bottom: 1px solid var(--border); font-size: 1.3rem; }
.section h3 { margin-top: 26px; font-size: 1.05rem; }
.section ul, .section ol { padding-left: 22px; }
.section li { margin-bottom: 7px; }

.callout {
  background: var(--accent-soft); border-left: 3px solid var(--accent);
  padding: 14px 18px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 20px 0; font-size: .94rem;
}
.callout.warnbox { background: var(--warn-soft); border-left-color: var(--warn); }
.callout p:last-child { margin-bottom: 0; }

table.data { width: 100%; border-collapse: collapse; font-size: .92rem; margin: 18px 0; }
table.data th, table.data td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; }
table.data th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); }
table.data td code { font-size: .86em; background: var(--code-bg); padding: 2px 5px; border-radius: 4px; }

details.faq { border-bottom: 1px solid var(--border); padding: 12px 0; }
details.faq summary { cursor: pointer; font-weight: 600; font-size: .98rem; list-style: none; display: flex; gap: 10px; align-items: flex-start; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::before { content: "+"; color: var(--accent); font-weight: 700; font-family: var(--mono); flex-shrink: 0; }
details.faq[open] summary::before { content: "\2212"; }
details.faq > *:not(summary) { margin-top: 10px; color: var(--text-muted); font-size: .94rem; }

pre.codeblock {
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 16px; overflow-x: auto;
  font-size: 13px; line-height: 1.6; margin: 14px 0;
}

.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 16px 0; }
.field label { display: block; font-size: .84rem; font-weight: 650; color: var(--text-muted); margin-bottom: 5px; }
.field input[type="text"], .field select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  font-family: var(--mono); font-size: 13.5px; outline: none;
}
.field input[type="text"]:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.check-row { display: flex; align-items: center; gap: 10px; margin: 10px 0; font-size: .92rem; }
.check-row input { width: 16px; height: 16px; accent-color: var(--accent); }

.hash-row { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--border); font-family: var(--mono); font-size: 13px; }
.hash-row:last-child { border-bottom: 0; }
.hash-row .algo { width: 78px; flex-shrink: 0; color: var(--text-faint); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.hash-row .val  { flex: 1; word-break: break-all; }

@media (max-width: 600px) {
  .hero h1 { font-size: 1.85rem; }
  h1 { font-size: 1.6rem; }
  .wrap { padding: 0 16px; }
  .site-header .wrap { height: auto; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
}
