:root {
  --gold: #ffc900;
  --black: #050505;
  --ink: #141414;
  --white: #fff;
  --paper: #f2f2ef;
  --gray-1: #e6e6e1;
  --gray-2: #b8b8b2;
  --gray-3: #70706c;
  --green: #148342;
  --border: 2px solid var(--black);
  --mono: "JetBrains Mono", "Consolas", monospace;
  --sans: "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  min-width: 320px;
  margin: 0;
  background: var(--paper);
  color: var(--black);
  font-family: var(--sans);
  letter-spacing: 0;
}
a:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  min-height: 56px;
  padding: 0 16px;
  border-bottom: 4px solid var(--gold);
  background: var(--black);
  color: var(--white);
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 2px solid var(--white);
  background: var(--gold);
}
.brand-mark img { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.brand-copy strong, .brand-copy small { display: block; }
.brand-copy strong { font-size: 15px; font-weight: 900; letter-spacing: .08em; }
.brand-copy small { margin-top: 3px; color: var(--gray-2); font: 700 9px/1.2 var(--mono); letter-spacing: .18em; }
.series-label { padding: 6px 8px; border: 1px solid #555; color: var(--gray-1); font: 700 8px var(--mono); }

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 34px 0 52px; }
.directory-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: var(--border);
}
.eyebrow { color: var(--gray-3); font: 800 9px var(--mono); }
h1 { margin: 5px 0 0; font-size: 28px; line-height: 1.15; letter-spacing: 0; }
.directory-heading p { margin: 0 0 2px; color: var(--gray-3); font-size: 12px; font-weight: 800; }

.tool-directory { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-left: var(--border); }
.tool-entry { min-width: 0; border-right: var(--border); border-bottom: var(--border); background: var(--white); }
.tool-entry-primary { background: var(--gold); }
.tool-preview { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; border-bottom: var(--border); background: var(--ink); }
.tool-preview::after { position: absolute; inset: 0; content: ""; border: 8px solid rgba(255, 255, 255, .08); pointer-events: none; }
.tool-preview img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top left; filter: saturate(.9) contrast(1.04); transition: transform .18s ease; }
.tool-preview:hover img { transform: scale(1.015); }
.tool-body { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; min-height: 142px; }
.tool-index { padding: 17px 10px; border-right: 1px solid var(--black); font: 900 12px var(--mono); }
.tool-copy { min-width: 0; padding: 16px 14px; }
.tool-kind { color: var(--gray-3); font: 800 8px var(--mono); }
.tool-entry-primary .tool-kind { color: #4e4100; }
.tool-copy h2 { margin: 6px 0 5px; font-size: 20px; line-height: 1.2; letter-spacing: 0; }
.tool-copy p { margin: 0; color: var(--gray-3); font-size: 11px; font-weight: 700; line-height: 1.55; }
.tool-entry-primary .tool-copy p { color: #443900; }
.tool-action {
  display: flex;
  min-width: 110px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border-left: var(--border);
  background: var(--black);
  color: var(--white);
  font-size: 11px;
  font-weight: 900;
  text-decoration: none;
}
.tool-action span { color: var(--gold); font: 900 18px/1 var(--mono); }
.tool-action:hover { background: var(--green); }

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 18px max(20px, calc((100% - 1180px) / 2));
  border-top: var(--border);
  background: var(--black);
  color: var(--white);
  font: 700 9px var(--mono);
}
footer span { color: var(--gray-2); }

@media (max-width: 760px) {
  main { width: min(100% - 24px, 560px); padding: 22px 0 34px; }
  .directory-heading { align-items: start; flex-direction: column; gap: 8px; padding-bottom: 13px; }
  h1 { font-size: 23px; }
  .tool-directory { grid-template-columns: 1fr; }
  .tool-body { min-height: 128px; }
}

@media (max-width: 460px) {
  .topbar { padding-inline: 10px; }
  .series-label { display: none; }
  .tool-body { grid-template-columns: 36px minmax(0, 1fr); }
  .tool-index { padding-inline: 8px; }
  .tool-copy { padding: 13px 12px; }
  .tool-action { grid-column: 1 / -1; min-height: 42px; border-top: var(--border); border-left: 0; }
  footer { align-items: flex-start; flex-direction: column; gap: 5px; padding: 15px 12px; }
}

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