/* ---- Design tokens (dark default, light via [data-theme="light"]) ---- */
:root {
  --bg: #0b1524;
  --bg-elev: #10203a;
  --card: #13233d;
  --text: #e8eef7;
  --muted: #9fb0c7;
  --border: #23374f;
  --accent: #f5a524;
  --accent-contrast: #1a1300;
  --radius: 12px;
  --max: 1120px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
:root[data-theme="light"] {
  --bg: #f5f7fb;
  --bg-elev: #ffffff;
  --card: #ffffff;
  --text: #14213a;
  --muted: #566379;
  --border: #dbe2ec;
  --accent: #e0910f;
  --accent-contrast: #ffffff;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
.container { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: 20px; }
main.container { padding-block: 32px 48px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { line-height: 1.2; }
img { max-width: 100%; height: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }

/* ---- Header ---- */
.site-header { background: var(--bg-elev); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.brand { font-weight: 800; font-size: 1.25rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.site-nav { display: flex; align-items: center; gap: 20px; margin-left: auto; }
.nav-toggle { display: none; background: none; border: 0; color: var(--text); font-size: 1.5rem; cursor: pointer; margin-left: auto; }

.nav-dropdown { position: relative; }
.nav-dropdown-btn { background: none; border: 0; color: var(--text); font-weight: 600; cursor: pointer; font-size: 1rem; }
.nav-dropdown-menu {
  position: absolute; top: 130%; left: 0; min-width: 240px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px; display: none; flex-direction: column; box-shadow: 0 12px 32px rgba(0,0,0,.35);
}
.nav-dropdown[data-open] .nav-dropdown-menu { display: flex; }
.nav-dropdown-menu a { color: var(--text); padding: 9px 12px; border-radius: 8px; }
.nav-dropdown-menu a:hover { background: var(--card); text-decoration: none; }

.nav-right { display: flex; align-items: center; gap: 14px; }
.lang-switcher { display: flex; gap: 8px; }
.lang-switcher a { color: var(--muted); font-weight: 600; font-size: .85rem; }
.theme-toggle { background: none; border: 1px solid var(--border); color: var(--text); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; }

/* ---- Hero + tool grid ---- */
.hero { text-align: center; padding: 24px 0 8px; }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 8px; }
.hero p { color: var(--muted); max-width: 640px; margin-inline: auto; }

.tool-grid { list-style: none; padding: 0; margin: 24px 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.tool-card a { display: flex; flex-direction: column; gap: 6px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; height: 100%; color: var(--text); transition: border-color .15s, transform .15s; }
.tool-card a:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.tool-card strong { font-size: 1.05rem; }
.tool-card span { color: var(--muted); font-size: .92rem; }

/* ---- Breadcrumb ---- */
.breadcrumb { font-size: .88rem; color: var(--muted); display: flex; gap: 8px; margin-bottom: 16px; }
.breadcrumb a { color: var(--muted); }

/* ---- Tool page ---- */
.tool-page { max-width: 860px; margin-inline: auto; }
.tool-head h1 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); margin: 0 0 6px; }
.lede { color: var(--muted); font-size: 1.05rem; margin-top: 0; }

.tool { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin: 20px 0; }
.tool-grid-2 { display: grid; gap: 24px; grid-template-columns: 1.4fr 1fr; align-items: start; }
.tool-form { display: flex; flex-direction: column; gap: 14px; }
.tool-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .95rem; }
.tool-form small { font-weight: 400; color: var(--muted); }
input, textarea, output, select {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 11px 12px; font: inherit;
}
output { display: block; min-height: 44px; word-break: break-all; color: var(--accent); }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.input-with-select { display: flex; gap: 8px; }
.input-with-select input { flex: 1.4; }
.input-with-select select { flex: 1; }

.tool-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { background: var(--accent); color: var(--accent-contrast); border: 0; border-radius: 8px; padding: 11px 18px; font-weight: 700; cursor: pointer; }
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 11px 18px; font-weight: 600; cursor: pointer; }
.btn-ghost:hover { border-color: var(--accent); text-decoration: none; }

.tool-qr { text-align: center; }
.tool-qr h2 { font-size: 1rem; margin: 0 0 10px; }
.qr-box { background: #fff; border-radius: var(--radius); min-height: 200px; display: grid; place-items: center; padding: 12px; }
.qr-box img { display: block; }

.tool-form label.checkbox { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; }
.tool-form label.checkbox input { width: auto; }
.tool-form input[type="range"] { padding: 0; }
.mode-group { display: flex; flex-direction: column; gap: 14px; }

.tool-result-panel { display: flex; flex-direction: column; gap: 14px; }
.tool-result-panel label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .95rem; }
.strength-line { margin: 0; font-size: .95rem; color: var(--muted); }
.strength-line strong { color: var(--accent); }
.tool-disclaimer { margin: 4px 0 0; font-size: .85rem; color: var(--muted); line-height: 1.5; }

.stats-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); margin-top: 18px; }
.stat-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; text-align: center; }
.stat-card strong { display: block; font-size: 1.5rem; color: var(--accent); }
.stat-card span { font-size: .85rem; color: var(--muted); }

/* ---- Long-form content ---- */
.tool-content, .prose { margin-top: 28px; }
.tool-content h2, .prose h2 { margin-top: 28px; }
.faq details { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; background: var(--bg-elev); }
.faq summary { cursor: pointer; font-weight: 600; }

.related { margin-top: 36px; }

/* ---- Ads (reserve space to avoid layout shift) ---- */
.ad { margin: 28px 0; min-height: 100px; display: grid; place-items: center; }
.ad-placeholder { min-height: 100px; border: 1px dashed var(--border); color: var(--muted); border-radius: var(--radius); font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; }

/* ---- Footer ---- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-elev); margin-top: 40px; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; padding-block: 20px; }
.footer-brand { color: var(--muted); }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); font-size: .9rem; }

/* ---- Consent banner ---- */
.consent { position: fixed; inset: auto 16px 16px 16px; max-width: 520px; margin-inline: auto; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: 0 16px 40px rgba(0,0,0,.4); z-index: 40; }
.consent p { margin: 0 0 12px; font-size: .92rem; color: var(--muted); }
.consent-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---- Responsive ---- */
@media (max-width: 760px) {
  .tool-grid-2 { grid-template-columns: 1fr; }
  .nav-toggle { display: block; }
  .site-nav { display: none; position: absolute; top: 60px; left: 0; right: 0; flex-direction: column; align-items: flex-start; gap: 12px; background: var(--bg-elev); border-bottom: 1px solid var(--border); padding: 16px 20px; }
  .site-nav[data-open] { display: flex; }
  .site-nav { margin-left: 0; }
}
