:root {
  color-scheme: light dark;
  --bg: oklch(0.975 0 0);
  --surface: oklch(1 0 0);
  --surface-strong: oklch(0.945 0 0);
  --ink: oklch(0.2 0 0);
  --muted: oklch(0.45 0 0);
  --border: oklch(0.88 0 0);
  --border-strong: oklch(0.72 0 0);
  --brand: #cd131c;
  --brand-hover: #aa0e16;
  --brand-soft: oklch(0.96 0.025 26);
  --brand-ink: #a20d15;
  --link: #b20f18;
  --link-hover: #8f0b12;
  --danger: oklch(0.46 0.16 29);
  --danger-soft: oklch(0.96 0.025 29);
  --focus: #cd131c;
  --on-brand: oklch(1 0 0);
  --header-bg: oklch(1 0 0);
  --header-ink: oklch(0.16 0 0);
  --header-muted: oklch(0.4 0 0);
  --header-border: oklch(0.9 0 0);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 8px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  font-family: "PingFang SC", "Microsoft YaHei", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--link-hover);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 60;
  transform: translateY(-160%);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--bg);
  transition: transform 160ms var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--header-border);
  background: var(--header-bg);
}

.header-inner,
.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.header-inner {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  color: var(--header-ink);
  text-decoration: none;
}

.wordmark:hover {
  color: var(--header-ink);
}

.wordmark-logo {
  display: block;
  width: 106px;
  height: auto;
}

.wordmark-divider {
  width: 1px;
  height: 18px;
  margin-inline: 12px;
  background: var(--header-border);
}

.wordmark-product {
  color: var(--header-ink);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 14px;
}

.header-nav a {
  position: relative;
  padding-block: 22px;
  color: var(--header-muted);
  font-weight: 600;
  text-decoration: none;
}

.header-nav a::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--brand);
  content: "";
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 180ms var(--ease);
}

.header-nav a:hover {
  color: var(--header-ink);
}

.header-nav a:hover::after,
.header-nav a:focus-visible::after {
  transform: scaleX(1);
}

.page-shell {
  min-height: calc(100vh - 66px);
  padding-block: 32px 64px;
}

.page-context,
.state-label {
  margin: 0 0 9px;
  color: var(--brand-ink);
  font-size: 13px;
  font-weight: 720;
}

h1,
h2,
h3,
h4,
p {
  text-wrap: pretty;
}

h1,
h2,
h3,
h4 {
  text-wrap: balance;
}

h1 {
  max-width: 22ch;
  margin: 0;
  font-size: 34px;
  line-height: 1.18;
  letter-spacing: -0.03em;
}

.detail-description {
  max-width: 68ch;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.detail-facts {
  margin: 0;
  border-block: 1px solid var(--border);
}

.detail-facts > div {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 18px;
  padding-block: 11px;
}

.detail-facts > div + div {
  border-top: 1px solid var(--border);
}

dt {
  color: var(--muted);
  font-size: 13px;
}

dd {
  min-width: 0;
  margin: 0;
  font-weight: 620;
  overflow-wrap: anywhere;
}

.catalog-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.34fr);
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.field {
  display: grid;
  gap: 6px;
}

.field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 160ms var(--ease), background-color 160ms var(--ease);
}

.field input {
  padding: 9px 12px;
}

.field select {
  padding: 9px 34px 9px 12px;
}

.field input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.field input:hover,
.field select:hover {
  border-color: var(--ink);
}

.field input:focus,
.field select:focus {
  border-color: var(--brand);
  outline: 3px solid var(--brand-soft);
  outline-offset: 1px;
}

.catalog-summary {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-inline: 2px;
}

.catalog-facts,
.catalog-facts > div {
  display: flex;
  align-items: baseline;
}

.catalog-facts {
  min-width: 0;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0;
}

.catalog-facts > div {
  gap: 6px;
}

.catalog-facts dt,
.catalog-facts dd {
  font-size: 12px;
}

.catalog-facts dd {
  font-weight: 620;
}

.text-button {
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: var(--link);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.text-button:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.tools-list {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.tool-entry {
  display: grid;
  grid-template-columns: minmax(250px, 1.35fr) minmax(120px, 0.42fr) minmax(280px, 0.85fr) auto;
  align-items: center;
  gap: 24px;
  padding: 24px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
  text-decoration: none;
  transition: background-color 180ms var(--ease);
}

.tool-entry:hover {
  background: var(--surface-strong);
  color: var(--ink);
}

.tool-entry:active {
  background: var(--brand-soft);
}

.tool-entry:last-child {
  border-bottom: 0;
}

.tool-identity {
  min-width: 0;
}

.tool-identity h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.tool-identity p {
  max-width: 64ch;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.tool-release {
  display: grid;
  gap: 4px;
}

.tool-meta-label {
  color: var(--muted);
  font-size: 12px;
}

.tool-release strong {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.platform-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.platform-chip,
.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 11px;
  font-weight: 680;
  line-height: 1.2;
}

.platform-chip-current,
.status-recommended {
  background: var(--brand-soft);
  color: var(--brand-ink);
}

.tool-entry-action {
  color: var(--link);
  font-size: 13px;
  font-weight: 680;
  white-space: nowrap;
}

.empty-state,
.state-panel,
.detail-empty {
  max-width: 760px;
  padding-block: 72px;
}

.empty-state {
  margin-inline: auto;
  text-align: center;
}

.empty-state h2,
.state-panel h1,
.detail-empty h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.empty-state p,
.state-copy,
.detail-empty > p:last-child {
  margin: 12px 0 24px;
  color: var(--muted);
}

.state-actions,
.artifact-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
}

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease);
}

.button:hover {
  text-decoration: none;
}

.button-primary {
  background: var(--brand);
  color: var(--on-brand);
}

.button-primary:hover {
  background: var(--brand-hover);
  color: var(--on-brand);
}

.button-secondary {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--ink);
}

.button-secondary:hover {
  border-color: var(--ink);
  background: var(--surface);
  color: var(--ink);
}

.button-ghost {
  background: transparent;
  color: var(--link);
}

.button-ghost:hover {
  background: var(--surface);
  color: var(--link-hover);
}

.button-compact {
  min-height: 36px;
  padding: 7px 11px;
  font-size: 12px;
}

.button:disabled {
  border-color: var(--border);
  background: var(--surface-strong);
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.78;
}

.detail-header {
  max-width: 820px;
}

.back-link {
  display: inline-block;
  margin-bottom: 34px;
  font-size: 13px;
  font-weight: 680;
}

.detail-header h1 {
  max-width: none;
  overflow-wrap: anywhere;
}

.detail-facts {
  max-width: 920px;
  margin-top: 32px;
}

.detail-facts > div {
  grid-template-columns: 120px minmax(0, 1fr);
}

.section-heading {
  margin-top: 58px;
}

.section-heading h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.section-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.versions-list {
  display: grid;
  gap: 20px;
  margin-top: 20px;
}

.version-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: clip;
}

.version-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.version-title-group,
.version-metadata {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.version-title-group h3 {
  margin: 0;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.version-metadata {
  justify-content: flex-end;
  color: var(--muted);
  font-size: 12px;
}

.artifact-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.62fr) minmax(320px, 1.1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 18px;
}

.artifact-row + .artifact-row {
  border-top: 1px solid var(--border);
}

.artifact-heading {
  min-width: 0;
}

.artifact-heading h4 {
  margin: 0;
  font-size: 14px;
}

.artifact-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.artifact-facts {
  min-width: 0;
  display: grid;
  gap: 5px;
  margin: 0;
}

.artifact-facts > div {
  min-width: 0;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 8px;
}

.artifact-facts dt,
.artifact-facts dd {
  font-size: 11px;
}

.artifact-facts dd {
  font-weight: 560;
}

code {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  word-break: break-all;
}

.artifact-actions {
  justify-content: flex-end;
}

.artifact-invalid {
  background: var(--danger-soft);
}

.artifact-warning {
  grid-column: 1 / -1;
  margin: -6px 0 0;
  color: var(--danger);
  font-size: 12px;
  font-weight: 650;
}

.inline-empty {
  margin: 0;
  padding: 24px 18px;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  max-width: min(380px, calc(100vw - 32px));
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--bg);
  box-shadow: 0 4px 8px oklch(0 0 0 / 0.2);
  font-size: 13px;
  font-weight: 650;
}

.toast-error {
  background: var(--danger);
  color: var(--on-brand);
}

.clipboard-fallback {
  position: fixed;
  top: -1000px;
  left: -1000px;
}

.loading-panel {
  max-width: none;
  padding-block: 12px;
}

.skeleton {
  border-radius: 6px;
  background: var(--surface-strong);
  animation: skeleton-pulse 1.4s ease-in-out infinite alternate;
}

.loading-list {
  display: grid;
  gap: 12px;
  margin-top: 0;
}

.loading-row {
  height: 104px;
}

@keyframes skeleton-pulse {
  from { opacity: 0.62; }
  to { opacity: 1; }
}

@media (max-width: 900px) {
  .tool-entry {
    grid-template-columns: minmax(220px, 1fr) minmax(120px, 0.45fr) auto;
  }

  .platform-list {
    grid-column: 1 / 3;
  }

  .tool-entry-action {
    grid-column: 3;
    grid-row: 1 / 3;
  }

  .artifact-row {
    grid-template-columns: minmax(180px, 0.7fr) minmax(280px, 1fr);
  }

  .artifact-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .header-inner,
  .page-shell {
    width: min(100% - 28px, 1180px);
  }

  .header-inner {
    min-height: 58px;
  }

  .wordmark-logo {
    width: 92px;
  }

  .wordmark-divider {
    height: 16px;
    margin-inline: 9px;
  }

  .wordmark-product {
    font-size: 13px;
  }

  .header-nav a {
    padding-block: 18px;
  }

  .header-nav a:first-child {
    display: none;
  }

  .page-shell {
    padding-block: 36px 56px;
  }

  h1 {
    font-size: 29px;
  }

  .catalog-toolbar {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .tool-entry {
    grid-template-columns: 1fr auto;
    gap: 14px 16px;
    padding: 20px 4px;
  }

  .tool-identity {
    grid-column: 1 / -1;
  }

  .tool-release {
    grid-column: 1;
  }

  .platform-list {
    grid-column: 1 / -1;
  }

  .tool-entry-action {
    grid-column: 2;
    grid-row: 2;
  }

  .back-link {
    margin-bottom: 26px;
  }

  .detail-facts > div {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .section-heading {
    margin-top: 46px;
  }

  .version-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .version-metadata {
    justify-content: flex-start;
  }

  .artifact-row {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px;
  }

  .artifact-facts,
  .artifact-actions,
  .artifact-warning {
    grid-column: 1;
  }

  .artifact-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .artifact-actions .button:first-child {
    grid-column: 1 / -1;
  }

  .toast {
    right: 16px;
    bottom: 16px;
    left: 16px;
    max-width: none;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: oklch(0.13 0 0);
    --surface: oklch(0.18 0 0);
    --surface-strong: oklch(0.23 0 0);
    --ink: oklch(0.94 0 0);
    --muted: oklch(0.72 0 0);
    --border: oklch(0.3 0 0);
    --border-strong: oklch(0.43 0 0);
    --brand: oklch(0.62 0.22 26);
    --brand-hover: oklch(0.7 0.19 26);
    --brand-soft: oklch(0.25 0.06 26);
    --brand-ink: oklch(0.82 0.12 26);
    --link: oklch(0.75 0.15 26);
    --link-hover: oklch(0.84 0.1 26);
    --danger: oklch(0.7 0.15 29);
    --danger-soft: oklch(0.23 0.055 29);
    --focus: oklch(0.7 0.19 26);
    --header-bg: oklch(0.13 0 0);
    --header-ink: oklch(0.94 0 0);
    --header-muted: oklch(0.72 0 0);
    --header-border: oklch(0.3 0 0);
  }

  .wordmark-logo {
    filter: invert(1) hue-rotate(180deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (forced-colors: active) {
  .platform-chip,
  .status-chip,
  .button,
  .catalog-toolbar,
  .version-section {
    forced-color-adjust: auto;
  }
}

@media print {
  .site-header,
  .catalog-toolbar,
  .catalog-summary,
  .artifact-actions,
  .toast {
    display: none !important;
  }

  .page-shell {
    width: 100%;
    padding: 0;
  }
}
