* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-tertiary: #0f0f1a;
  --text-primary: #e4e4e7;
  --text-secondary: #a1a1aa;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --error: #ef4444;
  --error-bg: #450a0a;
  --success: #22c55e;
  --border: #27273a;
  --font-mono: 'Fira Code', 'SF Mono', 'Monaco', 'Consolas', monospace;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
}

.container {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 1800px;
  margin: 0 auto;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

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

select, button, input {
  font-family: inherit;
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

select:hover, button:hover {
  border-color: var(--accent);
}

button {
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 500;
}

button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

input {
  cursor: text;
  min-width: 200px;
}

input:focus {
  outline: none;
  border-color: var(--accent);
}

.toolbar {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}

.context-inputs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.context-inputs label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.split-pane {
  display: flex;
  flex: 1;
  min-height: 0;
}

.editor-pane, .output-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.editor-pane {
  border-right: 1px solid var(--border);
}

.pane-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.tabs {
  display: flex;
  gap: 0.25rem;
}

.tab {
  padding: 0.25rem 0.5rem;
  font-size: 0.7rem;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
}

.tab:hover {
  color: var(--text-primary);
  background: transparent;
  border-color: transparent;
}

.tab.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

#editor, .CodeMirror {
  flex: 1;
  width: 100%;
  height: 100%;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: none;
  resize: none;
  padding: 1rem;
  outline: none;
}

.CodeMirror {
  height: auto;
}

.CodeMirror-gutters {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
}

.CodeMirror-linenumber {
  color: var(--text-secondary);
}

#output {
  flex: 1;
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.error {
  padding: 1rem;
  background: var(--error-bg);
  color: var(--error);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  border-top: 1px solid var(--error);
}

.hidden {
  display: none;
}

footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
}

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

footer a:hover {
  text-decoration: underline;
}

footer span {
  color: var(--text-secondary);
}

/* Syntax highlighting in output */
.key { color: #93c5fd; }
.string { color: #86efac; }
.number { color: #fde68a; }
.boolean { color: #c4b5fd; }
.null { color: #f87171; }

/* Mobile responsive */
@media (max-width: 768px) {
  .split-pane {
    flex-direction: column;
  }

  .editor-pane {
    border-right: none;
    border-bottom: 1px solid var(--border);
    min-height: 40vh;
  }

  .output-pane {
    min-height: 40vh;
  }

  header {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
  }

  .toolbar {
    flex-wrap: wrap;
  }

  .context-inputs {
    flex-wrap: wrap;
  }

  input {
    min-width: 150px;
  }
}
