/* ─────────────────────────────────────────────
   Ruby Editor – Scoped Styles
   ───────────────────────────────────────────── */

.re-ruby-icon { color: #cc342d; font-size: 1rem; }
.re-hero { min-height: 50vh; padding-bottom: 2rem; }
.re-hero-desc { color: var(--text-secondary); font-size: 1.1rem; margin: 1rem auto 1.5rem; max-width: 600px; }

.re-note {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(204, 52, 45, 0.08);
  border: 1px solid rgba(204, 52, 45, 0.3);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  color: #e05252;
  margin-top: 1rem;
}

.re-section { padding: 2rem 1rem 4rem; }
.re-container { max-width: 1400px; margin: 0 auto; }

/* Toolbar */
.re-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background: var(--dark-surface);
  border: 1px solid var(--glass-border);
  border-radius: 12px 12px 0 0;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.re-toolbar-left,
.re-toolbar-right { display: flex; align-items: center; gap: 0.75rem; }

.re-label {
  font-family: Orbitron, sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #cc342d;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.re-select {
  background: var(--dark-card);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: Poppins, sans-serif;
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  outline: none;
}
.re-select:focus { border-color: #cc342d; }

.re-run-btn {
  background: linear-gradient(135deg, #cc342d 0%, #e05252 100%);
  color: #fff;
  font-weight: 700;
  padding: 0.45rem 1.25rem;
  font-size: 0.85rem;
  border-radius: 8px;
}
.re-run-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.re-icon-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 0.85rem;
}
.re-icon-btn:hover { color: #cc342d; border-color: #cc342d; }

/* Auto-run toggle */
.re-auto-toggle { display: flex; align-items: center; gap: 0.5rem; }
.re-toggle-label { font-size: 0.8rem; color: var(--text-secondary); white-space: nowrap; }
.re-toggle-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.re-toggle-input:focus-visible + .re-toggle-switch {
  outline: 2px solid `#cc342d`;
  outline-offset: 2px;
}

.re-toggle-switch {
  width: 36px;
  height: 20px;
  background: var(--dark-card);
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  border: 1px solid var(--glass-border);
  display: block;
  transition: background 0.2s ease;
}
.re-toggle-switch::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--text-secondary);
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: all 0.2s ease;
}
.re-toggle-input:checked + .re-toggle-switch { background: #cc342d; border-color: #cc342d; }
.re-toggle-input:checked + .re-toggle-switch::after { left: 18px; background: #fff; }

/* Split */
.re-split {
  display: flex;
  height: 500px;
  border: 1px solid var(--glass-border);
  border-top: none;
  overflow: hidden;
}
.re-editor-pane,
.re-output-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.re-output-pane { border-left: 1px solid var(--glass-border); }

.re-pane-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background: var(--dark-surface);
  border-bottom: 1px solid var(--glass-border);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.re-lang-badge {
  font-family: "Fira Code", monospace;
  font-size: 0.7rem;
  color: #cc342d;
  background: rgba(204, 52, 45, 0.1);
  border: 1px solid rgba(204, 52, 45, 0.3);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.re-status-badge { font-size: 0.7rem; font-weight: 600; padding: 0.15rem 0.5rem; border-radius: 4px; }
.re-status-ready   { color: #22c55e; background: rgba(34,197,94,0.1);  border: 1px solid rgba(34,197,94,0.3);  }
.re-status-running { color: #f59e0b; background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); }
.re-status-error   { color: #ef4444; background: rgba(239,68,68,0.1);  border: 1px solid rgba(239,68,68,0.3);  }
.re-status-api     { color: #cc342d; background: rgba(204,52,45,0.1);  border: 1px solid rgba(204,52,45,0.3);  }

/* Editor */
.re-editor-wrap {
  display: flex;
  flex: 1;
  overflow: hidden;
  background: #0d1117;
}
.re-line-numbers {
  width: 44px;
  background: var(--dark-surface);
  border-right: 1px solid var(--glass-border);
  padding: 1rem 0.5rem;
  text-align: right;
  font-family: "Fira Code", monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-secondary);
  user-select: none;
  pointer-events: none;
  overflow: hidden;
  white-space: pre;
  flex-shrink: 0;
}
.re-editor {
  flex: 1;
  background: #0d1117;
  color: #e6edf3;
  font-family: "Fira Code", monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  padding: 1rem 1.25rem;
  border: none;
  outline: none;
  resize: none;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
  caret-color: #cc342d;
}
.re-editor::selection { background: rgba(204, 52, 45, 0.2); }

/* Output */
.re-output-body {
  flex: 1;
  padding: 1rem 1.25rem;
  font-family: "Fira Code", monospace;
  font-size: 0.85rem;
  line-height: 1.7;
  color: #e6edf3;
  background: #0d1117;
  overflow-y: auto;
  white-space: pre-wrap;
}
.re-output-placeholder { color: var(--text-secondary); font-style: italic; }
.re-output-running {
  color: #f59e0b;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-style: italic;
}

/* Console */
.re-console {
  border: 1px solid var(--glass-border);
  border-top: none;
  border-radius: 0 0 12px 12px;
  overflow: hidden;
}
.re-console-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background: var(--dark-surface);
  border-bottom: 1px solid var(--glass-border);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.re-console-clear {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-family: Poppins, sans-serif;
}
.re-console-clear:hover { color: #ef4444; }
.re-console-body {
  min-height: 60px;
  max-height: 120px;
  overflow-y: auto;
  padding: 0.75rem 1rem;
  background: #0d1117;
  font-family: "Fira Code", monospace;
  font-size: 0.8rem;
  line-height: 1.6;
}
.re-console-placeholder { color: var(--text-secondary); font-style: italic; }
.re-console-line { display: block; padding: 0.1rem 0; color: #ef4444; }
.re-console-line::before { content: "⚠ "; }

/* Responsive */
@media (max-width: 768px) {
  .re-split { flex-direction: column; height: auto; }
  .re-editor-pane { height: 300px; }
  .re-output-pane { height: 250px; border-left: none; border-top: 1px solid var(--glass-border); }
  .re-toolbar { flex-direction: column; align-items: flex-start; }
  .re-toolbar-right { flex-wrap: wrap; }
}