:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --border: #2a2f3a;
  --text: #e7eaf0;
  --muted: #9aa3b2;
  --accent: #6ea8fe;
  --accent-2: #7ee787;
  --danger: #ff7b72;
  --radius: 10px;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  line-height: 1.55;
}

.wrap {
  width: min(100% - 2rem, 960px);
  margin-inline: auto;
}

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

a:hover {
  text-decoration: underline;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--panel-2);
  padding: 0.1em 0.35em;
  border-radius: 5px;
  font-size: 0.9em;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #141821, var(--bg));
  padding: 2rem 0 1.5rem;
}

.site-header h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  letter-spacing: -0.02em;
}

.tag {
  font-size: 0.5em;
  vertical-align: middle;
  color: var(--accent-2);
  border: 1px solid var(--accent-2);
  border-radius: 999px;
  padding: 0.1em 0.6em;
  margin-left: 0.5rem;
  font-weight: 600;
}

.lede {
  color: var(--muted);
  max-width: 60ch;
  margin: 0 0 1rem;
}

.runtime-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
}

.runtime-status[data-state="ready"] {
  color: var(--accent-2);
  border-color: color-mix(in srgb, var(--accent-2) 40%, var(--border));
}

.runtime-status[data-state="error"] {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
}

.spinner {
  width: 0.8rem;
  height: 0.8rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.runtime-status[data-state="ready"] .spinner,
.runtime-status[data-state="error"] .spinner {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  margin: 1.25rem 0;
}

.panel h2 {
  margin: 0 0 0.6rem;
  font-size: 1.15rem;
}

.hint {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 0.5rem;
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.scenario {
  text-align: left;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.75rem 0.85rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: border-color 0.15s ease, transform 0.05s ease;
}

.scenario:hover {
  border-color: var(--accent);
}

.scenario:active {
  transform: translateY(1px);
}

.scenario[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

.scenario .scenario-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.scenario .scenario-op {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.76rem;
}

.playground {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-top: 0.5rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field-label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

textarea,
select {
  width: 100%;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  resize: vertical;
}

textarea:focus,
select:focus,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.controls {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.select-field {
  flex: 1 1 260px;
}

button {
  background: var(--accent);
  color: #0b1020;
  border: none;
  border-radius: 8px;
  padding: 0.65rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

button:hover:not(:disabled) {
  filter: brightness(1.08);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.output-block {
  margin-top: 1rem;
}

.output-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
  flex-wrap: wrap;
}

.diagnostics {
  font-size: 0.82rem;
  color: var(--accent-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.output {
  margin: 0;
  background: #0b0e14;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem;
  min-height: 4.5rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
}

.muted {
  color: var(--muted);
}

.output.has-error {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
}

.feature-list {
  margin: 0.5rem 0 1rem;
  padding-left: 1.1rem;
  color: var(--muted);
}

.feature-list li {
  margin-bottom: 0.2rem;
}

.meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem 1.25rem;
  margin: 0;
}

.meta div {
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
}

.meta dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.meta dd {
  margin: 0.1rem 0 0;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 0;
  margin-top: 2rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

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