:root {
  --bg: #0b0d10;
  --panel: #12161c;
  --panel-2: #171c23;
  --border: #262c35;
  --text: #d9dee5;
  --dim: #838d9c;
  --dimmer: #5b6472;
  --accent: #7ee7b8;
  --accent-dim: #4f9d78;
  --error: #ff7b72;
  --warn: #f2c464;
  --note: #7aa2f7;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Consolas, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  background: var(--bg);
  color: var(--text);
  margin: 0;
  font-family: var(--mono);
}

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

.banner {
  padding: 22px 20px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #10141a, #0b0d10);
  text-align: center;
}

.banner-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent);
}

.banner-tag {
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--dim);
}

.layout {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
}

/* toolbar */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.tool-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--dim);
}

.tool-field select {
  font-family: var(--mono);
  font-size: 0.82rem;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
}

.tool-field select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.tool-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.btn {
  font-family: var(--mono);
  font-size: 0.82rem;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.12s, border-color 0.12s, transform 0.05s;
}

.btn:hover:not(:disabled) {
  border-color: var(--accent-dim);
  background: #1a2027;
}

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

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

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

.btn-primary {
  background: var(--accent);
  color: #0b1410;
  border-color: var(--accent);
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background: #93f0c9;
}

.btn-ghost {
  background: transparent;
}

.btn-tiny {
  padding: 3px 8px;
  font-size: 0.72rem;
}

kbd {
  font-family: var(--mono);
  font-size: 0.68rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 1px 4px;
}

/* samples */

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

.chip {
  font-family: var(--mono);
  font-size: 0.76rem;
  background: var(--panel);
  color: var(--dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}

.chip:hover {
  color: var(--text);
  border-color: var(--accent-dim);
}

.chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* panes */

.panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  min-height: 360px;
  flex: 1;
}

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

.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}

.pane-head h2 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--dim);
  text-transform: lowercase;
  letter-spacing: 0.03em;
}

.pane-head-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stats-line {
  font-size: 0.7rem;
  color: var(--dimmer);
}

.status-badge {
  font-size: 0.7rem;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--dim);
}

.status-badge.status-ok {
  color: #0b1410;
  background: var(--accent);
  border-color: var(--accent);
}

.status-badge.status-fail {
  color: #2a0a08;
  background: var(--error);
  border-color: var(--error);
}

.status-badge.status-idle {
  color: var(--dim);
}

/* editor */

.editor-frame {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

.gutter {
  margin: 0;
  padding: 12px 8px;
  text-align: right;
  color: var(--dimmer);
  font-size: 0.82rem;
  line-height: 1.5;
  background: var(--panel-2);
  border-right: 1px solid var(--border);
  overflow: hidden;
  user-select: none;
  min-width: 34px;
}

.code-input {
  flex: 1;
  resize: none;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.5;
  padding: 12px 14px;
  white-space: pre;
  overflow: auto;
}

.code-input:focus {
  outline: none;
}

.code-input:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent-dim);
}

/* terminal */

.terminal {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  font-size: 0.8rem;
  line-height: 1.55;
}

.log-block + .log-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.log-line {
  white-space: pre-wrap;
  word-break: break-word;
}

.log-prompt {
  color: var(--accent);
  font-weight: 600;
}

.log-error { color: var(--error); }
.log-warn { color: var(--warn); }
.log-note { color: var(--note); }
.log-plain { color: var(--text); }
.log-success { color: var(--accent); margin-top: 4px; }
.log-fail { color: var(--error); margin-top: 4px; }

.log-pending {
  color: var(--dim);
}

.dots span {
  animation: blink 1.2s infinite;
  opacity: 0;
}

.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 20% { opacity: 0; }
  50% { opacity: 1; }
  100% { opacity: 0; }
}

/* disassembly */

.asm-pane {
  max-height: 320px;
}

.asm-content {
  margin: 0;
  padding: 12px 14px;
  overflow: auto;
  font-size: 0.76rem;
  line-height: 1.55;
  color: var(--dim);
}

/* footer */

.footer {
  text-align: center;
  padding: 18px;
  font-size: 0.78rem;
  color: var(--dimmer);
}

.footer a {
  color: var(--dim);
  text-decoration: none;
}

.footer a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.footer a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* scrollbars, webkit only, degrades fine elsewhere */

.terminal::-webkit-scrollbar,
.code-input::-webkit-scrollbar,
.asm-content::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

.terminal::-webkit-scrollbar-thumb,
.code-input::-webkit-scrollbar-thumb,
.asm-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 5px;
}

@media (max-width: 860px) {
  .panes {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .editor-pane {
    min-height: 260px;
  }
  .terminal-pane {
    min-height: 260px;
  }
  .tool-actions {
    margin-left: 0;
    flex-wrap: wrap;
  }
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}
