/* ============================================================
   TestFiles — tf.netlnk.org
   Тёмная тема, без внешних зависимостей.
   ============================================================ */

:root {
  --bg: #070b12;
  --bg-2: #0b111c;
  --card: rgba(148, 163, 184, 0.055);
  --card-solid: #0e1626;
  --border: rgba(148, 163, 184, 0.14);
  --border-soft: rgba(148, 163, 184, 0.09);
  --text: #e8eef7;
  --muted: #93a1b5;
  --dim: #64748b;
  --accent-1: #6366f1;
  --accent-2: #22d3ee;
  --accent-grad: linear-gradient(135deg, #6366f1 0%, #22d3ee 100%);
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 16px;
  --radius-sm: 10px;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", "Cascadia Code", Consolas, monospace;
  --shadow: 0 18px 50px -18px rgba(2, 6, 16, 0.85);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ---------- фон ---------- */

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(52rem 30rem at 12% -6%, rgba(99, 102, 241, 0.16), transparent 60%),
    radial-gradient(46rem 28rem at 88% 4%, rgba(34, 211, 238, 0.10), transparent 62%),
    radial-gradient(40rem 30rem at 50% 110%, rgba(99, 102, 241, 0.08), transparent 65%);
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(72rem 40rem at 50% 0%, rgba(0,0,0,.9), transparent 78%);
  -webkit-mask-image: radial-gradient(72rem 40rem at 50% 0%, rgba(0,0,0,.9), transparent 78%);
}

.wrap {
  width: min(1120px, calc(100% - 2.5rem));
  margin-inline: auto;
}

code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 0.08em 0.4em;
  color: #c7d2fe;
  word-break: break-all;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(7, 11, 18, 0.72);
  border-bottom: 1px solid var(--border-soft);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 6px 18px -6px rgba(99, 102, 241, 0.65);
}

.brand-mark svg { width: 19px; height: 19px; }

.brand-name {
  font-weight: 750;
  font-size: 1.14rem;
  letter-spacing: -0.01em;
}

.brand-name em {
  font-style: normal;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-name.small { font-size: 1rem; }

.host-chip {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  background: rgba(148, 163, 184, 0.06);
  white-space: nowrap;
}

.site-nav {
  margin-left: auto;
  display: flex;
  gap: 1.35rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 550;
  transition: color 0.15s ease;
}

.site-nav a:hover { color: var(--text); }

/* ---------- герой ---------- */

.hero {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 3rem;
  align-items: center;
  padding: 4.5rem 0 3.5rem;
}

.hero h1 {
  font-size: clamp(2.1rem, 4.2vw, 3.1rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
  margin: 0 0 1.1rem;
  font-weight: 800;
}

.grad {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead {
  color: var(--muted);
  font-size: 1.06rem;
  max-width: 46ch;
  margin: 0 0 1.4rem;
}

.hero-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.hero-points li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.94rem;
}

.hero-points svg {
  width: 17px;
  height: 17px;
  flex: none;
  color: var(--good);
}

/* ---------- карточка спидтеста ---------- */

.speed-card {
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.085), rgba(148, 163, 184, 0.035));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem 1.2rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.speed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.speed-phase {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.speed-phase::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dim);
  flex: none;
}

.speed-card.running .speed-phase::before {
  background: var(--accent-2);
  animation: pulse 1.1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}

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

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-weight: 650;
  font-size: 0.92rem;
  padding: 0.62rem 1.35rem;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.btn:active { transform: translateY(1px) scale(0.99); }

.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 10px 26px -10px rgba(99, 102, 241, 0.75);
}

.btn-primary:hover { box-shadow: 0 14px 30px -10px rgba(34, 211, 238, 0.55); }

.btn-primary[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-ghost {
  background: rgba(148, 163, 184, 0.08);
  border-color: var(--border);
  color: var(--text);
  font-size: 0.84rem;
  padding: 0.5rem 1.05rem;
}

.btn-ghost:hover { background: rgba(148, 163, 184, 0.15); }

/* ---------- gauge ---------- */

.gauge { text-align: center; }

.gauge-value {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.35rem 0 0.15rem;
}

.gauge-value span {
  font-family: var(--mono);
  font-size: clamp(2.6rem, 5vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fff, #a5b4fc);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.gauge-value small {
  color: var(--dim);
  font-weight: 650;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#chart {
  width: 100%;
  height: 120px;
  display: block;
}

/* ---------- прогресс ---------- */

.progress {
  height: 5px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  overflow: hidden;
  margin: 0.35rem 0 0.9rem;
}

.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--accent-grad);
  transition: width 0.2s ease;
}

/* ---------- результаты ---------- */

.results {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  margin-top: 0.7rem;
}

.result {
  background: rgba(7, 11, 18, 0.45);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.result-label {
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--dim);
}

.result-value {
  font-family: var(--mono);
  font-size: 0.98rem;
  font-weight: 650;
  color: var(--text);
  overflow-wrap: anywhere;
}

.speed-note {
  margin: 0.8rem 0 0;
  min-height: 1.2em;
  font-size: 0.84rem;
  color: var(--dim);
  text-align: center;
}

/* ---------- секции ---------- */

.section { padding: 3.2rem 0 1rem; }

.section-head { margin-bottom: 1.6rem; }

.section-head h2 {
  font-size: 1.6rem;
  letter-spacing: -0.02em;
  margin: 0 0 0.4rem;
  font-weight: 750;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  max-width: 72ch;
}

/* ---------- файлы ---------- */

.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.9rem;
}

.file-card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.2rem 0.7rem;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.file-card:hover {
  border-color: rgba(99, 102, 241, 0.45);
  background: rgba(99, 102, 241, 0.07);
  transform: translateY(-2px);
}

.file-name {
  font-family: var(--mono);
  font-weight: 650;
  font-size: 0.98rem;
  color: var(--text);
}

.file-size {
  font-size: 0.8rem;
  color: var(--dim);
  font-family: var(--mono);
}

.file-actions {
  grid-row: span 2;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.file-actions .btn {
  font-size: 0.8rem;
  padding: 0.42rem 0.9rem;
}

.btn-dl {
  background: rgba(99, 102, 241, 0.16);
  border-color: rgba(99, 102, 241, 0.4);
  color: #c7d2fe;
  text-decoration: none;
  text-align: center;
  display: inline-block;
}

.btn-dl:hover { background: rgba(99, 102, 241, 0.28); }

/* ---------- cli ---------- */

.cli-list { display: grid; gap: 0.7rem; }

.cli-row {
  display: grid;
  grid-template-columns: 220px 1fr auto;
  gap: 1rem;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
}

.cli-meta { display: grid; gap: 0.1rem; }

.cli-title { font-weight: 650; font-size: 0.92rem; }

.cli-desc { font-size: 0.78rem; color: var(--dim); }

.cli-row code {
  display: block;
  background: rgba(7, 11, 18, 0.6);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  font-size: 0.8rem;
  color: #a5f3fc;
  white-space: nowrap;
  overflow-x: auto;
}

/* ---------- about ---------- */

.about-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.9rem;
}

.about-card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem;
}

.about-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.02rem;
  font-weight: 700;
}

.about-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

/* ---------- футер ---------- */

.site-footer {
  margin-top: 4rem;
  border-top: 1px solid var(--border-soft);
  padding: 1.6rem 0 2rem;
  color: var(--dim);
  font-size: 0.86rem;
}

.footer-inner {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.footer-host { margin-left: auto; font-family: var(--mono); font-size: 0.78rem; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.6rem;
  transform: translate(-50%, 12px);
  background: #101a2c;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 0.6rem 1.1rem;
  font-size: 0.88rem;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- адаптив ---------- */

@media (max-width: 940px) {
  .hero { grid-template-columns: 1fr; gap: 2.2rem; padding-top: 3rem; }
  .about-grid { grid-template-columns: 1fr; }
  .cli-row { grid-template-columns: 1fr; gap: 0.6rem; }
  .cli-row .btn { justify-self: start; }
}

@media (max-width: 620px) {
  .site-nav { display: none; }
  .host-chip { margin-left: auto; }
  .speed-head { flex-direction: column; align-items: stretch; text-align: center; }
  .speed-head .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}
