/* ─── Design Tokens ──────────────────────────────────────────────── */
:root {
  --bg:           #f0f2f7;
  --card:         #ffffff;
  --txt:          #0b1220;
  --muted:        #5b667a;
  --accent:       #1e66ff;
  --accent-hover: #1a55d9;
  --border:       #e5e8f0;
  --row:          #f7f8fc;
  --danger:       #e53935;
  --success:      #1fb86a;
  --shadow:       0 2px 6px rgba(16,24,40,.04), 0 10px 24px rgba(16,24,40,.08);
}
[data-theme="dark"] {
  --bg:           #0d1117;
  --card:         #161b22;
  --txt:          #e6edf3;
  --muted:        #7d8590;
  --accent:       #4d90ff;
  --accent-hover: #6aa3ff;
  --border:       #30363d;
  --row:          #1c2128;
  --danger:       #ff6b6b;
  --success:      #3dd68c;
  --shadow:       0 2px 8px rgba(0,0,0,.35), 0 10px 24px rgba(0,0,0,.5);
}

/* ─── Reset & Base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font: 14px/1.5 system-ui, "Segoe UI", Roboto, Arial, sans-serif;
  transition: background .2s, color .2s;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }

/* ─── Site Header ────────────────────────────────────────────────── */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.site-header-left {
  display: flex;
  align-items: center;
  gap: 0;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -.3px;
  color: var(--txt);
  white-space: nowrap;
}
.site-logo-mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: radial-gradient(120% 120% at 30% 20%, #49b0ff 0%, #1e66ff 60%, #1a4fe6 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.3), 0 3px 8px rgba(30,102,255,.25);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.site-logo-mark svg { width: 17px; height: 17px; color: #fff; }
.site-logo-text span { color: var(--accent); }
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  margin-left: 4px;
}
.breadcrumb-sep {
  color: var(--border);
  font-size: 16px;
  line-height: 1;
  font-weight: 300;
}
.breadcrumb-current {
  color: var(--txt);
  font-weight: 600;
  font-size: 13px;
}
.theme-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--row);
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.theme-btn:hover { background: var(--border); color: var(--txt); }
.theme-btn svg { width: 18px; height: 18px; }
.theme-btn .icon-moon { display: block; }
.theme-btn .icon-sun  { display: none;  }
[data-theme="dark"] .theme-btn .icon-moon { display: none;  }
[data-theme="dark"] .theme-btn .icon-sun  { display: block; }

/* ─── Page Wrapper & Card ────────────────────────────────────────── */
.page-wrap { flex: 1; }
.wrap { max-width: 1200px; margin: 36px auto; padding: 0 16px; }
.card {
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 24px;
  border: 1px solid var(--border);
}

/* ─── Tool Hero ──────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.hero { display: flex; align-items: center; gap: 18px; }
.hero-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: grid; place-items: center; flex-shrink: 0;
  /* background and box-shadow set per-tool in inline <style> */
}
.hero-icon svg { width: 30px; height: 30px; color: #fff; }
.hero-text h1 { margin: 0 0 4px; font-size: 22px; font-weight: 700; letter-spacing: .2px; }
.hero-text p  { margin: 0; font-size: 13px; color: var(--muted); }

/* ─── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 700; font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, opacity .15s, transform .1s;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 3px 8px rgba(30,102,255,.25);
}
.btn-primary:not(:disabled):hover { background: var(--accent-hover); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
  padding: 6px 8px;
}
.btn-ghost:not(:disabled):hover { color: var(--txt); background: var(--row); }

/* ─── Spinner ────────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 17px; height: 17px; flex-shrink: 0;
  border: 2.5px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .65s linear infinite;
}

/* ─── Pills ──────────────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 12px; font-weight: 700;
  border: 1.5px solid transparent;
}
.pill-success {
  background: rgba(31,184,106,.12);
  color: #1a9a52;
  border-color: rgba(31,184,106,.3);
}
.pill-danger {
  background: rgba(229,57,53,.1);
  color: #c62828;
  border-color: rgba(229,57,53,.25);
}
.pill-warn {
  background: rgba(217,119,6,.1);
  color: #b45309;
  border-color: rgba(217,119,6,.25);
}
[data-theme="dark"] .pill-success { background: rgba(61,214,140,.15);  color: var(--success); border-color: rgba(61,214,140,.3); }
[data-theme="dark"] .pill-danger  { background: rgba(255,107,107,.15); color: var(--danger);  border-color: rgba(255,107,107,.3); }
[data-theme="dark"] .pill-warn    { background: rgba(251,191,36,.12);  color: #fbbf24;        border-color: rgba(251,191,36,.3); }

/* ─── Site Footer ────────────────────────────────────────────────── */
.site-footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  margin-top: 20px;
}
.site-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--txt);
}
.footer-brand-mark {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: radial-gradient(120% 120% at 30% 20%, #49b0ff 0%, #1e66ff 60%, #1a4fe6 100%);
  display: grid; place-items: center;
}
.footer-brand-mark svg { width: 12px; height: 12px; color: #fff; }
.footer-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}
.footer-back:hover { opacity: .75; }
.footer-back svg { width: 14px; height: 14px; }
.footer-about { font-size: 13px; color: var(--muted); font-weight: 500; transition: color .15s; }
.footer-about:hover { color: var(--txt); }

/* ─── Search History (shared across tools) ──────────────────────── */
.history-wrap {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.history-wrap h2 {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.history-wrap h2::before {
  content: '';
  display: block;
  width: 3px;
  height: 14px;
  background: var(--accent);
  border-radius: 2px;
}
.history-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  font-size: 13px;
}
.history-table th {
  background: var(--row);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.history-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--txt);
  vertical-align: middle;
}
.history-table tr:last-child td { border-bottom: none; }
.history-table tr:hover td { background: var(--row); }
.history-domain {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  cursor: pointer;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.history-domain:hover { opacity: .8; }
.history-time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.history-clear {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}
.history-clear button {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.history-clear button:hover { color: var(--txt); }

/* ─── Privacy Badge ──────────────────────────────────────────────── */
.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1px;
  border-radius: 5px;
  padding: 2px 6px;
  cursor: default;
  vertical-align: middle;
  margin-left: 6px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.privacy-badge svg { width: 10px; height: 10px; flex-shrink: 0; }
.privacy-badge--local  { color: #1d4ed8; background: rgba(29,78,216,.1);  border-color: rgba(29,78,216,.18); }
.privacy-badge--api    { color: #15803d; background: rgba(21,128,61,.1);   border-color: rgba(21,128,61,.18); }
.privacy-badge--stored { color: #b45309; background: rgba(180,83,9,.1);    border-color: rgba(180,83,9,.18); }
[data-theme="dark"] .privacy-badge--local  { color: #93c5fd; background: rgba(147,197,253,.12); border-color: rgba(147,197,253,.2); }
[data-theme="dark"] .privacy-badge--api    { color: #86efac; background: rgba(134,239,172,.12); border-color: rgba(134,239,172,.2); }
[data-theme="dark"] .privacy-badge--stored { color: #fcd34d; background: rgba(252,211,77,.12);  border-color: rgba(252,211,77,.2); }

/* ─── Shared Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .wrap { margin: 12px auto; }
  .card { padding: 16px; border-radius: 14px; }
}
