:root {
  --bg: #f4f5f7;
  --bg-grad: radial-gradient(1400px 700px at 50% -10%, #e8effb 0%, transparent 60%);
  --card-bg: #ffffff;
  --card-border: #e6e8ec;
  --text: #1f2329;
  --text-muted: #6b7280;
  --link-hover: #f2f5fb;
  --accent: #2563eb;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 10px 28px rgba(16, 24, 40, .07);
  --shadow-hover: 0 2px 6px rgba(16, 24, 40, .08), 0 16px 40px rgba(16, 24, 40, .12);
  --radius: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0e13;
    --bg-grad: radial-gradient(1400px 700px at 50% -10%, #16243f 0%, transparent 55%);
    --card-bg: #141921;
    --card-border: #242b36;
    --text: #e6e9ef;
    --text-muted: #94a0b0;
    --link-hover: #1c232e;
    --accent: #5b9dff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px rgba(0, 0, 0, .35);
    --shadow-hover: 0 2px 8px rgba(0, 0, 0, .5), 0 18px 44px rgba(0, 0, 0, .45);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Full-width responsive container */
.wrap {
  width: 100%;
  margin: 0 auto;
  padding: clamp(20px, 3vw, 44px) clamp(16px, 3vw, 48px) 56px;
}

header.site {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 4px;
}
header.site img.logo {
  width: 38px; height: 38px; border-radius: 9px; object-fit: cover;
  background: var(--card-bg); border: 1px solid var(--card-border);
}
header.site h1 {
  font-size: 1.5rem; font-weight: 700; margin: 0; letter-spacing: -0.02em;
}

/* Search — capped width, not stretched across ultrawide */
.search { margin: 20px 0 28px; position: relative; max-width: 560px; }
.search input {
  width: 100%;
  padding: 12px 16px 12px 42px;
  font-size: .98rem;
  color: var(--text);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  outline: none;
  box-shadow: var(--shadow);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search input:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow), 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.search svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--text-muted); pointer-events: none;
}

/* Flexible full-width grid: cards grow to fill the row, no dead columns */
.grid {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(14px, 1.2vw, 20px);
  align-items: flex-start;
}

.card {
  flex: 1 1 300px;
  min-width: 0;
  max-width: 440px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--card-border));
}
.card-img { width: 100%; height: 116px; object-fit: cover; display: block; }
.card-head {
  padding: 15px 18px 13px;
  border-bottom: 1px solid var(--card-border);
}
.card-head h2 {
  margin: 0; font-size: 1.02rem; font-weight: 650; letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 9px;
}
.card-head h2::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); flex: 0 0 8px;
}
.card-head p { margin: 5px 0 0 17px; font-size: .84rem; color: var(--text-muted); }

.links { padding: 7px; display: flex; flex-direction: column; }
a.link {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: .92rem;
  transition: background-color .12s ease;
}
a.link:hover { background: var(--link-hover); }

/* Icon: colored monogram, optional favicon overlay */
a.link .ico {
  position: relative;
  width: 24px; height: 24px; flex: 0 0 24px;
  border-radius: 7px; overflow: hidden;
  display: grid; place-items: center;
}
a.link .ico .mono {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  font-size: .72rem; font-weight: 700; color: #fff;
  background: var(--ic, var(--accent));
  text-transform: uppercase;
}
a.link .ico img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: contain;
  background: #fff;
}
a.link .name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.link .ext { width: 14px; height: 14px; color: var(--text-muted); opacity: 0; transition: opacity .12s ease; flex: 0 0 14px; }
a.link:hover .ext { opacity: .8; }

.card.hidden, a.link.hidden { display: none; }

footer.site {
  margin-top: 36px; padding-top: 20px;
  border-top: 1px solid var(--card-border);
  display: flex; flex-wrap: wrap; gap: 8px 20px;
  font-size: .84rem; color: var(--text-muted);
  justify-content: center;
}
footer.site a { color: var(--text-muted); text-decoration: none; }
footer.site a:hover { color: var(--accent); }

.empty { text-align: center; color: var(--text-muted); padding: 60px 0; width: 100%; }
.error {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 20px; color: var(--text-muted);
  box-shadow: var(--shadow); max-width: 560px;
}
.error code { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .card:hover { transform: none; }
}
