:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #5b6170;
  --border: #e3e6ee;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef0ff;
  --pdf: #e5484d;
  --img: #12a594;
  --ok: #18794e;
  --ok-soft: #e9f9ef;
  --err: #cd2b31;
  --err-soft: #fff0f0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  --max: 1080px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a21;
    --text: #eceef3;
    --muted: #9aa1b2;
    --border: #2a2f3a;
    --primary: #7c74ff;
    --primary-hover: #948dff;
    --primary-soft: #23244a;
    --ok: #4cc38a;
    --ok-soft: #13261c;
    --err: #ff6369;
    --err-soft: #2d1415;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a { color: var(--primary); }
img { max-width: 100%; }
.container { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

/* Header / footer */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 16px; }
.logo { font-weight: 800; font-size: 1.2rem; text-decoration: none; color: var(--text); display: flex; align-items: center; gap: 8px; }
.logo-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: .9rem; }
.site-nav { display: flex; gap: 18px; }
.site-nav a { color: var(--muted); text-decoration: none; font-weight: 500; }
.site-nav a:hover { color: var(--text); }
@media (max-width: 560px) { .site-nav { display: none; } }

.site-footer { margin-top: 64px; padding: 32px 0; border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: .9rem; }
.site-footer .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 16px; }
.site-footer a { color: var(--muted); }

/* Hero */
.hero { text-align: center; padding: 48px 0 24px; }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.2; margin: 0 0 12px; }
.hero p { color: var(--muted); font-size: 1.1rem; margin: 0 auto; max-width: 640px; }
.badge-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.badge { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; font-size: .85rem; color: var(--muted); }

/* Tool grid */
.section-title { font-size: 1.25rem; margin: 36px 0 14px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tool-link {
  display: flex; gap: 14px; align-items: flex-start; padding: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s;
}
.tool-link:hover { border-color: var(--primary); transform: translateY(-2px); }
.tool-link strong { display: block; }
.tool-link span.desc { color: var(--muted); font-size: .88rem; line-height: 1.4; }
.tool-icon { flex: none; width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; font-size: 1.3rem; color: #fff; }
.tool-icon.pdf { background: var(--pdf); }
.tool-icon.img { background: var(--img); }

/* Tool page */
.breadcrumb { font-size: .85rem; color: var(--muted); margin-top: 20px; }
.breadcrumb a { color: var(--muted); }
.tool-hero { text-align: center; padding: 20px 0 8px; }
.tool-hero h1 { margin: 0 0 6px; font-size: clamp(1.6rem, 3.5vw, 2.2rem); }
.tool-hero p { margin: 0 auto; color: var(--muted); max-width: 620px; }

.tool-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin: 20px auto; max-width: 760px; }
.dropzone {
  border: 2px dashed var(--border); border-radius: 12px; padding: 36px 16px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-soft); }
.dropzone .big { font-size: 2.2rem; line-height: 1; }
.dropzone p { margin: 8px 0 0; color: var(--muted); }
.dropzone .hint { font-size: .85rem; }

.file-list { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-direction: column; gap: 8px; }
.file-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; font-size: .92rem; }
.file-list .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .size { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.icon-btn { border: 1px solid var(--border); background: transparent; color: var(--text); border-radius: 8px; width: 30px; height: 30px; cursor: pointer; font-size: .9rem; }
.icon-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.icon-btn:disabled { opacity: .35; cursor: default; }

.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 18px; }
.options:empty { display: none; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; }
.field > span { font-weight: 600; }
.field small { color: var(--muted); }
.field input[type=text], .field input[type=number], .field select {
  font: inherit; padding: 9px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg); color: var(--text);
}
.field input:focus, .field select:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: transparent; }
.field input[type=color] { width: 100%; height: 40px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg); padding: 3px; }
.field input[type=range] { accent-color: var(--primary); }
.field.wide { grid-column: 1 / -1; }
.radio-row { display: flex; flex-wrap: wrap; gap: 14px; }
.radio-row label, .check { display: flex; align-items: center; gap: 6px; font-weight: 400; cursor: pointer; }

.actions { margin-top: 20px; display: flex; justify-content: center; }
.btn { font: inherit; font-weight: 600; border: 0; border-radius: 10px; padding: 12px 26px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.btn.primary { background: var(--primary); color: #fff; font-size: 1.05rem; }
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn.secondary { background: var(--primary-soft); color: var(--primary); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.status { margin-top: 16px; padding: 10px 14px; border-radius: 10px; font-size: .92rem; display: none; }
.status.show { display: block; }
.status.info { background: var(--primary-soft); color: var(--text); }
.status.ok { background: var(--ok-soft); color: var(--ok); }
.status.err { background: var(--err-soft); color: var(--err); }
.progress { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress > div { height: 100%; width: 0; background: var(--primary); transition: width .2s; }

.results { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.results:empty { display: none; }
.result-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.result-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-item .size { color: var(--muted); font-size: .85rem; }
.results .all { align-self: center; margin-top: 6px; }

.privacy-note { text-align: center; color: var(--muted); font-size: .9rem; }

/* Article content */
.content { max-width: 760px; margin: 40px auto 0; }
.content h2 { font-size: 1.3rem; margin: 32px 0 10px; }
.content ol li, .content ul li { margin-bottom: 6px; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 10px 0 0; color: var(--muted); }
.page { max-width: 760px; margin: 0 auto; padding-top: 24px; }
.page h1 { font-size: 2rem; }

/* Ads: empty slots take no space until an ad (or local placeholder) fills them */
.ad-slot { max-width: 760px; margin: 18px auto; text-align: center; }
.ad-slot:empty { display: none; }
.ad-placeholder { border: 1px dashed var(--border); border-radius: 10px; padding: 28px; color: var(--muted); font-size: .85rem; }
