:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #1f2328;
  --muted: #656d76;
  --border: #d0d7de;
  --accent: #0969da;
  --badge: #eaeef2;
  --badge-cat: #ddf4ff;
  --warn: #fff8c5;
  --hover: #f6f8fa;
  --neg: #cf222e;
  --neg-bg: #ffebe9;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1117;
  --fg: #e6edf3;
  --muted: #8d96a0;
  --border: #30363d;
  --accent: #4493f8;
  --badge: #21262d;
  --badge-cat: #0c2d6b;
  --warn: #4d3800;
  --hover: #161b22;
  --neg: #ff7b72;
  --neg-bg: #3d1214;
}
/* Without JS (no data-theme) follow the OS setting. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0d1117;
    --fg: #e6edf3;
    --muted: #8d96a0;
    --border: #30363d;
    --accent: #4493f8;
    --badge: #21262d;
    --badge-cat: #0c2d6b;
    --warn: #4d3800;
    --hover: #161b22;
    --neg: #ff7b72;
    --neg-bg: #3d1214;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.site-footer, main { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
/* The border spans the viewport; the content lines up with main. */
.site-header { border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1200px; min-height: 56px; margin: 0 auto; padding: 8px 16px; padding-right: clamp(16px, calc(84px - (100vw - 1200px) / 2), 84px); }
/* .site-name is a flex box so a 24px logo can go before .site-title. */
.site-name { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-weight: 700; font-size: 1.2rem; color: var(--fg); }
.site-name:hover { text-decoration: none; }
.site-logo { width: 24px; height: 24px; flex: none; border-radius: 6px; }
.site-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.hbtn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; box-sizing: border-box; height: 40px; min-width: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--fg); font: inherit; font-size: 0.95rem; font-weight: 500; line-height: 1; white-space: nowrap; cursor: pointer; }
.hbtn:hover { background: var(--hover); text-decoration: none; }
.hbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hbtn .icon { width: 18px; height: 18px; }
.hbtn-icon { padding: 0; }
.hbtn-icon span { display: inline-flex; }
/* The icon shows the theme a click switches to. */
:root[data-theme="dark"] .theme-moon, :root:not([data-theme="dark"]) .theme-sun { display: none; }
/* GitHub Corners (https://github.com/tholman/github-corners) by Tim Holman, MIT License:
   Copyright (c) 2016 Tim Holman. Colours follow the theme variables. */
.github-corner { position: absolute; top: 0; right: 0; z-index: 10; display: block; width: 80px; height: 80px; color: var(--bg); fill: var(--fg); }
.github-corner:hover { text-decoration: none; }
.github-corner svg { display: block; width: 80px; height: 80px; }
.github-corner .octo-arm { transform-origin: 130px 106px; }
.github-corner:hover .octo-arm { animation: octocat-wave 560ms ease-in-out; }
.github-corner:focus-visible { outline: 2px solid var(--accent); }
@keyframes octocat-wave { 0%, 100% { transform: rotate(0); } 20%, 60% { transform: rotate(-25deg); } 40%, 80% { transform: rotate(10deg); } }
@media (max-width: 500px) {
  .github-corner:hover .octo-arm { animation: none; }
  .github-corner .octo-arm { animation: octocat-wave 560ms ease-in-out; }
}
@media (prefers-reduced-motion: reduce) {
  .github-corner .octo-arm, .github-corner:hover .octo-arm { animation: none; }
}
main { padding-top: 16px; padding-bottom: 24px; }
#tool-table { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; vertical-align: middle; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { font-weight: 600; white-space: nowrap; color: var(--muted); font-size: 0.85rem; padding-top: 8px; padding-bottom: 8px; }
td { font-size: 0.92rem; }
tbody tr:hover { background: var(--hover); }
.col-name { min-width: 14rem; }
.col-works, .col-platforms { white-space: nowrap; }
.marks { display: grid; grid-template-columns: repeat(3, auto); gap: 3px 3px; justify-content: start; }
.mark { display: block; padding: 0 4px; border: 1px solid transparent; border-radius: 4px; background: var(--badge); color: var(--fg); font-size: 0.75rem; font-weight: 600; line-height: 18px; text-align: center; white-space: nowrap; }
a.mark:hover { border-color: var(--accent); }
.mark-off { background: none; border-color: var(--border); color: var(--muted); font-weight: 400; opacity: 0.6; }
.tool-cell { display: flex; align-items: flex-start; gap: 10px; }
.tool-main { min-width: 0; }
.tool-name { font-weight: 600; font-size: 1rem; line-height: 22px; }
.unread-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 6px; vertical-align: 2px; }
.fav { flex: none; display: inline-flex; width: 32px; height: 32px; margin-top: 1px; }
/* White plate so dark favicons stay visible in dark mode (invisible in light mode). */
.fav img { width: 32px; height: 32px; box-sizing: border-box; padding: 3px; border-radius: 6px; background: #fff; object-fit: contain; }
.fav-i { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: hsl(var(--h) 45% 38%); color: #fff; font-size: 1rem; font-weight: 600; line-height: 1; }
.fav-i[hidden] { display: none; }
.repo-link { display: inline-flex; vertical-align: middle; margin-left: 6px; color: var(--muted); }
.repo-link:hover { color: var(--accent); }
.repo-link .icon { width: 14px; height: 14px; }
.summary { color: var(--muted); font-size: 0.85rem; line-height: 1.4; margin-top: 1px; max-width: 46rem; }
.col-pricing, .col-updated, .col-stars { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; margin: 1px 2px 1px 0; border-radius: 999px; background: var(--badge); color: var(--fg); font-size: 0.8rem; white-space: nowrap; }
.badge-category { background: var(--badge-cat); }
.badge-warn { background: var(--warn); }
.muted { color: var(--muted); }
.site-footer { display: flex; flex-wrap: wrap; gap: 16px; padding-top: 12px; padding-bottom: 24px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.9rem; }
/* icons */
.ic { display: inline-flex; vertical-align: middle; }
.icon { width: 16px; height: 16px; flex: none; }
.links a, .dim { opacity: 0.4; display: inline-flex; }
.col-stars .ic { margin-right: 4px; }
.col-stars .icon { width: 14px; height: 14px; }
/* search + filters */
#filters { margin-bottom: 12px; min-height: 38px; }
.toolbar { display: flex; align-items: center; gap: 8px; }
.searchbox { flex: 1 1 auto; display: flex; align-items: center; gap: 8px; min-width: 0; padding: 0 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--muted); }
.searchbox:focus-within { border-color: var(--accent); outline: 1px solid var(--accent); }
.search { flex: 1; min-width: 0; padding: 7px 0; border: 0; outline: 0; background: transparent; color: var(--fg); font: inherit; }
button.filter-toggle, button.clear { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--badge); color: var(--fg); font: inherit; cursor: pointer; white-space: nowrap; }
button.filter-toggle[aria-expanded="true"] { border-color: var(--accent); }
button.filter-toggle:disabled { opacity: 0.6; cursor: default; }
button.clear { background: transparent; color: var(--muted); border-color: transparent; padding-left: 6px; padding-right: 6px; }
button.clear:hover { color: var(--fg); }
.count-badge { min-width: 1.4em; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 0.75rem; line-height: 1.5; text-align: center; }
.result-count { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
#filter-panel { margin-top: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; }
#filter-panel[hidden] { display: none; }
.facet { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 0 0 6px; padding: 4px 0; border: 0; }
.facet legend { padding: 0; margin-bottom: 2px; color: var(--muted); font-size: 0.85rem; float: left; width: 100%; }
.opt { white-space: nowrap; font-size: 0.9rem; }
.count { color: var(--muted); font-size: 0.8rem; }
button.sort { all: unset; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; font-weight: 600; font-size: inherit; color: var(--muted); }
.sort { display: inline-flex; align-items: center; gap: 4px; }
button.sort:hover, button.sort:focus-visible { color: var(--fg); }
th[aria-sort="ascending"] .sort, th[aria-sort="descending"] .sort { color: var(--fg); }
/* column header filters: a button in the header opens a popover of choices */
.colfilter { display: inline-flex; align-items: center; gap: 4px; }
.colfilter-btn { display: inline-flex; align-items: center; gap: 4px; min-width: 24px; height: 24px; padding: 0 4px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); font: inherit; cursor: pointer; }
.colfilter-btn:hover:not(:disabled), .colfilter-btn[aria-expanded="true"] { background: var(--hover); color: var(--fg); border-color: var(--border); }
.colfilter-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.colfilter-btn:disabled { opacity: 0.4; cursor: default; }
.colfilter-btn.active { color: var(--accent); border-color: var(--accent); }
.colfilter-btn .ic { pointer-events: none; }
.colfilter-btn .icon { width: 14px; height: 14px; }
.colfilter-btn .count-badge { min-width: 1.3em; padding: 0 5px; font-size: 0.7rem; line-height: 1.4; }
/* position: fixed (placed by the WASM) so the scrolling table wrapper does not clip it */
.colfilter-pop { position: fixed; z-index: 20; display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--fg); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); font-weight: 400; font-size: 0.9rem; white-space: normal; }
.colfilter-pop[hidden] { display: none; }
.colfilter-opts { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; min-height: 0; }
.colfilter-opts .opt { display: flex; align-items: center; gap: 6px; padding: 5px 4px; border-radius: 4px; cursor: pointer; }
.colfilter-opts .opt:hover { background: var(--hover); }
.colfilter-opts .opt input { margin: 0; }
.colfilter-opts .count { margin-left: auto; }
.colfilter-clear { align-self: flex-start; padding: 4px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--badge); color: var(--fg); font: inherit; font-size: 0.85rem; cursor: pointer; }
.colfilter-clear:disabled { opacity: 0.5; cursor: default; }
.colfilter-clear:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* category badges under the summary: phones only (the column is hidden there) */
.tool-cats { display: none; }
@media (max-width: 639px) {
  .col-pricing, .col-category, .col-works, .col-platforms { display: none; }
  .fav, .fav img, .fav-i { width: 24px; height: 24px; }
  .fav-i { font-size: 0.8rem; }
  .tool-cats { display: block; margin-top: 4px; }
  .tool-cats .badge { white-space: normal; font-size: 0.75rem; }
  .tool-cats .badge .icon { display: none; }
  th, td { padding-left: 4px; padding-right: 4px; }
  td { font-size: 0.85rem; }
  .col-name { min-width: 0; }
  .tool-name { overflow-wrap: anywhere; }
  main { padding-left: 12px; padding-right: 12px; }
  th { font-size: 0.78rem; }
  .col-stars .icon { display: none; }
  .tool-name { font-size: 0.95rem; }
  .toolbar { flex-wrap: wrap; }
  button.filter-toggle, button.clear { min-height: 40px; }
  .search { padding: 9px 0; }
  .searchbox { flex-basis: 100%; }
}
/* Phones: the language switch shows only its icon; the name stays for screen readers. */
@media (max-width: 480px) {
  #lang-switch { padding: 0; width: 40px; }
  #lang-switch .lang-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
/* exclude button next to each tag row */
.opt-row { display: inline-flex; align-items: center; gap: 2px; }
.colfilter-opts .opt-row { display: flex; }
.colfilter-opts .opt-row .opt { flex: 1; min-width: 0; }
.opt-x { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.opt-x:hover { color: var(--neg); background: var(--neg-bg); }
.opt-x:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.opt-x[aria-pressed="true"] { color: #fff; background: var(--neg); }
.opt-row.excluded .opt-name { color: var(--neg); text-decoration: line-through; }
@media (hover: hover) {
  .opt-x { opacity: 0; }
  .opt-row:hover .opt-x, .opt-row:focus-within .opt-x, .opt-x[aria-pressed="true"] { opacity: 1; }
}
/* pagination */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; padding: 16px 0 4px; font-size: 0.9rem; }
.pager .range { margin-right: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pager button { min-width: 36px; height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 6px; background: transparent; color: var(--fg); font: inherit; font-variant-numeric: tabular-nums; cursor: pointer; }
.pager button:hover:not(:disabled) { background: var(--hover); }
.pager button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pager button[aria-current="page"] { border-color: var(--accent); background: var(--accent); color: #fff; font-weight: 600; }
.pager button:disabled { opacity: 0.4; cursor: default; }
.pager .gap { padding: 0 4px; color: var(--muted); }
.per-page { display: inline-flex; align-items: center; gap: 6px; margin-left: 12px; color: var(--muted); white-space: nowrap; }
.per-page select { height: 36px; padding: 0 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--fg); font: inherit; font-variant-numeric: tabular-nums; cursor: pointer; }
.per-page select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Intro (h1 and lead) above the table, and the FAQ above the search box. */
.intro { padding-top: 16px; }
.intro h1 { font-size: 1.25rem; line-height: 1.3; margin: 0 0 6px; }
.lead { color: var(--muted); max-width: 72ch; margin: 0 0 16px; font-size: 0.9rem; }
.faq { margin-bottom: 16px; }
.faq h2 { font-size: 1rem; margin: 0 0 8px; }
.faq-list { display: grid; grid-template-columns: 1fr; gap: 6px; align-items: start; }
@media (min-width: 768px) {
  .faq-list { grid-template-columns: 1fr 1fr; gap: 8px; }
}
.faq-item { border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; background: var(--bg); }
.faq-item summary { cursor: pointer; }
.faq-item summary h3 { display: inline; font-size: inherit; font-weight: 600; margin: 0; }
.faq-item p { margin: 8px 0 2px; line-height: 1.6; font-size: 0.9rem; }
