/* FreeAITools design system. System fonts only, no external requests. */
:root {
  --bg: #f6f7f2; --surface: #ffffff; --ink: #12151f; --muted: #556070; --line: #dfe2d6; --soft: #eef0e6;
  --brand: #3b2fe0; --brand-ink: #2a20b8; --accent: #c6ff3d; --accent-hover: #b4f01f; --danger: #b3261e; --warn-bg: #fff6d6; --warn-line: #e5c75a; --ok: #1b7a3a;
  --ig: #3b2fe0; --ig-bg: #ecebff; --tt: #0b6f6a; --tt-bg: #d8f3f0; --cr: #8a5a00; --cr-bg: #fdf0d2;
  --radius: 14px; --shadow: 0 1px 2px rgba(18, 21, 31, .06), 0 6px 18px rgba(18, 21, 31, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1118; --surface: #161a24; --ink: #eef0f6; --muted: #a6adbd; --line: #2a3040; --soft: #1d2230;
    --brand: #a5adff; --brand-ink: #c3c8ff; --danger: #ff8a80; --warn-bg: #2b2610; --warn-line: #6b5a1c; --ok: #6fd58b;
    --ig: #a5adff; --ig-bg: #23244a; --tt: #66d9d1; --tt-bg: #12332f; --cr: #f2c36b; --cr-bg: #3a2e12;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); font-size: 1rem; line-height: 1.6; color: var(--ink); background: var(--bg); }
img, svg { max-width: 100%; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-ink); }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .6rem; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); font-weight: 800; letter-spacing: -.025em; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.75rem); font-weight: 750; }
h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0 0 1rem; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -60px; background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: 8px; z-index: 100; }
.skip-link:focus { top: 8px; }
.wrap { width: min(1120px, 100% - 2rem); margin-inline: auto; }
.wrap.narrow { width: min(780px, 100% - 2rem); }
[hidden] { display: none !important; }

/* header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.25rem; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.brand b { background: var(--accent); color: #12151f; padding: 0 .3rem; border-radius: 6px; margin-left: 1px; }
.site-nav ul { display: flex; gap: .25rem; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.site-nav a { display: block; padding: .5rem .8rem; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 600; }
.site-nav a:hover { background: var(--soft); }
.site-nav a[aria-current="page"] { background: var(--soft); box-shadow: inset 0 -3px 0 var(--accent); }
.menu-btn { display: none; background: none; border: 1px solid var(--line); border-radius: 10px; padding: .5rem; color: var(--ink); cursor: pointer; }
@media (max-width: 760px) {
  .js .menu-btn { display: inline-flex; }
  .js .site-nav { display: none; width: 100%; padding-bottom: .75rem; }
  .js .site-nav.open { display: block; }
  .js .site-nav ul { flex-direction: column; }
}

/* buttons / forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; font: inherit; font-weight: 700; padding: .7rem 1.2rem; border-radius: 10px; border: 2px solid var(--ink); cursor: pointer; text-decoration: none; line-height: 1.2; min-height: 44px; transition: background-color .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #12151f; border-color: #12151f; }
.btn-primary:hover { background: var(--accent-hover); color: #12151f; }
@media (prefers-color-scheme: dark) { .btn-primary { border-color: var(--accent); } }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--soft); color: var(--ink); }
.btn-sm { padding: .4rem .8rem; min-height: 36px; font-size: .9rem; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); text-decoration: underline; cursor: pointer; }
.field { margin-bottom: 1.1rem; }
.field label, .fieldset legend { display: block; font-weight: 650; margin-bottom: .35rem; }
.req { color: var(--danger); }
input[type=text], input[type=number], input[type=date], input[type=search], select, textarea { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; padding: .65rem .8rem; min-height: 44px; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
[aria-invalid="true"] { border-color: var(--danger) !important; }
.hint { color: var(--muted); font-size: .9rem; margin: .3rem 0 0; }
.field-error, .form-error { color: var(--danger); font-weight: 600; font-size: .92rem; margin: .35rem 0 0; }
.check { display: flex; align-items: center; gap: .6rem; font-weight: 500 !important; margin-bottom: .35rem; cursor: pointer; }
.check input { width: 1.15rem; height: 1.15rem; accent-color: var(--brand); flex: none; }
.fieldset { border: 1.5px solid var(--line); border-radius: 10px; padding: .75rem 1rem .5rem; margin-inline: 0; min-width: 0; }
.fieldset legend { padding: 0 .4rem; }

/* hero / home */
.hero { padding: clamp(2.5rem, 7vw, 5rem) 0 2.5rem; background: linear-gradient(180deg, var(--surface), var(--bg)); border-bottom: 1px solid var(--line); }
.eyebrow { display: inline-block; font-weight: 700; font-size: .85rem; color: var(--muted); background: var(--soft); padding: .3rem .75rem; border-radius: 999px; margin-bottom: 1rem; }
.hero h1 { max-width: 18ch; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 62ch; }
.search { display: flex; gap: .5rem; max-width: 640px; margin: 1.5rem 0 1rem; }
.search input { flex: 1; }
.search-inline { margin: 1rem 0 .5rem; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: 0; }
.chips a { display: inline-block; padding: .4rem .9rem; border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600; font-size: .92rem; }
.chips a:hover { border-color: var(--ink); }
.section { padding: 3rem 0; }
.section.alt { background: var(--surface); border-block: 1px solid var(--line); }
.section-tight { margin: 2.5rem 0; }
.page-head { padding: 1.25rem 0 1.5rem; }
.page-head h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); }

/* cards */
.tool-grid { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.tool-card { display: flex; gap: .9rem; height: 100%; padding: 1rem; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.tool-card:hover { border-color: var(--ink); transform: translateY(-2px); color: var(--ink); }
.tool-ico { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; }
.tool-ico-instagram { background: var(--ig-bg); color: var(--ig); } .tool-ico-tiktok { background: var(--tt-bg); color: var(--tt); } .tool-ico-creator { background: var(--cr-bg); color: var(--cr); }
.tool-body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.tool-cat { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tool-name { font-size: 1.02rem; margin: 0; }
.tool-sum { color: var(--muted); font-size: .93rem; }
.cat-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 1rem; }
.cat-card { background: var(--bg); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 1.4rem; }
.cat-card h3 a { color: var(--ink); text-decoration: none; font-size: 1.25rem; }
.cat-links { padding-left: 1.1rem; margin: 0 0 1rem; color: var(--muted); } .cat-links li { margin: .15rem 0; }
.more-link { font-weight: 700; display: inline-flex; gap: .3rem; align-items: center; }
.points { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-top: 1rem; }
.guide-list { padding-left: 1.2rem; max-width: 74ch; } .guide-list li { margin-bottom: .5rem; }
.inline-links { list-style: none; padding: 0; display: flex; gap: 1rem; flex-wrap: wrap; }
.dir-section { margin-bottom: 2rem; }
.empty, .empty-state { color: var(--muted); }
.empty { padding: 2rem 0; }

/* breadcrumbs */
.breadcrumbs { padding-top: 1rem; font-size: .9rem; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .3rem; padding: 0; margin: 0; color: var(--muted); }
.breadcrumbs li + li::before { content: "/"; margin-right: .3rem; opacity: .6; }
.breadcrumbs a { color: var(--muted); } .breadcrumbs a:hover { color: var(--ink); }

/* tool page */
.tool { background: var(--surface); border: 1.5px solid var(--line); border-radius: 18px; padding: clamp(1rem, 3vw, 1.75rem); box-shadow: var(--shadow); margin-bottom: 2rem; }
.fields { display: grid; gap: 0 1.25rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.fields .field:has(textarea), .fields .fieldset { grid-column: 1 / -1; }
.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .5rem; }
.results { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 2px dashed var(--line); outline: none; }
.res-toolbar { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.res-note, .res-summary { color: var(--muted); font-size: .95rem; }
.result-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .9rem; }
.result-item { border: 1.5px solid var(--line); border-radius: 12px; padding: .75rem; background: var(--bg); }
.res-edit { border: 0; background: transparent; padding: .25rem; min-height: 0; width: 100%; resize: none; overflow: hidden; }
.res-edit:focus { background: var(--surface); outline: 2px solid var(--brand); }
.res-big { border: 1.5px solid var(--line); background: var(--bg); padding: .75rem; overflow: auto; min-height: 140px; resize: vertical; }
.res-detail { color: var(--muted); font-size: .93rem; margin: .25rem .25rem .5rem; }
.res-row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: .4rem; }
.res-meta { color: var(--muted); font-size: .85rem; margin-right: auto; }
.res-link { font-size: .9rem; }
.warnings { list-style: none; padding: .6rem .9rem; margin: 0 0 1rem; background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 10px; }
.notice { background: var(--warn-bg); border: 1.5px solid var(--warn-line); border-radius: 12px; padding: .9rem 1.1rem; margin-bottom: 1.25rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .6rem; margin: 1rem 0; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; }
.stat dt { font-size: .8rem; color: var(--muted); } .stat dd { margin: 0; font-weight: 750; font-size: 1.2rem; }
.meter { margin: .75rem 0; } .meter-head { display: flex; justify-content: space-between; font-size: .95rem; margin-bottom: .25rem; }
.bar { height: 12px; background: var(--soft); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.bar-fill { display: block; height: 100%; background: var(--ok); transition: width .12s; }
.meter.near .bar-fill { background: #d99a00; } .meter.over .bar-fill { background: var(--danger); } .meter.over strong { color: var(--danger); }
.fold { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: .75rem 1rem; margin: 1rem 0; }
.fold-label { font-size: .8rem; color: var(--muted); margin: 0 0 .25rem; } .fold-text { margin: 0; } .preline { white-space: pre-line; }
.metric-grid { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.metric { background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: 1rem; display: flex; flex-direction: column; gap: .2rem; }
.metric.primary { background: var(--accent); border-color: #12151f; color: #12151f; } .metric.primary .metric-label, .metric.primary .metric-hint { color: #2b3140; }
.metric-label { font-size: .85rem; color: var(--muted); font-weight: 650; } .metric-value { font-size: 2rem; letter-spacing: -.02em; line-height: 1.1; } .metric-hint { font-size: .82rem; color: var(--muted); }
.formula { margin-top: 1.25rem; padding: .9rem 1rem; border-left: 4px solid var(--brand); background: var(--bg); border-radius: 0 10px 10px 0; font-family: var(--mono); font-size: .9rem; }
.formula h3 { font-family: var(--font); font-size: 1rem; } .formula p { margin: .25rem 0; }
.res-notes { color: var(--muted); font-size: .95rem; padding-left: 1.2rem; }
.g-title { font-size: 1.3rem; } .g-list { padding-left: 1.25rem; } .g-list li { margin-bottom: .35rem; } .g-links { padding-left: 1.1rem; } .g-links li { margin-bottom: .5rem; }
.toast { position: fixed; left: 50%; bottom: 1.25rem; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; font-weight: 600; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* long-form content */
.prose { max-width: 74ch; }
.prose-sec { margin-bottom: 2rem; }
.prose h2 { margin-top: 2.2rem; } .prose h3 { margin-top: 1.4rem; font-size: 1.05rem; }
.prose ul, .prose ol { padding-left: 1.3rem; } .prose li { margin-bottom: .4rem; }
.legal h1 { margin-top: 1rem; }
.ex-inputs { color: var(--muted); } .ex-list { list-style: none; padding: 0; display: grid; gap: .6rem; }
.ex-pre { white-space: pre-wrap; font-family: var(--font); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; margin: 0 0 .3rem; }
.ex-meta { font-size: .85rem; color: var(--muted); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.data th, table.data td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data thead th { background: var(--soft); font-size: .85rem; white-space: nowrap; }
table.data tbody tr:last-child td, table.data tbody tr:last-child th { border-bottom: 0; }
@media (max-width: 640px) {
  table.stack thead { position: absolute; left: -9999px; }
  table.stack tr { display: block; border-bottom: 2px solid var(--line); padding: .5rem 0; }
  table.stack td { display: flex; gap: .75rem; border: 0; padding: .25rem .75rem; }
  table.stack td::before { content: attr(data-label); font-weight: 700; min-width: 6.5rem; color: var(--muted); flex: none; }
}

/* ads: always labelled, spaced away from controls, never styled like a control */
.ad-slot { margin: 3rem 0; padding: .75rem; border: 1px dashed var(--line); border-radius: 10px; text-align: center; min-height: 0; clear: both; }
.ad-label { font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 .4rem; }

/* consent + footer */
.consent { position: fixed; z-index: 70; right: 1rem; bottom: 1rem; width: min(440px, calc(100% - 2rem)); background: var(--surface); border: 2px solid var(--ink); border-radius: 14px; padding: 1rem 1.1rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); }
.consent h2 { font-size: 1.05rem; } .consent p { font-size: .92rem; }
.consent-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.site-footer { background: var(--surface); border-top: 1px solid var(--line); margin-top: 4rem; padding: 2.5rem 0 2rem; font-size: .95rem; }
.footer-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.footer-h { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.site-footer ul { list-style: none; padding: 0; margin: 0; } .site-footer li { margin: .3rem 0; }
.site-footer a { color: var(--ink); }
.footer-note { color: var(--muted); font-size: .88rem; margin: 1.75rem 0 .75rem; max-width: 80ch; }
.footer-legal { display: flex; gap: 1.25rem; flex-wrap: wrap; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media print { .site-header, .site-footer, .consent, .ad-slot, .form-actions { display: none !important; } }

/* ---- articles ---- */
.post-grid { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.post-card { display: flex; flex-direction: column; gap: .4rem; height: 100%; padding: 1.1rem; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius, 14px); color: var(--ink); text-decoration: none; transition: transform .12s, border-color .12s; }
.post-card:hover { border-color: var(--ink); transform: translateY(-2px); color: var(--ink); }
.post-meta { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.post-type { font-size: .75rem; color: var(--muted); }
.post-title { font-size: 1.1rem; margin: 0; line-height: 1.3; }
.post-date { margin-top: auto; padding-top: .4rem; font-size: .82rem; color: var(--muted); }
.byline { color: var(--muted); font-size: .92rem; margin: .5rem 0 0; }
.badge-ok { background: var(--accent); color: #12151f; font-weight: 700; font-size: .78rem; padding: .1rem .5rem; border-radius: 999px; }
.toc { background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; padding: .9rem 1.2rem; margin: 1.25rem 0; max-width: 74ch; }
.toc-h { font-size: 1rem; margin: 0 0 .4rem; }
.toc ol { margin: 0; padding-left: 1.2rem; } .toc li { margin-bottom: .25rem; }
.post-body h2 { scroll-margin-top: 1rem; }
.post-body table { font-size: .93rem; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 2rem 0; color: var(--muted); }
.post .notice { max-width: 74ch; }

/* ---- cover images ---- */
.post-card.has-thumb { padding-top: 0; overflow: hidden; }
.post-thumb { display: block; width: calc(100% + 2.2rem); max-width: none; margin: 0 -1.1rem .35rem; aspect-ratio: 1200 / 630; height: auto; object-fit: cover; background: var(--line); }
.post-cover { margin: 1.25rem 0; max-width: 74ch; }
.post-cover img { display: block; width: 100%; height: auto; aspect-ratio: 1200 / 630; object-fit: cover; border-radius: 12px; border: 1.5px solid var(--line); background: var(--line); }
