:root {
  --bg: #1a1a2e;
  --surface: #16213e;
  --surface2: #0f3460;
  --text: #e0e0e0;
  --muted: #888;
  --accent: #4fc3f7;
  --pass: #66bb6a;
  --fail: #ef5350;
  --warn: #ffa726;
  --border: #333;
  --sticky-bg: rgba(15, 15, 30, 0.85);
  font-family: system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}

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

fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  padding-bottom: 4rem;
}

/* Sticky bar */
.sticky-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--sticky-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  max-width: 900px;
  margin: 0 auto;
  padding: 0.6rem 1.5rem;
  display: flex;
  align-items: center;
}

/* Segmented buttons */
.state-buttons {
  display: flex;
  align-items: center;
  gap: 0;
}

.state-buttons .toggle-label {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  margin-right: 0.6rem;
}

.state-buttons .seg-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 0;
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
}

.state-buttons .seg-btn:first-of-type {
  border-radius: 6px 0 0 6px;
}

.state-buttons .seg-btn:last-of-type {
  border-radius: 0 6px 6px 0;
  border-right: 1px solid var(--border);
}

.legacy-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
}

.toggle-label {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.legacy-toggle .seg-btn {
  border-radius: 4px;
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
}

/* Shared button base */
.seg-btn {
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border: 1px solid var(--border);
}

.seg-btn:hover {
  background: var(--surface2);
  color: var(--accent);
}

.seg-btn.active {
  background: var(--accent);
  color: #000;
  font-weight: 600;
}

/* Hero */
.hero {
  max-width: 900px;
  margin: 2.5rem auto 2rem;
  padding: 0 1.5rem;
}

.hero h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  color: var(--text);
}

.thesis {
  font-size: 1rem;
  color: var(--muted);
  max-width: 70ch;
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.finding-callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin-top: 1rem;
  font-size: 0.92rem;
  line-height: 1.7;
}

.finding-callout ul {
  margin-top: 0.5rem;
  padding-left: 1.25rem;
}

.finding-callout li {
  margin-bottom: 0.4rem;
}

.finding-callout code {
  background: var(--surface2);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-size: 0.88em;
  color: var(--accent);
}

.thesis code {
  background: var(--surface2);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-size: 0.9em;
  color: var(--accent);
}

/* Main content layout */
main {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Example cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
}

.card h2 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
}

.card h2 code {
  font-size: 0.95em;
}

.card-prose {
  font-size: 0.92rem;
  color: var(--text);
  margin-bottom: 1rem;
  max-width: 72ch;
  line-height: 1.7;
}

.card-prose code {
  background: var(--surface2);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-size: 0.88em;
  color: var(--accent);
}

.ext-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Code blocks */
.code-block {
  background: var(--bg);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.5;
  border: 1px solid var(--border);
}

.code-block code {
  font-family: "SFMono-Regular", "Consolas", "Liberation Mono", monospace;
}

/* Results strip */
.results-strip {
  display: block;
  background: var(--bg);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
}

.results-strip dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 0.75rem;
  align-items: baseline;
  margin: 0;
}

.results-strip dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.results-strip dd {
  font-family: "SFMono-Regular", "Consolas", monospace;
  font-size: 0.83rem;
  margin: 0;
}

.results-strip dd {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

 {
  color: var(--muted);
  font-size: 0.8rem;
}

 {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: italic;
  padding: 0 0.1rem;
}

 {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
}

.result-val {
  font-family: "SFMono-Regular", "Consolas", "Liberation Mono", monospace;
  font-size: 0.82rem;
  padding: 0.15em 0.45em;
  border-radius: 3px;
  background: var(--surface2);
  color: var(--text);
  font-style: normal;
}

.result-val.val-granted {
  color: var(--pass);
  background: rgba(102, 187, 106, 0.12);
}

.result-val.val-prompt {
  color: var(--warn);
  background: rgba(255, 167, 38, 0.12);
}

.result-val.val-denied {
  color: var(--fail);
  background: rgba(239, 83, 80, 0.12);
}

.result-val.val-throws {
  color: var(--fail);
  background: rgba(239, 83, 80, 0.12);
  font-style: italic;
}

/* Verdict line */
.verdict-line {
  font-size: 0.82rem;
  font-weight: 600;
  margin-top: 0.35rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border);
}

.verdict-line.verdict-pass {
  color: var(--pass);
}

.verdict-line.verdict-fail {
  color: var(--fail);
}

.verdict-line.verdict-neutral {
  color: var(--warn);
}

/* Summary details */
.summary-details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.summary-details summary {
  padding: 1rem 1.5rem;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--accent);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.summary-details summary::before {
  content: "▶";
  font-size: 0.7rem;
  transition: transform 0.2s;
  color: var(--muted);
}

.summary-details[open] summary::before {
  transform: rotate(90deg);
}

.summary-details summary::-webkit-details-marker {
  display: none;
}

.summary-inner {
  padding: 0 1.5rem 1.5rem;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.summary-table th,
.summary-table td {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
}

.summary-table th {
  background: var(--surface2);
  color: var(--accent);
  font-weight: 600;
}

.summary-table td.cell-pass {
  color: var(--pass);
}

.summary-table td.cell-fail {
  color: var(--fail);
}

.summary-score {
  margin-top: 0.75rem;
  font-size: 0.84rem;
  color: var(--muted);
}

.summary-score strong {
  color: var(--text);
}

/* Responsive */
@media (max-width: 600px) {
  .sticky-bar {
    padding: 0.5rem 1rem;
    gap: 0.5rem;
  }

  .legacy-toggle {
    margin-left: 0;
  }

  .hero {
    margin: 1.5rem auto 1.5rem;
    padding: 0 1rem;
  }

  .hero h1 {
    font-size: 1.2rem;
  }

  main {
    padding: 0 1rem;
  }

  .card {
    padding: 1rem;
  }

  .results-strip dt {
    min-width: unset;
    width: 100%;
  }

  .summary-table {
    font-size: 0.78rem;
  }

  .summary-table th,
  .summary-table td {
    padding: 0.35rem 0.4rem;
  }
}
