/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Design tokens — dark developer theme ──────────────────── */
:root {
  --bg:          #0d1117;
  --surface:     #161b22;
  --surface2:    #1c2128;
  --surface3:    #21262d;
  --border:      #30363d;
  --border-focus:#6366f1;
  --accent:      #6366f1;
  --accent-lt:   #818cf8;
  --accent-xlt:  rgba(99,102,241,.12);
  --accent-glow: rgba(99,102,241,.2);
  --cyan:        #22d3ee;
  --cyan-lt:     rgba(34,211,238,.12);
  --green:       #3fb950;
  --red:         #f85149;
  --amber:       #f0883e;
  --text:        #e6edf3;
  --text2:       #8d96a0;
  --muted:       #656d76;
  --chip-bg:     rgba(99,102,241,.15);
  --chip-text:   #a5b4fc;
  --code-bg:     #0d1117;
  --radius:      12px;
  --shadow:      0 1px 3px rgba(0,0,0,.4), 0 4px 12px rgba(0,0,0,.3);
  --shadow-lg:   0 4px 24px rgba(0,0,0,.5), 0 8px 32px rgba(0,0,0,.3);
  --glow:        0 0 0 3px var(--accent-glow);
}

/* ── Base ──────────────────────────────────────────────────── */
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-lt); text-decoration: none; }
a:hover { color: var(--accent-lt); text-decoration: underline; }
code, .mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; }

/* ── Top bar ───────────────────────────────────────────────── */
.top-bar {
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #6366f1, #22d3ee, #3fb950);
  flex-shrink: 0;
}

/* ── Header ────────────────────────────────────────────────── */
.site-header {
  width: 100%;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo-link {
  display: flex;
  align-items: baseline;
  gap: 2px;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -.4px;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}
.logo-link .tld { color: var(--accent-lt); font-size: 15px; font-weight: 700; }
.logo-link .dot { color: var(--muted); }

.site-nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  padding: 6px 10px;
  border-radius: 8px;
  transition: color .15s, background .15s;
  white-space: nowrap;
}
.nav-link:hover, .nav-link.active {
  color: var(--text);
  background: var(--surface3);
  text-decoration: none;
}
.nav-link.active { color: var(--accent-lt); }

/* ── Ad slots ──────────────────────────────────────────────── */
.ad-slot {
  width: 100%;
  max-width: 728px;
  min-height: 90px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 8px;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .05em;
}
.ad-top    { margin: 14px auto 0; }
.ad-bottom { margin: 0 auto 24px; }
body.ads-enabled .ad-slot { display: flex; }

/* ── Page layout ───────────────────────────────────────────── */
.page {
  flex: 1;
  width: 100%;
  max-width: 960px;
  padding: 44px 24px 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}
.page.wide { max-width: 1100px; }

/* ── Breadcrumb ────────────────────────────────────────────── */
.breadcrumb {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--text2); text-decoration: none; }
.breadcrumb span { color: var(--text2); font-weight: 500; }
.bc-sep { color: var(--border); }

/* ── Tool hero ─────────────────────────────────────────────── */
.tool-hero { width: 100%; }
.tool-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--chip-bg);
  color: var(--chip-text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 4px 12px;
  border-radius: 20px;
  text-transform: uppercase;
  margin-bottom: 14px;
  width: fit-content;
}
.tool-hero h1 {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -.8px;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 10px;
}
.tool-hero h1 em { font-style: normal; color: var(--accent-lt); }
.tool-hero p {
  font-size: 16px;
  color: var(--text2);
  line-height: 1.65;
  max-width: 640px;
}

/* ── Tool card ─────────────────────────────────────────────── */
.tool-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: border-color .2s;
}
.tool-card:focus-within { border-color: var(--border-focus); }

.tool-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}
.card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: #5558e3; border-color: #5558e3; }
.btn-outline {
  background: transparent;
  color: var(--text2);
  border-color: var(--border);
}
.btn-outline:hover { border-color: var(--accent-lt); color: var(--accent-lt); background: var(--accent-xlt); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 7px; }
.btn-success { color: var(--green) !important; border-color: rgba(63,185,80,.3) !important; }

/* ── Options row ───────────────────────────────────────────── */
.options-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.opt-btn {
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  transition: all .15s;
}
.opt-btn:hover { border-color: var(--accent-lt); color: var(--accent-lt); }
.opt-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Textarea / output ─────────────────────────────────────── */
textarea, .output-area {
  width: 100%;
  min-height: 200px;
  padding: 16px 18px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  border: none;
  outline: none;
  resize: vertical;
  caret-color: var(--accent-lt);
}
textarea::placeholder { color: var(--muted); }
.output-area {
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--cyan);
  cursor: text;
  user-select: text;
}

.io-divider {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px;
  background: var(--surface2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  gap: 8px;
  flex-wrap: wrap;
}
.io-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.output-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: var(--surface2);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}
.output-meta { font-size: 12px; color: var(--muted); font-family: monospace; }

/* ── Steps ─────────────────────────────────────────────────── */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
}
.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
}
.step-num {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--chip-bg);
  color: var(--chip-text);
  font-size: 13px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  font-family: monospace;
}
.step-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.step-card p  { font-size: 13px; color: var(--text2); line-height: 1.55; }

/* ── Section heading ───────────────────────────────────────── */
.section-head { width: 100%; }
.section-head h2 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.3px;
  color: var(--text);
  margin-bottom: 6px;
}
.section-head p { font-size: 15px; color: var(--text2); line-height: 1.65; }

/* ── Code block ────────────────────────────────────────────── */
.code-tabs { width: 100%; }
.code-tab-bar {
  display: flex;
  gap: 2px;
  padding: 0 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow-x: auto;
}
.code-tab {
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.code-tab:hover { color: var(--text2); }
.code-tab.active { color: var(--accent-lt); border-bottom-color: var(--accent-lt); }
.code-panel {
  display: none;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}
.code-panel.active { display: block; }
.code-panel pre {
  padding: 18px 20px;
  font-size: 13px;
  line-height: 1.65;
  overflow-x: auto;
  color: var(--text);
}
.c-kw  { color: #ff79c6; }  /* keyword */
.c-fn  { color: #50fa7b; }  /* function */
.c-str { color: #f1fa8c; }  /* string */
.c-cm  { color: #6272a4; }  /* comment */
.c-num { color: #bd93f9; }  /* number */
.c-var { color: #8be9fd; }  /* variable */

/* ── Prose ─────────────────────────────────────────────────── */
.prose {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 26px;
}
.prose h2 { font-size: 18px; font-weight: 800; letter-spacing: -.3px; margin-bottom: 12px; color: var(--text); }
.prose p  { font-size: 14px; color: var(--text2); line-height: 1.75; margin-bottom: 12px; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { color: var(--text); }
.prose code { background: var(--surface3); color: var(--cyan); padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.prose ul { padding-left: 20px; margin-bottom: 12px; }
.prose li { font-size: 14px; color: var(--text2); line-height: 1.7; margin-bottom: 4px; }

/* ── FAQ ───────────────────────────────────────────────────── */
.faq-list { width: 100%; display: flex; flex-direction: column; gap: 8px; }
details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .15s;
}
details:hover { border-color: var(--accent); }
details[open] { border-color: var(--accent-lt); }
summary {
  padding: 15px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  color: var(--text);
}
summary:hover { color: var(--accent-lt); }
summary::after { content: "+"; font-size: 18px; color: var(--muted); flex-shrink: 0; margin-left: 10px; }
details[open] summary::after { content: "−"; color: var(--accent-lt); }
.ans { padding: 0 18px 16px; font-size: 14px; color: var(--text2); line-height: 1.7; }
.ans code { background: var(--surface3); color: var(--cyan); padding: 2px 6px; border-radius: 4px; font-size: 12px; }

/* ── More tools grid ───────────────────────────────────────── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}
.tool-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 14px;
  transition: border-color .15s, background .15s, transform .1s;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  color: inherit;
}
.tool-tile:hover {
  border-color: var(--accent);
  background: var(--surface2);
  transform: translateY(-2px);
  text-decoration: none;
}
.tool-tile-icon { font-size: 24px; }
.tool-tile h3   { font-size: 13px; font-weight: 700; color: var(--text); }
.tool-tile p    { font-size: 12px; color: var(--muted); line-height: 1.5; }
.tool-tile-arrow { font-size: 12px; color: var(--accent-lt); margin-top: auto; font-weight: 600; }

/* ── Footer ────────────────────────────────────────────────── */
.site-footer {
  width: 100%;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 24px 24px 32px;
  margin-top: auto;
}
.site-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  font-size: 13px;
}
.footer-links a { color: var(--muted); transition: color .15s; }
.footer-links a:hover { color: var(--text); text-decoration: none; }
.footer-copy { font-size: 12px; color: var(--muted); }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 700px) {
  .site-nav .nav-link { display: none; }
  .site-nav .nav-link.home-link { display: flex; }
  .page { padding: 28px 16px 56px; gap: 24px; }
  .tool-hero h1 { font-size: 24px; }
  .steps-grid { grid-template-columns: 1fr; }
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
  .prose { padding: 20px 16px; }
}
@media (max-width: 420px) {
  .tools-grid { grid-template-columns: 1fr; }
  .tool-hero h1 { font-size: 20px; }
}
