:root {
  --bg: #f7f6f3; --surface: #ffffff; --ink: #141416; --muted: #6b6b70;
  --line: #e3e1db; --soft: #efede8; --header: rgba(247, 246, 243, .82);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f12; --surface: #17171b; --ink: #ecebe6; --muted: #8f8f95;
    --line: #26262c; --soft: #1c1c21; --header: rgba(15, 15, 18, .78);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f0f12; --surface: #17171b; --ink: #ecebe6; --muted: #8f8f95;
  --line: #26262c; --soft: #1c1c21; --header: rgba(15, 15, 18, .78);
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif; line-height: 1.6;
  display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } }

/* Header */
header {
  position: sticky; top: 0; z-index: 10;
  background: var(--header); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
header .wrap { display: flex; align-items: center; height: 64px; gap: 16px; }
.logo { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; flex-shrink: 0; }
.logo svg { width: 30px; height: auto; }
.logo span { font-weight: 600; font-size: 15px; letter-spacing: .24em; text-transform: uppercase; }
.primary { display: flex; gap: 28px; margin-left: 40px; }
.primary a { position: relative; font-size: 14px; color: var(--muted); text-decoration: none; transition: color .15s; }
.primary a:hover, .primary a:focus-visible, .primary a[aria-current="page"] { color: var(--ink); }
.primary a[aria-current="page"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -21px; height: 2px; background: var(--ink);
}
.spacer { flex: 1; }

/* Theme switch */
.theme { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--soft); flex-shrink: 0; }
.theme button {
  display: grid; place-items: center; width: 30px; height: 26px; padding: 0;
  border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s;
}
.theme button:hover { color: var(--ink); }
.theme button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.theme svg { width: 15px; height: 15px; }

@media (max-width: 640px) {
  .logo span { display: none; }
  .primary { margin-left: 8px; gap: 20px; }
}
@media (max-width: 360px) {
  .primary { gap: 14px; }
  .theme button { width: 26px; }
}

/* Home hero */
.hero { padding: clamp(72px, 14vh, 140px) 0 clamp(56px, 10vh, 96px); text-align: center; border-bottom: 1px solid var(--line); }
.hero svg { width: clamp(88px, 16vw, 136px); height: auto; }
.hero h1 {
  margin: 28px 0 0; font-weight: 500; font-size: clamp(20px, 6vw, 52px);
  letter-spacing: .3em; text-indent: .3em; text-transform: uppercase; line-height: 1.2;
}

/* List pages (Applications, Team): one small title line instead of a big header */
.list-page { padding-top: 32px; }
.list-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 18px; }
.page-title { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.005em; }
.count { font-size: 13px; color: var(--muted); }

main { flex: 1; }
.content { min-height: 32vh; padding: 64px 0; }
.empty { margin: 0; color: var(--muted); font-size: 15px; }

/* Sections */
.section-title {
  margin: 0 0 24px; font-size: 13px; font-weight: 600; color: var(--muted);
  letter-spacing: .14em; text-transform: uppercase;
}

/* Team */
.team { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin: 0; padding: 0; list-style: none; }
.member {
  display: flex; align-items: center; gap: 14px; padding: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
}
.avatar {
  display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%;
  background: var(--ink); color: var(--bg); font-weight: 600; font-size: 17px; text-transform: uppercase;
}
.member .name { font-weight: 600; font-size: 15px; line-height: 1.3; }
.member .links { font-size: 13px; color: var(--muted); }
.member .links a { text-decoration: none; }
.member .links a:hover, .member .links a:focus-visible { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* Home: the hero fills the space between header and footer */
.home main { display: flex; flex-direction: column; }
.home .hero { flex: 1; display: grid; place-items: center; border-bottom: 0; }

/* Footer */
footer { border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.footer-base { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding-top: 28px; padding-bottom: 32px; }
.footer-base a { text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 1px; transition: color .15s, border-color .15s; }
.footer-base a:hover, .footer-base a:focus-visible { color: var(--ink); border-color: var(--ink); }
@media (max-width: 600px) { .footer-base { flex-direction: column; text-align: center; } }

/* "Supported by" line in the home footer: small, single-color logos (masks take the text color) */
.supporters { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; }
.footer-base .supporters a { display: inline-flex; align-items: center; border-bottom: 0; padding: 0; color: var(--muted); }
.footer-base .supporters a:hover, .footer-base .supporters a:focus-visible { color: var(--ink); }
.sup-group { display: inline-flex; align-items: center; gap: 8px; }
.sup-sep { opacity: .6; }
.mono-logo {
  display: block; background-color: currentColor;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}
.mono-logo.mirako {
  height: 17px; aspect-ratio: 376 / 96;
  -webkit-mask-image: url("assets/mirako-mark.png"); mask-image: url("assets/mirako-mark.png");
}
.mono-logo.nvidia {
  height: 20px; aspect-ratio: 452 / 160;
  -webkit-mask-image: url("assets/nvidia-inception.png"); mask-image: url("assets/nvidia-inception.png");
}
.mono-logo.illinois {
  height: 15px; aspect-ratio: 242.305 / 350;
  -webkit-mask-image: url("assets/illinois.svg"); mask-image: url("assets/illinois.svg");
}

/* Applications: toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.search { position: relative; flex: 1 1 260px; display: flex; }
.search svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.toolbar input, .toolbar select {
  height: 38px; font: inherit; font-size: 14px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; outline: none; transition: border-color .15s;
}
.toolbar input { width: 100%; padding: 0 12px 0 34px; }
.toolbar select { padding: 0 32px 0 12px; cursor: pointer; appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 15px top 17px, right 10px top 17px; background-size: 5px 5px; background-repeat: no-repeat; }
.toolbar input:focus, .toolbar select:focus { border-color: var(--ink); }
@media (max-width: 600px) {
  .toolbar { display: grid; grid-template-columns: 1fr 1fr; }
  .search, #app-sort { grid-column: 1 / -1; }
  .toolbar select { min-width: 0; width: 100%; }
}

/* Applications: one row per app */
.app-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.app-row { position: relative; border-bottom: 1px solid var(--line); }
.app-row > a { display: flex; align-items: flex-start; gap: 16px; padding: 16px 84px 16px 8px; text-decoration: none; border-radius: 12px; transition: background .15s; }
.app-row > a:hover, .app-row > a:focus-visible { background: var(--surface); }
.app-row img { width: 56px; height: 56px; flex-shrink: 0; border-radius: 13px; box-shadow: 0 0 0 1px var(--line); }
.app-row-main { flex: 1; min-width: 0; }
.app-row-title { display: flex; align-items: baseline; gap: 8px; }
.app-row-name { font-size: 16px; font-weight: 600; }
.app-row-version { font-size: 12.5px; color: var(--muted); }
.app-row-tagline { margin: 2px 0 0; font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 8px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; line-height: 1; padding: 5px 8px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); color: var(--muted); }
.tag:first-child { color: var(--ink); }
.plat-icons { display: inline-flex; gap: 8px; color: var(--muted); }
.plat-icons svg { width: 14px; height: 14px; fill: currentColor; }
@media (max-width: 600px) {
  .app-row-tagline { white-space: normal; }
}

/* Applications: one app's page */
.app-page { padding-top: 40px; }
.back { display: inline-block; margin-bottom: 28px; font-size: 14px; color: var(--muted); text-decoration: none; }
.back:hover, .back:focus-visible { color: var(--ink); }
.app-head { display: flex; align-items: center; gap: 18px; }
.app-icon { width: 64px; height: 64px; flex-shrink: 0; border-radius: 15px; box-shadow: 0 0 0 1px var(--line); }
.app-head h1 { margin: 0; font-size: clamp(26px, 4vw, 34px); font-weight: 600; line-height: 1.2; }
.app-tagline { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.app-points { max-width: 760px; margin: 28px 0 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.app-points li { position: relative; padding-left: 18px; font-size: 15px; color: var(--muted); }
.app-points li::before { content: ""; position: absolute; left: 0; top: .7em; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); }
.app-points strong { color: var(--ink); font-weight: 600; }
.downloads { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; max-width: 900px; margin-top: 32px; }
.dl {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; transition: border-color .15s, transform .15s;
}
.dl:hover, .dl:focus-visible { border-color: var(--ink); }
.dl:active { transform: translateY(1px); }
.dl svg { width: 26px; height: 26px; flex-shrink: 0; fill: currentColor; }
.dl > span { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.dl b { font-size: 15px; font-weight: 600; }
.dl small { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.dl-meta { margin: 14px 0 0; font-size: 13px; color: var(--muted); }
.dl-meta a { color: inherit; }
.dl-meta a:hover { color: var(--ink); }
.app-page .section-title { margin-top: 56px; }
.features { max-width: 760px; margin: 0; display: grid; }
.features > div { display: grid; grid-template-columns: 200px 1fr; gap: 6px 24px; padding: 14px 0; border-top: 1px solid var(--line); }
.features dt { font-weight: 600; font-size: 15px; }
.features dd { margin: 0; color: var(--muted); font-size: 15px; }
.features code { font-size: 13px; background: var(--soft); border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; }
@media (max-width: 640px) {
  .features > div { grid-template-columns: 1fr; }
  .app-icon { width: 54px; height: 54px; border-radius: 13px; }
}

/* Favorites, stats and source links */
.fav-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; font: inherit; font-size: 13px;
  color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.fav-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.fav-btn:hover, .fav-btn:focus-visible { color: var(--ink); border-color: var(--ink); }
.fav-btn[aria-pressed="true"] { color: #e5484d; border-color: color-mix(in srgb, #e5484d 45%, var(--line)); }
.fav-btn[aria-pressed="true"] svg { fill: currentColor; }
.fav-count:empty { display: none; }
.app-row .fav-btn { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
.stat { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); }
.app-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 20px; }
.app-actions .stat { font-size: 13px; }
.source-link { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); text-decoration: none; }
.source-link svg { width: 16px; height: 16px; fill: currentColor; }
.source-link:hover, .source-link:focus-visible { color: var(--ink); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; font: inherit; font-size: 14px;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.chip svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.chip[aria-pressed="true"] { color: #e5484d; border-color: color-mix(in srgb, #e5484d 45%, var(--line)); }
.chip[aria-pressed="true"] svg { fill: currentColor; }
@media (max-width: 600px) {
  .app-row > a { padding-right: 8px; padding-bottom: 54px; }
  .app-row .fav-btn { top: auto; bottom: 14px; transform: none; left: 80px; right: auto; }
  #app-fav-only { grid-column: 1 / -1; justify-content: center; }
}

/* Comments */
.comments { max-width: 760px; }
.comment-form { display: grid; gap: 10px; margin-bottom: 8px; }
.comment-form input, .comment-form textarea, .admin-login input {
  width: 100%; font: inherit; font-size: 14px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none; transition: border-color .15s;
}
.comment-form input { max-width: 280px; }
.comment-form textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.comment-form input:focus, .comment-form textarea:focus, .admin-login input:focus { border-color: var(--ink); }
.comment-send { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.cf-turnstile { min-width: 0; flex: 1 1 280px; max-width: 360px; }
.comment-form button, .admin-login button {
  height: 38px; padding: 0 18px; font: inherit; font-size: 14px; font-weight: 600; color: var(--bg); background: var(--ink);
  border: 0; border-radius: 10px; cursor: pointer;
}
.comment-form button:disabled { opacity: .5; cursor: default; }
.comment-status { min-height: 1.4em; margin: 0; font-size: 13px; color: var(--muted); }
.comment-list { margin: 8px 0 0; padding: 0; list-style: none; }
.comment { padding: 14px 0; border-top: 1px solid var(--line); }
.comment-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.comment-head strong { font-size: 14px; }
.comment-head time { font-size: 12.5px; color: var(--muted); }
.comment p { margin: 4px 0 0; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-empty { padding: 14px 0; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.admin-login { display: flex; gap: 10px; max-width: 460px; margin-bottom: 10px; }
.admin-delete { margin-top: 8px; font: inherit; font-size: 13px; color: #e5484d; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; cursor: pointer; }
