:root {
  --bg: #0b0e14;
  --bg-panel: #12161f;
  --bg-inset: #0d1119;
  --border: #232a38;
  --border-strong: #33405a;
  --text: #e8ecf3;
  --text-dim: #97a1b5;
  --text-faint: #5d6acti77;
  --accent: #6ee7b7;
  --accent-dim: #17382c;
  --danger: #f87171;
  --danger-dim: #3a1a1a;
  --warn: #fbbf24;
  --warn-dim: #3a2f12;
  --info: #7dd3fc;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(11, 14, 20, 0.9);
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(8px);
}
.header-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { color: var(--accent); display: inline-flex; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: 0.2px; }
.header-meta { display: flex; align-items: center; gap: 12px; }
.meta-pill {
  font-size: 12px; color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px;
}
.meta-link { font-size: 13px; }

/* Hero */
.hero { padding: 56px 0 32px; }
.hero h1 { font-size: clamp(30px, 5vw, 44px); line-height: 1.12; letter-spacing: -0.02em; }
.lede { color: var(--text-dim); max-width: 640px; margin-top: 16px; font-size: 16px; }

/* Inputs */
.input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .input-grid { grid-template-columns: 1fr; } }

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.panel-head h2 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); }
.optional { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text-faint, #5d6a77); margin-left: 6px; }
.char-count { font-family: var(--mono); font-size: 11px; color: var(--text-faint, #5d6a77); }

textarea {
  width: 100%; min-height: 190px; resize: vertical;
  background: var(--bg-inset); color: var(--text);
  border: none; outline: none;
  font-family: var(--mono); font-size: 13px; line-height: 1.6;
  padding: 14px 16px;
}
textarea::placeholder { color: #4a5468; }

/* Actions */
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 8px; }

button { font-family: var(--sans); cursor: pointer; }

.btn-primary {
  background: var(--accent); color: #06281c;
  font-weight: 600; font-size: 14px;
  border: none; border-radius: 8px; padding: 11px 22px;
  transition: filter 0.15s ease;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.1); }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-ghost {
  background: transparent; color: var(--text-dim);
  font-size: 14px;
  border: 1px solid var(--border); border-radius: 8px; padding: 11px 18px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--border-strong); }
.btn-ghost:disabled { opacity: 0.35; cursor: not-allowed; }

.error-box {
  margin: 14px 0;
  background: var(--danger-dim);
  border: 1px solid #5c2626;
  color: #fca5a5;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
}

/* Results */
.results { margin-top: 28px; padding-bottom: 60px; }

.verdict-banner {
  border-radius: 12px;
  padding: 18px 22px;
  font-size: 16px; font-weight: 600;
  margin-bottom: 18px;
  border: 1px solid transparent;
  display: flex; align-items: center; gap: 12px;
}
.verdict-banner .verdict-sub { font-weight: 400; font-size: 14px; opacity: 0.85; }
.verdict-banner.ok { background: var(--accent-dim); border-color: #1f5543; color: var(--accent); }
.verdict-banner.blocked { background: var(--danger-dim); border-color: #5c2626; color: #fca5a5; }
.verdict-banner.warn { background: var(--warn-dim); border-color: #6b5318; color: var(--warn); }
.verdict-banner.loading { background: var(--bg-panel); border-color: var(--border); color: var(--text-dim); }

.result-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }

.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.card.flagged { border-color: #5c2626; }
.card.clean { border-color: #1f5543; }

.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 15px; font-weight: 600; }
.step-tag {
  font-size: 11px; font-family: var(--mono);
  background: var(--bg-inset); border: 1px solid var(--border);
  padding: 3px 8px; border-radius: 6px; margin-right: 8px;
  color: var(--info); text-transform: uppercase; letter-spacing: 0.06em;
}

.chip {
  font-size: 12px; font-weight: 600;
  border-radius: 999px; padding: 4px 12px;
  background: var(--bg-inset); color: var(--text-dim);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.chip.ok { background: var(--accent-dim); color: var(--accent); border-color: #1f5543; }
.chip.bad { background: var(--danger-dim); color: #fca5a5; border-color: #5c2626; }
.chip.warn { background: var(--warn-dim); color: var(--warn); border-color: #6b5318; }

.card-body { padding: 16px 18px; font-size: 14px; color: var(--text-dim); }
.card-body p + p { margin-top: 8px; }
.card-body .kv { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.card-body .kv b { color: var(--text); font-weight: 600; }

.entity-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.entity-tag {
  font-family: var(--mono); font-size: 12px;
  background: var(--warn-dim); color: var(--warn);
  border: 1px solid #6b5318; border-radius: 6px; padding: 3px 8px;
}

.masked-view {
  margin-top: 12px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.65;
  white-space: pre-wrap; word-break: break-word;
  max-height: 220px; overflow-y: auto;
  color: var(--text);
}
.masked-view .mask {
  background: #2b2f3a; color: transparent;
  border-radius: 4px; padding: 0 4px;
  border-bottom: 1px dashed #52596b;
  position: relative;
  user-select: none;
}
.masked-view .mask::after {
  content: attr(data-kind);
  color: var(--warn); font-size: 10px;
  position: absolute; left: 4px; right: 4px; top: 50%; transform: translateY(-50%);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  user-select: none;
}

.flag-list { list-style: none; margin-top: 10px; }
.flag-list li {
  padding: 8px 12px; margin-top: 6px;
  background: var(--danger-dim); border-left: 3px solid var(--danger);
  border-radius: 0 6px 6px 0; font-size: 13px; color: #fca5a5;
}
.flag-list li.low { background: var(--warn-dim); border-left-color: var(--warn); color: var(--warn); }

.prob-bars { margin-top: 12px; display: grid; gap: 6px; }
.prob-row { display: grid; grid-template-columns: 130px 1fr 44px; align-items: center; gap: 10px; font-size: 12px; }
.prob-row .label { font-family: var(--mono); color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prob-track { height: 6px; background: var(--bg-inset); border-radius: 3px; overflow: hidden; }
.prob-fill { height: 100%; background: var(--danger); border-radius: 3px; }
.prob-row .val { font-family: var(--mono); text-align: right; color: var(--text-dim); }

/* Commit bar */
.commit-bar {
  margin-top: 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
.commit-text { font-size: 14px; color: var(--text-dim); max-width: 560px; }
.commit-text b { color: var(--text); }
.commit-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.copied-toast { color: var(--accent); font-size: 13px; margin-left: 8px; }

.footnote { margin-top: 14px; font-size: 12.5px; color: #5d6a77; }

.site-footer { border-top: 1px solid var(--border); padding: 20px 0; }
.site-footer p { font-size: 13px; color: var(--text-dim); }

/* Loading shimmer */
.loading-block {
  height: 14px; border-radius: 6px;
  background: linear-gradient(90deg, var(--bg-inset) 25%, #1a2130 50%, var(--bg-inset) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  margin-top: 10px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* grounding */
.grounding { margin-top: 48px; }
.panel-note { color: var(--text-dim); font-size: 14px; line-height: 1.55; margin: 0 0 12px; }
.claim-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.claim-list li { line-height: 1.5; }
.claim-list .chip { margin-right: 8px; }
.claim-src { color: var(--text-dim); font-size: 13px; margin-top: 4px; }
