:root {
  --bg-deep: #0a0e1a;
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #1c2333;
  --bg-surface: #21283b;
  --border: #30363d;
  --border-focus: #00ff41;
  --green: #00ff41;
  --green-dim: #00cc33;
  --amber: #ffb000;
  --cyan: #00d4ff;
  --magenta: #ff6ec7;
  --red: #ff4444;
  --yellow: #ffd700;
  --white: #e6edf3;
  --gray: #8b949e;
  --gray-dim: #484f58;

  --tok-label: #00e5ff;
  --tok-mnemonic: #00ff88;
  --tok-directive: #c586c0;
  --tok-register: #dcdcaa;
  --tok-number: #ffb86c;
  --tok-string: #ce9178;
  --tok-comment: #6a9955;
  --tok-operator: #cccccc;
  --tok-punctuation: #cccccc;
  --tok-unknown: #d4d4d4;
  --tok-whitespace: transparent;
}

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

body {
  background: var(--bg-deep);
  color: var(--white);
  font-family: 'JetBrains Mono', monospace;
  overflow: hidden;
  height: 100vh;
}

#root { height: 100vh; display: flex; flex-direction: column; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--gray-dim); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray); }

.app-root {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--bg-deep);
}

.app-header {
  background: linear-gradient(180deg, #0f1629 0%, #0a0e1a 100%);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  flex-shrink: 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chip-icon {
  color: var(--green);
  font-size: 22px;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(0, 255, 65, 0.5);
}

.header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.retro-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  color: var(--green);
  letter-spacing: 2px;
  text-shadow: 0 0 10px rgba(0, 255, 65, 0.5), 0 0 20px rgba(0, 255, 65, 0.2);
}

.header-sub {
  color: var(--gray);
  font-size: 10px;
  font-style: italic;
}

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

.header-badge {
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1px;
}

.badge-reg {
  background: rgba(255, 215, 0, 0.15);
  color: var(--yellow);
  border: 1px solid rgba(255, 215, 0, 0.4);
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.4);
  animation: pulse-badge 2s ease-in-out infinite;
}

.badge-fix {
  background: rgba(255, 176, 0, 0.15);
  color: var(--amber);
  border: 1px solid rgba(255, 176, 0, 0.4);
  text-shadow: 0 0 6px rgba(255, 176, 0, 0.4);
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.badge-highlight {
  background: rgba(0, 255, 136, 0.12);
  color: var(--green);
  border: 1px solid rgba(0, 255, 136, 0.35);
  text-shadow: 0 0 6px rgba(0, 255, 136, 0.4);
}

.badge-data {
  background: rgba(0, 212, 255, 0.1);
  color: var(--cyan);
  border: 1px solid rgba(0, 212, 255, 0.35);
  text-shadow: 0 0 6px rgba(0, 212, 255, 0.4);
}

.badge-ddcb {
  background: rgba(255, 106, 199, 0.12);
  color: var(--magenta);
  border: 1px solid rgba(255, 106, 199, 0.35);
  text-shadow: 0 0 6px rgba(255, 106, 199, 0.4);
}

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

.btn {
  border-radius: 4px;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  transition: all 0.15s ease;
  outline: none;
}

.btn:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-assemble {
  background: rgba(0, 255, 65, 0.12);
  color: var(--green);
  border: 1px solid var(--green);
  font-weight: 700;
}
.btn-assemble:hover:not(:disabled) {
  background: rgba(0, 255, 65, 0.22);
  box-shadow: 0 0 12px rgba(0, 255, 65, 0.3);
}

.btn-default {
  background: var(--bg-tertiary);
  color: var(--gray);
  border: 1px solid var(--border);
}
.btn-default:hover:not(:disabled) { color: var(--white); border-color: var(--gray); }

.btn-copied { color: var(--green) !important; border-color: var(--green) !important; }

.btn-ref-active {
  background: rgba(0, 212, 255, 0.1);
  color: var(--cyan);
  border: 1px solid var(--cyan);
}

.btn-reg-active {
  background: rgba(255, 215, 0, 0.12);
  color: var(--yellow);
  border: 1px solid var(--yellow);
}

.auto-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--gray);
  font-size: 11px;
  cursor: pointer;
}
.auto-toggle input { accent-color: var(--green); }

.toolbar-sep { width: 1px; height: 20px; background: var(--border); }

.toolbar-select {
  background: var(--bg-tertiary);
  color: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  outline: none;
  cursor: pointer;
}

.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

.panel { display: flex; flex-direction: column; min-width: 0; }
.panel-editor { flex: 1; border-right: 1px solid var(--border); }
.panel-output { flex: 1; display: flex; flex-direction: column; }
.panel-label {
  background: var(--bg-tertiary);
  padding: 3px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  color: var(--gray-dim);
  letter-spacing: 1px;
  flex-shrink: 0;
}

.editor-wrap {
  flex: 1;
  display: flex;
  overflow: hidden;
  background: var(--bg-primary);
  position: relative;
}

.scanline {
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0, 255, 65, 0.012) 2px, rgba(0, 255, 65, 0.012) 4px);
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 3;
}

.line-numbers {
  font-size: 13px;
  line-height: 20px;
  color: var(--gray-dim);
  text-align: right;
  user-select: none;
  padding: 8px 8px 8px 0;
  min-width: 38px;
  overflow: hidden;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
}

.line-num { height: 20px; padding-right: 4px; }
.line-num-error { color: var(--red); font-weight: 700; }
.line-num-warn { color: var(--amber); }

.editor-inner {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.highlight-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.highlight-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 20px;
  padding: 8px;
  white-space: pre;
  tab-size: 8;
  color: transparent;
}

.hl-line {
  height: 20px;
  min-height: 20px;
}

.hl-line-error { background: rgba(255, 68, 68, 0.08); }
.hl-line-warn { background: rgba(255, 215, 0, 0.06); }

.tok-label { color: var(--tok-label); font-weight: 700; }
.tok-mnemonic { color: var(--tok-mnemonic); }
.tok-directive { color: var(--tok-directive); font-weight: 600; }
.tok-register { color: var(--tok-register); }
.tok-number { color: var(--tok-number); }
.tok-string { color: var(--tok-string); }
.tok-comment { color: var(--tok-comment); font-style: italic; }
.tok-operator { color: var(--tok-operator); }
.tok-punctuation { color: var(--tok-punctuation); }
.tok-unknown { color: var(--tok-unknown); }
.tok-whitespace { }

.editor-textarea {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  color: transparent;
  caret-color: var(--green);
  border: none;
  outline: none;
  resize: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 20px;
  padding: 8px;
  white-space: pre;
  overflow-wrap: normal;
  tab-size: 8;
  overflow-y: auto;
  z-index: 2;
}

.editor-textarea::selection {
  background: rgba(0, 212, 255, 0.3);
  color: transparent;
}

.output-top { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.output-bottom { flex: 1; display: flex; flex-direction: column; overflow: hidden; border-top: 1px solid var(--border); }

.hex-dump-area {
  flex: 1;
  overflow: auto;
  padding: 8px 12px;
  background: var(--bg-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 18px;
}

.listing-area {
  flex: 1;
  overflow: auto;
  padding: 8px 12px;
  background: var(--bg-primary);
}

.empty-msg {
  color: var(--gray-dim);
  font-style: italic;
  padding: 20px;
  font-size: 12px;
}

.hex-dump { font-family: 'JetBrains Mono', monospace; font-size: 12px; line-height: 18px; }
.hex-line { white-space: pre; }
.hex-addr { color: var(--amber); }
.hex-sep { color: var(--gray-dim); }
.hex-byte { color: var(--cyan); }
.hex-byte-data { color: #5ec4b6; }
.hex-pad { color: var(--gray-dim); }
.hex-ascii { color: var(--magenta); }

.listing { font-family: 'JetBrains Mono', monospace; font-size: 12px; line-height: 18px; }
.listing-line { white-space: pre; border-left: 2px solid transparent; padding-left: 4px; }
.listing-error { background: rgba(255, 68, 68, 0.08); border-left-color: var(--red); }
.list-addr { color: var(--amber); }
.list-sep { color: var(--gray-dim); }
.list-hex { color: var(--cyan); }
.list-hex-data { color: #5ec4b6; }
.list-source { }

.console-panel {
  height: 90px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.console-output {
  flex: 1;
  overflow: auto;
  padding: 6px 12px;
  background: var(--bg-deep);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 18px;
}

.msg-success { color: var(--green); }
.msg-error { color: var(--red); }
.msg-warn { color: var(--amber); }
.msg-symbols { color: var(--gray); margin-top: 4px; }

.help-panel {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 480px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 10;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
}

.help-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
  font-size: 10px;
  color: var(--cyan);
  letter-spacing: 1px;
}

.help-close {
  background: none;
  border: none;
  color: var(--gray);
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
}
.help-close:hover { color: var(--white); }

.help-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.help-tab {
  flex: 1;
  background: var(--bg-secondary);
  border: none;
  color: var(--gray);
  padding: 6px 8px;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: all 0.15s ease;
  border-bottom: 2px solid transparent;
}
.help-tab:hover { color: var(--white); background: var(--bg-tertiary); }
.help-tab-active { color: var(--cyan); border-bottom-color: var(--cyan); background: var(--bg-tertiary); }
.help-tab-reg.help-tab-active { color: var(--yellow); border-bottom-color: var(--yellow); }

.help-search-wrap { padding: 8px 12px; }

.help-search {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 10px;
  color: var(--white);
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  outline: none;
}
.help-search:focus { border-color: var(--cyan); }

.help-content { flex: 1; overflow: auto; padding: 0 12px 12px; }

.help-section-regs {
  margin-bottom: 14px;
  padding: 8px;
  background: rgba(0, 255, 65, 0.03);
  border: 1px solid rgba(0, 255, 65, 0.08);
  border-radius: 4px;
}

.help-section-title {
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  letter-spacing: 1px;
}

.help-group { margin-bottom: 10px; }

.help-group-title {
  color: var(--amber);
  font-size: 10px;
  font-weight: 700;
  margin-bottom: 3px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
}
.help-group-reg { color: var(--magenta); }

.help-item { font-size: 11px; padding: 1px 0; display: flex; gap: 8px; align-items: center; }
.help-mnemonic { color: var(--cyan); min-width: 140px; flex-shrink: 0; }
.help-mnemonic-green { color: var(--green); min-width: 140px; flex-shrink: 0; font-weight: 500; }
.help-mnemonic-undoc { color: var(--magenta); min-width: 140px; flex-shrink: 0; }
.help-mnemonic-directive { color: var(--tok-directive); min-width: 140px; flex-shrink: 0; font-weight: 600; }
.help-desc { color: var(--gray); }

.undoc-badge {
  background: rgba(255, 106, 199, 0.15);
  color: var(--magenta);
  border: 1px solid rgba(255, 106, 199, 0.3);
  border-radius: 3px;
  padding: 0 4px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.directive-badge {
  background: rgba(197, 134, 192, 0.15);
  color: var(--tok-directive);
  border: 1px solid rgba(197, 134, 192, 0.3);
  border-radius: 3px;
  padding: 0 4px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.opcode-grid-wrap { font-size: 10px; }

.opcode-legend {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.legend-doc { color: var(--cyan); font-weight: 700; }
.legend-undoc { color: var(--magenta); font-weight: 700; }

.opcode-grid { display: flex; flex-direction: column; gap: 1px; overflow-x: auto; min-width: 0; }
.opcode-grid-header { display: flex; gap: 1px; position: sticky; top: 0; z-index: 2; }
.opcode-grid-corner { min-width: 30px; width: 30px; padding: 2px; text-align: center; background: var(--bg-tertiary); color: var(--amber); font-weight: 700; flex-shrink: 0; }
.opcode-grid-col-hdr { min-width: 56px; width: 56px; padding: 2px; text-align: center; background: var(--bg-tertiary); color: var(--amber); font-weight: 700; flex-shrink: 0; }
.opcode-grid-row { display: flex; gap: 1px; }
.opcode-grid-row-hdr { min-width: 30px; width: 30px; padding: 2px; text-align: center; background: var(--bg-tertiary); color: var(--amber); font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

.opcode-cell {
  min-width: 56px; width: 56px; padding: 2px 3px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 2px; cursor: default; transition: background 0.1s;
  flex-shrink: 0; text-align: center; min-height: 36px;
}
.opcode-cell:hover { filter: brightness(1.3); }
.opcode-doc { background: rgba(0, 212, 255, 0.08); border: 1px solid rgba(0, 212, 255, 0.15); }
.opcode-undoc { background: rgba(255, 106, 199, 0.06); border: 1px solid rgba(255, 106, 199, 0.12); }
.opcode-empty { background: var(--bg-primary); color: var(--gray-dim); }
.opcode-dimmed { opacity: 0.2; }

.opcode-mn { font-size: 7px; line-height: 1.2; color: var(--white); word-break: break-all; }
.opcode-doc .opcode-mn { color: var(--cyan); }
.opcode-undoc .opcode-mn { color: var(--magenta); }
.opcode-hex { font-size: 7px; color: var(--gray-dim); margin-top: 1px; }

/* ============================================================
   FILE TABS & PROJECT STYLES
   ============================================================ */

.file-tabs {
  display: flex;
  align-items: center;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
  padding: 0 2px;
  gap: 1px;
  min-height: 30px;
}

.file-tabs::-webkit-scrollbar { height: 3px; }
.file-tabs::-webkit-scrollbar-thumb { background: var(--gray-dim); }

.file-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--gray);
  cursor: pointer;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  border-radius: 4px 4px 0 0;
  white-space: nowrap;
  transition: all 0.15s ease;
  background: transparent;
  position: relative;
  margin-top: 2px;
}

.file-tab:hover {
  color: var(--white);
  background: var(--bg-tertiary);
}

.file-tab-active {
  color: var(--cyan);
  background: var(--bg-primary);
  border-color: var(--border);
  border-bottom-color: var(--bg-primary);
}

.file-tab-name {
  user-select: none;
}

.file-tab-input {
  background: var(--bg-primary);
  border: 1px solid var(--cyan);
  color: var(--white);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  padding: 1px 4px;
  outline: none;
  width: 100px;
  border-radius: 2px;
}

.file-tab-close {
  background: none;
  border: none;
  color: var(--gray-dim);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  border-radius: 2px;
  transition: all 0.1s;
}

.file-tab-close:hover {
  color: var(--red);
  background: rgba(255, 68, 68, 0.15);
}

.file-tab-add {
  background: none;
  border: 1px dashed var(--gray-dim);
  color: var(--gray-dim);
  cursor: pointer;
  font-size: 14px;
  font-family: 'JetBrains Mono', monospace;
  padding: 2px 8px;
  border-radius: 3px;
  margin: 2px 4px;
  transition: all 0.15s;
  line-height: 1;
}

.file-tab-add:hover {
  color: var(--green);
  border-color: var(--green);
  background: rgba(0, 255, 65, 0.08);
}

.panel-label-project {
  color: var(--cyan);
  font-size: 9px;
}

.btn-project {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.autosave-indicator {
  color: var(--green);
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  opacity: 0.8;
  padding: 2px 6px;
}

/* Project Modal */
.project-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease-out;
}

.project-modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 480px;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.project-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
  border-radius: 8px 8px 0 0;
  color: var(--amber);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
}

.project-modal-body {
  padding: 12px 16px;
  overflow-y: auto;
  flex: 1;
}

.btn-new-project {
  background: rgba(0, 255, 65, 0.08);
  color: var(--green);
  border: 1px dashed var(--green);
  width: 100%;
  padding: 8px;
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  border-radius: 4px;
  margin-bottom: 12px;
  transition: all 0.15s;
}

.btn-new-project:hover {
  background: rgba(0, 255, 65, 0.15);
}

.project-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.project-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  gap: 8px;
}

.project-item:hover {
  border-color: var(--cyan);
  background: rgba(0, 212, 255, 0.04);
}

.project-item-active {
  border-color: var(--green);
  background: rgba(0, 255, 65, 0.04);
}

.project-item-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.project-item-name {
  color: var(--white);
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-item-meta {
  color: var(--gray-dim);
  font-size: 10px;
}

.project-item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.project-action-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--gray);
  cursor: pointer;
  font-size: 12px;
  padding: 3px 6px;
  border-radius: 3px;
  transition: all 0.1s;
}

.project-action-btn:hover {
  color: var(--white);
  border-color: var(--gray);
}

.project-action-delete:hover {
  color: var(--red);
  border-color: var(--red);
  background: rgba(255, 68, 68, 0.1);
}

.project-rename-input {
  background: var(--bg-primary);
  border: 1px solid var(--cyan);
  color: var(--white);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  padding: 2px 6px;
  outline: none;
  border-radius: 2px;
  width: 100%;
}

.project-active-badge {
  background: rgba(0, 255, 65, 0.12);
  color: var(--green);
  border: 1px solid rgba(0, 255, 65, 0.3);
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

/* ============================================================
   REGISTER PANEL STYLES
   ============================================================ */

.reg-panel-content {
  padding: 12px 0 20px 0;
}

.reg-section {
  margin-bottom: 20px;
}

.reg-section-title {
  color: var(--yellow);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 215, 0, 0.2);
}

.reg-section-title-alt {
  color: #b8a038;
}

.reg-bit-header {
  display: flex;
  justify-content: space-between;
  padding: 0 2px;
  margin-bottom: 4px;
}

.reg-bit-header-wide {
  display: flex;
  justify-content: center;
  padding: 0 2px;
  margin-top: 12px;
  margin-bottom: 4px;
}

.reg-bit-label {
  color: var(--gray-dim);
  font-size: 9px;
  letter-spacing: 0.5px;
}

.reg-row {
  display: flex;
  gap: 0;
  margin-bottom: 1px;
}

.reg-cell {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  background: rgba(255, 215, 0, 0.06);
  border: 1px solid rgba(255, 215, 0, 0.18);
  border-radius: 2px;
  margin: 0 1px;
  transition: background 0.15s;
}

.reg-cell:hover {
  background: rgba(255, 215, 0, 0.12);
}

.reg-cell-wide {
  flex: 1;
}

.reg-cell-alt {
  background: rgba(184, 160, 56, 0.06);
  border-color: rgba(184, 160, 56, 0.18);
}

.reg-cell-alt:hover {
  background: rgba(184, 160, 56, 0.12);
}

.reg-cell-alt .reg-name {
  color: #b8a038;
}

.reg-cell-special {
  background: rgba(0, 212, 255, 0.06);
  border-color: rgba(0, 212, 255, 0.18);
}

.reg-cell-special:hover {
  background: rgba(0, 212, 255, 0.12);
}

.reg-cell-special .reg-name {
  color: var(--cyan);
}

.reg-name {
  color: var(--yellow);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  font-family: 'JetBrains Mono', monospace;
}

.reg-special-block {
  display: flex;
  justify-content: flex-end;
  gap: 0;
  margin-top: 12px;
  width: 50%;
  margin-left: auto;
}

.reg-row-half {
  flex: 1;
  display: flex;
}

.reg-row-half .reg-cell {
  flex: 1;
}

/* Flag register styles */
.flag-bit-header {
  display: flex;
  gap: 2px;
  margin-bottom: 2px;
  padding: 0 1px;
}

.flag-bit-num {
  flex: 1;
  text-align: center;
  color: var(--gray-dim);
  font-size: 9px;
}

.flag-bit-row {
  display: flex;
  gap: 2px;
  margin-bottom: 12px;
  padding: 0 1px;
}

.flag-bit-cell {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  background: rgba(255, 215, 0, 0.06);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 2px;
}

.flag-bit-cell:hover {
  background: rgba(255, 215, 0, 0.12);
}

.flag-bit-undoc {
  background: rgba(128, 128, 128, 0.04);
  border-color: rgba(128, 128, 128, 0.15);
}

.flag-bit-undoc .flag-bit-name {
  color: var(--gray);
  font-style: italic;
  opacity: 0.6;
}

.flag-bit-name {
  color: var(--yellow);
  font-size: 12px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

.flag-key {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.flag-key-item {
  font-size: 10px;
  display: flex;
  align-items: center;
  padding: 1px 0;
}

.flag-key-undoc .flag-key-name {
  color: var(--gray);
  font-style: italic;
}

.flag-key-undoc .flag-key-desc {
  color: var(--gray-dim);
  font-style: italic;
}

.flag-key-name {
  color: var(--yellow);
  font-weight: 700;
  min-width: 14px;
}

.flag-key-sep {
  color: var(--gray-dim);
}

.flag-key-desc {
  color: var(--gray);
}

/* ============================================================ */

.app-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 5px 16px;
  font-size: 10px;
  color: var(--gray-dim);
  display: flex;
  justify-content: space-between;
  flex-shrink: 0;
}
.footer-link { color: var(--cyan); text-decoration: none; }
.footer-link:hover { text-decoration: underline; }

@keyframes flashGreen {
  0% { background-color: rgba(0, 255, 65, 0.12); }
  100% { background-color: transparent; }
}
.flash-success { animation: flashGreen 0.6s ease-out; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.2s ease-out; }

@media (max-width: 768px) {
  .main-content { flex-direction: column !important; }
  .panel-editor { border-right: none; border-bottom: 1px solid var(--border); min-height: 200px; }
  .help-panel { width: 100%; }
  .retro-title { font-size: 11px; }
  .toolbar { padding: 4px 8px; gap: 4px; }
  .btn { padding: 4px 8px; font-size: 10px; }
  .header-badges { display: none; }
  .opcode-cell { min-width: 44px; width: 44px; }
  .opcode-grid-col-hdr { min-width: 44px; width: 44px; }
  .opcode-mn { font-size: 6px; }
}