/* =====================================================
   BKStudio - Retro-Modern Web IDE for Elektronika BK
   Theme: CRT Obsidian & Phosphor Glow
   ===================================================== */

:root {
  --bg-primary: #0a0d12;
  --bg-secondary: #121820;
  --bg-tertiary: #1a222d;
  --bg-hover: #242f3d;
  --border-color: #273544;
  --border-focus: #00ff66;

  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #586069;

  --accent-green: #00ff66;
  --accent-green-dim: #00b347;
  --accent-amber: #ffaa00;
  --accent-cyan: #00e5ff;
  --accent-red: #ff4d4f;

  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, 'Courier New', monospace;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --header-height: 48px;
  --statusbar-height: 28px;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.4;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
  background: #2a3746;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3b4d61;
}

/* Top Navigation Bar */
.studio-header {
  height: var(--header-height);
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  user-select: none;
  z-index: 100;
}

.brand, .brand-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #00ff66, #007733);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: bold;
  color: #000;
  font-size: 14px;
  text-decoration: none;
  box-shadow: 0 0 10px rgba(0, 255, 102, 0.3);
  transition: transform 0.15s ease;
}

.brand-icon:hover {
  transform: scale(1.05);
}

.brand-text-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1;
}

.brand-title-link {
  text-decoration: none;
  display: inline-block;
}

.brand-title {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.5px;
  color: #fff;
  line-height: 1.1;
}

.brand-title span {
  color: var(--accent-green);
}

.brand-copyright {
  font-size: 9.5px;
  color: var(--text-secondary);
  text-decoration: none;
  letter-spacing: 0.2px;
  line-height: 1.1;
  margin-top: 2px;
  white-space: nowrap;
  transition: color 0.15s ease, text-shadow 0.15s ease;
}

.brand-copyright:hover {
  color: var(--accent-green);
  text-decoration: underline;
  text-shadow: 0 0 6px var(--accent-green);
}

.brand-badge {
  font-size: 10px;
  padding: 2px 6px;
  background: rgba(0, 255, 102, 0.1);
  color: var(--accent-green);
  border: 1px solid rgba(0, 255, 102, 0.3);
  border-radius: 10px;
  font-family: var(--font-mono);
}

.header-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-group {
  display: flex;
  align-items: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 2px;
}

.tool-btn {
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 5px 10px;
  font-size: 12px;
  font-family: var(--font-ui);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.tool-btn:hover {
  background: var(--bg-hover);
  color: #fff;
}

.tool-btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent-green);
  color: #000;
  font-weight: bold;
  border-color: var(--accent-green);
  box-shadow: 0 0 10px rgba(0, 255, 102, 0.25);
}

.btn-primary:hover {
  background: #22ff77;
  color: #000;
  box-shadow: 0 0 14px rgba(0, 255, 102, 0.4);
}

.select-control {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

.select-control:focus {
  border-color: var(--accent-green);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Main Workspace */
.studio-workspace {
  display: flex;
  width: 100%;
  height: calc(100% - var(--header-height) - var(--statusbar-height));
  min-height: 0;
  position: relative;
  overflow: hidden;
}

/* Sidebar (Left) */
.sidebar {
  width: 250px;
  min-width: 160px;
  max-width: 400px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
}

.sidebar-section-header {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-actions {
  display: flex;
  gap: 4px;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 12px;
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.file-tree {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  padding: 4px 0;
}

.file-item {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  cursor: pointer;
  gap: 8px;
  color: var(--text-secondary);
  border-left: 3px solid transparent;
  font-family: var(--font-mono);
  font-size: 12px;
}

.file-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.file-item.active {
  background: rgba(0, 255, 102, 0.08);
  color: var(--accent-green);
  border-left-color: var(--accent-green);
  font-weight: 600;
}

.file-item .file-actions {
  margin-left: auto;
  display: none;
}

.file-item.is-bin .file-actions {
  display: flex;
  gap: 2px;
}

.file-item:hover .file-actions {
  display: flex;
  gap: 2px;
}

.file-item .btn-run-file {
  color: var(--accent-green) !important;
  font-weight: bold;
  padding: 1px 5px;
  font-size: 11px;
  border-radius: 3px;
  background: rgba(0, 255, 102, 0.12);
  border: 1px solid rgba(0, 255, 102, 0.3);
  transition: all 0.15s ease;
}

.file-item .btn-run-file:hover {
  background: var(--accent-green);
  color: #000 !important;
}

/* Центральная панель редактора */
.editor-panel {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  min-width: 300px;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

/* Вкладки файлов — фиксированная высота */
.editor-tabs {
  flex: 0 0 36px;
  height: 36px;
  min-height: 36px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: flex-end;
  padding: 0 4px;
  overflow-x: auto;
  overflow-y: hidden;
  user-select: none;
}

.tab {
  height: 32px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  margin-right: 4px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
}

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

.tab.active {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-top: 2px solid var(--accent-green);
  font-weight: bold;
}

.tab .tab-close {
  opacity: 0.6;
  border-radius: 50%;
  padding: 2px;
}

.tab .tab-close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

/* Editor Workspace */
.editor-workspace {
  flex: 1 1 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  position: relative;
  overflow: hidden;
}

/* Side Disassembler Panel (Left of Monaco Editor in Debug Mode) */
.side-disasm-panel {
  width: 390px;
  min-width: 200px;
  max-width: 480px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-color);
  flex-shrink: 0;
  overflow: hidden;
  z-index: 2;
}

.side-disasm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.side-disasm-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.side-disasm-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.side-disasm-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  margin: 0;
  padding: 4px 0;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  background: var(--bg-primary);
  color: var(--text-primary);
}

.side-disasm-splitter {
  width: 4px;
  cursor: col-resize;
  background: transparent;
  flex-shrink: 0;
  transition: background 0.15s ease;
  z-index: 3;
}

.side-disasm-splitter:hover,
.side-disasm-splitter.active {
  background: var(--accent-green);
}

/* Monaco Container */
#monaco-container {
  flex: 1 1 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
  background-color: var(--bg-primary);
  overflow: hidden;
}

/* Bottom Console / Output Panel */
.bottom-panel {
  flex: 0 0 245px;
  height: 245px;
  min-height: 36px;
  max-height: 400px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bottom-panel-header {
  height: 32px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
}

.bottom-tabs {
  display: flex;
  gap: 4px;
}

.bottom-tab {
  padding: 4px 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  border-radius: 4px;
}

.bottom-tab.active {
  background: var(--bg-hover);
  color: var(--accent-green);
}

.console-output {
  flex: 1;
  padding: 8px 12px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  /* white-space: pre-wrap; */
  word-break: break-all;
  line-height: 1.5;
}

.log-info { color: var(--accent-cyan); }
.log-success { color: var(--accent-green); }
.log-warning { color: var(--accent-amber); font-weight: bold; }
.log-error { color: var(--accent-red); font-weight: bold; }
.log-stdout { color: var(--text-primary); }

.log-clickable {
  cursor: pointer;
  border-radius: 2px;
  padding: 1px 3px;
  transition: background 0.1s ease;
}

.log-clickable:hover {
  text-decoration: underline;
  background: rgba(255, 255, 255, 0.08);
}

/* Right Panel (BK Emulator Runner) - строго фиксированный размер под pixel-perfect 512x384 */
.emulator-panel {
  width: 560px;
  min-width: 560px;
  max-width: 560px;
  flex: 0 0 560px;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.emulator-header {
  height: 36px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.emulator-header-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: bold;
}

.emulator-header-actions {
  display: flex;
  gap: 6px;
}

.emulator-frame-wrapper {
  flex: 1;
  position: relative;
  background: #000;
}

#emulator-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Splitter handles */
.splitter-h {
  width: 5px;
  cursor: col-resize;
  background: transparent;
  transition: background 0.2s;
  z-index: 10;
}
.splitter-h:hover, .splitter-h.active {
  background: var(--accent-green);
}

/* Сплиттер панели эмулятора заблокирован: размер панели фиксирован (Pixel Perfect 512×384) */
#splitter-emu {
  cursor: default !important;
  pointer-events: none !important;
  background: transparent !important;
}
#splitter-emu:hover {
  background: transparent !important;
}

#splitter-bottom {
  flex: 0 0 5px;
  height: 5px;
  min-height: 5px;
}

.splitter-v {
  height: 5px;
  cursor: row-resize;
  background: transparent;
  transition: background 0.2s;
  z-index: 10;
}
.splitter-v:hover, .splitter-v.active {
  background: var(--accent-green);
}

/* Status Bar */
.statusbar {
  height: var(--statusbar-height);
  background: #07090c;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  user-select: none;
}

.statusbar-left, .statusbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
}

.status-dot.compiling {
  background: var(--accent-amber);
  animation: pulse 0.8s infinite alternate;
}

@keyframes pulse {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

/* Modal dialogs */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-dialog {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  width: 500px;
  max-width: 90vw;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.modal-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 16px;
}

.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* =====================================================
   Стили панели отладочной информации (Debug Panel)
   ===================================================== */

.debug-panel {
  flex: 1 1 auto;
  height: 100%;
  min-height: 180px;
  max-height: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Секция outline — занимает оставшееся пространство */
.sidebar-section-outline {
  flex: 1 1 120px;
  min-height: 120px;
  max-height: 450px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Контент горячих клавиш — естественный размер */
.sidebar-hotkeys-content {
  flex-shrink: 0;
}

.debug-registers {
  flex: 0.5;
  overflow-y: auto;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
}

.debug-register-row {
  display: flex;
  align-items: center;
  padding: 2px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.debug-register-name {
  width: 50px;
  font-weight: bold;
  color: var(--text-secondary);
  font-size: 12px;
}

.debug-register-name.highlight {
  color: var(--accent-green);
  text-shadow: 0 0 4px rgba(0, 255, 102, 0.3);
}

.debug-register-value {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  margin-left: 10px;
}

.debug-register-value.highlight {
  color: var(--accent-green);
  font-weight: bold;
  text-shadow: 0 0 6px rgba(0, 255, 102, 0.2);
}

.debug-register-arrow {
  color: var(--text-muted);
  margin: 0 4px;
  font-size: 11px;
}

.debug-register-old {
  color: var(--text-secondary);
  text-decoration: line-through;
  opacity: 0.6;
  font-size: 11px;
}

.debug-register-new {
  color: var(--accent-green);
  font-weight: bold;
  font-size: 12px;
}

/* PSW регистр */
.debug-register-psw {
  display: flex;
  align-items: center;
  gap: 2px;
}

.psw-flag {
  display: inline-block;
  padding: 1px 3px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: bold;
  min-width: 14px;
  text-align: center;
}

.psw-flag.set {
  background: var(--accent-green);
  color: #000;
  box-shadow: 0 0 4px rgba(0, 255, 102, 0.3);
}

.psw-flag.unset {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.psw-flag-name {
  font-size: 9px;
  color: var(--text-muted);
  margin-left: 1px;
}

/* Стек */
.debug-stack {
  flex: 1;
  overflow-y: auto;
  padding: 6px 12px;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-primary);
  border-top: 1px solid var(--border-color);
  white-space: pre;
  min-height: 70px;
  max-height: 175px;
}

/* Системные регистры */
.debug-sysregs-header {
  padding: 6px 12px;
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
  font-family: var(--font-mono);
}

.debug-sysregs {
  flex: 0 1 auto;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 6px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
}

.debug-sysregs-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.35;
}

.debug-sysregs-table th {
  text-align: left;
  padding: 2px 4px;
  color: var(--text-muted);
  font-size: 9px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  font-weight: 600;
  text-transform: uppercase;
}

.debug-sysregs-table td {
  padding: 2px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  white-space: nowrap;
}

.debug-sysregs-table tr:hover {
  background: var(--bg-hover);
}

.sysreg-col-addr {
  width: 48px;
  color: var(--accent-cyan);
}

.sysreg-col-name {
  color: var(--text-secondary);
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sysreg-col-write {
  width: 46px;
  text-align: right;
  color: var(--accent-amber);
}

.sysreg-col-read {
  width: 46px;
  text-align: right;
  color: var(--accent-green);
}

.debug-format-switcher {
  display: flex;
  gap: 4px;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.format-btn {
  padding: 3px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  border-radius: 3px;
  transition: all 0.15s ease;
  letter-spacing: 0.5px;
}

.format-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.format-btn.active {
  background: var(--accent-green);
  color: #000;
  border-color: var(--accent-green);
  box-shadow: 0 0 6px rgba(0, 255, 102, 0.3);
}

.format-btn[data-format="dec"].active {
  background: var(--accent-amber);
  color: #000;
  border-color: var(--accent-amber);
  box-shadow: 0 0 6px rgba(255, 170, 0, 0.3);
}

.format-btn[data-format="bin"].active {
  background: var(--accent-cyan);
  color: #000;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 6px rgba(0, 229, 255, 0.3);
}

.debug-stack-header {
  padding: 6px 12px;
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border-top: none;
  font-family: var(--font-mono);
}

/* Панель управления отладкой */
.debug-control-panel {
  margin-top: auto;
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 8px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
}

.debug-ctrl-btn {
  flex: 1 1 auto;
  min-width: 0;
  padding: 4px 6px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  border-radius: 3px;
  transition: all 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.debug-ctrl-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent-green);
}

.debug-ctrl-btn:active {
  transform: translateY(1px);
}

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

.debug-ctrl-btn#btn-debug-pause.btn-paused,
.debug-ctrl-btn#btn-debug-pause.active {
  background: var(--accent-red) !important;
  color: #fff !important;
  border-color: #ff7875 !important;
  font-weight: 700 !important;
  box-shadow: 0 0 10px rgba(255, 77, 79, 0.75) !important;
}

.stack-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 1px 0;
}

.stack-line.sp-line {
  color: var(--accent-green);
  font-weight: bold;
  background: rgba(0, 255, 102, 0.06);
  padding: 1px 4px;
  border-radius: 2px;
}

.stack-address {
  color: var(--text-secondary);
  min-width: 60px;
  font-size: 11px;
}

.stack-value {
  color: var(--text-primary);
  font-size: 11px;
}

.stack-line.sp-line .stack-address,
.stack-line.sp-line .stack-value {
  color: var(--accent-green);
  text-shadow: 0 0 4px rgba(0, 255, 102, 0.2);
}

.stack-sp-marker {
  color: var(--accent-green);
  font-size: 10px;
  margin-left: auto;
  white-space: nowrap;
}

.stack-arrow {
  color: var(--text-muted);
  font-size: 10px;
  padding: 0 4px;
}

.debug-loading {
  color: var(--text-muted);
  font-style: italic;
  font-size: 11px;
}

/* =====================================================
   Memory View — просмотр памяти
   ===================================================== */

.memory-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.memory-toolbar {
  height: 32px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.memory-toolbar-left,
.memory-toolbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.memory-separator {
  color: var(--text-muted);
  font-size: 10px;
  margin: 0 2px;
}

.memory-btn {
  padding: 2px 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  border-radius: 3px;
  transition: all 0.15s ease;
  letter-spacing: 0.5px;
}

.memory-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.memory-btn.active {
  background: var(--accent-green);
  color: #000;
  border-color: var(--accent-green);
  box-shadow: 0 0 6px rgba(0, 255, 102, 0.3);
}

.mem-input {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--accent-green);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: center;
  outline: none;
}

.mem-input:focus {
  border-color: var(--accent-green);
}

.memory-header {
  height: 20px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 4px;
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  text-transform: uppercase;
}

.mem-col-addr {
  width: 60px;
  flex-shrink: 0;
}

.mem-col-data {
  flex: 1;
  text-align: right;
  padding-right: 10px;
}

.mem-col-ascii {
  width: 100px;
  flex-shrink: 0;
  margin-left: 10px;
  padding-left: 10px;
  border-left: 1px solid var(--border-color);
}

.memory-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 0;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre;
  margin: 0;
}

.memory-row {
  display: flex;
  align-items: center;
  padding: 0 4px;
  height: 18px;
  transition: background 0.1s ease;
}

.memory-row:hover {
  background: var(--bg-hover);
}

.memory-row.highlight {
  background: rgba(0, 255, 102, 0.08);
}

.memory-row.pc-row {
  background: rgba(0, 255, 102, 0.12);
  border-left: 2px solid var(--accent-green);
}

.memory-row.sp-row {
  background: rgba(255, 170, 0, 0.12);
  border-left: 2px solid var(--accent-amber);
}

.mem-row-addr {
  width: 60px;
  flex-shrink: 0;
  color: var(--text-secondary);
  font-size: 11px;
}

.mem-row-data {
  flex: 1;
  text-align: right;
  padding-right: 10px;
  color: var(--text-primary);
  font-size: 12px;
  letter-spacing: 1px;
}

.mem-row-ascii {
  width: 100px;
  flex-shrink: 0;
  margin-left: 10px;
  padding-left: 10px;
  border-left: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 12px;
}

/* Цвета символов ASCII */
.mem-row-ascii .ascii-printable {
  color: var(--text-primary);
}

.mem-row-ascii .ascii-space {
  color: var(--text-muted);
  opacity: 0.4;
}

.mem-row-ascii .ascii-control {
  color: var(--accent-red);
  opacity: 0.6;
}

/* =====================================================
   Debug View — декорации Monaco Editor
   ===================================================== */

/* Glyph margin area */
.monaco-editor .margin-layer {
  min-width: 25px !important;
}

/* Видимая полоса glyph margin */
.monaco-editor .minimap,
.monaco-editor .glyph-margin {
  border-left: 1px solid var(--accent-green) !important;
}

/* Подсветка текущей строки (PC) */
.debug-current-line {
  background-color: rgba(0, 255, 102, 0.15) !important;
}

/* Подсветка гутера текущей строки в Monaco (для isWholeLine) */
.debug-current-glyph {
  background: var(--accent-amber) !important;
  border-radius: 50% !important;
  width: 10px !important;
  height: 10px !important;
  margin-left: 3px !important;
}

/* Точка останова в glyph margin */
.breakpoint-glyph {
  background-color: var(--accent-red) !important;
  box-shadow: 0 0 6px rgba(255, 77, 79, 0.7) !important;
  border-radius: 50% !important;
  width: 10px !important;
  height: 10px !important;
  margin-left: 3px !important;
}

/* Видимая полоса glyph margin */
.monaco-editor .glyph-margin-view-zones {
  border-left: 2px solid var(--accent-green) !important;
  opacity: 0.6;
}

/* =====================================================
   Disasm Panel — панель дизассемблера
   ===================================================== */

.disasm-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-primary);
  overflow: hidden;
}

.disasm-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.disasm-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.disasm-pc-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-amber);
  background: rgba(255, 170, 0, 0.1);
  border: 1px solid rgba(255, 170, 0, 0.3);
  padding: 1px 7px;
  border-radius: 3px;
  letter-spacing: 0.05em;
}

.disasm-follow-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.disasm-follow-label input[type="checkbox"] {
  accent-color: var(--accent-green);
  cursor: pointer;
}

.disasm-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  margin: 0;
  padding: 4px 0;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  background: var(--bg-primary);
  color: var(--text-primary);
}

/* Строка дизассемблера */
.disasm-row {
  display: flex;
  align-items: center;
  padding: 1px 0;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.1s ease;
  white-space: nowrap;
}

.disasm-row:hover {
  background: var(--bg-hover);
}

/* Текущая строка PC */
.disasm-row.is-current {
  background: rgba(255, 170, 0, 0.12);
  border-left-color: var(--accent-amber);
}

.disasm-row.is-current .disasm-addr {
  color: var(--accent-amber);
  font-weight: bold;
}

/* Строка с breakpoint */
.disasm-row.has-breakpoint {
  border-left-color: var(--accent-red);
}

.disasm-row.has-breakpoint .disasm-bp-dot {
  background: var(--accent-red);
  box-shadow: 0 0 5px rgba(255, 77, 79, 0.7);
}

/* BP маркер */
.disasm-bp-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin: 0 5px 0 8px;
  flex-shrink: 0;
  background: transparent;
  transition: background 0.15s ease;
}

.disasm-row:hover .disasm-bp-dot {
  background: rgba(255, 77, 79, 0.3);
}

/* PC стрелка */
.disasm-pc-arrow {
  width: 14px;
  flex-shrink: 0;
  text-align: center;
  color: var(--accent-amber);
  font-size: 11px;
  font-weight: bold;
}

/* Адрес */
.disasm-addr {
  width: 56px;
  flex-shrink: 0;
  color: var(--text-secondary);
  font-size: 11px;
  padding-left: 4px;
}

/* Восьмеричные опкоды */
.disasm-hex {
  width: 145px;
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 11px;
  padding: 0 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Мнемоника */
.disasm-mnem {
  flex: 1;
  color: var(--text-primary);
  font-size: 12px;
  padding-right: 10px;
}

/* Ключевые слова дизассемблера подсвечиваем */
.disasm-mnem .disasm-op {
  color: var(--accent-green);
}

.disasm-mnem .disasm-arg {
  color: var(--accent-cyan);
}

/* =====================================================
   Стили панели структуры меток (Outline)
   ===================================================== */
.outline-tree {
  list-style: none;
  overflow-y: auto;
  padding: 4px 0;
}

.outline-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  cursor: pointer;
  color: var(--text-secondary);
  border-left: 2px solid transparent;
  font-family: var(--font-mono);
  font-size: 11px;
  transition: background 0.15s ease, color 0.15s ease;
}

.outline-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-left-color: var(--accent-green);
}

/* =====================================================
   Цветовые темы пользовательского интерфейса
   ===================================================== */

/* 1. CRT Янтарный люминофор */
body[data-theme="bk-crt-amber"] {
  --bg-primary: #100c08;
  --bg-secondary: #18130c;
  --bg-tertiary: #221a10;
  --bg-hover: #2e2316;
  --border-color: #3d2f1d;
  --border-focus: #ffaa00;
  --text-primary: #ffd899;
  --text-secondary: #aa9070;
  --text-muted: #705e48;
  --accent-green: #ffaa00;
  --accent-green-dim: #cc8800;
  --accent-amber: #ffaa00;
}
body[data-theme="bk-crt-amber"] .brand-icon {
  background: linear-gradient(135deg, #ffaa00, #995500);
  box-shadow: 0 0 10px rgba(255, 170, 0, 0.4);
}
body[data-theme="bk-crt-amber"] .btn-primary {
  background: linear-gradient(135deg, #ffaa00, #cc7700);
}

/* 2. SynthWave '84 */
body[data-theme="synthwave-84"] {
  --bg-primary: #262335;
  --bg-secondary: #241b2f;
  --bg-tertiary: #2a2139;
  --bg-hover: #34294f;
  --border-color: #34294f;
  --border-focus: #ff7edb;
  --text-primary: #ffffff;
  --text-secondary: #b3a0cc;
  --text-muted: #848bbd;
  --accent-green: #36f9f6;
  --accent-green-dim: #25b8b5;
  --accent-amber: #fede5d;
  --accent-cyan: #36f9f6;
  --accent-red: #fe4450;
}
body[data-theme="synthwave-84"] .brand-icon {
  background: linear-gradient(135deg, #ff7edb, #f92aad);
  box-shadow: 0 0 12px rgba(255, 126, 219, 0.5);
  color: #fff;
}
body[data-theme="synthwave-84"] .btn-primary {
  background: linear-gradient(135deg, #f92aad, #ff7edb);
  box-shadow: 0 0 8px rgba(249, 42, 173, 0.4);
  color: #fff;
}
body[data-theme="synthwave-84"] .tab.active {
  border-top: 2px solid #ff7edb;
}

/* 3. Dracula for VS Code */
body[data-theme="dracula"] {
  --bg-primary: #282a36;
  --bg-secondary: #21222c;
  --bg-tertiary: #343746;
  --bg-hover: #44475a;
  --border-color: #44475a;
  --border-focus: #bd93f9;
  --text-primary: #f8f8f2;
  --text-secondary: #bfbfbf;
  --text-muted: #6272a4;
  --accent-green: #50fa7b;
  --accent-green-dim: #38b259;
  --accent-amber: #ffb86c;
  --accent-cyan: #8be9fd;
  --accent-red: #ff5555;
}
body[data-theme="dracula"] .brand-icon {
  background: linear-gradient(135deg, #bd93f9, #ff79c6);
  box-shadow: 0 0 10px rgba(189, 147, 249, 0.4);
  color: #282a36;
}
body[data-theme="dracula"] .btn-primary {
  background: linear-gradient(135deg, #bd93f9, #9d65f5);
  color: #282a36;
  font-weight: 600;
}
body[data-theme="dracula"] .tab.active {
  border-top: 2px solid #bd93f9;
}

/* 4. Night Coder (Ember Variant) */
body[data-theme="night-coder-ember"] {
  --bg-primary: #030917;
  --bg-secondary: #070d1e;
  --bg-tertiary: #141926;
  --bg-hover: #252a36;
  --border-color: #1c2333;
  --border-focus: #f1836f;
  --text-primary: #c1c2c6;
  --text-secondary: #abadb2;
  --text-muted: #575b64;
  --accent-green: #85c3ab;
  --accent-green-dim: #5c9982;
  --accent-amber: #f1836f;
  --accent-cyan: #0bc2cb;
  --accent-red: #ff7575;
}
body[data-theme="night-coder-ember"] .brand-icon {
  background: linear-gradient(135deg, #f1836f, #d45d47);
  box-shadow: 0 0 10px rgba(241, 131, 111, 0.4);
  color: #fff;
}
body[data-theme="night-coder-ember"] .btn-primary {
  background: linear-gradient(135deg, #f1836f, #c74e39);
  color: #fff;
}
body[data-theme="night-coder-ember"] .tab.active {
  border-top: 2px solid #f1836f;
}

/* 5. VS Dark Modern */
body[data-theme="vs-dark"] {
  --bg-primary: #1e1e1e;
  --bg-secondary: #252526;
  --bg-tertiary: #2d2d30;
  --bg-hover: #3e3e42;
  --border-color: #3f3f46;
  --border-focus: #007acc;
  --text-primary: #d4d4d4;
  --text-secondary: #9da5b4;
  --text-muted: #6e7681;
  --accent-green: #4ec9b0;
  --accent-green-dim: #2e8b57;
  --accent-amber: #ce9178;
}
body[data-theme="vs-dark"] .brand-icon {
  background: linear-gradient(135deg, #007acc, #004c80);
  box-shadow: 0 0 10px rgba(0, 122, 204, 0.4);
  color: #fff;
}
body[data-theme="vs-dark"] .btn-primary {
  background: linear-gradient(135deg, #007acc, #005a9e);
  color: #fff;
}

/* 3. Monokai Retro */
body[data-theme="monokai"] {
  --bg-primary: #272822;
  --bg-secondary: #1e1f1c;
  --bg-tertiary: #383830;
  --bg-hover: #49483e;
  --border-color: #49483e;
  --border-focus: #a6e22e;
  --text-primary: #f8f8f2;
  --text-secondary: #a6a6a0;
  --text-muted: #75715e;
  --accent-green: #a6e22e;
  --accent-green-dim: #669900;
  --accent-amber: #fd971f;
}
body[data-theme="monokai"] .brand-icon {
  background: linear-gradient(135deg, #a6e22e, #558000);
  box-shadow: 0 0 10px rgba(166, 226, 46, 0.4);
  color: #000;
}
body[data-theme="monokai"] .btn-primary {
  background: linear-gradient(135deg, #a6e22e, #669900);
  color: #000;
}

/* 4. Классическая светлая тема */
body[data-theme="vs-light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f3f3f3;
  --bg-tertiary: #e5e5e5;
  --bg-hover: #dadada;
  --border-color: #cccccc;
  --border-focus: #007acc;
  --text-primary: #1f1f1f;
  --text-secondary: #505050;
  --text-muted: #808080;
  --accent-green: #0066cc;
  --accent-green-dim: #004c99;
  --accent-amber: #b36b00;
}
body[data-theme="vs-light"] .brand-icon {
  background: linear-gradient(135deg, #0066cc, #003d80);
  box-shadow: 0 0 8px rgba(0, 102, 204, 0.3);
  color: #fff;
}
body[data-theme="vs-light"] .btn-primary {
  background: linear-gradient(135deg, #0066cc, #004c99);
  color: #fff;
}
body[data-theme="vs-light"] .tab.active {
  background: #ffffff;
  color: #000;
  border-top: 2px solid #0066cc;
}

/* ==========================================================================
   BKStudio Bridge & Gryphon-MPI Panel Styles
   ========================================================================== */
.bridge-panel {
  display: flex;
  flex-direction: column;
  height: calc(100% - 32px);
  padding: 8px 12px;
  overflow-y: auto;
  box-sizing: border-box;
}

.bridge-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 100%;
}

.bridge-top-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
}

.bridge-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bridge-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: bold;
  color: var(--accent-green);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 4px;
}

.bridge-meta-tag {
  font-size: 10px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  background: var(--bg-secondary);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--border-color);
}

.bridge-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bridge-field-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  gap: 8px;
}

.bridge-label {
  color: var(--text-secondary);
  font-size: 11px;
}

.bridge-val {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
}

.bridge-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.bridge-checkbox {
  accent-color: var(--accent-green);
  cursor: pointer;
  width: 14px;
  height: 14px;
}

.bridge-checkbox-text {
  font-size: 11px;
  font-weight: bold;
  color: var(--text-primary);
}

.bridge-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 1px 6px;
  border-radius: 3px;
}

.bridge-status-badge.status-connected {
  color: var(--accent-green);
  background: rgba(0, 255, 102, 0.1);
  border: 1px solid rgba(0, 255, 102, 0.3);
}

.bridge-status-badge.status-disconnected {
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.bridge-status-badge.status-connecting {
  color: var(--accent-amber);
  background: rgba(255, 179, 0, 0.1);
  border: 1px solid rgba(255, 179, 0, 0.3);
}

.bridge-status-badge.status-error {
  color: #ff5555;
  background: rgba(255, 85, 85, 0.1);
  border: 1px solid rgba(255, 85, 85, 0.3);
}

.bridge-workflow-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 8px 10px;
}

.bridge-workflow-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: bold;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.bridge-workflow-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.workflow-step {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wf-step-title {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.wf-step-val {
  font-size: 11px;
  font-weight: bold;
  color: var(--text-primary);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wf-step-sub {
  font-size: 10px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.bridge-log-wrapper {
  flex: 1;
  min-height: 80px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
}

.bridge-log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  font-size: 11px;
  color: var(--text-secondary);
}

.bridge-log-content {
  flex: 1;
  margin: 0;
  padding: 6px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-secondary);
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

