:root {
  --bg: #0b0f14;
  --bg-elevated: #121820;
  --bg-card: #161d27;
  --border: #243041;
  --text: #e8eef7;
  --text-muted: #8fa0b8;
  --accent: #5eead4;
  --accent-dim: #2dd4bf33;
  --purple: #a78bfa;
  --pass: #34d399;
  --fail: #f87171;
  --warn: #fbbf24;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --radius: 12px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.25;
  pointer-events: none;
  mask-image: radial-gradient(circle at center, black, transparent 75%);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
  background: rgba(11, 15, 20, 0.85);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.logo {
  font-size: 1.75rem;
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-dim), transparent);
  border: 1px solid var(--border);
}

.brand h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.tagline {
  margin: 0.15rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.5rem;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 5.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tabs {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem;
}

.tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 500;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.tab.active {
  color: var(--text);
  background: var(--accent-dim);
  box-shadow: inset 0 0 0 1px rgba(94, 234, 212, 0.25);
}

.sidebar-block {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.sidebar-block h2 {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.feature-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.feature-list li + li {
  margin-top: 0.35rem;
}

.code-snippet {
  margin: 0;
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.78rem;
  overflow-x: auto;
}

.sidebar-note {
  margin: 0.65rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.content {
  min-width: 0;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.panel-header h2 {
  margin: 0 0 0.35rem;
  font-size: 1.4rem;
}

.panel-header p {
  margin: 0;
  color: var(--text-muted);
  max-width: 52ch;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.55rem 0.95rem;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.15s, background 0.15s;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn:not(:disabled):active {
  transform: translateY(1px);
}

.btn.primary {
  background: linear-gradient(135deg, #2dd4bf, #0891b2);
  color: #042028;
  border-color: rgba(255, 255, 255, 0.1);
}

.btn.secondary {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--border);
}

.btn.ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}

.btn.ghost:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.status-pill,
.summary-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.status-pill[data-kind="pass"],
.summary-pill[data-kind="pass"] {
  color: var(--pass);
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.08);
}

.status-pill[data-kind="fail"],
.summary-pill[data-kind="fail"] {
  color: var(--fail);
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.08);
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.demo-card,
.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.demo-card h3,
.section-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.demo-card p {
  margin: 0 0 0.85rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.demo-card .btn {
  width: 100%;
}

.demo-output {
  margin: 0.85rem 0 0;
  padding: 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-x: auto;
  max-height: 320px;
}

.test-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 1rem;
  align-items: start;
}

.section-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.section-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.section-card h3 {
  font-size: 0.88rem;
  font-weight: 600;
}

.badge {
  font-size: 0.72rem;
  font-family: var(--mono);
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.badge.pass {
  color: var(--pass);
  border-color: rgba(52, 211, 153, 0.3);
}

.badge.fail {
  color: var(--fail);
  border-color: rgba(248, 113, 113, 0.3);
}

.test-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 120px;
  overflow-y: auto;
}

.test-list li {
  font-size: 0.75rem;
  font-family: var(--mono);
  padding: 0.2rem 0;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.test-list li.pass::before {
  content: "✓ ";
  color: var(--pass);
}

.test-list li.fail {
  color: var(--fail);
}

.test-list li.fail::before {
  content: "✗ ";
}

.log-panel {
  position: sticky;
  top: 5.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.log-panel h3 {
  margin: 0;
  padding: 0.75rem 1rem;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.log-output {
  height: 70vh;
  overflow-y: auto;
  padding: 0.85rem;
  font-family: var(--mono);
  font-size: 0.74rem;
}

.log-line {
  padding: 0.15rem 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.log-line.section {
  color: var(--purple);
  font-weight: 600;
  margin-top: 0.35rem;
}

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

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

.log-line.info {
  color: var(--text-muted);
}

.site-footer {
  max-width: 1400px;
  margin: 2rem auto 0;
  padding: 1rem 1.5rem 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

.site-footer p {
  margin: 0;
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .tabs {
    flex-direction: row;
  }

  .test-layout {
    grid-template-columns: 1fr;
  }

  .log-panel {
    position: static;
  }

  .log-output {
    height: 40vh;
  }

  .section-grid {
    max-height: none;
  }
}
