@import url('https://fonts.googleapis.com/css2?family=Geologica:wght@400;500;600;700;800&family=PT+Mono&display=swap');

:root {
  --paper: #e9ebe6;
  --paper-2: #f4f5f2;
  --card: #ffffff;
  --ink: #14171a;
  --ink-2: #5a6169;
  --ink-3: #8c9299;
  --line: #cbd0c8;
  --line-2: #e2e5df;
  --accent: #1f2ad4;
  --accent-2: #4a53ea;
  --signal: #ffd400;
  --ok: #1a7f4b;
  --warn: #b4471a;
  --r: 6px;
  --gap: 22px;
  --shadow: 0 1px 0 var(--line);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26'%3E%3Ccircle cx='13' cy='13' r='1' fill='%23c2c8bf'/%3E%3C/svg%3E");
  color: var(--ink);
  font-family: 'Geologica', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  font-weight: 400;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

h1, h2, h3 { font-weight: 700; letter-spacing: -0.035em; line-height: 1.1; margin: 0; }

.mono {
  font-family: 'PT Mono', ui-monospace, monospace;
  font-size: 11.5px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 22px; }

@media (max-width: 700px) {
  .wrap { padding: 0 28px; }
}

/* ---------- шапка ---------- */

.site-head {
  border-bottom: 1px solid var(--line);
  background: rgba(233, 235, 230, 0.92);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.site-head__in {
  display: flex;
  align-items: center;
  gap: 26px;
  min-height: 62px;
  flex-wrap: wrap;
  padding-top: 8px;
  padding-bottom: 8px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-weight: 800;
  letter-spacing: -0.04em;
  font-size: 20px;
}
.logo:hover { text-decoration: none; color: var(--accent); }
.logo__mark {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 4px solid var(--accent);
  border-right-color: transparent;
}
.site-nav { display: flex; gap: 18px; flex-wrap: wrap; margin-left: auto; }
.site-nav a {
  font-family: 'PT Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--ink); text-decoration: none; border-bottom-color: var(--line); }
.site-nav a[aria-current='page'] { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- заголовок страницы инструмента ---------- */

.tool-head { padding: 40px 0 26px; }
.tool-head__top { display: flex; align-items: center; gap: 16px; }
.tool-head__glyph { flex: none; width: 44px; height: 44px; color: var(--accent); }
.tool-head h1 { font-size: clamp(28px, 5vw, 44px); }
.tool-head p { max-width: 62ch; color: var(--ink-2); margin: 14px 0 0; }

/* ---------- рабочая область ---------- */

.work {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: var(--gap);
  align-items: start;
  padding-bottom: 70px;
}
.work--wide { grid-template-columns: minmax(0, 400px) minmax(0, 1fr); }
.work--single { grid-template-columns: minmax(0, 1fr); }

@media (max-width: 860px) {
  .work, .work--wide { grid-template-columns: minmax(0, 1fr); }
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px;
  box-shadow: 0 1px 2px rgba(20, 23, 26, 0.04);
}
.panel + .panel { margin-top: var(--gap); }
.panel__title {
  font-family: 'PT Mono', monospace;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-2);
  font-weight: 400;
}
.panel__title::before {
  content: '';
  width: 7px;
  height: 7px;
  flex: none;
  background: var(--accent);
}
.panel--sticky { position: sticky; top: 78px; }
@media (max-width: 860px) { .panel--sticky { position: static; } }

/* ---------- поля ---------- */

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field > label, .lab {
  display: block;
  font-family: 'PT Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 7px;
}
.field__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.field__val { font-family: 'PT Mono', monospace; font-size: 12px; color: var(--ink); }

input[type='text'], input[type='number'], select, textarea {
  width: 100%;
  font-family: 'Geologica', sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 9px 11px;
}
textarea { resize: vertical; line-height: 1.4; }
input[type='text']:focus, select:focus, textarea:focus, input[type='number']:focus {
  border-color: var(--accent);
  outline: none;
  background: var(--card);
}

input[type='range'] {
  width: 100%;
  accent-color: var(--accent);
  margin: 4px 0 0;
}

input[type='color'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: none;
  cursor: pointer;
}
input[type='color']::-webkit-color-swatch-wrapper { padding: 3px; }
input[type='color']::-webkit-color-swatch { border: none; border-radius: 2px; }
input[type='color']::-moz-color-swatch { border: none; border-radius: 2px; }

.colors { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* переключатели-сегменты */
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  font-family: 'PT Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 7px 11px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--ink-2);
  border-radius: 4px;
  cursor: pointer;
}
.seg button:hover { color: var(--ink); border-color: var(--ink-3); }
.seg button[aria-pressed='true'] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

/* ---------- кнопки ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Geologica', sans-serif;
  font-size: 15px;
  font-weight: 700;
  padding: 11px 18px;
  border-radius: 4px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  text-align: center;
}
.btn:hover { background: var(--accent-2); border-color: var(--accent-2); text-decoration: none; color: #fff; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: var(--paper-2); color: var(--ink); border-color: var(--ink-3); }
.btn--full { width: 100%; }
.btn--sm { font-size: 13px; padding: 8px 13px; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- зона загрузки ---------- */

.drop {
  border: 2px dashed var(--line);
  border-radius: var(--r);
  background: var(--paper-2);
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  color: var(--ink-2);
}
.drop:hover, .drop.is-over { border-color: var(--accent); background: #fff; color: var(--ink); }
.drop b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.drop small { font-size: 13px; }

/* ---------- код ---------- */

.code {
  font-family: 'PT Mono', monospace;
  font-size: 12.5px;
  line-height: 1.65;
  background: var(--ink);
  color: #e8ebe6;
  border-radius: 4px;
  padding: 14px 16px;
  overflow-x: auto;
  white-space: pre;
  margin: 0;
}
.code b { color: var(--signal); font-weight: 400; }

.copy-wrap { position: relative; }
.copy-wrap .btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 5px 10px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.12);
  border-color: transparent;
}
.copy-wrap .btn:hover { background: rgba(255, 255, 255, 0.24); }

/* ---------- мелочи ---------- */

.hint { font-size: 13px; color: var(--ink-2); margin: 10px 0 0; }
.checker {
  background-image:
    linear-gradient(45deg, var(--line-2) 25%, transparent 25%),
    linear-gradient(-45deg, var(--line-2) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--line-2) 75%),
    linear-gradient(-45deg, transparent 75%, var(--line-2) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.site-foot {
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.4);
  padding: 26px 0 40px;
  font-size: 13px;
  color: var(--ink-2);
}
.site-foot__in { display: flex; gap: 20px; flex-wrap: wrap; justify-content: space-between; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
