:root {
  color-scheme: light dark;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --text: #16181d;
  --muted: #5a5f6b;
  --line: #d8dbe2;
  --accent: #084fd6;
  --accent-ink: #ffffff;
  --accent-soft: #e7efff;
  --warn: #7a4100;
  --warn-bg: #fff0d4;
  --danger: #8f1717;
  --danger-bg: #ffe4e4;
  --ok-bg: #ddf5e5;
  --ok: #0e5a2b;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 8px 24px rgb(0 0 0 / 4%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101216;
    --surface: #181b21;
    --surface-2: #22262e;
    --text: #eceef3;
    --muted: #a5abb8;
    --line: #303641;
    --accent: #8ab4ff;
    --accent-ink: #0b1220;
    --accent-soft: #1b2b46;
    --warn: #ffd08a;
    --warn-bg: #3a2a0e;
    --danger: #ff9b9b;
    --danger-bg: #3d1919;
    --ok-bg: #12351f;
    --ok: #86e0a8;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

code, .sha code, .url {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.85em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.08em 0.38em;
}

code { overflow-wrap: anywhere; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  color: var(--text);
  padding: 0.6rem 1rem;
  z-index: 10;
}
.skip:focus { left: 1rem; top: 1rem; outline: 3px solid var(--accent); }

.site-header, .site-main, .site-footer {
  width: min(980px, 100% - 2rem);
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 1.4rem 0 0.8rem;
}

.brand {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}
.brand::before {
  content: "";
  display: inline-block;
  width: 0.65em;
  height: 0.65em;
  margin-right: 0.45em;
  border-radius: 4px;
  background: var(--accent);
}
.tagline { color: var(--muted); font-size: 0.9rem; }

.site-main { padding-bottom: 3rem; }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.2rem 0 2rem;
  color: var(--muted);
  font-size: 0.85rem;
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); margin: 0.4rem 0 0.5rem; }
h2 { font-size: 1.25rem; margin: 0 0 0.6rem; }

.page-head { padding: 1rem 0 0.4rem; }
.lede { color: var(--muted); margin: 0 0 1.2rem; font-size: 1.05rem; }
.meta { color: var(--muted); margin: 0.2rem 0 0.6rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.empty { color: var(--muted); }

.breadcrumb { margin-top: 0.8rem; color: var(--muted); font-size: 0.9rem; }

.app-head {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin: 0.6rem 0 1.4rem;
}

.app-icon {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 1.4rem;
  font-weight: 700;
  border: 1px solid var(--line);
}
.app-icon.large { width: 64px; height: 64px; font-size: 1.8rem; border-radius: 16px; }
.app-icon img { width: 100%; height: 100%; object-fit: cover; }

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: 1rem;
}

.app-card {
  display: flex;
  gap: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}
.app-card-body { min-width: 0; }
.app-card h2 { font-size: 1.05rem; margin: 0 0 0.1rem; }
.app-card h2 a { color: var(--text); text-decoration: none; }
.app-card h2 a:hover { text-decoration: underline; }
.app-card .description { color: var(--muted); font-size: 0.9rem; }
.app-card .description p { margin: 0.2rem 0; }
.latest-line { font-size: 0.88rem; margin: 0.6rem 0 0; }
.dot { color: var(--muted); padding: 0 0.15rem; }

.description { color: var(--muted); }
.description p { margin: 0.3rem 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1rem 0;
  box-shadow: var(--shadow);
}

.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.card-head h2 { margin: 0; }

.latest { border-left: 4px solid var(--accent); }
.big-version { font-size: clamp(1.6rem, 4vw, 2.1rem); font-weight: 800; margin: 0.35rem 0 0; letter-spacing: -0.02em; }

.latest-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.5rem;
  align-items: start;
  margin-top: 1rem;
}

.facts { display: flex; flex-wrap: wrap; gap: 0.6rem 1.6rem; margin: 0 0 1rem; }
.facts div { min-width: 0; }
.facts dt { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.facts dd { margin: 0.1rem 0 0; }
.fact-wide { flex-basis: 100%; }

.sha { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.sha code { min-width: 0; }

button.copy {
  font: inherit;
  font-size: 0.78rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.14rem 0.55rem;
  cursor: pointer;
}
button.copy:hover { border-color: var(--accent); color: var(--accent); }
button.copy:focus-visible, .button:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.downloads { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.8rem 0; }
.button {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  font-weight: 650;
  padding: 0.62rem 1rem;
  border-radius: 10px;
  border: 1px solid transparent;
}
.button:hover { filter: brightness(1.06); text-decoration: none; }
.button-sub { font-weight: 400; font-size: 0.78rem; opacity: 0.85; }

.url { display: inline; }

.qr-figure {
  margin: 0;
  padding: 0.6rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  max-width: 200px;
}
.qr-figure svg { display: block; width: 168px; height: 168px; }
.qr-figure figcaption { color: #333; font-size: 0.75rem; margin-top: 0.4rem; line-height: 1.35; }

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
  vertical-align: 0.08em;
}
.badge.channel-stable { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.channel-beta { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.withdrawn { background: var(--danger-bg); color: var(--danger); border-color: transparent; }

.notice {
  background: var(--warn-bg);
  color: var(--warn);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.9rem;
}

.notes { overflow-wrap: anywhere; }
.notes > :first-child { margin-top: 0; }
.notes > :last-child { margin-bottom: 0; }
.notes img { max-width: 100%; height: auto; }
.notes table { border-collapse: collapse; display: block; overflow-x: auto; }
.notes th, .notes td { border: 1px solid var(--line); padding: 0.3rem 0.55rem; text-align: left; }
.notes pre { overflow-x: auto; background: var(--surface-2); padding: 0.8rem; border-radius: 8px; }
.notes code { background: var(--surface-2); }
.notes blockquote { border-left: 3px solid var(--line); margin-left: 0; padding-left: 0.8rem; color: var(--muted); }

.history { margin-top: 2rem; }
.release-row { padding: 0; margin: 0.6rem 0; }
.release-row > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.7rem;
  cursor: pointer;
  padding: 0.85rem 1rem;
  list-style-position: inside;
}
.release-row > summary::marker { color: var(--muted); }
.summary-version { font-weight: 700; }
.summary-date, .summary-code { color: var(--muted); font-size: 0.85rem; }
.summary-date { margin-left: auto; }
.release-body { padding: 0 1rem 1rem; border-top: 1px solid var(--line); padding-top: 0.9rem; }

.files { list-style: none; margin: 0.8rem 0 0; padding: 0; display: grid; gap: 0.6rem; }
.files li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.8rem; }
.file-link { font-weight: 600; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); }
thead th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
tbody th { font-weight: 600; }

.error-page { text-align: center; padding: 3rem 1rem; }
.error-code { font-size: 3rem; font-weight: 800; color: var(--muted); margin: 0; line-height: 1; }

@media (max-width: 700px) {
  .latest-grid { grid-template-columns: 1fr; }
  .qr-figure { max-width: none; display: flex; gap: 0.8rem; align-items: center; }
  .qr-figure svg { flex: none; }
  .qr-figure figcaption { margin-top: 0; }
  .summary-date { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
