/* ===================== Exelento — общий стиль сайта ===================== */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

:root {
  --brand: #1a5296;
  --brand-dark: #123b6e;
  --brand-light: #eef0f3;
  --bg: #ffffff;
  --surface: #ffffff;
  --border: #ccc;
  --border-dark: #999;
  --text: #1a1a1a;
  --text-dim: #555;
  --text-faint: #888;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }

/* ---------- Header ---------- */
header.site {
  background: #f4f5f7;
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
}
header.site .inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
header.site .brand {
  font-size: 19px;
  font-weight: bold;
  color: var(--text);
  text-decoration: none;
}
header.site .brand span { color: var(--brand); }
header.site nav { margin-left: -16px; }
header.site nav a {
  margin-left: 16px;
  text-decoration: none;
  font-size: 13px;
  color: #333;
  white-space: nowrap;
}
header.site nav a:hover { text-decoration: underline; }

@media (max-width: 620px) {
  header.site nav { display: flex; flex-wrap: wrap; margin-left: 0; width: 100%; }
  header.site nav a { margin-left: 0; margin-right: 12px; }
}

/* ---------- Layout ---------- */
main { max-width: 1080px; margin: 0 auto; padding: 20px; }
main.narrow { max-width: 1080px; }

footer.site {
  max-width: 1080px;
  margin: 20px auto 0;
  padding: 18px 20px 40px;
  color: #777;
  font-size: 12px;
  border-top: 1px solid #ddd;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  max-width: 1080px;
  margin: 12px auto 0;
  padding: 0 20px;
  font-size: 12.5px;
  color: var(--text-faint);
}
.breadcrumb a { color: var(--text-dim); text-decoration: none; }
.breadcrumb a:hover { color: var(--brand); text-decoration: underline; }

/* ---------- Hero (homepage) ---------- */
.hero {
  max-width: 1080px;
  margin: 0 auto;
  padding: 26px 20px 10px;
}
.hero h1 {
  font-size: 22px;
  margin: 0 0 6px;
}
.hero p.lead {
  color: var(--text-dim);
  font-size: 13.5px;
  margin: 0 0 16px;
  max-width: 640px;
}
.hero .search-wrap { max-width: 340px; }
.hero .search-wrap input {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--border-dark);
  background: var(--surface);
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
}
#no-results {
  color: var(--text-faint);
  padding: 16px 0;
  display: none;
}

/* ---------- Category / calculator grid ---------- */
.category {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}
.category h2 {
  font-size: 16px;
  margin: 26px 0 4px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.category p.cat-desc {
  color: var(--text-dim);
  font-size: 12.5px;
  margin: 8px 0 14px;
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.calc-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 12px 14px;
  text-decoration: none;
  color: var(--text);
}
.calc-card:hover {
  border-color: var(--border-dark);
  background: #fafafa;
}
.calc-card h3 {
  margin: 0 0 4px;
  font-size: 13.5px;
  color: var(--brand);
}
.calc-card p {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.45;
}

/* small related-calculators variant, used at bottom of calculator pages */
.related { margin-top: 34px; }
.related .calc-grid { gap: 8px; }
.related .calc-card { padding: 8px 12px; }
.related .calc-card h3 { font-size: 12.5px; margin: 0; }

/* ---------- Cards used inside calculator pages ---------- */
.intro {
  padding: 14px 16px;
  background: #f9f9f9;
  border: 1px solid var(--border);
  margin-bottom: 22px;
  font-size: 13px;
  color: var(--text-dim);
}

section.card, div.calc-card-wrap {
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 26px;
  scroll-margin-top: 14px;
}
section.card > h1, section.card > h2 {
  margin: 0;
  font-size: 16px;
  font-weight: bold;
  background: var(--brand-light);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
}
section.card > .body { padding: 16px; }
section.card > .body > p.note {
  color: var(--text-dim);
  font-size: 12.5px;
  margin-top: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px 18px;
  margin-bottom: 12px;
}
.field { display: flex; flex-direction: column; }
.field label { font-size: 12.5px; color: var(--text-dim); margin-bottom: 3px; }
.field input, .field select, .field textarea {
  padding: 5px 6px;
  border: 1px solid var(--border-dark);
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 1px solid var(--brand);
}

button {
  background: #e8e8e8;
  border: 1px solid #888;
  padding: 7px 16px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  color: var(--text);
}
button:hover { background: #dcdcdc; }
button.primary { background: var(--brand); border-color: var(--brand-dark); color: #fff; }
button.primary:hover { background: var(--brand-dark); }
button.small { padding: 3px 8px; font-size: 12px; }
button.lang-btn.active { background: var(--brand); border-color: var(--brand-dark); color: #fff; }

.result {
  margin-top: 14px;
  border: 1px solid #b8c6da;
  background: #f0f5fb;
  padding: 10px 14px;
  font-size: 13.5px;
}
.result table { margin-top: 6px; }
.result .big { font-size: 17px; font-weight: bold; }
.ok { color: #1a6b1a; font-weight: bold; }
.bad { color: #a01414; font-weight: bold; }

table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
table caption { text-align: left; font-size: 12.5px; color: var(--text-dim); margin-bottom: 4px; }
th, td { border: 1px solid var(--border); padding: 5px 8px; text-align: center; }
th { background: var(--brand-light); }
tr:nth-child(even) td { background: #fafafa; }
tr.hl td { background: #fff3c4 !important; font-weight: bold; }
.tbl-wrap { overflow-x: auto; margin-top: 10px; }

.disclaimer {
  background: #fff9e6;
  border: 1px solid #e0d38a;
  padding: 10px 14px;
  font-size: 12.5px;
  color: #5a4d10;
  margin-bottom: 22px;
}

/* ---------- Typing speed test ---------- */
/* Accent colour is used sparingly and only on the thing that matters right
   now (the live number, the active tab, the caret, the progress fill) —
   everything else stays plain ink/gray, no boxed "widget" chrome. */

.tt-modebar { margin-bottom: 16px; }
.tt-tab-lg { font-size: 16px; margin-right: 26px; padding-bottom: 5px; }

.tt-status {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin-bottom: 14px;
}
.tt-lang { display: flex; }
.tt-drill { display: flex; }
.tt-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0 0 3px;
  margin-right: 18px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-faint);
  cursor: pointer;
}
.tt-tab:hover { color: var(--text); }
.tt-tab.active { color: var(--text); font-weight: bold; border-bottom-color: var(--brand); }

.tt-live { font-size: 13px; color: var(--text-dim); }
.tt-live b { color: var(--text); font-weight: bold; font-variant-numeric: tabular-nums; }
.tt-live .sep { color: var(--border-dark); margin: 0 2px; }

.tt-train-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.tt-problem-chars { font-size: 12px; color: var(--text-faint); margin-bottom: 12px; }
.tt-problem-chars b { color: var(--text-dim); font-variant-numeric: tabular-nums; letter-spacing: 0.05em; }

.tt-round-banner { font-size: 13px; color: var(--text-dim); margin: 6px 0 16px; }
.tt-round-banner b { color: var(--brand-dark); font-variant-numeric: tabular-nums; }

.tt-text {
  padding: 6px 0 10px;
  font-size: 17px;
  line-height: 1.85;
  font-family: Consolas, Menlo, monospace;
  color: var(--text-faint);
}
.tt-text .ch-correct { color: #1a6b1a; }
.tt-text .ch-wrong { color: #a01414; text-decoration: underline; text-underline-offset: 2px; }
.tt-text .ch-pending { color: var(--text-faint); }
.tt-text .ch-current {
  color: var(--text);
  border-left: 2px solid var(--brand);
  margin-left: -2px;
  animation: tt-caret-blink 1s step-end infinite;
}
@media (prefers-reduced-motion: reduce) {
  .tt-text .ch-current { animation: none; }
}
@keyframes tt-caret-blink {
  0%, 49% { border-left-color: var(--brand); }
  50%, 100% { border-left-color: transparent; }
}

.tt-progress { height: 3px; background: #e9e9e9; margin-bottom: 16px; }
.tt-progress-fill { height: 100%; width: 0%; background: var(--brand); }

.tt-input {
  display: block;
  width: 100%;
  min-height: 60px;
  resize: vertical;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--border);
  color: var(--text);
  padding: 6px 2px;
  font-size: 15px;
  font-family: Consolas, Menlo, monospace;
}
.tt-input:focus { outline: none; border-bottom-color: var(--brand); }
.tt-input:disabled { color: var(--text-faint); }

.tt-hint { font-size: 12px; color: var(--text-faint); margin: 10px 0 0; }
.tt-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: inherit;
  color: var(--brand);
  text-decoration: underline;
  cursor: pointer;
}
.tt-link:hover { color: var(--brand-dark); }

/* ---------- Results ---------- */
.tt-result-panel { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }

.tt-score { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.tt-score-num { font-size: 60px; font-weight: bold; letter-spacing: -0.03em; color: var(--brand); line-height: 1; }
.tt-score-unit { font-size: 15px; color: var(--text-dim); }
.tt-score-sub { margin-top: 8px; font-size: 13px; color: var(--text-dim); }
.tt-score-sub b { color: var(--text); font-variant-numeric: tabular-nums; }
.tt-new-best { color: var(--brand-dark); font-weight: bold; }

.tt-verdict { margin-top: 14px; font-size: 14.5px; max-width: 46em; }
.tt-verdict b { color: var(--brand-dark); }
.tt-note { font-size: 11.5px; color: var(--text-faint); margin-top: 10px; }

.chart-caption { font-size: 12.5px; color: var(--text-dim); margin: 22px 0 6px; }
.chart-wrap { max-width: 460px; }
.chart-line { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart-area { fill: var(--brand); fill-opacity: 0.07; }
.chart-baseline { stroke: var(--border); stroke-width: 1; }
.chart-endpoint-label { fill: var(--text-dim); font-size: 11px; font-family: Arial, Helvetica, sans-serif; }
