:root {
  --bg: #0d1117;
  --canvas: #010409;
  --panel: #161b22;
  --panel-muted: #0d1117;
  --panel-border: #30363d;
  --text: #e6edf3;
  --text-muted: #7d8590;
  --text-soft: #8b949e;
  --accent: #2f81f7;
  --success: #3fb950;
  --error: #f85149;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", sans-serif;
  font-style: normal;
  color: var(--text);
  background: var(--bg);
}

.page {
  width: min(1200px, calc(100vw - 32px));
  margin: 32px auto 64px;
}

/* Hero */

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px;
  margin-bottom: 0;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px 10px 0 0;
  border-bottom: none;
}

.hero p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Tab nav */

.tab-nav {
  display: flex;
  border-bottom: 1px solid var(--panel-border);
  background: var(--panel);
  border-left: 1px solid var(--panel-border);
  border-right: 1px solid var(--panel-border);
  padding: 0 16px;
  margin-bottom: 24px;
}

.tab-button {
  appearance: none;
  padding: 12px 16px;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 100ms ease, border-color 100ms ease;
}

.tab-button:hover {
  color: var(--text);
  background: none;
}

.tab-button.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

[data-tab-panel][hidden] {
  display: none;
}

/* Content area */

.content {
  display: grid;
  gap: 12px;
}

.card {
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
}

.card p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.5;
  font-size: 0.9rem;
}

.card-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 1.4rem;
  font-weight: 600;
}

h2 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

.stack {
  display: grid;
  gap: 14px;
}

/* Console */

.console {
  min-height: 120px;
  margin: 0;
  padding: 16px;
  border-radius: 8px;
  background: var(--panel-muted);
  border: 1px solid var(--panel-border);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, monospace;
  font-size: 0.875rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-x: auto;
}

.console.small {
  min-height: 0;
  font-size: 0.85rem;
}

.code-sample {
  margin: 0;
  border-radius: 8px;
  overflow: hidden;
  font-size: 0.85rem;
  line-height: 1.5;
}

.code-sample code.hljs {
  display: block;
  padding: 16px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, monospace;
}

/* Controls */

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

button {
  appearance: none;
  min-width: 0;
  padding: 8px 14px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: #21262d;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 100ms ease, border-color 100ms ease;
}

button:hover {
  background: #30363d;
  border-color: #3d444d;
}

button.primary {
  background: #238636;
  border-color: rgba(63, 185, 80, 0.4);
  color: #fff;
}

button.primary:hover {
  background: #2ea043;
  border-color: rgba(63, 185, 80, 0.6);
}

/* Test results */

.results {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.results li {
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  background: var(--panel-muted);
  color: var(--text);
  font-size: 0.875rem;
}

.results li.pass {
  color: var(--success);
  border-color: rgba(26, 127, 55, 0.3);
  background: rgba(26, 127, 55, 0.04);
}

.results li.fail {
  color: var(--error);
  border-color: rgba(207, 34, 46, 0.3);
  background: rgba(207, 34, 46, 0.04);
}

/* Pokemon */

.pokemon {
  display: grid;
  grid-template-columns: 80px 1fr;
  align-items: center;
  gap: 16px;
}

.pokemon img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  image-rendering: pixelated;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent);
}

.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* Ledger */

.ledger {
  display: grid;
  gap: 8px;
}

.ledger-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  background: var(--panel-muted);
  font-size: 0.875rem;
}

.optimistic-trace {
  min-height: 140px;
}

/* API table */

.api-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  overflow: hidden;
}

.api-table th,
.api-table td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--panel-border);
  font-size: 0.875rem;
}

.api-table tr:last-child td {
  border-bottom: none;
}

.api-table th {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-soft);
  background: var(--panel-muted);
}

/* Doc list */

.doc-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.doc-list li {
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  background: var(--panel-muted);
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.doc-list strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-weight: 600;
}

/* Inline code */

code {
  padding: 0.1em 0.3em;
  border-radius: 4px;
  background: rgba(175, 184, 193, 0.2);
  border: 1px solid rgba(175, 184, 193, 0.3);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

@media (max-width: 720px) {
  .hero {
    flex-direction: column;
    align-items: stretch;
  }

  .card-row {
    grid-template-columns: 1fr;
  }
}
