/* ================================================
   CodeMentor v2.0 — Complete Neat UI
   Self-contained dark theme, no CDN dependencies
   ================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0d1117;
  --bg2: #161b22;
  --bg3: #1c2230;
  --border: #21293a;
  --border2: #2d3748;
  --text: #e6edf3;
  --text2: #8b949e;
  --text3: #6e7681;
  --sage: #3fb950;
  --sage-dim: rgba(63, 185, 80, .12);
  --sage-glow: rgba(63, 185, 80, .25);
  --sergeant: #f85149;
  --sergeant-dim: rgba(248, 81, 73, .12);
  --sergeant-glow: rgba(248, 81, 73, .25);
  --buddy: #58a6ff;
  --buddy-dim: rgba(88, 166, 255, .12);
  --buddy-glow: rgba(88, 166, 255, .25);
  --accent: #3fb950;
  --amber: #e3b341;
  --amber-dim: rgba(227, 179, 65, .1);
  --violet: #a371f7;
  --violet-dim: rgba(163, 113, 247, .1);
  --radius: 8px;
  --radius-lg: 12px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', 'Cascadia Code', 'Courier New', monospace;
  --nav-h: 44px;
  --sb-h: 24px;
  --sidebar-w: 256px;
  --transition: 180ms ease;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── TOP NAV ─────────────────────────────── */
.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  background: rgba(13, 17, 23, .92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  z-index: 100;
  gap: 12px;
}

.topnav-left,
.topnav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-mark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--sage), var(--buddy));
  color: #0d1117;
  font-size: 11px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.logo-text em {
  font-style: normal;
  color: var(--text3);
  font-weight: 400;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 5px;
}

.bc-sep {
  color: var(--text3);
}

.bc-file {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text2);
}

/* Icon buttons */
.icon-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: background var(--transition), color var(--transition);
}

.icon-btn:hover {
  background: var(--bg3);
  color: var(--text);
}

.icon-btn.danger:hover {
  color: var(--sergeant);
}

/* Sidebar Icon */
.sidebar-icon {
  width: 18px;
  height: 18px;
  display: block;
}

.sidebar-icon .arrow-group {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: 13px 12px;
}

.sidebar-open-btn .sidebar-icon .arrow-group {
  transform: rotate(180deg);
}

/* Status */
.status-dot-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sage);
  box-shadow: 0 0 6px var(--sage-glow);
  animation: blink 2.5s ease-in-out infinite;
}

.status-dot.offline {
  background: var(--sergeant);
  box-shadow: 0 0 6px var(--sergeant-glow);
}

.status-text {
  font-size: 11px;
  color: var(--text2);
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .5;
  }
}

.nav-divider {
  width: 1px;
  height: 16px;
  background: var(--border2);
}

.nav-frustration {
  font-size: 11px;
  color: var(--text3);
  display: flex;
  gap: 5px;
}

.nav-frust-val {
  font-weight: 700;
  color: var(--text2);
  font-variant-numeric: tabular-nums;
}

/* ── WORKSPACE ───────────────────────────── */
.workspace {
  display: flex;
  height: 100vh;
  padding-top: var(--nav-h);
  position: relative;
}

.workspace-sidebar-toggle {
  position: absolute;
  top: calc(var(--nav-h) + 12px);
  left: 12px;
  z-index: 50;
  background: var(--bg2);
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  transition: left 280ms cubic-bezier(.4, 0, .2, 1);
}

.sidebar:not(.closed)~.main-area .workspace-sidebar-toggle,
.sidebar:not(.closed)+.workspace-sidebar-toggle {
  left: calc(var(--sidebar-w) + 12px);
}

/* ── SIDEBAR ─────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: rgba(13, 17, 23, .7);
  display: flex;
  flex-direction: column;
  transition: width 280ms cubic-bezier(.4, 0, .2, 1), opacity 240ms, padding 280ms;
  overflow: hidden;
}

.sidebar.closed {
  width: 0;
  opacity: 0;
  border-right: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 10px 48px;
  /* Extra left padding to clear the floating button when open */
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.history-badge {
  background: var(--bg3);
  color: var(--text2);
  border-radius: 99px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--mono);
}

.history-badge.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

/* Empty state */
.history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 32px 16px;
}

.empty-icon {
  font-size: 28px;
  opacity: .3;
}

.empty-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
}

.empty-sub {
  font-size: 10px;
  color: var(--text3);
  opacity: .6;
}

.sidebar-footer {
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.footer-note {
  font-size: 10px;
  color: var(--text3);
}

/* History cards */
.history-card {
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg2);
  cursor: pointer;
  margin-bottom: 4px;
  transition: all var(--transition);
}

.history-card:hover {
  border-color: var(--border2);
  background: var(--bg3);
  transform: translateY(-1px);
}

.history-card.active-card {
  border-color: var(--sage);
  background: var(--sage-dim);
}

.hc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 2px;
}

.hc-type {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hc-meta {
  font-size: 10px;
  color: var(--text3);
  font-family: var(--mono);
  flex-shrink: 0;
}

.hc-snippet {
  font-size: 10px;
  color: var(--text3);
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── MAIN AREA ───────────────────────────── */
.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.main-scroll {
  flex: 1;
  overflow-y: auto;
}

.workspace-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 18px 20px;
}

/* ── SECTION PRIMITIVES ──────────────────── */
.section {
  margin-bottom: 16px;
}

.section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text3);
  margin-bottom: 10px;
}

/* ── MENTOR SELECTOR ─────────────────────── */
.mentor-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.mentor-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border2);
  background: var(--bg2);
  cursor: pointer;
  transition: all var(--transition);
  outline: none;
}

.mentor-card:hover {
  border-color: var(--border2);
  background: var(--bg3);
  transform: translateY(-1px);
}

.mentor-emoji {
  font-size: 18px;
  line-height: 1;
}

.mentor-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 1px;
}

.mentor-sub {
  font-size: 10px;
  color: var(--text3);
}

/* Active states */
.active-sage {
  border-color: rgba(63, 185, 80, .4) !important;
  background: var(--sage-dim) !important;
  box-shadow: 0 0 18px var(--sage-glow);
}

.active-sergeant {
  border-color: rgba(248, 81, 73, .4) !important;
  background: var(--sergeant-dim) !important;
  box-shadow: 0 0 18px var(--sergeant-glow);
}

.active-buddy {
  border-color: rgba(88, 166, 255, .4) !important;
  background: var(--buddy-dim) !important;
  box-shadow: 0 0 18px var(--buddy-glow);
}

.sage-color {
  color: var(--sage) !important;
}

.sergeant-color {
  color: var(--sergeant) !important;
}

.buddy-color {
  color: var(--buddy) !important;
}

/* Frustration control */
.frustration-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 9px 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg2);
}

.frust-label {
  font-size: 10px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
  white-space: nowrap;
}

.frust-val {
  font-size: 12px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--sage);
  min-width: 16px;
  text-align: center;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 88px;
  height: 4px;
  border-radius: 99px;
  background: var(--bg3);
  outline: none;
  cursor: pointer;
  border: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--sage);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 2px rgba(63, 185, 80, .3);
  cursor: pointer;
  transition: transform var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* ── EDITOR PANEL ────────────────────────── */
.editor-panel {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg2);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: 0 4px 32px rgba(0, 0, 0, .35);
}

/* Tab bar */
.editor-tabbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 0 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  height: 38px;
}

.editor-tabs {
  display: flex;
  height: 100%;
}

.editor-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  border-right: 1px solid var(--border);
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text2);
  background: var(--bg2);
}

.tab-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sage);
  flex-shrink: 0;
}

.editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Language select */
.lang-select {
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text2);
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
}

.lang-select:hover {
  border-color: var(--border2);
}

.lang-select:focus {
  border-color: var(--sage);
}

/* File Actions */
.file-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  border-right: 1px solid var(--border);
  padding-right: 8px;
  margin-right: 2px;
}

.tool-btn {
  background: var(--bg3);
  border: 1px solid var(--border2);
  width: 26px;
  height: 26px;
  font-size: 13px;
  border-radius: var(--radius);
}

.tool-btn:hover {
  border-color: var(--sage);
  color: var(--sage);
}

/* Analyze button */
.analyze-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(63, 185, 80, .35);
  background: rgba(63, 185, 80, .1);
  color: #5de37a;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 0 10px rgba(63, 185, 80, .1);
  outline: none;
}

.analyze-btn:hover {
  background: rgba(63, 185, 80, .18);
  border-color: rgba(63, 185, 80, .6);
  box-shadow: 0 0 18px rgba(63, 185, 80, .2);
  transform: translateY(-1px);
}

.analyze-btn:active {
  transform: scale(.97);
}

.analyze-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

.btn-icon-wrap {
  font-size: 13px;
}

.analyze-btn.loading {
  background: var(--bg3);
  border-color: var(--border2);
  color: var(--text3);
  box-shadow: none;
}

/* Editor body */
.editor-body {
  display: flex;
  min-height: 180px;
  max-height: 300px;
}

.line-numbers {
  width: 36px;
  flex-shrink: 0;
  padding: 14px 0;
  text-align: right;
  padding-right: 8px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text3);
  line-height: 1.75rem;
  background: rgba(0, 0, 0, .2);
  border-right: 1px solid var(--border);
  user-select: none;
  overflow: hidden;
}

.code-area {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--mono);
  font-size: 12.5px;
  color: #79c0ff;
  padding: 14px 16px;
  line-height: 1.75rem;
  caret-color: var(--sage);
}

.code-area::placeholder {
  color: var(--text3);
}

/* Stderr */
.stderr-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: rgba(248, 81, 73, .03);
}

.stderr-label {
  font-size: 10px;
  font-family: var(--mono);
  color: rgba(248, 81, 73, .6);
  flex-shrink: 0;
}

.stderr-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--mono);
  font-size: 11.5px;
  color: rgba(248, 81, 73, .75);
  caret-color: var(--sergeant);
}

.stderr-input::placeholder {
  color: var(--text3);
}

/* Stdin inline row */
.stdin-row {
  background: rgba(88, 166, 255, .03);
  align-items: flex-start;
  padding: 8px 14px;
}

.stdin-row .stderr-label {
  color: rgba(88, 166, 255, .6);
  padding-top: 3px;
}

.stdin-inline {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: vertical;
  font-family: var(--mono);
  font-size: 11.5px;
  color: rgba(88, 166, 255, .85);
  caret-color: var(--buddy);
  line-height: 1.6;
  min-height: 42px;
  max-height: 120px;
}

.stdin-inline::placeholder {
  color: var(--text3);
}

/* ── RESULT PANEL ────────────────────────── */
.result-panel {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg2);
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .4);
}

/* Loading */
.loading-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px 0;
}

.skel-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg3);
  animation: shimmer 1.6s linear infinite;
}

.skel-lines {
  flex: 1;
}

.skel {
  height: 10px;
  border-radius: 5px;
  background: var(--bg3);
  animation: shimmer 1.6s linear infinite;
  margin-bottom: 6px;
}

.skel.full {
  width: 100%;
}

.skel.medium {
  width: 65%;
}

.skel.short {
  width: 40%;
}

.skel.xshort {
  width: 25%;
}

.skel.short2 {
  width: 50%;
}

.mt12 {
  margin-top: 4px;
  padding: 0 18px 16px;
}

@keyframes shimmer {
  0% {
    opacity: .5;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: .5;
  }
}

.typing-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  font-size: 11px;
  color: var(--text3);
}

.dots {
  display: flex;
  gap: 3px;
}

.dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text3);
  animation: typeDot 1.2s ease-in-out infinite;
}

@keyframes typeDot {

  0%,
  80%,
  100% {
    transform: scale(.7);
    opacity: .3;
  }

  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}

/* Result header */
.result-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.result-avatar {
  font-size: 24px;
  flex-shrink: 0;
}

.result-header-info {
  flex: 1;
}

.result-header-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.result-mentor-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.error-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text2);
}

.result-time {
  font-size: 10px;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 5px;
}

.live-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--sage);
}

.log-id {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--text3);
}

/* Result body */
.result-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.res-block {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.res-block-label {
  padding: 7px 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text3);
  background: var(--bg3);
}

.res-block-text {
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text2);
}

.res-block-text.italic {
  font-style: italic;
}

.res-block-text strong {
  color: var(--text);
}

.analogy-block {
  border-color: rgba(63, 185, 80, .2);
}

.analogy-block .res-block-label {
  background: rgba(63, 185, 80, .08);
}

.sage-label {
  color: var(--sage) !important;
}

.hint-block {
  border-color: rgba(227, 179, 65, .2);
}

.hint-block .res-block-label {
  background: rgba(227, 179, 65, .08);
}

.hint-label {
  color: var(--amber) !important;
}

.hint-block .res-block-text {
  color: rgba(227, 179, 65, .85);
}

.tip-block {
  border-color: rgba(163, 113, 247, .2);
}

.tip-block .res-block-label {
  background: rgba(163, 113, 247, .08);
}

.tip-label {
  color: var(--violet) !important;
}

.tip-block .res-block-text {
  color: rgba(163, 113, 247, .85);
}

/* Diff */
.diff-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.diff-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text3);
}

.diff-toggle {
  font-size: 11px;
  color: var(--text3);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color var(--transition);
  padding: 0;
}

.diff-toggle:hover {
  color: var(--text2);
}

.diff-panel {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.diff-cols {
  display: flex;
}

.diff-col {
  flex: 1;
  min-width: 0;
}

.diff-col:first-child {
  border-right: 1px solid var(--border);
}

.diff-col-label {
  padding: 5px 10px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.diff-before .diff-col-label {
  background: rgba(248, 81, 73, .1);
  color: var(--sergeant);
}

.diff-after .diff-col-label {
  background: rgba(63, 185, 80, .08);
  color: var(--sage);
}

.diff-code {
  padding: 10px;
  font-size: 11px;
  font-family: var(--mono);
  line-height: 1.65;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.diff-before .diff-code {
  background: rgba(248, 81, 73, .05);
  color: rgba(248, 81, 73, .8);
}

.diff-after .diff-code {
  background: rgba(63, 185, 80, .05);
  color: rgba(63, 185, 80, .8);
}

/* High-five */
.highfive-banner {
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--bg3), var(--bg2));
  text-align: center;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text2);
}

/* Result actions */
.result-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, .15);
}

.chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--text2);
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
}

.chip:hover {
  background: var(--border2);
  color: var(--text);
  transform: translateY(-1px);
}

.chip.chip-green {
  border-color: rgba(63, 185, 80, .3);
  background: rgba(63, 185, 80, .1);
  color: var(--sage);
}

.chip.chip-green:hover {
  background: rgba(63, 185, 80, .18);
  border-color: rgba(63, 185, 80, .5);
}

/* ── STATUS BAR ──────────────────────────── */
.statusbar {
  height: var(--sb-h);
  border-top: 1px solid var(--border);
  background: rgba(13, 17, 23, .9);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  flex-shrink: 0;
}

.sb-left,
.sb-right {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: var(--text3);
  font-family: var(--mono);
}

.sb-sep {
  color: var(--border2);
}

.sb-lang,
.sb-mentor {
  color: var(--text2);
}

/* Result border themes */
.result-sage .result-header {
  background: var(--sage-dim);
}

.result-sergeant .result-header {
  background: var(--sergeant-dim);
}

.result-buddy .result-header {
  background: var(--buddy-dim);
}

.result-sage {
  border-color: rgba(63, 185, 80, .25) !important;
}

.result-sergeant {
  border-color: rgba(248, 81, 73, .25) !important;
}

.result-buddy {
  border-color: rgba(88, 166, 255, .25) !important;
}

/* ── CUSTOM SCROLLBAR ────────────────────── */
.custom-scroll {
  scrollbar-width: thin;
  scrollbar-color: var(--bg3) transparent;
}

.custom-scroll::-webkit-scrollbar {
  width: 5px;
}

.custom-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.custom-scroll::-webkit-scrollbar-thumb {
  background: var(--bg3);
  border-radius: 99px;
}

.custom-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--border2);
}

textarea.code-area {
  scrollbar-width: thin;
  scrollbar-color: var(--bg3) transparent;
}

textarea.code-area::-webkit-scrollbar {
  width: 4px;
}

textarea.code-area::-webkit-scrollbar-thumb {
  background: var(--bg3);
  border-radius: 4px;
}

/* ── INLINE CODE ─────────────────────────── */
code.ic {
  font-family: var(--mono);
  background: rgba(108, 99, 255, .15);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: .9em;
  color: #c4b5fd;
}

/* ── ANIMATIONS ──────────────────────────── */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-up {
  animation: slideUp .35s cubic-bezier(.16, 1, .3, 1) forwards;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spin {
  display: inline-block;
  animation: spin .8s linear infinite;
}

/* ── RESPONSIVE ──────────────────────────── */
@media (max-width: 680px) {
  .frustration-control {
    margin-left: 0;
    width: 100%;
  }

  .mentor-row {
    flex-direction: column;
    align-items: stretch;
  }

  .breadcrumb {
    display: none;
  }

  :root {
    --sidebar-w: 220px;
  }
}

/* ── AI Agent Status (navbar) ─────────────── */
.agent-status-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: default;
}

.agent-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text3);
  flex-shrink: 0;
  transition: background .3s, box-shadow .3s;
}

.agent-dot.ai-online {
  background: var(--buddy);
  box-shadow: 0 0 6px var(--buddy-glow);
  animation: blink 2.5s ease-in-out infinite;
}

.agent-dot.ai-offline {
  background: var(--text3);
}

.agent-label {
  font-size: 11px;
  color: var(--text3);
  white-space: nowrap;
}

.agent-label.ai-online {
  color: var(--buddy);
}

/* ── AI / Fallback badge on result card ──── */
.ai-badge,
.fallback-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
}

.ai-badge {
  background: rgba(88, 166, 255, .15);
  border: 1px solid rgba(88, 166, 255, .3);
  color: var(--buddy);
}

.fallback-badge {
  background: rgba(163, 113, 247, .1);
  border: 1px solid rgba(163, 113, 247, .25);
  color: var(--violet);
}

/* =========================================
   Execution Panel & Run Button Styles
   ========================================= */

/* Run button */
.run-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(88, 166, 255, .35);
  background: rgba(88, 166, 255, .1);
  color: #79c0ff;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 0 10px rgba(88, 166, 255, .1);
  outline: none;
}

.run-btn:hover {
  background: rgba(88, 166, 255, .18);
  border-color: rgba(88, 166, 255, .6);
  box-shadow: 0 0 18px rgba(88, 166, 255, .2);
  transform: translateY(-1px);
}

.run-btn:active {
  transform: scale(.97);
}

.run-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
  background: var(--bg3);
  border-color: var(--border2);
  color: var(--text3);
  box-shadow: none;
}

.run-btn.loading {
  background: var(--bg3);
  border-color: var(--border2);
  color: var(--text3);
  box-shadow: none;
}

/* Execution Panel */
.execution-panel {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: #090b10;
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: 0 4px 32px rgba(0, 0, 0, .35);
  display: flex;
  flex-direction: column;
}

.exec-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}

.exec-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.exec-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.explain-error-btn {
  padding: 4px 10px;
  border-radius: var(--radius);
  border: 1px solid rgba(248, 81, 73, .4);
  background: rgba(248, 81, 73, .1);
  color: #ff7b72;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.explain-error-btn:hover {
  background: rgba(248, 81, 73, .2);
  transform: translateY(-1px);
}

.close-exec-btn {
  background: transparent;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 14px;
  transition: color var(--transition);
}

.close-exec-btn:hover {
  color: var(--text);
}

.exec-body {
  max-height: 250px;
  overflow-y: auto;
  padding: 12px 14px;
}

/* Stdin Area styling */
.stdin-area {
  width: 100%;
  min-height: 80px;
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  resize: vertical;
  line-height: 1.5;
  box-sizing: border-box;
  caret-color: var(--sage);
}

.stdin-area:focus {
  outline: none;
  border-color: var(--sage);
}

.stdin-area::placeholder {
  color: var(--text3);
}

.exec-output {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  color: #e6edf3;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.exec-output.error {
  color: #ff7b72;
}

/* Inline Terminal Input */
.inline-terminal-input {
  background: transparent;
  border: none;
  outline: none;
  color: #e2e8f0;
  font-family: inherit;
  font-size: inherit;
  width: 200px;
  caret-color: #38bdf8;
  margin: 0;
  padding: 0;
}

.inline-terminal-input:focus {
  border-bottom: 1px solid #38bdf8;
}

/* ── Interactive Execution Terminal Panel ─────────── */
.exec-panel {
  background: #0d1117;
  border: 1px solid #21293a;
  border-radius: 10px;
  margin: 12px 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 13px;
}

.exec-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #161b22;
  border-bottom: 1px solid #21293a;
}

.exec-title {
  flex: 1;
  color: #3fb950;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.exec-close-btn {
  background: transparent;
  border: none;
  color: #6e7681;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.2s;
}

.exec-close-btn:hover {
  color: #f85149;
}

.exec-kill-btn {
  background: rgba(248, 81, 73, 0.12);
  border: 1px solid rgba(248, 81, 73, 0.3);
  color: #f85149;
  cursor: pointer;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 4px;
  transition: all 0.2s;
}

.exec-kill-btn:hover {
  background: rgba(248, 81, 73, 0.25);
}

.exec-output {
  min-height: 160px;
  max-height: 280px;
  overflow-y: auto;
  padding: 10px 14px;
  white-space: pre-wrap;
  word-break: break-all;
  color: #e6edf3;
  background: #0d1117;
  line-height: 1.6;
}

.exec-stdin-row {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  border-top: 1px solid #21293a;
  background: #0d1117;
}

.exec-prompt {
  color: #3fb950;
  font-size: 13px;
  flex-shrink: 0;
}

.exec-stdin-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #7dd3fc;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  caret-color: #7dd3fc;
}

/* ── Run Code Button ───────────────────────────────── */
.run-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 16px;
  border-radius: 7px;
  border: 1px solid #3fb950;
  background: rgba(63, 185, 80, 0.12);
  color: #3fb950;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}

.run-btn:hover:not(:disabled) {
  background: rgba(63, 185, 80, 0.22);
  box-shadow: 0 0 10px rgba(63, 185, 80, 0.25);
}

.run-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}