/* Code Editor */
#code-editor {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.5;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-left: none;
  border-radius: 0 4px 4px 0;
  resize: none;
  outline: none;
}

#code-editor:focus {
  border-color: var(--color-primary);
}

#code-editor:disabled {
  background: var(--color-bg);
}

/* Code Display (for step-through highlighting) */
.code-display {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.5;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-left: none;
  border-radius: 0 4px 4px 0;
  background: white;
  overflow: auto;
  white-space: pre-wrap;
  margin: 0;
}

.code-display .code-before,
.code-display .code-after {
  color: #666;
}

.code-display .code-current {
  background: var(--color-highlight);
  border-radius: 2px;
  padding: 0 2px;
}

/* Character-level scanning visualization */
.code-display .code-done {
  color: #999;
}

.code-display .code-buffer {
  background: #90caf9;
  color: #0d47a1;
  border-radius: 2px;
  padding: 0 1px;
}

.code-display .code-cursor {
  background: #ffc107;
  color: #000;
  border-radius: 2px;
  padding: 0 1px;
  font-weight: 600;
}

.code-display .code-pending {
  color: #666;
}

/* Code execution highlighting (animated run) */
.code-display .code-executing {
  animation: code-pulse 0.8s ease-in-out infinite;
  background: rgba(74, 122, 255, 0.3);
  border-radius: 2px;
}

@keyframes code-pulse {
  0%, 100% { background: rgba(74, 122, 255, 0.3); }
  50% { background: rgba(74, 122, 255, 0.5); }
}

/* Output Header */
.output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.output-header h2 {
  font-size: 0.875rem;
  font-weight: 500;
  color: #666;
  margin: 0;
}

/* Output Tabs */
.output-tabs {
  display: flex;
  gap: 2px;
  background: #333;
  padding: 3px;
  border-radius: 6px;
}

.tab-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  background: transparent;
  color: #888;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

/* Tab link (for Syntax page) */
.tab-btn.tab-link {
  display: flex;
  align-items: center;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #bbb;
}

.tab-btn.active {
  background: #1e1e1e;
  color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.tab-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tab-panel {
  display: none;
  flex: 1;
  flex-direction: column;
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 0.75rem;
  background: #1e1e1e;
  color: #d4d4d4;
  border-radius: 4px;
  overflow: auto;
  white-space: pre-wrap;
}

.tab-panel.active {
  display: flex;
}

/* Output */
#output {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 0.75rem;
  background: #1e1e1e;
  color: #d4d4d4;
  border-radius: 4px;
  overflow: auto;
  white-space: pre-wrap;
  margin: 0;
}

/* Scanner state display */
.scan-section {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #444;
}

.scan-header {
  color: #4fc3f7;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.scan-line {
  margin-bottom: 0.25rem;
}

.scan-label {
  color: #888;
  margin-right: 0.5rem;
}

.scan-action {
  margin-top: 0.5rem;
  color: #81c784;
  font-style: italic;
}

/* Token display */
.tokens-section {
  margin-top: 0.5rem;
}

.tokens-header {
  margin-bottom: 0.5rem;
  color: #888;
}

.token-line {
  white-space: pre;
}

.token-empty {
  color: #666;
  font-style: italic;
}

.token-new {
  color: #81c784;
}

.token-skipped {
  color: #666;
  font-style: italic;
}

.token-eof {
  color: #888;
}

/* Reference/Syntax Tab */
.reference-content {
  font-family: var(--font-body);
  padding: 0.5rem;
}

.reference-content section {
  margin-bottom: 1.5rem;
}

.reference-content section:last-child {
  margin-bottom: 0;
}

.reference-content h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: #4fc3f7;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid #444;
}

.reference-content .ref-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 1rem;
}

.reference-content .ref-list dt {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: #81c784;
}

.reference-content .ref-list dd {
  font-size: 0.9rem;
  color: #aaa;
}

/* Line-level code highlighting */
.code-line {
  padding: 0 2px;
  border-radius: 2px;
}

.code-line.line-executing {
  background: var(--color-highlight);
}
