/* DownloadFactory — общий базовый CSS (переопределяется токенами :root в пресете и site.json -> theme_vars) */
:root {
  --bg: #EEF2F6;
  --surface: #FFFFFF;
  --surface-2: #F7F9FC;
  --surface-dark: #0F172A;
  --border: #D8E1EC;
  --border-strong: #B9C7D8;
  --text: #0F172A;
  --text-2: #334155;
  --muted: #5A6B82;
  --accent: #0D9488;
  --accent-hover: #0F766E;
  --accent-soft: #E6F7F5;
  --accent-ink: #FFFFFF;
  --ok: #15803D;
  --ok-soft: #DCFCE7;
  --warn: #B45309;
  --warn-soft: #FEF3C7;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 12px rgba(15, 23, 42, .04);
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: var(--font-sans);
  --font-mono: ui-monospace, 'Cascadia Mono', 'Segoe UI Mono', Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--link, var(--accent)); }
.container { max-width: 1220px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 32px); }

/* Anti-mimicry subtle top notice bar */
.dl-fan-bar {
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  color: var(--muted); font-size: 0.78rem; line-height: 1.35;
}
.dl-fan-inner {
  padding-top: 6px; padding-bottom: 6px; display: flex; align-items: center; gap: 8px;
}
.dl-fan-inner::before {
  content: 'i'; width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0;
  border: 1px solid var(--border-strong); display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 0.68rem; font-weight: 700; color: var(--muted);
}

/* Header */
.dl-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.dl-header-inner {
  min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.dl-brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text);
  font-family: var(--font-display); font-weight: 800; font-size: 1.06rem;
  letter-spacing: -0.02em; white-space: nowrap;
}
.dl-brand-mark {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; flex-shrink: 0;
}
.dl-brand-ver {
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 600;
  color: var(--muted); padding: 2px 7px; border-radius: 5px;
  border: 1px solid var(--border); background: var(--surface-2);
}
.dl-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.dl-nav a {
  text-decoration: none; color: var(--text-2); font-size: 0.92rem; font-weight: 600;
  padding: 8px 12px; border-radius: var(--radius-sm);
}
.dl-nav a:hover, .dl-nav a.active { background: var(--surface-2); color: var(--text); }
.dl-nav-cta {
  display: inline-flex; align-items: center; gap: 7px;
  height: 40px; padding: 0 15px; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--accent-ink);
  text-decoration: none; font-weight: 700; font-size: 0.9rem; white-space: nowrap;
}
.dl-nav-cta:hover { background: var(--accent-hover); }

/* Mobile menu button */
.dl-burger {
  display: none; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer;
}
.dl-mobile-nav {
  display: none; padding: 12px 16px 16px; border-top: 1px solid var(--border); background: var(--surface);
}
.dl-mobile-nav.open { display: flex; flex-direction: column; gap: 6px; }
.dl-mobile-nav a {
  padding: 10px 12px; border-radius: var(--radius-sm); text-decoration: none;
  color: var(--text); font-weight: 600; background: var(--surface-2);
}

/* Panels & Cards */
.dl-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  min-width: 0; max-width: 100%;
}
.dl-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 50px; padding: 0 22px; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--accent-ink);
  text-decoration: none; font-weight: 700; font-size: 0.98rem;
  border: 1px solid transparent; cursor: pointer; transition: background .15s, transform .1s;
}
.dl-btn:hover { background: var(--accent-hover); }
.dl-btn:active { transform: scale(.99); }
.dl-btn--sec {
  background: var(--surface); color: var(--text); border-color: var(--border-strong);
}
.dl-btn--sec:hover { background: var(--surface-2); }

/* Specs 4x2 (Zero orphans) */
.dl-specs {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px;
}
.dl-spec {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 13px;
}
.dl-spec-k { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 700; }
.dl-spec-v { margin-top: 3px; font-weight: 700; font-size: 0.94rem; color: var(--text); }

/* Tables & mobile horizontal scroll UX */
.dl-table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.dl-table-wrap, .dl-prose-table, .tr-seeds, .rf-files {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) var(--surface-2);
}
.dl-table-wrap::-webkit-scrollbar,
.dl-prose-table::-webkit-scrollbar,
.tr-seeds::-webkit-scrollbar,
.rf-files::-webkit-scrollbar { height: 7px; }
.dl-table-wrap::-webkit-scrollbar-track,
.dl-prose-table::-webkit-scrollbar-track,
.tr-seeds::-webkit-scrollbar-track,
.rf-files::-webkit-scrollbar-track { background: var(--surface-2); border-radius: 99px; }
.dl-table-wrap::-webkit-scrollbar-thumb,
.dl-prose-table::-webkit-scrollbar-thumb,
.tr-seeds::-webkit-scrollbar-thumb,
.rf-files::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }

.dl-tscroll-shell { position: relative; margin: 18px 0; min-width: 0; max-width: 100%; }
.dl-tscroll-stage > .dl-prose-table,
.dl-tscroll-stage > .dl-table-wrap,
.dl-tscroll-stage > .tr-seeds,
.dl-tscroll-stage > .rf-files { margin: 0; }
.dl-tscroll-hint {
  display: none; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 6px; padding: 5px 10px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--muted); font-size: 0.78rem; font-weight: 600; line-height: 1.3;
}
.dl-tscroll-shell.is-scrollable .dl-tscroll-hint { display: flex; }
.dl-tscroll-hint-text { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.dl-tscroll-hint-text svg { flex-shrink: 0; color: var(--accent); }
.dl-tscroll-btns { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; }
.dl-tscroll-btn {
  appearance: none; width: 26px; height: 24px; border-radius: 5px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  display: grid; place-items: center; cursor: pointer; font-size: 0.9rem; line-height: 1; padding: 0;
  transition: opacity .15s, border-color .15s, background .15s;
}
.dl-tscroll-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.dl-tscroll-btn:disabled { opacity: .35; cursor: default; }
.dl-tscroll-stage { position: relative; min-width: 0; }
.dl-tscroll-stage::after {
  content: ''; position: absolute; top: 1px; right: 1px; bottom: 8px; width: 28px;
  pointer-events: none; border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: linear-gradient(to left, rgba(15, 23, 42, .18), transparent);
  opacity: 0; transition: opacity .2s ease;
}
.dl-tscroll-shell.has-right .dl-tscroll-stage::after { opacity: 1; }
.dl-table { width: 100%; border-collapse: collapse; min-width: 660px; }
.dl-table th, .dl-table td {
  text-align: left; padding: 13px 15px; border-bottom: 1px solid var(--border); font-size: 0.92rem;
}
.dl-table th {
  background: var(--surface-2); font-size: 0.76rem; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted); font-weight: 700;
}
.dl-table tr:last-child td { border-bottom: none; }
.mono { font-family: var(--font-mono); font-size: 0.84rem; }

/* Inner 2-column layout (main + static sidebar) */
.dl-layout {
  padding: 24px 0 48px;
  display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 24px; align-items: start;
}
.dl-main { min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.dl-sidebar { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.dl-side-box { padding: 18px 20px; }
.dl-side-box h2 { font-size: 1rem; font-weight: 800; margin-bottom: 12px; }
.dl-side-links { display: flex; flex-direction: column; gap: 6px; }
.dl-side-links a {
  display: flex; justify-content: space-between; gap: 8px; padding: 9px 11px;
  border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text);
  text-decoration: none; font-size: 0.89rem; font-weight: 600;
}
.dl-side-links a:hover { background: var(--accent-soft); color: var(--accent); }

/* Editorial prose */
.dl-prose { padding: 24px 28px; }
.dl-prose h2 { font-family: var(--font-display); font-size: 1.4rem; margin: 28px 0 12px; letter-spacing: -0.02em; }
.dl-prose h2:first-child { margin-top: 0; }
.dl-prose h3 { font-size: 1.12rem; margin: 20px 0 8px; }
.dl-prose p { margin-bottom: 14px; color: var(--text-2); max-width: 72ch; }
.dl-prose ul, .dl-prose ol { margin: 0 0 16px 20px; color: var(--text-2); }
.dl-prose li { margin-bottom: 7px; }
.dl-prose-table {
  overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 18px 0;
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface);
}
.dl-prose table {
  display: table; width: 100%; min-width: 520px; border-collapse: collapse; margin: 0;
  font-size: 0.9rem;
}
.dl-prose th, .dl-prose td {
  text-align: left; padding: 10px 13px; border-bottom: 1px solid var(--border); vertical-align: top;
}
.dl-prose th {
  background: var(--surface-2); font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.03em; color: var(--muted); font-weight: 700;
}
.dl-prose tbody tr:hover td { background: var(--surface-2); }
.dl-prose tr:last-child td { border-bottom: none; }
.dl-prose figure { margin: 20px 0; }
.dl-prose figure img {
  display: block; width: 100%; height: auto; border-radius: var(--radius-md);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.dl-prose figcaption {
  margin-top: 8px; font-size: 0.83rem; color: var(--muted); text-align: center;
}

/* Screenshots gallery */
.dl-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dl-shot {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  overflow: hidden; box-shadow: var(--shadow-sm); display: flex; flex-direction: column;
}
.dl-shot img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: var(--surface-dark); }
.dl-shot figcaption { padding: 11px 14px; font-size: 0.88rem; color: var(--text-2); font-weight: 600; line-height: 1.35; }

/* FAQ accordion */
.dl-faq { display: flex; flex-direction: column; gap: 10px; }
.dl-faq details {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 14px 18px;
}
.dl-faq summary { font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.dl-faq summary::after { content: '+'; font-family: var(--font-mono); color: var(--accent); }
.dl-faq details[open] summary::after { content: '−'; }
.dl-faq details p { margin-top: 10px; color: var(--text-2); font-size: 0.94rem; }

/* Download landing (/download/{token}/) */
.dl-landing-wrap { padding: 36px 0 64px; max-width: 760px; margin: 0 auto; }
.dl-landing-card { padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.dl-sha-box {
  padding: 12px 14px; background: var(--surface-2); border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: 0.8rem;
  word-break: break-all; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
}
.dl-vt {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px;
  border-radius: 5px; background: var(--ok-soft); color: var(--ok); font-weight: 700; font-size: 0.8rem;
}

/* Ad slots (only rendered when monetization.enabled = true) */
.dl-ad-wrap { margin: 16px 0; }
.dl-ad--mobile { display: none; }

/* Sticky mobile download bar */
.dl-sticky-mob {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 10px 16px; box-shadow: 0 -4px 16px rgba(0,0,0,.1);
  align-items: center; justify-content: space-between; gap: 12px;
}
.dl-sticky-mob.show { display: flex; }

/* Back-to-top button */
.dl-top-btn {
  position: fixed; right: 22px; bottom: 24px; z-index: 45;
  width: 44px; height: 44px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  box-shadow: 0 4px 14px rgba(15, 23, 42, .14);
  display: grid; place-items: center; cursor: pointer;
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s, background .15s, color .15s, border-color .15s;
}
.dl-top-btn.show { opacity: 1; visibility: visible; transform: translateY(0); }
.dl-top-btn:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* Preset A+ Terminal Styles */
.dl-status-strip { background: var(--surface-dark); color: #CBD5E1; font-size: 0.84rem; }
.dl-status-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 18px; padding: 8px 0; }
.dl-status-items { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.dl-status-item { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-size: 0.78rem; }
.dl-dot-live { width: 7px; height: 7px; border-radius: 50%; background: #2DD4BF; flex-shrink: 0; }

.dl-a-hero { padding: 22px 0 30px; }
.dl-a-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, 1fr); gap: 20px; align-items: stretch; }
.dl-a-release { padding: 24px 26px; display: flex; flex-direction: column; gap: 18px; }
.dl-a-head { display: flex; gap: 15px; align-items: flex-start; }
.dl-a-icon {
  width: 56px; height: 56px; border-radius: 13px; background: linear-gradient(145deg, #0F172A, #1E293B);
  border: 1px solid #334155; color: #2DD4BF; display: grid; place-items: center; flex-shrink: 0;
}
.dl-a-head h1 { font-size: clamp(1.48rem, 2.3vw, 2.02rem); line-height: 1.15; letter-spacing: -0.025em; font-weight: 800; }
.dl-a-lead { margin-top: 6px; color: var(--text-2); font-size: 0.95rem; max-width: 56ch; }

.dl-branch-bar {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
  padding: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-md);
}
.dl-branch-btn {
  appearance: none; border: 1px solid transparent; background: transparent; border-radius: 7px;
  padding: 10px; text-align: left; cursor: pointer; min-height: 52px; font-family: inherit; transition: all .15s;
}
.dl-branch-btn:hover { background: var(--surface); border-color: var(--border); }
.dl-branch-btn.active { background: var(--surface); border-color: var(--accent); box-shadow: 0 2px 6px rgba(13, 148, 136, .12); }
.dl-branch-name { display: block; font-weight: 700; font-size: 0.88rem; color: var(--text); }
.dl-branch-ver { display: block; font-size: 0.74rem; color: var(--muted); margin-top: 2px; }
.dl-a-action {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 15px;
  background: var(--accent-soft); border: 1px solid #99F6E4; border-radius: var(--radius-md);
}

.dl-a-side { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.dl-a-preview { border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border); aspect-ratio: 16 / 9; background: var(--surface-dark); }
.dl-a-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dl-chip-head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 0.94rem; }
.dl-chip-list { display: flex; flex-direction: column; gap: 8px; }
.dl-chip-row {
  appearance: none; width: 100%; text-align: left; font-family: inherit; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); transition: border-color .15s, background .15s;
}
.dl-chip-row:hover, .dl-chip-row.active { border-color: var(--accent); background: var(--accent-soft); }
.dl-chip-tag { font-size: 0.74rem; font-weight: 700; padding: 3px 8px; border-radius: 5px; white-space: nowrap; }
.dl-chip-tag--ok { background: var(--ok-soft); color: var(--ok); }
.dl-chip-tag--warn { background: var(--warn-soft); color: var(--warn); }

.dl-presets-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.dl-fps-bar { height: 5px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.dl-fps-bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* Footer */
.dl-footer {
  border-top: 1px solid var(--border); background: var(--surface);
  padding: 26px 0; margin-top: 32px; font-size: 0.86rem; color: var(--muted);
}
.dl-footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; }
.dl-footer a { color: var(--text-2); text-decoration: none; }
.dl-footer a:hover { color: var(--accent); }

@media (max-width: 980px) {
  .dl-layout, .dl-a-grid { grid-template-columns: minmax(0, 1fr); }
  .dl-presets-grid, .dl-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dl-sidebar { position: static; }
}
@media (max-width: 680px) {
  .dl-nav, .dl-brand-ver { display: none; }
  .dl-burger { display: inline-flex; }
  .dl-status-inner > .dl-status-item, .dl-status-items .dl-status-item:not(:first-child) { display: none; }
  .dl-a-hero { padding: 14px 0 24px; }
  .dl-a-release { padding: 16px; gap: 14px; }
  .dl-a-icon { width: 44px; height: 44px; border-radius: 10px; }
  .dl-a-lead { display: none; }
  .dl-branch-bar, .dl-specs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dl-presets-grid, .dl-gallery { grid-template-columns: 1fr; }
  .dl-a-action .dl-btn--sec { width: 100%; }
  .dl-prose { padding: 18px; }
  .dl-ad--desktop { display: none; }
  .dl-ad--mobile { display: block; }
  .dl-top-btn { display: none !important; }
  body { padding-bottom: 68px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
