:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --border: #e1e5eb;
  --text: #17202b;
  --muted: #637083;
  --accent: #2f6fed;
  --accent-hover: #2459c9;
  --accent-soft: #e8efff;
  --ok: #18794e;
  --hero-1: #1d3c78;
  --hero-2: #2f6fed;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 14px rgba(16, 24, 40, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --surface: #161b22;
    --surface-2: #1d232c;
    --border: #2a313b;
    --text: #e6e9ee;
    --muted: #8d97a5;
    --accent: #5b8cff;
    --accent-hover: #7aa2ff;
    --accent-soft: #1b2640;
    --ok: #4cc38a;
    --hero-1: #122650;
    --hero-2: #1e4bb0;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
}
.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding-inline: 20px; }
[hidden] { display: none !important; }

/* ---------- шапка ---------- */
.hero {
  color: #fff;
  background:
    radial-gradient(1200px 400px at 85% -20%, rgba(255, 255, 255, .16), transparent 60%),
    linear-gradient(135deg, var(--hero-1), var(--hero-2));
  padding-block: 28px 40px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: .01em; }
.mark {
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .28);
  font-size: 13px;
  font-weight: 700;
}
.hero h1 { margin: 36px 0 6px; font-size: clamp(26px, 4vw, 34px); line-height: 1.2; }
.lead { margin: 0; max-width: 620px; color: rgba(255, 255, 255, .82); }

.search {
  position: relative;
  max-width: 460px;
  margin-top: 22px;
}
.search svg {
  position: absolute; left: 14px; top: 50%;
  width: 18px; height: 18px; transform: translateY(-50%);
  fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round;
}
.search input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border: 0;
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
.search input:focus { outline: 3px solid rgba(255, 255, 255, .45); }

/* ---------- карточки ---------- */
main { flex: 1; padding-block: 28px 40px; }
.cards {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .15s, border-color .15s;
}
.card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.card-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar {
  flex: none;
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
}
.card-name { min-width: 0; }
.card-name h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.card-name code {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font: 12.5px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.actions { display: flex; gap: 8px; margin-top: auto; }

.btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.copied { color: var(--ok); border-color: var(--ok); }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ---------- запасной вид без JS: таблица mod_autoindex ---------- */
.listing table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.listing th { display: none; }
.listing td { padding: 0; border-top: 1px solid var(--border); }
.listing tr:nth-child(2) td { border-top: 0; }
.listing td a {
  display: block;
  padding: 14px 18px;
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}
.listing td a:hover { background: var(--surface-2); color: var(--accent); }

/* ---------- подсказка и подвал ---------- */
.help {
  margin-top: 28px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.help h2 { margin: 0 0 8px; font-size: 15px; }
.help ol { margin: 0; padding-left: 20px; color: var(--muted); }
.help li { margin: 4px 0; }
.help b { color: var(--text); font-weight: 600; }
.foot { padding-block: 18px; color: var(--muted); font-size: 13px; }

@media (max-width: 560px) {
  .wrap { padding-inline: 16px; }
  .hero { padding-block: 22px 32px; }
  .hero h1 { margin-top: 26px; }
}
