/* «Тулбокс» — общие стили. Визуальный язык Gravity UI (gravity-ui.com): тёплый
   янтарный акцент, тёплый тёмный фон, радиусы 6/8px, Inter. Mobile-first,
   тёмная тема через [data-theme] и prefers-color-scheme. */
:root {
  --bg: #f6f6f7;
  --surface: #ffffff;
  --text: rgba(0, 0, 0, 0.85);
  --muted: rgba(0, 0, 0, 0.5);
  --border: rgba(0, 0, 0, 0.1);
  --accent: #ffbe5c;
  --accent-hover: #e7ae56;
  --accent-soft: rgba(255, 190, 92, 0.16);
  --accent-ink: rgba(0, 0, 0, 0.82);
  --link: #3b6ef6;
  --link-hover: #2f5ad0;
  --danger: #db3b21;
  --success: #2aa65c;
  --radius: 8px;
  --radius-s: 6px;
  --shadow: 0 1px 2px rgba(20, 20, 22, 0.06), 0 4px 12px rgba(20, 20, 22, 0.04);
}
[data-theme="dark"] {
  --bg: #221d22;
  --surface: #2b252c;
  --text: rgba(255, 255, 255, 0.85);
  --muted: rgba(255, 255, 255, 0.5);
  --border: rgba(255, 255, 255, 0.15);
  --accent: #ffbe5c;
  --accent-hover: #ffcb7d;
  --accent-soft: rgba(255, 190, 92, 0.2);
  --link: #85a6ff;
  --link-hover: #a3bcff;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #221d22;
    --surface: #2b252c;
    --text: rgba(255, 255, 255, 0.85);
    --muted: rgba(255, 255, 255, 0.5);
    --border: rgba(255, 255, 255, 0.15);
    --accent: #ffbe5c;
    --accent-hover: #ffcb7d;
    --accent-soft: rgba(255, 190, 92, 0.2);
    --link: #85a6ff;
    --link-hover: #a3bcff;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
}
.container { max-width: 960px; margin: 0 auto; padding: 0 16px; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.logo { font-weight: 700; font-size: 18px; color: var(--text); }
.logo:hover { text-decoration: none; }
.header-nav { display: flex; align-items: center; gap: 14px; }
.header-nav a { font-size: 15px; }
#theme-toggle {
  background: none; border: 1px solid var(--border); border-radius: var(--radius-s);
  font-size: 16px; padding: 4px 8px; cursor: pointer; color: var(--text);
}

/* Hero + поиск */
.hero { text-align: center; padding: 32px 0 8px; }
.hero h1 { font-size: 28px; margin: 0 0 8px; }
.tool-search {
  width: 100%; max-width: 480px; margin-top: 16px;
  padding: 12px 16px; font-size: 16px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
}
.tool-search:focus { outline: 2px solid var(--link); border-color: transparent; }

/* Карточки инструментов */
.category-section h2 { font-size: 20px; margin: 28px 0 12px; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.card {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  color: var(--text); box-shadow: var(--shadow);
  transition: transform 0.12s, border-color 0.12s;
}
.card:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--accent-hover); }
.card-icon { font-size: 26px; }
.card small { color: var(--muted); }
.card-mini { flex-direction: row; align-items: center; gap: 12px; }
.card-mini span:last-child { display: flex; flex-direction: column; }
.no-results { text-align: center; color: var(--muted); padding: 32px 0; }

/* Страница инструмента */
.breadcrumbs { font-size: 14px; color: var(--muted); margin: 16px 0 4px; }
.breadcrumbs span { margin: 0 4px; }
h1 { font-size: 26px; margin: 8px 0 4px; }
.subtitle { color: var(--muted); margin: 0 0 20px; }
.article-updated { color: var(--muted); font-size: 13px; margin-top: 20px; }
.category-section h2 a { color: inherit; text-decoration: none; }
.category-section h2 a:hover { text-decoration: underline; }
.tool-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}

/* Формы */
label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
input[type="text"], input[type="number"], input[type="search"], input[type="url"], input[type="date"], input[type="time"], textarea, select {
  width: 100%; padding: 10px 12px; font-size: 16px; font-family: inherit;
  border: 1px solid var(--border); border-radius: var(--radius-s);
  background: var(--bg); color: var(--text);
}
textarea { resize: vertical; min-height: 120px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--link); border-color: transparent; }
input[type="range"] { width: 100%; accent-color: var(--accent-hover); }
input[type="color"] { width: 48px; height: 36px; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--bg); cursor: pointer; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent-hover); width: 16px; height: 16px; }

.field { margin-bottom: 14px; }
.field-row { display: flex; flex-wrap: wrap; gap: 12px; }
.field-row .field { flex: 1; min-width: 140px; margin-bottom: 0; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: 15px; cursor: pointer; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; font-size: 15px; font-weight: 600; font-family: inherit;
  border: none; border-radius: var(--radius-s); cursor: pointer;
  background: var(--accent); color: var(--accent-ink);
  transition: background 0.12s;
}
.btn:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--accent-soft); color: var(--text); }
.btn-secondary:hover { background: var(--border); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.result-box {
  margin-top: 16px; padding: 14px; border-radius: var(--radius-s);
  background: var(--bg); border: 1px dashed var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px;
  word-break: break-all; white-space: pre-wrap;
}
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.error-text { color: var(--danger); font-size: 14px; margin-top: 8px; }
.success-text { color: var(--success); font-size: 14px; margin-top: 8px; }

/* Статистика (счётчики и т.п.) */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 16px; }
.stat {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-s);
  padding: 10px 12px; text-align: center;
}
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 13px; color: var(--muted); }

/* Таблицы результатов */
.result-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 14px; }
.result-table th, .result-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.result-table td:last-child { text-align: right; }

/* SEO-статья и FAQ */
.seo-article { margin-top: 32px; }
.seo-article h2 { font-size: 21px; margin: 28px 0 10px; }
.seo-article p, .seo-article li { color: var(--text); }
.seo-article table {
  width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 15px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s);
  overflow: hidden;
}
.seo-article th, .seo-article td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.seo-article thead th { background: var(--accent-soft); font-weight: 600; }
.seo-article tbody tr:last-child td { border-bottom: none; }
.faq-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s);
  padding: 12px 16px; margin-bottom: 8px;
}
.faq-item summary { font-weight: 600; cursor: pointer; }
.faq-item p { margin: 10px 0 2px; color: var(--muted); }

.related { margin-top: 32px; }
.related h2 { font-size: 20px; }

/* Рекламные места (замените содержимое кодом сети) */
.ad-slot {
  margin: 28px 0; min-height: 90px;
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--border); border-radius: var(--radius);
  color: var(--muted); font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase;
}

/* Footer */
.site-footer { margin-top: 48px; padding: 28px 0; border-top: 1px solid var(--border); background: var(--surface); }
.footer-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 16px; font-size: 14px; margin-bottom: 16px; }
.footer-note { font-size: 13px; color: var(--muted); margin: 0; }

/* QR-специфика */
.qr-layout { display: grid; grid-template-columns: 1fr; gap: 20px; }
.qr-preview { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.qr-preview canvas { max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: var(--radius-s); background: #fff; }
.color-row { display: flex; align-items: center; gap: 10px; }
.style-options { display: flex; gap: 8px; flex-wrap: wrap; }
.style-options label {
  border: 1px solid var(--border); border-radius: var(--radius-s); padding: 8px 12px;
  font-weight: 400; cursor: pointer; display: flex; gap: 6px; align-items: center;
}
.style-options input:checked + span { color: var(--accent); font-weight: 600; }

/* Список файлов (сжатие изображений) */
.file-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px;
}
.file-item img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.file-meta { flex: 1; min-width: 0; }
.file-meta .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta .sizes { color: var(--muted); }
.savings { color: var(--success); font-weight: 600; }

.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 32px 16px; text-align: center; color: var(--muted); cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }

/* Карта мира */
.map-layout { display: grid; grid-template-columns: 1fr; gap: 16px; }
.map-wrap { position: relative; }
.map-wrap svg { width: 100%; height: auto; display: block; }
.wm-country { fill: var(--border); stroke: var(--surface); stroke-width: 0.4; cursor: pointer; transition: fill 0.1s; }
.wm-country:hover { fill: var(--accent-hover); }
.wm-nodata { cursor: default; }
.wm-nodata:hover { fill: var(--border); }
.wm-selected { fill: var(--accent-hover); }
.map-tooltip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 10px; font-size: 14px; box-shadow: var(--shadow); white-space: nowrap;
}
.country-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.country-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.country-flag { font-size: 34px; line-height: 1; }
.country-head h3 { margin: 0; font-size: 20px; }

/* Палитры и градиенты */
.palette-row { display: flex; border-radius: var(--radius); overflow: hidden; min-height: 180px; }
.palette-color { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; padding: 12px 4px; cursor: pointer; border: none; font-family: inherit; }
.palette-color code { font-size: 13px; background: rgba(0,0,0,0.35); color: #fff; padding: 2px 6px; border-radius: 6px; }
.palette-color .lock { font-size: 16px; opacity: 0.85; }
.gradient-preview { height: 180px; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 14px; }
.contrast-preview { border-radius: var(--radius); padding: 20px; margin-top: 14px; border: 1px solid var(--border); }
.contrast-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.badge { padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.badge-pass { background: rgba(46, 158, 91, 0.15); color: var(--success); }
.badge-fail { background: rgba(214, 69, 69, 0.15); color: var(--danger); }

/* Сравнение текстов */
.diff-result { margin-top: 14px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; line-height: 1.5; }
.diff-line { white-space: pre-wrap; word-break: break-word; padding: 1px 8px; border-radius: 4px; }
.diff-add { background: rgba(46, 158, 91, 0.16); color: var(--success); }
.diff-del { background: rgba(214, 69, 69, 0.14); color: var(--danger); text-decoration: line-through; }

/* Десктоп */
@media (min-width: 720px) {
  .map-layout { grid-template-columns: 1fr 280px; align-items: start; }
  .hero h1 { font-size: 34px; }
  h1 { font-size: 30px; }
  .tool-panel { padding: 28px; }
  .qr-layout { grid-template-columns: 1fr 320px; align-items: start; }
}
