:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #4f46e5;
  --brand-soft: #eef2ff;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--brand); }
img { max-width: 100%; height: auto; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: #fff; padding: 8px 12px; z-index: 10; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.header-inner { display: flex; align-items: center; gap: 16px; padding-top: 12px; padding-bottom: 8px; }
.logo b { color: var(--brand); font-weight: 800; }
.logo b + b { color: #7c3aed; }
.prose-wide { max-width: 900px; color: var(--muted); }
.prose-wide h2 { color: var(--text); font-size: 1.2rem; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; flex-shrink: 0; }
.search { flex: 1; display: flex; max-width: 560px; margin-left: auto; }
.search input { flex: 1; min-width: 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px 0 0 999px; font: inherit; background: var(--bg); }
.search input:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.search button { border: 0; background: var(--brand); color: #fff; padding: 0 16px; border-radius: 0 999px 999px 0; cursor: pointer; }
.cat-nav { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.cat-nav a { white-space: nowrap; padding: 4px 12px; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: .92rem; }
.cat-nav a:hover, .cat-nav a[aria-current] { background: var(--brand-soft); color: var(--brand); }

/* Hero */
.hero { background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff; padding: 56px 0 48px; text-align: center; }
.hero h1 { font-size: clamp(1.9rem, 5vw, 3rem); margin: 0 0 12px; line-height: 1.15; }
.hero .lead { color: #e0e7ff; max-width: 640px; margin: 0 auto 24px; }
.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chips a { display: inline-block; padding: 8px 16px; border-radius: 999px; background: rgba(255,255,255,.15); color: #fff; text-decoration: none; }
.chips a:hover { background: rgba(255,255,255,.28); }
.chips span { opacity: .75; font-size: .85em; }

/* Section & grid */
.section { padding-top: 32px; padding-bottom: 16px; }
.section h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin: 0 0 8px; line-height: 1.2; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.section-head h2 { margin: 0 0 12px; font-size: 1.3rem; }
.section-head a { text-decoration: none; font-weight: 600; white-space: nowrap; }
.lead { color: var(--muted); max-width: 760px; }
.grid { list-style: none; padding: 0; margin: 16px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.card a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--text); transition: transform .15s, box-shadow .15s, border-color .15s; }
.card a:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: 0 8px 20px rgba(79,70,229,.12); }
.card img { width: 64px; height: 64px; margin-bottom: 6px; }
.card-title { font-weight: 600; font-size: .95rem; text-align: center; }
.card-meta { font-size: .75rem; color: var(--muted); }

/* Breadcrumb */
.breadcrumb ol { list-style: none; padding: 16px 0 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; font-size: .88rem; color: var(--muted); }
.breadcrumb li + li::before { content: "›"; margin-right: 6px; }
.breadcrumb a { color: var(--muted); }

/* Detail */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 32px; padding-top: 20px; padding-bottom: 16px; }
.preview { margin: 0; aspect-ratio: 1; display: grid; place-items: center; border-radius: var(--radius); border: 1px solid var(--line); position: sticky; top: 120px; }
.checker { background-color: #fff; background-image: linear-gradient(45deg, #f1f5f9 25%, transparent 25%), linear-gradient(-45deg, #f1f5f9 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #f1f5f9 75%), linear-gradient(-45deg, transparent 75%, #f1f5f9 75%); background-size: 24px 24px; background-position: 0 0, 0 12px, 12px -12px, -12px 0; }
.preview img { width: 60%; height: auto; }
.info h1 { font-size: clamp(1.5rem, 3.5vw, 2rem); margin: 0 0 8px; line-height: 1.2; }
.controls { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 20px 0; display: grid; gap: 16px; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.color-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
input[type=color] { width: 44px; height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: #fff; cursor: pointer; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch:hover { box-shadow: 0 0 0 2px var(--brand); }
select { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; width: 100%; max-width: 220px; }
.buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { font: inherit; font-weight: 600; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--brand); background: #fff; color: var(--brand); cursor: pointer; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.ghost { border-color: var(--line); color: var(--text); }
.btn:hover { filter: brightness(.95); }
.status { margin: 0; min-height: 1.4em; color: #16a34a; font-size: .9rem; }
.meta-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.meta-table th, .meta-table td { text-align: left; padding: 8px 0; border-bottom: 1px solid var(--line); }
.meta-table th { color: var(--muted); font-weight: 500; width: 40%; }
.tags { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags a { display: inline-block; padding: 3px 10px; background: var(--brand-soft); border-radius: 999px; font-size: .82rem; text-decoration: none; }

/* FAQ & prose */
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin-top: 8px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: 8px 0 0; color: var(--muted); }
.prose { max-width: 760px; }

/* Footer */
.site-footer { margin-top: 48px; background: #0f172a; color: #cbd5e1; padding: 40px 0 16px; }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; }
.site-footer strong { color: #fff; font-size: 1.1rem; }
.site-footer h2 { font-size: .95rem; color: #fff; margin: 0 0 8px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer a { color: #cbd5e1; text-decoration: none; line-height: 2; }
.site-footer a:hover { color: #fff; }
.copy { font-size: .82rem; color: #64748b; margin-top: 24px; }

@media (max-width: 760px) {
  .header-inner { flex-wrap: wrap; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .detail { grid-template-columns: 1fr; gap: 16px; }
  .preview { position: static; max-width: 360px; margin: 0 auto; width: 100%; }
  .footer-inner { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
}

.pager { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 24px; }
.pager a, .pager span { padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); text-decoration: none; }
.pager span { background: var(--brand); color: #fff; border-color: var(--brand); }
