:root {
  --ink: #17211b;
  --muted: #667069;
  --paper: #f6f5ef;
  --card: #fffefa;
  --line: #dedfd7;
  --green: #1f6b4f;
  --green-dark: #174d3b;
  --lime: #d9f09c;
  --amber: #9a6118;
  --amber-bg: #fff5df;
  --shadow: 0 18px 50px rgba(23, 33, 27, .08);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
button { cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.topbar {
  height: 72px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 clamp(20px, 4vw, 64px);
  border-bottom: 1px solid var(--line);
  background: rgba(246, 245, 239, .92);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 20px; letter-spacing: -.03em; }
.brand > span:last-child span { color: var(--green); }
.brand-mark { width: 34px; height: 34px; border-radius: 10px 10px 3px 10px; display: grid; place-items: center; color: white; background: var(--green); font-family: Georgia, serif; font-size: 21px; }
nav { display: flex; gap: 6px; }
.nav-link { border: 0; background: transparent; padding: 10px 14px; color: var(--muted); border-radius: 9px; }
.nav-link.active { color: var(--ink); background: #ecece4; font-weight: 650; }
.nav-link:disabled { cursor: default; opacity: .45; }
.status { justify-self: end; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.status span { width: 8px; height: 8px; border-radius: 50%; background: #46a66d; box-shadow: 0 0 0 4px rgba(70,166,109,.13); }

main { min-height: calc(100vh - 140px); }
.hero {
  text-align: center;
  padding: clamp(54px, 8vw, 100px) 20px 56px;
  background:
    radial-gradient(circle at 14% 18%, rgba(217,240,156,.42), transparent 24%),
    radial-gradient(circle at 88% 8%, rgba(31,107,79,.10), transparent 25%);
}
.eyebrow, .kicker { color: var(--green); text-transform: uppercase; letter-spacing: .14em; font-size: 12px; font-weight: 800; }
h1 { margin: 16px auto 18px; max-width: 900px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(44px, 6vw, 76px); font-weight: 500; letter-spacing: -.045em; line-height: .98; }
h1 em { color: var(--green); font-weight: inherit; }
.hero > p { max-width: 680px; margin: 0 auto 30px; color: var(--muted); font-size: 18px; line-height: 1.55; }
.search-box { max-width: 920px; margin: 0 auto; padding: 7px; display: grid; grid-template-columns: 42px 1fr auto; align-items: center; background: var(--card); border: 1px solid #cfd2c8; border-radius: 16px; box-shadow: var(--shadow); }
.search-icon { font-size: 28px; color: var(--green); transform: rotate(-20deg); }
.search-box input { min-width: 0; height: 52px; border: 0; outline: 0; background: transparent; font-size: 17px; color: var(--ink); }
.search-box input::placeholder { color: #92988f; }
.search-box button { height: 48px; border: 0; border-radius: 11px; padding: 0 22px; color: white; background: var(--green); font-weight: 750; }
.search-box button:hover { background: var(--green-dark); }
.examples { max-width: 920px; margin: 16px auto 0; display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.examples button { border: 1px solid var(--line); background: rgba(255,255,255,.55); color: #4d5750; padding: 6px 10px; border-radius: 999px; }
.examples button:hover { border-color: var(--green); color: var(--green); }

.workspace { width: min(1340px, calc(100% - 40px)); margin: 0 auto 70px; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr); gap: 24px; align-items: start; }
.results-column, .detail-panel { min-width: 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 16px; }
.section-head h2 { margin: 5px 0 0; font-family: Georgia, serif; font-size: 29px; font-weight: 500; }
.count { color: var(--muted); font-size: 14px; }
.notice { margin-bottom: 14px; padding: 13px 15px; border: 1px solid #efd39a; background: var(--amber-bg); color: #714811; border-radius: 10px; font-size: 13px; line-height: 1.5; }
.results { display: grid; gap: 12px; }
.result-card { width: 100%; text-align: left; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink); transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.result-card:hover, .result-card.selected { transform: translateY(-1px); border-color: #82a993; box-shadow: 0 10px 30px rgba(23,33,27,.07); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--green); font-size: 13px; font-weight: 750; }
.tags { display: flex; gap: 6px; }
.tag { padding: 4px 7px; border-radius: 6px; background: #edf1eb; color: #536158; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.tag.demo { background: var(--amber-bg); color: var(--amber); }
.result-card h3 { margin: 0 0 10px; font-size: 18px; line-height: 1.35; }
.card-meta { display: flex; gap: 16px; color: var(--muted); font-size: 13px; }
.skeleton { height: 144px; border-radius: 14px; background: linear-gradient(90deg, #e9e9e1 25%, #f2f2ec 50%, #e9e9e1 75%); background-size: 200% 100%; animation: pulse 1.4s infinite; }
@keyframes pulse { to { background-position: -200% 0; } }

.detail-panel { position: sticky; top: 96px; min-height: 420px; border: 1px solid var(--line); border-radius: 16px; background: #1e2c24; color: white; overflow: hidden; box-shadow: var(--shadow); }
.detail-empty { min-height: 420px; display: grid; place-content: center; text-align: center; padding: 40px; }
.detail-glyph { margin: 0 auto 18px; width: 52px; height: 52px; border: 1px solid rgba(255,255,255,.24); border-radius: 50%; display: grid; place-items: center; color: var(--lime); font-size: 24px; }
.detail-empty h2 { margin: 0 0 8px; font-family: Georgia, serif; font-weight: 500; }
.detail-empty p { margin: 0; color: #b8c1bb; line-height: 1.55; }
.detail-content { padding: 28px; }
.detail-code { color: var(--lime); font-family: ui-monospace, monospace; font-size: 13px; }
.detail-content h2 { margin: 12px 0 18px; font-family: Georgia, serif; font-weight: 500; font-size: 27px; line-height: 1.16; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 22px; }
.detail-stat { padding: 12px; border-radius: 9px; background: rgba(255,255,255,.07); }
.detail-stat span { display: block; color: #aeb9b2; font-size: 11px; text-transform: uppercase; letter-spacing: .09em; margin-bottom: 5px; }
.detail-stat strong { font-size: 15px; }
.detail-content h3 { margin: 21px 0 8px; color: var(--lime); font-size: 12px; text-transform: uppercase; letter-spacing: .12em; }
.detail-content p { color: #d0d7d2; line-height: 1.55; font-size: 14px; }
.resource-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.resource-list li { padding: 9px 11px; background: rgba(255,255,255,.06); border-radius: 7px; font-size: 13px; color: #dbe1dc; }
.source-link { display: inline-flex; margin-top: 8px; color: var(--lime); text-decoration: none; font-size: 13px; }
.source-link:hover { text-decoration: underline; }

.empty-results { padding: 40px 20px; border: 1px dashed #c7c9c0; border-radius: 14px; text-align: center; color: var(--muted); }
footer { min-height: 68px; padding: 18px clamp(20px, 4vw, 64px); display: flex; justify-content: space-between; gap: 24px; align-items: center; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.auth-gate { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 22px; background: rgba(20,31,24,.82); backdrop-filter: blur(18px); }
.auth-gate[hidden] { display: none; }
.auth-card { width: min(460px, 100%); padding: 38px; text-align: center; border: 1px solid rgba(255,255,255,.18); border-radius: 20px; background: var(--card); box-shadow: 0 30px 100px rgba(0,0,0,.28); }
.auth-card .brand-mark { margin: 0 auto 18px; }
.auth-card h2 { margin: 12px 0 10px; font-family: Georgia, serif; font-size: 32px; font-weight: 500; }
.auth-card p { margin: 0 0 24px; color: var(--muted); line-height: 1.55; }
.auth-card button { width: 100%; min-height: 50px; padding: 0 20px; border: 0; border-radius: 11px; color: white; background: var(--green); font-weight: 750; }
.auth-card button:disabled { cursor: not-allowed; opacity: .55; }

@media (max-width: 900px) {
  .topbar { grid-template-columns: 1fr auto; }
  nav { display: none; }
  .workspace { grid-template-columns: 1fr; }
  .detail-panel { position: static; min-height: 0; }
  .detail-empty { min-height: 260px; }
}
@media (max-width: 620px) {
  .topbar { height: 62px; }
  .status { display: none; }
  .hero { padding-top: 48px; }
  h1 { font-size: 43px; }
  .hero > p { font-size: 16px; }
  .search-box { grid-template-columns: 34px 1fr; }
  .search-box button { grid-column: 1 / -1; width: 100%; }
  .workspace { width: min(100% - 24px, 1340px); }
  footer { align-items: flex-start; flex-direction: column; }
}
