/* Opcode table */
.opcode-filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.opcode-search {
  flex: 1;
  min-width: 150px;
  background: #1c1917;
  color: #d6d3d1;
  border: 1px solid #44403c;
  border-radius: 3px;
  padding: 6px 10px;
  font-family: "JetBrains Mono", "Courier New", monospace;
  font-size: 0.75rem;
}

.opcode-cat-filter {
  background: #1c1917;
  color: #d6d3d1;
  border: 1px solid #44403c;
  border-radius: 3px;
  padding: 6px;
  font-family: "JetBrains Mono", "Courier New", monospace;
  font-size: 0.75rem;
}

.opcode-official-toggle {
  font-size: 0.75rem;
  color: #78716c;
  cursor: pointer;
  white-space: nowrap;
}

.opcode-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.6rem;
  table-layout: fixed;
}

.opcode-grid th {
  background: #0d9488;
  color: #f5f5f4;
  padding: 4px 2px;
  font-weight: bold;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 1;
}

.opcode-grid th:first-child {
  width: 30px;
}

.opcode-grid td {
  border: 1px solid #44403c;
  padding: 3px 2px;
  text-align: center;
  vertical-align: top;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  line-height: 1.2;
  height: 48px;
  overflow: hidden;
}

.opcode-grid td:hover {
  transform: scale(1.05);
  z-index: 2;
  position: relative;
  box-shadow: 0 0 8px rgba(0,0,0,0.5);
}

/* Category background colors */
.grp-load { background: #1d4d3a; }
.grp-arith { background: #3a2a1d; }
.grp-branch { background: #2a1d3a; }
.grp-status { background: #3a3a1d; }
.grp-stack { background: #1d3a3a; }

/* Opcode categories */
.op-official { }
.op-illegal-stable { border-left: 2px solid #ccaa00 !important; }
.op-illegal-unstable {
  background: repeating-linear-gradient(45deg, transparent, transparent 3px, rgba(200,120,0,0.15) 3px, rgba(200,120,0,0.15) 6px) !important;
}
.op-kil {
  border: 1px solid #cc3333 !important;
}
.op-kil .op-mnemonic { color: #ff4444; }

.op-mnemonic { font-weight: bold; color: #f5f5f4; font-size: 0.65rem; }
.op-mode { color: #78716c; font-size: 0.55rem; }
.op-hex { color: #5eead4; font-size: 0.55rem; }
.op-cycles { color: #78716c; font-size: 0.55rem; }

/* Legend */
.opcode-legend {
  margin-top: 12px;
  padding: 8px;
  border: 1px solid #44403c;
  border-radius: 4px;
  font-size: 0.7rem;
}

.opcode-legend h4 {
  margin-bottom: 6px;
  color: #f5f5f4;
}

.legend-items, .legend-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 6px;
}

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

.legend-swatch {
  display: inline-block;
  width: 16px;
  height: 12px;
  border: 1px solid #44403c;
  border-radius: 2px;
}

.legend-swatch.op-official { background: #292524; }
.legend-swatch.op-illegal-stable { background: #292524; border-left: 3px solid #ccaa00; }
.legend-swatch.op-illegal-unstable { background: repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(200,120,0,0.3) 2px, rgba(200,120,0,0.3) 4px); }
.legend-swatch.op-kil { background: #292524; border: 1px solid #cc3333; }

/* Opcode detail panel */
.opcode-detail {
  margin-top: 12px;
  padding: 12px;
  background: #1c1917;
  border: 1px solid #0d9488;
  border-radius: 4px;
}
.opcode-detail.hidden { display: none; }
.opcode-detail h3 { color: #5eead4; margin-bottom: 8px; }
.opcode-detail p { margin-bottom: 6px; font-size: 0.8rem; }
.detail-header { display: flex; justify-content: space-between; align-items: center; }
.detail-close { background: none; border: none; color: #78716c; font-size: 1.2rem; cursor: pointer; }

/* Help section */
.help-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.help-tab-btn {
  background: #1c1917;
  color: #78716c;
  border: 1px solid #44403c;
  border-radius: 3px;
  padding: 6px 12px;
  font-family: "JetBrains Mono", "Courier New", monospace;
  font-size: 0.7rem;
  cursor: pointer;
}

.help-tab-btn:hover { color: #d6d3d1; }
.help-tab-btn.active { background: #0d9488; color: #f5f5f4; }

.help-content {
  font-size: 0.85rem;
  line-height: 1.6;
}

.help-content h2 { color: #f5f5f4; margin-bottom: 12px; font-size: 1.1rem; }
.help-content h3 { color: #14b8a6; margin: 16px 0 8px; font-size: 0.95rem; }
.help-content p, .help-text p { margin-bottom: 8px; }
.help-content code { background: #1c1917; padding: 1px 4px; border-radius: 2px; color: #5eead4; font-size: 0.8rem; }

/* Key cards */
.key-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  margin-bottom: 8px;
  background: #1c1917;
  border: 1px solid #44403c;
  border-radius: 4px;
}

.key-symbol {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 48px;
  background: #0d9488;
  color: #f5f5f4;
  font-size: 1.2rem;
  font-weight: bold;
  border-radius: 4px;
}

.key-info h4 { color: #f5f5f4; margin-bottom: 4px; font-size: 0.85rem; }
.key-short { color: #d6d3d1; margin-bottom: 4px; }
.key-long { color: #78716c; font-size: 0.8rem; margin-bottom: 4px; }
.key-shortcut kbd {
  background: #292524;
  border: 1px solid #44403c;
  border-radius: 3px;
  padding: 1px 6px;
  font-family: "JetBrains Mono", "Courier New", monospace;
  font-size: 0.75rem;
}

/* Instruction cards */
.instr-card {
  padding: 12px;
  margin-bottom: 8px;
  background: #1c1917;
  border: 1px solid #44403c;
  border-radius: 4px;
}

.instr-card h4 { color: #f5f5f4; margin-bottom: 4px; }
.instr-card h4 code { color: #5eead4; font-size: 1rem; }
.instr-category { font-size: 0.7rem; color: #14b8a6; text-transform: uppercase; }

.instr-flags {
  display: flex;
  gap: 6px;
  margin: 8px 0;
}

.flag-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid #44403c;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: bold;
}

.flag-indicator.flag-on { background: #0d9488; color: #f5f5f4; }
.flag-indicator.flag-off { background: #1c1917; color: #78716c; }

.instr-example {
  margin-top: 8px;
  padding: 8px;
  background: #1c1917;
  border-radius: 3px;
}

.instr-example pre { margin-bottom: 6px; }
.instr-example code { color: #5eead4; }
.example-hex { font-size: 0.75rem; }

/* Illegal opcode cards */
.illegal-card { border-left: 3px solid #ccaa00; }
.stability-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.65rem;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.stability-stable { background: #1a3a2a; color: #4aff8a; }
.stability-unstable { background: #3a2a1a; color: #ffaa44; }
.stability-halt { background: #3a1a1a; color: #ff4444; }

.warning-banner {
  background: #3a2a0a;
  border: 1px solid #aa7700;
  border-radius: 3px;
  padding: 6px 10px;
  font-size: 0.75rem;
  color: #ffcc44;
  margin-top: 8px;
}

/* Tutorial */
.tutorial-step {
  padding: 12px;
  margin-bottom: 8px;
  background: #1c1917;
  border: 1px solid #44403c;
  border-radius: 4px;
}

.tutorial-step h4 { color: #f5f5f4; margin-bottom: 6px; }
.tutorial-keys kbd {
  background: #0d9488;
  color: #f5f5f4;
  padding: 2px 8px;
  border-radius: 3px;
  margin: 0 2px;
  font-size: 0.75rem;
}

.tutorial-play-btn {
  margin-top: 8px;
  background: #0d9488;
  color: #f5f5f4;
  border: 1px solid #14b8a6;
  border-radius: 3px;
  padding: 4px 12px;
  cursor: pointer;
  font-family: "JetBrains Mono", "Courier New", monospace;
  font-size: 0.75rem;
}

/* Memory dump UI */
.memdump-form {
  margin-bottom: 16px;
}

.memdump-field {
  margin-bottom: 8px;
}

.memdump-field label {
  display: block;
  font-size: 0.75rem;
  color: #78716c;
  margin-bottom: 4px;
}

.memdump-field input,
.memdump-field textarea {
  width: 100%;
  background: #1c1917;
  color: #d6d3d1;
  border: 1px solid #44403c;
  border-radius: 3px;
  padding: 6px 10px;
  font-family: "JetBrains Mono", "Courier New", monospace;
  font-size: 0.8rem;
  resize: vertical;
}

.memdump-buttons {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.btn-save { background: #0d9488; }
.btn-load {
  background: #292524;
  border: 1px solid #44403c;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 3px;
  font-family: "JetBrains Mono", "Courier New", monospace;
  font-size: 0.75rem;
  color: #f5f5f4;
}

.memdump-status {
  margin-top: 8px;
  font-size: 0.75rem;
  min-height: 20px;
}
.status-success { color: #5eead4; }
.status-error { color: #ef4444; }

.memdump-recent h3 {
  color: #f5f5f4;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: #1c1917;
  border: 1px solid #44403c;
  border-radius: 3px;
  margin-bottom: 4px;
  font-size: 0.75rem;
}

.recent-title { flex: 1; color: #f5f5f4; }
.recent-date { color: #78716c; font-size: 0.65rem; }

.btn-recent-load {
  background: #0d9488;
  color: #f5f5f4;
  border: none;
  border-radius: 3px;
  padding: 2px 8px;
  cursor: pointer;
  font-family: "JetBrains Mono", "Courier New", monospace;
  font-size: 0.65rem;
}

.btn-recent-delete {
  background: none;
  border: none;
  color: #78716c;
  font-size: 1rem;
  cursor: pointer;
  padding: 0 4px;
}

.no-recent { color: #78716c; font-size: 0.8rem; }

/* Disassembly view */
.disasm-content {
  font-size: 0.75rem;
  font-family: "JetBrains Mono", "Courier New", monospace;
}

.disasm-line {
  padding: 2px 8px;
  border-bottom: 1px solid rgba(42, 62, 50, 0.3);
}

.disasm-line.current {
  background: rgba(14, 85, 56, 0.3);
  border-left: 3px solid #5eead4;
}

.disasm-addr { color: #78716c; }
.disasm-bytes { color: #14b8a6; }
.disasm-mnemonic { color: #f5f5f4; font-weight: bold; }
.disasm-operand { color: #5eead4; }

/* Memory viewer */
.memory-content {
  font-size: 0.7rem;
  font-family: "JetBrains Mono", "Courier New", monospace;
}

.mem-row {
  display: flex;
  gap: 4px;
  padding: 1px 4px;
  border-bottom: 1px solid rgba(42, 62, 50, 0.2);
}

.mem-addr { color: #78716c; min-width: 50px; }
.mem-byte { color: #5eead4; min-width: 20px; text-align: center; }
.mem-byte.nonzero { color: #f5f5f4; font-weight: bold; }
.mem-ascii { color: #78716c; margin-left: 8px; }
