:root {
  --bg: #1a1d23;
  --panel: #22262e;
  --border: #343a46;
  --text: #e8eaed;
  --muted: #9aa0a6;
  --accent: #3d9a7a;
  --accent-hover: #4cb08c;
  --err: #e57373;
  --warn: #ffb74d;
  --ok: #81c784;
  --mono: "JetBrains Mono", "Fira Code", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.top {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #232833 0%, var(--bg) 100%);
}

.brand h1 {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: 0.02em;
  font-weight: 650;
}

.tag {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: flex-end;
}

.example-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

select, button, textarea, pre {
  font: inherit;
}

select {
  min-width: 11rem;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
}

button {
  padding: 0.5rem 0.95rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

button:hover:not(:disabled) {
  border-color: #4a5260;
}

button.primary {
  background: var(--accent);
  border-color: transparent;
  color: #08120e;
  font-weight: 600;
}

button.primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

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

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 0.75rem;
  padding: 0.75rem;
  min-height: 0;
}

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

.side {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
}

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.panel.grow {
  flex: 1;
}

.editor-panel {
  min-height: 28rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.panel-btn {
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  text-transform: none;
  letter-spacing: 0;
  border-radius: 4px;
}

.go-hint {
  margin: 0;
  padding: 0.55rem 1rem 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-family: var(--sans);
}

.go-hint[hidden] {
  display: none;
}

.status {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.8rem;
}

.status.ok { color: var(--ok); }
.status.err { color: var(--err); }
.status.warn { color: var(--warn); }
.status.busy { color: var(--muted); }

#source {
  flex: 1;
  width: 100%;
  min-height: 24rem;
  resize: none;
  border: 0;
  outline: none;
  padding: 0.85rem 1rem;
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.45;
  tab-size: 2;
}

.out {
  margin: 0;
  padding: 0.85rem 1rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text);
  min-height: 6rem;
}

.code {
  color: #c8d0da;
  flex: 1;
}

.diag-error { color: var(--err); }
.diag-warning { color: var(--warn); }
.diag-empty { color: var(--muted); }
.diag-clickable {
  cursor: pointer;
  text-decoration: underline dotted transparent;
}
.diag-clickable:hover {
  text-decoration-color: currentColor;
}

.foot {
  padding: 0.65rem 1.25rem 1rem;
  color: var(--muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

.foot code, .foot kbd {
  font-family: var(--mono);
  font-size: 0.78rem;
}

.foot kbd {
  padding: 0.05rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--panel);
}
