:root {
  --ink: #221c17;
  --paper: #f6f1e8;
  --panel: #ffffff;
  --line: #e4dccb;
  --amber: #d97b3f;
  --amber-dark: #b8622c;
  --sage: #4c7a63;
  --sage-light: #e6efe9;
  --rust: #b3452f;
  --rust-light: #f7e6e0;
  --muted: #7a7166;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(34, 28, 23, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 20px 32px;
  background: var(--ink);
  color: var(--paper);
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--amber);
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.03em;
}

.brand h1 { margin: 0; font-size: 1.25rem; }
.tagline { margin: 2px 0 0; font-size: 0.85rem; color: #cfc6b8; }

.tabs { display: flex; gap: 8px; }

.tab-btn {
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid #4a4038;
  background: transparent;
  color: var(--paper);
  font-size: 0.9rem;
  cursor: pointer;
}

.tab-btn.is-active { background: var(--amber); color: var(--ink); border-color: var(--amber); font-weight: 600; }

main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.view { display: none; }
.view.is-active { display: block; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}

.panel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.panel-row-end { justify-content: flex-end; }

.sample-controls { display: flex; gap: 8px; }

select, input[type="text"], textarea {
  font-family: inherit;
  font-size: 0.95rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--paper);
  color: var(--ink);
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 160px;
}

#embed-snippet { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.8rem; }

.hint { color: var(--muted); font-size: 0.85rem; }

.btn {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
}

.btn-primary { background: var(--amber); color: #fff; }
.btn-primary:hover { background: var(--amber-dark); }
.btn-primary:disabled { background: #d9cfc0; color: #9a8f7d; cursor: not-allowed; }

.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--amber); color: var(--amber-dark); }
.btn-ghost.is-active { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.is-hidden { display: none !important; }

.score-block {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.score-ring {
  width: 84px; height: 84px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  font-weight: 700;
  border: 6px solid var(--sage);
  color: var(--ink);
  flex-shrink: 0;
}

.score-ring.is-fail { border-color: var(--rust); }

.score-copy { flex: 1; min-width: 200px; }

.score-verdict { margin: 0 0 4px; font-weight: 600; font-size: 1.05rem; }

.cert-fields { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.cert-fields input { flex: 1; min-width: 160px; }

.results-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
}

.highlighted-text {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: var(--paper);
  white-space: pre-wrap;
  font-size: 0.95rem;
  max-height: 320px;
  overflow-y: auto;
}

mark.tell {
  border-radius: 4px;
  padding: 1px 3px;
  background: var(--rust-light);
  color: var(--rust);
  cursor: help;
}

.category-list { list-style: none; margin: 0; padding: 0; }

.category-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}

.category-list li:last-child { border-bottom: none; }

.category-count {
  background: var(--rust-light);
  color: var(--rust);
  border-radius: 999px;
  padding: 1px 9px;
  font-weight: 600;
  font-size: 0.8rem;
}

.cert-card {
  border: 1px solid var(--sage);
  background: var(--sage-light);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 18px;
}

.cert-card .cert-id { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; color: var(--sage); }
.cert-card h3 { margin: 6px 0 4px; }
.cert-card .cert-meta { color: var(--muted); font-size: 0.85rem; }

.embed-block textarea { width: 100%; margin-bottom: 10px; }

.verify-row { display: flex; gap: 10px; margin-bottom: 14px; }
.verify-row input { flex: 1; }

.verify-result:empty { display: none; }

.verify-card {
  border-radius: 10px;
  padding: 14px 16px;
  border: 1px solid var(--sage);
  background: var(--sage-light);
}

.verify-card.not-found {
  border-color: var(--rust);
  background: var(--rust-light);
}

.registry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.sort-controls { display: flex; align-items: center; gap: 6px; }

.registry-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }

.registry-table th, .registry-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}

.registry-table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }

.status-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.status-pill.verified { background: var(--sage-light); color: var(--sage); }
.status-pill.needs-rescan { background: var(--rust-light); color: var(--rust); }

.site-footer {
  text-align: center;
  padding: 24px;
  color: var(--muted);
  font-size: 0.8rem;
}

@media (max-width: 720px) {
  .site-header { padding: 16px; }
  main { padding: 24px 16px 48px; }
  .results-grid { grid-template-columns: 1fr; }
  .panel-row { flex-direction: column; align-items: stretch; }
  .panel-row-end { align-items: flex-end; }
  .registry-table { display: block; overflow-x: auto; white-space: nowrap; }
}
